Files
im_webapp/umd/index.prod.js
T

2 lines
233 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(n){var a={};function o(e){if(a[e])return a[e].exports;var t=a[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=a,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)o.d(n,a,function(e){return t[e]}.bind(null,a));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/umd/",o(o.s=7)}([function(e,t){e.exports=React},function(e,t){e.exports=ReactIntl},function(e,t){e.exports=Tinode},function(e,t){e.exports=ReactDOM},function(e){e.exports=JSON.parse('{"en":{"archived_contacts":"Archived contacts ({count})","contacts_not_found":"You have no chats<br />¯∖_(ツ)_/¯","full_name_prompt":"Full name, e.g. John Doe","email_prompt":"Email, e.g. jdoe@example.com","button_sign_up":"Sign up","validate_credential_action":"confirm","label_your_name":"Your name","label_password":"Password","password_unchanged_prompt":"Unchanged","label_message_sound":"Message sound:","label_push_notifications":"Notification alerts:","label_push_notifications_disabled":"Notification alerts (requires HTTPS):","title_tag_manager":"Tags (user discovery)","label_user_contacts":"Contacts:","label_user_id":"Address:","label_default_access_mode":"Default access mode:","button_logout":"Logout","label_legal":"Legal","link_contact_us":"Contact Us","link_terms_of_service":"Terms of Service","link_privacy_policy":"Privacy Policy","requested_permissions":"Requested","granted_permissions":"Granted","menu_item_edit_permissions":"Edit permissions","label_other_user":"Other","action_clear_messages":"Clear Messages","clear_messages_warning":"Are you sure you want to clear all messages? It cannot be undone.","action_delete_messages":"Clear Messages for All","delete_messages_warning":"Are you sure you want to delete all messages for everyone? It cannot be undone.","action_leave_chat":"Leave Conversation","leave_chat_warning":"Are you sure you want to leave this conversation?","action_block_contact":"Block Contact","block_contact_warning":"Are you sure you want to block this contact?","action_report_chat":"Report Conversation","report_chat_warning":"Are you sure you want to block and report this conversation?","title_info":"Info","label_topic_name":"Name","label_private":"Private comment","private_editing_placeholder":"Visible to you only","label_muting_topic":"Muted:","action_more":"More","label_your_permissions":"Your permissions:","label_permissions":"Permissions:","label_you":"You:","label_default_access":"Default access mode:","label_group_members":"Group members:","button_add_members":"Add members","group_has_no_members":"No members","login_prompt":"Login","password_prompt":"Password","stay_logged_in":"Stay logged in","forgot_password_link":"Forgot password?","button_sign_in":"Sign in","label_client":"Client:","label_server":"Server:","online_now":"online now","last_seen_timestamp":"Last seen","title_not_found":"Not found","unnamed_topic":"Unnamed","messages_not_readable":"no access to messages","peers_messaging_disabled":"Peer\'s messaging is disabled.","enable_peers_messaging":"Enable","search_for_contacts":"Use search to find contacts","search_no_results":"Search returned no results","tabtitle_find_user":"find","tabtitle_new_group":"new group","tabtitle_group_by_id":"by id","new_password_placeholder":"Enter new password","label_reset_password":"Send a password reset email:","credential_email_prompt":"Your registration email","button_reset":"Reset","button_send_request":"Send request","label_server_to_use":"Server to use:","label_wire_transport":"Wire transport:","button_update":"Update","sidepanel_title_login":"Sign In","sidepanel_title_register":"Create Account","sidepanel_title_settings":"Settings","sidepanel_title_edit_account":"Edit Account","sidepanel_title_newtpk":"Start New Chat","sidepanel_title_cred":"Confirm Credentials","sidepanel_title_reset":"Reset Password","sidepanel_title_archive":"Archived Chats","update_available":"Update available. <a href=\\"\\">Reload</a>.","reconnect_countdown":"Disconnected. Reconnecting in {seconds}…","reconnect_now":"Try now","phone_dative":"phone","email_dative":"email","enter_confirmation_code_prompt":"Enter confirmation code sent to you by {method}:","numeric_confirmation_code_prompt":"Numbers only","button_confirm":"Confirm","save_attachment":"save","deleted_content":"content deleted","invalid_content":"invalid content","user_not_found":"Not found","badge_you":"you","badge_owner":"owner","menu_item_info":"Info","menu_item_clear_messages":"Clear messages","menu_item_clear_messages_for_all":"Clear for All","menu_item_delete":"Delete","menu_item_delete_for_all":"Delete for All","menu_item_mute":"Mute","menu_item_unmute":"Unmute","menu_item_delete_topic":"Delete","topic_delete_warning":"Are you sure you want to delete this conversation?","menu_item_unblock":"Unblock","menu_item_block":"Block","topic_block_warning":"Are you sure you want to block this conversation?","menu_item_member_delete":"Remove","menu_item_archive_topic":"Archive","action_cancel":"cancel","upload_finishing":"finishing...","no_contacts":"You have no contacts :-(","contacts_not_found_short":"No contacts match \'{query}\'","title_group_members":"Group Members","title_all_contacts":"All Contacts","button_ok":"OK","button_cancel":"Cancel","more_online_members":"+{overflow} more","download_action":"download","label_file_name":"File name:","label_content_type":"Content type:","label_size":"Size:","chat_invitation":"You are invited to start a new chat. What would you like to do?","chat_invitation_accept":"Accept","chat_invitation_ignore":"Ignore","chat_invitation_block":"Block","error_invalid_id":"Invalid ID","group_user_id_prompt":"Group or User ID","button_subscribe":"Subscribe","topic_name_editing_placeholder":"Freeform name of the group","button_create":"Create","permission_join":"Join ({val})","permission_read":"Read ({val})","permission_write":"Write ({val})","permission_pres":"Get notified ({val})","permission_admin":"Approve ({val})","permission_share":"Share ({val})","permission_delete":"Delete ({val})","permission_owner":"Owner ({val})","title_permissions":"Permissions","message_sending":"sending...","message_sending_failed":"failed","search_placeholder":"List like email:alice@example.com, tel:17025550003...","messaging_disabled_prompt":"Messaging disabled","new_message_prompt":"New message","file_attachment_too_large":"The file size {size} exceeds the {limit} limit.","cannot_initiate_file_upload":"Cannot initiate file upload.","tags_not_found":"No tags defined. Add some.","tags_editor_no_tags":"Add some tags","title_manage_tags":"Manage"},"ru":{"contacts_not_found":"Чатов нет<br />¯∖_(ツ)_/¯","full_name_prompt":"Полное имя, напр. Иван Петров","email_prompt":"Email, напр. ivan@example.com","button_sign_up":"Создать аккаунт","label_your_name":"Ваше имя","label_password":"Пароль","password_unchanged_prompt":"Не изменен","label_user_id":"Адрес:","label_default_access_mode":"Доступ по умолчанию:","label_message_sound":"Звук нового сообщения:","label_push_notifications":"Уведомления:","label_push_notifications_disabled":"Уведомления (требуют HTTPS):","title_tag_manager":"Теги для поиска","button_logout":"Выйти","login_prompt":"Логин","password_prompt":"Пароль","stay_logged_in":"Запомнить","forgot_password_link":"Напомнить пароль","button_sign_in":"Войти","label_client":"Клиент:","label_server":"Сервер:","online_now":"онлайн","last_seen_timestamp":"Был активен","title_not_found":"Не найден","unnamed_topic":"Без названия","messages_not_readable":"нет доступа к сообщениям","tabtitle_find_user":"найти","tabtitle_new_group":"создать","tabtitle_group_by_id":"по id","label_server_to_use":"Использовать сервер:","label_wire_transport":"Соединение:","button_update":"Применить","sidepanel_title_login":"Авторизация","sidepanel_title_register":"Зарегистрироваться","sidepanel_title_settings":"Настройки","sidepanel_title_edit_account":"Редактировать аккаунт","sidepanel_title_newtpk":"Новый чат","sidepanel_title_cred":"Подтвердить","sidepanel_title_reset":"Сменить пароль","tags_not_found":"Тегов нет. Добавьте","tags_editor_no_tags":"Добавьте теги","title_manage_tags":"Редактировать","message_sending":"в пути...","message_sending_failed":"ошибка","search_placeholder":"Список, напр. email:alice@example.com, tel:+17025550003...","messaging_disabled_prompt":"Отправка недоступна","new_message_prompt":"Новое сообщение","file_attachment_too_large":"Размер файла {size} превышает {limit} лимит.","cannot_initiate_file_upload":"Ошибка загрузки файла.","search_for_contacts":"Поиск контактов","enter_confirmation_code_prompt":"Код подтверждения, полученный по {method}:","numeric_confirmation_code_prompt":"Только цифры","button_confirm":"Подтвердить","button_ok":"OK","button_cancel":"Отменить","invalid_content":"сообщение не читается","label_file_name":"Имя файла:","label_content_type":"Тип:","label_size":"Размер:","phone_dative":"телефону","email_dative":"емейлу","title_group_members":"Участники","download_action":"скачать","permission_join":"Подписываться ({val})","permission_read":"Читать ({val})","permission_write":"Писать ({val})","permission_pres":"Уведомлять ({val})","permission_admin":"Подтверждать ({val})","permission_share":"Приглашать ({val})","permission_delete":"Удалять ({val})","permission_owner":"Владелец ({val})","title_permissions":"Права доступа","requested_permissions":"Требуются","granted_permissions":"Получены","menu_item_edit_permissions":"Права доступа","label_other_user":"Второй","label_topic_name":"Название","label_private":"Комментарий","private_editing_placeholder":"Виден только вам","label_muting_topic":"Без уведомлений","action_more":"Ещё","label_your_permissions":"Ваши права доступа:","label_permissions":"Права доступа:","label_you":"Вы:","label_default_access":"Права по умолчанию:","label_group_members":"Участники чата:","button_add_members":"Добавить","group_has_no_members":"Нет участников","action_leave_chat":"Уйти из чата","menu_item_info":"Информация","menu_item_clear_messages":"Удалить сообщения","menu_item_clear_messages_for_all":"Удалить для всех","menu_item_delete":"Удалить","menu_item_delete_for_all":"Удалить для всех","menu_item_mute":"Не уведомлять","menu_item_unmute":"Уведомлять","menu_item_delete_topic":"Удалить чат","menu_item_unblock":"Разблокировать","menu_item_block":"Заблокировать","menu_item_member_delete":"Отписать","title_info":"Подробности","new_password_placeholder":"Введите новый пароль","label_reset_password":"Отправить емейл для смены пароля:","credential_email_prompt":"Регистрационный емейл","button_reset":"Изменить","button_send_request":"Отправить","action_cancel":"отменить","upload_finishing":"завершение...","no_contacts":"Ничего нет :-(","contacts_not_found_short":"Нет контактов для запроса \'{query}\'","title_all_contacts":"Все контакты","error_invalid_id":"Неверный ID","group_user_id_prompt":"ID чата или пользователя","button_subscribe":"Подписаться","topic_name_editing_placeholder":"Название чата","button_create":"Создать","badge_you":"вы","badge_owner":"влад.","update_available":"Есть новая версия приложения. <a href=\\"\\">Обновить</a>.","user_not_found":"Не найден","reconnect_countdown":"Нет связи. Подключение через {seconds}…","reconnect_now":"Подключить сейчас.","save_attachment":"сохранить","menu_item_archive_topic":"В архив","archived_contacts":"Чаты в архиве ({count})","sidepanel_title_archive":"Архив чатов","chat_invitation":"Вас пригласили начать новый чат. Как вы хотите поступить?","chat_invitation_accept":"Принять","chat_invitation_ignore":"Игнорировать","chat_invitation_block":"Заблокировать","peers_messaging_disabled":"Чат заблокирован у корреспондента.","enable_peers_messaging":"Разблокировать.","more_online_members":"+еще {overflow}","label_user_contacts":"Конакты:","validate_credential_action":"подтвердить","label_legal":"Прочее","link_contact_us":"Связаться с нами","link_terms_of_service":"Условия сервиса","link_privacy_policy":"Политика конфиденциальности","action_delete_messages":"Удалить сообщения","action_block_contact":"Заблокировать контакт","action_report_chat":"Сообщить о нарушении","delete_messages_warning":"Вы действительно хотите удалить все сообщения?","leave_chat_warning":"Вы действительно хотите покинуть этот чат?","block_contact_warning":"Вы действительно заблокировать этот контакт?","report_chat_warning":"Вы действительно хотите сообщить о нарушении и заблокировать этот чат?","action_clear_messages":"Удалить сообщения","clear_messages_warning":"Вы действительно хотите удалить все сообщения в чате? Их будет невозможно восстановить.","topic_delete_warning":"Вы действительно хотите удалить этот чат?","topic_block_warning":"Вы действительно хотите заблокировать этот чат?","search_no_results":"Ничего не найдено","deleted_content":"удалено"},"zh":{"archived_contacts":"已归档联系人 ({count})","contacts_not_found":"你尚无会话<br />¯∖_(ツ)_/¯","full_name_prompt":"全名,例如张伟","email_prompt":"电子邮件,例如 zhang@example.com","button_sign_up":"注册","label_your_name":"你的姓名","label_password":"密码","password_unchanged_prompt":"未改变","label_user_id":"地址:","label_default_access_mode":"蓦然访问模式:","label_message_sound":"消息提示音:","label_push_notifications":"通知提醒:","label_push_notifications_disabled":"通知提醒(需要 HTTPS):","title_tag_manager":"标签(用户发现)","button_logout":"登出","requested_permissions":"已请求","granted_permissions":"已授予","menu_item_edit_permissions":"编辑权限","label_other_user":"其他","title_info":"信息","label_topic_name":"名称","label_private":"私人评论","private_editing_placeholder":"仅自己可见","label_muting_topic":"已静音:","action_more":"更多","label_your_permissions":"你的权限:","label_permissions":"权限:","label_you":"你:","label_default_access":"默认权限模式:","label_group_members":"群组成员:","button_add_members":"添加成员","group_has_no_members":"无成员","action_leave_chat":"离开","login_prompt":"登录","password_prompt":"密码","stay_logged_in":"保持登录","forgot_password_link":"忘记密码?","button_sign_in":"登录","label_client":"客户端:","label_server":"服务器:","online_now":"在线","last_seen_timestamp":"最后可见","title_not_found":"无法找到","unnamed_topic":"未命名","messages_not_readable":"无消息访问权限","peers_messaging_disabled":"成员间消息已禁用。","enable_peers_messaging":"启用","tabtitle_find_user":"搜索","tabtitle_new_group":"新群组","tabtitle_group_by_id":"通过 id","search_for_contacts":"使用搜索寻找联系人","new_password_placeholder":"输入新密码","label_reset_password":"发送密码重置邮件:","credential_email_prompt":"你的注册邮箱","button_reset":"重置","button_send_request":"发送请求","label_server_to_use":"使用的服务器:","label_wire_transport":"线路传输:","button_update":"更新","sidepanel_title_login":"登录","sidepanel_title_register":"创建账户","sidepanel_title_settings":"设置","sidepanel_title_edit_account":"编辑账户","sidepanel_title_newtpk":"开始新会话","sidepanel_title_cred":"确认凭据","sidepanel_title_reset":"重置密码","sidepanel_title_archive":"已存档会话","update_available":"更新可用。<a href=\\"\\">重新载入</a>.","reconnect_countdown":"连接已断开。{seconds} 秒后重新连接…","reconnect_now":"立即尝试","phone_dative":"电话","email_dative":"电子邮件","enter_confirmation_code_prompt":"输入通过{method}发送的验证码:","numeric_confirmation_code_prompt":"仅数字","button_confirm":"确认","save_attachment":"保存","invalid_content":"无效内容","user_not_found":"未找到","badge_you":"你","badge_owner":"所有者","menu_item_info":"信息","menu_item_clear_messages":"清空消息","menu_item_clear_messages_for_all":"全部清除","menu_item_delete":"删除","menu_item_delete_for_all":"全部删除","menu_item_mute":"静音","menu_item_unmute":"取消静音","menu_item_delete_topic":"删除","menu_item_unblock":"取消屏蔽","menu_item_block":"屏蔽","menu_item_member_delete":"移除","menu_item_archive_topic":"归档","action_cancel":"取消","upload_finishing":"正在结束...","no_contacts":"你尚无联系人 :-(","contacts_not_found_short":"无联系人匹配 \'{query}\'","title_group_members":"群组成员","title_all_contacts":"全部联系人","button_ok":"好","button_cancel":"取消","download_action":"下载","label_file_name":"文件名:","label_content_type":"内容类型:","label_size":"大小:","chat_invitation":"你受邀开始新会话。你想怎么做?","chat_invitation_accept":"接受","chat_invitation_ignore":"忽略","chat_invitation_block":"屏蔽","error_invalid_id":"无效 ID","group_user_id_prompt":"群组或用户 ID","button_subscribe":"订阅","topic_name_editing_placeholder":"群组自由格式名称","button_create":"创建","permission_join":"加入 ({val})","permission_read":"读取 ({val})","permission_write":"写入 ({val})","permission_pres":"获取通知 ({val})","permission_admin":"批准 ({val})","permission_share":"分享 ({val})","permission_delete":"删除 ({val})","permission_owner":"所有者 ({val})","title_permissions":"权限","message_sending":"正在发送...","message_sending_failed":"发送失败","search_placeholder":"列表如 email:alice@example.com, tel:+17025550003...","messaging_disabled_prompt":"消息已禁用","new_message_prompt":"新消息","file_attachment_too_large":"文件大小 {size} 超过 {limit} 限制。","cannot_initiate_file_upload":"无法初始化文件上传。","tags_not_found":"尚未定义标签。添加一些。","tags_editor_no_tags":"添加一些标签","title_manage_tags":"管理标签","more_online_members":"还有{overflow}个","label_user_contacts":"往来:","validate_credential_action":"确认","label_legal":"法律东西","link_contact_us":"联系我们","link_terms_of_service":"条款和条件","link_privacy_policy":"隐私政策","action_delete_messages":"删除所有帖子","action_block_contact":"屏蔽联系人","action_report_chat":"检举垃圾邮件","deleted_content":"内容已删除"}}')},function(e,t){e.exports=firebase},function(e,t){e.exports=firebase.messaging},function(e,t,n){"use strict";n.r(t);var a=n(0),E=n.n(a),o=n(3),r=n.n(o),S=n(1),i=n(4),s=n(5),l=(n(6),n(2)),k=n.n(l);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function d(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var m,f,b=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(g,E.a.PureComponent),u((m=g).prototype,[{key:"render",value:function(){return this.props.visible?E.a.createElement("div",{className:"alert-container"},E.a.createElement("div",{className:"alert"},E.a.createElement("div",{className:"title"},this.props.title),E.a.createElement("div",{className:"content"},this.props.content),E.a.createElement("div",{className:"dialog-buttons"},this.props.onReject?E.a.createElement("button",{className:"outline",onClick:this.props.onReject},this.props.reject||E.a.createElement(S.FormattedMessage,{id:"button_cancel"})):null,E.a.createElement("button",{className:"blue",onClick:this.props.onConfirm},this.props.confirm||E.a.createElement(S.FormattedMessage,{id:"button_ok"}))))):null}}]),f&&u(m,f),g);function g(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,g),d(this,p(g).apply(this,arguments))}var y="TinodeWeb/0.16.3-rc5",v={hosted:"web.tinode.co",local:"localhost:6060"},_=v.hosted,w="JRWPS",C=195840;function M(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var O,T,P,j=(O=N,P=[{key:"parseUrlHash",value:function(e){var t=e.split("?",2),n={},a=[];return t[0]&&(a=t[0].substr(1).split("/")),t[1]&&t[1].split("&").forEach(function(e){var t=e.split("=");t[0]&&(n[decodeURIComponent(t[0])]=decodeURIComponent(t[1]))}),{path:a,params:n}}},{key:"navigateTo",value:function(e){window.location.hash=e}},{key:"composeUrlHash",value:function(e,t){var n=e.join("/"),a=[];for(var o in t)t.hasOwnProperty(o)&&a.push(o+"="+t[o]);return 0<a.length&&(n+="?"+a.join("&")),n}},{key:"addUrlParam",value:function(e,t,n){var a=this.parseUrlHash(e);return a.params[t]=n,this.composeUrlHash(a.path,a.params)}},{key:"removeUrlParam",value:function(e,t){var n=this.parseUrlHash(e);return delete n.params[t],this.composeUrlHash(n.path,n.params)}},{key:"setUrlSidePanel",value:function(e,t){var n=this.parseUrlHash(e);return n.path[0]=t,this.composeUrlHash(n.path,n.params)}},{key:"setUrlTopic",value:function(e,t){var n=this.parseUrlHash(e);return n.path[1]=t,delete n.params.info,this.composeUrlHash(n.path,n.params)}}],(T=null)&&M(O.prototype,T),P&&M(O,P),N);function N(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,N)}function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function F(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var R,I,L=Object(S.defineMessages)({info:{id:"menu_item_info",defaultMessage:"Info"},clear_messages:{id:"menu_item_clear_messages",defaultMessage:"Clear messages"},clear_for_all:{id:"menu_item_clear_messages_for_all",defaultMessage:"Clear for All"},delete:{id:"menu_item_delete",defaultMessage:"Delete"},delete_for_all:{id:"menu_item_delete_for_all",defaultMessage:"Delete for All"},mute:{id:"menu_item_mute",defaultMessage:"Mute"},unmute:{id:"menu_item_unmute",defaultMessage:"Unmute"},topic_delete:{id:"menu_item_delete_topic",defaultMessage:"Delete"},topic_delete_warning:{id:"topic_delete_warning",defaultMessage:"Are you sure you want to delete this conversation?"},unblock:{id:"menu_item_unblock",defaultMessage:"Unblock"},block:{id:"menu_item_block",defaultMessage:"Block"},topic_block_warning:{id:"topic_block_warning",defaultMessage:"Are you sure you want to block this conversation?"},member_delete:{id:"menu_item_member_delete",defaultMessage:"Remove"},archive:{id:"menu_item_archive_topic",defaultMessage:"Archive"}}),q=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(H,E.a.Component),F((R=H).prototype,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.handlePageClick,!1),document.addEventListener("keyup",this.handleEscapeKey,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.handlePageClick,!1),document.removeEventListener("keyup",this.handleEscapeKey,!1)}},{key:"handlePageClick",value:function(e){r.a.findDOMNode(this).contains(e.target)||(e.preventDefault(),e.stopPropagation(),this.props.hide())}},{key:"handleEscapeKey",value:function(e){27===e.keyCode&&this.props.hide()}},{key:"handleClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.hide();var t=this.props.items[e.currentTarget.dataset.id];"string"==typeof t&&(t=this.MenuItems[t]),t?this.props.onAction(t.id,t.handler(this.props.params,this.props.onError),this.props.params):console.log("Invalid menu item ID",e.currentTarget.dataset.id)}},{key:"deleteMessages",value:function(e,t,n,a){var o=this.props.tinode.getTopic(n.topicName);if(o){if(e||!o.cancelSend(n.seq))return(e?o.delMessagesAll(t):o.delMessagesList([n.seq],t)).catch(function(e){a&&a(e.message,"err")})}else console.log("Topic not found: ",n.topicName)}},{key:"topicPermissionSetter",value:function(e,t,n){var a=this.props.tinode.getTopic(t.topicName);if(a){var o=a.updateMode(t.user,e);return n&&(o=o.catch(function(e){n(e.message,"err")})),o}console.log("Topic not found",t.topicName)}},{key:"render",value:function(){var t=this,n=0,a=[];this.props.items.map(function(e){"string"==typeof e&&(e=t.MenuItems[e]),e&&e.title&&a.push("-"==e.title?E.a.createElement("li",{className:"separator",key:n}):E.a.createElement("li",{onClick:t.handleClick,"data-id":n,key:n},e.title)),n++});var e=13*(.7+2.5*a.length),o={left:(this.props.bounds.right-this.props.clickAt.x<156?this.props.clickAt.x-this.props.bounds.left-156:this.props.clickAt.x-this.props.bounds.left)+"px",top:(this.props.bounds.bottom-this.props.clickAt.y<e?this.props.clickAt.y-this.props.bounds.top-e:this.props.clickAt.y-this.props.bounds.top)+"px"};return E.a.createElement("ul",{className:"menu",style:o},a)}}]),I&&F(R,I),H);function H(a){var o,e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,H),e=this,t=U(H).call(this,a),o=!t||"object"!==A(t)&&"function"!=typeof t?x(e):t;var r=a.intl.formatMessage;return o.handlePageClick=o.handlePageClick.bind(x(o)),o.handleEscapeKey=o.handleEscapeKey.bind(x(o)),o.handleClick=o.handleClick.bind(x(o)),o.MenuItems={topic_info:{id:"topic_info",title:r(L.info),handler:null},messages_clear:{id:"messages_clear",title:r(L.clear_messages),handler:function(e,t){return a.onShowAlert(r({id:"menu_item_clear_messages"}),r({id:"clear_messages_warning"}),function(){o.deleteMessages(!0,!1,e,t)},null,!0,null)}},messages_clear_hard:{id:"messages_clear_hard",title:r(L.clear_for_all),handler:function(e,t){return a.onShowAlert(r({id:"menu_item_clear_messages_for_all"}),r({id:"delete_messages_warning"}),function(){return o.deleteMessages(!0,!0,e,t)},null,!0,null)}},message_delete:{id:"message_delete",title:r(L.delete),handler:function(e,t){return o.deleteMessages(!1,!1,e,t)}},message_delete_hard:{id:"message_delete_hard",title:r(L.delete_for_all),handler:function(e,t){return o.deleteMessages(!1,!0,e,t)}},topic_unmute:{id:"topic_unmute",title:r(L.unmute),handler:o.topicPermissionSetter.bind(x(o),"+P")},topic_mute:{id:"topic_mute",title:r(L.mute),handler:o.topicPermissionSetter.bind(x(o),"-P")},topic_unblock:{id:"topic_unblock",title:r(L.unblock),handler:o.topicPermissionSetter.bind(x(o),"+JP")},topic_block:{id:"topic_block",title:r(L.block),handler:function(t,e){return a.onShowAlert(r({id:"menu_item_block"}),r(L.topic_block_warning),function(){return o.topicPermissionSetter("-JP",t,e).then(function(e){return o.props.onTopicRemoved(t.topicName),e})},null,!0,null)}},topic_delete:{id:"topic_delete",title:r(L.topic_delete),handler:function(t,n){return a.onShowAlert(r({id:"menu_item_delete_topic"}),r(L.topic_delete_warning),function(){var e=o.props.tinode.getTopic(t.topicName);if(e)return e.delTopic().catch(function(e){n&&n(e.message,"err")});console.log("Topic not found: ",t.topicName)},null,!0,null)}},topic_archive:{id:"topic_archive",title:r(L.archive),handler:function(e,t){var n=o.props.tinode.getTopic(e.topicName);if(n)return n.archive(!0).catch(function(e){t&&t(e.message,"err")});console.log("Topic not found: ",e.topicName)}},permissions:{id:"permissions",title:r({id:"menu_item_edit_permissions"}),handler:null},member_delete:{id:"member_delete",title:r(L.member_delete),handler:function(e,t){var n=o.props.tinode.getTopic(e.topicName);if(n&&e.user)return n.delSubscription(e.user).catch(function(e){t&&t(e.message,"err")});console.log("Topic or user not found: '"+e.topicName+"', '"+e.user+"'")}},member_mute:{id:"member_mute",title:r(L.mute),handler:o.topicPermissionSetter.bind(x(o),"-P")},member_unmute:{id:"member_unmute",title:r(L.unmute),handler:o.topicPermissionSetter.bind(x(o),"+P")},member_block:{id:"member_block",title:r(L.block),handler:o.topicPermissionSetter.bind(x(o),"-J")},member_unblock:{id:"member_unblock",title:r(L.unblock),handler:o.topicPermissionSetter.bind(x(o),"+J")}},o}var W=Object(S.injectIntl)(q);function B(e,t){t=t||window.navigator.userLanguage||window.navigator.language;var n=new Date;return e.getFullYear()==n.getFullYear()?e.getMonth()==n.getMonth()&&e.getDate()==n.getDate()?e.toLocaleTimeString(t,{hour12:!1,hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function V(e){if(!e||0==e)return"0 Bytes";var t=["Bytes","KB","MB","GB","TB","PB"],n=Math.min(0|Math.floor(Math.log2(e)/10),t.length-1),a=e/Math.pow(1024,n),o=0<n?a<3?2:a<30?1:0:0;return a.toFixed(o)+" "+t[n]}function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function z(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Y(e,t){return(Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q,X,Z=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Y(e,t)}($,E.a.PureComponent),K((Q=$).prototype,[{key:"render",value:function(){var e;if(!0===this.props.avatar){var t="grp"==k.a.topicType(this.props.topic),n=(t?"light-color":"dark-color")+Math.abs(function(e){var t=0;e=""+e;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(this.props.topic))%16;if(this.props.topic&&this.props.title&&this.props.title.trim()){var a=this.props.title.trim().charAt(0),o="lettertile "+n;e=E.a.createElement("div",{className:o},E.a.createElement("div",null,a))}else{var r="material-icons "+n;e=t?E.a.createElement("i",{className:r},"group"):E.a.createElement("i",{className:r},"person")}}else e=this.props.avatar?E.a.createElement("img",{className:"avatar",alt:"avatar",src:this.props.avatar,onError:function(e){e.target.onerror=null,e.target.src="/img/broken_image.png"}}):null;return e}}]),X&&K(Q,X),$);function $(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,$),z(this,J($).apply(this,arguments))}var ee=["image/jpeg","image/gif","image/png","image/svg","image/svg+xml"],te=["jpg","gif","png","svg","svg"];function ne(e){return e&&e.type&&e.data?"data:image/"+e.type+";base64,"+e.data:null}function ae(e,t,n,a,o){if(t|=0,n|=0,a|=0,(e|=0)<=0||t<=0||n<=0||a<=0)return null;o&&(n=a=Math.min(n,a));var r=Math.min(Math.min(e,n)/e,Math.min(t,a)/t),i={dstWidth:e*r|0,dstHeight:t*r|0};return o?(i.dstWidth=i.dstHeight=Math.min(i.dstWidth,i.dstHeight),i.srcWidth=i.srcHeight=Math.min(e,t),i.xoffset=(e-i.srcWidth)/2|0,i.yoffset=(t-i.srcWidth)/2|0):(i.xoffset=i.yoffset=0,i.srcWidth=e,i.srcHeight=t),i}function oe(e,t){var n=ee.indexOf(t),a=te[n],o=e.lastIndexOf(".");return 0<=o&&(e=e.substring(0,o)),e+"."+a}function re(i,s,l,c,u,d){var e=new Image;e.crossOrigin="Anonymous",e.onerror=function(e){d("Image format unrecognized")},e.onload=function(){var e=ae(this.width,this.height,s,l,c);if(e){var t=document.createElement("canvas");t.width=e.dstWidth,t.height=e.dstHeight;var n=t.getContext("2d");n.imageSmoothingEnabled=!0,n.drawImage(this,e.xoffset,e.yoffset,e.srcWidth,e.srcHeight,0,0,e.dstWidth,e.dstHeight);var a=this.width!=e.dstWidth||this.height!=e.dstHeight||ee.indexOf(i.type)<0?"image/jpeg":i.type,o=t.toDataURL(a);if(a=le(o.split(",")[0])){var r=.78;if(ce(o.length)>C&&(a="image/jpeg"),"image/jpeg"==a)for(;ce(o.length)>C&&.45<r;)o=t.toDataURL(a,r),r*=.84;ce(o.length)>C?d("The image size "+bytesToHumanSize(ce(o.length))+" exceeds the "+bytesToHumanSize(C)+" limit.","err"):(t=null,u(o.split(",")[1],a,e.dstWidth,e.dstHeight,oe(i.name,a)))}else d("Unsupported image format")}else d("Invalid image")},e.src=URL.createObjectURL(i)}function ie(a,o,r){var i=new FileReader;i.addEventListener("load",function(){var e=i.result.split(","),t=le(e[0]);if(t){var n=new Image;n.crossOrigin="Anonymous",n.onload=function(){o(e[1],t,this.width,this.height,oe(a.name,t))},n.onerror=function(e){r("Image format not recognized")},n.src=URL.createObjectURL(a)}else r("Failed to process image file")},!1),i.readAsDataURL(a)}function se(e,t){var n=new FileReader;n.addEventListener("load",function(){t(e.type,n.result.split(",")[1],e.name)}),n.readAsDataURL(e)}function le(e){var t=/^data:(image\/[-+a-z0-9.]+);base64/.exec(e);return t&&1<t.length?t[1]:null}function ce(e){return 3*Math.floor(e/4)}function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function he(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe,be,ge=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(ye,E.a.Component),de((fe=ye).prototype,[{key:"componentDidUpdate",value:function(e){this.props.avatar!=e.avatar&&this.setState({dataUrl:this.props.avatar})}},{key:"handleFileUpload",value:function(e){var a=this;re(e.target.files[0],128,128,!0,function(e,t){var n=ne({data:e,type:t});a.setState({dataUrl:n}),a.props.onImageChanged(n)},function(e){a.props.onError(e,"err")}),e.target.value=""}},{key:"render",value:function(){var t=this,e="file-input-avatar-"+(Math.random()+"").substr(2);return E.a.createElement("div",{className:"avatar-upload"},this.props.readOnly||!this.state.dataUrl?null:E.a.createElement("a",{href:"#",className:"clear-avatar",onClick:function(e){e.preventDefault(),t.props.onImageChanged(null)}},E.a.createElement("i",{className:"material-icons"},"clear")),this.state.dataUrl?E.a.createElement("img",{src:this.state.dataUrl,className:"preview"}):this.props.readOnly&&this.props.uid?E.a.createElement("div",{className:"avatar-box"},E.a.createElement(Z,{avatar:!0,topic:this.props.uid,title:this.props.title})):E.a.createElement("div",{className:"blank"},128,"×",128),this.props.readOnly?null:E.a.createElement("input",{type:"file",id:e,className:"inputfile hidden",accept:"image/*",onChange:this.handleFileUpload}),this.props.readOnly?null:E.a.createElement("label",{htmlFor:e,className:"round"},E.a.createElement("i",{className:"material-icons"},"file_upload")))}}]),be&&de(fe,be),ye);function ye(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ye),n=this,(t=!(a=pe(ye).call(this,e))||"object"!==ue(a)&&"function"!=typeof a?he(n):a).state={dataUrl:e.avatar},t.handleFileUpload=t.handleFileUpload.bind(he(t)),t}function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ee(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Se(e,t){return(Se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ke,Ce,Me=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Se(e,t)}(Oe,E.a.PureComponent),_e((ke=Oe).prototype,[{key:"handleChange",value:function(){this.props.onChange(this.props.name,!this.props.checked)}},{key:"render",value:function(){return this.props.onChange?this.props.checked?E.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box"):E.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box_outline_blank"):this.props.checked?E.a.createElement("i",{className:"material-icons"},"check_box"):E.a.createElement("i",{className:"material-icons"},"check_box_outline_blank")}}]),Ce&&_e(ke,Ce),Oe);function Oe(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Oe),n=this,(t=!(a=we(Oe).call(this,e))||"object"!==ve(a)&&"function"!=typeof a?Ee(n):a).handleChange=t.handleChange.bind(Ee(t)),t}function Te(e){return(Te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pe(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function je(e,t){return!t||"object"!==Te(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ne(e){return(Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fe,Ue,xe={muted:"notifications_off",banned:"block"},De=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ae(e,t)}(Re,E.a.PureComponent),Pe((Fe=Re).prototype,[{key:"render",value:function(){var n=null;return this.props.badges&&0<this.props.badges.length?(n=[],this.props.badges.map(function(e){if(e.icon)n.push(E.a.createElement("i",{className:"material-icons as-badge",key:e.key||e.icon},xe[e.icon]));else{var t="badge"+(e.color?" "+e.color:"");n.push(E.a.createElement("span",{className:t,key:e.key||e.name},e.name))}}),E.a.createElement(E.a.Fragment,null,n)):null}}]),Ue&&Pe(Fe,Ue),Re);function Re(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Re),je(this,Ne(Re).apply(this,arguments))}function Ie(e){return(Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Le(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function qe(e,t){return!t||"object"!==Ie(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function He(e){return(He=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function We(e,t){return(We=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Be,Ve,Ge=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&We(e,t)}(Ke,E.a.PureComponent),Le((Be=Ke).prototype,[{key:"render",value:function(){return 0<this.props.count?E.a.createElement("span",{className:"unread"},9<this.props.count?"9+":this.props.count):null}}]),Ve&&Le(Be,Ve),Ke);function Ke(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ke),qe(this,He(Ke).apply(this,arguments))}function ze(e){return(ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Je(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ye(e){return(Ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xe(e,t){return(Xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ze,$e,et=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xe(e,t)}(tt,E.a.Component),Je((Ze=tt).prototype,[{key:"handleClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onSelected&&this.props.onSelected(this.props.item,this.props.index,this.props.now,this.props.acs)}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.props.item,y:e.pageY,x:e.pageX})}},{key:"render",value:function(){var e=this.props.title;e?30<e.length&&(e=e.substring(0,28)+"..."):e=E.a.createElement("i",null,E.a.createElement(S.FormattedMessage,{id:"unnamed_topic"}));var t=this.props.now?"online":"offline",n=!this.props.avatar||this.props.avatar,a=this.props.badges?this.props.badges.slice():[],o=[];return this.props.acs&&(this.props.showMode&&a.push({name:this.props.acs.getMode(),key:"mode"}),this.props.acs.isMuted()&&o.push({icon:"muted"}),this.props.acs.isJoiner()||o.push({icon:"banned"})),E.a.createElement("li",{className:!this.props.showCheckmark&&this.props.selected?"selected":null,onClick:this.handleClick},E.a.createElement("div",{className:"avatar-box"},E.a.createElement(Z,{avatar:n,title:this.props.title,topic:this.props.item}),this.props.showOnline?E.a.createElement("span",{className:t}):this.props.showCheckmark&&this.props.selected?E.a.createElement("i",{className:"checkmark material-icons"},"check_circle"):null),E.a.createElement("div",{className:"text-box"},E.a.createElement("div",null,E.a.createElement("span",{className:"contact-title"},e),E.a.createElement(Ge,{count:this.props.unread}),E.a.createElement(De,{badges:o})),this.props.comment?E.a.createElement("div",{className:"contact-comment"},this.props.comment):null,E.a.createElement("span",null,E.a.createElement(De,{badges:a}))),this.props.showContextMenu?E.a.createElement("span",{className:"menuTrigger"},E.a.createElement("a",{href:"#",onClick:this.handleContextClick},E.a.createElement("i",{className:"material-icons"},"expand_more"))):null)}}]),$e&&Je(Ze,$e),tt);function tt(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,tt),n=this,(t=!(a=Ye(tt).call(this,e))||"object"!==ze(a)&&"function"!=typeof a?Qe(n):a).handleClick=t.handleClick.bind(Qe(t)),t.handleContextClick=t.handleContextClick.bind(Qe(t)),t}function nt(e){return(nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function at(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ot(e){return(ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function it(e,t){return(it=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var st,lt,ct=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&it(e,t)}(ut,E.a.PureComponent),at((st=ut).prototype,[{key:"handleClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onAction(this.props.action)}},{key:"render",value:function(){var e=this.props.intl.formatMessage;return E.a.createElement("li",{onClick:this.handleClick,className:"action"},E.a.createElement("div",{className:"action-text"},e(this.props.title,this.props.values)))}}]),lt&&at(st,lt),ut);function ut(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ut),n=this,(t=!(a=ot(ut).call(this,e))||"object"!==nt(a)&&"function"!=typeof a?rt(n):a).handleClick=t.handleClick.bind(rt(t)),t}var dt=Object(S.injectIntl)(ct);function pt(e){return(pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ht(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function mt(e,t){return!t||"object"!==pt(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function ft(e){return(ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function bt(e,t){return(bt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var gt,yt,vt=Object(S.defineMessages)({badge_you:{id:"badge_you",defaultMessage:"you"},badge_owner:{id:"badge_owner",defaultMessage:"owner"}}),_t=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bt(e,t)}(wt,E.a.Component),ht((gt=wt).prototype,[{key:"render",value:function(){var i=this,s=this.props.intl.formatMessage,l=Array.isArray(this.props.topicSelected),c=[],u=0;return this.props.contacts&&0<this.props.contacts.length&&this.props.contacts.map(function(e){if(e.action)c.push(E.a.createElement(dt,{title:e.title,action:e.action,values:e.values,key:e.action,onAction:i.props.onAction}));else{var t=e.topic?e.topic:e.user;if(i.props.filterFunc&&i.props.filter){var n=[t];if(e.private&&e.private.comment&&n.push((""+e.private.comment).toLowerCase()),e.public&&e.public.fn&&n.push((""+e.public.fn).toLowerCase()),!i.props.filterFunc(i.props.filter,n))return}var a=l?-1<i.props.topicSelected.indexOf(t):i.props.topicSelected===t,o=[];i.props.showMode&&(t===i.props.myUserId&&o.push({name:s(vt.badge_you),color:"green"}),e.acs&&e.acs.isOwner()&&o.push({name:s(vt.badge_owner),color:"blue"}));var r=Array.isArray(e.private)?e.private.join(","):e.private?e.private.comment:null;c.push(E.a.createElement(et,{title:e.public?e.public.fn:null,avatar:ne(e.public?e.public.photo:null),comment:r,unread:i.props.showUnread?e.unread:0,now:e.online&&i.props.connected,acs:e.acs,showMode:i.props.showMode,badges:o,showCheckmark:l,selected:a,showOnline:i.props.showOnline,onSelected:i.props.onTopicSelected,showContextMenu:i.props.showContextMenu,item:t,index:c.length,key:t})),u++}},this),E.a.createElement("div",{className:this.props.noScroll?null:"scrollable-panel"},0==u?E.a.createElement("div",{className:"center-medium-text",dangerouslySetInnerHTML:{__html:this.props.emptyListMessage}}):null,0<c.length?E.a.createElement("ul",{className:"contact-box"},c):null)}}]),yt&&ht(gt,yt),wt);function wt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,wt),mt(this,ft(wt).apply(this,arguments))}var Et=Object(S.injectIntl)(_t);function St(e){return(St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function kt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ct(e,t){return!t||"object"!==St(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Mt(e){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ot(e,t){return(Ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Tt,Pt,jt=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ot(e,t)}(Nt,E.a.PureComponent),kt((Tt=Nt).prototype,[{key:"render",value:function(){var t=this;return E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onCancel()}},E.a.createElement("i",{className:"material-icons"},"close"))}}]),Pt&&kt(Tt,Pt),Nt);function Nt(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Nt),Ct(this,Mt(Nt).apply(this,arguments))}function At(e){return(At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ft(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ut(e){return(Ut=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dt(e,t){return(Dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Rt,It,Lt=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Dt(e,t)}(qt,E.a.PureComponent),Ft((Rt=qt).prototype,[{key:"componentDidUpdate",value:function(e){e.level!==this.props.level&&this.setState({show:!!this.props.level})}},{key:"hide",value:function(){this.setState({show:!1}),this.props.onClearError&&this.props.onClearError()}},{key:"render",value:function(){var t=this,e={err:"error",warn:"warning",info:"info"}[this.props.level]||"",n="info-box "+e;return E.a.createElement("div",{className:n},E.a.createElement("div",{className:"icon"},E.a.createElement("i",{className:"material-icons"},e)),E.a.createElement("span",null,E.a.createElement("span",{dangerouslySetInnerHTML:{__html:this.props.text}}),this.props.action?E.a.createElement(E.a.Fragment,null,E.a.createElement("a",{href:"#",style:{whiteSpace:"nowrap"},onClick:function(e){e.preventDefault(),t.props.action()}},this.props.actionText)):null),E.a.createElement("div",{className:"cancel"},E.a.createElement(jt,{onCancel:this.hide})))}}]),It&&Ft(Rt,It),qt);function qt(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,qt),n=this,(t=!(a=Ut(qt).call(this,e))||"object"!==At(a)&&"function"!=typeof a?xt(n):a).state={show:!1},t.hide=t.hide.bind(xt(t)),t}function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Bt(e){return(Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gt(e,t){return(Gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Kt,zt,Jt=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Gt(e,t)}(Yt,E.a.PureComponent),Wt((Kt=Yt).prototype,[{key:"handleCancel",value:function(e){e.preventDefault(),this.props.onCancel(this.props.topic,this.props.index)}},{key:"render",value:function(){var e=this.props.title||this.props.topic,t=this.props.invalid?"chip invalid":"chip";return E.a.createElement("div",{className:t},this.props.noAvatar?E.a.createElement("span",{className:"spacer"}):E.a.createElement("div",{className:"avatar-box"},E.a.createElement(Z,{avatar:this.props.avatar||!0,topic:this.props.topic,title:this.props.title})),E.a.createElement("span",null,e),this.props.onCancel&&!this.props.required?E.a.createElement("a",{href:"#",onClick:this.handleCancel},"×"):E.a.createElement("span",{className:"spacer"}))}}]),zt&&Wt(Kt,zt),Yt);function Yt(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Yt),n=this,(t=!(a=Bt(Yt).call(this,e))||"object"!==Ht(a)&&"function"!=typeof a?Vt(n):a).handleCancel=t.handleCancel.bind(Vt(t)),t}function Qt(e){return(Qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Zt(e){return(Zt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function en(e,t){return(en=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var tn,nn,an,on=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&en(e,t)}(rn,E.a.Component),an=[{key:"deriveStateFromProps",value:function(e){return{placeholder:e.chips?"":e.prompt,sortedChips:rn.sortChips(e.chips,e.staticMembers),chipIndex:rn.indexChips(e.chips)}}},{key:"indexChips",value:function(e){var t={},n=0;return e.map(function(e){t[e.user]=n,n++}),t}},{key:"sortChips",value:function(e,t){var n=[],a=[];return e.map(function(e){t&&t.includes(e.user)?n.push(e):a.push(e)}),n.concat(a)}}],nn=[{key:"componentDidUpdate",value:function(e,t){e.chips==this.props.chips&&e.staticMembers==this.props.staticMembers&&e.prompt==this.props.prompt||this.setState(rn.deriveStateFromProps(this.props)),(!t||this.props.chips.length>t.sortedChips.length)&&this.setState({input:""})}},{key:"handleTextInput",value:function(e){this.setState({input:e.target.value}),this.props.filterFunc&&this.props.filterFunc(e.target.value)}},{key:"removeChipAt",value:function(e){var t=this.state.sortedChips[e];this.props.onChipRemoved(t.user,this.state.chipIndex[t.user])}},{key:"handleChipCancel",value:function(e,t){this.removeChipAt(t)}},{key:"handleFocusGained",value:function(){this.setState({focused:!0})}},{key:"handleFocusLost",value:function(){this.setState({focused:!1}),this.props.onFocusLost&&this.props.onFocusLost(this.state.input)}},{key:"handleKeyDown",value:function(e){if("Backspace"===e.key){if(0==this.state.input.length&&0<this.state.sortedChips.length){var t=this.state.sortedChips.length-1;this.state.sortedChips[t].user!==this.props.staticMembers&&this.removeChipAt(t)}}else"Enter"===e.key?this.props.onEnter&&this.props.onEnter(this.state.input):"Escape"===e.key&&this.props.onCancel&&this.props.onCancel()}},{key:"render",value:function(){var t=this,n=[],a=0,o=this.props.staticMembers||[];this.state.sortedChips.map(function(e){n.push(E.a.createElement(Jt,{onCancel:t.handleChipCancel,avatar:ne(e.public?e.public.photo:null),title:e.public?e.public.fn:void 0,noAvatar:t.props.avatarDisabled,topic:e.user,required:o.includes(e.user),invalid:e.invalid,index:a,key:e.user})),a++});var e="chip-input"+(this.state.focused?" focused":"");return E.a.createElement("div",{className:e},n,E.a.createElement("input",{type:"text",placeholder:this.state.placeholder,onChange:this.handleTextInput,onFocus:this.handleFocusGained,onBlur:this.handleFocusLost,onKeyDown:this.handleKeyDown,value:this.state.input,autoFocus:!0}))}}],Xt((tn=rn).prototype,nn),an&&Xt(tn,an),rn);function rn(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,rn),n=this,(t=!(a=Zt(rn).call(this,e))||"object"!==Qt(a)&&"function"!=typeof a?$t(n):a).state=rn.deriveStateFromProps(e),t.state.input="",t.state.focused=!1,t.handleTextInput=t.handleTextInput.bind($t(t)),t.removeChipAt=t.removeChipAt.bind($t(t)),t.handleChipCancel=t.handleChipCancel.bind($t(t)),t.handleFocusGained=t.handleFocusGained.bind($t(t)),t.handleFocusLost=t.handleFocusLost.bind($t(t)),t.handleKeyDown=t.handleKeyDown.bind($t(t)),t}function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ln(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function un(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pn,hn,mn,fn=Object(S.defineMessages)({no_contacts:{id:"no_contacts",defaultMessage:"You have no contacts :-("},contacts_not_found:{id:"contacts_not_found_short",defaultMessage:"No contacts match '{query}'"}}),bn=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(gn,E.a.Component),mn=[{key:"indexMembers",value:function(e){var t={};return e.map(function(e){t[e.user]={delta:0,present:!0}}),t}},{key:"staticMembers",value:function(e,t,n){var a=[];return e.map(function(e){!t&&e.user!=n||a.push(e.user)}),a}},{key:"selectedContacts",value:function(e){var t=[];return e.map(function(e){t.push(e.user)}),t}},{key:"doContactFiltering",value:function(e,t){if(e){for(var n=0;n<t.length;n++)if(0<=t[n].indexOf(e))return!0;return!1}return!0}}],hn=[{key:"handleContactSelected",value:function(e,t){var n=this.state.index[e];if(n){if(n.present)return;n.delta+=1,n.present=!0}else n={delta:1,present:!0};var a=this.state.members.slice();a.push(this.props.contacts[t]);var o=gn.selectedContacts(a),r=this.state.index;r[e]=n,this.setState({members:a,index:r,selectedContacts:o})}},{key:"handleMemberRemoved",value:function(e,t){var n=this.state.index[e];if(n&&n.present){n.present=!1,--n.delta;var a=this.state.members.slice();a.splice(t,1);var o=gn.selectedContacts(a),r=this.state.index;r[e]=n,this.setState({members:a,index:r,selectedContacts:o})}}},{key:"handleContactFilter",value:function(e){var t=this.props.intl.formatMessage,n=e?t(fn.contacts_not_found,{query:e}):t(fn.no_contacts);this.setState({contactFilter:e,noContactsMessage:n})}},{key:"handleSubmit",value:function(){var t=this,n=[],a=[],o=[];Object.keys(this.state.index).map(function(e){t.state.index[e].present&&n.push(e),0<t.state.index[e].delta?a.push(e):t.state.index[e].delta<0&&o.push(e)}),this.props.onSubmit(n,a,o)}},{key:"handleCancel",value:function(){this.props.onCancel()}},{key:"render",value:function(){return this.props.intl.formatMessage,E.a.createElement("div",{id:"group-manager"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"title_group_members",defaultMessage:"Group Members"}))),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(on,{chips:this.state.members,staticMembers:this.state.staticMembers,prompt:"add members",filterFunc:this.handleContactFilter,onChipRemoved:this.handleMemberRemoved})),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"title_all_contacts",defaultMessage:"All Contacts"}))),E.a.createElement(Et,{contacts:this.props.contacts,myUserId:this.props.myUserId,topicSelected:this.state.selectedContacts,filter:this.state.contactFilter,filterFunc:gn.doContactFiltering,emptyListMessage:this.state.noContactsMessage,showOnline:!1,showUnread:!1,onTopicSelected:this.handleContactSelected}),E.a.createElement("div",{id:"group-manager-buttons",className:"panel-form-row"},E.a.createElement("button",{className:"blue",onClick:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"button_ok",defaultMessage:"OK"})),E.a.createElement("button",{className:"white",onClick:this.handleCancel},E.a.createElement(S.FormattedMessage,{id:"button_cancel",defaultMessage:"Cancel"}))))}}],ln((pn=gn).prototype,hn),mn&&ln(pn,mn),gn);function gn(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,gn),n=this,(t=!(a=cn(gn).call(this,e))||"object"!==sn(a)&&"function"!=typeof a?un(n):a).state={members:e.members,index:gn.indexMembers(e.members),staticMembers:gn.staticMembers(e.members,e.keepInitialMembers,e.requiredMember),contactFilter:"",noContactsMessage:e.intl.formatMessage(fn.no_contacts),selectedContacts:gn.selectedContacts(e.members)},t.handleContactSelected=t.handleContactSelected.bind(un(t)),t.handleMemberRemoved=t.handleMemberRemoved.bind(un(t)),t.handleContactFilter=t.handleContactFilter.bind(un(t)),t.handleSubmit=t.handleSubmit.bind(un(t)),t.handleCancel=t.handleCancel.bind(un(t)),t}var yn=Object(S.injectIntl)(bn);function vn(e){return(vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function wn(e){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function En(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sn(e,t){return(Sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var kn,Cn,Mn=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}(On,E.a.PureComponent),_n((kn=On).prototype,[{key:"handeTextChange",value:function(e){this.setState({value:e.target.value}),this.props.onChange&&this.props.onChange(e)}},{key:"handleVisibility",value:function(e){e.preventDefault(),this.setState({visible:!this.state.visible})}},{key:"handleKeyDown",value:function(e){27==e.keyCode?(this.setState({value:this.props.value,visible:!1}),this.props.onFinished&&this.props.onFinished()):13==e.keyCode&&this.handleEditingFinished()}},{key:"handleEditingFinished",value:function(e){var t=this;if(e){var n=e.currentTarget;setTimeout(function(){n.contains(document.activeElement)||t.props.onFinished&&t.props.onFinished(t.state.value)},0)}else this.props.onFinished&&this.props.onFinished(this.state.value.trim())}},{key:"render",value:function(){return E.a.createElement("div",{tabIndex:"-1",className:"group-focus",onBlur:this.handleEditingFinished},E.a.createElement("input",{className:"with-visibility",type:this.state.visible?"text":"password",value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoFocus:this.props.autoFocus?"autoFocus":"",autoComplete:this.props.autoComplete,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown}),E.a.createElement("span",{onClick:this.handleVisibility},E.a.createElement("i",{className:"material-icons clickable light-gray"},this.state.visible?"visibility":"visibility_off")))}}]),Cn&&_n(kn,Cn),On);function On(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,On),n=this,(t=!(a=wn(On).call(this,e))||"object"!==vn(a)&&"function"!=typeof a?En(n):a).state={value:t.props.value,visible:!1},t.handleVisibility=t.handleVisibility.bind(En(t)),t.handeTextChange=t.handeTextChange.bind(En(t)),t.handleKeyDown=t.handleKeyDown.bind(En(t)),t.handleEditingFinished=t.handleEditingFinished.bind(En(t)),t}function Tn(e){return(Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pn(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function jn(e){return(jn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Nn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function An(e,t){return(An=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fn,Un,xn=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&An(e,t)}(Dn,E.a.Component),Pn((Fn=Dn).prototype,[{key:"componentDidUpdate",value:function(e,t){var n=this.props.value||"";t.initialValue==n||t.active||this.setState({initialValue:n,value:n})}},{key:"handeTextChange",value:function(e){this.setState({value:e.target.value})}},{key:"handleKeyDown",value:function(e){27===e.keyCode?this.setState({value:this.props.value,active:!1}):13===e.keyCode&&this.handleEditingFinished(e)}},{key:"handleStartEditing",value:function(){this.props.readOnly||(r.a.findDOMNode(this).focus(),this.setState({active:!0}))}},{key:"handleEditingFinished",value:function(e){if(!this.props.required||e.target.checkValidity()){this.setState({active:!1});var t=this.state.value.trim();(t||this.props.value)&&t!==this.props.value&&this.props.onFinished(t)}else this.setState({value:this.props.value,active:!1})}},{key:"handlePasswordFinished",value:function(e){this.setState({active:!1}),e&&e!==this.props.value&&this.props.onFinished(e)}},{key:"render",value:function(){if(this.state.active)var e=this.props.type||"text";else{var t="password"==this.props.type?"••••••••":this.state.value,n="in-place-edit"+(this.props.readOnly?" disabled":"");t||(t=this.props.placeholder,n+=" placeholder"),20<t.length&&(t=t.substring(0,19)+"...")}return this.state.active?"password"==e?E.a.createElement(Mn,{value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoComplete:this.props.autoComplete,autoFocus:!0,onFinished:this.handlePasswordFinished}):E.a.createElement("input",{type:e,value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoComplete:this.props.autoComplete,autoFocus:!0,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown,onBlur:this.handleEditingFinished}):E.a.createElement("span",{className:n,onClick:this.handleStartEditing},E.a.createElement("span",{className:"content"},t))}}]),Un&&Pn(Fn,Un),Dn);function Dn(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Dn),n=this,(t=!(a=jn(Dn).call(this,e))||"object"!==Tn(a)&&"function"!=typeof a?Nn(n):a).state={active:e.active,initialValue:e.value||"",value:e.value||""},t.handeTextChange=t.handeTextChange.bind(Nn(t)),t.handleKeyDown=t.handleKeyDown.bind(Nn(t)),t.handleStartEditing=t.handleStartEditing.bind(Nn(t)),t.handleEditingFinished=t.handleEditingFinished.bind(Nn(t)),t.handlePasswordFinished=t.handlePasswordFinished.bind(Nn(t)),t}function Rn(e){return(Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function In(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ln(e){return(Ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hn(e,t){return(Hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Wn,Bn,Vn=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hn(e,t)}(Gn,E.a.PureComponent),In((Wn=Gn).prototype,[{key:"handleToggle",value:function(){var e=!this.state.open;this.setState({open:e}),this.props.onToggle&&this.props.onToggle(e)}},{key:"render",value:function(){return E.a.createElement("label",{className:"small clean-clickable",onClick:this.handleToggle},this.props.title,"...",this.state.open?E.a.createElement("i",{className:"material-icons"},"expand_more"):E.a.createElement("i",{className:"material-icons"},"chevron_right"))}}]),Bn&&In(Wn,Bn),Gn);function Gn(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Gn),n=this,(t=!(a=Ln(Gn).call(this,e))||"object"!==Rn(a)&&"function"!=typeof a?qn(n):a).state={open:e.open},t.handleToggle=t.handleToggle.bind(qn(t)),t}function Kn(e){return(Kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zn(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Jn(e){return(Jn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qn(e,t){return(Qn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Xn,Zn,$n=Object(S.defineMessages)({joiner:{id:"permission_join",defaultMessage:"Join ({val})"},reader:{id:"permission_read",defaultMessage:"Read ({val})"},writer:{id:"permission_write",defaultMessage:"Write ({val})"},preser:{id:"permission_pres",defaultMessage:"Get notified ({val})"},approver:{id:"permission_admin",defaultMessage:"Approve ({val})"},sharer:{id:"permission_share",defaultMessage:"Share ({val})"},deleter:{id:"permission_delete",defaultMessage:"Delete ({val})"},owner:{id:"permission_owner",defaultMessage:"Owner ({val})"}}),ea=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qn(e,t)}(ta,E.a.Component),zn((Xn=ta).prototype,[{key:"handleChange",value:function(e){var t=this.state.mode;-1==t.indexOf(e)?t+=e:t=t.replace(e,""),this.setState({mode:t})}},{key:"handleSubmit",value:function(){var e=(this.state.mode||"N").split("").sort().join("");e!==(this.props.mode||"N").split("").sort().join("")?this.props.onSubmit(e):this.props.onCancel()}},{key:"handleCancel",value:function(){this.props.onCancel()}},{key:"render",value:function(){for(var e=this.props.intl.formatMessage,t="JRWPASDO",n={J:e($n.joiner,{val:"J"}),R:e($n.reader,{val:"R"}),W:e($n.writer,{val:"W"}),P:e($n.preser,{val:"P"}),A:e($n.approver,{val:"A"}),S:e($n.sharer,{val:"S"}),D:e($n.deleter,{val:"D"}),O:e($n.owner,{val:"O"})},a=this.props.skip||"",o=this.state.mode,r=(this.props.compare||"").replace("N",""),i=[],s=0;s<t.length;s++){var l=t.charAt(s);0<=a.indexOf(l)&&o.indexOf(l)<0||i.push(E.a.createElement("tr",{key:l},E.a.createElement("td",null,n[l]),E.a.createElement("td",{className:"checkbox"},a.indexOf(l)<0?E.a.createElement(Me,{name:l,checked:0<=o.indexOf(l),onChange:this.handleChange}):E.a.createElement(Me,{name:l,checked:0<=o.indexOf(l)})),this.props.compare?E.a.createElement("td",{className:"checkbox"},E.a.createElement(Me,{name:l,checked:0<=r.indexOf(l)})):null))}return E.a.createElement("div",{className:"panel-form-column"},this.props.userTitle?E.a.createElement("ul",{className:"contact-box"},E.a.createElement(et,{item:this.props.item,title:this.props.userTitle,avatar:ne(this.props.userAvatar?this.props.userAvatar:null)})):null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"title_permissions",defaultMessage:"Permissions"})),E.a.createElement("table",{className:"permission-editor"},this.props.compare?E.a.createElement("thead",null,E.a.createElement("tr",null,E.a.createElement("th",null),E.a.createElement("th",null,this.props.modeTitle),E.a.createElement("th",null,this.props.compareTitle))):null,E.a.createElement("tbody",null,i)),E.a.createElement("br",null),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:"outline",onClick:this.handleCancel},E.a.createElement(S.FormattedMessage,{id:"button_cancel"})),E.a.createElement("button",{className:"blue",onClick:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"button_ok"}))))}}]),Zn&&zn(Xn,Zn),ta);function ta(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ta),n=this,(t=!(a=Jn(ta).call(this,e))||"object"!==Kn(a)&&"function"!=typeof a?Yn(n):a).state={mode:(e.mode||"").replace("N","")},t.handleChange=t.handleChange.bind(Yn(t)),t.handleSubmit=t.handleSubmit.bind(Yn(t)),t.handleCancel=t.handleCancel.bind(Yn(t)),t}var na=Object(S.injectIntl)(ea);function aa(e){var t=document.getElementById("shortcut-icon"),n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("link");a.type="image/png",a.id="shortcut-icon",a.rel="shortcut icon",a.href="img/logo32x32"+(0<e?"a":"")+".png",t&&n.removeChild(t),n.appendChild(a),document.title=(0<e?"("+e+") ":"")+"Tinode"}function oa(e,t){var n=null;if((e&&e.trim()||t)&&(n={},e&&(n.fn=e.trim()),t)){var a=t.indexOf(",");n.photo=0<=a?{data:t.substring(a+1),type:"jpg"}:t}return n}function ra(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!=t.length)return!1;e.sort(),t.sort();for(var n=0,a=e.length;n<a;n++)if(e[n]!==t[n])return!1;return!0}function ia(e,t){if(!e)return null;if(e=e.replace(/[^\x20-\x7E]/gim,"").trim(),!/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e))return e;if(/^blob:http/.test(e))return e;var n=Array.isArray(t)?t.join("|"):"http|https";return new RegExp("^(("+n+"):|//)","i").test(e)?e:null}function sa(e){return(sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function la(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ca(e){return(ca=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ua(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function da(e,t){return(da=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pa,ha,ma=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&da(e,t)}(fa,E.a.Component),ha=[{key:"getDerivedStateFromProps",value:function(e,t){return ra(e.tags,t.tags)||t.activated?null:{tags:e.tags}}}],la((pa=fa).prototype,[{key:"handleTagInput",value:function(e){if(this.setState({tagInput:e}),0<e.length){var t=e[e.length-1];'"'==e[0]?1<e.length&&'"'==t&&this.handleAddTag(e.substring(1,e.length-1)):","!=t&&" "!=t&&";"!=t&&'"'!=t||this.handleAddTag(e.substring(0,e.length-1).trim())}}},{key:"handleAddTag",value:function(e){if(0<e.length){var t=this.state.tags.slice(0);return t.push(e),this.setState({tags:t,tagInput:""}),this.props.onTagsChanged&&this.props.onTagsChanged(t),t}return this.state.tags}},{key:"handleRemoveTag",value:function(e,t){var n=this.state.tags.slice(0);n.splice(t,1),this.setState({tags:n}),this.props.onTagsChanged&&this.props.onTagsChanged(n)}},{key:"handleSubmit",value:function(){this.props.onSubmit(this.handleAddTag(this.state.tagInput.trim())),this.setState({activated:!1,tags:this.props.tags})}},{key:"handleCancel",value:function(){this.setState({activated:!1,tagInput:"",tags:this.props.tags}),this.props.onCancel&&this.props.onCancel()}},{key:"render",value:function(){var t=this,n=[];return this.state.activated?this.state.tags.map(function(e){n.push({user:e,invalid:e.length<4})}):(this.state.tags.map(function(e){n.push(E.a.createElement("span",{className:"badge",key:n.length},e))}),0==n.length&&(n=E.a.createElement("i",null,E.a.createElement(S.FormattedMessage,{id:"tags_not_found",defaultMessage:"No tags defined. Add some."})))),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},this.props.title)),this.state.activated?E.a.createElement("div",null,E.a.createElement(S.FormattedMessage,{id:"tags_editor_no_tags",defaultMessage:"Add some tags"},function(e){return E.a.createElement(on,{chips:n,avatarDisabled:!0,prompt:e,onEnter:t.handleAddTag,onFocusLost:t.handleAddTag,onCancel:t.handleCancel,onChipRemoved:t.handleRemoveTag,filterFunc:t.handleTagInput})}),this.props.onSubmit||this.props.onCancel?E.a.createElement("div",{id:"tag-manager-buttons",className:"dialog-buttons panel-form-row"},E.a.createElement("button",{className:"outline",onClick:this.handleCancel},E.a.createElement(S.FormattedMessage,{id:"button_cancel",defautMessage:"Cancel",description:"Rejection button [Cancel]"})),E.a.createElement("button",{className:"blue",onClick:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"button_ok",defautMessage:"OK",description:"Confirmation button [OK]"}))):null):E.a.createElement("div",{className:"quoted"},E.a.createElement("a",{href:"#",className:"flat-button",onClick:function(e){e.preventDefault(),t.setState({activated:!0})}},E.a.createElement("i",{className:"material-icons"},"edit"),"  ",E.a.createElement(S.FormattedMessage,{id:"title_manage_tags",defaultMessage:"Manage"})),E.a.createElement(E.a.Fragment,null,n)))}}]),ha&&la(pa,ha),fa);function fa(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,fa),n=this,(t=!(a=ca(fa).call(this,e))||"object"!==sa(a)&&"function"!=typeof a?ua(n):a).state={tags:t.props.tags,tagInput:"",activated:t.props.activated},t.handleTagInput=t.handleTagInput.bind(ua(t)),t.handleAddTag=t.handleAddTag.bind(ua(t)),t.handleRemoveTag=t.handleRemoveTag.bind(ua(t)),t.handleSubmit=t.handleSubmit.bind(ua(t)),t.handleCancel=t.handleCancel.bind(ua(t)),t}function ba(e){return(ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ga(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ya(e){return(ya=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function va(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _a(e,t){return(_a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var wa,Ea,Sa=Object(S.defineMessages)({requested:{id:"requested_permissions",defaultMessage:"Requested"},granted:{id:"granted_permissions",defaultMessage:"Granted"},edit_permissions:{id:"menu_item_edit_permissions",defaultMessage:"Edit permissions"},other_user:{id:"label_other_user",defaultMessage:"Other"},clear_messages:{id:"action_clear_messages",defaultMessage:"Clear Messages"},clear_messages_warning:{id:"clear_messages_warning",defaultMessage:"Are you sure you want to clear all messages? It cannot be undone."},delete_messages:{id:"action_delete_messages",defaultMessage:"Clear Messages for All"},delete_messages_warning:{id:"delete_messages_warning",defaultMessage:"Are you sure you want to delete all messages for everyone? It cannot be undone."},leave_chat:{id:"action_leave_chat",defaultMessage:"Leave Conversation"},leave_chat_warning:{id:"leave_chat_warning",defaultMessage:"Are you sure you want to leave this conversation?"},block_contact:{id:"action_block_contact",defaultMessage:"Block Contact"},block_contact_warning:{id:"block_contact_warning",defaultMessage:"Are you sure you want to block this contact?"},report_chat:{id:"action_report_chat",defaultMessage:"Report Conversation"},report_chat_warning:{id:"report_chat_warning",defaultMessage:"Are you sure you want to block and report this conversation?"}}),ka=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_a(e,t)}(Ca,E.a.Component),ga((wa=Ca).prototype,[{key:"componentDidUpdate",value:function(e){var t=this.props.tinode.getTopic(e.topic);t&&(this.onMetaDesc!=t.onMetaDesc&&(this.previousMetaDesc=t.onMetaDesc,t.onMetaDesc=this.onMetaDesc,this.previousSubsUpdated=t.onSubsUpdated,t.onSubsUpdated=this.onSubsUpdated,"grp"==t.getType()?(this.previousTagsUpdated=t.onTagsUpdated,t.onTagsUpdated=this.onTagsUpdated):this.previousTagsUpdated=void 0),this.state.topic!=e.topic&&(this.setState({topic:e.topic}),this.resetDesc(t,e),this.resetSubs(t,e)))}},{key:"componentWillUnmount",value:function(){var e=this.props.tinode.getTopic(this.props.topic);e&&(this.setState({topic:null}),e.onMetaDesc=this.previousMetaDesc,e.onSubsUpdated=this.previousSubsUpdated,e.onTagsUpdated=this.previousTagsUpdated)}},{key:"resetSubs",value:function(e,t){var n={contactList:[]};if("p2p"==e.getType()){var a=e.subscriber(t.topic);a?(n.modeGiven2=a.acs.getGiven(),n.modeWant2=a.acs.getWant()):(n.modeGiven2="N",n.modeWant2="N")}else e.subscribers(function(e){n.contactList.push(e)},this);this.setState(n)}},{key:"resetDesc",value:function(e){var t=e.getDefaultAccess()||{},n=e.getAccessMode();this.setState({owner:n&&n.isOwner(),admin:n&&n.isAdmin(),sharer:n&&n.isSharer(),deleter:n&&n.isDeleter(),muted:n&&n.isMuted(),fullName:e.public?e.public.fn:void 0,avatar:ne(e.public?e.public.photo:null),private:e.private?e.private.comment:null,address:e.name,groupTopic:"grp"==e.getType(),showMemberPanel:!1,access:n?n.getMode():void 0,modeGiven:n?n.getGiven():void 0,modeWant:n?n.getWant():void 0,auth:t.auth,anon:t.anon}),"grp"==e.getType()&&n&&n.isOwner()&&e.getMeta(e.startMetaQuery().withTags().build())}},{key:"onMetaDesc",value:function(e){var t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetDesc(t,this.props),this.previousMetaDesc&&this.previousMetaDesc!=this.onMetaDesc&&this.previousMetaDesc(e))}},{key:"onSubsUpdated",value:function(e){var t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetSubs(t,this.props),this.previousSubsUpdated&&this.previousSubsUpdated!=this.onSubsUpdated&&this.previousSubsUpdated(e))}},{key:"onTagsUpdated",value:function(e){this.setState({tags:e}),this.previousTagsUpdated&&this.previousTagsUpdated!=this.onTagsUpdated&&this.previousTagsUpdated()}},{key:"handleFullNameUpdate",value:function(e){e=e.trim().substring(0,60),this.state.fullName!==e&&(this.setState({fullName:e}),this.props.onTopicDescUpdate(this.props.topic,oa(e,null),null))}},{key:"handlePrivateUpdate",value:function(e){e=e.trim().substring(0,60),this.state.private!==e&&(this.setState({private:e}),this.props.onTopicDescUpdate(this.props.topic,null,e||k.a.DEL_CHAR))}},{key:"handleImageChanged",value:function(e){this.setState({avatar:e}),this.props.onTopicDescUpdate(this.props.topic,oa(null,e||k.a.DEL_CHAR),null)}},{key:"handleMuted",value:function(e,t){this.setState({muted:t}),this.props.onChangePermissions(this.props.topic,t?"-P":"+P")}},{key:"handlePermissionsChanged",value:function(e){switch(this.state.showPermissionEditorFor){case"auth":this.props.onTopicDescUpdate(this.props.topic,null,null,{auth:e});break;case"anon":this.props.onTopicDescUpdate(this.props.topic,null,null,{anon:e});break;case"mode":case"want":this.props.onChangePermissions(this.props.topic,e);break;case"given":this.props.onChangePermissions(this.props.topic,e,this.props.topic);break;case"user":this.props.onChangePermissions(this.props.topic,e,this.state.userPermissionsEdited)}this.setState({showPermissionEditorFor:void 0})}},{key:"handleLaunchPermissionsEditor",value:function(e,t){var n,a,o,r,i,s,l,c=this.props.intl.formatMessage;switch(e){case"mode":n=this.state.access;break;case"want":n=this.state.modeWant,a=this.state.modeGiven,o=this.state.groupTopic?"O":"ASDO",r=c(Sa.requested),i=c(Sa.granted);break;case"given":n=this.state.modeGiven2,a=this.state.modeWant2,o=this.state.groupTopic?this.state.owner?"":"O":"ASDO",r=c(Sa.granted),i=c(Sa.requested);break;case"auth":n=this.state.auth,o="O";break;case"anon":n=this.state.anon,o="O";break;case"user":var u=this.props.tinode.getTopic(this.props.topic);if(!u)return;var d=u.subscriber(t);if(!d||!d.acs)return;n=d.acs.getGiven(),a=d.acs.getWant(),o=this.state.owner?"":"O",r=c(Sa.granted),i=c(Sa.requested),d.public&&(s=d.public.fn,l=d.public.photo);break;default:console.log("Unknown permission editing mode '"+e+"'")}this.setState({showPermissionEditorFor:e,userPermissionsEdited:t,userPermissionsTitle:s,userPermissionsAvatar:l,editedPermissions:n,immutablePermissions:a,editedPermissionsTitle:r,immutablePermissionsTitle:i,editedPermissionsSkipped:o})}},{key:"handleHidePermissionsEditor",value:function(){this.setState({showPermissionEditorFor:void 0})}},{key:"handleShowAddMembers",value:function(e){e.preventDefault(),this.props.onInitFind(),this.setState({showMemberPanel:!0})}},{key:"handleHideAddMembers",value:function(){this.setState({showMemberPanel:!1})}},{key:"handleMemberUpdateRequest",value:function(e,t,n){this.props.onMemberUpdateRequest(this.props.topic,t,n),this.setState({showMemberPanel:!1})}},{key:"handleDeleteMessages",value:function(e){var t=this;e.preventDefault();var n=this.props.intl.formatMessage;this.props.onShowAlert(n(this.state.deleter?Sa.delete_messages:Sa.clear_messages),n(this.state.deleter?Sa.delete_messages_warning:Sa.clear_messages_warning),function(){t.props.onDeleteMessages(t.props.topic)},null,!0,null)}},{key:"handleLeave",value:function(e){var t=this;e.preventDefault();var n=this.props.intl.formatMessage;this.props.onShowAlert(n(Sa.leave_chat),n(Sa.leave_chat_warning),function(){t.props.onLeaveTopic(t.props.topic)},null,!0,null)}},{key:"handleBlock",value:function(e){var t=this;e.preventDefault();var n=this.props.intl.formatMessage;this.props.onShowAlert(n(Sa.block_contact),n(Sa.block_contact_warning),function(){t.props.onBlockTopic(t.props.topic)},null,!0,null)}},{key:"handleReport",value:function(e){var t=this;e.preventDefault();var n=this.props.intl.formatMessage;this.props.onShowAlert(n(Sa.report_chat),n(Sa.report_chat_warning),function(){t.props.onReportTopic(t.props.topic)},null,!0,null)}},{key:"handleMemberSelected",value:function(e){this.setState({selectedContact:e})}},{key:"handleMoreInfo",value:function(e){this.setState({moreInfoExpanded:e})}},{key:"handleTagsUpdated",value:function(e){ra(this.state.tags.slice(0),e.slice(0))||this.props.onTopicTagsUpdate(this.props.topic,e)}},{key:"handleContextMenu",value:function(e){var t=this.props.intl.formatMessage,n=this,a=this.props.tinode.getTopic(this.props.topic);if(a){var o=a.subscriber(e.topicName);if(o&&o.acs){var r=[{title:t(Sa.edit_permissions),handler:function(){n.handleLaunchPermissionsEditor("user",e.topicName)}},"member_delete",o.acs.isMuted()?"member_unmute":"member_mute",o.acs.isJoiner()?"member_block":"member_unblock"];this.props.showContextMenu({topicName:this.props.topic,x:e.x,y:e.y,user:e.topicName},r)}}}},{key:"render",value:function(){var t=this,e=this.props.intl.formatMessage;return E.a.createElement("div",{id:"info-view"},E.a.createElement("div",{className:"caption-panel",id:"info-caption-panel"},E.a.createElement("div",{className:"panel-title",id:"info-title"},E.a.createElement(S.FormattedMessage,{id:"title_info",defaultMessage:"Info"})),E.a.createElement("div",null,E.a.createElement(jt,{onCancel:this.props.onCancel}))),this.props.displayMobile?E.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,this.state.showMemberPanel?E.a.createElement(yn,{members:this.state.contactList,requiredMember:this.props.myUserId,keepInitialMembers:!this.state.admin&&!this.state.owner,myUserId:this.props.myUserId,contacts:this.props.searchableContacts,onCancel:this.handleHideAddMembers,onSubmit:this.handleMemberUpdateRequest}):this.state.showPermissionEditorFor?E.a.createElement(na,{mode:this.state.editedPermissions,compare:this.state.immutablePermissions,skip:this.state.editedPermissionsSkipped,modeTitle:this.state.editedPermissionsTitle,compareTitle:this.state.immutablePermissionsTitle,userTitle:this.state.userPermissionsTitle,item:this.state.userPermissionsEdited,userAvatar:this.state.userPermissionsAvatar,onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):E.a.createElement("div",{id:"info-view-content",className:"scrollable-panel"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_topic_name",defaultMessage:"Name"}))),E.a.createElement("div",null,E.a.createElement(xn,{placeholder:this.state.groupTopic?"Group name":E.a.createElement("i",null,"Unknown"),readOnly:!this.state.owner,value:this.state.fullName,required:!0,onFinished:this.handleFullNameUpdate})),E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_private",defaultMessage:"Private comment"}))),E.a.createElement("div",null,E.a.createElement(S.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:"Visible to you only"},function(e){return E.a.createElement(xn,{placeholder:e,value:t.state.private,onFinished:t.handlePrivateUpdate})}))),E.a.createElement(ge,{avatar:this.state.avatar,readOnly:!this.state.owner,uid:this.props.topic,title:this.state.fullName,onImageChanged:this.handleImageChanged,onError:this.props.onError})),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",null,E.a.createElement(S.FormattedMessage,{id:"label_muting_topic",defaultMessage:"Muted:"})),E.a.createElement(Me,{name:"P",checked:this.state.muted,onChange:this.handleMuted})),E.a.createElement(S.FormattedMessage,{id:"action_more",defaultMessage:"More"},function(e){return E.a.createElement(Vn,{title:e,open:t.state.moreInfoExpanded,onToggle:t.handleMoreInfo})}),this.state.moreInfoExpanded?E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",null,E.a.createElement(S.FormattedMessage,{id:"label_user_id"})),E.a.createElement("tt",null,this.state.address)),this.state.groupTopic?E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",null,E.a.createElement(S.FormattedMessage,{id:"label_your_permissions",defaultMessage:"Your permissions:"})),E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)):E.a.createElement("div",null,E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_permissions",defaultMessage:"Permissions:"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("div",null,E.a.createElement(S.FormattedMessage,{id:"label_you",defaultMessage:"You:"}),"  ",E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)),E.a.createElement("div",null,this.state.fullName?this.state.fullName:e(Sa.other_user),":  ",E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"given")},this.state.modeGiven2)))),this.state.sharer&&(this.state.auth||this.state.anon)?E.a.createElement("div",null,E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_default_access",defaultMessage:"Default access mode:"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("div",null,"Auth: ",this.state.admin?E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth):E.a.createElement("tt",null,this.state.auth)),E.a.createElement("div",null,"Anon: ",this.state.admin?E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon):E.a.createElement("tt",null,this.state.anon)))):null):null),E.a.createElement("div",{className:"hr"}),this.state.owner?E.a.createElement(E.a.Fragment,null,E.a.createElement(S.FormattedMessage,{id:"title_tag_manager"},function(e){return E.a.createElement(ma,{title:e,tags:t.state.tags,activated:!1,onSubmit:t.handleTagsUpdated})}),E.a.createElement("div",{className:"hr"})):null,E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("a",{href:"#",className:"flat-button",onClick:this.handleDeleteMessages},E.a.createElement("i",{className:"material-icons"},"delete_outline"),"  ",e(this.state.deleter?Sa.delete_messages:Sa.clear_messages)),E.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleLeave},E.a.createElement("i",{className:"material-icons"},"exit_to_app"),"  ",e(Sa.leave_chat)),this.state.groupTopic?null:E.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleBlock},E.a.createElement("i",{className:"material-icons"},"block"),"  ",e(Sa.block_contact)),this.state.owner?null:E.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleReport},E.a.createElement("i",{className:"material-icons"},"report"),"  ",e(Sa.report_chat))),this.state.groupTopic?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_group_members",defaultMessage:"Group members:"}))),E.a.createElement("div",{className:"panel-form-row"},this.state.sharer?E.a.createElement("a",{href:"#",className:"flat-button",onClick:this.handleShowAddMembers},E.a.createElement("i",{className:"material-icons"},"person_add"),"  ",E.a.createElement(S.FormattedMessage,{id:"button_add_members",defaultMessage:"Add members"})):null),E.a.createElement(S.FormattedMessage,{id:"group_has_no_members",defaultMessage:"No members"},function(e){return E.a.createElement(Et,{contacts:t.state.contactList,myUserId:t.props.myUserId,emptyListMessage:e,topicSelected:t.state.selectedContact,showOnline:!1,showUnread:!1,showMode:!0,noScroll:!0,onTopicSelected:t.handleMemberSelected,showContextMenu:!!t.state.admin&&t.handleContextMenu})}))):null))}}]),Ea&&ga(wa,Ea),Ca);function Ca(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ca),n=this,(t=!(a=ya(Ca).call(this,e))||"object"!==ba(a)&&"function"!=typeof a?va(n):a).state={topic:null,owner:!1,admin:!1,sharer:!1,deleter:!1,muted:!1,address:null,groupTopic:void 0,fullName:void 0,avatar:null,private:null,selectedContact:null,access:null,modeGiven:null,modeWant:null,modeGiven2:null,modeWant2:null,auth:null,anon:null,contactList:[],tags:[],showMemberPanel:!1,showPermissionEditorFor:void 0,moreInfoExpanded:!1,previousMetaDesc:void 0,previousSubsUpdated:void 0,previousTagsUpdated:void 0},t.resetSubs=t.resetSubs.bind(va(t)),t.resetDesc=t.resetDesc.bind(va(t)),t.onMetaDesc=t.onMetaDesc.bind(va(t)),t.onSubsUpdated=t.onSubsUpdated.bind(va(t)),t.onTagsUpdated=t.onTagsUpdated.bind(va(t)),t.handleFullNameUpdate=t.handleFullNameUpdate.bind(va(t)),t.handlePrivateUpdate=t.handlePrivateUpdate.bind(va(t)),t.handleImageChanged=t.handleImageChanged.bind(va(t)),t.handleMuted=t.handleMuted.bind(va(t)),t.handlePermissionsChanged=t.handlePermissionsChanged.bind(va(t)),t.handleLaunchPermissionsEditor=t.handleLaunchPermissionsEditor.bind(va(t)),t.handleHidePermissionsEditor=t.handleHidePermissionsEditor.bind(va(t)),t.handleShowAddMembers=t.handleShowAddMembers.bind(va(t)),t.handleHideAddMembers=t.handleHideAddMembers.bind(va(t)),t.handleMemberUpdateRequest=t.handleMemberUpdateRequest.bind(va(t)),t.handleDeleteMessages=t.handleDeleteMessages.bind(va(t)),t.handleLeave=t.handleLeave.bind(va(t)),t.handleBlock=t.handleBlock.bind(va(t)),t.handleReport=t.handleReport.bind(va(t)),t.handleMemberSelected=t.handleMemberSelected.bind(va(t)),t.handleMoreInfo=t.handleMoreInfo.bind(va(t)),t.handleTagsUpdated=t.handleTagsUpdated.bind(va(t)),t.handleContextMenu=t.handleContextMenu.bind(va(t)),t}var Ma=Object(S.injectIntl)(ka);function Oa(e){return(Oa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ta(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Pa(e,t){return!t||"object"!==Oa(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function ja(e){return(ja=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Na(e,t){return(Na=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Aa,Fa,Ua=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Na(e,t)}(xa,E.a.PureComponent),Ta((Aa=xa).prototype,[{key:"render",value:function(){var t=this;return E.a.createElement("div",{className:"uploader"},E.a.createElement("div",null,E.a.createElement("span",{style:{width:100*this.props.progress+"%"}})),this.props.progress<.999?E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onCancel()}},E.a.createElement("i",{className:"material-icons"},"close")," ",E.a.createElement(S.FormattedMessage,{id:"action_cancel",defaultMessage:"cancel"})):E.a.createElement(S.FormattedMessage,{id:"upload_finishing",defaultMessage:"finishing..."}))}}]),Fa&&Ta(Aa,Fa),xa);function xa(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,xa),Pa(this,ja(xa).apply(this,arguments))}function Da(e){return(Da="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ra(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ia(e){return(Ia=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function La(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qa(e,t){return(qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ha,Wa,Ba=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qa(e,t)}(Va,E.a.Component),Ra((Ha=Va).prototype,[{key:"downloadFile",value:function(e,t,n){var a=this,o=this.props.tinode.getLargeFileHelper();this.setState({downloader:o}),o.download(e,t,n,function(e){a.setState({progress:e/a.props.size})}).then(function(){a.setState({downloader:null,progress:0})}).catch(function(e){e&&a.props.onError("Error downloading file: "+e.message,"err"),a.setState({downloader:null,progress:0})})}},{key:"handleCancel",value:function(){this.props.uploader?this.props.onCancelUpload():this.state.downloader&&this.state.downloader.cancel()}},{key:"render",value:function(){var t=this,e=this.props.filename||"file_attachment";36<e.length&&(e=e.substr(0,16)+"..."+e.substr(-16));var n,a,o,r=0<this.props.size?E.a.createElement("span",{className:"small gray"},"(",V(this.props.size),")"):null;return a=this.props.uploader||this.state.downloader||(o=this.props.downloadUrl,/^\s*([a-z][a-z0-9+.-]*:|\/\/)/im.test(o))?(n=ia(this.props.downloadUrl)||"about:blank",null):(n="#",function(e){e.preventDefault(),t.downloadFile(t.props.downloadUrl,t.props.filename,t.props.mimetype)}),E.a.createElement("div",{className:"attachment"},E.a.createElement("div",null,E.a.createElement("i",{className:"material-icons big gray"},"insert_drive_file")),E.a.createElement("div",{className:"flex-column"},E.a.createElement("div",null,e," ",r),this.props.uploader||this.state.downloader?E.a.createElement(Ua,{progress:this.props.uploader?this.props.progress:this.state.progress,onCancel:this.handleCancel}):E.a.createElement("div",null,E.a.createElement("a",{href:n,download:this.props.filename,onClick:a},E.a.createElement("i",{className:"material-icons"},"file_download")," ",E.a.createElement(S.FormattedMessage,{id:"save_attachment",defaultMessage:"save"})))))}}]),Wa&&Ra(Ha,Wa),Va);function Va(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Va),n=this,(t=!(a=Ia(Va).call(this,e))||"object"!==Da(a)&&"function"!=typeof a?La(n):a).state={downloader:null,progress:0},t.downloadFile=t.downloadFile.bind(La(t)),t.handleCancel=t.handleCancel.bind(La(t)),t}function Ga(e){return(Ga="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ka(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function za(e,t){return!t||"object"!==Ga(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ja(e){return(Ja=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ya(e,t){return(Ya=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qa,Xa,Za=Object(S.defineMessages)({sending:{id:"message_sending",defaultMessage:"sending..."},failed:{id:"message_sending_failed",defaultMessage:"failed"}}),$a=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ya(e,t)}(eo,E.a.PureComponent),Ka((Qa=eo).prototype,[{key:"render",value:function(){var e,t=this.props.intl.formatMessage;e=this.props.received<=k.a.MESSAGE_STATUS_SENDING?t(Za.sending):this.props.received==k.a.MESSAGE_STATUS_FAILED?t(Za.failed):B(this.props.timestamp,this.props.intl.locale);var n=null;return this.props.received<=k.a.MESSAGE_STATUS_SENDING?n=E.a.createElement("i",{className:"material-icons small"},"access_time"):this.props.received==k.a.MESSAGE_STATUS_FAILED?n=E.a.createElement("i",{className:"material-icons small amber"},"warning"):this.props.received==k.a.MESSAGE_STATUS_SENT?n=E.a.createElement("i",{className:"material-icons small"},"done"):this.props.received==k.a.MESSAGE_STATUS_RECEIVED?n=E.a.createElement("i",{className:"material-icons small"},"done_all"):this.props.received==k.a.MESSAGE_STATUS_READ&&(n=E.a.createElement("i",{className:"material-icons small blue"},"done_all")),E.a.createElement("span",{className:"timestamp"},e," ",n)}}]),Xa&&Ka(Qa,Xa),eo);function eo(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,eo),za(this,Ja(eo).apply(this,arguments))}var to=Object(S.injectIntl)($a);function no(e){return(no="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ao(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function oo(e){return(oo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ro(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function io(e,t){return(io=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var so,lo,co=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&io(e,t)}(uo,E.a.Component),ao((so=uo).prototype,[{key:"handlePreviewImage",value:function(e){e.preventDefault(),this.props.onImagePreview({url:e.target.src,filename:e.target.title,width:e.target.dataset.width,height:e.target.dataset.height,size:e.target.dataset.size,type:e.target.dataset.mime})}},{key:"handleFormButtonClick",value:function(e){e.preventDefault();var t={seq:this.props.seq,resp:{}};e.target.dataset.name&&(t.resp[e.target.dataset.name]=e.target.dataset.val?e.target.dataset.val:void 0===e.target.dataset.val?1:""+e.target.dataset.val),"url"==e.target.dataset.act&&(t.ref=ia(e.target.dataset.ref)||"about:blank");var n=e.target.dataset.title||"unknown";this.props.onFormResponse(e.target.dataset.act,n,t)}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({seq:this.props.seq,y:e.pageY,x:e.pageX})}},{key:"handleProgress",value:function(e){this.setState({progress:e})}},{key:"handleCancelUpload",value:function(){this.props.uploader.cancel()}},{key:"render",value:function(){var t=this,e=this.props.deleted?"center":this.props.sequence+" "+(this.props.response?"left":"right"),n="single"==this.props.sequence||"last"==this.props.sequence?"bubble tip":"bubble",a=this.props.deleted?null:this.props.userAvatar||!0,o=this.props.userFrom&&this.props.response&&("single"==this.props.sequence||"last"==this.props.sequence),r=this.props.content,i=[];return this.props.mimeType==l.Drafty.getContentType()?(l.Drafty.attachments(r,function(e,t){"application/json"!=e.mime&&i.push(E.a.createElement(Ba,{tinode:this.props.tinode,downloadUrl:l.Drafty.getDownloadUrl(e),filename:e.name,uploader:l.Drafty.isUploading(e),mimetype:e.mime,size:l.Drafty.getEntitySize(e),progress:this.state.progress,onCancelUpload:this.handleCancelUpload,onError:this.props.onError,key:t}))},this),r=E.a.createElement("span",null,l.Drafty.format(r,po,this))):this.props.deleted?r=E.a.createElement(E.a.Fragment,null,E.a.createElement("i",{className:"material-icons gray"},"block")," ",E.a.createElement("i",{className:"gray"},E.a.createElement(S.FormattedMessage,{id:"deleted_content",defaultMessage:"content deleted"}))):"string"!=typeof r&&(r=E.a.createElement(E.a.Fragment,null,E.a.createElement("i",{className:"material-icons gray"},"error_outline")," ",E.a.createElement("i",{className:"gray"},E.a.createElement(S.FormattedMessage,{id:"invalid_content",defaultMessage:"invalid content"})))),E.a.createElement("li",{className:e},this.props.userFrom&&this.props.response?E.a.createElement("div",{className:"avatar-box"},o?E.a.createElement(Z,{topic:this.props.userFrom,title:this.props.userName,avatar:a}):null):null,E.a.createElement("div",null,E.a.createElement("div",{className:n},E.a.createElement("div",{className:"message-content"},r,i,this.props.timestamp?E.a.createElement(to,{timestamp:this.props.timestamp,received:this.props.received}):null),this.props.deleted?null:E.a.createElement("span",{className:"menuTrigger"},E.a.createElement("a",{href:"#",onClick:this.handleContextClick},E.a.createElement("i",{className:"material-icons"},"expand_more")))),o?E.a.createElement("div",{className:"author"},E.a.createElement(S.FormattedMessage,{id:"user_not_found",defaultMessage:"Not found"},function(e){return t.props.userName||E.a.createElement("i",null,e)})):null))}}]),lo&&ao(so,lo),uo);function uo(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,uo),n=this,(t=!(a=oo(uo).call(this,e))||"object"!==no(a)&&"function"!=typeof a?ro(n):a).state={progress:0},e.uploader&&(e.uploader.onProgress=t.handleProgress.bind(ro(t))),t.handlePreviewImage=t.handlePreviewImage.bind(ro(t)),t.handleFormButtonClick=t.handleFormButtonClick.bind(ro(t)),t.handleContextClick=t.handleContextClick.bind(ro(t)),t.handleCancelUpload=t.handleCancelUpload.bind(ro(t)),t}function po(e,t,n,a){var o=l.Drafty.tagName(e);if(o){var r=l.Drafty.attrValue(e,t)||{};switch(r.key=a,e){case"IM":if(t){r.className="inline-image";var i=ae(t.width,t.height,Math.min(this.props.viewportWidth-52,468),312,!1);i=i||{dstWidth:32,dstHeight:32},r.style={width:i.dstWidth+"px",height:i.dstHeight+"px"},r.src=function(e){if(!e)return null;var t=ia(e);return t||(/data:image\/[a-z0-9.-]+;base64,/i.test(e.trim())?e:null)}(r.src),r.src?(r.onClick=this.handlePreviewImage,r.className+=" image-clickable"):r.src="img/broken_image.png"}break;case"BN":r.onClick=this.handleFormButtonClick;var s=E.a.Children.map(n,function(e){return"string"==typeof e?e:void 0});s&&0!=s.length||(s=[r.name]),r["data-title"]=s.join("");break;case"FM":r.className="bot-form"}return E.a.createElement(o,r,n)}return n}function ho(e){return(ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mo(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function fo(e,t){return!t||"object"!==ho(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function bo(e){return(bo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function go(e,t){return(go=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yo,vo,_o=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&go(e,t)}(wo,E.a.Component),mo((yo=wo).prototype,[{key:"render",value:function(){var t=[],e=(this.props.subscribers||[]).length,n=Math.min(4,e);return(this.props.subscribers||[]).some(function(e){return t.push(E.a.createElement("div",{className:"avatar-box",key:e.user},E.a.createElement(Z,{topic:e.user,avatar:ne(e.public?e.public.photo:null)||!0,title:e.public?e.public.fn:null}))),t.length==n}),E.a.createElement("div",{id:"topic-users"},t," ",n<e?E.a.createElement("span",null,E.a.createElement(S.FormattedMessage,{id:"more_online_members",defaultMessage:"+{overflow} more",values:{overflow:e-n}})):null)}}]),vo&&mo(yo,vo),wo);function wo(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,wo),fo(this,bo(wo).call(this,e))}function Eo(e){return(Eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function So(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ko(e,t){return!t||"object"!==Eo(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Co(e){return(Co=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Mo(e,t){return(Mo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Oo,To,Po=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mo(e,t)}(jo,E.a.PureComponent),So((Oo=jo).prototype,[{key:"assignWidth",value:function(e){if(e&&!this.state.width){var t=e.getBoundingClientRect();this.setState({width:0|t.width,height:0|t.height})}}},{key:"render",value:function(){var t=this;if(!this.props.content)return null;var e=ae(this.props.content.width,this.props.content.height,this.state.width,this.state.height,!1),n=e?{width:e.dstWidth+"px",height:e.dstHeight+"px"}:this.props.content.width>this.props.content.height?{width:"100%"}:{height:"100%"};n.maxWidth="100%",n.maxHeight="100%";var a=this.props.content.filename,o=Math.max((this.state.width/13/1.5|0)-2,12);a.length>o&&(a=a.slice(0,o/2-1)+"..."+a.slice(1-o/2));var r=this.props.content.width||"-",i=this.props.content.height||"-";return E.a.createElement("div",{id:"image-preview",onClick:this.props.onClose},E.a.createElement("div",{id:"image-preview-caption-panel"},this.props.downloadable?E.a.createElement("a",{href:this.props.content.url,download:this.props.content.filename},E.a.createElement("i",{className:"material-icons"},"file_download")," ",E.a.createElement(S.FormattedMessage,{id:"download_action",defaultMessage:"download"})):null,E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onClose()}},E.a.createElement("i",{className:"material-icons gray"},"close"))),E.a.createElement("div",{id:"image-preview-container",ref:function(e){return t.assignWidth(e)}},E.a.createElement("img",{src:this.props.content.url,style:n})),E.a.createElement("div",{id:"image-preview-footer"},E.a.createElement("div",null,E.a.createElement("div",null,E.a.createElement("b",null,E.a.createElement(S.FormattedMessage,{id:"label_file_name",defaultMessage:"File name:"}))),E.a.createElement("div",null,E.a.createElement("span",{title:this.props.content.filename},a||"-"))),E.a.createElement("div",null,E.a.createElement("div",null,E.a.createElement("b",null,E.a.createElement(S.FormattedMessage,{id:"label_content_type",defaultMessage:"Content type:"}))),E.a.createElement("div",null,this.props.content.type)),E.a.createElement("div",null,E.a.createElement("div",null,E.a.createElement("b",null,E.a.createElement(S.FormattedMessage,{id:"label_size",defaultMessage:"Size:"}))),E.a.createElement("div",null,r," × ",i," px; ",V(this.props.content.size)))))}}]),To&&So(Oo,To),jo);function jo(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,jo),(t=ko(this,Co(jo).call(this,e))).state={width:0,height:0},t}function No(e){return(No="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ao(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Fo(e){return(Fo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Uo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xo(e,t){return(xo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Do,Ro,Io=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xo(e,t)}(Lo,E.a.PureComponent),Ao((Do=Lo).prototype,[{key:"handleButtonAction",value:function(e,t){e.preventDefault(),this.props.onAction(t)}},{key:"render",value:function(){var t=this;return E.a.createElement("div",{className:"accept-invite-panel"},E.a.createElement("div",{className:"title"},E.a.createElement(S.FormattedMessage,{id:"chat_invitation",defaultMessage:"You are invited to start a new chat. What would you like to do?"})),E.a.createElement("div",{className:"footer"},E.a.createElement("button",{className:"blue",onClick:function(e){t.handleButtonAction(e,"accept")}},E.a.createElement(S.FormattedMessage,{id:"chat_invitation_accept",defaultMessage:"Accept"})),E.a.createElement("button",{className:"white",onClick:function(e){t.handleButtonAction(e,"delete")}},E.a.createElement(S.FormattedMessage,{id:"chat_invitation_ignore",defaultMessage:"Ignore"})),E.a.createElement("button",{className:"white",onClick:function(e){t.handleButtonAction(e,"block")}},E.a.createElement(S.FormattedMessage,{id:"chat_invitation_block",defaultMessage:"Block"}))))}}]),Ro&&Ao(Do,Ro),Lo);function Lo(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Lo),n=this,(t=!(a=Fo(Lo).call(this,e))||"object"!==No(a)&&"function"!=typeof a?Uo(n):a).handleButtonAction=t.handleButtonAction.bind(Uo(t)),t}function qo(e){return(qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ho(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Wo(e,t){return!t||"object"!==qo(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Bo(e){return(Bo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vo(e,t){return(Vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Go,Ko,zo=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vo(e,t)}(Jo,E.a.PureComponent),Ho((Go=Jo).prototype,[{key:"render",value:function(){return this.props.show?E.a.createElement("div",{className:"load-spinner-box"},E.a.createElement("div",{className:"loader-spinner"})):null}}]),Ko&&Ho(Go,Ko),Jo);function Jo(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Jo),Wo(this,Bo(Jo).apply(this,arguments))}function Yo(e){return(Yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qo(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Xo(e,t){return!t||"object"!==Yo(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Zo(e){return(Zo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $o(e,t){return($o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var er,tr,nr=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$o(e,t)}(ar,E.a.PureComponent),Qo((er=ar).prototype,[{key:"render",value:function(){var e=y+" ("+k.a.getLibrary()+")";return E.a.createElement("div",{id:"dummy-view",className:this.props.hideSelf?"nodisplay":null},E.a.createElement("div",null,E.a.createElement("a",{href:"https://github.com/tinode/chat/"},E.a.createElement("img",{id:"logo",alt:"logo",src:"img/logo.svg"}),E.a.createElement("h2",null,"Tinode Web")),E.a.createElement("p",null,E.a.createElement(S.FormattedMessage,{id:"label_client",defaultMessage:"Client:"})," ",e),E.a.createElement("p",null,E.a.createElement(S.FormattedMessage,{id:"label_server",defaultMessage:"Server:"})," ",this.props.serverVersion," (",this.props.serverAddress,")")))}}]),tr&&Qo(er,tr),ar);function ar(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ar),Xo(this,Zo(ar).apply(this,arguments))}function or(e){return(or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rr(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ir(e){return(ir=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function sr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lr(e,t){return(lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var cr,ur,dr=Object(S.defineMessages)({messaging_disabled:{id:"messaging_disabled_prompt",defaultMessage:"Messaging disabled"},type_new_message:{id:"new_message_prompt",defaultMessage:"New message"},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:"The file size {size} exceeds the {limit} limit."},cannot_initiate_upload:{id:"cannot_initiate_file_upload",defaultMessage:"Cannot initiate file upload."}}),pr=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&lr(e,t)}(hr,E.a.PureComponent),rr((cr=hr).prototype,[{key:"componentDidMount",value:function(){this.messageEditArea.addEventListener("paste",this.handlePasteEvent,!1)}},{key:"componentWillUnmount",value:function(){this.messageEditArea.removeEventListener("paste",this.handlePasteEvent,!1)}},{key:"componentDidUpdate",value:function(){this.messageEditArea.focus()}},{key:"handlePasteEvent",value:function(e){var r=this;this.props.disabled||!function(e,t,n,a){var o=(e.clipboardData||e.originalEvent.clipboardData||{}).items;for(var r in o){var i=o[r];if("file"===i.kind){var s=i.getAsFile();if(s)return s.type&&"image"==s.type.split("/")[0]?s.size>C||ee.indexOf(s.type)<0?re(s,768,768,!1,t,a):ie(s,t,a):se(s,n),1;console.log("Failed to get file object from pasted file item",i.kind,i.type)}}return 0}(e,function(e,t,n,a,o){r.props.onAttachImage(t,e,n,a,o)},function(e,t,n){r.props.onAttachFile(e,t,n)},this.props.onError)||e.preventDefault()}},{key:"handleAttachImage",value:function(e){var r=this;if(e.target.files&&0<e.target.files.length){var t=e.target.files[0];t.size>C||ee.indexOf(t.type)<0?re(t,768,768,!1,function(e,t,n,a,o){r.props.onAttachImage(t,e,n,a,o)},function(e){r.props.onError(e,"err")}):ie(t,function(e,t,n,a,o){r.props.onAttachImage(t,e,n,a,o)},function(e){r.props.onError(e,"err")})}e.target.value=""}},{key:"handleAttachFile",value:function(e){var a=this,t=this.props.intl.formatMessage;if(e.target.files&&0<e.target.files.length){var n=e.target.files[0];if(n.size>1<<23)this.props.onError(t(dr.file_attachment_too_large,{size:V(n.size),limit:V(1<<23)}),"err");else if(n.size>C){var o=this.props.tinode.getLargeFileHelper();if(!o)return void this.props.onError(t(dr.cannot_initiate_upload));this.props.onAttachFile(n.type,null,n.name,n.size,uploadCompletionPromise,o)}else se(n,function(e,t,n){a.props.onAttachFile(e,t,n)},this.props.onError)}e.target.value=""}},{key:"handleSend",value:function(e){e.preventDefault(),this.state.message.trim()&&(this.props.onSendMessage(this.state.message.trim()),this.setState({message:""}))}},{key:"handleKeyPress",value:function(e){"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),e.stopPropagation(),this.handleSend(e)))}},{key:"handleMessageTyping",value:function(e){var t={message:e.target.value},n=(new Date).getTime();if(3e3<n-this.state.keypressTimestamp){var a=this.props.tinode.getTopic(this.props.topic);a.isSubscribed()&&a.noteKeyPress(),t.keypressTimestamp=n}this.setState(t)}},{key:"render",value:function(){var t=this,e=this.props.intl.formatMessage,n=this.props.disabled?e(dr.messaging_disabled):e(dr.type_new_message);return E.a.createElement("div",{id:"send-message-panel"},this.props.disabled?E.a.createElement("i",{className:"material-icons disabled"},"photo"):E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.attachImage.click()},title:"Add image"},E.a.createElement("i",{className:"material-icons secondary"},"photo")),this.props.disabled?E.a.createElement("i",{className:"material-icons disabled"},"attach_file"):E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.attachFile.click()},title:"Attach file"},E.a.createElement("i",{className:"material-icons secondary"},"attach_file")),E.a.createElement("textarea",{id:"sendMessage",placeholder:n,disabled:this.props.disabled,value:this.state.message,onChange:this.handleMessageTyping,onKeyPress:this.handleKeyPress,ref:function(e){t.messageEditArea=e},autoFocus:!0}),this.props.disabled?E.a.createElement("i",{className:"material-icons disabled"},"send"):E.a.createElement("a",{href:"#",onClick:this.handleSend,title:"Send"},E.a.createElement("i",{className:"material-icons"},"send")),E.a.createElement("input",{type:"file",ref:function(e){t.attachFile=e},onChange:this.handleAttachFile,style:{display:"none"}}),E.a.createElement("input",{type:"file",ref:function(e){t.attachImage=e},accept:"image/*",onChange:this.handleAttachImage,style:{display:"none"}}))}}]),ur&&rr(cr,ur),hr);function hr(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,hr),n=this,(t=!(a=ir(hr).call(this,e))||"object"!==or(a)&&"function"!=typeof a?sr(n):a).state={message:"",keypressTimestamp:(new Date).getTime()-3e3-1},t.handlePasteEvent=t.handlePasteEvent.bind(sr(t)),t.handleAttachImage=t.handleAttachImage.bind(sr(t)),t.handleAttachFile=t.handleAttachFile.bind(sr(t)),t.handleSend=t.handleSend.bind(sr(t)),t.handleKeyPress=t.handleKeyPress.bind(sr(t)),t.handleMessageTyping=t.handleMessageTyping.bind(sr(t)),t}var mr=Object(S.injectIntl)(pr);function fr(e){return(fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function br(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function gr(e){return(gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var _r=k.a.Drafty,wr=Object(S.defineMessages)({online_now:{id:"online_now",defaultMessage:"online now"},last_seen:{id:"last_seen_timestamp",defaultMessage:"Last seen"},not_found:{id:"title_not_found",defaultMessage:"Not found"}});function Er(e){if(e){var t=e.getExcessive()||"";return e.isJoiner("given")&&(t.includes("R")||t.includes("W"))}return!1}function Sr(e){if(e){var t=e.getMissing()||"";return e.isJoiner("want")&&(t.includes("R")||t.includes("W"))}return!1}var kr,Cr,Mr,Or=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vr(e,t)}(Tr,E.a.Component),Mr=[{key:"getDerivedStateFromProps",value:function(t,e){var n={};if(t.topic){if(t.topic!=e.topic){var a=t.tinode.getTopic(t.topic);if(n={topic:t.topic,imagePreview:null,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1},a){var o=[],r=[];t.connected&&a.subscribers(function(e){e.online&&e.user!=t.myUserId&&r.push(e)}),a.messages(function(e){e.deleted||o.push(e)}),Object.assign(n,{messages:o,onlineSubs:r}),a.public?Object.assign(n,{title:a.public.fn,avatar:ne(a.public.photo)}):Object.assign(n,{title:"",avatar:null});var i=a.p2pPeerDesc();i?Object.assign(n,{peerMessagingDisabled:Sr(i.acs)}):e.peerMessagingDisabled&&Object.assign(n,{peerMessagingDisabled:!1})}else Object.assign(n,{messages:[],onlineSubs:[],title:"",avatar:null,peerMessagingDisabled:!1})}}else n={messages:[],onlineSubs:[],topic:null,title:"",avatar:null,imagePreview:null,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1,peerMessagingDisabled:!1};return t.acs?(t.acs.isWriter()!=e.isWriter&&(n.isWriter=!e.isWriter),t.acs.isReader()!=e.isReader&&(n.isReader=!e.isReader),!t.acs.isReader("given")!=e.readingBlocked&&(n.readingBlocked=!e.readingBlocked)):(e.isWriter&&(n.isWriter=!1),e.isReader&&(n.isReader=!1),e.readingBlocked||(e.readingBlocked=!0)),Er(t.acs)==!e.unconformed&&(n.unconfirmed=!e.unconformed),!t.connected&&e.onlineSubs&&0<e.onlineSubs.length&&(n.onlineSubs=[]),n}}],Cr=[{key:"componentDidMount",value:function(){this.messagesScroller&&this.messagesScroller.addEventListener("scroll",this.handleScrollEvent)}},{key:"componentWillUnmount",value:function(){this.messagesScroller&&this.messagesScroller.removeEventListener("scroll",this.handleScrollEvent)}},{key:"componentDidUpdate",value:function(e,t){var n=this;this.messagesScroller&&(t.topic!=this.state.topic||t.messages.length!=this.state.messages.length?this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition:e.viewportHeight>this.props.viewportHeight&&(this.messagesScroller.scrollTop+=e.viewportHeight-this.props.viewportHeight));var a=this.props.tinode.getTopic(this.state.topic);if(this.state.topic!=t.topic&&(t.topic&&!k.a.isNewGroupTopicName(t.topic)&&(this.leave(t.topic),this.props.readTimerHandler(null)),a&&(a.onData=this.handleNewMessage,a.onAllMessagesReceived=this.handleAllMessagesReceived,a.onInfo=this.handleInfoReceipt,a.onMetaDesc=this.handleDescChange,a.onSubsUpdated=this.handleSubsUpdated,a.onPres=this.handleSubsUpdated)),a&&!a.isSubscribed()&&this.props.ready&&(this.state.topic!=t.topic||!e.ready)){var o=this.props.newTopicParams&&this.props.newTopicParams._topicName==this.props.topic,r=a.startMetaQuery().withLaterDesc().withLaterSub();(this.state.isReader||o)&&(r=r.withLaterData(24),this.state.isReader&&(r=r.withLaterDel()),this.setState({fetchingMessages:!0}));var i=o?this.props.newTopicParams:void 0;a.subscribe(r.build(),i).then(function(e){n.state.topic!=e.topic&&n.setState({topic:e.topic}),n.props.onNewTopicCreated(n.props.topic,e.topic),a.queuedMessages(function(e){!e._sending&&a.isSubscribed()&&a.publishMessage(e)})}).catch(function(e){console.log("Failed subscription to",n.state.topic),n.props.onError(e.message,"err");var t=Tr.getDerivedStateFromProps({},{});t.title=n.props.intl.formatMessage(wr.not_found),n.setState(t)})}}},{key:"leave",value:function(e){var t=this;if(e){var n=this.props.tinode.getTopic(e);n&&n.isSubscribed()&&n.leave(!1).catch(function(){}).finally(function(){t.setState({fetchingMessages:!1}),n.onData=void 0,n.onAllMessagesReceived=void 0,n.onInfo=void 0,n.onMetaDesc=void 0,n.onSubsUpdated=void 0,n.onPres=void 0})}}},{key:"handleScrollReference",value:function(e){e&&(e.addEventListener("scroll",this.handleScrollEvent),this.messagesScroller=e)}},{key:"handleScrollEvent",value:function(e){var o=this;this.setState({scrollPosition:e.target.scrollHeight-e.target.scrollTop}),e.target.scrollTop<=0&&this.setState(function(e,t){var n={};if(!e.fetchingMessages){var a=o.props.tinode.getTopic(o.state.topic);a&&a.isSubscribed()&&a.msgHasMoreMessages()&&(n.fetchingMessages=!0,a.getMessagesPage(24).catch(function(e){o.setState({fetchingMessages:!1}),o.props.onError(e.message,"err")}))}return n})}},{key:"handleDescChange",value:function(e){e.public?this.setState({title:e.public.fn,avatar:ne(e.public.photo)}):this.setState({title:"",avatar:null}),e.acs&&this.setState({isWriter:e.acs.isWriter(),isReader:e.acs.isReader(),readingBlocked:!e.acs.isReader("given"),unconfirmed:Er(e.acs)})}},{key:"handleSubsUpdated",value:function(){var t=this;if(this.state.topic){var n=[],e=this.props.tinode.getTopic(this.state.topic);e.subscribers(function(e){e.online&&e.user!=t.props.myUserId&&n.push(e)});var a={onlineSubs:n},o=e.p2pPeerDesc();o?Object.assign(a,{peerMessagingDisabled:Sr(o.acs)}):this.state.peerMessagingDisabled&&Object.assign(a,{peerMessagingDisabled:!1}),this.setState(a)}}},{key:"handleNewMessage",value:function(e){var t=this.props.tinode.getTopic(this.state.topic),n={messages:[]};t.messages(function(e){e.deleted||n.messages.push(e)}),e&&!e.deleted&&(t.isNewMessage(e.seq)&&(n.scrollPosition=0),t.msgStatus(e)>=k.a.MESSAGE_STATUS_SENT&&e.from!=this.props.myUserId&&this.props.readTimerHandler(function(){t.noteRead(e.seq)}),this.props.onData(e)),this.setState(n)}},{key:"handleAllMessagesReceived",value:function(){this.setState({fetchingMessages:!1})}},{key:"handleInfoReceipt",value:function(e){switch(e.what){case"kp":clearTimeout(this.keyPressTimer);var t=this;this.keyPressTimer=setTimeout(function(){t.setState({typingIndicator:!1})},4e3),this.state.typingIndicator||this.setState({typingIndicator:!0});break;case"read":case"recv":this.forceUpdate();break;default:console.log("Other change in topic: ",e.what)}}},{key:"handleImagePreview",value:function(e){this.setState({imagePreview:e})}},{key:"handleCloseImagePreview",value:function(){this.setState({imagePreview:null})}},{key:"handleFormResponse",value:function(e,t,n){if("pub"==e)this.props.sendMessage(_r.attachJSON(_r.parse(t),n));else if("url"==e){var a=new URL(n.ref),o=a.searchParams;for(var r in n.resp)n.resp.hasOwnProperty(r)&&o.set(r,n.resp[r]);["name","seq"].map(function(e){n[e]&&o.set(e,n[e])}),o.set("uid",this.props.myUserId),a.search=o,window.open(a,"_blank")}else console.log("Unknown action in form",e)}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.state.topic,y:e.pageY,x:e.pageX})}},{key:"handleShowContextMenuMessage",value:function(e){e.topicName=this.state.topic;var t=["message_delete"],n=this.props.tinode.getTopic(e.topicName);if(n){var a=n.getAccessMode();a&&a.isDeleter()&&t.push("message_delete_hard")}this.props.showContextMenu(e,t)}},{key:"handleNewChatAcceptance",value:function(e){this.props.onNewChat(this.state.topic,e)}},{key:"handleEnablePeer",value:function(e){e.preventDefault(),this.props.onChangePermissions(this.state.topic,w,this.state.topic)}},{key:"handleAttachFile",value:function(e,t,n,a,o,r){if(o){var i=_r.attachFile(null,e,null,n,a,o);this.props.sendMessage(i,o,r)}else this.props.sendMessage(_r.attachFile(null,e,t,n))}},{key:"handleAttachImage",value:function(e,t,n,a,o){this.props.sendMessage(_r.insertImage(null,0,e,t,n,a,o))}},{key:"render",value:function(){var e,t=this,n=this.props.intl.formatMessage;if(this.state.topic){for(var a=this.props.tinode.getTopic(this.state.topic),o="grp"==a.getType(),r=[],i=null,s=null,l=0;l<this.state.messages.length;l++){var c=this.state.messages[l],u=null;l+1<this.state.messages.length&&(u=this.state.messages[l+1].from);var d="single";c.from==i?d=c.from==u?"middle":"last":c.from==u&&(d="first"),i=c.from;var p=!(c.from==this.props.myUserId),h=a.msgStatus(c),m=void 0,f=void 0,b=void 0;if(o){var g=a.userDesc(c.from);g&&g.public&&(m=g.public.fn,f=ne(g.public.photo)),b=c.from,s="chat-box group"}else s="chat-box";r.push(E.a.createElement(co,{tinode:this.props.tinode,content:c.content,deleted:c.hi,mimeType:c.head?c.head.mime:null,timestamp:c.ts,response:p,seq:c.seq,userFrom:b,userName:m,userAvatar:f,sequence:d,received:h,uploader:c._uploader,viewportWidth:this.props.viewportWidth,showContextMenu:this.handleShowContextMenuMessage,onImagePreview:this.handleImagePreview,onFormResponse:this.handleFormResponse,onError:this.props.onError,key:c.seq}))}var y=null,v=this.props.tinode.getMeTopic().getContact(this.state.topic);v&&"p2p"==k.a.topicType(v.topic)&&(v.online?y=n(wr.online_now):v.seen&&(y=n(wr.last_seen)+": "+B(v.seen.when,this.props.intl.locale)));var _=this.state.avatar||!0,w=this.props.online?"online"+(this.state.typingIndicator?" typing":""):"offline";e=E.a.createElement("div",{id:"topic-view",className:this.props.hideSelf?"nodisplay":null},E.a.createElement("div",{id:"topic-caption-panel",className:"caption-panel"},this.props.displayMobile?E.a.createElement("a",{href:"#",id:"hide-message-view",onClick:function(e){e.preventDefault(),t.props.onHideMessagesView()}},E.a.createElement("i",{className:"material-icons"},"arrow_back")):null,E.a.createElement("div",{className:"avatar-box"},E.a.createElement(Z,{avatar:_,topic:this.state.topic,title:this.state.title}),E.a.createElement("span",{className:w})),E.a.createElement("div",{id:"topic-title-group"},E.a.createElement("div",{id:"topic-title",className:"panel-title"},this.state.title||E.a.createElement("i",null,E.a.createElement(S.FormattedMessage,{id:"unnamed_topic",defaultMessage:"Unnamed"}))),E.a.createElement("div",{id:"topic-last-seen"},y)),o?E.a.createElement(_o,{subscribers:this.state.onlineSubs}):E.a.createElement("div",{id:"topic-users"}),E.a.createElement("div",null,E.a.createElement("a",{href:"#",onClick:this.handleContextClick},E.a.createElement("i",{className:"material-icons"},"more_vert")))),this.props.displayMobile?E.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,E.a.createElement(zo,{show:this.state.fetchingMessages}),E.a.createElement("div",{id:"messages-container"},E.a.createElement("div",{id:"messages-panel",ref:this.handleScrollReference},E.a.createElement("ul",{id:"scroller",className:s},r)),this.state.isReader?null:E.a.createElement("div",{id:"write-only-background"},this.state.readingBlocked?E.a.createElement("div",{id:"write-only-note"},E.a.createElement(S.FormattedMessage,{id:"messages_not_readable",defaultMessage:"no access to messages"})):null)),this.state.peerMessagingDisabled&&!this.state.unconfirmed?E.a.createElement("div",{id:"peer-messaging-disabled-note"},E.a.createElement("i",{className:"material-icons secondary"},"block")," ",E.a.createElement(S.FormattedMessage,{id:"peers_messaging_disabled",defaultMessage:"Peer's messaging is disabled."})," ",E.a.createElement("a",{href:"#",onClick:this.handleEnablePeer},E.a.createElement(S.FormattedMessage,{id:"enable_peers_messaging",defaultMessage:"Enable"})),"."):null,this.state.unconfirmed?E.a.createElement(Io,{onAction:this.handleNewChatAcceptance}):E.a.createElement(mr,{tinode:this.props.tinode,topic:this.props.topic,disabled:!this.state.isWriter,onSendMessage:this.props.sendMessage,onAttachFile:this.handleAttachFile,onAttachImage:this.handleAttachImage,onError:this.props.onError}),this.state.imagePreview?E.a.createElement(Po,{content:this.state.imagePreview,downloadable:!0,onClose:this.handleCloseImagePreview}):null)}else e=E.a.createElement(nr,{hideSelf:this.props.hideSelf,serverVersion:this.props.serverVersion,serverAddress:this.props.serverAddress});return e}}],br((kr=Tr).prototype,Cr),Mr&&br(kr,Mr),Tr);function Tr(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Tr),n=this,(t=!(a=gr(Tr).call(this,e))||"object"!==fr(a)&&"function"!=typeof a?yr(n):a).state=Tr.getDerivedStateFromProps(e,{}),t.leave=t.leave.bind(yr(t)),t.handleScrollReference=t.handleScrollReference.bind(yr(t)),t.handleScrollEvent=t.handleScrollEvent.bind(yr(t)),t.handleDescChange=t.handleDescChange.bind(yr(t)),t.handleSubsUpdated=t.handleSubsUpdated.bind(yr(t)),t.handleNewMessage=t.handleNewMessage.bind(yr(t)),t.handleAllMessagesReceived=t.handleAllMessagesReceived.bind(yr(t)),t.handleInfoReceipt=t.handleInfoReceipt.bind(yr(t)),t.handleImagePreview=t.handleImagePreview.bind(yr(t)),t.handleCloseImagePreview=t.handleCloseImagePreview.bind(yr(t)),t.handleFormResponse=t.handleFormResponse.bind(yr(t)),t.handleContextClick=t.handleContextClick.bind(yr(t)),t.handleShowContextMenuMessage=t.handleShowContextMenuMessage.bind(yr(t)),t.handleNewChatAcceptance=t.handleNewChatAcceptance.bind(yr(t)),t.handleEnablePeer=t.handleEnablePeer.bind(yr(t)),t.handleAttachFile=t.handleAttachFile.bind(yr(t)),t.handleAttachImage=t.handleAttachImage.bind(yr(t)),t}var Pr=Object(S.injectIntl)(Or);function jr(e){return(jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nr(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ar(e,t){return!t||"object"!==jr(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Fr(e){return(Fr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ur(e,t){return(Ur=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xr,Dr,Rr=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ur(e,t)}(Ir,E.a.PureComponent),Nr((xr=Ir).prototype,[{key:"render",value:function(){var t=this;return E.a.createElement("div",null,E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onNewTopic()}},E.a.createElement("i",{className:"material-icons"},"chat"))," ",E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSettings()}},E.a.createElement("i",{className:"material-icons"},"settings")))}}]),Dr&&Nr(xr,Dr),Ir);function Ir(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ir),Ar(this,Fr(Ir).apply(this,arguments))}function Lr(e){return(Lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qr(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Hr(e,t){return!t||"object"!==Lr(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Wr(e){return(Wr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Br(e,t){return(Br=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Vr,Gr,Kr=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Br(e,t)}(zr,E.a.PureComponent),qr((Vr=zr).prototype,[{key:"render",value:function(){var t=this;return E.a.createElement("div",null,E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSignUp()}},E.a.createElement("i",{className:"material-icons"},"person_add"))," ",E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSettings()}},E.a.createElement("i",{className:"material-icons"},"settings")))}}]),Gr&&qr(Vr,Gr),zr);function zr(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,zr),Hr(this,Wr(zr).apply(this,arguments))}function Jr(e){return(Jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yr(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Qr(e,t){return!t||"object"!==Jr(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Xr(e){return(Xr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Zr(e,t){return(Zr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var $r,ei,ti=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zr(e,t)}(ni,E.a.PureComponent),Yr(($r=ni).prototype,[{key:"render",value:function(){return E.a.createElement("div",{id:"side-caption-panel",className:"caption-panel"},E.a.createElement("div",{id:"self-avatar",className:"avatar-box"},E.a.createElement(Z,{avatar:this.props.avatar,topic:this.props.myUserId,title:this.props.title})),E.a.createElement("div",{id:"sidepanel-title",className:"panel-title"},this.props.title),"login"===this.props.state?E.a.createElement(Kr,{onSignUp:this.props.onSignUp,onSettings:this.props.onSettings}):"contacts"===this.props.state?E.a.createElement(Rr,{onNewTopic:this.props.onNewTopic,onSettings:this.props.onSettings}):null,this.props.onCancel?E.a.createElement(jt,{onCancel:this.props.onCancel}):null)}}]),ei&&Yr($r,ei),ni);function ni(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ni),Qr(this,Xr(ni).apply(this,arguments))}function ai(e){return(ai="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oi(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ri(e){return(ri=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ii(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function si(e,t){return(si=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var li,ci,ui,di=Object(S.defineMessages)({archived_contacts_title:{id:"archived_contacts",defaultMessage:"Archived contacts ({count})"}}),pi=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&si(e,t)}(hi,E.a.Component),ui=[{key:"deriveStateFromProps",value:function(t){var n=[],a=0,o=0;return t.chatList.map(function(e){e.private&&e.private.arch?t.archive?n.push(e):o++:t.archive||(n.push(e),a+=0<e.unread?1:0)}),n.sort(function(e,t){return(t.touched||0)-(e.touched||0)}),0<o&&n.push({action:"archive",title:di.archived_contacts_title,values:{count:o}}),{contactList:n,unreadThreads:a}}}],ci=[{key:"componentDidUpdate",value:function(e,t){if(e.chatList!=this.props.chatList||e.archive!=this.props.archive){var n=hi.deriveStateFromProps(this.props);this.setState(n),n.unreadThreads!=t.unreadThreads&&aa(n.unreadThreads)}}},{key:"handleAction",value:function(){this.props.onShowArchive()}},{key:"render",value:function(){var t=this;return E.a.createElement(S.FormattedHTMLMessage,{id:"contacts_not_found",defaultMessage:"You have no chats<br />¯∖_(ツ)_/¯"},function(e){return E.a.createElement(Et,{connected:t.props.connected,contacts:t.state.contactList,emptyListMessage:e,topicSelected:t.props.topicSelected,myUserId:t.props.myUserId,showOnline:!0,showUnread:!0,onTopicSelected:t.props.onTopicSelected,showContextMenu:t.props.showContextMenu,onAction:t.handleAction})})}}],oi((li=hi).prototype,ci),ui&&oi(li,ui),hi);function hi(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,hi),n=this,(t=!(a=ri(hi).call(this,e))||"object"!==ai(a)&&"function"!=typeof a?ii(n):a).handleAction=t.handleAction.bind(ii(t)),t.state=hi.deriveStateFromProps(e),t}function mi(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var fi,bi,gi,yi=(fi=vi,gi=[{key:"setObject",value:function(e,t){localStorage.setItem(e,JSON.stringify(t))}},{key:"getObject",value:function(e){var t=localStorage.getItem(e);return t&&JSON.parse(t)}},{key:"updateObject",value:function(e,t){var n=this.getObject(e);this.setObject(e,Object.assign(n||{},t))}},{key:"removeItem",value:function(e){localStorage.removeItem(e)}}],(bi=null)&&mi(fi.prototype,bi),gi&&mi(fi,gi),vi);function vi(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,vi)}function _i(e){return(_i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wi(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ei(e){return(Ei=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Si(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ki(e,t){return(ki=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ci,Mi,Oi=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ki(e,t)}(Ti,E.a.PureComponent),wi((Ci=Ti).prototype,[{key:"handleLoginChange",value:function(e){this.setState({login:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e})}},{key:"handleEmailChange",value:function(e){this.setState({email:e.target.value})}},{key:"handleFnChange",value:function(e){this.setState({fn:e.target.value})}},{key:"handleImageChanged",value:function(e){this.setState({imageDataUrl:e})}},{key:"handleToggleSaveToken",value:function(){yi.setObject("keep-logged-in",!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.setState({errorCleared:!1}),this.props.onCreateAccount(this.state.login.trim(),this.state.password.trim(),oa(this.state.fn.trim().substring(0,60),this.state.imageDataUrl),{meth:"email",val:this.state.email})}},{key:"render",value:function(){var t=this,e="blue";return this.props.disabled&&(e+=" disabled"),E.a.createElement("form",{className:"panel-form-column",onSubmit:this.handleSubmit},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("div",{className:"panel-form-column"},E.a.createElement(S.FormattedMessage,{id:"login_prompt"},function(e){return E.a.createElement("input",{type:"text",placeholder:e,autoComplete:"user-name",value:t.state.login,onChange:t.handleLoginChange,required:!0,autoFocus:!0})}),E.a.createElement(S.FormattedMessage,{id:"password_prompt"},function(e){return E.a.createElement(Mn,{placeholder:e,autoComplete:"new-password",value:t.state.password,onFinished:t.handlePasswordChange,required:!0})})),E.a.createElement(ge,{onImageChanged:this.handleImageChanged,onError:this.props.onError})),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(S.FormattedMessage,{id:"full_name_prompt",defaultMessage:"Full name, e.g. John Doe"},function(e){return E.a.createElement("input",{type:"text",placeholder:e,autoComplete:"name",value:t.state.fn,onChange:t.handleFnChange,required:!0})})),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(S.FormattedMessage,{id:"email_prompt",defaultMessage:"Email, e.g. jdoe@example.com"},function(e){return E.a.createElement("input",{type:"email",placeholder:e,autoComplete:"email",value:t.state.email,onChange:t.handleEmailChange,required:!0})})),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(Me,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),E.a.createElement(S.FormattedMessage,{id:"stay_logged_in"},function(e){return E.a.createElement("label",{htmlFor:"save-token"}," ",e)})),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:e,type:"submit"},E.a.createElement(S.FormattedMessage,{id:"button_sign_up",defaultMessage:"Sign up"}))))}}]),Mi&&wi(Ci,Mi),Ti);function Ti(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ti),n=this,(t=!(a=Ei(Ti).call(this,e))||"object"!==_i(a)&&"function"!=typeof a?Si(n):a).state={login:"",password:"",email:"",fn:"",imageDataUrl:null,errorCleared:!1,saveToken:yi.getObject("keep-logged-in")},t.handleLoginChange=t.handleLoginChange.bind(Si(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Si(t)),t.handleEmailChange=t.handleEmailChange.bind(Si(t)),t.handleFnChange=t.handleFnChange.bind(Si(t)),t.handleImageChanged=t.handleImageChanged.bind(Si(t)),t.handleToggleSaveToken=t.handleToggleSaveToken.bind(Si(t)),t.handleSubmit=t.handleSubmit.bind(Si(t)),t}function Pi(e){return(Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ji(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ni(e){return(Ni=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ai(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fi(e,t){return(Fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ui,xi,Di=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fi(e,t)}(Ri,E.a.Component),ji((Ui=Ri).prototype,[{key:"componentDidMount",value:function(){var e=this.props.tinode.getMeTopic();e.onCredsUpdated=this.tnCredsUpdated,e.onTagsUpdated=this.tnNewTags}},{key:"componentWillUnmount",value:function(){var e=this.props.tinode.getMeTopic();e.onTagsUpdated=this.state.previousOnTags,e.onCredsUpdated=void 0}},{key:"tnNewTags",value:function(e){this.setState({tags:e})}},{key:"tnCredsUpdated",value:function(e){this.setState({credentials:e||[]})}},{key:"handleFullNameUpdate",value:function(e){(e=e.trim().substring(0,60))&&(this.setState({fullName:e}),this.props.onUpdateAccount(void 0,oa(e,null)))}},{key:"handlePasswordUpdate",value:function(e){this.setState({password:e}),this.props.onUpdateAccount(e)}},{key:"handleImageChanged",value:function(e){this.setState({avatar:e}),this.props.onUpdateAccount(void 0,oa(null,e||k.a.DEL_CHAR))}},{key:"handleCheckboxClick",value:function(e,t){"sound"==e?this.props.onToggleMessageSounds(t):"alert"==e&&this.props.onTogglePushNotifications(t)}},{key:"handleCredChange",value:function(e){this.setState({newCred:e.target.value,addCredInvalid:!1})}},{key:"handleCredKeyDown",value:function(e){27===e.keyCode?this.setState({newCred:"",addCredActive:!1}):13===e.keyCode&&this.handleCredEntered(e)}},{key:"handleCredEntered",value:function(){var e=this.state.newCred.trim();if(e){var t,n,a,o=(t=(t=e).trim(),/^(?:\+?(\d{1,3}))?[- (.]*(\d{3})[- ).]*(\d{3})[- .]*(\d{2})[- .]*(\d{2})?$/.test(t)?t.replace(/[- ().]*/,""):null);o?n="tel":(a=(a=e).trim(),(o=/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/.test(a)?a:null)&&(n="email")),n?(this.props.onCredAdd(n,o),this.setState({addCredActive:!1,newCred:""})):this.setState({addCredInvalid:!0})}else this.setState({addCredActive:!1,addCredInvalid:!1})}},{key:"handleLaunchPermissionsEditor",value:function(e){this.setState({showPermissionEditorFor:e,editedPermissions:this.state[e]})}},{key:"handleHidePermissionsEditor",value:function(){this.setState({showPermissionEditorFor:void 0})}},{key:"handlePermissionsChanged",value:function(e){var t={};t[this.state.showPermissionEditorFor]=e,this.props.onUpdateAccount(void 0,void 0,t);var n={showPermissionEditorFor:void 0};n[this.state.showPermissionEditorFor]=e,this.setState(n)}},{key:"handleTagsUpdated",value:function(e){ra(this.state.tags.slice(0),e.slice(0))||this.props.onUpdateTags(e)}},{key:"render",value:function(){var n=this,e=[];return this.state.credentials.map(function(t){e.push(E.a.createElement("div",{key:t.meth+":"+t.val+":"+t.done},t.meth,": ",E.a.createElement("tt",null,t.val),E.a.createElement("span",null," ",t.done?null:E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.props.onCredConfirm(t.meth,t.val)}},E.a.createElement(S.FormattedMessage,{id:"validate_credential_action",defaultMessage:"confirm"}))," ",E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.props.onCredDelete(t.meth,t.val)}},E.a.createElement("i",{className:"material-icons gray"},"delete_outline")))))}),E.a.createElement(E.a.Fragment,null,this.state.showPermissionEditorFor?E.a.createElement(na,{mode:this.state.editedPermissions,skip:"O",onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):E.a.createElement("div",{id:"edit-account",className:"scrollable-panel"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_your_name",defaultMessage:"Your name"}))),E.a.createElement("div",null,E.a.createElement(S.FormattedMessage,{id:"full_name_prompt"},function(e){return E.a.createElement(xn,{placeholder:e,value:n.state.fullName,onFinished:n.handleFullNameUpdate})})),E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_password",defaultMessage:"Password"}))),E.a.createElement("div",null,E.a.createElement(S.FormattedMessage,{id:"password_unchanged_prompt",defaultMessage:"Unchanged"},function(e){return E.a.createElement(xn,{placeholder:e,type:"password",onFinished:n.handlePasswordUpdate})}))),E.a.createElement(ge,{avatar:this.state.avatar,uid:this.props.myUserId,title:this.state.fullName,onImageChanged:this.handleImageChanged,onError:this.props.onError})),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{htmlFor:"message-sound"},E.a.createElement(S.FormattedMessage,{id:"label_message_sound",defaultMessage:"Message sound:"})),E.a.createElement(Me,{name:"sound",id:"message-sound",checked:this.props.messageSounds,onChange:this.handleCheckboxClick})),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{htmlFor:"desktop-alerts"},this.props.desktopAlertsEnabled?E.a.createElement(S.FormattedMessage,{id:"label_push_notifications",defaultMessage:"Notification alerts:"}):E.a.createElement(S.FormattedMessage,{id:"label_push_notifications_disabled",defaultMessage:"Notification alerts (requires HTTPS):"})),E.a.createElement(Me,{name:"alert",id:"desktop-alerts",checked:this.props.desktopAlerts,onChange:this.props.desktopAlertsEnabled?this.handleCheckboxClick:null})),E.a.createElement("div",{className:"hr"}),E.a.createElement(S.FormattedMessage,{id:"title_tag_manager",defaultMessage:"Tags (user discovery)"},function(e){return E.a.createElement(ma,{title:e,activated:!1,tags:n.state.tags,onSubmit:n.handleTagsUpdated})}),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_user_contacts",defaultMessage:"Contacts:"}))),E.a.createElement("div",{className:"quoted"},e,this.state.addCredActive?E.a.createElement("input",{type:"text",value:this.state.value,className:this.state.addCredInvalid?"invalid":null,placeholder:"Phone number or email",required:"required",autoFocus:!0,onChange:this.handleCredChange,onKeyDown:this.handleCredKeyDown,onBlur:this.handleCredEntered}):null,E.a.createElement("div",null,E.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.setState({addCredActive:!0})}},"+ Add another")))),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_user_id",defaultMessage:"Address:"})),E.a.createElement("tt",null,this.props.myUserId)),E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_default_access_mode",defaultMessage:"Default access mode:"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("div",null,"Auth: ",E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth)),E.a.createElement("div",null,"Anon: ",E.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon)))),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("a",{href:"#",className:"red flat-button",onClick:function(e){e.preventDefault(),n.props.onLogout()}},E.a.createElement("i",{className:"material-icons"},"exit_to_app"),"  ",E.a.createElement(S.FormattedMessage,{id:"button_logout",defaultMessage:"Logout"}))),E.a.createElement("div",{className:"hr"}),E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("div",null,E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_legal",defaultMessage:"Legal"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("a",{href:"email:info@tinode.co",className:"flat-button",target:"_blank"},E.a.createElement("i",{className:"material-icons"},"email"),"  ",E.a.createElement(S.FormattedMessage,{id:"link_contact_us",defaultMessage:"Contact Us"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("a",{href:"https://tinode.co/terms.html",className:"flat-button",target:"_blank"},E.a.createElement("i",{className:"material-icons"},"description"),"  ",E.a.createElement(S.FormattedMessage,{id:"link_terms_of_service",defaultMessage:"Terms of Service"}))),E.a.createElement("div",{className:"quoted"},E.a.createElement("a",{href:"https://tinode.co/privacy.html",className:"flat-button",target:"_blank"},E.a.createElement("i",{className:"material-icons"},"policy"),"  ",E.a.createElement(S.FormattedMessage,{id:"link_privacy_policy",defaultMessage:"Privacy Policy"}))))))}}]),xi&&ji(Ui,xi),Ri);function Ri(e){var t,n,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ri),n=this;var o=(t=!(a=Ni(Ri).call(this,e))||"object"!==Pi(a)&&"function"!=typeof a?Ai(n):a).props.tinode.getMeTopic(),r=o.getDefaultAccess();return t.state={fullName:o.public?o.public.fn:void 0,avatar:ne(o.public?o.public.photo:null),auth:r?r.auth:null,anon:r?r.anon:null,tags:o.tags(),credentials:o.getCredentials()||[],addCredActive:!1,addCredInvalid:!1,newCred:"",showPermissionEditorFor:void 0,previousOnTags:o.onTagsUpdated},t.tnNewTags=t.tnNewTags.bind(Ai(t)),t.tnCredsUpdated=t.tnCredsUpdated.bind(Ai(t)),t.handleFullNameUpdate=t.handleFullNameUpdate.bind(Ai(t)),t.handlePasswordUpdate=t.handlePasswordUpdate.bind(Ai(t)),t.handleImageChanged=t.handleImageChanged.bind(Ai(t)),t.handleCheckboxClick=t.handleCheckboxClick.bind(Ai(t)),t.handleCredChange=t.handleCredChange.bind(Ai(t)),t.handleCredKeyDown=t.handleCredKeyDown.bind(Ai(t)),t.handleCredEntered=t.handleCredEntered.bind(Ai(t)),t.handleLaunchPermissionsEditor=t.handleLaunchPermissionsEditor.bind(Ai(t)),t.handleHidePermissionsEditor=t.handleHidePermissionsEditor.bind(Ai(t)),t.handlePermissionsChanged=t.handlePermissionsChanged.bind(Ai(t)),t.handleTagsUpdated=t.handleTagsUpdated.bind(Ai(t)),t}function Ii(e){return(Ii="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Li(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function qi(e){return(qi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Hi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wi(e,t){return(Wi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Bi,Vi,Gi=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wi(e,t)}(Ki,E.a.Component),Li((Bi=Ki).prototype,[{key:"handleLoginChange",value:function(e){this.setState({login:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e.target.value})}},{key:"handleToggleSaveToken",value:function(){yi.setObject("keep-logged-in",!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.props.onLogin(this.state.login.trim(),this.state.password.trim())}},{key:"render",value:function(){var t=this,e="blue";return this.props.disabled&&(e+=" disabled"),E.a.createElement("form",{id:"login-form",onSubmit:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"login_prompt",defaultMessage:"Login"},function(e){return E.a.createElement("input",{type:"text",id:"inputLogin",placeholder:e,autoComplete:"username",autoCorrect:"off",autoCapitalize:"none",value:t.state.login,onChange:t.handleLoginChange,required:!0,autoFocus:!0})}),E.a.createElement(S.FormattedMessage,{id:"password_prompt",defaultMessage:"Password"},function(e){return E.a.createElement(Mn,{type:"password",id:"inputPassword",placeholder:e,autoComplete:"current-password",value:t.state.password,onChange:t.handlePasswordChange,required:!0})}),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(Me,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),E.a.createElement("label",{htmlFor:"save-token"}," ",E.a.createElement(S.FormattedMessage,{id:"stay_logged_in",defaultMessage:"Stay logged in"})),E.a.createElement("a",{href:"#reset"},E.a.createElement(S.FormattedMessage,{id:"forgot_password_link",defaultMessage:"Forgot password?"}))),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:e,type:"submit"},E.a.createElement(S.FormattedMessage,{id:"button_sign_in",defaultMessage:"Sign in"}))))}}]),Vi&&Li(Bi,Vi),Ki);function Ki(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ki),n=this,(t=!(a=qi(Ki).call(this,e))||"object"!==Ii(a)&&"function"!=typeof a?Hi(n):a).state={login:e.login,password:"",hostName:e.serverAddress,saveToken:yi.getObject("keep-logged-in")},t.handleLoginChange=t.handleLoginChange.bind(Hi(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Hi(t)),t.handleToggleSaveToken=t.handleToggleSaveToken.bind(Hi(t)),t.handleSubmit=t.handleSubmit.bind(Hi(t)),t}function zi(e){return(zi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ji(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Yi(e){return(Yi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xi(e,t){return(Xi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Zi,$i,es=Object(S.defineMessages)({invalid_id:{id:"error_invalid_id",defaultMessage:"Invalid ID"}}),ts=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xi(e,t)}(ns,E.a.PureComponent),Ji((Zi=ns).prototype,[{key:"handleChange",value:function(e){this.setState({groupId:e.target.value})}},{key:"handleKeyPress",value:function(e){"Enter"===e.key&&this.handleSubmit(e)}},{key:"handleSubmit",value:function(e){if(e.preventDefault(),this.state.groupId){var t=this.state.groupId.trim();3<t.length&&("usr"==t.substr(0,3)||"grp"==t.substr(0,3))?this.props.onSubmit(t):this.props.onError(this.props.intl.formatMessage(es.invalid_id),"err")}}},{key:"render",value:function(){var t=this;return E.a.createElement("div",{className:"panel-form"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(S.FormattedMessage,{id:"group_user_id_prompt",defaultMessage:"Group or User ID"},function(e){return E.a.createElement("input",{type:"text",placeholder:e,value:t.state.groupId,onChange:t.handleChange,onKeyPress:t.handleKeyPress,required:!0})})),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:"blue",onClick:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"button_subscribe",defaultMessage:"Subscribe"}))))}}]),$i&&Ji(Zi,$i),ns);function ns(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ns),n=this,(t=!(a=Yi(ns).call(this,e))||"object"!==zi(a)&&"function"!=typeof a?Qi(n):a).state={groupId:""},t.handleChange=t.handleChange.bind(Qi(t)),t.handleKeyPress=t.handleKeyPress.bind(Qi(t)),t.handleSubmit=t.handleSubmit.bind(Qi(t)),t}var as=Object(S.injectIntl)(ts);function os(e){return(os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rs(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function is(e){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ss(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ls(e,t){return(ls=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var cs,us,ds=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ls(e,t)}(ps,E.a.PureComponent),rs((cs=ps).prototype,[{key:"handleFnChange",value:function(e){this.setState({fn:e.target.value})}},{key:"handlePrivateChange",value:function(e){this.setState({private:e.target.value})}},{key:"handleImageChanged",value:function(e){this.setState({imageDataUrl:e})}},{key:"handleTagsChanged",value:function(e){this.setState({tags:e})}},{key:"handleSubmit",value:function(e){e.preventDefault();var t=this.state.fn.trim().substring(0,60),n=this.state.private.trim().substring(0,60);t&&this.props.onSubmit(t,this.state.imageDataUrl,n,this.state.tags)}},{key:"render",value:function(){var t=this,e="blue";return this.props.disabled&&(e+=" disabled"),E.a.createElement("form",{className:"panel-form",onSubmit:this.handleSubmit},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("div",{className:"panel-form-column"},E.a.createElement("label",{className:"small",htmlFor:"new-topic-fn"},E.a.createElement(S.FormattedMessage,{id:"label_topic_name"})),E.a.createElement(S.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:"Freeform name of the group"},function(e){return E.a.createElement("input",{type:"text",id:"new-topic-fn",placeholder:e,value:t.state.fn,onChange:t.handleFnChange,autoFocus:!0,required:!0})}),E.a.createElement("br",null),E.a.createElement("label",{className:"small",htmlFor:"new-topic-priv"},E.a.createElement(S.FormattedMessage,{id:"label_private"})),E.a.createElement(S.FormattedMessage,{id:"private_editing_placeholder"},function(e){return E.a.createElement("input",{type:"text",id:"new-topic-priv",placeholder:e,value:t.state.private,onChange:t.handlePrivateChange})})),E.a.createElement(ge,{onError:this.props.onError,onImageChanged:this.handleImageChanged})),E.a.createElement(S.FormattedMessage,{id:"title_tag_manager"},function(e){return E.a.createElement(ma,{tags:t.state.tags,activated:!0,onTagsChanged:t.handleTagsChanged,title:e})}),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:e},E.a.createElement(S.FormattedMessage,{id:"button_create",defaultMessage:"Create"}))))}}]),us&&rs(cs,us),ps);function ps(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ps),n=this,(t=!(a=is(ps).call(this,e))||"object"!==os(a)&&"function"!=typeof a?ss(n):a).state={fn:"",private:"",imageDataUrl:null,tags:[]},t.handleFnChange=t.handleFnChange.bind(ss(t)),t.handlePrivateChange=t.handlePrivateChange.bind(ss(t)),t.handleImageChanged=t.handleImageChanged.bind(ss(t)),t.handleTagsChanged=t.handleTagsChanged.bind(ss(t)),t.handleTagsChanged=t.handleTagsChanged.bind(ss(t)),t.handleSubmit=t.handleSubmit.bind(ss(t)),t}function hs(e){return(hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ms(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function fs(e){return(fs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function bs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gs(e,t){return(gs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ys,vs,_s=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gs(e,t)}(ws,E.a.PureComponent),ms((ys=ws).prototype,[{key:"componentWillUnmount",value:function(){this.state.edited&&(this.setState({search:"",edited:!1}),this.props.onSearchContacts(k.a.DEL_CHAR))}},{key:"handleSearchChange",value:function(e){this.setState({search:e.target.value})}},{key:"handleSearch",value:function(e){e.preventDefault();var t=this.state.search.trim();this.setState({edited:0<t.length}),this.props.onSearchContacts(0<t.length?t:k.a.DEL_CHAR)}},{key:"handleClear",value:function(e){e.preventDefault(),this.state.edited&&this.props.onSearchContacts(k.a.DEL_CHAR),this.setState({search:"",edited:!1})}},{key:"handleKeyDown",value:function(e){"Enter"===e.key?this.handleSearch(e):"Escape"===e.key&&this.handleClear()}},{key:"render",value:function(){var t=this;return E.a.createElement("div",{className:"panel-form"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("i",{className:"material-icons search"},"search"),E.a.createElement(S.FormattedMessage,{id:"search_placeholder",defaultMessage:"List like email:alice@example.com, tel:17025550003..."},function(e){return E.a.createElement("input",{className:"search",type:"text",placeholder:e,value:t.state.search,onChange:t.handleSearchChange,onKeyDown:t.handleKeyDown,required:!0,autoFocus:!0})}),E.a.createElement("a",{href:"#",onClick:this.handleClear},E.a.createElement("i",{className:"material-icons"},"close"))))}}]),vs&&ms(ys,vs),ws);function ws(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ws),n=this,(t=!(a=fs(ws).call(this,e))||"object"!==hs(a)&&"function"!=typeof a?bs(n):a).state={edited:!1,search:""},t.handleSearchChange=t.handleSearchChange.bind(bs(t)),t.handleSearch=t.handleSearch.bind(bs(t)),t.handleClear=t.handleClear.bind(bs(t)),t.handleKeyDown=t.handleKeyDown.bind(bs(t)),t}function Es(e){return(Es="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ss(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ks(e){return(ks=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Cs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ms(e,t){return(Ms=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Os,Ts,Ps=Object(S.defineMessages)({search_for_contacts:{id:"search_for_contacts",defaultMessage:"Use search to find contacts"},search_no_results:{id:"search_no_results",defaultMessage:"Search returned no results"}}),js=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ms(e,t)}(Ns,E.a.Component),Ss((Os=Ns).prototype,[{key:"componentDidMount",value:function(){this.props.onInitFind()}},{key:"handleTabClick",value:function(e){e.preventDefault(),j.navigateTo(j.addUrlParam(window.location.hash,"tab",e.currentTarget.dataset.id)),this.setState({tabSelected:e.currentTarget.dataset.id})}},{key:"handleSearchContacts",value:function(e){this.props.onSearchContacts(e),this.setState({searchQuery:k.a.isNullValue(e)?null:e})}},{key:"handleContactSelected",value:function(e){"p2p"===this.state.tabSelected&&(j.navigateTo(j.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e,void 0))}},{key:"handleNewGroupSubmit",value:function(e,t,n,a){j.navigateTo(j.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(void 0,oa(e,t),n,a)}},{key:"handleGroupByID",value:function(e){j.navigateTo(j.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e)}},{key:"render",value:function(){var e=(0,this.props.intl.formatMessage)(this.state.searchQuery?Ps.search_no_results:Ps.search_for_contacts);return E.a.createElement("div",{className:"flex-column"},E.a.createElement("ul",{className:"tabbar"},E.a.createElement("li",{className:"p2p"===this.state.tabSelected?"active":null},E.a.createElement("a",{href:"#","data-id":"p2p",onClick:this.handleTabClick},E.a.createElement(S.FormattedMessage,{id:"tabtitle_find_user",defaultMessage:"find"}))),E.a.createElement("li",{className:"grp"===this.state.tabSelected?"active":null},E.a.createElement("a",{href:"#","data-id":"grp",onClick:this.handleTabClick},E.a.createElement(S.FormattedMessage,{id:"tabtitle_new_group",defaultMessage:"new group"}))),E.a.createElement("li",{className:"byid"===this.state.tabSelected?"active":null},E.a.createElement("a",{href:"#","data-id":"byid",onClick:this.handleTabClick},E.a.createElement(S.FormattedMessage,{id:"tabtitle_group_by_id",defaultMessage:"by id"})))),"grp"===this.state.tabSelected?E.a.createElement(ds,{onSubmit:this.handleNewGroupSubmit}):"byid"===this.state.tabSelected?E.a.createElement(as,{onSubmit:this.handleGroupByID,onError:this.props.onError}):E.a.createElement("div",{className:"flex-column"},E.a.createElement(_s,{type:"p2p",onSearchContacts:this.handleSearchContacts}),E.a.createElement(Et,{contacts:this.props.searchResults,myUserId:this.props.myUserId,emptyListMessage:e,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleContactSelected})))}}]),Ts&&Ss(Os,Ts),Ns);function Ns(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ns),n=this,(t=!(a=ks(Ns).call(this,e))||"object"!==Es(a)&&"function"!=typeof a?Cs(n):a).state={tabSelected:"p2p",searchQuery:null},t.handleTabClick=t.handleTabClick.bind(Cs(t)),t.handleSearchContacts=t.handleSearchContacts.bind(Cs(t)),t.handleContactSelected=t.handleContactSelected.bind(Cs(t)),t.handleNewGroupSubmit=t.handleNewGroupSubmit.bind(Cs(t)),t.handleGroupByID=t.handleGroupByID.bind(Cs(t)),t}var As=Object(S.injectIntl)(js);function Fs(e){return(Fs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Us(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function xs(e){return(xs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ds(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rs(e,t){return(Rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Is,Ls,qs=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rs(e,t)}(Hs,E.a.PureComponent),Us((Is=Hs).prototype,[{key:"componentDidMount",value:function(){var e=j.parseUrlHash(window.location.hash);this.setState({token:e.params.token,scheme:e.params.scheme})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.state.token?this.props.onReset(this.state.scheme,this.state.password.trim(),this.state.token):this.props.onRequest("email",this.state.email.trim())}},{key:"handleEmailChange",value:function(e){this.setState({email:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e.target.value})}},{key:"render",value:function(){var t=this,e=this.state.token&&this.state.scheme;return E.a.createElement("form",{id:"password-reset-form",onSubmit:this.handleSubmit},e?E.a.createElement(S.FormattedMessage,{id:"new_password_placeholder",defaultMessage:"Enter new password"},function(e){return E.a.createElement(Mn,{placeholder:e,autoComplete:"new-password",value:t.state.password,required:!0,autoFocus:!0,onChange:t.handlePasswordChange})}):E.a.createElement(E.a.Fragment,null,E.a.createElement("label",{htmlFor:"inputEmail"},E.a.createElement(S.FormattedMessage,{id:"label_reset_password",defaultMessage:"Send a password reset email:"})),E.a.createElement(S.FormattedMessage,{id:"credential_email_prompt",defaultMessage:"Your registration email"},function(e){return E.a.createElement("input",{type:"email",id:"inputEmail",placeholder:e,autoComplete:"email",value:t.state.email,onChange:t.handleEmailChange,required:!0,autoFocus:!0})})),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:"blue",type:"submit"},e?E.a.createElement(S.FormattedMessage,{id:"button_reset",defaultMessage:"Reset"}):E.a.createElement(S.FormattedMessage,{id:"button_send_request",defaultMessage:"Send request"}))))}}]),Ls&&Us(Is,Ls),Hs);function Hs(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Hs),n=this,(t=!(a=xs(Hs).call(this,e))||"object"!==Fs(a)&&"function"!=typeof a?Ds(n):a).state={email:"",password:""},t.handleSubmit=t.handleSubmit.bind(Ds(t)),t.handleEmailChange=t.handleEmailChange.bind(Ds(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Ds(t)),t}function Ws(e){return(Ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Bs(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Vs(e){return(Vs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Gs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ks(e,t){return(Ks=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var zs,Js,Ys=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ks(e,t)}(Qs,E.a.PureComponent),Bs((zs=Qs).prototype,[{key:"handleHostNameChange",value:function(e){this.setState({hostName:e.target.value,changed:!0})}},{key:"handleEditingFinished",value:function(){this.state.changed&&(this.setState({changed:!1}),this.props.onServerAddressChange(this.state.hostName.trim()))}},{key:"render",value:function(){var e=[];for(var t in v){var n=v[t];e.push(E.a.createElement("option",{key:n,value:n}))}return E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("input",{type:"search",id:"host-name",placeholder:this.props.hostName,list:"known-hosts",className:"quoted",value:this.state.hostName,onChange:this.handleHostNameChange,onBlur:this.handleEditingFinished,required:!0}),E.a.createElement("datalist",{id:"known-hosts"},e))}}]),Js&&Bs(zs,Js),Qs);function Qs(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Qs),n=this,(t=!(a=Vs(Qs).call(this,e))||"object"!==Ws(a)&&"function"!=typeof a?Gs(n):a).state={hostName:e.serverAddress,changed:!1},t.handleHostNameChange=t.handleHostNameChange.bind(Gs(t)),t.handleEditingFinished=t.handleEditingFinished.bind(Gs(t)),t}function Xs(e){return(Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zs(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function $s(e){return($s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function el(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tl(e,t){return(tl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var nl,al,ol=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tl(e,t)}(rl,E.a.PureComponent),Zs((nl=rl).prototype,[{key:"handleSubmit",value:function(e){e.preventDefault(),this.props.onUpdate({transport:this.state.transport,serverAddress:this.state.serverAddress})}},{key:"handleTransportSelected",value:function(e){this.setState({transport:e.currentTarget.value})}},{key:"handleServerAddressChange",value:function(e){this.setState({serverAddress:e})}},{key:"render",value:function(){var a={def:"default",ws:"websocket",lp:"long polling"},o=[],r=this;return["def","ws","lp"].map(function(e){var t="transport-"+e,n=a[e];o.push(E.a.createElement("li",{key:e},E.a.createElement("input",{type:"radio",id:t,name:"transport-select",value:e,checked:r.state.transport===e,onChange:r.handleTransportSelected}),E.a.createElement("label",{htmlFor:t},n)))}),E.a.createElement("form",{id:"settings-form",className:"panel-form",onSubmit:this.handleSubmit},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_server_to_use",defaultMessage:"Server to use:"}))),E.a.createElement(Ys,{serverAddress:this.state.serverAddress,onServerAddressChange:this.handleServerAddressChange}),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small"},E.a.createElement(S.FormattedMessage,{id:"label_wire_transport",defaultMessage:"Wire transport:"}))),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("ul",{className:"quoted"},o)),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{type:"submit",className:"blue"},E.a.createElement(S.FormattedMessage,{id:"button_update",defaultMessage:"Update"}))))}}]),al&&Zs(nl,al),rl);function rl(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,rl),n=this,(t=!(a=$s(rl).call(this,e))||"object"!==Xs(a)&&"function"!=typeof a?el(n):a).state={transport:e.transport||"def",serverAddress:e.serverAddress},t.handleSubmit=t.handleSubmit.bind(el(t)),t.handleTransportSelected=t.handleTransportSelected.bind(el(t)),t.handleServerAddressChange=t.handleServerAddressChange.bind(el(t)),t}function il(e){return(il="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sl(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ll(e){return(ll=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ul(e,t){return(ul=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var dl,pl,hl=Object(S.defineMessages)({phone:{id:"phone_dative",defaultMessage:"phone"},email:{id:"email_dative",defaultMessage:"email"}}),ml=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ul(e,t)}(fl,E.a.PureComponent),sl((dl=fl).prototype,[{key:"handleChange",value:function(e){this.setState({code:e.target.value})}},{key:"handleKeyPress",value:function(e){"Enter"===e.key?this.handleSubmit(e):"Escape"==e.key&&this.handleCancel(e)}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.state.code&&this.state.code.trim()&&this.props.onSubmit(this.props.credMethod,this.state.code.trim())}},{key:"handleCancel",value:function(e){e.preventDefault(),this.props.onCancel()}},{key:"render",value:function(){var t=this,e=this.props.intl.formatMessage,n={email:e(hl.email),tel:e(hl.phone)}[this.props.credMethod]||this.props.credMethod;return E.a.createElement("div",{className:"panel-form"},E.a.createElement("div",{className:"panel-form-row"},E.a.createElement("label",{className:"small",htmlFor:"enter-confirmation-code"},E.a.createElement(S.FormattedMessage,{id:"enter_confirmation_code_prompt",defaultMessage:"Enter confirmation code sent to you by {method}:",values:{method:n}}))),E.a.createElement("div",{className:"panel-form-row"},E.a.createElement(S.FormattedMessage,{id:"numeric_confirmation_code_prompt",defaultMessage:"Numbers only"},function(e){return E.a.createElement("input",{type:"text",id:"enter-confirmation-code",placeholder:e,value:t.state.code,onChange:t.handleChange,onKeyPress:t.handleKeyPress,required:!0})})),E.a.createElement("div",{className:"dialog-buttons"},E.a.createElement("button",{className:"blue",onClick:this.handleSubmit},E.a.createElement(S.FormattedMessage,{id:"button_confirm",defaultMessage:"Confirm"})),E.a.createElement("button",{className:"white",onClick:this.handleCancel},E.a.createElement(S.FormattedMessage,{id:"button_cancel"}))))}}]),pl&&sl(dl,pl),fl);function fl(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,fl),n=this,(t=!(a=ll(fl).call(this,e))||"object"!==il(a)&&"function"!=typeof a?cl(n):a).state={code:e.credCode||""},t.handleChange=t.handleChange.bind(cl(t)),t.handleKeyPress=t.handleKeyPress.bind(cl(t)),t.handleSubmit=t.handleSubmit.bind(cl(t)),t.handleCancel=t.handleCancel.bind(cl(t)),t}var bl=Object(S.injectIntl)(ml);function gl(e){return(gl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yl(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function vl(e){return(vl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wl(e,t){return(wl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var El,Sl,kl=Object(S.defineMessages)({login:{id:"sidepanel_title_login",defaultMessage:"Sign In"},register:{id:"sidepanel_title_register",defaultMessage:"Create Account"},settings:{id:"sidepanel_title_settings",defaultMessage:"Settings"},edit:{id:"sidepanel_title_edit_account",defaultMessage:"Edit Account"},newtpk:{id:"sidepanel_title_newtpk",defaultMessage:"Start New Chat"},cred:{id:"sidepanel_title_cred",defaultMessage:"Confirm Credentials"},reset:{id:"sidepanel_title_reset",defaultMessage:"Reset Password"},archive:{id:"sidepanel_title_archive",defaultMessage:"Archived Chats"}}),Cl=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wl(e,t)}(Ml,E.a.Component),yl((El=Ml).prototype,[{key:"handleLoginRequested",value:function(e,t){this.props.onLoginRequest(e,t)}},{key:"render",value:function(){var e,t,n,a=this.props.intl.formatMessage,o=this.props.state||(this.props.myUserId?"contacts":"login");return t="contacts"==o?(e=this.props.title,!this.props.avatar||this.props.avatar):(e=a(kl[o]),!1),-1==["login","contacts"].indexOf(o)&&(n=this.props.onCancel),E.a.createElement("div",{id:"sidepanel",className:this.props.hideSelf?"nodisplay":null},E.a.createElement(ti,{state:o,title:e,avatar:t,myUserId:this.props.myUserId,onSignUp:this.props.onSignUp,onSettings:this.props.onSettings,onNewTopic:this.props.onNewTopic,onCancel:n}),E.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,action:this.props.errorAction,actionText:this.props.errorActionText,onClearError:this.props.onError}),E.a.createElement(zo,{show:this.props.loadSpinnerVisible}),"login"===o?E.a.createElement(Gi,{login:this.props.login,disabled:this.props.loginDisabled,onLogin:this.handleLoginRequested}):"register"===o?E.a.createElement(Oi,{onCreateAccount:this.props.onCreateAccount,onCancel:this.props.onCancel,onError:this.props.onError}):"settings"===o?E.a.createElement(ol,{transport:this.props.transport,serverAddress:this.props.serverAddress,onCancel:this.props.onCancel,onUpdate:this.props.onGlobalSettings}):"edit"===o?E.a.createElement(Di,{tinode:this.props.tinode,myUserId:this.props.myUserId,messageSounds:this.props.messageSounds,desktopAlerts:this.props.desktopAlerts,desktopAlertsEnabled:this.props.desktopAlertsEnabled,onUpdateAccount:this.props.onUpdateAccount,onUpdateTags:this.props.onUpdateAccountTags,onTogglePushNotifications:this.props.onTogglePushNotifications,onToggleMessageSounds:this.props.onToggleMessageSounds,onCredAdd:this.props.onCredAdd,onCredDelete:this.props.onCredDelete,onCredConfirm:this.props.onCredConfirm,onLogout:this.props.onLogout,onCancel:this.props.onCancel,onError:this.props.onError}):"contacts"===o||"archive"==o?E.a.createElement(pi,{tinode:this.props.tinode,myUserId:this.props.myUserId,connected:this.props.connected,topicSelected:this.props.topicSelected,archive:"archive"==o,chatList:this.props.chatList,showContextMenu:this.props.showContextMenu,onTopicSelected:this.props.onTopicSelected,onShowArchive:this.props.onShowArchive}):"newtpk"===o?E.a.createElement(As,{searchResults:this.props.searchResults,onInitFind:this.props.onInitFind,onSearchContacts:this.props.onSearchContacts,onCreateTopic:this.props.onCreateTopic,onError:this.props.onError}):"cred"===o?E.a.createElement(bl,{credCode:this.props.credCode,credMethod:this.props.credMethod,onSubmit:this.props.onValidateCredentials,onCancel:this.props.onCancel,onError:this.props.onError}):"reset"===o?E.a.createElement(qs,{onRequest:this.props.onPasswordResetRequest,onReset:this.props.onResetPassword}):null)}}]),Sl&&yl(El,Sl),Ml);function Ml(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ml),n=this,(t=!(a=vl(Ml).call(this,e))||"object"!==gl(a)&&"function"!=typeof a?_l(n):a).handleLoginRequested=t.handleLoginRequested.bind(_l(t)),t}var Ol=Object(S.injectIntl)(Cl);function Tl(e){return(Tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pl(){return"object"==Tl(window.location)&&"https:"==window.location.protocol}function jl(e){return(jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nl(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Al(e){return(Al=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ul(e,t){return(Ul=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xl,Dl,Rl,Il=new Audio("audio/msg.mp3"),Ll=Object(S.defineMessages)({update_available:{id:"update_available",defaultMessage:'Update available. <a href="">Reload</a>.'},reconnect_countdown:{id:"reconnect_countdown",defaultMessage:"Disconnected. Reconnecting in {seconds}…"},reconnect_now:{id:"reconnect_now",defaultMessage:"Try now"}}),ql=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ul(e,t)}(Hl,E.a.Component),Rl=[{key:"tnSetup",value:function(e,t){var n=new k.a(y,e,"AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K",t,Pl());return n.enableLogging(!0,!0),n}},{key:"prepareSearchableContacts",value:function(e,t){var n={},a=!0,o=!1,r=void 0;try{for(var i,s=e[Symbol.iterator]();!(a=(i=s.next()).done);a=!0){var l=i.value;"p2p"==k.a.topicType(l.topic)&&(n[l.topic]={user:l.topic,updated:l.updated,public:l.public,private:l.private,acs:l.acs})}}catch(e){o=!0,r=e}finally{try{a||null==s.return||s.return()}finally{if(o)throw r}}var c=!0,u=!1,d=void 0;try{for(var p,h=t[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var m=p.value;n[m.user]||(n[m.user]=m)}}catch(e){u=!0,d=e}finally{try{c||null==h.return||h.return()}finally{if(u)throw d}}return Object.values(n)}}],Dl=[{key:"getBlankState",value:function(){var e,t=yi.getObject("settings")||{};return{connected:!1,ready:!1,transport:t.transport||null,serverAddress:t.serverAddress||(e=_,"object"==Tl(window.location)&&("file:"==window.location.protocol||"localhost"==window.location.hostname?e=v.local:window.location.hostname&&(e=window.location.hostname+(window.location.port?":"+window.location.port:""))),e),serverVersion:"no connection",messageSounds:!t.messageSoundsOff,desktopAlerts:t.desktopAlerts,desktopAlertsEnabled:(Pl()||"object"==Tl(window.location)&&"localhost"==window.location.hostname)&&void 0!==s&&"undefined"!=typeof navigator&&"undefined"!=typeof FIREBASE_INIT,firebaseToken:yi.getObject("firebase-token"),errorText:"",errorLevel:null,errorAction:void 0,errorActionText:null,sidePanelSelected:"login",sidePanelTitle:null,sidePanelAvatar:null,loadSpinnerVisible:!1,login:"",password:"",myUserId:null,liveConnection:navigator.onLine,topicSelected:"",topicSelectedOnline:!1,topicSelectedAcs:null,newTopicParams:null,loginDisabled:!1,displayMobile:window.innerWidth<=640,showInfoPanel:!1,mobilePanel:"sidepanel",contextMenuVisible:!1,contextMenuBounds:null,contextMenuClickAt:null,contextMenuParams:null,contextMenuItems:[],alertVisible:!1,alertParams:{},chatList:[],searchResults:[],searchableContacts:[],credMethod:void 0,credCode:void 0}}},{key:"componentDidMount",value:function(){var t=this;if(window.addEventListener("resize",this.handleResize),window.addEventListener("online",function(e){t.handleOnline(!0)}),window.addEventListener("offline",function(e){t.handleOnline(!1)}),window.addEventListener("hashchange",this.handleHashRoute),document.addEventListener("visibilitychange",this.handleVisibilityEvent),this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),this.tinode=Hl.tnSetup(this.state.serverAddress,this.state.transport),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.state.desktopAlertsEnabled)try{this.fbPush=s.initializeApp(FIREBASE_INIT,y).messaging(),this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey),navigator.serviceWorker.register("/service-worker.js").then(function(e){t.checkForAppUpdate(e),t.fbPush.useServiceWorker(e),t.initDesktopAlerts(),t.state.desktopAlerts&&(t.state.firebaseToken?t.tinode.setDeviceToken(t.state.firebaseToken,!0):t.togglePushToken(!0))}).catch(function(e){console.log("Failed to register service worker:",e)})}catch(e){this.handleError("Failed to initialize push notifications","err"),console.log("Failed to initialize push notifications",e),this.setState({desktopAlertsEnabled:!1})}var e=yi.getObject("keep-logged-in")?yi.getObject("auth-token"):void 0,n=j.parseUrlHash(window.location.hash);e?(e.expires=new Date(e.expires),this.tinode.setAuthToken(e),this.tinode.connect().catch(function(e){t.handleError(e.message,"err")}),delete n.params.info,delete n.params.tab,n.path[0]="",j.navigateTo(j.composeUrlHash(n.path,n.params))):n.params.token||j.navigateTo(""),this.readTimer=null,this.readTimerCallback=null,this.handleHashRoute()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("hashchange",this.handleHashRoute),document.removeEventListener("visibilitychange",this.handleVisibilityEvent)}},{key:"handleResize",value:function(){var e=document.documentElement.clientWidth<=640;this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),this.state.displayMobile!=e&&this.setState({displayMobile:e})}},{key:"checkForAppUpdate",value:function(t){var n=this,a=this.props.intl.formatHTMLMessage;t.onupdatefound=function(){var e=t.installing;e.onstatechange=function(){"installed"==e.state&&navigator.serviceWorker.controller&&n.handleError(a(Ll.update_available),"info")}}}},{key:"handleHashRoute",value:function(){var e=j.parseUrlHash(window.location.hash);e.path&&0<e.path.length?(["register","settings","edit","cred","reset","newtpk","archive","contacts",""].includes(e.path[0])?this.setState({sidePanelSelected:e.path[0]}):console.log("Unknown sidepanel view",e.path[0]),1<e.path.length&&e.path[1]!=this.state.topicSelected&&this.setState({topicSelected:k.a.topicType(e.path[1])?e.path[1]:null})):this.setState({sidePanelSelected:""}),e.params.method&&this.setState({credMethod:e.params.method}),e.params.code&&this.setState({credCode:e.params.code}),this.setState({showInfoPanel:e.params.info,newTopicTabSelected:e.params.tab})}},{key:"handleOnline",value:function(e){e?this.handleError("",null):this.handleError("No connection","warn"),this.setState({liveConnection:e})}},{key:"handleAppVisibility",value:function(e,t){clearTimeout(this.readTimer),this.readTimerCallback=t,this.readTimer=e&&t?setTimeout(t,1e3):null}},{key:"handleReadTimer",value:function(e){this.handleAppVisibility(!document.hidden,e)}},{key:"handleVisibilityEvent",value:function(){this.handleAppVisibility(!document.hidden,this.readTimerCallback)}},{key:"handleError",value:function(e,t,n,a){this.setState({errorText:e,errorLevel:t,errorAction:n,errorActionText:a})}},{key:"handleLoginRequest",value:function(e,t){var n=this;this.setState({loginDisabled:!0,login:e,password:t,loadSpinnerVisible:!0}),this.handleError("",null),this.tinode.isConnected()?this.doLogin(e,t,{meth:this.state.credMethod,resp:this.state.credCode}):this.tinode.connect().catch(function(e){n.setState({loginDisabled:!1}),n.handleError(e.message,"err")})}},{key:"handleConnected",value:function(){var e=this.tinode.getServerInfo();this.setState({serverVersion:e.ver+" "+(e.build?e.build:"none")+"; "}),this.doLogin(this.state.login,this.state.password,{meth:this.state.credMethod,resp:this.state.credCode})}},{key:"handleAutoreconnectIteration",value:function(e,t){var o=this;if(clearInterval(this.reconnectCountdown),e<0)this.handleError();else if(t)t.then(function(){o.handleError()}).catch(function(e){o.handleError(e.message,"err")});else{var r=this.props.intl.formatHTMLMessage,i=e/1e3;i|=i,this.reconnectCountdown=setInterval(function(){var e,t,n,a=99<i?(e=i,t=Math.floor(e/60),n=(n=e%60)<10?"0".concat(n):n,"".concat(t,":").concat(n)):i;o.handleError(r(Ll.reconnect_countdown,{seconds:a}),"warn",function(){clearInterval(o.reconnectCountdown),o.tinode.reconnect()},r(Ll.reconnect_now)),--i},1e3)}}},{key:"handleDisconnect",value:function(e){this.setState({connected:!1,ready:!1,topicSelectedOnline:!1,errorText:e&&e.message?e.message:"Disconnected",errorLevel:e&&e.message?"err":"warn",loginDisabled:!1,contextMenuVisible:!1,serverVersion:"no connection"})}},{key:"doLogin",value:function(e,t,n){var a=this;if(this.tinode.isAuthenticated())j.navigateTo("");else{n=k.a.credential(n);var o=null,r=this.tinode.getAuthToken();e&&t?(this.setState({password:null}),o=this.tinode.loginBasic(e,t,n)):r&&(o=this.tinode.loginToken(r.token,n)),o?o.then(function(e){300<=e.code&&"validate credentials"===e.text?(a.setState({loadSpinnerVisible:!1}),n&&a.handleError("Code does not match","warn"),a.handleCredentialsRequest(e.params)):a.handleLoginSuccessful()}).catch(function(e){a.setState({loginDisabled:!1,credMethod:void 0,credCode:void 0,loadSpinnerVisible:!1}),a.handleError(e.message,"err"),localStorage.removeItem("auth-token"),j.navigateTo("")}):(j.navigateTo(""),this.setState({loginDisabled:!1}))}}},{key:"handleCredentialsRequest",value:function(e){var t=j.parseUrlHash(window.location.hash);t.path[0]="cred",t.params.method=e.cred[0],j.navigateTo(j.composeUrlHash(t.path,t.params))}},{key:"handleLoginSuccessful",value:function(){var t=this;this.handleError("",null),yi.getObject("keep-logged-in")&&yi.setObject("auth-token",this.tinode.getAuthToken());var e=this.tinode.getMeTopic();e.onMetaDesc=this.tnMeMetaDesc,e.onContactUpdate=this.tnMeContactUpdate,e.onSubsUpdated=this.tnMeSubsUpdated,this.setState({connected:!0,credMethod:void 0,credCode:void 0,myUserId:this.tinode.getCurrentUserID()}),e.subscribe(e.startMetaQuery().withLaterSub().withDesc().withTags().withCred().build()).catch(function(e){t.tinode.disconnect(),localStorage.removeItem("auth-token"),t.handleError(e.message,"err"),j.navigateTo("")}).finally(function(){t.setState({loadSpinnerVisible:!1})}),j.navigateTo(j.setUrlSidePanel(window.location.hash,"contacts"))}},{key:"tnMeMetaDesc",value:function(e){e&&e.public&&this.setState({sidePanelTitle:e.public.fn,sidePanelAvatar:ne(e.public.photo)})}},{key:"tnMeContactUpdate",value:function(e,t){if("on"==e||"off"==e)this.resetContactList(),this.state.topicSelected==t.topic&&this.setState({topicSelectedOnline:"on"==e});else if("read"==e)this.resetContactList();else if("msg"==e){var n=this.tinode.getTopic(t.topic),a=n&&n.isArchived();0<t.unread&&this.state.messageSounds&&!a&&(!document.hidden&&this.state.topicSelected==t.topic||Il.play()),this.resetContactList()}else"recv"==e||("gone"==e||"unsub"==e?(this.state.topicSelected==t.topic&&this.handleTopicSelected(null),this.resetContactList()):"acs"==e?this.state.topicSelected==t.topic&&this.setState({topicSelectedAcs:t.acs}):"del"==e||"upd"==e||console.log("Unsupported (yet) presence update:"+e+" in: "+t.topic))}},{key:"tnMeSubsUpdated",value:function(){this.resetContactList()}},{key:"resetContactList",value:function(){var t=this,n={chatList:[]};this.state.ready||(n.ready=!0),this.tinode.getMeTopic().contacts(function(e){n.chatList.push(e),t.state.topicSelected==e.topic&&(n.topicSelectedOnline=e.online,n.topicSelectedAcs=e.acs)}),n.searchableContacts=Hl.prepareSearchableContacts(n.chatList,this.state.searchResults),this.setState(n)}},{key:"tnData",value:function(e){var t=this,n=this.tinode.getTopic(e.topic);n.msgStatus(e)>=k.a.MESSAGE_STATUS_SENT&&e.from!=this.state.myUserId&&(clearTimeout(this.receivedTimer),this.receivedTimer=setTimeout(function(){t.receivedTimer=void 0,n.noteRecv(e.seq)},500))}},{key:"tnInitFind",value:function(){var t=this,e=this.tinode.getFndTopic();e.onSubsUpdated=this.tnFndSubsUpdated,e.isSubscribed()?this.tnFndSubsUpdated():e.subscribe(e.startMetaQuery().withSub().build()).catch(function(e){t.handleError(e.message,"err")})}},{key:"tnFndSubsUpdated",value:function(){var t=[];this.tinode.getFndTopic().contacts(function(e){t.push(e)}),this.setState({searchResults:t,searchableContacts:Hl.prepareSearchableContacts(this.state.chatList,t)})}},{key:"handleSearchContacts",value:function(e){var t=this,n=this.tinode.getFndTopic();n.setMeta({desc:{public:e}}).then(function(e){return n.getMeta(n.startMetaQuery().withSub().build())}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleTopicSelected",value:function(e,t,n,a){this.state.newTopicParams&&this.state.newTopicParams._topicName!=e&&this.setState({newTopicParams:null}),e?(this.setState({errorText:"",errorLevel:null,mobilePanel:"topic-view",showInfoPanel:!1}),this.state.topicSelected!=e&&(this.setState({topicSelectedOnline:n,topicSelectedAcs:a}),j.navigateTo(j.setUrlTopic("",e)))):(this.setState({errorText:"",errorLevel:null,mobilePanel:"sidepanel",topicSelectedOnline:!1,topicSelectedAcs:null,showInfoPanel:!1}),j.navigateTo(j.setUrlTopic("",null)))}},{key:"handleHideMessagesView",value:function(){this.setState({mobilePanel:"sidepanel"}),j.navigateTo(j.setUrlTopic(window.location.hash,null))}},{key:"handleSendMessage",value:function(e,t,n){var a=this,o=this.tinode.getTopic(this.state.topicSelected);(e=o.createMessage(e,!1))._uploader=n,o.isSubscribed()||(t=(t=t||Promise.resolve()).then(function(){return o.subscribe()})),t=t&&t.catch(function(e){a.handleError(e.message,"err")}),o.publishDraft(e,t).then(function(e){if(o.isArchived())return o.archive(!1)}).catch(function(e){a.handleError(e.message,"err")})}},{key:"handleNewChatInvitation",value:function(t,e){var n=this,a=this.tinode.getTopic(t),o=null;switch(e){case"accept":var r=a.getAccessMode().getGiven();o=a.setMeta({sub:{mode:r}}),"p2p"==a.getType()&&(o=o.then(function(e){a.setMeta({sub:{user:t,mode:r}})}));break;case"delete":o=a.delTopic();break;case"block":var i=a.getAccessMode().updateWant("-JP").getWant();o=a.setMeta({sub:{mode:i}}).then(function(e){return n.handleTopicSelected(null)});break;default:console.log("Unknown invitation action",'"'+e+'""')}null!=o&&o.catch(function(e){n.handleError(e.message,"err")})}},{key:"handleNewAccount",value:function(){j.navigateTo(j.setUrlSidePanel(window.location.hash,"register"))}},{key:"handleNewAccountRequest",value:function(e,t,n,a,o){var r=this;this.tinode.connect(this.state.serverAddress).then(function(){return r.tinode.createAccountBasic(e,t,{public:n,tags:o,cred:k.a.credential(a)})}).then(function(e){300<=e.code&&"validate credentials"==e.text?r.handleCredentialsRequest(e.params):r.handleLoginSuccessful(r)}).catch(function(e){r.handleError(e.message,"err")})}},{key:"handleUpdateAccountRequest",value:function(e,t,n){var a=this;if(t||n){var o={};t&&(o.public=t),n&&(o.defacs=n),this.tinode.getMeTopic().setMeta({desc:o}).catch(function(e){a.handleError(e.message,"err")})}e&&this.tinode.updateAccountBasic(null,this.tinode.getCurrentLogin(),e).catch(function(e){a.handleError(e.message,"err")})}},{key:"handleUpdateAccountTagsRequest",value:function(e){var t=this;this.tinode.getMeTopic().setMeta({tags:e}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleSettings",value:function(){j.navigateTo(j.setUrlSidePanel(window.location.hash,this.state.myUserId?"edit":"settings"))}},{key:"handleGlobalSettings",value:function(e){var t=e.serverAddress||this.state.serverAddress,n=e.transport||this.state.transport;this.tinode&&(this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.tinode=Hl.tnSetup(t,n),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.setState({serverAddress:t,transport:n}),yi.setObject("settings",{serverAddress:t,transport:n}),j.navigateTo(j.setUrlSidePanel(window.location.hash,""))}},{key:"handleShowArchive",value:function(){j.navigateTo(j.setUrlSidePanel(window.location.hash,this.state.myUserId?"archive":""))}},{key:"initDesktopAlerts",value:function(){var e=this;this.fbPush.onTokenRefresh(function(){e.requestPushToken()}),this.fbPush.onMessage(function(e){})}},{key:"togglePushToken",value:function(e){var t=this;e?this.state.firebaseToken?(this.setState({desktopAlerts:!0}),yi.updateObject("settings",{desktopAlerts:!0})):this.fbPush.requestPermission().then(function(){t.requestPushToken()}).catch(function(e){t.handleError(e.message,"err"),t.setState({desktopAlerts:!1,firebaseToken:null}),yi.updateObject("settings",{desktopAlerts:!1}),console.log("Failed to get permission to notify.",e)}):this.state.firebaseToken?this.fbPush.deleteToken(this.state.firebaseToken).catch(function(e){console.log("Unable to delete token.",e)}).finally(function(){yi.updateObject("settings",{desktopAlerts:!1}),localStorage.removeItem("firebase-token"),t.setState({desktopAlerts:!1,firebaseToken:null})}):(this.setState({desktopAlerts:!1,firebaseToken:null}),yi.updateObject("settings",{desktopAlerts:!1}))}},{key:"requestPushToken",value:function(){var t=this;this.fbPush.getToken().then(function(e){e!=t.state.firebaseToken&&(t.tinode.setDeviceToken(e,!0),yi.setObject("firebase-token",e)),t.setState({firebaseToken:e,desktopAlerts:!0}),yi.updateObject("settings",{desktopAlerts:!0})}).catch(function(e){t.handleError(e.message,"err"),console.log("Failed to retrieve firebase token",e)})}},{key:"handleToggleMessageSounds",value:function(e){this.setState({messageSounds:e}),yi.updateObject("settings",{messageSoundsOff:!e})}},{key:"handleCredAdd",value:function(e,t){var n=this;this.tinode.getMeTopic().setMeta({cred:{meth:e,val:t}}).catch(function(e){n.handleError(e.message,"err")})}},{key:"handleCredDelete",value:function(e,t){var n=this;this.tinode.getMeTopic().delCredential(e,t).catch(function(e){n.handleError(e.message,"err")})}},{key:"handleCredConfirm",value:function(e){this.handleCredentialsRequest({cred:[e]})}},{key:"handleSidepanelCancel",value:function(){var e=j.parseUrlHash(window.location.hash);e.path[0]=this.state.myUserId?"contacts":"",e.params&&(delete e.params.code,delete e.params.method,delete e.params.tab),j.navigateTo(j.composeUrlHash(e.path,e.params)),this.setState({errorText:"",errorLevel:null})}},{key:"handleNewTopic",value:function(){j.navigateTo(j.setUrlSidePanel(window.location.hash,"newtpk"))}},{key:"handleNewTopicRequest",value:function(e,t,n,a){var o=this,r=e||this.tinode.newGroupTopicName(),i={_topicName:r};e?(i.sub={mode:w},i.desc={defacs:{auth:w}}):(i.desc={public:t,private:{comment:n}},i.tags=a),this.setState({newTopicParams:i},function(){o.handleTopicSelected(r)})}},{key:"handleNewTopicCreated",value:function(e,t){this.state.topicSelected==e&&e!=t&&this.setState({topicSelected:t},function(){j.navigateTo(j.setUrlTopic("",t))})}},{key:"handleTopicUpdateRequest",value:function(e,t,n,a){var o=this,r=this.tinode.getTopic(e);if(r){var i={};t&&(i.public=t),n&&(i.private=n===k.a.DEL_CHAR?k.a.DEL_CHAR:{comment:n}),a&&(i.defacs=a),r.setMeta({desc:i}).catch(function(e){o.handleError(e.message,"err")})}}},{key:"handleChangePermissions",value:function(e,t,n){var a=this,o=this.tinode.getTopic(e);if(o){var r=o.getAccessMode();t=n?(r.updateGiven(t),r.getGiven()):(r.updateWant(t),r.getWant()),o.setMeta({sub:{user:n,mode:t}}).catch(function(e){a.handleError(e.message,"err")})}}},{key:"handleTagsUpdated",value:function(e,t){var n=this,a=this.tinode.getTopic(e);a&&a.setMeta({tags:t}).catch(function(e){n.handleError(e.message,"err")})}},{key:"handleLogout",value:function(){aa(0),localStorage.removeItem("auth-token"),localStorage.removeItem("firebase-token"),localStorage.removeItem("settings"),this.state.firebaseToken&&this.fbPush.deleteToken(this.state.firebaseToken),this.tinode&&(this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.setState(this.getBlankState()),this.tinode=Hl.tnSetup(this.state.serverAddress,this.state.transport),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,j.navigateTo("")}},{key:"handleDeleteMessagesRequest",value:function(e){var t=this,n=this.tinode.getTopic(e);n&&n.delMessagesAll(!0).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleLeaveUnsubRequest",value:function(e){var t=this,n=this.tinode.getTopic(e);n&&n.leave(!0).then(function(e){j.navigateTo(j.setUrlTopic(window.location.hash,""))}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleBlockTopicRequest",value:function(e){var t=this,n=this.tinode.getTopic(e);n&&n.updateMode(null,"-JP").then(function(e){j.navigateTo(j.setUrlTopic(window.location.hash,""))}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleReportTopic",value:function(e){var t=this,n=this.tinode.getTopic(e);n&&(this.tinode.publish(k.a.TOPIC_SYS,k.a.Drafty.attachJSON(null,{action:"report",target:e})),n.updateMode(null,"-JP").then(function(e){j.navigateTo(j.setUrlTopic(window.location.hash,""))}).catch(function(e){t.handleError(e.message,"err")}))}},{key:"handleShowContextMenu",value:function(e,t){this.setState({contextMenuVisible:!0,contextMenuClickAt:{x:e.x,y:e.y},contextMenuParams:e,contextMenuItems:t||this.defaultTopicContextMenu(e.topicName),contextMenuBounds:r.a.findDOMNode(this).getBoundingClientRect()})}},{key:"defaultTopicContextMenu",value:function(e){var t=this.tinode.getTopic(e),n=this.props.intl.formatMessage,a=!1,o=!1,r=!1,i=!1,s=!1,l=!1;if(t){i=t.isSubscribed(),l=t.isArchived();var c=t.getAccessMode();c&&(a=c.isMuted(),o=!c.isJoiner(),r=!c.isJoiner("want"),s=c.isDeleter())}return[i?{title:n({id:"menu_item_info"}),handler:this.handleShowInfoView}:null,i?"messages_clear":null,i&&s?"messages_clear_hard":null,a?o?null:"topic_unmute":"topic_mute",r?"topic_unblock":"topic_block",l?null:"topic_archive","topic_delete"]}},{key:"handleHideContextMenu",value:function(){this.setState({contextMenuVisible:!1,contextMenuClickAt:null,contextMenuParams:null,contextMenuBounds:null})}},{key:"handleContextMenuAction",value:function(e,t,n){var a=this;"topic_archive"==e&&t&&n.topicName&&n.topicName==this.state.topicSelected&&t.then(function(){a.handleTopicSelected(null)})}},{key:"handleShowAlert",value:function(e,t,n,a,o,r){this.setState({alertVisible:!0,alertParams:{title:e,content:t,onConfirm:n,confirm:a,onReject:o,reject:r}})}},{key:"handleShowInfoView",value:function(){j.navigateTo(j.addUrlParam(window.location.hash,"info",!0)),this.setState({showInfoPanel:!0})}},{key:"handleHideInfoView",value:function(){j.navigateTo(j.removeUrlParam(window.location.hash,"info")),this.setState({showInfoPanel:!1})}},{key:"handleMemberUpdateRequest",value:function(e,t,n){var a=this;if(e){var o=this.tinode.getTopic(e);o&&(t&&0<t.length&&t.map(function(e){o.invite(e,null).catch(function(e){a.handleError(e.message,"err")})}),n&&0<n.length&&n.map(function(e){o.delSubscription(e).catch(function(e){a.handleError(e.message,"err")})}))}}},{key:"handleValidateCredentialsRequest",value:function(e,t){var n=this;this.tinode.isAuthenticated()?this.tinode.getMeTopic().setMeta({cred:{meth:e,resp:t}}).then(function(){j.navigateTo("")}).catch(function(e){n.handleError(e.message,"err")}):(this.setState({credMethod:e,credCode:t}),this.doLogin(null,null,{meth:e,resp:t}))}},{key:"handlePasswordResetRequest",value:function(e,t){var n=this;this.tinode.connect().then(function(){return n.tinode.requestResetAuthSecret("basic",e,t)}).catch(function(e){n.handleError(e.message,"err")})}},{key:"handleResetPassword",value:function(e,t,n){var a=this;(n=function(t){if(t){t=t.replace(/-/g,"+").replace(/_/g,"/");try{t=btoa(atob(t))}catch(e){console.log("Failed to base64 re-encode string.",e),t=null}}return t}(n))?this.tinode.connect().then(function(){return a.tinode.updateAccountBasic(null,null,t,{token:n})}).catch(function(e){a.handleError(e.message,"err")}):this.handleError("Invalid security token","err")}},{key:"render",value:function(){var t=this;return E.a.createElement("div",{id:"app-container"},this.state.contextMenuVisible?E.a.createElement(W,{tinode:this.tinode,bounds:this.state.contextMenuBounds,clickAt:this.state.contextMenuClickAt,params:this.state.contextMenuParams,items:this.state.contextMenuItems,hide:this.handleHideContextMenu,onShowAlert:this.handleShowAlert,onAction:this.handleContextMenuAction,onTopicRemoved:function(e){e==t.state.topicSelected&&t.handleTopicSelected(null)},onError:this.handleError}):null,E.a.createElement(b,{visible:this.state.alertVisible,title:this.state.alertParams.title,content:this.state.alertParams.content,onReject:this.state.alertParams.onReject?function(){t.setState({alertVisible:!1})}:null,reject:this.state.alertParams.reject,onConfirm:function(){t.setState({alertVisible:!1}),t.state.alertParams.onConfirm()},confirm:this.state.alertParams.confirm}),E.a.createElement(Ol,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,hideSelf:this.state.displayMobile&&"sidepanel"!==this.state.mobilePanel,state:this.state.sidePanelSelected,title:this.state.sidePanelTitle,avatar:this.state.sidePanelAvatar,login:this.state.login,myUserId:this.state.myUserId,loginDisabled:this.state.loginDisabled,loadSpinnerVisible:this.state.loadSpinnerVisible,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,topicSelected:this.state.topicSelected,chatList:this.state.chatList,credMethod:this.state.credMethod,credCode:this.state.credCode,transport:this.state.transport,messageSounds:this.state.messageSounds,desktopAlerts:this.state.desktopAlerts,desktopAlertsEnabled:this.state.desktopAlertsEnabled,serverAddress:this.state.serverAddress,onGlobalSettings:this.handleGlobalSettings,onSignUp:this.handleNewAccount,onSettings:this.handleSettings,onLoginRequest:this.handleLoginRequest,onCreateAccount:this.handleNewAccountRequest,onUpdateAccount:this.handleUpdateAccountRequest,onUpdateAccountTags:this.handleUpdateAccountTagsRequest,onTogglePushNotifications:this.togglePushToken,onToggleMessageSounds:this.handleToggleMessageSounds,onCredAdd:this.handleCredAdd,onCredDelete:this.handleCredDelete,onCredConfirm:this.handleCredConfirm,onTopicSelected:this.handleTopicSelected,onCreateTopic:this.handleNewTopicRequest,onNewTopic:this.handleNewTopic,onLogout:this.handleLogout,onCancel:this.handleSidepanelCancel,onError:this.handleError,onValidateCredentials:this.handleValidateCredentialsRequest,onPasswordResetRequest:this.handlePasswordResetRequest,onResetPassword:this.handleResetPassword,onShowArchive:this.handleShowArchive,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,showContextMenu:this.handleShowContextMenu}),E.a.createElement(Pr,{tinode:this.tinode,connected:this.state.connected,ready:this.state.ready,online:this.state.topicSelectedOnline,acs:this.state.topicSelectedAcs,displayMobile:this.state.displayMobile,viewportWidth:this.state.viewportWidth,viewportHeight:this.state.viewportHeight,hideSelf:this.state.displayMobile&&("topic-view"!==this.state.mobilePanel||this.state.showInfoPanel),topic:this.state.topicSelected,myUserId:this.state.myUserId,serverVersion:this.state.serverVersion,serverAddress:this.state.serverAddress,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,newTopicParams:this.state.newTopicParams,onHideMessagesView:this.handleHideMessagesView,onData:this.tnData,onError:this.handleError,onNewTopicCreated:this.handleNewTopicCreated,readTimerHandler:this.handleReadTimer,showContextMenu:this.handleShowContextMenu,onChangePermissions:this.handleChangePermissions,onNewChat:this.handleNewChatInvitation,sendMessage:this.handleSendMessage}),this.state.showInfoPanel?E.a.createElement(Ma,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,topic:this.state.topicSelected,searchableContacts:this.state.searchableContacts,myUserId:this.state.myUserId,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,onTopicDescUpdate:this.handleTopicUpdateRequest,onCancel:this.handleHideInfoView,onShowAlert:this.handleShowAlert,onChangePermissions:this.handleChangePermissions,onMemberUpdateRequest:this.handleMemberUpdateRequest,onDeleteMessages:this.handleDeleteMessagesRequest,onLeaveTopic:this.handleLeaveUnsubRequest,onBlockTopic:this.handleBlockTopicRequest,onReportTopic:this.handleReportTopic,onAddMember:this.handleManageGroupMembers,onTopicTagsUpdate:this.handleTagsUpdated,onInitFind:this.tnInitFind,onError:this.handleError,showContextMenu:this.handleShowContextMenu}):null)}}],Nl((xl=Hl).prototype,Dl),Rl&&Nl(xl,Rl),Hl);function Hl(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Hl),n=this,(t=!(a=Al(Hl).call(this,e))||"object"!==jl(a)&&"function"!=typeof a?Fl(n):a).state=t.getBlankState(),t.handleResize=t.handleResize.bind(Fl(t)),t.handleHashRoute=t.handleHashRoute.bind(Fl(t)),t.handleOnline=t.handleOnline.bind(Fl(t)),t.checkForAppUpdate=t.checkForAppUpdate.bind(Fl(t)),t.handleAppVisibility=t.handleAppVisibility.bind(Fl(t)),t.handleReadTimer=t.handleReadTimer.bind(Fl(t)),t.handleVisibilityEvent=t.handleVisibilityEvent.bind(Fl(t)),t.handleError=t.handleError.bind(Fl(t)),t.handleLoginRequest=t.handleLoginRequest.bind(Fl(t)),t.handleConnected=t.handleConnected.bind(Fl(t)),t.handleAutoreconnectIteration=t.handleAutoreconnectIteration.bind(Fl(t)),t.doLogin=t.doLogin.bind(Fl(t)),t.handleCredentialsRequest=t.handleCredentialsRequest.bind(Fl(t)),t.handleLoginSuccessful=t.handleLoginSuccessful.bind(Fl(t)),t.handleDisconnect=t.handleDisconnect.bind(Fl(t)),t.tnMeMetaDesc=t.tnMeMetaDesc.bind(Fl(t)),t.tnMeContactUpdate=t.tnMeContactUpdate.bind(Fl(t)),t.tnMeSubsUpdated=t.tnMeSubsUpdated.bind(Fl(t)),t.resetContactList=t.resetContactList.bind(Fl(t)),t.tnData=t.tnData.bind(Fl(t)),t.tnInitFind=t.tnInitFind.bind(Fl(t)),t.tnFndSubsUpdated=t.tnFndSubsUpdated.bind(Fl(t)),t.handleSearchContacts=t.handleSearchContacts.bind(Fl(t)),t.handleTopicSelected=t.handleTopicSelected.bind(Fl(t)),t.handleHideMessagesView=t.handleHideMessagesView.bind(Fl(t)),t.handleSendMessage=t.handleSendMessage.bind(Fl(t)),t.handleNewChatInvitation=t.handleNewChatInvitation.bind(Fl(t)),t.handleNewAccount=t.handleNewAccount.bind(Fl(t)),t.handleNewAccountRequest=t.handleNewAccountRequest.bind(Fl(t)),t.handleUpdateAccountRequest=t.handleUpdateAccountRequest.bind(Fl(t)),t.handleUpdateAccountTagsRequest=t.handleUpdateAccountTagsRequest.bind(Fl(t)),t.handleSettings=t.handleSettings.bind(Fl(t)),t.handleGlobalSettings=t.handleGlobalSettings.bind(Fl(t)),t.handleShowArchive=t.handleShowArchive.bind(Fl(t)),t.handleToggleMessageSounds=t.handleToggleMessageSounds.bind(Fl(t)),t.handleCredAdd=t.handleCredAdd.bind(Fl(t)),t.handleCredDelete=t.handleCredDelete.bind(Fl(t)),t.handleCredConfirm=t.handleCredConfirm.bind(Fl(t)),t.initDesktopAlerts=t.initDesktopAlerts.bind(Fl(t)),t.togglePushToken=t.togglePushToken.bind(Fl(t)),t.requestPushToken=t.requestPushToken.bind(Fl(t)),t.handleSidepanelCancel=t.handleSidepanelCancel.bind(Fl(t)),t.handleNewTopic=t.handleNewTopic.bind(Fl(t)),t.handleNewTopicRequest=t.handleNewTopicRequest.bind(Fl(t)),t.handleNewTopicCreated=t.handleNewTopicCreated.bind(Fl(t)),t.handleTopicUpdateRequest=t.handleTopicUpdateRequest.bind(Fl(t)),t.handleChangePermissions=t.handleChangePermissions.bind(Fl(t)),t.handleTagsUpdated=t.handleTagsUpdated.bind(Fl(t)),t.handleLogout=t.handleLogout.bind(Fl(t)),t.handleDeleteMessagesRequest=t.handleDeleteMessagesRequest.bind(Fl(t)),t.handleLeaveUnsubRequest=t.handleLeaveUnsubRequest.bind(Fl(t)),t.handleBlockTopicRequest=t.handleBlockTopicRequest.bind(Fl(t)),t.handleReportTopic=t.handleReportTopic.bind(Fl(t)),t.handleShowContextMenu=t.handleShowContextMenu.bind(Fl(t)),t.defaultTopicContextMenu=t.defaultTopicContextMenu.bind(Fl(t)),t.handleHideContextMenu=t.handleHideContextMenu.bind(Fl(t)),t.handleShowAlert=t.handleShowAlert.bind(Fl(t)),t.handleShowInfoView=t.handleShowInfoView.bind(Fl(t)),t.handleHideInfoView=t.handleHideInfoView.bind(Fl(t)),t.handleMemberUpdateRequest=t.handleMemberUpdateRequest.bind(Fl(t)),t.handleValidateCredentialsRequest=t.handleValidateCredentialsRequest.bind(Fl(t)),t.handlePasswordResetRequest=t.handlePasswordResetRequest.bind(Fl(t)),t.handleResetPassword=t.handleResetPassword.bind(Fl(t)),t.handleContextMenuAction=t.handleContextMenuAction.bind(Fl(t)),t}var Wl=Object(S.injectIntl)(ql),Bl=j.parseUrlHash(window.location.hash).params,Vl=Bl&&Bl.hl||navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||"en",Gl=Vl.toLowerCase().split(/[-_]/)[0],Kl=i[Vl]||i[Gl]||i.en;r.a.render(E.a.createElement(S.IntlProvider,{locale:Vl,messages:Kl,textComponent:E.a.Fragment},E.a.createElement(Wl,null)),document.getElementById("mountPoint"))}]);
//# sourceMappingURL=index.prod.js.map