2 lines
238 KiB
JavaScript
2 lines
238 KiB
JavaScript
!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","image_caption_prompt":"Image caption","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":"удалено","image_caption_prompt":"Подпись к фото"},"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":"内容已删除","image_caption_prompt":"图片标题"}}')},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),S=n.n(a),o=n(3),r=n.n(o),k=n(1),i=n(4),s=n(5),l=(n(6),n(2)),C=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,S.a.PureComponent),u((m=g).prototype,[{key:"render",value:function(){return this.props.visible?S.a.createElement("div",{className:"alert-container"},S.a.createElement("div",{className:"alert"},S.a.createElement("div",{className:"title"},this.props.title),S.a.createElement("div",{className:"content"},this.props.content),S.a.createElement("div",{className:"dialog-buttons"},this.props.onReject?S.a.createElement("button",{className:"outline",onClick:this.props.onReject},this.props.reject||S.a.createElement(k.FormattedMessage,{id:"button_cancel"})):null,S.a.createElement("button",{className:"blue",onClick:this.props.onConfirm},this.props.confirm||S.a.createElement(k.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",v={hosted:"web.tinode.co",local:"localhost:6060"},_=v.hosted,w="JRWPS",E=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,P,T,j=(O=N,T=[{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)}}],(P=null)&&M(O.prototype,P),T&&M(O,T),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(k.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,S.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?S.a.createElement("li",{className:"separator",key:n}):S.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 S.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(k.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 K(e){return(K="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 z(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 G(e,t){return!t||"object"!==K(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)}($,S.a.PureComponent),z((Q=$).prototype,[{key:"render",value:function(){var e;if(!0===this.props.avatar){var t="grp"==C.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=S.a.createElement("div",{className:o},S.a.createElement("div",null,a))}else{var r="material-icons "+n;e=t?S.a.createElement("i",{className:r},"group"):S.a.createElement("i",{className:r},"person")}}else e=this.props.avatar?S.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&&z(Q,X),$);function $(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,$),G(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)>E&&(a="image/jpeg"),"image/jpeg"==a)for(;ce(o.length)>E&&.45<r;)o=t.toDataURL(a,r),r*=.84;ce(o.length)>E?d("The image size "+bytesToHumanSize(ce(o.length))+" exceeds the "+bytesToHumanSize(E)+" 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,S.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 S.a.createElement("div",{className:"avatar-upload"},this.props.readOnly||!this.state.dataUrl?null:S.a.createElement("a",{href:"#",className:"clear-avatar",onClick:function(e){e.preventDefault(),t.props.onImageChanged(null)}},S.a.createElement("i",{className:"material-icons"},"clear")),this.state.dataUrl?S.a.createElement("img",{src:this.state.dataUrl,className:"preview"}):this.props.readOnly&&this.props.uid?S.a.createElement("div",{className:"avatar-box"},S.a.createElement(Z,{avatar:!0,topic:this.props.uid,title:this.props.title})):S.a.createElement("div",{className:"blank"},128,"×",128),this.props.readOnly?null:S.a.createElement("input",{type:"file",id:e,className:"inputfile hidden",accept:"image/*",onChange:this.handleFileUpload}),this.props.readOnly?null:S.a.createElement("label",{htmlFor:e,className:"round"},S.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,S.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?S.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box"):S.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box_outline_blank"):this.props.checked?S.a.createElement("i",{className:"material-icons"},"check_box"):S.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 Pe(e){return(Pe="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 Te(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"!==Pe(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,S.a.PureComponent),Te((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(S.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(S.a.createElement("span",{className:t,key:e.key||e.name},e.name))}}),S.a.createElement(S.a.Fragment,null,n)):null}}]),Ue&&Te(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,Ke=(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)}(ze,S.a.PureComponent),Le((Be=ze).prototype,[{key:"render",value:function(){return 0<this.props.count?S.a.createElement("span",{className:"unread"},9<this.props.count?"9+":this.props.count):null}}]),Ve&&Le(Be,Ve),ze);function ze(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ze),qe(this,He(ze).apply(this,arguments))}function Ge(e){return(Ge="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,S.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=S.a.createElement("i",null,S.a.createElement(k.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"})),S.a.createElement("li",{className:!this.props.showCheckmark&&this.props.selected?"selected":null,onClick:this.handleClick},S.a.createElement("div",{className:"avatar-box"},S.a.createElement(Z,{avatar:n,title:this.props.title,topic:this.props.item}),this.props.showOnline?S.a.createElement("span",{className:t}):this.props.showCheckmark&&this.props.selected?S.a.createElement("i",{className:"checkmark material-icons"},"check_circle"):null),S.a.createElement("div",{className:"text-box"},S.a.createElement("div",null,S.a.createElement("span",{className:"contact-title"},e),S.a.createElement(Ke,{count:this.props.unread}),S.a.createElement(De,{badges:o})),this.props.comment?S.a.createElement("div",{className:"contact-comment"},this.props.comment):null,S.a.createElement("span",null,S.a.createElement(De,{badges:a}))),this.props.showContextMenu?S.a.createElement("span",{className:"menuTrigger"},S.a.createElement("a",{href:"#",onClick:this.handleContextClick},S.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"!==Ge(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,S.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 S.a.createElement("li",{onClick:this.handleClick,className:"action"},S.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(k.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(k.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,S.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(S.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(S.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),S.a.createElement("div",{className:this.props.noScroll?null:"scrollable-panel"},0==u?S.a.createElement("div",{className:"center-medium-text",dangerouslySetInnerHTML:{__html:this.props.emptyListMessage}}):null,0<c.length?S.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(k.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 Pt,Tt,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,S.a.PureComponent),kt((Pt=Nt).prototype,[{key:"render",value:function(){var t=this;return S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onCancel()}},S.a.createElement("i",{className:"material-icons"},"close"))}}]),Tt&&kt(Pt,Tt),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,S.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 S.a.createElement("div",{className:n},S.a.createElement("div",{className:"icon"},S.a.createElement("i",{className:"material-icons"},e)),S.a.createElement("span",null,S.a.createElement("span",{dangerouslySetInnerHTML:{__html:this.props.text}}),this.props.action?S.a.createElement(S.a.Fragment,null,S.a.createElement("a",{href:"#",style:{whiteSpace:"nowrap"},onClick:function(e){e.preventDefault(),t.props.action()}},this.props.actionText)):null),S.a.createElement("div",{className:"cancel"},S.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 Kt(e,t){return(Kt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var zt,Gt,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&&Kt(e,t)}(Yt,S.a.PureComponent),Wt((zt=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 S.a.createElement("div",{className:t},this.props.noAvatar?S.a.createElement("span",{className:"spacer"}):S.a.createElement("div",{className:"avatar-box"},S.a.createElement(Z,{avatar:this.props.avatar||!0,topic:this.props.topic,title:this.props.title})),S.a.createElement("span",null,e),this.props.onCancel&&!this.props.required?S.a.createElement("a",{href:"#",onClick:this.handleCancel},"×"):S.a.createElement("span",{className:"spacer"}))}}]),Gt&&Wt(zt,Gt),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,S.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(S.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 S.a.createElement("div",{className:e},n,S.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(k.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,S.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,S.a.createElement("div",{id:"group-manager"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"title_group_members",defaultMessage:"Group Members"}))),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(on,{chips:this.state.members,staticMembers:this.state.staticMembers,prompt:"add members",filterFunc:this.handleContactFilter,onChipRemoved:this.handleMemberRemoved})),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"title_all_contacts",defaultMessage:"All Contacts"}))),S.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}),S.a.createElement("div",{id:"group-manager-buttons",className:"panel-form-row"},S.a.createElement("button",{className:"blue",onClick:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"button_ok",defaultMessage:"OK"})),S.a.createElement("button",{className:"white",onClick:this.handleCancel},S.a.createElement(k.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(k.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,S.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 S.a.createElement("div",{tabIndex:"-1",className:"group-focus",onBlur:this.handleEditingFinished},S.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}),S.a.createElement("span",{onClick:this.handleVisibility},S.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 Pn(e){return(Pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Tn(e,t){for(var n=0;n<t.length;n++){var 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,S.a.Component),Tn((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?S.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}):S.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}):S.a.createElement("span",{className:n,onClick:this.handleStartEditing},S.a.createElement("span",{className:"content"},t))}}]),Un&&Tn(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"!==Pn(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)}(Kn,S.a.PureComponent),In((Wn=Kn).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 S.a.createElement("label",{className:"small clean-clickable",onClick:this.handleToggle},this.props.title,"...",this.state.open?S.a.createElement("i",{className:"material-icons"},"expand_more"):S.a.createElement("i",{className:"material-icons"},"chevron_right"))}}]),Bn&&In(Wn,Bn),Kn);function Kn(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Kn),n=this,(t=!(a=Ln(Kn).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 zn(e){return(zn="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 Gn(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(k.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,S.a.Component),Gn((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(S.a.createElement("tr",{key:l},S.a.createElement("td",null,n[l]),S.a.createElement("td",{className:"checkbox"},a.indexOf(l)<0?S.a.createElement(Me,{name:l,checked:0<=o.indexOf(l),onChange:this.handleChange}):S.a.createElement(Me,{name:l,checked:0<=o.indexOf(l)})),this.props.compare?S.a.createElement("td",{className:"checkbox"},S.a.createElement(Me,{name:l,checked:0<=r.indexOf(l)})):null))}return S.a.createElement("div",{className:"panel-form-column"},this.props.userTitle?S.a.createElement("ul",{className:"contact-box"},S.a.createElement(et,{item:this.props.item,title:this.props.userTitle,avatar:ne(this.props.userAvatar?this.props.userAvatar:null)})):null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"title_permissions",defaultMessage:"Permissions"})),S.a.createElement("table",{className:"permission-editor"},this.props.compare?S.a.createElement("thead",null,S.a.createElement("tr",null,S.a.createElement("th",null),S.a.createElement("th",null,this.props.modeTitle),S.a.createElement("th",null,this.props.compareTitle))):null,S.a.createElement("tbody",null,i)),S.a.createElement("br",null),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:"outline",onClick:this.handleCancel},S.a.createElement(k.FormattedMessage,{id:"button_cancel"})),S.a.createElement("button",{className:"blue",onClick:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"button_ok"}))))}}]),Zn&&Gn(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"!==zn(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(k.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,S.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(S.a.createElement("span",{className:"badge",key:n.length},e))}),0==n.length&&(n=S.a.createElement("i",null,S.a.createElement(k.FormattedMessage,{id:"tags_not_found",defaultMessage:"No tags defined. Add some."})))),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},this.props.title)),this.state.activated?S.a.createElement("div",null,S.a.createElement(k.FormattedMessage,{id:"tags_editor_no_tags",defaultMessage:"Add some tags"},function(e){return S.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?S.a.createElement("div",{id:"tag-manager-buttons",className:"dialog-buttons panel-form-row"},S.a.createElement("button",{className:"outline",onClick:this.handleCancel},S.a.createElement(k.FormattedMessage,{id:"button_cancel",defautMessage:"Cancel",description:"Rejection button [Cancel]"})),S.a.createElement("button",{className:"blue",onClick:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"button_ok",defautMessage:"OK",description:"Confirmation button [OK]"}))):null):S.a.createElement("div",{className:"quoted"},S.a.createElement("a",{href:"#",className:"flat-button",onClick:function(e){e.preventDefault(),t.setState({activated:!0})}},S.a.createElement("i",{className:"material-icons"},"edit")," ",S.a.createElement(k.FormattedMessage,{id:"title_manage_tags",defaultMessage:"Manage"})),S.a.createElement(S.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(k.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,S.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||C.a.DEL_CHAR))}},{key:"handleImageChanged",value:function(e){this.setState({avatar:e}),this.props.onTopicDescUpdate(this.props.topic,oa(null,e||C.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 S.a.createElement("div",{id:"info-view"},S.a.createElement("div",{className:"caption-panel",id:"info-caption-panel"},S.a.createElement("div",{className:"panel-title",id:"info-title"},S.a.createElement(k.FormattedMessage,{id:"title_info",defaultMessage:"Info"})),S.a.createElement("div",null,S.a.createElement(jt,{onCancel:this.props.onCancel}))),this.props.displayMobile?S.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,this.state.showMemberPanel?S.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?S.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}):S.a.createElement("div",{id:"info-view-content",className:"scrollable-panel"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_topic_name",defaultMessage:"Name"}))),S.a.createElement("div",null,S.a.createElement(xn,{placeholder:this.state.groupTopic?"Group name":S.a.createElement("i",null,"Unknown"),readOnly:!this.state.owner,value:this.state.fullName,required:!0,onFinished:this.handleFullNameUpdate})),S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_private",defaultMessage:"Private comment"}))),S.a.createElement("div",null,S.a.createElement(k.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:"Visible to you only"},function(e){return S.a.createElement(xn,{placeholder:e,value:t.state.private,onFinished:t.handlePrivateUpdate})}))),S.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})),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",null,S.a.createElement(k.FormattedMessage,{id:"label_muting_topic",defaultMessage:"Muted:"})),S.a.createElement(Me,{name:"P",checked:this.state.muted,onChange:this.handleMuted})),S.a.createElement(k.FormattedMessage,{id:"action_more",defaultMessage:"More"},function(e){return S.a.createElement(Vn,{title:e,open:t.state.moreInfoExpanded,onToggle:t.handleMoreInfo})}),this.state.moreInfoExpanded?S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",null,S.a.createElement(k.FormattedMessage,{id:"label_user_id"})),S.a.createElement("tt",null,this.state.address)),this.state.groupTopic?S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",null,S.a.createElement(k.FormattedMessage,{id:"label_your_permissions",defaultMessage:"Your permissions:"})),S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)):S.a.createElement("div",null,S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_permissions",defaultMessage:"Permissions:"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("div",null,S.a.createElement(k.FormattedMessage,{id:"label_you",defaultMessage:"You:"})," ",S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)),S.a.createElement("div",null,this.state.fullName?this.state.fullName:e(Sa.other_user),": ",S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"given")},this.state.modeGiven2)))),this.state.sharer&&(this.state.auth||this.state.anon)?S.a.createElement("div",null,S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_default_access",defaultMessage:"Default access mode:"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("div",null,"Auth: ",this.state.admin?S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth):S.a.createElement("tt",null,this.state.auth)),S.a.createElement("div",null,"Anon: ",this.state.admin?S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon):S.a.createElement("tt",null,this.state.anon)))):null):null),S.a.createElement("div",{className:"hr"}),this.state.owner?S.a.createElement(S.a.Fragment,null,S.a.createElement(k.FormattedMessage,{id:"title_tag_manager"},function(e){return S.a.createElement(ma,{title:e,tags:t.state.tags,activated:!1,onSubmit:t.handleTagsUpdated})}),S.a.createElement("div",{className:"hr"})):null,S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("a",{href:"#",className:"flat-button",onClick:this.handleDeleteMessages},S.a.createElement("i",{className:"material-icons"},"delete_outline")," ",e(this.state.deleter?Sa.delete_messages:Sa.clear_messages)),S.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleLeave},S.a.createElement("i",{className:"material-icons"},"exit_to_app")," ",e(Sa.leave_chat)),this.state.groupTopic?null:S.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleBlock},S.a.createElement("i",{className:"material-icons"},"block")," ",e(Sa.block_contact)),this.state.owner?null:S.a.createElement("a",{href:"#",className:"red flat-button",onClick:this.handleReport},S.a.createElement("i",{className:"material-icons"},"report")," ",e(Sa.report_chat))),this.state.groupTopic?S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_group_members",defaultMessage:"Group members:"}))),S.a.createElement("div",{className:"panel-form-row"},this.state.sharer?S.a.createElement("a",{href:"#",className:"flat-button",onClick:this.handleShowAddMembers},S.a.createElement("i",{className:"material-icons"},"person_add")," ",S.a.createElement(k.FormattedMessage,{id:"button_add_members",defaultMessage:"Add members"})):null),S.a.createElement(k.FormattedMessage,{id:"group_has_no_members",defaultMessage:"No members"},function(e){return S.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(k.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 Pa(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 Ta(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,S.a.PureComponent),Pa((Aa=xa).prototype,[{key:"render",value:function(){var t=this;return S.a.createElement("div",{className:"uploader"},S.a.createElement("div",null,S.a.createElement("span",{style:{width:100*this.props.progress+"%"}})),this.props.progress<.999?S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onCancel()}},S.a.createElement("i",{className:"material-icons"},"close")," ",S.a.createElement(k.FormattedMessage,{id:"action_cancel",defaultMessage:"cancel"})):S.a.createElement(k.FormattedMessage,{id:"upload_finishing",defaultMessage:"finishing..."}))}}]),Fa&&Pa(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),Ta(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,S.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?S.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)}),S.a.createElement("div",{className:"attachment"},S.a.createElement("div",null,S.a.createElement("i",{className:"material-icons big gray"},"insert_drive_file")),S.a.createElement("div",{className:"flex-column"},S.a.createElement("div",null,e," ",r),this.props.uploader||this.state.downloader?S.a.createElement(Ua,{progress:this.props.uploader?this.props.progress:this.state.progress,onCancel:this.handleCancel}):S.a.createElement("div",null,S.a.createElement("a",{href:n,download:this.props.filename,onClick:a},S.a.createElement("i",{className:"material-icons"},"file_download")," ",S.a.createElement(k.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 Ka(e){return(Ka="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function za(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 Ga(e,t){return!t||"object"!==Ka(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(k.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,S.a.PureComponent),za((Qa=eo).prototype,[{key:"render",value:function(){var e,t=this.props.intl.formatMessage;e=this.props.received<=C.a.MESSAGE_STATUS_SENDING?t(Za.sending):this.props.received==C.a.MESSAGE_STATUS_FAILED?t(Za.failed):B(this.props.timestamp,this.props.intl.locale);var n=null;return this.props.received<=C.a.MESSAGE_STATUS_SENDING?n=S.a.createElement("i",{className:"material-icons small"},"access_time"):this.props.received==C.a.MESSAGE_STATUS_FAILED?n=S.a.createElement("i",{className:"material-icons small amber"},"warning"):this.props.received==C.a.MESSAGE_STATUS_SENT?n=S.a.createElement("i",{className:"material-icons small"},"done"):this.props.received==C.a.MESSAGE_STATUS_RECEIVED?n=S.a.createElement("i",{className:"material-icons small"},"done_all"):this.props.received==C.a.MESSAGE_STATUS_READ&&(n=S.a.createElement("i",{className:"material-icons small blue"},"done_all")),S.a.createElement("span",{className:"timestamp"},e," ",n)}}]),Xa&&za(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),Ga(this,Ja(eo).apply(this,arguments))}var to=Object(k.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,S.a.Component),ao((so=uo).prototype,[{key:"handleImagePreview",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(S.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=S.a.createElement("span",null,l.Drafty.format(r,po,this))):this.props.deleted?r=S.a.createElement(S.a.Fragment,null,S.a.createElement("i",{className:"material-icons gray"},"block")," ",S.a.createElement("i",{className:"gray"},S.a.createElement(k.FormattedMessage,{id:"deleted_content",defaultMessage:"content deleted"}))):"string"!=typeof r&&(r=S.a.createElement(S.a.Fragment,null,S.a.createElement("i",{className:"material-icons gray"},"error_outline")," ",S.a.createElement("i",{className:"gray"},S.a.createElement(k.FormattedMessage,{id:"invalid_content",defaultMessage:"invalid content"})))),S.a.createElement("li",{className:e},this.props.userFrom&&this.props.response?S.a.createElement("div",{className:"avatar-box"},o?S.a.createElement(Z,{topic:this.props.userFrom,title:this.props.userName,avatar:a}):null):null,S.a.createElement("div",null,S.a.createElement("div",{className:n},S.a.createElement("div",{className:"message-content"},r,i,this.props.timestamp?S.a.createElement(to,{timestamp:this.props.timestamp,received:this.props.received}):null),this.props.deleted?null:S.a.createElement("span",{className:"menuTrigger"},S.a.createElement("a",{href:"#",onClick:this.handleContextClick},S.a.createElement("i",{className:"material-icons"},"expand_more")))),o?S.a.createElement("div",{className:"author"},S.a.createElement(k.FormattedMessage,{id:"user_not_found",defaultMessage:"Not found"},function(e){return t.props.userName||S.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.handleImagePreview=t.handleImagePreview.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.handleImagePreview,r.className+=" image-clickable"):r.src="img/broken_image.png"}break;case"BN":r.onClick=this.handleFormButtonClick;var s=S.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 S.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){return(fo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function bo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function go(e,t){return(go=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yo,vo,_o=Object(k.defineMessages)({messaging_disabled:{id:"messaging_disabled_prompt",defaultMessage:"Messaging disabled"},type_new_message:{id:"new_message_prompt",defaultMessage:"New message"},add_image_caption:{id:"image_caption_prompt",defaultMessage:"Image caption"},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."}}),wo=(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)}(Eo,S.a.PureComponent),mo((yo=Eo).prototype,[{key:"componentDidMount",value:function(){this.messageEditArea&&this.messageEditArea.addEventListener("paste",this.handlePasteEvent,!1)}},{key:"componentWillUnmount",value:function(){this.messageEditArea&&this.messageEditArea.removeEventListener("paste",this.handlePasteEvent,!1)}},{key:"componentDidUpdate",value:function(){this.messageEditArea&&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>E||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){e.target.files&&0<e.target.files.length&&this.props.onAttachImage(e.target.files[0]),e.target.value=""}},{key:"handleAttachFile",value:function(e){this.props.intl.formatMessage,e.target.files&&0<e.target.files.length&&this.props.onAttachFile(e.target.files[0]),e.target.value=""}},{key:"handleSend",value:function(e){e.preventDefault();var t=this.state.message.trim();(t||this.props.acceptBlank||this.props.noInput)&&(this.props.onSendMessage(t),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};if(this.props.onKeyPress){var n=(new Date).getTime();3e3<n-this.state.keypressTimestamp&&(this.props.onKeyPress(),t.keypressTimestamp=n)}this.setState(t)}},{key:"render",value:function(){var t=this,e=this.props.intl.formatMessage,n=this.props.disabled?e(_o.messaging_disabled):this.props.messagePrompt?e(_o[this.props.messagePrompt]):e(_o.type_new_message);return S.a.createElement("div",{id:"send-message-panel"},this.props.onAttachFile?this.props.disabled?S.a.createElement(S.a.Fragment,null,S.a.createElement("i",{className:"material-icons disabled"},"photo"),S.a.createElement("i",{className:"material-icons disabled"},"attach_file")):S.a.createElement(S.a.Fragment,null,S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.attachImage.click()},title:"Add image"},S.a.createElement("i",{className:"material-icons secondary"},"photo")),S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.attachFile.click()},title:"Attach file"},S.a.createElement("i",{className:"material-icons secondary"},"attach_file"))):null,this.props.noInput?S.a.createElement("div",{className:"hr thin"}):S.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?S.a.createElement("i",{className:"material-icons disabled"},"send"):S.a.createElement("a",{href:"#",onClick:this.handleSend,title:"Send"},S.a.createElement("i",{className:"material-icons"},"send")),S.a.createElement("input",{type:"file",ref:function(e){t.attachFile=e},onChange:this.handleAttachFile,style:{display:"none"}}),S.a.createElement("input",{type:"file",ref:function(e){t.attachImage=e},accept:"image/*",onChange:this.handleAttachImage,style:{display:"none"}}))}}]),vo&&mo(yo,vo),Eo);function Eo(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Eo),n=this,(t=!(a=fo(Eo).call(this,e))||"object"!==ho(a)&&"function"!=typeof a?bo(n):a).state={message:"",keypressTimestamp:(new Date).getTime()-3e3-1},t.handlePasteEvent=t.handlePasteEvent.bind(bo(t)),t.handleAttachImage=t.handleAttachImage.bind(bo(t)),t.handleAttachFile=t.handleAttachFile.bind(bo(t)),t.handleSend=t.handleSend.bind(bo(t)),t.handleKeyPress=t.handleKeyPress.bind(bo(t)),t.handleMessageTyping=t.handleMessageTyping.bind(bo(t)),t}var So=Object(k.injectIntl)(wo);function ko(e){return(ko="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 Co(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 Mo(e){return(Mo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Po(e,t){return(Po=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var To,jo,No=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Po(e,t)}(Ao,S.a.PureComponent),Co((To=Ao).prototype,[{key:"handleSendDoc",value:function(){this.props.onClose(),this.props.onSendMessage(this.props.content.file)}},{key:"render",value:function(){var e,t,n=this;return this.props.content?S.a.createElement("div",{id:"image-preview"},S.a.createElement("div",{id:"image-preview-caption-panel"},S.a.createElement("span",null,this.props.content.filename),S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.props.onClose()}},S.a.createElement("i",{className:"material-icons gray"},"close"))),S.a.createElement("div",{id:"image-preview-container"},S.a.createElement("div",{className:"flex-column narrow"},S.a.createElement("i",{className:"material-icons gray"},(e=this.props.content.type,(t={default:"insert_drive_file",image:"image",text:"description",video:"theaters"})[e]||t[(e||"").split("/")[0]]||t.default)),S.a.createElement("div",null,S.a.createElement("b",null,S.a.createElement(k.FormattedMessage,{id:"label_content_type"}))," ",this.props.content.type||"application/octet-stream"),S.a.createElement("div",null,S.a.createElement("b",null,S.a.createElement(k.FormattedMessage,{id:"label_size"}))," ",V(this.props.content.size)))),S.a.createElement(So,{noInput:!0,onSendMessage:this.handleSendDoc,onError:this.props.onError})):null}}]),jo&&Co(To,jo),Ao);function Ao(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ao),n=this,(t=!(a=Mo(Ao).call(this,e))||"object"!==ko(a)&&"function"!=typeof a?Oo(n):a).handleSendDoc=t.handleSendDoc.bind(Oo(t)),t}function Fo(e){return(Fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uo(e,t){for(var n=0;n<t.length;n++){var 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"!==Fo(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 Do(e){return(Do=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ro(e,t){return(Ro=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Io,Lo,qo=(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&&Ro(e,t)}(Ho,S.a.Component),Uo((Io=Ho).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(S.a.createElement("div",{className:"avatar-box",key:e.user},S.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}),S.a.createElement("div",{id:"topic-users"},t," ",n<e?S.a.createElement("span",null,S.a.createElement(k.FormattedMessage,{id:"more_online_members",defaultMessage:"+{overflow} more",values:{overflow:e-n}})):null)}}]),Lo&&Uo(Io,Lo),Ho);function Ho(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ho),xo(this,Do(Ho).call(this,e))}function Wo(e){return(Wo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Bo(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Vo(e){return(Vo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ko(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zo(e,t){return(zo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Go,Jo,Yo=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zo(e,t)}(Qo,S.a.PureComponent),Bo((Go=Qo).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:"handleSendImage",value:function(e){this.props.onClose(),this.props.onSendMessage(e,this.props.content.type,this.props.content.bits,this.props.content.width,this.props.content.height,this.props.content.filename)}},{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 S.a.createElement("div",{id:"image-preview"},S.a.createElement("div",{id:"image-preview-caption-panel"},this.props.onSendMessage?S.a.createElement("span",null,this.props.content.filename):S.a.createElement("a",{href:this.props.content.url,download:this.props.content.filename},S.a.createElement("i",{className:"material-icons"},"file_download")," ",S.a.createElement(k.FormattedMessage,{id:"download_action",defaultMessage:"download"})),S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onClose()}},S.a.createElement("i",{className:"material-icons gray"},"close"))),S.a.createElement("div",{id:"image-preview-container",ref:function(e){return t.assignWidth(e)}},S.a.createElement("img",{src:this.props.content.url,style:n})),this.props.onSendMessage?S.a.createElement(So,{messagePrompt:"add_image_caption",acceptBlank:!0,onSendMessage:this.handleSendImage,onError:this.props.onError}):S.a.createElement("div",{id:"image-preview-footer"},S.a.createElement("div",null,S.a.createElement("div",null,S.a.createElement("b",null,S.a.createElement(k.FormattedMessage,{id:"label_file_name",defaultMessage:"File name:"}))),S.a.createElement("div",null,S.a.createElement("span",{title:this.props.content.filename},a||"-"))),S.a.createElement("div",null,S.a.createElement("div",null,S.a.createElement("b",null,S.a.createElement(k.FormattedMessage,{id:"label_content_type",defaultMessage:"Content type:"}))),S.a.createElement("div",null,this.props.content.type)),S.a.createElement("div",null,S.a.createElement("div",null,S.a.createElement("b",null,S.a.createElement(k.FormattedMessage,{id:"label_size",defaultMessage:"Size:"}))),S.a.createElement("div",null,r," × ",i," px; ",V(this.props.content.size)))))}}]),Jo&&Bo(Go,Jo),Qo);function Qo(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Qo),n=this,(t=!(a=Vo(Qo).call(this,e))||"object"!==Wo(a)&&"function"!=typeof a?Ko(n):a).state={width:0,height:0},t.handleSendImage=t.handleSendImage.bind(Ko(t)),t}function Xo(e){return(Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zo(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 $o(e){return($o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tr(e,t){return(tr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var nr,ar,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&&tr(e,t)}(rr,S.a.PureComponent),Zo((nr=rr).prototype,[{key:"handleButtonAction",value:function(e,t){e.preventDefault(),this.props.onAction(t)}},{key:"render",value:function(){var t=this;return S.a.createElement("div",{className:"accept-invite-panel"},S.a.createElement("div",{className:"title"},S.a.createElement(k.FormattedMessage,{id:"chat_invitation",defaultMessage:"You are invited to start a new chat. What would you like to do?"})),S.a.createElement("div",{className:"footer"},S.a.createElement("button",{className:"blue",onClick:function(e){t.handleButtonAction(e,"accept")}},S.a.createElement(k.FormattedMessage,{id:"chat_invitation_accept",defaultMessage:"Accept"})),S.a.createElement("button",{className:"white",onClick:function(e){t.handleButtonAction(e,"delete")}},S.a.createElement(k.FormattedMessage,{id:"chat_invitation_ignore",defaultMessage:"Ignore"})),S.a.createElement("button",{className:"white",onClick:function(e){t.handleButtonAction(e,"block")}},S.a.createElement(k.FormattedMessage,{id:"chat_invitation_block",defaultMessage:"Block"}))))}}]),ar&&Zo(nr,ar),rr);function rr(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,rr),n=this,(t=!(a=$o(rr).call(this,e))||"object"!==Xo(a)&&"function"!=typeof a?er(n):a).handleButtonAction=t.handleButtonAction.bind(er(t)),t}function ir(e){return(ir="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 sr(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 lr(e,t){return!t||"object"!==ir(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 cr(e){return(cr=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 dr,pr,hr=(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)}(mr,S.a.PureComponent),sr((dr=mr).prototype,[{key:"render",value:function(){return this.props.show?S.a.createElement("div",{className:"load-spinner-box"},S.a.createElement("div",{className:"loader-spinner"})):null}}]),pr&&sr(dr,pr),mr);function mr(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,mr),lr(this,cr(mr).apply(this,arguments))}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,t){return!t||"object"!==fr(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 yr(e){return(yr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var _r,wr,Er=(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)}(Sr,S.a.PureComponent),br((_r=Sr).prototype,[{key:"render",value:function(){var e=y+" ("+C.a.getLibrary()+")";return S.a.createElement("div",{id:"dummy-view",className:this.props.hideSelf?"nodisplay":null},S.a.createElement("div",null,S.a.createElement("a",{href:"https://github.com/tinode/chat/"},S.a.createElement("img",{id:"logo",alt:"logo",src:"img/logo.svg"}),S.a.createElement("h2",null,"Tinode Web")),S.a.createElement("p",null,S.a.createElement(k.FormattedMessage,{id:"label_client",defaultMessage:"Client:"})," ",e),S.a.createElement("p",null,S.a.createElement(k.FormattedMessage,{id:"label_server",defaultMessage:"Server:"})," ",this.props.serverVersion," (",this.props.serverAddress,")")))}}]),wr&&br(_r,wr),Sr);function Sr(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Sr),gr(this,yr(Sr).apply(this,arguments))}function kr(e){return(kr="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 Cr(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 Mr(e){return(Mr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e,t){return(Pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Tr=C.a.Drafty,jr=Object(k.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 Nr(e){if(e){var t=e.getExcessive()||"";return e.isJoiner("given")&&(t.includes("R")||t.includes("W"))}return!1}function Ar(e){if(e){var t=e.getMissing()||"";return e.isJoiner("want")&&(t.includes("R")||t.includes("W"))}return!1}var Fr,Ur,xr,Dr=(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&&Pr(e,t)}(Rr,S.a.Component),xr=[{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,docPreview:null,imagePreview:null,imagePostview: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:Ar(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,docPreview:null,imagePreview:null,imagePostview: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)),Nr(t.acs)==!e.unconformed&&(n.unconfirmed=!e.unconformed),!t.connected&&e.onlineSubs&&0<e.onlineSubs.length&&(n.onlineSubs=[]),n}}],Ur=[{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&&!C.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=Rr.getDerivedStateFromProps({},{});t.title=n.props.intl.formatMessage(jr.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:Nr(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:Ar(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)>=C.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:"handleImagePostview",value:function(e){this.setState({imagePostview:e})}},{key:"handleClosePreview",value:function(){this.setState({imagePostview:null,imagePreview:null,docPreview:null})}},{key:"handleFormResponse",value:function(e,t,n){if("pub"==e)this.props.sendMessage(Tr.attachJSON(Tr.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:"sendKeyPress",value:function(){var e=this.props.tinode.getTopic(this.state.topic);e.isSubscribed()&&e.noteKeyPress()}},{key:"sendFileAttachment",value:function(e){var a=this;if(e.size>E){var t=this.props.tinode.getLargeFileHelper();if(!t)return void this.props.onError(formatMessage(jr.cannot_initiate_upload));var n=t.upload(e),o=Tr.attachFile(null,e.type,null,e.name,e.size,n);this.props.sendMessage(o,n,t)}else se(e,function(e,t,n){a.props.sendMessage(Tr.attachFile(null,e,t,n))},this.props.onError)}},{key:"handleAttachFile",value:function(e){e.size>1<<23?this.props.onError(formatMessage(jr.file_attachment_too_large,{size:V(e.size),limit:V(1<<23)}),"err"):this.setState({docPreview:{file:e,filename:e.name,size:e.size,type:e.type}})}},{key:"sendImageAttachment",value:function(e,t,n,a,o,r){var i=Tr.insertImage(null,0,t,n,a,o,r);e&&(i=Tr.appendLineBreak(i),i=Tr.append(i,Tr.init(e))),this.props.sendMessage(i)}},{key:"handleAttachImage",value:function(r){var i=this;r.size>E||ee.indexOf(r.type)<0?re(r,768,768,!1,function(e,t,n,a,o){i.setState({imagePreview:{url:URL.createObjectURL(r),bits:e,filename:o,width:n,height:a,size:e.length,type:t}})},function(e){i.props.onError(e,"err")}):ie(r,function(e,t,n,a,o){i.setState({imagePreview:{url:URL.createObjectURL(r),bits:e,filename:o,width:n,height:a,size:e.length,type:t}})},function(e){i.props.onError(e,"err")})}},{key:"render",value:function(){var e,t=this,n=this.props.intl.formatMessage;if(this.props.hideSelf)e=null;else if(this.state.topic){var a;if(this.state.imagePreview)a=S.a.createElement(Yo,{content:this.state.imagePreview,onClose:this.handleClosePreview,onSendMessage:this.sendImageAttachment});else if(this.state.imagePostview)a=S.a.createElement(Yo,{content:this.state.imagePostview,onClose:this.handleClosePreview});else if(this.state.docPreview)a=S.a.createElement(No,{content:this.state.docPreview,onClose:this.handleClosePreview,onSendMessage:this.sendFileAttachment});else{for(var o=this.props.tinode.getTopic(this.state.topic),r="grp"==o.getType(),i=[],s=null,l=null,c=0;c<this.state.messages.length;c++){var u=this.state.messages[c],d=null;c+1<this.state.messages.length&&(d=this.state.messages[c+1].from);var p="single";u.from==s?p=u.from==d?"middle":"last":u.from==d&&(p="first"),s=u.from;var h=!(u.from==this.props.myUserId),m=o.msgStatus(u),f=void 0,b=void 0,g=void 0;if(r){var y=o.userDesc(u.from);y&&y.public&&(f=y.public.fn,b=ne(y.public.photo)),g=u.from,l="chat-box group"}else l="chat-box";i.push(S.a.createElement(co,{tinode:this.props.tinode,content:u.content,deleted:u.hi,mimeType:u.head?u.head.mime:null,timestamp:u.ts,response:h,seq:u.seq,userFrom:g,userName:f,userAvatar:b,sequence:p,received:m,uploader:u._uploader,viewportWidth:this.props.viewportWidth,showContextMenu:this.handleShowContextMenuMessage,onImagePreview:this.handleImagePostview,onFormResponse:this.handleFormResponse,onError:this.props.onError,key:u.seq}))}var v=null,_=this.props.tinode.getMeTopic().getContact(this.state.topic);_&&"p2p"==C.a.topicType(_.topic)&&(_.online?v=n(jr.online_now):_.seen&&(v=n(jr.last_seen)+": "+B(_.seen.when,this.props.intl.locale)));var w=this.state.avatar||!0,E=this.props.online?"online"+(this.state.typingIndicator?" typing":""):"offline";a=S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{id:"topic-caption-panel",className:"caption-panel"},this.props.displayMobile?S.a.createElement("a",{href:"#",id:"hide-message-view",onClick:function(e){e.preventDefault(),t.props.onHideMessagesView()}},S.a.createElement("i",{className:"material-icons"},"arrow_back")):null,S.a.createElement("div",{className:"avatar-box"},S.a.createElement(Z,{avatar:w,topic:this.state.topic,title:this.state.title}),S.a.createElement("span",{className:E})),S.a.createElement("div",{id:"topic-title-group"},S.a.createElement("div",{id:"topic-title",className:"panel-title"},this.state.title||S.a.createElement("i",null,S.a.createElement(k.FormattedMessage,{id:"unnamed_topic",defaultMessage:"Unnamed"}))),S.a.createElement("div",{id:"topic-last-seen"},v)),r?S.a.createElement(qo,{subscribers:this.state.onlineSubs}):S.a.createElement("div",{id:"topic-users"}),S.a.createElement("div",null,S.a.createElement("a",{href:"#",onClick:this.handleContextClick},S.a.createElement("i",{className:"material-icons"},"more_vert")))),this.props.displayMobile?S.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,S.a.createElement(hr,{show:this.state.fetchingMessages}),S.a.createElement("div",{id:"messages-container"},S.a.createElement("div",{id:"messages-panel",ref:this.handleScrollReference},S.a.createElement("ul",{id:"scroller",className:l},i)),this.state.isReader?null:S.a.createElement("div",{id:"write-only-background"},this.state.readingBlocked?S.a.createElement("div",{id:"write-only-note"},S.a.createElement(k.FormattedMessage,{id:"messages_not_readable",defaultMessage:"no access to messages"})):null)),this.state.peerMessagingDisabled&&!this.state.unconfirmed?S.a.createElement("div",{id:"peer-messaging-disabled-note"},S.a.createElement("i",{className:"material-icons secondary"},"block")," ",S.a.createElement(k.FormattedMessage,{id:"peers_messaging_disabled",defaultMessage:"Peer's messaging is disabled."})," ",S.a.createElement("a",{href:"#",onClick:this.handleEnablePeer},S.a.createElement(k.FormattedMessage,{id:"enable_peers_messaging",defaultMessage:"Enable"})),"."):null,this.state.unconfirmed?S.a.createElement(or,{onAction:this.handleNewChatAcceptance}):S.a.createElement(So,{disabled:!this.state.isWriter,onSendMessage:this.props.sendMessage,onKeyPress:this.sendKeyPress,onAttachFile:this.handleAttachFile,onAttachImage:this.handleAttachImage,onError:this.props.onError}))}e=S.a.createElement("div",{id:"topic-view"},a)}else e=S.a.createElement(Er,{hideSelf:this.props.hideSelf,serverVersion:this.props.serverVersion,serverAddress:this.props.serverAddress});return e}}],Cr((Fr=Rr).prototype,Ur),xr&&Cr(Fr,xr),Rr);function Rr(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Rr),n=this,(t=!(a=Mr(Rr).call(this,e))||"object"!==kr(a)&&"function"!=typeof a?Or(n):a).state=Rr.getDerivedStateFromProps(e,{}),t.leave=t.leave.bind(Or(t)),t.sendImageAttachment=t.sendImageAttachment.bind(Or(t)),t.sendFileAttachment=t.sendFileAttachment.bind(Or(t)),t.sendKeyPress=t.sendKeyPress.bind(Or(t)),t.handleScrollReference=t.handleScrollReference.bind(Or(t)),t.handleScrollEvent=t.handleScrollEvent.bind(Or(t)),t.handleDescChange=t.handleDescChange.bind(Or(t)),t.handleSubsUpdated=t.handleSubsUpdated.bind(Or(t)),t.handleNewMessage=t.handleNewMessage.bind(Or(t)),t.handleAllMessagesReceived=t.handleAllMessagesReceived.bind(Or(t)),t.handleInfoReceipt=t.handleInfoReceipt.bind(Or(t)),t.handleImagePostview=t.handleImagePostview.bind(Or(t)),t.handleClosePreview=t.handleClosePreview.bind(Or(t)),t.handleFormResponse=t.handleFormResponse.bind(Or(t)),t.handleContextClick=t.handleContextClick.bind(Or(t)),t.handleShowContextMenuMessage=t.handleShowContextMenuMessage.bind(Or(t)),t.handleNewChatAcceptance=t.handleNewChatAcceptance.bind(Or(t)),t.handleEnablePeer=t.handleEnablePeer.bind(Or(t)),t.handleAttachFile=t.handleAttachFile.bind(Or(t)),t.handleAttachImage=t.handleAttachImage.bind(Or(t)),t}var Ir=Object(k.injectIntl)(Dr);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,Kr,zr=(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)}(Gr,S.a.PureComponent),qr((Vr=Gr).prototype,[{key:"render",value:function(){var t=this;return S.a.createElement("div",null,S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onNewTopic()}},S.a.createElement("i",{className:"material-icons"},"chat"))," ",S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSettings()}},S.a.createElement("i",{className:"material-icons"},"settings")))}}]),Kr&&qr(Vr,Kr),Gr);function Gr(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Gr),Hr(this,Wr(Gr).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,S.a.PureComponent),Yr(($r=ni).prototype,[{key:"render",value:function(){var t=this;return S.a.createElement("div",null,S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSignUp()}},S.a.createElement("i",{className:"material-icons"},"person_add"))," ",S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),t.props.onSettings()}},S.a.createElement("i",{className:"material-icons"},"settings")))}}]),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,t){return!t||"object"!==ai(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 ii(e){return(ii=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function si(e,t){return(si=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var li,ci,ui=(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)}(di,S.a.PureComponent),oi((li=di).prototype,[{key:"render",value:function(){return S.a.createElement("div",{id:"side-caption-panel",className:"caption-panel"},S.a.createElement("div",{id:"self-avatar",className:"avatar-box"},S.a.createElement(Z,{avatar:this.props.avatar,topic:this.props.myUserId,title:this.props.title})),S.a.createElement("div",{id:"sidepanel-title",className:"panel-title"},this.props.title),"login"===this.props.state?S.a.createElement(ti,{onSignUp:this.props.onSignUp,onSettings:this.props.onSettings}):"contacts"===this.props.state?S.a.createElement(zr,{onNewTopic:this.props.onNewTopic,onSettings:this.props.onSettings}):null,this.props.onCancel?S.a.createElement(jt,{onCancel:this.props.onCancel}):null)}}]),ci&&oi(li,ci),di);function di(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,di),ri(this,ii(di).apply(this,arguments))}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 hi(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 mi(e){return(mi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bi(e,t){return(bi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var gi,yi,vi,_i=Object(k.defineMessages)({archived_contacts_title:{id:"archived_contacts",defaultMessage:"Archived contacts ({count})"}}),wi=(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&&bi(e,t)}(Ei,S.a.Component),vi=[{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:_i.archived_contacts_title,values:{count:o}}),{contactList:n,unreadThreads:a}}}],yi=[{key:"componentDidUpdate",value:function(e,t){if(e.chatList!=this.props.chatList||e.archive!=this.props.archive){var n=Ei.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 S.a.createElement(k.FormattedHTMLMessage,{id:"contacts_not_found",defaultMessage:"You have no chats<br />¯∖_(ツ)_/¯"},function(e){return S.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})})}}],hi((gi=Ei).prototype,yi),vi&&hi(gi,vi),Ei);function Ei(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ei),n=this,(t=!(a=mi(Ei).call(this,e))||"object"!==pi(a)&&"function"!=typeof a?fi(n):a).handleAction=t.handleAction.bind(fi(t)),t.state=Ei.deriveStateFromProps(e),t}function Si(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 ki,Ci,Mi,Oi=(ki=Pi,Mi=[{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)}}],(Ci=null)&&Si(ki.prototype,Ci),Mi&&Si(ki,Mi),Pi);function Pi(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Pi)}function Ti(e){return(Ti="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,S.a.PureComponent),ji((Ui=Ri).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(){Oi.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"),S.a.createElement("form",{className:"panel-form-column",onSubmit:this.handleSubmit},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("div",{className:"panel-form-column"},S.a.createElement(k.FormattedMessage,{id:"login_prompt"},function(e){return S.a.createElement("input",{type:"text",placeholder:e,autoComplete:"user-name",value:t.state.login,onChange:t.handleLoginChange,required:!0,autoFocus:!0})}),S.a.createElement(k.FormattedMessage,{id:"password_prompt"},function(e){return S.a.createElement(Mn,{placeholder:e,autoComplete:"new-password",value:t.state.password,onFinished:t.handlePasswordChange,required:!0})})),S.a.createElement(ge,{onImageChanged:this.handleImageChanged,onError:this.props.onError})),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(k.FormattedMessage,{id:"full_name_prompt",defaultMessage:"Full name, e.g. John Doe"},function(e){return S.a.createElement("input",{type:"text",placeholder:e,autoComplete:"name",value:t.state.fn,onChange:t.handleFnChange,required:!0})})),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(k.FormattedMessage,{id:"email_prompt",defaultMessage:"Email, e.g. jdoe@example.com"},function(e){return S.a.createElement("input",{type:"email",placeholder:e,autoComplete:"email",value:t.state.email,onChange:t.handleEmailChange,required:!0})})),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(Me,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),S.a.createElement(k.FormattedMessage,{id:"stay_logged_in"},function(e){return S.a.createElement("label",{htmlFor:"save-token"}," ",e)})),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:e,type:"submit"},S.a.createElement(k.FormattedMessage,{id:"button_sign_up",defaultMessage:"Sign up"}))))}}]),xi&&ji(Ui,xi),Ri);function Ri(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ri),n=this,(t=!(a=Ni(Ri).call(this,e))||"object"!==Ti(a)&&"function"!=typeof a?Ai(n):a).state={login:"",password:"",email:"",fn:"",imageDataUrl:null,errorCleared:!1,saveToken:Oi.getObject("keep-logged-in")},t.handleLoginChange=t.handleLoginChange.bind(Ai(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Ai(t)),t.handleEmailChange=t.handleEmailChange.bind(Ai(t)),t.handleFnChange=t.handleFnChange.bind(Ai(t)),t.handleImageChanged=t.handleImageChanged.bind(Ai(t)),t.handleToggleSaveToken=t.handleToggleSaveToken.bind(Ai(t)),t.handleSubmit=t.handleSubmit.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,Ki=(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)}(zi,S.a.Component),Li((Bi=zi).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||C.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(S.a.createElement("div",{key:t.meth+":"+t.val+":"+t.done},t.meth,": ",S.a.createElement("tt",null,t.val),S.a.createElement("span",null," ",t.done?null:S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.props.onCredConfirm(t.meth,t.val)}},S.a.createElement(k.FormattedMessage,{id:"validate_credential_action",defaultMessage:"confirm"}))," ",S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.props.onCredDelete(t.meth,t.val)}},S.a.createElement("i",{className:"material-icons gray"},"delete_outline")))))}),S.a.createElement(S.a.Fragment,null,this.state.showPermissionEditorFor?S.a.createElement(na,{mode:this.state.editedPermissions,skip:"O",onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):S.a.createElement("div",{id:"edit-account",className:"scrollable-panel"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_your_name",defaultMessage:"Your name"}))),S.a.createElement("div",null,S.a.createElement(k.FormattedMessage,{id:"full_name_prompt"},function(e){return S.a.createElement(xn,{placeholder:e,value:n.state.fullName,onFinished:n.handleFullNameUpdate})})),S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_password",defaultMessage:"Password"}))),S.a.createElement("div",null,S.a.createElement(k.FormattedMessage,{id:"password_unchanged_prompt",defaultMessage:"Unchanged"},function(e){return S.a.createElement(xn,{placeholder:e,type:"password",onFinished:n.handlePasswordUpdate})}))),S.a.createElement(ge,{avatar:this.state.avatar,uid:this.props.myUserId,title:this.state.fullName,onImageChanged:this.handleImageChanged,onError:this.props.onError})),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{htmlFor:"message-sound"},S.a.createElement(k.FormattedMessage,{id:"label_message_sound",defaultMessage:"Message sound:"})),S.a.createElement(Me,{name:"sound",id:"message-sound",checked:this.props.messageSounds,onChange:this.handleCheckboxClick})),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{htmlFor:"desktop-alerts"},this.props.desktopAlertsEnabled?S.a.createElement(k.FormattedMessage,{id:"label_push_notifications",defaultMessage:"Notification alerts:"}):S.a.createElement(k.FormattedMessage,{id:"label_push_notifications_disabled",defaultMessage:"Notification alerts (requires HTTPS):"})),S.a.createElement(Me,{name:"alert",id:"desktop-alerts",checked:this.props.desktopAlerts,onChange:this.props.desktopAlertsEnabled?this.handleCheckboxClick:null})),S.a.createElement("div",{className:"hr"}),S.a.createElement(k.FormattedMessage,{id:"title_tag_manager",defaultMessage:"Tags (user discovery)"},function(e){return S.a.createElement(ma,{title:e,activated:!1,tags:n.state.tags,onSubmit:n.handleTagsUpdated})}),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_user_contacts",defaultMessage:"Contacts:"}))),S.a.createElement("div",{className:"quoted"},e,this.state.addCredActive?S.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,S.a.createElement("div",null,S.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n.setState({addCredActive:!0})}},"+ Add another")))),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_user_id",defaultMessage:"Address:"})),S.a.createElement("tt",null,this.props.myUserId)),S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_default_access_mode",defaultMessage:"Default access mode:"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("div",null,"Auth: ",S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth)),S.a.createElement("div",null,"Anon: ",S.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon)))),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("a",{href:"#",className:"red flat-button",onClick:function(e){e.preventDefault(),n.props.onLogout()}},S.a.createElement("i",{className:"material-icons"},"exit_to_app")," ",S.a.createElement(k.FormattedMessage,{id:"button_logout",defaultMessage:"Logout"}))),S.a.createElement("div",{className:"hr"}),S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("div",null,S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_legal",defaultMessage:"Legal"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("a",{href:"email:info@tinode.co",className:"flat-button",target:"_blank"},S.a.createElement("i",{className:"material-icons"},"email")," ",S.a.createElement(k.FormattedMessage,{id:"link_contact_us",defaultMessage:"Contact Us"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("a",{href:"https://tinode.co/terms.html",className:"flat-button",target:"_blank"},S.a.createElement("i",{className:"material-icons"},"description")," ",S.a.createElement(k.FormattedMessage,{id:"link_terms_of_service",defaultMessage:"Terms of Service"}))),S.a.createElement("div",{className:"quoted"},S.a.createElement("a",{href:"https://tinode.co/privacy.html",className:"flat-button",target:"_blank"},S.a.createElement("i",{className:"material-icons"},"policy")," ",S.a.createElement(k.FormattedMessage,{id:"link_privacy_policy",defaultMessage:"Privacy Policy"}))))))}}]),Vi&&Li(Bi,Vi),zi);function zi(e){var t,n,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,zi),n=this;var o=(t=!(a=qi(zi).call(this,e))||"object"!==Ii(a)&&"function"!=typeof a?Hi(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(Hi(t)),t.tnCredsUpdated=t.tnCredsUpdated.bind(Hi(t)),t.handleFullNameUpdate=t.handleFullNameUpdate.bind(Hi(t)),t.handlePasswordUpdate=t.handlePasswordUpdate.bind(Hi(t)),t.handleImageChanged=t.handleImageChanged.bind(Hi(t)),t.handleCheckboxClick=t.handleCheckboxClick.bind(Hi(t)),t.handleCredChange=t.handleCredChange.bind(Hi(t)),t.handleCredKeyDown=t.handleCredKeyDown.bind(Hi(t)),t.handleCredEntered=t.handleCredEntered.bind(Hi(t)),t.handleLaunchPermissionsEditor=t.handleLaunchPermissionsEditor.bind(Hi(t)),t.handleHidePermissionsEditor=t.handleHidePermissionsEditor.bind(Hi(t)),t.handlePermissionsChanged=t.handlePermissionsChanged.bind(Hi(t)),t.handleTagsUpdated=t.handleTagsUpdated.bind(Hi(t)),t}function Gi(e){return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function 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=(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)}(ts,S.a.Component),Ji((Zi=ts).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(){Oi.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"),S.a.createElement("form",{id:"login-form",onSubmit:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"login_prompt",defaultMessage:"Login"},function(e){return S.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})}),S.a.createElement(k.FormattedMessage,{id:"password_prompt",defaultMessage:"Password"},function(e){return S.a.createElement(Mn,{type:"password",id:"inputPassword",placeholder:e,autoComplete:"current-password",value:t.state.password,onChange:t.handlePasswordChange,required:!0})}),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(Me,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),S.a.createElement("label",{htmlFor:"save-token"}," ",S.a.createElement(k.FormattedMessage,{id:"stay_logged_in",defaultMessage:"Stay logged in"})),S.a.createElement("a",{href:"#reset"},S.a.createElement(k.FormattedMessage,{id:"forgot_password_link",defaultMessage:"Forgot password?"}))),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:e,type:"submit"},S.a.createElement(k.FormattedMessage,{id:"button_sign_in",defaultMessage:"Sign in"}))))}}]),$i&&Ji(Zi,$i),ts);function ts(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ts),n=this,(t=!(a=Yi(ts).call(this,e))||"object"!==Gi(a)&&"function"!=typeof a?Qi(n):a).state={login:e.login,password:"",hostName:e.serverAddress,saveToken:Oi.getObject("keep-logged-in")},t.handleLoginChange=t.handleLoginChange.bind(Qi(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Qi(t)),t.handleToggleSaveToken=t.handleToggleSaveToken.bind(Qi(t)),t.handleSubmit=t.handleSubmit.bind(Qi(t)),t}function ns(e){return(ns="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 as(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 os(e){return(os=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function is(e,t){return(is=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ss,ls,cs=Object(k.defineMessages)({invalid_id:{id:"error_invalid_id",defaultMessage:"Invalid ID"}}),us=(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&&is(e,t)}(ds,S.a.PureComponent),as((ss=ds).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(cs.invalid_id),"err")}}},{key:"render",value:function(){var t=this;return S.a.createElement("div",{className:"panel-form"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(k.FormattedMessage,{id:"group_user_id_prompt",defaultMessage:"Group or User ID"},function(e){return S.a.createElement("input",{type:"text",placeholder:e,value:t.state.groupId,onChange:t.handleChange,onKeyPress:t.handleKeyPress,required:!0})})),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:"blue",onClick:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"button_subscribe",defaultMessage:"Subscribe"}))))}}]),ls&&as(ss,ls),ds);function ds(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ds),n=this,(t=!(a=os(ds).call(this,e))||"object"!==ns(a)&&"function"!=typeof a?rs(n):a).state={groupId:""},t.handleChange=t.handleChange.bind(rs(t)),t.handleKeyPress=t.handleKeyPress.bind(rs(t)),t.handleSubmit=t.handleSubmit.bind(rs(t)),t}var ps=Object(k.injectIntl)(us);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,S.a.PureComponent),ms((ys=ws).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"),S.a.createElement("form",{className:"panel-form",onSubmit:this.handleSubmit},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("div",{className:"panel-form-column"},S.a.createElement("label",{className:"small",htmlFor:"new-topic-fn"},S.a.createElement(k.FormattedMessage,{id:"label_topic_name"})),S.a.createElement(k.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:"Freeform name of the group"},function(e){return S.a.createElement("input",{type:"text",id:"new-topic-fn",placeholder:e,value:t.state.fn,onChange:t.handleFnChange,autoFocus:!0,required:!0})}),S.a.createElement("br",null),S.a.createElement("label",{className:"small",htmlFor:"new-topic-priv"},S.a.createElement(k.FormattedMessage,{id:"label_private"})),S.a.createElement(k.FormattedMessage,{id:"private_editing_placeholder"},function(e){return S.a.createElement("input",{type:"text",id:"new-topic-priv",placeholder:e,value:t.state.private,onChange:t.handlePrivateChange})})),S.a.createElement(ge,{onError:this.props.onError,onImageChanged:this.handleImageChanged})),S.a.createElement(k.FormattedMessage,{id:"title_tag_manager"},function(e){return S.a.createElement(ma,{tags:t.state.tags,activated:!0,onTagsChanged:t.handleTagsChanged,title:e})}),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:e},S.a.createElement(k.FormattedMessage,{id:"button_create",defaultMessage:"Create"}))))}}]),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={fn:"",private:"",imageDataUrl:null,tags:[]},t.handleFnChange=t.handleFnChange.bind(bs(t)),t.handlePrivateChange=t.handlePrivateChange.bind(bs(t)),t.handleImageChanged=t.handleImageChanged.bind(bs(t)),t.handleTagsChanged=t.handleTagsChanged.bind(bs(t)),t.handleTagsChanged=t.handleTagsChanged.bind(bs(t)),t.handleSubmit=t.handleSubmit.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,Ps,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&&Ms(e,t)}(js,S.a.PureComponent),Ss((Os=js).prototype,[{key:"componentWillUnmount",value:function(){this.state.edited&&(this.setState({search:"",edited:!1}),this.props.onSearchContacts(C.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:C.a.DEL_CHAR)}},{key:"handleClear",value:function(e){e.preventDefault(),this.state.edited&&this.props.onSearchContacts(C.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 S.a.createElement("div",{className:"panel-form"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("i",{className:"material-icons search"},"search"),S.a.createElement(k.FormattedMessage,{id:"search_placeholder",defaultMessage:"List like email:alice@example.com, tel:17025550003..."},function(e){return S.a.createElement("input",{className:"search",type:"text",placeholder:e,value:t.state.search,onChange:t.handleSearchChange,onKeyDown:t.handleKeyDown,required:!0,autoFocus:!0})}),S.a.createElement("a",{href:"#",onClick:this.handleClear},S.a.createElement("i",{className:"material-icons"},"close"))))}}]),Ps&&Ss(Os,Ps),js);function js(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,js),n=this,(t=!(a=ks(js).call(this,e))||"object"!==Es(a)&&"function"!=typeof a?Cs(n):a).state={edited:!1,search:""},t.handleSearchChange=t.handleSearchChange.bind(Cs(t)),t.handleSearch=t.handleSearch.bind(Cs(t)),t.handleClear=t.handleClear.bind(Cs(t)),t.handleKeyDown=t.handleKeyDown.bind(Cs(t)),t}function Ns(e){return(Ns="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 As(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 Us(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xs(e,t){return(xs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ds,Rs,Is=Object(k.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"}}),Ls=(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&&xs(e,t)}(qs,S.a.Component),As((Ds=qs).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:C.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?Is.search_no_results:Is.search_for_contacts);return S.a.createElement("div",{className:"flex-column"},S.a.createElement("ul",{className:"tabbar"},S.a.createElement("li",{className:"p2p"===this.state.tabSelected?"active":null},S.a.createElement("a",{href:"#","data-id":"p2p",onClick:this.handleTabClick},S.a.createElement(k.FormattedMessage,{id:"tabtitle_find_user",defaultMessage:"find"}))),S.a.createElement("li",{className:"grp"===this.state.tabSelected?"active":null},S.a.createElement("a",{href:"#","data-id":"grp",onClick:this.handleTabClick},S.a.createElement(k.FormattedMessage,{id:"tabtitle_new_group",defaultMessage:"new group"}))),S.a.createElement("li",{className:"byid"===this.state.tabSelected?"active":null},S.a.createElement("a",{href:"#","data-id":"byid",onClick:this.handleTabClick},S.a.createElement(k.FormattedMessage,{id:"tabtitle_group_by_id",defaultMessage:"by id"})))),"grp"===this.state.tabSelected?S.a.createElement(_s,{onSubmit:this.handleNewGroupSubmit}):"byid"===this.state.tabSelected?S.a.createElement(ps,{onSubmit:this.handleGroupByID,onError:this.props.onError}):S.a.createElement("div",{className:"flex-column"},S.a.createElement(Ts,{type:"p2p",onSearchContacts:this.handleSearchContacts}),S.a.createElement(Et,{contacts:this.props.searchResults,myUserId:this.props.myUserId,emptyListMessage:e,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleContactSelected})))}}]),Rs&&As(Ds,Rs),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=Fs(qs).call(this,e))||"object"!==Ns(a)&&"function"!=typeof a?Us(n):a).state={tabSelected:"p2p",searchQuery:null},t.handleTabClick=t.handleTabClick.bind(Us(t)),t.handleSearchContacts=t.handleSearchContacts.bind(Us(t)),t.handleContactSelected=t.handleContactSelected.bind(Us(t)),t.handleNewGroupSubmit=t.handleNewGroupSubmit.bind(Us(t)),t.handleGroupByID=t.handleGroupByID.bind(Us(t)),t}var Hs=Object(k.injectIntl)(Ls);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 Ks(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zs(e,t){return(zs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Gs,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&&zs(e,t)}(Qs,S.a.PureComponent),Bs((Gs=Qs).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 S.a.createElement("form",{id:"password-reset-form",onSubmit:this.handleSubmit},e?S.a.createElement(k.FormattedMessage,{id:"new_password_placeholder",defaultMessage:"Enter new password"},function(e){return S.a.createElement(Mn,{placeholder:e,autoComplete:"new-password",value:t.state.password,required:!0,autoFocus:!0,onChange:t.handlePasswordChange})}):S.a.createElement(S.a.Fragment,null,S.a.createElement("label",{htmlFor:"inputEmail"},S.a.createElement(k.FormattedMessage,{id:"label_reset_password",defaultMessage:"Send a password reset email:"})),S.a.createElement(k.FormattedMessage,{id:"credential_email_prompt",defaultMessage:"Your registration email"},function(e){return S.a.createElement("input",{type:"email",id:"inputEmail",placeholder:e,autoComplete:"email",value:t.state.email,onChange:t.handleEmailChange,required:!0,autoFocus:!0})})),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:"blue",type:"submit"},e?S.a.createElement(k.FormattedMessage,{id:"button_reset",defaultMessage:"Reset"}):S.a.createElement(k.FormattedMessage,{id:"button_send_request",defaultMessage:"Send request"}))))}}]),Js&&Bs(Gs,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?Ks(n):a).state={email:"",password:""},t.handleSubmit=t.handleSubmit.bind(Ks(t)),t.handleEmailChange=t.handleEmailChange.bind(Ks(t)),t.handlePasswordChange=t.handlePasswordChange.bind(Ks(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,S.a.PureComponent),Zs((nl=rl).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(S.a.createElement("option",{key:n,value:n}))}return S.a.createElement("div",{className:"panel-form-row"},S.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}),S.a.createElement("datalist",{id:"known-hosts"},e))}}]),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={hostName:e.serverAddress,changed:!1},t.handleHostNameChange=t.handleHostNameChange.bind(el(t)),t.handleEditingFinished=t.handleEditingFinished.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=(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)}(ml,S.a.PureComponent),sl((dl=ml).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(S.a.createElement("li",{key:e},S.a.createElement("input",{type:"radio",id:t,name:"transport-select",value:e,checked:r.state.transport===e,onChange:r.handleTransportSelected}),S.a.createElement("label",{htmlFor:t},n)))}),S.a.createElement("form",{id:"settings-form",className:"panel-form",onSubmit:this.handleSubmit},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_server_to_use",defaultMessage:"Server to use:"}))),S.a.createElement(ol,{serverAddress:this.state.serverAddress,onServerAddressChange:this.handleServerAddressChange}),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small"},S.a.createElement(k.FormattedMessage,{id:"label_wire_transport",defaultMessage:"Wire transport:"}))),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("ul",{className:"quoted"},o)),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{type:"submit",className:"blue"},S.a.createElement(k.FormattedMessage,{id:"button_update",defaultMessage:"Update"}))))}}]),pl&&sl(dl,pl),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=ll(ml).call(this,e))||"object"!==il(a)&&"function"!=typeof a?cl(n):a).state={transport:e.transport||"def",serverAddress:e.serverAddress},t.handleSubmit=t.handleSubmit.bind(cl(t)),t.handleTransportSelected=t.handleTransportSelected.bind(cl(t)),t.handleServerAddressChange=t.handleServerAddressChange.bind(cl(t)),t}function fl(e){return(fl="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 bl(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 gl(e){return(gl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vl(e,t){return(vl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var _l,wl,El=Object(k.defineMessages)({phone:{id:"phone_dative",defaultMessage:"phone"},email:{id:"email_dative",defaultMessage:"email"}}),Sl=(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&&vl(e,t)}(kl,S.a.PureComponent),bl((_l=kl).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(El.email),tel:e(El.phone)}[this.props.credMethod]||this.props.credMethod;return S.a.createElement("div",{className:"panel-form"},S.a.createElement("div",{className:"panel-form-row"},S.a.createElement("label",{className:"small",htmlFor:"enter-confirmation-code"},S.a.createElement(k.FormattedMessage,{id:"enter_confirmation_code_prompt",defaultMessage:"Enter confirmation code sent to you by {method}:",values:{method:n}}))),S.a.createElement("div",{className:"panel-form-row"},S.a.createElement(k.FormattedMessage,{id:"numeric_confirmation_code_prompt",defaultMessage:"Numbers only"},function(e){return S.a.createElement("input",{type:"text",id:"enter-confirmation-code",placeholder:e,value:t.state.code,onChange:t.handleChange,onKeyPress:t.handleKeyPress,required:!0})})),S.a.createElement("div",{className:"dialog-buttons"},S.a.createElement("button",{className:"blue",onClick:this.handleSubmit},S.a.createElement(k.FormattedMessage,{id:"button_confirm",defaultMessage:"Confirm"})),S.a.createElement("button",{className:"white",onClick:this.handleCancel},S.a.createElement(k.FormattedMessage,{id:"button_cancel"}))))}}]),wl&&bl(_l,wl),kl);function kl(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,kl),n=this,(t=!(a=gl(kl).call(this,e))||"object"!==fl(a)&&"function"!=typeof a?yl(n):a).state={code:e.credCode||""},t.handleChange=t.handleChange.bind(yl(t)),t.handleKeyPress=t.handleKeyPress.bind(yl(t)),t.handleSubmit=t.handleSubmit.bind(yl(t)),t.handleCancel=t.handleCancel.bind(yl(t)),t}var Cl=Object(k.injectIntl)(Sl);function Ml(e){return(Ml="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 Ol(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 Pl(e){return(Pl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jl(e,t){return(jl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Nl,Al,Fl=Object(k.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"}}),Ul=(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&&jl(e,t)}(xl,S.a.Component),Ol((Nl=xl).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(Fl[o]),!1),-1==["login","contacts"].indexOf(o)&&(n=this.props.onCancel),S.a.createElement("div",{id:"sidepanel",className:this.props.hideSelf?"nodisplay":null},S.a.createElement(ui,{state:o,title:e,avatar:t,myUserId:this.props.myUserId,onSignUp:this.props.onSignUp,onSettings:this.props.onSettings,onNewTopic:this.props.onNewTopic,onCancel:n}),S.a.createElement(Lt,{level:this.props.errorLevel,text:this.props.errorText,action:this.props.errorAction,actionText:this.props.errorActionText,onClearError:this.props.onError}),S.a.createElement(hr,{show:this.props.loadSpinnerVisible}),"login"===o?S.a.createElement(es,{login:this.props.login,disabled:this.props.loginDisabled,onLogin:this.handleLoginRequested}):"register"===o?S.a.createElement(Di,{onCreateAccount:this.props.onCreateAccount,onCancel:this.props.onCancel,onError:this.props.onError}):"settings"===o?S.a.createElement(hl,{transport:this.props.transport,serverAddress:this.props.serverAddress,onCancel:this.props.onCancel,onUpdate:this.props.onGlobalSettings}):"edit"===o?S.a.createElement(Ki,{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?S.a.createElement(wi,{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?S.a.createElement(Hs,{searchResults:this.props.searchResults,onInitFind:this.props.onInitFind,onSearchContacts:this.props.onSearchContacts,onCreateTopic:this.props.onCreateTopic,onError:this.props.onError}):"cred"===o?S.a.createElement(Cl,{credCode:this.props.credCode,credMethod:this.props.credMethod,onSubmit:this.props.onValidateCredentials,onCancel:this.props.onCancel,onError:this.props.onError}):"reset"===o?S.a.createElement(Ys,{onRequest:this.props.onPasswordResetRequest,onReset:this.props.onResetPassword}):null)}}]),Al&&Ol(Nl,Al),xl);function xl(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,xl),n=this,(t=!(a=Pl(xl).call(this,e))||"object"!==Ml(a)&&"function"!=typeof a?Tl(n):a).handleLoginRequested=t.handleLoginRequested.bind(Tl(t)),t}var Dl=Object(k.injectIntl)(Ul);function Rl(e){return(Rl="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 Il(){return"object"==Rl(window.location)&&"https:"==window.location.protocol}function Ll(e){return(Ll="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 ql(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 Hl(e){return(Hl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bl(e,t){return(Bl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Vl,Kl,zl,Gl=new Audio("audio/msg.mp3"),Jl=Object(k.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"}}),Yl=(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&&Bl(e,t)}(Ql,S.a.Component),zl=[{key:"tnSetup",value:function(e,t){var n=new C.a(y,e,"AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K",t,Il());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"==C.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)}}],Kl=[{key:"getBlankState",value:function(){var e,t=Oi.getObject("settings")||{};return{connected:!1,ready:!1,transport:t.transport||null,serverAddress:t.serverAddress||(e=_,"object"==Rl(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:(Il()||"object"==Rl(window.location)&&"localhost"==window.location.hostname)&&void 0!==s&&"undefined"!=typeof navigator&&"undefined"!=typeof FIREBASE_INIT,firebaseToken:Oi.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=Ql.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=Oi.getObject("keep-logged-in")?Oi.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(Jl.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:C.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(Jl.reconnect_countdown,{seconds:a}),"warn",function(){clearInterval(o.reconnectCountdown),o.tinode.reconnect()},r(Jl.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=C.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),Oi.getObject("keep-logged-in")&&Oi.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||Gl.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=Ql.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)>=C.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:Ql.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:C.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=Ql.tnSetup(t,n),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.setState({serverAddress:t,transport:n}),Oi.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}),Oi.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}),Oi.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(){Oi.updateObject("settings",{desktopAlerts:!1}),localStorage.removeItem("firebase-token"),t.setState({desktopAlerts:!1,firebaseToken:null})}):(this.setState({desktopAlerts:!1,firebaseToken:null}),Oi.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),Oi.setObject("firebase-token",e)),t.setState({firebaseToken:e,desktopAlerts:!0}),Oi.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}),Oi.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===C.a.DEL_CHAR?C.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=Ql.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(C.a.TOPIC_SYS,C.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 S.a.createElement("div",{id:"app-container"},this.state.contextMenuVisible?S.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,S.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}),S.a.createElement(Dl,{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}),S.a.createElement(Ir,{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?S.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)}}],ql((Vl=Ql).prototype,Kl),zl&&ql(Vl,zl),Ql);function Ql(e){var t,n,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Ql),n=this,(t=!(a=Hl(Ql).call(this,e))||"object"!==Ll(a)&&"function"!=typeof a?Wl(n):a).state=t.getBlankState(),t.handleResize=t.handleResize.bind(Wl(t)),t.handleHashRoute=t.handleHashRoute.bind(Wl(t)),t.handleOnline=t.handleOnline.bind(Wl(t)),t.checkForAppUpdate=t.checkForAppUpdate.bind(Wl(t)),t.handleAppVisibility=t.handleAppVisibility.bind(Wl(t)),t.handleReadTimer=t.handleReadTimer.bind(Wl(t)),t.handleVisibilityEvent=t.handleVisibilityEvent.bind(Wl(t)),t.handleError=t.handleError.bind(Wl(t)),t.handleLoginRequest=t.handleLoginRequest.bind(Wl(t)),t.handleConnected=t.handleConnected.bind(Wl(t)),t.handleAutoreconnectIteration=t.handleAutoreconnectIteration.bind(Wl(t)),t.doLogin=t.doLogin.bind(Wl(t)),t.handleCredentialsRequest=t.handleCredentialsRequest.bind(Wl(t)),t.handleLoginSuccessful=t.handleLoginSuccessful.bind(Wl(t)),t.handleDisconnect=t.handleDisconnect.bind(Wl(t)),t.tnMeMetaDesc=t.tnMeMetaDesc.bind(Wl(t)),t.tnMeContactUpdate=t.tnMeContactUpdate.bind(Wl(t)),t.tnMeSubsUpdated=t.tnMeSubsUpdated.bind(Wl(t)),t.resetContactList=t.resetContactList.bind(Wl(t)),t.tnData=t.tnData.bind(Wl(t)),t.tnInitFind=t.tnInitFind.bind(Wl(t)),t.tnFndSubsUpdated=t.tnFndSubsUpdated.bind(Wl(t)),t.handleSearchContacts=t.handleSearchContacts.bind(Wl(t)),t.handleTopicSelected=t.handleTopicSelected.bind(Wl(t)),t.handleHideMessagesView=t.handleHideMessagesView.bind(Wl(t)),t.handleSendMessage=t.handleSendMessage.bind(Wl(t)),t.handleNewChatInvitation=t.handleNewChatInvitation.bind(Wl(t)),t.handleNewAccount=t.handleNewAccount.bind(Wl(t)),t.handleNewAccountRequest=t.handleNewAccountRequest.bind(Wl(t)),t.handleUpdateAccountRequest=t.handleUpdateAccountRequest.bind(Wl(t)),t.handleUpdateAccountTagsRequest=t.handleUpdateAccountTagsRequest.bind(Wl(t)),t.handleSettings=t.handleSettings.bind(Wl(t)),t.handleGlobalSettings=t.handleGlobalSettings.bind(Wl(t)),t.handleShowArchive=t.handleShowArchive.bind(Wl(t)),t.handleToggleMessageSounds=t.handleToggleMessageSounds.bind(Wl(t)),t.handleCredAdd=t.handleCredAdd.bind(Wl(t)),t.handleCredDelete=t.handleCredDelete.bind(Wl(t)),t.handleCredConfirm=t.handleCredConfirm.bind(Wl(t)),t.initDesktopAlerts=t.initDesktopAlerts.bind(Wl(t)),t.togglePushToken=t.togglePushToken.bind(Wl(t)),t.requestPushToken=t.requestPushToken.bind(Wl(t)),t.handleSidepanelCancel=t.handleSidepanelCancel.bind(Wl(t)),t.handleNewTopic=t.handleNewTopic.bind(Wl(t)),t.handleNewTopicRequest=t.handleNewTopicRequest.bind(Wl(t)),t.handleNewTopicCreated=t.handleNewTopicCreated.bind(Wl(t)),t.handleTopicUpdateRequest=t.handleTopicUpdateRequest.bind(Wl(t)),t.handleChangePermissions=t.handleChangePermissions.bind(Wl(t)),t.handleTagsUpdated=t.handleTagsUpdated.bind(Wl(t)),t.handleLogout=t.handleLogout.bind(Wl(t)),t.handleDeleteMessagesRequest=t.handleDeleteMessagesRequest.bind(Wl(t)),t.handleLeaveUnsubRequest=t.handleLeaveUnsubRequest.bind(Wl(t)),t.handleBlockTopicRequest=t.handleBlockTopicRequest.bind(Wl(t)),t.handleReportTopic=t.handleReportTopic.bind(Wl(t)),t.handleShowContextMenu=t.handleShowContextMenu.bind(Wl(t)),t.defaultTopicContextMenu=t.defaultTopicContextMenu.bind(Wl(t)),t.handleHideContextMenu=t.handleHideContextMenu.bind(Wl(t)),t.handleShowAlert=t.handleShowAlert.bind(Wl(t)),t.handleShowInfoView=t.handleShowInfoView.bind(Wl(t)),t.handleHideInfoView=t.handleHideInfoView.bind(Wl(t)),t.handleMemberUpdateRequest=t.handleMemberUpdateRequest.bind(Wl(t)),t.handleValidateCredentialsRequest=t.handleValidateCredentialsRequest.bind(Wl(t)),t.handlePasswordResetRequest=t.handlePasswordResetRequest.bind(Wl(t)),t.handleResetPassword=t.handleResetPassword.bind(Wl(t)),t.handleContextMenuAction=t.handleContextMenuAction.bind(Wl(t)),t}var Xl=Object(k.injectIntl)(Yl),Zl=j.parseUrlHash(window.location.hash).params,$l=Zl&&Zl.hl||navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||"en",ec=$l.toLowerCase().split(/[-_]/)[0],tc=i[$l]||i[ec]||i.en;r.a.render(S.a.createElement(k.IntlProvider,{locale:$l,messages:tc,textComponent:S.a.Fragment},S.a.createElement(Xl,null)),document.getElementById("mountPoint"))}]);
|
||
//# sourceMappingURL=index.prod.js.map
|