(window.webpackJsonp=window.webpackJsonp||[]).push([[6],[function(n,e,r){"use strict";var o=r(74),t=r(9),l=r(13);r(1).get("interchat:loggerLocal.ts");let d=r(1);d.useDefaults();const c="ksitalkDebugLogEnabled";let f=[];function m(){try{return"1"==localStorage.getItem(c)}catch(n){return!1}}function h(n,e){if(e instanceof Error){let n={};return Object.getOwnPropertyNames(e).forEach(function(r){n[r]=e[r]}),n}return e}d.logBufferEnabledGet=function(){return m()},d.logBufferEnabledSet=function(n){try{localStorage.setItem(c,n?"1":"0")}catch(n){}},d.clearAllMessages=function(){f=[]},d.sendAllMessages=async function(){!t.a.connected||f.length<=0||t.a.authorizationToken&&(f.forEach(n=>{t.a.emit("logger",n)}),m()||(f=[]))},d.getAllMessagesText=function(){if(f.length<=0)return"";let text="";return f.forEach(n=>{text+=n+"\n"}),text};let v=d.createDefaultHandler();function x(){return{value:function(){let n={};return Object.getOwnPropertyNames(this).forEach(function(e){n[e]=this[e]},this),n},configurable:!0,writable:!0}}d.setHandler(function(n,e){if(v(n,e),!m())return;let r=(new Date).toISOString()+" : ";for(let e in n){let param=n[e];"string"!=typeof param&&(param=JSON.stringify(h(0,param),h)),r+=param+" "}for(r.length>4e3&&(r=r.substring(0,4e3)+"...[truncated]");f.length>=300;)f.splice(0,1);r="|"+Object(o.a)()+" | "+r,f.push(r),Object(l.f)()&&!m()&&d.sendAllMessages()}),"toJSON"in Error.prototype||Object.defineProperty(Error.prototype,"toJSON",x()),"toJSON"in Event.prototype||Object.defineProperty(Event.prototype,"toJSON",x()),window&&(window.onerror=function(n,e,r){d.error("Global error ",n,e,r)},window.addEventListener("error",function(n){d.error("Global error event",n.message,"event = ",n)})),e.a=d},,,,,function(n,e,r){"use strict";r.d(e,"a",function(){return l}),r.d(e,"d",function(){return d}),r.d(e,"e",function(){return c}),r.d(e,"c",function(){return f});var o=r(3);r(1).get("interchat:eventBus");const t=new o.default;e.b=t;class l{}function d(text){t.$emit(l.MODAL_SHOW,{title:"Notification",text:text})}function c(text){t.$emit(l.MODAL_SHOW,{title:"Warning",text:text})}function f(text){t.$emit(l.MODAL_SHOW,{title:"Error",text:text})}l.ACTIVATE="Activator::activate",l.REGISTRATION_TOKEN="PlatformDevice::registrationToken",l.AUDIO_CONTEXT_SET="GlobalAudio::audioContextSet",l.PLAYER_SET="GlobalAudio::playerSet",l.SOCKET_MOUNT="Socket:Mount",l.CALL_START="Call:Start",l.MODAL_SHOW="Modal:show",l.MODAL_HIDE="Modal:hide",l.REDIRECT="Redirect",l.NAVIGATE_BACK="NavigateBack",l.NAVIGATE_END="NavigateEnd",l.LAYOUT_MENU_CLICK="layoutMenuClick",l.LAYOUT_USER_ADD="layoutUserAdd",l.FILE_SHARE="FileShare",l.MESSAGE_REPLY="MessageReply",l.MESSAGE_FORWARD="MessageForward"},,,,function(n,e,r){"use strict";var o=r(452),t=r.n(o),l=r(0),d=r(5);r(1).get("interchat:SocketServer:emitAsync.ts");var c=r(17);r(1).get("interchat:socket.io.ts");const f=["polling","websocket"],m=t()("https://ksitalk.com",{path:"/interchat/back/socket.io",autoConnect:!1,transports:f,timeout:6e4,forceNew:!0});m.isInProgress=function(){return this.requestInProgress>0};m.requestInProgress=0,m.authenticated=!1,m.serverReady=!1,m.changeRequestInProgress=function(n){let e=this.isInProgress();this.requestInProgress+=n,this.requestInProgress<0&&(l.a.warn("requestInProgress <0 !!!",this.requestInProgress),this.requestInProgress=0);let r=this.isInProgress();this.context&&e!=r&&this.context.store.commit("SET_SOCKET_IN_PROGRESS",r)},m.onRequestStart=function(){this.changeRequestInProgress(1)},m.onRequestEnd=function(){this.changeRequestInProgress(-1)},m.waitAuthenticated=function(n=8e3){return this.authenticated&&this.serverReady?Promise.resolve():this.connected?new Promise((e,r)=>{let o=null;const t=()=>{this.removeListener("authenticated",f),this.removeListener(c.a.SOCKET_READY,m),this.removeListener("disconnect",h),o&&(clearTimeout(o),o=null)},d=()=>{this.authenticated&&this.serverReady&&(t(),e())},f=()=>{setTimeout(()=>{this.serverReady||(l.a.warn("socket-ready fallback after authenticated"),this.serverReady=!0,d())},750),d()},m=()=>{d()},h=()=>{t(),r(new Error("offline"))};o=setTimeout(()=>{t(),r(new Error("timeout"))},n),this.once("authenticated",f),this.once(c.a.SOCKET_READY,m),this.once("disconnect",h),this.authenticated&&f()}):Promise.reject(new Error("offline"))},m.emitAsync=async function(n,data){try{this.onRequestStart(),await this.waitAuthenticated();let e=await async function(n,e,data,r){return new Promise((o,t)=>{let l=null,d=()=>{n.removeEventListener("disconnect",c),l&&(clearTimeout(l),l=null)},c=()=>{d(),t(new Error("timeout"))},f=r&&r.timeout||0;f&&(l=setTimeout(c,f)),n.once("disconnect",c),n.emit(e,data,(n,e)=>{l&&(d(),n?t(n):o(e))})})}(this,n,data,{timeout:15e3});return l.a.debug("event resolve ",n,e),e}catch(e){throw l.a.error("emit error ",n,e),e}finally{this.onRequestEnd()}},m.listenersMounted=!1,m.setContext=function(n){if(this.context=n,!this.listenersMounted){let n=this.context.store;d.b.$emit(d.a.SOCKET_MOUNT,{}),m.mountListeners(n),this.listenersMounted=!0}},m.onLogin=function(){if(!this.context)throw l.a.error("Socket on Login fails! No context"),new Error("Socket no context");let n=this.context.$auth;this.authorizationToken=n.getToken(n.strategy.name),this.authenticated=!1,this.serverReady=!1,m.open(),l.a.log("socket open")},m.mountListeners=function(n){let e=this;l.a.trace("Event mounted"),e.on(c.a.USER_ONLINE,e=>{n.dispatch("Users/setOnline",e)}),e.on(c.a.USER_OFFLINE,e=>{n.dispatch("Users/setOffline",e)}),e.on(c.a.NEW_MESSAGE,e=>n.dispatch("pushMessage",e)),e.on(c.a.REMOVE_MESSAGE,e=>n.dispatch("onRemoveMessage",e)),e.on(c.a.UPDATE_USER_CONVERSATION,data=>n.dispatch("updateUserConversation",data)),e.on(c.a.UPDATE_USER_CONVERSATION_OPPONENT,e=>n.dispatch("updateUserConversationOpponent",e)),e.on(c.a.CONVERSATION_CLEAN,data=>n.dispatch("conversationClean",data)),e.on(c.a.CONVERSATION_DELETE,data=>n.dispatch("conversationDelete",data)),e.on(c.a.RSA_PUBLIC_KEY_SET,data=>n.dispatch("Users/setUserPublicKey",data)),e.on(c.a.LOGOUT,data=>e.onLogout()),e.on(c.a.PROFILE_CHANGED,data=>n.dispatch("Users/userUpdate",data)),e.on(c.a.NEW_MESSAGE_AUDIO,e=>n.dispatch("pushMessage",e)),e.on(c.a.NEW_CONVERSATION,async e=>{l.a.debug("on new-conversation",e),await n.dispatch("Users/fetchUsers"),n.commit("ADD_CONVERSATION",e)}),e.on(c.a.NEW_USER,async e=>{l.a.debug("on new-user",e),await n.dispatch("Users/fetchUsers")});let r=async()=>{await n.dispatch("updateSelfOnline",e.connected)};e.on(c.a.CALL_MESSAGE,e=>{try{n.dispatch("Call/onMessage",e)}catch(n){l.a.error("onCallMessage",n)}}),e.on(c.a.TRANSFER_MESSAGE,e=>{try{n.dispatch("FileShare/onMessage",e)}catch(n){l.a.error("onCallMessage",n)}}),e.on("connect",r),e.on("reconnect",r),e.on("disconnect",r),r()},m.onLogout=async function(){l.a.debug("logout");let n=this.context.$auth,e=this.context.store;try{if(!e)throw new Error("onLogout store undefined!");this.deviceToken&&await m.sendLogout(),m.close()}finally{await n.logout(),this.authorizationToken=void 0,await e.dispatch("logout")}},m.on("connect",()=>{m.authenticated=!1,m.serverReady=!1;const n=m.io;l.a.debug("socket connected",m.id,"transport",n&&n.engine&&n.engine.transport&&n.engine.transport.name),m.authorizationToken?m.emit("authenticate",{token:m.authorizationToken}):(l.a.log("connected not authorized socket ... close"),m.close())}),m.on("authenticated",n=>{m.authenticated=!0,l.a.debug("socket authenticated",m.id),m.deviceToken&&m.doUpdateDeviceToken({token:m.deviceToken});try{window.top.postMessage("authenticated","*")}catch(n){}}),m.on(c.a.SOCKET_READY,()=>{m.authenticated=!0,m.serverReady=!0,l.a.debug("socket server ready",m.id)}),m.on("disconnect",n=>{m.authenticated=!1,m.serverReady=!1,l.a.debug("socket disconnected",n)}),m.on("error",n=>{l.a.error("socket error",n)}),m.getUsersOnlineIds=async function(){return this.emitAsync("get_users_online_ids")},m.sendMessage=async function(n){return this.emitAsync("send-message",n)},m.removeMessage=async function(n){return this.emitAsync("remove-message",n)},m.sendMessageAudio=async function(n){return this.emitAsync("send-message-audio",n)},m.sendConversationClean=async function(n){return this.emitAsync("send-conversation-clean",n)},m.sendConversationDeleteWith=async function(n){return this.emitAsync("send-conversation-delete-with",n)},m.sendPublicKeySet=async function(n){return this.emitAsync("publicKeySet",n)},m.doUpdateDeviceToken=async function({token:n}){return this.deviceToken=n,l.a.debug("Send device token",this.deviceToken),this.emitAsync("updateDeviceToken",n)},m.sendLogout=async function(n={}){return n={...n,deviceToken:this.deviceToken},this.emitAsync("logout",n)},m.sendBugReport=async function(n){return this.emitAsync("bugReport",n)},m.forceConnect=function(){this.connected||(this.close(),setTimeout(()=>this.open(),0))},m.sendLog=async function(n){return this.emitAsync("logger",n)},m.runActionGet=async function(n,e){return this.emitAsync("action",{method:"get",url:n,params:e})},m.runActionPost=async function(n,e){return this.emitAsync("action",{method:"post",url:n,params:e})};e.a=m},,function(n,e,r){"use strict";r.d(e,"d",function(){return l}),r.d(e,"a",function(){return d}),r.d(e,"b",function(){return f}),r.d(e,"c",function(){return m});var o=r(0);r(1).get("interchat:PersonalCache.ts");let t=null;function l(n){o.a.log("Set current user id ",n),t=n}var d;function c(n){if(!t)throw Error("Current user id not set");return"personCache:"+t+":"+n}function f(n){let e=function(n){return localStorage.getItem(c(n))}(n);try{if("string"==typeof e)return JSON.parse(e)}catch(n){return null}return null}function m(n,e){!function(n,e){localStorage.setItem(c(n),e)}(n,JSON.stringify(e))}!function(n){n.USER_LIST="user_list",n.USER_SELF="user_self",n.CRYPTO_STORAGE="crypto_storage",n.CONVERSATIONS="conversations",n.USER_CONVERSATIONS="user_conversations",n.USER_CONVERSATIONS_OPPONENTS="user_conversations_opponents"}(d||(d={}))},,function(n,e,r){"use strict";(function(n){r.d(e,"p",function(){return l}),r.d(e,"o",function(){return d}),r.d(e,"a",function(){return f}),r.d(e,"h",function(){return h}),r.d(e,"i",function(){return x}),r.d(e,"j",function(){return k}),r.d(e,"e",function(){return w}),r.d(e,"d",function(){return y}),r.d(e,"l",function(){return S}),r.d(e,"k",function(){return _}),r.d(e,"g",function(){return C}),r.d(e,"f",function(){return E}),r.d(e,"c",function(){return I}),r.d(e,"b",function(){return A}),r.d(e,"n",function(){return T}),r.d(e,"m",function(){return O}),r.d(e,"q",function(){return N});var o=r(43),t=r(0);r(1).get("interchat:localOptions.ts");const l="default",d="dark",c=n.env.DEFAULT_THEME?n.env.DEFAULT_THEME:d;var f;!function(n){n.LOG_AUTO_SEND="logAutoSend",n.FILE_TRANSFER_AUTO="fileTransferAuto",n.PHOTO_VIDEO_GALLERY_SAVE="photoVideoGallerySave",n.SPEECH_THRESHOLD="speechThreshold",n.CRYPTO_CLOUD_BACKUP="cryptoCloudBackup",n.ECHO_CANCELLATION_ENABLE="echoCancellationEnable",n.ECHO_CANCELLATION_NATIVE_DISABLE="echoCancellationNativeDisable",n.ECHO_CANCELLATION_NATIVE_VIDEO_DISABLE="echoCancellationNativeVideoDisable",n.THEME_NAME="themeName"}(f||(f={}));const m={};function h(n){return e=localStorage.getItem(n),r=m[n],"true"==e||"false"!=e&&r;var e,r}function v(n){return function(n,e){let r=n?parseInt(n):NaN;return isNaN(r)?e:r}(localStorage.getItem(n),m[n])}function x(n){return localStorage.getItem(n)||m[n]}function k(n,e){localStorage.setItem(n,e)}function w(n){k(f.FILE_TRANSFER_AUTO,n)}function y(){return h(f.FILE_TRANSFER_AUTO)}function S(n){k(f.PHOTO_VIDEO_GALLERY_SAVE,n)}function _(){return h(f.PHOTO_VIDEO_GALLERY_SAVE)}function C(n){k(f.LOG_AUTO_SEND,n);try{document.devicePlatform&&document.devicePlatform.developerLogSendSet&&document.devicePlatform.developerLogSendSet(n)}catch(n){t.a.error("Error LogAutoSendSet ",n)}}function E(){return h(f.LOG_AUTO_SEND)}function I(n){k(f.ECHO_CANCELLATION_ENABLE,n)}function A(){return h(f.ECHO_CANCELLATION_ENABLE)}function T(n){k(f.SPEECH_THRESHOLD,n)}function O(){return v(f.SPEECH_THRESHOLD)}function N(){return x(f.THEME_NAME)}m[f.ECHO_CANCELLATION_ENABLE]=!o.isIOS,m[f.ECHO_CANCELLATION_NATIVE_DISABLE]=!1,m[f.ECHO_CANCELLATION_NATIVE_VIDEO_DISABLE]=!1,m[f.SPEECH_THRESHOLD]=-60,m[f.CRYPTO_CLOUD_BACKUP]=!0,m[f.LOG_AUTO_SEND]=true,m[f.FILE_TRANSFER_AUTO]=!0,m[f.PHOTO_VIDEO_GALLERY_SAVE]=!0,m[f.THEME_NAME]=c}).call(this,r(16))},,function(n,e,r){"use strict";r.r(e),r.d(e,"STATUS",function(){return o}),r.d(e,"isStatusNeedFullScreen",function(){return t});r(1).get("interchat:Call:types:Status.ts");var o;function t(n){return n==o.OUTGOING||n==o.ACCEPTED}!function(n){n.NONE="",n.IGNORE="ignore",n.OUTGOING="outgoing",n.INCOMING="incoming",n.ACCEPTED="accepted",n.FINISHED="finished",n.BUSY="busy"}(o||(o={}))},,function(n,e,r){"use strict";r.d(e,"a",function(){return o});r(1).get("interchat:SocketServer:ESocketEvents.ts");var o;!function(n){n.USER_ONLINE="user-online",n.USER_OFFLINE="user-offline",n.SOCKET_READY="socket-ready",n.NEW_MESSAGE="new-message",n.NEW_MESSAGE_AUDIO="new-message-audio",n.NEW_USER="new-user",n.NEW_CONVERSATION="new-conversation",n.PROFILE_CHANGED="profile_changed",n.RSA_PUBLIC_KEY_SET="rsa_public_key_set",n.GET_USERS_ONLINE_IDS="get_users_online_ids",n.SEND_MESSAGE="send-message",n.REMOVE_MESSAGE="remove-message",n.PUBLIC_KEY_SET="publicKeySet",n.CONVERSATION_CLEAN="conversation-clean",n.CONVERSATION_DELETE="conversation-del",n.SEND_CONVERSATION_CLEAN="send-conversation-clean",n.SEND_CONVERSATION_DELETE_WITH="send-conversation-delete-with",n.SEND_MESSAGE_AUDIO="send-message-audio",n.CALL_MESSAGE="call-message",n.TRANSFER_MESSAGE="transfer-message",n.UPDATE_DEVICE_TOKEN="updateDeviceToken",n.LOGGER="logger",n.BUG_REPORT="bugReport",n.LOGOUT="logout",n.UPDATE_USER_CONVERSATION="updateUserConversation",n.UPDATE_USER_CONVERSATION_OPPONENT="updateUserConversationOpponent",n.FILE_UPLOAD_STREAM="file_upload_stream",n.FILE_DOWNLOAD_STREAM="file_download_stream"}(o||(o={}))},,function(n,e,r){"use strict";r.r(e),r.d(e,"STATUS",function(){return o});r(1).get("interchat:FileShare:types:Status.ts");var o;!function(n){n.NONE="",n.IGNORE="ignore",n.OUTGOING="outgoing",n.INCOMING="incoming",n.ACCEPTED="accepted",n.FINISHED="finished"}(o||(o={}))},,,,,function(n,e,r){"use strict";r.d(e,"a",function(){return o}),r.d(e,"c",function(){return t}),r.d(e,"b",function(){return l});r(1).get("interchat:platform:PlatformDeviceInterface.ts");var o,t,l;!function(n){n.MODE_NORMAL="MODE_NORMAL",n.MODE_RINGTONE="MODE_RINGTONE",n.MODE_IN_CALL="MODE_IN_CALL",n.MODE_IN_COMMUNICATION="MODE_IN_COMMUNICATION",n.MODE_INVALID="MODE_INVALID"}(o||(o={})),function(n){n.PHONE="PHONE",n.SPEAKER="SPEAKER",n.BLUETOOTH="BLUETOOTH",n.ANY="ANY"}(t||(t={})),function(n){n[n.STREAM_MUSIC=3]="STREAM_MUSIC",n[n.STREAM_VOICE_CALL=0]="STREAM_VOICE_CALL"}(l||(l={}))},function(n,e,r){"use strict";r.d(e,"c",function(){return t}),r.d(e,"d",function(){return l}),r.d(e,"a",function(){return d}),r.d(e,"b",function(){return c});r(23);r(1).get("interchat:userDisplay.ts");function o(n){return String(n||"").trim()}function t(n){if(!n)return"";const e=o(n.username);return/^\d+$/.test(e)?e:""}function l(n){return t(n)}function d(n){const text=o(n),e=text.split(/\s+/).map(n=>Array.from(n).filter(n=>/\p{L}/u.test(n)).join("")).filter(Boolean);if(e.length>=2)return(e[0][0]+e[1][0]).toUpperCase();if(1==e.length){const n=Array.from(e[0]);return n.length>2?(n[0]+n[n.length-1]).toUpperCase():n.join("").toUpperCase()}const r=text.replace(/\D/g,"");if(!r)return"";const t="ABCDEFGHIJ",l=parseInt(r[0],10),d=parseInt(r[r.length-1],10);return isNaN(l)||isNaN(d)?"":t[l]+t[(d+5)%10]}function c(n){if(!n)return"";const e=o(n.avatarName);if(e)return e;const r=o(n.profile&&n.profile.avatarName);return r||d(t(n))}},function(n,e,r){"use strict";r.r(e),r.d(e,"MessageType",function(){return o});r(1).get("interchat:FileShare:types:Message.ts");var o;!function(n){n.REQUEST="transferRequest",n.ASC="transferASC",n.ANSWER="transferAnswer",n.ANSWER_SELF="transferAnswerSelf",n.HUNG="transferHung",n.SIGNAL="transferSignal",n.DONE="transferDone"}(o||(o={}))},function(n,e,r){"use strict";r.r(e),r.d(e,"MessageType",function(){return o});r(1).get("interchat:Call:types:Message.ts");var o;!function(n){n.REQUEST="callRequest",n.ASC="callRequestASC",n.ANSWER="callAnswer",n.ANSWER_SELF="callAnswerSelf",n.HUNG="callHung",n.SIGNAL="signal"}(o||(o={}))},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:Avatar.vue");r(23);var o=r(188),t=(r(5),r(10)),l=r(13),d=r(0);r(1).get("interchat:Avatar.vue");var c={name:"avatarImage",components:{avatar:o.a},props:{fullname:{type:String,default:""},size:{type:Number,default:32},avatarId:Number,urlPrefix:{type:String,default:null}},computed:{...Object(t.c)({themeName:"themeName"}),prefix(){if(this.urlPrefix)return this.urlPrefix;if("undefined"!=typeof window&&window.location&&"file:"===window.location.protocol)return"file:///android_asset/www/";const base=this.$router&&this.$router.options?this.$router.options.base:"";return base?base.endsWith("/")?base:base+"/":"/"},imageUri(){if(!this.avatarId)return;let n=(this.avatarId<10?"0":"")+this.avatarId;return this.prefix+"gfx/avatar/"+n+".png"},avatarStyle(){return{width:this.size+"px",height:this.size+"px",minWidth:this.size+"px",backgroundColor:this.color}},fullnameText(){return null===this.fullname||void 0===this.fullname?"":String(this.fullname).trim()},avatarColorKey(){const n=this.avatarLetters;return n.length>0?n.join(""):this.fullnameText},avatarLetters(){const text=this.fullnameText.trim();if(!text)return[];const n=text.split(/\s+/).map(n=>Array.from(n).filter(this.isAvatarLetter).join("")).filter(Boolean);if(n.length>=2)return[n[0][0],n[1][0]].map(this.normalizeAvatarLetter);const e=Array.from(n[0]||text);return e.length>2?[e[0],e[e.length-1]].map(this.normalizeAvatarLetter):e.map(this.normalizeAvatarLetter)},avatarFullname(){const n=this.avatarLetters;return n.length>=2?n[0]+" "+n[1]:this.fullnameText},color(){return this.themeName==l.o?this.toColorDark(this.avatarColorKey):this.toColorLight(this.avatarColorKey)}},methods:{logAvatarTrace(n){d.a.warn("USER_DISPLAY_TRACE avatar",{event:n,fullname:this.fullname,fullnameText:this.fullnameText,avatarFullname:this.avatarFullname,avatarLetters:this.avatarLetters,avatarId:this.avatarId,imageUri:this.imageUri,prefix:this.prefix,size:this.size,themeName:this.themeName,color:this.color})},onImageLoad(){this.logAvatarTrace("image-load")},onImageError(){this.logAvatarTrace("image-error")},isAvatarLetter:n=>/\p{L}/u.test(String(n||"")),normalizeAvatarLetter:n=>String(n||"").toUpperCase(),toColor(n,e){let r=0;if(!n)return"black";for(const e of n.split(""))r=(r<<8-r)+e.charCodeAt(0);let o=r,t=o%360;return t+=120,t>360&&(t-=360),o=Math.floor(o/360),`hsl(${t}, ${50+o%50}%, ${e}%`},toColorDark(n){return this.toColor(n,8)},toColorLight(n){return this.toColor(n,40)}}},f=(r(597),r(4)),component=Object(f.a)(c,function(){var n=this,e=n._self._c;return n.imageUri?e("img",{staticClass:"avatar-image avatar-no-select",style:n.avatarStyle,attrs:{src:n.imageUri,alt:"",draggable:"false"},on:{load:n.onImageLoad,error:n.onImageError}}):e("avatar",{staticClass:"avatar-no-select",style:n.avatarStyle,attrs:{fullname:this.avatarFullname,size:this.size,color:n.color}})},[],!1,null,"68e6fbdd",null);e.default=component.exports;installComponents(component,{Avatar:r(28).default})},,,,,function(n,e,r){"use strict";r.r(e),r.d(e,"default",function(){return c});var o=r(9),t=r(0),l=r(26),d=r(74);r(1).get("interchat:FileShare:TransferMessages.ts");class c{static async signalDirectSend(n,e){return t.a.debug("send signal ",e),c.sendMessage({type:l.MessageType.SIGNAL,signal:e,userId:n})}static async sendMessage(n){return n&&(n.appInstanceId=Object(d.a)(),t.a.log("app instance id = ",n.appInstanceId)),t.a.debug("Send transfer-message",n),o.a.emitAsync("transfer-message",n)}static sendMessageRequest(n,e){return c.sendMessage({type:l.MessageType.REQUEST,userId:n,payload:e})}static sendMessageAnswer(n,e){return c.sendMessage({type:l.MessageType.ANSWER,userId:n,error:e})}static sendMessageAnswerSelf(n,e){return c.sendMessage({type:l.MessageType.ANSWER_SELF,userId:n,payload:e})}static sendMessageAscend(n){return c.sendMessage({type:l.MessageType.ASC,userId:n})}static sendMessageHung(n,e,r=void 0){return c.sendMessage({type:l.MessageType.HUNG,userId:n,error:r,reason:e})}static sendMessageDone(n){return c.sendMessage({type:l.MessageType.DONE,userId:n})}}c.REASON_BUSY="busy"},,,function(n,e,r){"use strict";r.d(e,"a",function(){return o}),r.d(e,"b",function(){return t});r(1).get("interchat:tools:TimerCollection.ts");class o{constructor(n,time){this.cb=n,this.interval=!1,this.timer=null,this.timeout=time}isStarted(){return null!=this.timer}start(){return this.interval?this.timer=setInterval(this.fired.bind(this),this.timeout):this.timer=setTimeout(this.fired.bind(this),this.timeout),this}repeat(){return this.interval=!0,this}fired(){this.interval||this.clear(),this.cb&&this.cb()}clear(){this.timer&&(this.interval?clearInterval(this.timer):clearTimeout(this.timer),this.timer=null)}}class t{constructor(){this.timers={}}addTimer(n,e){this.clearTimer(n),e.name=n,e.isStarted()||e.start(),this.timers[n]=e}clearTimer(n){const e=this.timers[n];e&&(e.clear(),delete this.timers[n])}clearAll(){for(const n in this.timers){if(!this.timers.hasOwnProperty(n))continue;this.timers[n].clear()}this.timers={}}}},function(n,e,r){"use strict";r.r(e),r.d(e,"default",function(){return f});var o=r(9),t=r(0),l=r(27),d=r(74),c=r(17);r(1).get("interchat:Call:CallMessages.ts");class f{static signalDirectSend(n,e){t.a.debug("send signal ",e),f.sendMessage({type:l.MessageType.SIGNAL,signal:e,userId:n})}static async sendMessage(n){return n&&(n.appInstanceId=Object(d.a)()),t.a.debug("Send Call-message",n),await o.a.emitAsync(c.a.CALL_MESSAGE,n)}static async sendMessageRequest(n,e){let r=e;return r.usersId=e.callInfo.userIds,r.callId=e.callInfo.callId,r.videoMode=e.callInfo.video,f.sendMessage({type:l.MessageType.REQUEST,userId:n,payload:r})}static async sendMessageAnswer(n,e){return f.sendMessage({type:l.MessageType.ANSWER,userId:n,error:e})}static async sendMessageAnswerSelf(n,e){return f.sendMessage({type:l.MessageType.ANSWER_SELF,userId:n,payload:e})}static async sendMessageAscend(n){return f.sendMessage({type:l.MessageType.ASC,userId:n})}static async sendMessageHung(n,e,r,o){return f.sendMessage({type:l.MessageType.HUNG,userId:n,error:r,reason:e,connectionStatus:o})}}f.REASON_BUSY="busy"},,function(n,e,r){"use strict";r.d(e,"c",function(){return d}),r.d(e,"b",function(){return f}),r.d(e,"d",function(){return v}),r.d(e,"e",function(){return w}),r.d(e,"a",function(){return _}),r.d(e,"f",function(){return E});var o=r(0),t=r(184),l=(r(289),r(13));r(1).get("interchat:webstream");async function d(){if(!navigator)throw new Error("No navigator defined");if(!navigator.mediaDevices)throw new Error("No navigator.mediaDevices defined");if(!navigator.mediaDevices.enumerateDevices)throw new Error("No navigator.mediaDevices.enumerateDevices defined");const n=await navigator.mediaDevices.enumerateDevices();o.a.debug("Get devices",n);let e="audioinput",r=[e,"AVCaptureDeviceTypeBuiltInMicrophone"];const t=n.filter(n=>r.includes(n.kind)),l=n.filter(n=>"audiooutput"===n.kind),d=n.filter(n=>"videoinput"===n.kind);return t.forEach(n=>{n.kind!=e&&(n.kind=e)}),{inputDevices:t,outputDevices:l,videoInputDevices:d}}function c(n,e){if(!n)return null;let r=n.find(n=>n.deviceId==e);return r||null}function f(n){localStorage.setItem("ic_"+n.kind,n.deviceId)}function m(){return localStorage&&localStorage.getItem("ic_audioinput")}function h(){return localStorage&&localStorage.getItem("ic_videoinput")}async function v(){let n={inputDevice:null,outputDevice:null,videoInputDevice:null},{inputDevices:e,outputDevices:r,videoInputDevices:o}=await d();return n.inputDevice=c(e,m()),n.outputDevice=c(r,localStorage&&localStorage.getItem("ic_audiooutput")),n.videoInputDevice=c(o,h()),n}async function x(){let n=await async function(){let{inputDevices:n}=await d();o.a.debug("Input audio devices = ",n);let e=null;return e=c(n,m()),e||(e=n.find(n=>"Headset earpiece"==n.label),e||n[n.length-1])}();return n&&""===n.deviceId&&(n=void 0),{audio:!n||{deviceId:{ideal:n.deviceId}}}}async function k(){let n=await async function(){let{videoInputDevices:n}=await d();return o.a.debug("Input video devices = ",n),c(n,h())||null}();return n&&""===n.deviceId&&(n=void 0),!n||{deviceId:{ideal:n.deviceId}}}function w(){return new(window.AudioContext||window.webkitAudioContext)}async function y({videoOn:n,allowRestricts:e,makeSimple:r}){const t={video:!0},l={audio:!0};let d;if(!d&&r&&(d={audio:!0}),!d)try{d=await x()}catch(n){o.a.warn("failed get constrains ",n),o.a.debug("Using default constrains"),d=l}if(n)try{d={...d,video:await k()}}catch(n){o.a.warn("failed get video constrains ",n),d={...d,...t}}if(e){const n={sampleSize:8,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0,sampleRate:16e3,channelCount:1};let e=navigator.mediaDevices.getSupportedConstraints();o.a.debug("Supported constrains:",e),d.audio={...d.audio,...n}}return d}async function S(n){try{o.a.debug("Getting user media with constraints",n);var e=await navigator.mediaDevices.getUserMedia(n);o.a.debug("Success local stream.");try{e.getTracks().forEach(track=>{o.a.log("get local track capabilities: ",track.getCapabilities())})}catch(n){o.a.warn("Error get getCapabilities ",n)}return e}catch(n){throw o.a.error("Error get user media",n),n}}async function _(n,e){let r=new Error("no stages passed! should never happen.");for(let t=0;t<4;t++)try{if(0==t){if(!n)continue;return await S(n)}let r={videoOn:e};1==t?r={...r,allowRestricts:!0,makeSimple:!1}:2==t?r={...r,allowRestricts:!1,makeSimple:!1}:3==t&&(r={...r,allowRestricts:!1,makeSimple:!0});let o=await y(r),d=e?l.a.ECHO_CANCELLATION_NATIVE_VIDEO_DISABLE:l.a.ECHO_CANCELLATION_NATIVE_DISABLE;if(Object(l.h)(d)){let audio=o.audio;!0===audio&&(audio={}),audio={...audio,echoCancellation:!1},o.audio=audio}return await S(o)}catch(n){if(r=n,e&&C(n))try{o.a.warn("Video input device not found, retrying with audio only",n);let e=await y({videoOn:!1,allowRestricts:!1,makeSimple:!0});return await S(e)}catch(n){r=n}continue}throw r}function C(n){return!!n&&("NotFoundError"===n.name||"DevicesNotFoundError"===n.name||"OverconstrainedError"===n.name||/device not found/i.test(n.message||""))}function E(n){n.getTracks().forEach(track=>{track.stop&&track.stop(),n.removeTrack&&n.removeTrack(track)})}o.a.debug("Browser details: ",t.a.browserDetails)},function(n,e,r){"use strict";r.r(e),r.d(e,"SetIncomingFiles",function(){return w}),r.d(e,"SetAutoFileSelect",function(){return S}),r.d(e,"GoToTransferToUser",function(){return C});r(1).get("interchat:users:transfer.vue");var o=r(0),t=r(49),l=r(10),d=r(8),c=r(124),f=r.n(c),m=r(73),h=r(25);r(1).get("interchat:users:transfer.vue");var v=function(n,e,r,desc){var o,t=arguments.length,l=t<3?e:null===desc?desc=Object.getOwnPropertyDescriptor(e,r):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(n,e,r,desc);else for(var i=n.length-1;i>=0;i--)(o=n[i])&&(l=(t<3?o(l):t>3?o(e,r,l):o(e,r))||l);return t>3&&l&&Object.defineProperty(e,r,l),l};d.d.use(f.a);let x=null,k=!1;function w(n,e=!1){x=n,k=e}let y=!1;function S(n){y=n}var _;function C(n){return{path:"/users/transfer",query:{userId:n}}}!function(n){n[n.SELECTING=0]="SELECTING",n[n.SENDING=1]="SENDING"}(_||(_={}));let E=class extends d.d{constructor(){super(...arguments),this.state=_.SELECTING,this.userId=null,this.fileList=null,this.fileSend=null}get fileFirst(){return this.fileList?this.fileList[0]:null}get user(){return this.userId&&this.users?this.users[this.userId]:null}get userNumber(){return Object(h.d)(this.user)}get isFileChoose(){return this.state==_.SELECTING}get isSending(){return this.state==_.SENDING}created(){this.userId=this.$route.query.userId,this.$parent.$emit("update:opponent",this.user),this.$parent.$emit("update:showBackButton",!0),this.$parent.$emit("update:showMenuButton",!1)}mounted(){if(x){this.fileList=x;let n=k;o.a.warn("ANDROID_SHARE_TRACE transfer mounted with incoming files",{count:this.fileList.length,autoSend:n,firstName:this.fileList[0]?this.fileList[0].name:"",firstSize:this.fileList[0]?this.fileList[0].size:0}),x=null,k=!1,n&&this.$nextTick(()=>this.doSend())}if(y){this.$refs.fileSelect.doClickFileInput(),y=!1}}handleDrop(data,n){n.preventDefault(),n.dataTransfer&&(this.fileList=n.dataTransfer.files)}doBack(){this.$store.dispatch("screen/restoreAppViewport"),this.$router.replace(Object(m.GoToChatWithUser)(this.userId)),this.$nextTick(()=>this.$store.dispatch("screen/restoreAppViewport")),setTimeout(()=>this.$store.dispatch("screen/restoreAppViewport"),250)}getFirstFile(){if(!this.fileList)return;let n=this.fileList[0];if(n){if(n.size)return n;alert("Can not send file with zero size")}}async doAbort(){this.fileSend=null,this.state=_.SELECTING}async doSend(){let n=this.getFirstFile();n&&(o.a.warn("ANDROID_SHARE_TRACE transfer doSend",{name:n.name,size:n.size,type:n.type}),this.state=_.SENDING,this.fileSend=n)}async onFinish(n,e){n&&e&&(await this.sendMessageToChat(n,e),await this.$store.dispatch("platformDevice/onFileUpload",{fileName:n.name,fileSize:n.size,fileContent:n}),this.fileSend=null,this.fileList=null,await this.$store.dispatch("screen/restoreAppViewport"),this.doBack())}async sendMessageToChat(n,e){if(!this.fileSend)throw new Error("need set fileSend");let r=this.userId,body=JSON.stringify({name:n.name,size:n.size,crypto:e});await this.$store.dispatch("sendMessageToOpponent",{opponentId:r,body:body,type:"file",silent:!1,crypt:!0})}onFileListChange(){this.state=_.SELECTING}onUserChanged(n){this.$parent.$emit("update:opponent",this.user)}};v([Object(d.e)("fileList")],E.prototype,"onFileListChange",null),v([Object(d.e)("user")],E.prototype,"onUserChanged",null),E=v([Object(d.a)({middleware:["auth"],computed:{...Object(l.b)({online:"online"}),...Object(l.c)("Users",{users:"users"})},components:{},layout:"back",transition:t.a})],E);var I=E,A=r(4),component=Object(A.a)(I,function(){var n=this,e=n._self._c;n._self._setupProxy;return e("div",{staticClass:"container border-t flex flex-1 h-full"},[e("drop",{staticClass:"w-full h-full flex flex-col items-center",on:{drop:n.handleDrop}},[e("h1",{staticClass:"font-hairline my-3 text-center"},[n._v(n._s(n.$t("Send file to user",{name:n.userNumber})))]),n._v(" "),n.fileSend?n._e():e("FileSelect",{ref:"fileSelect",staticClass:"w-full",attrs:{file_list:n.fileList},on:{"update:file_list":function(e){n.fileList=e},send:n.doSend,back:n.doBack}}),n._v(" "),n.fileSend?e("FileSending",{staticClass:"w-full",attrs:{file:n.fileSend},on:{abort:n.doAbort,finish:n.onFinish}}):n._e()],1)],1)},[],!1,null,"1e364a3d",null);e.default=component.exports;installComponents(component,{FileSelect:r(816).default,FileSending:r(818).default})},,,,function(n,e,r){"use strict";r.r(e);r(1).get("interchat:activator:ActivatorInitial.vue");var o=r(10),t=r(5);r(1).get("interchat:activator:ActivatorInitial.vue");var l={name:"ActivatorInitial",components:{},computed:{...Object(o.b)({appActivated:"appActivated"})},mounted(){this.appActivated||this.$nextTick(this.doActivate)},methods:{doActivate(){t.b.$emit(t.a.ACTIVATE,{})}}},d=r(4),component=Object(d.a)(l,function(){return(0,this._self._c)("span")},[],!1,null,null,null);e.default=component.exports},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:Alert.vue");var o=r(5);r(1).get("interchat:Alert.vue");var t={data:()=>({title:"",text:""}),created(){o.b.$on(o.a.MODAL_SHOW,data=>this.onShow(data.title,data.text)),o.b.$on(o.a.MODAL_HIDE,this.onClose)},methods:{onShow(title,text){this.title=title?title.toString():"",this.text=text?text.toString():"",this.setVisible(!0)},onClose(){this.setVisible(!1),this.title="",this.text=""},setVisible(n){const e=document.querySelector(".modal");null!=e&&(e.classList.toggle("opacity-0",!1===n),e.classList.toggle("pointer-events-none",!1===n));const body=document.querySelector("body");null!=body&&body.classList.toggle("modal-active",n)}}},l=(r(593),r(4)),component=Object(l.a)(t,function(){var n=this,e=n._self._c;return e("div",{staticClass:"modal opacity-0 pointer-events-none fixed w-full h-full top-0 flex z-50 px-4 items-center justify-center"},[e("div",{staticClass:"modal-overlay absolute w-full h-full bg-gray-900 opacity-50",on:{click:n.onClose}}),n._v(" "),e("div",{staticClass:"modal-container panel_class w-full md:max-w-md mx-auto rounded shadow-lg z-50 overflow-y-auto"},[e("div",{staticClass:"modal-content py-4 text-left px-6"},[e("div",{staticClass:"flex justify-between items-center pb-3"},[e("p",{staticClass:"text-2xl font-bold"},[n._v(n._s(n.title))]),n._v(" "),e("div",{staticClass:"modal-close cursor-pointer z-50",on:{click:n.onClose}},[e("svg",{staticClass:"fill-current",attrs:{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"}},[e("path",{attrs:{d:"M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z"}})])])]),n._v(" "),e("div",[n._v(n._s(n.text))]),n._v(" "),e("div",{staticClass:"flex justify-end pt-2"},[e("button",{staticClass:"modal-close px-4 bg-indigo-500 p-3 rounded-lg btn btn-blue hover:bg-indigo-400",on:{click:n.onClose}},[n._v("Close")])])])])])},[],!1,null,null,null);e.default=component.exports},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:svg:Menu.vue");var o=r(4),component=Object(o.a)({},function(){var n=this,e=n._self._c;return e("svg",{attrs:{version:"1.1",x:"0px",y:"0px",height:"1rem",viewBox:"0 0 45.35 28.35","enable-background":"new 0 0 45.35 28.35","xml:space":"preserve"}},[e("g",[e("path",{attrs:{fill:"#010101",d:"M42.834,3.705c0,0.942-0.764,1.706-1.706,1.706H4.206C3.264,5.411,2.5,4.647,2.5,3.705l0,0\n C2.5,2.764,3.264,2,4.206,2h36.922C42.07,2,42.834,2.764,42.834,3.705L42.834,3.705z"}}),n._v(" "),e("path",{attrs:{fill:"#010101",d:"M42.834,14.221c0,0.942-0.764,1.706-1.706,1.706H4.206c-0.942,0-1.706-0.764-1.706-1.706l0,0\n c0-0.941,0.763-1.705,1.706-1.705h36.922C42.07,12.516,42.834,13.279,42.834,14.221L42.834,14.221z"}}),n._v(" "),e("path",{attrs:{fill:"#010101",d:"M42.834,24.504c0,0.942-0.764,1.705-1.706,1.705H4.206c-0.942,0-1.706-0.763-1.706-1.705l0,0\n c0-0.942,0.763-1.705,1.706-1.705h36.922C42.07,22.799,42.834,23.562,42.834,24.504L42.834,24.504z"}})])])},[],!1,null,null,null);e.default=component.exports},,,function(n,e,r){"use strict";r.d(e,"a",function(){return o});r(1).get("interchat:transitionLeftRight");function o(n,e){return e?{name:e.path<=n.path?"slide-left":"slide-right",mode:"out-in"}:"page"}},,,function(n,e,r){"use strict";r.d(e,"a",function(){return o});r(1).get("interchat:tools:FileSize.ts");function o(n,e=2){const r=["B","KB","MB","GB","TB"];let o=Math.max(n,0),t=Math.floor((o?Math.log(o):0)/Math.log(1024));return t=Math.min(t,r.length-1),o/=Math.pow(1024,t),o.toFixed(e)+r[t]}},function(n,e,r){"use strict";r.r(e),r.d(e,"DoFilePathSet",function(){return t}),r.d(e,"DoFilePathGet",function(){return l});r(1).get("interchat:fileTransfer:FilePathStore.ts");function o(n){return"filePath_"+n}function t(n,path){n&&localStorage.setItem(o(n),path)}function l(n){return n?localStorage.getItem(o(n)):null}},function(n,e,r){"use strict";r.d(e,"a",function(){return d}),r.d(e,"b",function(){return f});var o=r(0);r(1).get("interchat:localUserData");const t="local_user_name_";function l(n){return t+n}function d(n){let e={name:"",bg:""};try{let data=localStorage.getItem(l(n));data&&(e=JSON.parse(data))}catch(n){o.a.error("error user local ",n)}return e}function c(n,e){!function(n,data){localStorage.setItem(l(n),JSON.stringify(data))}(n,{...d(n),...e})}function f(n,e){c(n,{name:e})}},,,,,,,,,,,,,,,,,,function(n,e,r){"use strict";r.r(e);r(1).get("interchat:Loading.vue");var o=r(10),t=r(235),l=r.n(t),d=(r(599),r(8)),c=r(13);r(1).get("interchat:Loading.vue");var f=function(n,e,r,desc){var o,t=arguments.length,l=t<3?e:null===desc?desc=Object.getOwnPropertyDescriptor(e,r):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(n,e,r,desc);else for(var i=n.length-1;i>=0;i--)(o=n[i])&&(l=(t<3?o(l):t>3?o(e,r,l):o(e,r))||l);return t>3&&l&&Object.defineProperty(e,r,l),l};let m=class extends d.d{constructor(){super(...arguments),this.minimalShowActive=!1,this.isVisible=!1,this.timerShow=null,this.timerHide=null}get color(){return this.themeName==c.o?"#fff":"#000"}timerShowClear(){this.timerShow&&(clearTimeout(this.timerShow),this.timerShow=null)}timerHideClear(){this.timerHide&&(clearTimeout(this.timerHide),this.timerHide=null)}timerShowSet(n,e){this.timerShowClear(),this.timerShow=setTimeout(()=>{this.timerShow=null,n()},e)}timerHideSet(n,e){this.timerHideClear(),this.timerHide=setTimeout(()=>{this.timerHide=null,n()},e)}beforeDestroy(){this.timerShowClear(),this.timerHideClear()}created(){this.updateVisible(this.showLoading,0)}showStart(){this.isVisible=!0,this.minimalShowActive=!0,console.log("minimal start"),this.timerHideSet(()=>{this.minimalShowActive=!1,console.log("minimal end")},1e3)}showStop(){this.timerShowClear(),this.timerHideClear(),this.isVisible=!1}updateVisible(n,e){n?this.timerShowSet(()=>{this.showStart()},e):this.showStop()}onShowLoadingChanged(n){this.updateVisible(n,1e3)}onCancel(){this.showStop()}};f([Object(d.e)("showLoading")],m.prototype,"onShowLoadingChanged",null),m=f([Object(d.a)({components:{LoadingOverlay:l.a},computed:{...Object(o.b)({showLoading:"showLoading"}),...Object(o.c)({themeName:"themeName"})}})],m);var h=m,v=(r(601),r(4)),component=Object(v.a)(h,function(){var n=this;n._self._c,n._self._setupProxy;return n._e()},[],!1,null,"4a010ff0",null);e.default=component.exports},function(n,e,r){"use strict";r.r(e),r.d(e,"GoToChatWithUser",function(){return m});r(1).get("interchat:chats:index.vue");var o=r(207),t=r(136),l=r(10),d=r(0),c=r(49),f=r(40);r(1).get("interchat:chats:index.vue");function m(n){return{path:"/chats/",query:{userId:n}}}var h={name:"chat-view-id",middleware:["auth"],components:{UserList:o.default,Chat:t.default},transition:c.a,layout:"back",data:()=>({opponentId:null}),computed:{...Object(l.b)({online:"online"}),...Object(l.c)("Users",{users:"users"}),...Object(l.c)({conversations:"conversations",userOpponents:"userOpponents",userConversationsOpponents:"userConversationsOpponents"}),recipient(){return this.users?this.users[this.opponentId]:null},userConversationMy(){return this.userOpponents?this.userOpponents[this.opponentId]:null},userConversationOpponent(){return this.userConversationsOpponents?this.userConversationsOpponents[this.conversationId]:null},conversationId(){return this.userConversationMy?this.userConversationMy.conversationId:null},conversation(){return this.conversations?this.conversations[this.conversationId]:null}},async created(){this.opponentId=this.$route.query.userId,this.$parent.$emit("update:showBackButton",!0),this.$parent.$emit("update:showMenuButton",!0)},async beforeMount(){this.$parent.$emit("update:opponent",this.recipient),this.online&&await this.switchConversation()},mounted(){},async beforeDestroy(){this.conversationMute(!1)},methods:{handleDrop(data,n){n.dataTransfer&&(Object(f.SetIncomingFiles)(n.dataTransfer.files),this.$router.push(Object(f.GoToTransferToUser)(this.recipient.id)))},async conversationMute(n){let e=n?this.conversationId:null;await this.$store.dispatch("platformDevice/notificationMuteConversation",{conversationId:e})},addUser(){this.$router.push(this.localePath("/inviteUser"))},async switchConversation(){this.opponentId=this.$route.query.userId,d.a.debug("switchConversation ",this.opponentId);try{d.a.log("switchConversation",this.opponentId),await this.$store.dispatch("switchConversation",this.opponentId),await this.$store.dispatch("markConversationReadAll"),await this.conversationMute(!0)}catch(n){d.a.error("switchConversition after reload",n),this.$router.push(this.localePath("/"))}},conversationClean(n){confirm("Remove all messages?")&&this.$store.dispatch("sendConversationClean",n)},goBack(){this.$router.push(this.localePath("/"))}},watch:{async online(n){n&&(await this.switchConversation(),await this.$store.dispatch("markConversationReadAll"))},async conversationId(){this.conversationMute(!0)},recipient(n){this.$parent.$emit("update:opponent",this.recipient)}}},v=r(4),component=Object(v.a)(h,function(){var n=this,e=n._self._c;return e("drop",{staticClass:"container border-t flex flex-1 h-full overflow-hidden w-full",on:{drop:n.handleDrop}},[e("chat",{staticClass:"w-full h-full overflow-hidden",attrs:{conversation:n.conversation,recipient:n.recipient,userConversationOpponent:n.userConversationOpponent,userConversationMy:n.userConversationOpponent},on:{conversationClean:n.conversationClean,goBack:n.goBack}})],1)},[],!1,null,null,null);e.default=component.exports;installComponents(component,{Chat:r(136).default})},function(n,e,r){"use strict";r.d(e,"a",function(){return l});var o=r(206);r(1).get("interchat:appInstance.ts");let t=Object(o.a)();function l(){return t}},function(n,e,r){"use strict";var o=r(85);r(1).get("interchat:brandBody");e.a={computed:{brandBodyClass(){let n="";return(this.$store.getters["brand/isBrandKsiTalk"]||o.a)&&(n+=" body_KsiTalk"),this.$store.getters["brand/isBrandAnyTalk"]&&(n+=" body_AnyTalk"),n}}}},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:messages:ChatMessageBottom.vue");var o=r(77),t=r(486),l=r(487),d=r(488),c=r(489);r(1).get("interchat:messages:ChatMessageBottom.vue");var f={props:{me:Object,message:Object,recipientUser:Object,showSecure:{type:Boolean,default:!0},showDelivery:{type:Boolean,default:!0}},components:{Bin:o.default,Bird:t.default,BirdDouble:l.default,Secure:d.default,SecureNot:c.default},computed:{isSecure(){return this.message.isSecure},isRead(){return!this.message.isUnread},isMine(){return this.message.author===this.me.id},isBodyOk(){return this.isSecure||"decryption fails"!=this.message.body&&"crypted"!=this.message.body}},methods:{}},m=(r(760),r(4)),component=Object(m.a)(f,function(){var n=this,e=n._self._c;return e("div",{staticClass:"chat-message-bottom flex flex-row items-baseline"},[n.showSecure?e("div",{staticClass:"mx-1"},[n.isSecure?e("Secure"):e("SecureNot")],1):n._e(),n._v(" "),e("div",{staticClass:"text-grey-dark mx-1 text-xs"},[n._v(n._s(n._f("formatDate")(n.message.createdAt)))]),n._v(" "),n.isMine&&n.showDelivery?e("div",[n.isRead?e("BirdDouble"):e("Bird")],1):n._e(),n._v(" "),e("div",{staticClass:"flex-1 w-1 mx-1"})])},[],!1,null,"0d00c582",null);e.default=component.exports},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:svg:Bin.vue");var o=r(4),component=Object(o.a)({},function(){var n=this,e=n._self._c;return e("svg",{staticStyle:{"enable-background":"new 0 0 465.311 465.311"},attrs:{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"18px",height:"18px",viewBox:"0 0 465.311 465.311","xml:space":"preserve"}},[e("path",{attrs:{d:"M372.811,51.002h-59.908V36.566C312.902,16.404,296.499,0,276.335,0h-87.356c-20.163,0-36.567,16.404-36.567,36.566v14.436\n H92.5c-20.726,0-37.587,16.861-37.587,37.587v38.91c0,8.284,6.716,15,15,15h7.728v307.812c0,8.284,6.716,15,15,15H372.67\n c8.284,0,15-6.716,15-15V142.499h7.728c8.284,0,15-6.716,15-15v-38.91C410.397,67.863,393.536,51.002,372.811,51.002z\n M182.412,36.566c0-3.621,2.946-6.566,6.567-6.566h87.356c3.621,0,6.567,2.946,6.567,6.566v14.436h-100.49V36.566z M84.914,88.589\n c0-4.184,3.403-7.587,7.587-7.587h280.31c4.184,0,7.587,3.403,7.587,7.587v23.91H84.914V88.589z M357.67,435.311H107.641V142.499\n H357.67V435.311z"}}),n._v(" "),e("path",{attrs:{d:"M137.41,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988 C127.41,409.008,131.887,413.485,137.41,413.485z"}}),n._v(" "),e("path",{attrs:{d:"M200.907,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988 C190.907,409.008,195.384,413.485,200.907,413.485z"}}),n._v(" "),e("path",{attrs:{d:"M264.404,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988 C254.404,409.008,258.881,413.485,264.404,413.485z"}}),n._v(" "),e("path",{attrs:{d:"M327.901,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988 C317.901,409.008,322.378,413.485,327.901,413.485z"}})])},[],!1,null,null,null);e.default=component.exports},function(n,e,r){"use strict";r.r(e),r.d(e,"default",function(){return o});r(1).get("interchat:Call:types:CallInfo.ts");class o{constructor(n=null,e=[],video=!1){this.callId=n,this.userIds=e,this.video=video}isCompatible(n){return this.callId==n.callId&&JSON.stringify(n.userIds)==JSON.stringify(this.userIds)&&n.video==this.video}}},,,,function(n,e,r){"use strict";r.r(e),r.d(e,"doStartCallSingle",function(){return t}),r.d(e,"doStartCallMulti",function(){return l}),r.d(e,"ShowErrorWrap",function(){return d});var o=r(5);r(1).get("interchat:Call:startCall.ts");async function t(n,e,r){return d(async()=>n("Call/start",{callUserID:e,videoMode:r}))}async function l(n,e,r){return d(async()=>n("Call/startMany",{usersId:e,videoMode:r}))}async function d(n){try{await n()}catch(n){n.message?Object(o.c)(n.message):Object(o.c)("Unknown error")}}},,,function(n,e,r){"use strict";r.d(e,"a",function(){return o}),r.d(e,"b",function(){return t});r(1).get("interchat:platform:buildTarget");const o=!1,t=!1},,,,,,,,,,,,,function(n,e,r){"use strict";r.r(e);r(1).get("interchat:svg:Back.vue");var o=r(4),component=Object(o.a)({},function(){var n=this._self._c;return n("svg",{attrs:{version:"1.1",height:"1rem",viewBox:"19.026 13.031 32.819 29.353","enable-background":"new 19.026 13.031 32.819 29.353","xml:space":"preserve"}},[n("path",{attrs:{d:"M49.553,25.417H26.85l8.473-8.474c0.896-0.895,0.896-2.346,0-3.241s-2.346-0.896-3.241,0L19.704,26.081\n\tc-0.002,0.002-0.005,0.004-0.008,0.006c-0.039,0.039-0.067,0.084-0.103,0.126c-0.063,0.072-0.127,0.142-0.18,0.221\n\tc-0.048,0.071-0.082,0.147-0.121,0.223c-0.03,0.058-0.065,0.111-0.091,0.172c-0.037,0.088-0.06,0.181-0.084,0.271\n\tc-0.015,0.053-0.036,0.104-0.046,0.156c-0.06,0.298-0.06,0.604,0,0.903c0.01,0.052,0.031,0.1,0.044,0.149\n\tc0.025,0.093,0.049,0.188,0.086,0.277c0.026,0.063,0.063,0.119,0.094,0.178c0.036,0.068,0.064,0.139,0.107,0.204\n\tc0.003,0.004,0.007,0.008,0.01,0.012c0.063,0.095,0.138,0.18,0.213,0.263c0.025,0.026,0.043,0.06,0.07,0.086\n\tc0.001,0.001,0.002,0.001,0.003,0.002L32.08,41.712c0.895,0.896,2.346,0.896,3.241,0.002c0.896-0.896,0.896-2.348,0-3.242L26.85,30\n\th22.703c1.266,0,2.292-1.026,2.292-2.292C51.845,26.442,50.818,25.417,49.553,25.417z"}})])},[],!1,null,null,null);e.default=component.exports},function(n,e,r){"use strict";r.r(e),function(n){r.d(e,"getActualVersionAndroid",function(){return c}),r.d(e,"normalizeApplicationVersion",function(){return f}),r.d(e,"compareApplicationVersions",function(){return m}),r.d(e,"isApplicationVersionNewer",function(){return h}),r.d(e,"loadContentVersion",function(){return x});var o=r(0);r(1).get("interchat:app-updater.ts");let t=!1,l={},d=null;async function c(n,e,r=!1){return await v(n,e,r)}function f(n){return n&&"object"==typeof n&&(n=n.result&&n.result.version?n.result.version:n.version?n.version:""),(n||"").toString().replace(/^Ver\.\s*/i,"").replace(/[^\d.].*$/,"").trim()}function m(n,e){const r=f(n),o=f(e),t=r.split(".").map(n=>parseInt(n,10)||0),l=o.split(".").map(n=>parseInt(n,10)||0),d=Math.max(t.length,l.length);for(let n=0;n0?1:-1}return 0}function h(n,e){return!!f(n)&&!!f(e)&&m(n,e)>0}async function v(n,e,r){const t=e||"ksitalk";if(l[t]&&!r)return l[t];const{data:data}=await n.get("/applicationAndroidVersion/",{params:{brand:t,anticache:r?Date.now():void 0},headers:r?{"Cache-Control":"no-cache",Pragma:"no-cache"}:void 0});l[t]=data.result.version;let d=l[t];return o.a.log("Set actual application android version ",d),d}async function x(n,e,r){if(d&&!e)return d;const{data:data}=await n.get("/applicationContentVersion/",{params:{isDevice:r}});let t=data.result.version;return d=t,o.a.log("Set actual contnet version ",t),t}let k="1.17.4";let w=!1;e.default=function({app:e,store:r,redirect:l}){w||(w=!0,async function(n,e,r){try{if(o.a.log("/////////////////////////////////////"),o.a.log("//////////APP START//////////////////"),o.a.log("/////////////////////////////////////"),o.a.log("Content version = ",k),o.a.log("Socket host = ","https://ksitalk.com"),!await n.dispatch("platformDevice/isDevice",{}))return n.commit("SET_APP_UPDATE",{available:!1,version:null}),o.a.log("This is not device ignore app-updater");let l=n.getters["brand/brandName"],d=f(await v(e.$axios,l,!1));if(!d)return void n.commit("SET_APP_UPDATE",{available:!1,version:null});let c=f(await n.dispatch("platformDevice/versionGet",{}));o.a.log("Current version apk = ",c," actualVersion = ",d);const m=h(d,c);if(n.commit("SET_APP_UPDATE",{available:m,version:m?d:null}),!m)return o.a.log("Version same all ok");if(n.getters["Call/isActive"])return void o.a.warn("CALL_PUSH_TRACE app updater skip redirect during active call");if(t)return;o.a.log("redirect to page app update"),t=!0,r("/options/appupdate")}catch(e){n.commit("SET_APP_UPDATE",{available:!1,version:null}),o.a.error("error updater ",e)}}(r,e,l),async function(e,r){let t=await e.dispatch("platformDevice/isDevice",{});if(t)return o.a.log("Device build skips content update channel");let l=await x(r.$axios,!0,t);l&&(o.a.log("Current version content = ",k," actualVersion = ",l),k!=l&&("1"!=n.env.MODE_SERVICE?o.a.log("Web content version differs; skip forced /options/appupdate redirect (KT-0079)"):await e.dispatch("platformDevice/doPageReload",{})))}(r,e))}}.call(this,r(16))},,function(n,e,r){"use strict";r.r(e),r.d(e,"DownloadedFileKey",function(){return f}),r.d(e,"DownloadedFileRecordGet",function(){return h}),r.d(e,"DownloadedFileRecordSet",function(){return v}),r.d(e,"DownloadedFileRecordRemove",function(){return x});var o=r(53);r(1).get("interchat:fileTransfer:DownloadedFileStore.ts");const t="ksitalk-files",l=1,d="downloads";function c(n){return encodeURIComponent(String(n||""))}function f(n,e){let r=e&&e.crypto&&e.crypto.id?e.crypto.id:n,o=e&&e.name?e.name:"",t=e&&e.size?e.size:0;return"downloadedFile:"+c(r)+":"+c(o)+":"+t}function m(){return"undefined"==typeof indexedDB?Promise.resolve(null):new Promise((n,e)=>{const r=indexedDB.open(t,l);r.onupgradeneeded=()=>{const n=r.result;if(!n.objectStoreNames.contains(d)){const e=n.createObjectStore(d,{keyPath:"key"});e.createIndex("name","name",{unique:!1}),e.createIndex("savedAt","savedAt",{unique:!1})}},r.onsuccess=()=>n(r.result),r.onerror=()=>e(r.error)})}async function h(n){if(!n)return null;const e=await m();return e?new Promise((r,o)=>{const t=e.transaction(d,"readonly").objectStore(d).get(n);t.onsuccess=()=>r(t.result||null),t.onerror=()=>o(t.error)}):null}async function v(n){if(!n||!n.key)return;n.name&&n.path&&Object(o.DoFilePathSet)(n.name,n.path);const e=await m();return e?new Promise((r,o)=>{const t=e.transaction(d,"readwrite");t.objectStore(d).put(n),t.oncomplete=()=>r(),t.onerror=()=>o(t.error)}):void 0}async function x(n){if(!n)return;const e=await m();return e?new Promise((r,o)=>{const t=e.transaction(d,"readwrite");t.objectStore(d).delete(n),t.oncomplete=()=>r(),t.onerror=()=>o(t.error)}):void 0}},,,,,,,,,,,,,,,,,function(n,e,r){"use strict";(function(n){var o=r(45),t=r(44),l=r(98),d=r(46),c=r(28),f=r(10),m=r(5),h=r(13),v=r(75);r(1).get("interchat:back.vue");e.a={name:"back-layout",mixins:[v.a],components:{ActivatorInitial:t.default,Avatar:c.default,Alert:o.default,SvgBack:l.default,SvgMenu:d.default},head(){let head={title:this.brandName,bodyAttrs:{class:"bg-grey-lighter font-sans ",theme_name:this.themeName},htmlAttrs:{lang:this.$i18n.locale}};return head.bodyAttrs.class+=this.brandBodyClass,head},data:()=>({backPressed:!1,opponent:null,showMenuButton:!1,showBackButton:!0}),mounted(){"1"==n.env.MODE_SERVICE&&this.$nextTick(()=>{this.$router.replace(this.localePath("/integration"))})},destroyed(){},methods:{doBack(){m.b.$emit(m.a.NAVIGATE_BACK)},doHome(){this.$router.replace({path:this.localePath("/")})},doMenu(){m.b.$emit(m.a.LAYOUT_MENU_CLICK)}},computed:{...Object(f.c)({themeName:"themeName"}),...Object(f.c)("Users",{me:"mySelf"}),...Object(f.b)({online:"online",isBrandAnyTalk:"brand/isBrandAnyTalk",isBrandKsiTalk:"brand/isBrandKsiTalk",brandName:"brand/brandName"}),isThemeDark(){return this.themeName==h.o},meName(){let n=this.$auth.user?this.$auth.user.name:"";return n.length<=8?n:n.substr(0,8)+"*"},showMenu(){return this.showAvatar}}}}).call(this,r(16))},function(n,e,r){"use strict";(function(n){var o=r(45),t=r(44),l=r(190),d=r(132),c=r(10),f=r(46),m=r(28),h=r(99),v=r(75),x=r(5);r(1).get("interchat:loggedIn.vue");e.a={name:"loggedIn-layout",mixins:[v.a],head(){let head={title:this.brandName,bodyAttrs:{class:"bg-grey-lighter font-sans ",lang:this.$i18n.locale,theme_name:this.themeName},htmlAttrs:{lang:this.$i18n.locale}};return head.bodyAttrs.class+=this.brandBodyClass,head},data:()=>({appUpdateTimer:null}),components:{Avatar:m.default,ActivatorInitial:t.default,Alert:o.default,SvgGear:l.default,SvgMenu:f.default,SvgPersonAdd:d.default},computed:{...Object(c.b)({online:"online",unreadedMessagesCount:"unreadedMessagesCount",isBrandAnyTalk:"brand/isBrandAnyTalk",isBrandKsiTalk:"brand/isBrandKsiTalk",brandName:"brand/brandName"}),...Object(c.c)("Users",{me:"mySelf"}),...Object(c.c)({themeName:"themeName",appUpdateAvailable:"appUpdateAvailable",appUpdateVersion:"appUpdateVersion"}),updateTitle(){return this.appUpdateVersion?`Доступна версия ${this.appUpdateVersion}`:"Доступно обновление"}},mounted(){"1"==n.env.MODE_SERVICE&&this.$nextTick(()=>{this.$router.replace(this.localePath("/integration"))}),this.checkApplicationUpdateBadge(!0),this.appUpdateTimer=setInterval(()=>this.checkApplicationUpdateBadge(!1),6e5),this.syncApplicationBadge(this.unreadedMessagesCount)},watch:{unreadedMessagesCount(n){this.syncApplicationBadge(n)}},destroyed(){this.appUpdateTimer&&(clearInterval(this.appUpdateTimer),this.appUpdateTimer=null)},methods:{doMenu(){x.b.$emit(x.a.LAYOUT_MENU_CLICK)},goAppUpdate(){this.$router.push(this.localePath("/options/appupdate"))},normalizeVersion:n=>Object(h.normalizeApplicationVersion)(n),async checkApplicationUpdateBadge(n){try{if(!await this.$store.dispatch("platformDevice/isDevice",{}))return void this.$store.commit("SET_APP_UPDATE",{available:!1,version:null});const e=this.$store.getters["brand/brandName"],r=this.normalizeVersion(await Object(h.getActualVersionAndroid)(this.$axios,e,n)),o=this.normalizeVersion(await this.$store.dispatch("platformDevice/versionGet",{})),t=Object(h.isApplicationVersionNewer)(r,o);this.$store.commit("SET_APP_UPDATE",{available:t,version:t?r:null})}catch(n){this.$store.commit("SET_APP_UPDATE",{available:!1,version:null})}},syncApplicationBadge(n){this.$store.dispatch("platformDevice/setBadgeCount",{count:n})}}}}).call(this,r(16))},function(n,e,r){"use strict";(function(n){var o=r(0),t=r(17),l=r(9),d=r(60),c=r.n(d),f=r(52),m=r(457),h=r.n(m),v=r(8),x=r(61);r(1).get("interchat:fileTransfer:FileDownloading.vue");var k=function(n,e,r,desc){var o,t=arguments.length,l=t<3?e:null===desc?desc=Object.getOwnPropertyDescriptor(e,r):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(n,e,r,desc);else for(var i=n.length-1;i>=0;i--)(o=n[i])&&(l=(t<3?o(l):t>3?o(e,r,l):o(e,r))||l);return t>3&&l&&Object.defineProperty(e,r,l),l};let w=class extends v.d{constructor(){super(...arguments),this.progress=0,this.progressMax=0,this.blobStream=null}beforeDestroy(){this.doAbort()}get progressPercent(){return this.progressMax?this.progress/this.progressMax:0}get progressPercentString(){return(100*this.progressPercent).toFixed(2)}get fileSizeString(){return this.fileInfo?Object(f.a)(this.fileInfo.size):""}get progressMemoryString(){return Object(f.a)(this.progress)}mounted(){this.onFileChange()}async doDownload(){if(!this.fileInfo)return;let e=this.fileInfo,r=c.a.createStream(),d={size:e.size,name:e.name};if(e.crypto&&(d.name=e.crypto.id,d.size+=e.crypto.extraSize),o.a.log("start download ",d),c()(l.a).emit(t.a.FILE_DOWNLOAD_STREAM,r,d,(n,e)=>{if(n)return o.a.error("pipe download error ",n),this.doAbort()}),this.blobStream=r,!this.blobStream)return;this.progressMax=e.size,this.progress=0,this.blobStream.on("end",()=>{this.blobStream=null}),this.blobStream.on("abort",()=>{this.doAbort()}),this.blobStream.on("data",async n=>{this.progress+=n.length});let f=h()(async content=>{let n=new Blob([content]),r=await this.$store.dispatch("platformDevice/onFileDownload",{fileName:e.name,fileSize:e.size,fileContent:n});this.doFinish(n,r)});if(e.crypto){Object(x.setPassword)(n.from(e.crypto.key,"hex"));let r=Object(x.createDecryptStream)(f);this.blobStream.pipe(r)}else this.blobStream.pipe(f)}onFileChange(){this.doAbort(),this.fileInfo&&this.doDownload()}doAbort(){this.progressMax=0,this.progress=0,this.blobStream&&(this.blobStream.unpipe(),this.blobStream.destroy(),this.blobStream=null,this.$emit("abort"))}doFinish(n,e=null){this.progressMax=0,this.progress=0,this.blobStream=null,this.$emit("finish",n,e)}};k([Object(v.b)()],w.prototype,"fileInfo",void 0),k([Object(v.e)("file")],w.prototype,"onFileChange",null),w=k([Object(v.a)({})],w),e.a=w}).call(this,r(12).Buffer)},function(n,e,r){"use strict";(function(n){var o=r(0),t=r(17),l=r(9),d=r(60),c=r.n(d),f=r(52),m=r(8),h=r(61),v=r(206);r(1).get("interchat:fileTransfer:FileSending.vue");var x=function(n,e,r,desc){var o,t=arguments.length,l=t<3?e:null===desc?desc=Object.getOwnPropertyDescriptor(e,r):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(n,e,r,desc);else for(var i=n.length-1;i>=0;i--)(o=n[i])&&(l=(t<3?o(l):t>3?o(e,r,l):o(e,r))||l);return t>3&&l&&Object.defineProperty(e,r,l),l};let k=class extends m.d{constructor(){super(...arguments),this.progress=0,this.progressMax=0,this.blobStream=null,this.crypto=null}beforeDestroy(){this.doAbort()}get progressPercent(){return this.progressMax?this.progress/this.progressMax:0}get progressPercentString(){return(100*this.progressPercent).toFixed(2)}get fileSizeString(){return this.file?Object(f.a)(this.file.size):""}get progressMemoryString(){return Object(f.a)(this.progress)}mounted(){this.onFileChange()}generateCryptoData(){return{id:Object(v.a)(),key:Object(h.generatePassword)().toString("hex"),extraSize:16,algorithm:"aes-256-ctr"}}async doSend(){let e=this.file;if(!e)return;o.a.log("file.webkitRelativePath = ",e.webkitRelativePath),this.crypto=this.generateCryptoData();let r=c.a.createStream({highWaterMark:204800,decodeStrings:!1}),d={size:e.size,name:e.name};this.crypto&&(d.name=this.crypto.id,d.size+=this.crypto.extraSize),c()(l.a).emit(t.a.FILE_UPLOAD_STREAM,r,d,(n,r)=>{if(n)return o.a.error("pipe error ",n),alert("File send failed with error"),this.doAbort();e&&this.doFinish(e,this.crypto)}),this.blobStream=c.a.createBlobReadStream(e,{highWaterMark:204800}),this.blobStream&&(this.progressMax=1.05*e.size,this.progress=0,this.blobStream.on("data",n=>{this.progress+=n.length}),this.blobStream.on("end",()=>{this.blobStream=null}),this.blobStream.on("abort",()=>{this.doAbort()}),this.crypto?(Object(h.setPassword)(n.from(this.crypto.key,"hex")),Object(h.createEncryptStream)(this.blobStream).pipe(r)):this.blobStream.pipe(r))}onFileChange(){this.doAbort(),this.file&&this.doSend()}doAbort(){this.progressMax=0,this.progress=0,this.blobStream&&(this.blobStream.destroy(),this.blobStream=null,this.$emit("abort"))}doAbortBtn(){this.doAbort(),this.$emit("abort")}doFinish(n,e){this.progressMax=0,this.progress=0,this.blobStream=null,this.$emit("finish",n,e)}};x([Object(m.b)()],k.prototype,"file",void 0),x([Object(m.e)("file")],k.prototype,"onFileChange",null),k=x([Object(m.a)({})],k),e.a=k}).call(this,r(12).Buffer)},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:fileTransfer:FilePreview.vue");var o=r(8);r(1).get("interchat:fileTransfer:FilePreview.vue");var t=function(n,e,r,desc){var o,t=arguments.length,l=t<3?e:null===desc?desc=Object.getOwnPropertyDescriptor(e,r):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(n,e,r,desc);else for(var i=n.length-1;i>=0;i--)(o=n[i])&&(l=(t<3?o(l):t>3?o(e,r,l):o(e,r))||l);return t>3&&l&&Object.defineProperty(e,r,l),l};let l=class extends o.d{constructor(){super(...arguments),this.previewSrc=null}get fileName(){return this.file?this.file.name:this.file_name}get isNameImage(){return/\.(jpe?g|png|gif|webp|bmp)$/i.test(this.fileName)}onFileChanged(){this.updateImagePreview()}onFileNameChanged(){this.updateImageContent()}onFileContentChanged(){this.updateImageContent()}mounted(){this.updateImagePreview(),this.updateImageContent()}setPreviewSrc(n){this.$nextTick(()=>{let e=this.$refs.previewImg;e&&(this.previewSrc=n,n&&(e.src=n,this.$emit("resize")))})}updateImageContent(){this.fileContentBase64&&(this.isNameImage?this.setPreviewSrc(this.fileContentBase64):this.setPreviewUnknownFile())}updateImagePreview(){if(!this.file)return;let n=this.file;if(!this.isNameImage)return this.setPreviewUnknownFile();try{let e=new FileReader;e.addEventListener("load",()=>{this.setPreviewSrc(e.result)},!1),e.readAsDataURL(n)}catch(n){return this.setPreviewUnknownFile()}}setPreviewUnknownFile(){this.setPreviewSrc(void 0)}};t([Object(o.b)()],l.prototype,"file",void 0),t([Object(o.b)()],l.prototype,"fileContentBase64",void 0),t([Object(o.b)()],l.prototype,"file_name",void 0),t([Object(o.b)({default:!1})],l.prototype,"hideFileName",void 0),t([Object(o.e)("file")],l.prototype,"onFileChanged",null),t([Object(o.e)("file_name")],l.prototype,"onFileNameChanged",null),t([Object(o.e)("fileContentBase64")],l.prototype,"onFileContentChanged",null),l=t([Object(o.a)({})],l);var d=l,c=(r(784),r(4)),component=Object(c.a)(d,function(){var n=this,e=n._self._c;n._self._setupProxy;return n.file||n.fileContentBase64?e("div",{staticClass:"file-listing flex flex-col justify-center text-center items-center"},[e("img",{directives:[{name:"show",rawName:"v-show",value:n.previewSrc,expression:"previewSrc"}],ref:"previewImg",staticClass:"preview max-w-full max-h-screen imageOrientation",attrs:{src:r(302)}}),n._v(" "),e("img",{directives:[{name:"show",rawName:"v-show",value:!n.previewSrc,expression:"!previewSrc"}],staticClass:"previewDefault",attrs:{src:r(302)}}),n._v(" "),n.hideFileName?n._e():e("p",{staticClass:"text-message"},[n._v(n._s(n.fileName))])]):n._e()},[],!1,null,"ded779b8",null);e.default=component.exports},function(n,e,r){"use strict";r.d(e,"a",function(){return o});r(1).get("interchat:tools:BlobtoBase64.ts");function o(n){const e=new FileReader;return e.readAsDataURL(n),new Promise((n,r)=>{e.onloadend=()=>{"string"==typeof e.result?n(e.result):r()},e.onabort=()=>{r()}})}},,function(n,e,r){"use strict";r.d(e,"a",function(){return t});r(23);var o=r(0);r(1).get("interchat:webrtc:WebRtcConnection.ts");class t{constructor(n,e){this.config=n,this.isNegotiating=!1,this.isNegotiatingNeedRestart=!1,this.negotiationRestartCount=0,this.reinitAttemptsLeft=0,this.reinitAttemptsMax=0,this.master=!!e}setReinitAttempts(n){this.reinitAttemptsMax=n,this.reinitAttemptsLeft=this.reinitAttemptsMax}setMaster(n){this.master=n}isInited(){return!!this.connection}init(){if(this.connection)return o.a.warn("connection already inited");this.initConnection()}initConnection(){if(this.connection)throw new Error("peerConnection already inited!");o.a.trace("Creating peer connection");let n=new RTCPeerConnection(this.config);return n.onicecandidate=this.onIceCandidate.bind(this),n.onnegotiationneeded=this.onNegotiationNeeded.bind(this),n.onconnectionstatechange=this.onConnectionStateChange.bind(this),n.onicegatheringstatechange=this.onIceGatheringStateChange.bind(this),n.onicecandidateerror=this.onIceCandidateError.bind(this),n.onsignalingstatechange=this.onSignalingStateChange.bind(this),n.onstatsended=this.onStatsEnded.bind(this),this.connection=n,n}destroyConnection(){this.connection&&(this.connection.close(),this.connection=void 0),this.onClosed()}onClosed(){}doClose(){o.a.debug("Connection close:"),this.destroyConnection()}onSignalingStateChange(n){if(this.connection&&(o.a.debug("onSignalingStateChange :",n,"signalingState = ",this.connection.signalingState),this.isNegotiating="stable"!=this.connection.signalingState,!this.isNegotiating))if(this.isNegotiatingNeedRestart){if(o.a.log("Run restart negotiation after state stable"),this.negotiationRestartCount++,this.negotiationRestartCount>3)return this.isNegotiatingNeedRestart=!1,this.negotiationRestartCount=0,void o.a.warn("Too many continues negotiations ");this.doNegotiationStart()}else this.negotiationRestartCount=0}onStatsEnded(n){this.connection&&o.a.debug("onStatsEnded :",n)}onConnectionStateChange(n){if(!this.connection)return;let e=this.connection.connectionState;o.a.debug("Connection state :",e),"failed"==e?this.reinitAttemptsLeft<=0?this.doClose():(this.reinitAttemptsLeft--,o.a.debug("restart negotiation reinitAttemptsLeft = ",this.reinitAttemptsLeft),this.doNegotiationRestart()):"connected"==e&&(this.reinitAttemptsLeft=this.reinitAttemptsMax),this.onConnectionStateChangeEvent(n)}onConnectionStateChangeEvent(n){}onIceGatheringStateChange(n){this.connection&&o.a.debug("on Ice Gathering State Change :",this.connection.iceGatheringState)}onIceCandidateError(n){this.connection&&o.a.debug("onIceCandidateError :",n)}onNegotiationNeeded(n){o.a.debug("onNegotiationNeeded",n),this.doNegotiationStart(n)}isIceCandidateOk(n){return!0}async onIceCandidate(n){if(n.candidate){if(!this.isIceCandidateOk(n.candidate))return;await this.doSignalSend({type:"candidate",candidate:n.candidate.toJSON()})}else o.a.debug("End of candidates.")}async doSignalSend(data){this.onSignalSend&&await this.onSignalSend(data)}onSignalReceive(data){if(!this.connection)return;let n=data.type;"offer"===n?this.signalReceiveOffer(data):"answer"===n?this.signalReceiveAnswer(data):"candidate"===n?this.signalReceiveICECandidate(data):"negotiation"===n?this.signalReceiveNegotiation(data):o.a.warn("Ignore unknown signal message",data)}async signalReceiveOffer(n){if(!this.connection)return;let e=new RTCSessionDescription(n);if("offer"==e.type&&"stable"!=this.connection.signalingState){if(this.master)return;await Promise.all([this.connection.setLocalDescription({type:"rollback"}),this.connection.setRemoteDescription(e)])}else await this.connection.setRemoteDescription(e);if("offer"==e.type){let n=await this.connection.createAnswer();await this.connection.setLocalDescription(n),o.a.debug("Sending answer message",n),o.a.debug("Sending answer to peer."),await this.doSignalSend(n)}}async signalReceiveAnswer(n){this.connection&&(o.a.debug("Receive negotiation answer: ",n),await this.connection.setRemoteDescription(new RTCSessionDescription(n)))}async signalReceiveICECandidate(n){if(this.connection){o.a.debug("Receive ICE Candidate");var e=new RTCIceCandidate(n.candidate);this.connection.addIceCandidate(e)}}async signalReceiveNegotiation(n){o.a.log("signalReceiveNegotiation "),this.connection&&this.master&&(o.a.log("signalReceiveNegotiation on master"),this.doNegotiationStart())}async doNegotiationStart(n,e){if(o.a.debug("NegotiationStart, event = ",n," option =",e),this.connection){if(this.isNegotiating)return this.isNegotiatingNeedRestart=!0,o.a.warn("negotiation already in progress! Try run later");if(this.isNegotiatingNeedRestart=!1,!this.master)return o.a.debug("Ask negotiation to master"),void await this.doSignalSend({type:"negotiation"});this.isNegotiating=!0;try{let n=await this.connection.createOffer(e);if("stable"!=this.connection.signalingState)return void o.a.log("Current signalingState after createOffer = ",this.connection.signalingState,"cancel negotiation");await this.connection.setLocalDescription(n),await this.doSignalSend(n)}catch(n){throw o.a.warn("createOffer() error: ",n),n}}}async doNegotiationRestart(n){return this.doNegotiationStart(n,{iceRestart:!0})}}},function(n,e,r){"use strict";r.d(e,"a",function(){return o});r(184);r(1).get("interchat:streamMixer");class o{constructor(){this.audioSources=[],this.audioContext=null,this.audioDestination=null,this.gainNode=null}release(){this.audioSources.forEach(function(source){source.disconnect()}),this.audioSources=[],this.audioDestination&&(this.audioDestination.disconnect(),this.audioDestination=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.audioContext&&(this.audioContext.close(),this.audioContext=null)}initContext(){this.audioContext&&this.release();var n=window.AudioContext||window.webkitAudioContext;this.audioContext=new n}getMixedAudioStream(n,e){if(e=e||{},!n.length)return null;if(1==n.length&&!e.forceSingle)return n[0];this.initContext(),this.audioSources=[],this.audioDestination=this.audioContext.createMediaStreamDestination();let r=this.audioDestination;return e.useGain&&(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioDestination),this.setGain(1),r=this.gainNode),n.forEach(n=>{if(!n.getTracks().filter(n=>"audio"===n.kind).length)return;let e=this.audioContext.createMediaStreamSource(n);e.connect(r),this.audioSources.push(e)}),this.audioDestination.stream}setGain(n){this.gainNode&&(this.gainNode.gain.value=n)}}},,function(n,e,r){"use strict";r.r(e),r.d(e,"GoToMenuUser",function(){return m});r(1).get("interchat:users:index.vue");r(0);var o=r(49),t=r(10),l=(r(5),r(73)),d=r(472),c=r(82),f=r(25);r(1).get("interchat:users:index.vue");function m(n){return{path:"/users/",query:{userId:n}}}var h={name:"user-settings",middleware:["auth"],layout:"back",components:{},transition:o.a,data:()=>({userId:null}),computed:{...Object(t.b)({online:"online"}),...Object(t.c)("Users",{users:"users"}),user(){return this.userId&&this.users?this.users[this.userId]:null},userNumber(){return Object(f.d)(this.user)}},created(){this.userId=this.$route.query.userId,this.$parent.$emit("update:opponent",this.user),this.$parent.$emit("update:showMenuButton",!1)},methods:{doRename(){this.$router.push(Object(d.GoToUserEdit)(this.userId))},async doDelete(){let n=this.user;!0===confirm(this.$t("Are you sure you want remove the conversation with")+" "+this.userNumber+"?")&&(await this.$store.dispatch("sendConversationDeleteWith",n.id),this.doExit())},async getConversationByUserId(n){return await this.$store.dispatch("getConversationIdByOpponentId",{opponentId:n})},async doClearHistory(){if(confirm(this.$t("Remove all messages"))){let n=await this.getConversationByUserId(this.user.id);await this.$store.dispatch("sendConversationClean",n),this.doChat()}},doExit(){this.$router.replace(this.localePath("/"))},doBack(){this.$router.go(-1)},doChat(){this.$router.push(Object(l.GoToChatWithUser)(this.userId))},async doCallVideo(){confirm(this.$t("Do you want start video call with user",{name:this.userNumber}))&&await this.doCall(!0)},async doCallAudio(){confirm(this.$t("Do you want start audio call user",{name:this.userNumber}))&&await this.doCall(!1)},async doCall(n){await Object(c.doStartCallSingle)(this.$store.dispatch,this.userId,n)}},watch:{user(n){this.$parent.$emit("update:opponent",this.user)}}},v=r(4),component=Object(v.a)(h,function(){var n=this,e=n._self._c;return e("div",{staticClass:"container border-t flex flex-1 h-full"},[n.user?e("div",{staticClass:"w-full h-full flex flex-col items-center"},[e("h1",{staticClass:"font-hairline my-3 text-center"},[n._v(n._s(n.$t("User options",{name:n.userNumber})))]),n._v(" "),e("button",{staticClass:"btn bg-green-light my-3 w-1/2",on:{click:n.doCallAudio}},[n._v(n._s(n.$t("Call Audio")))]),n._v(" "),e("button",{staticClass:"btn bg-green-light my-3 w-1/2",on:{click:n.doCallVideo}},[n._v(n._s(n.$t("Call Video")))]),n._v(" "),e("div",{staticClass:"my-3"}),n._v(" "),e("button",{staticClass:"btn bg-green-light my-3 w-1/2",on:{click:n.doRename}},[n._v(n._s(n.$t("Rename")))]),n._v(" "),e("div",{staticClass:"my-3"}),n._v(" "),e("button",{staticClass:"btn bg-yellow my-3 w-1/2",on:{click:n.doClearHistory}},[n._v(n._s(n.$t("Clear history")))]),n._v(" "),e("button",{staticClass:"btn bg-red-light my-3 w-1/2",on:{click:n.doDelete}},[n._v(n._s(n.$t("Delete")))]),n._v(" "),e("div",{staticClass:"my-3"})]):n._e()])},[],!1,null,null,null);e.default=component.exports},,function(n,e,r){"use strict";r.r(e);r(1).get("interchat:messages:MessageActionMenu.vue");r(1).get("interchat:messages:MessageActionMenu.vue");var o={props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},subtitle:{type:String,default:""},actions:{type:Array,default:()=>[]}}},t=(r(762),r(4)),component=Object(t.a)(o,function(){var n=this,e=n._self._c;return n.visible?e("div",{staticClass:"message-action-menu",on:{click:function(e){return e.target!==e.currentTarget?null:n.$emit("close")}}},[e("div",{staticClass:"message-action-menu__panel",on:{click:function(n){n.stopPropagation()}}},[e("button",{staticClass:"message-action-menu__close",attrs:{type:"button"},on:{click:function(e){return n.$emit("close")}}},[n._v("x")]),n._v(" "),e("div",{staticClass:"message-action-menu__title",domProps:{textContent:n._s(n.title)}}),n._v(" "),n.subtitle?e("div",{staticClass:"message-action-menu__subtitle",domProps:{textContent:n._s(n.subtitle)}}):n._e(),n._v(" "),e("div",{staticClass:"message-action-menu__actions"},n._l(n.actions,function(r){return e("button",{key:r.id,staticClass:"message-action-menu__button",attrs:{type:"button"},domProps:{textContent:n._s(r.label)},on:{click:function(e){return n.$emit("action",r.id)}}})}),0)])]):n._e()},[],!1,null,"1b60946a",null);e.default=component.exports},function(n,e,r){"use strict";r.r(e),r.d(e,"CRYPT_STORE_KEY_NAME_CONTACT_LIST",function(){return T}),r.d(e,"state",function(){return U}),r.d(e,"getters",function(){return j}),r.d(e,"mutations",function(){return z}),r.d(e,"actions",function(){return K});var o=r(0),t=r(9),l=r(55),d=r.n(l);r(1).get("interchat:EncryptRSA");const c="pkcs8-public-pem",f="base64",m="base64";d.a.prototype.validateKeyPair=function(){const text="Hello RSA!",n=this.sign(text,f);if(!this.verify(text,n,void 0,f))throw new Error("Rsa key pair is not match")},d.a.prototype.importKeyJson=function(n){if(!n)throw new Error("Failed build key. ata is null");this.importKey(n.body,n.format)},d.a.prototype.exportKeyJson=function(n){return{body:this.exportKey(n),format:n}},d.a.prototype.comparePublicKey=function(n){return n&&n.body==this.exportKey(n.format)};class h{constructor(){this.key=null}isActivated(){return null!=this.key}static buildPublicKey(n){let e=new d.a;return e.importKeyJson(n),e}encryptMessage(n,e){return{body:e.encrypt(n,m),sign:this.key.sign(n,f)}}encryptMessageSelf(n){return this.encryptMessage(n,this.key)}decryptMessage(n,e){if(!n||!n.body||!n.sign)throw new Error("Bad message object");const text=this.key.decrypt(n.body,null,m);if(!e.verify(text,n.sign,void 0,f))throw new Error("Sign check fail");return text}decryptMessageSelf(n){return this.decryptMessage(n,this.key)}comparePublicKey(n){return this.key.comparePublicKey(n)}initNew(){this.__setKey(new d.a({b:"1024"}))}import(n){let e=new d.a;e.importKeyJson(n.public),e.importKeyJson(n.private),this.__setKey(e)}export(){if(!this.isActivated())throw new Error("Can not export not inited rsa");return{public:this.key.exportKeyJson(c),private:this.key.exportKeyJson("pkcs8-private-pem")}}exportPublicKey(){return this.key.exportKeyJson(c)}static __makeRsaKeySerialized(body,n){return{body:body,format:n}}__setKey(n){n.validateKeyPair(),this.key=n}}r(1).get("interchat:EncryptStore");var v=r(752);const x="GOOD";class k{constructor(){this.isOk=!1,this.store=null,this.passphrase=""}initStoreNew(n){this.passphrase=n,this.store=k.buildStore(),this.isOk=!0}initStore(n,e){this.passphrase=n,this.store=k.decryptStore(this.passphrase,e),this.isOk=!0}static encryptStore(n,e){if(!k.checkValid(e))throw new Error("Validation failed");return v.encrypt(n,JSON.stringify(e))}static decryptStore(n,e){let data=v.decrypt(n,e),r=JSON.parse(data);if(!k.checkValid(r))throw new Error("Validation failed");return r}static checkValid(n){return!(!n||!n.head)&&("1.0"==n.head.v&&n.head.mark==x)}static buildStore(){return{head:{mark:x,v:"1.0"},payload:{}}}getEncrypted(){return k.encryptStore(this.passphrase,this.store)}get payload(){return this.store.payload}set payload(n){this.store.payload=n}setItem(n,e){this.store.payload[n]=e}getItem(n,e){return this.store.payload[n]}}var w=r(454),main=r(455),y=r(11),S=r(13);r(1).get("interchat:cryptBackup.ts");const _="ksitalk-crypt-backup-plain";function C(n){return`ksitalk-key-${String(n||"user").replace(/[^a-zA-Z0-9_-]/g,"_")}.backup`}function E(n){if(!n)return null;let e=n;if("string"==typeof n)try{e=JSON.parse(n)}catch(n){return null}if(!e||e.type!=_||!e.payload)return null;let r=e.payload;return r.passphrase&&r.storeData?{passphrase:r.passphrase,storeData:r.storeData}:null}r(1).get("interchat:crypt.ts");const I=parseInt("16"),A=!0,T="contactList";function O(n){return n+":passphrase"}function N(n,e,r){return n+":chat:"+e+":msg:"+r}function R(n){return localStorage.getItem(O(n))}function M(n,e){localStorage.setItem(O(n),e)}var D=new h,L=new k;function P(n,e){(new k).initStore(n,e)}const U=()=>({isOk:!1,passphrase:"",failRsa:!1,failStore:!1,publicKey:null,userId:null,username:"",storeEmpty:!1,cloudBackupEnabled:Object(S.h)(S.a.CRYPTO_CLOUD_BACKUP),fileBackupStatus:"не проверена"}),j={enable:n=>A,isOk:n=>n.isOk,isStoreFail:n=>n.failStore,alertFlag:n=>!n.isOk,passphrase:n=>n.passphrase,isStoreEmpty:n=>n.storeEmpty,cloudBackupEnabled:n=>n.cloudBackupEnabled,fileBackupStatus:n=>n.fileBackupStatus},z={RESET(n,e){n.isOk=!1,n.passphrase="",n.failRsa=!1,n.failStore=!1,n.storeEmpty=!1,e&&(n.publicKey=null,n.userId=null)},SET_PASSPHRASE(n,e){n.passphrase=e},SET_IS_OK(n,e){n.isOk=e},SET_FAIL_RSA(n,e){n.failStore=e},SET_STORE_EMPTY(n,e){n.storeEmpty=e},SET_CLOUD_BACKUP_ENABLED(n,e){n.cloudBackupEnabled=e},SET_FILE_BACKUP_STATUS(n,e){n.fileBackupStatus=e||"не проверена"},SET_FAIL_STORE(n,e){n.failStore=e},SET_USER_INFO(n,{user:e}){n.publicKey=e.publicKey,n.userId=e.id,n.username=e.username||e.name||String(e.id||"")}};function F({state:n,commit:e,dispatch:r},t){if(o.a.debug("Store start decrypt data"),e("SET_FAIL_STORE",!0),e("SET_STORE_EMPTY",!1),!n.userId)throw new Error("User id not set");let l=R(n.userId);if(e("SET_PASSPHRASE",l),!l||""==l)throw new Error("Passphrase empty");if(!t)throw e("SET_STORE_EMPTY",!0),new Error("Store not inited");if((L=new k).initStore(l,t),!L.isOk)throw new Error("Store init failed unknown reason");return e("SET_FAIL_STORE",!1),o.a.debug("Store decrypted"),L}function B({state:n,commit:e,dispatch:r},t){if(e("SET_FAIL_RSA",!0),(D=new h).import(t.getItem("rsa")),!D.isActivated())throw new Error("RSA key corrupted!");return o.a.debug("RSA key imported"),e("SET_FAIL_RSA",!1),D}function $(n){return n.username||String(n.userId||"user")}function V(n,e){if(!n||!e)return!1;try{return P(n,e),!0}catch(n){return!1}}function G(n,data={}){try{o.a.log("CRYPT_TRACE",n,data)}catch(n){}}function H(n){let text="";try{text="string"==typeof n?n:JSON.stringify(n)}catch(e){text=String(n||"")}let e=0;for(let i=0;iw(I,!0)+main.generate({length:I,numbers:!0,symbols:!1,lowercase:!1,uppercase:!1}),decryptMessage({state:n},{message:e,opponent:r}){if(!n.isOk)return e;let t=(l=this.$auth.user.id,d=e.conversationId,c=e._id,localStorage.getItem(N(l,d,c)));var l,d,c;if(t)return e.body=t,e.isSecure=!0,e;if(e.isSecure=!1,!e.cryptoData||!e.cryptoData.encryptDest||!e.cryptoData.encryptDest.body)return e;try{if(e.author==this.$auth.user.id)e.body=D.decryptMessageSelf(e.cryptoData.encryptSrc).toString(),e.isSecure=!0;else if(r&&r.publicKey&&r.publicKey.body){let n=h.buildPublicKey(r.publicKey);e.body=D.decryptMessage(e.cryptoData.encryptDest,n).toString(),e.isSecure=!0}}catch(n){o.a.warn("decryptMessage error",n),e.body="decryption fails"}return e.isSecure&&function(n,e,r,o){localStorage.setItem(N(n,e,r),o)}(this.$auth.user.id,e.conversationId,e._id,e.body),e},async encryptMessage({state:n,dispatch:e},{message:r,opponent:t}){if(r.isSecure=!1,G("encryptMessage:start",{isOk:n.isOk,userId:n.userId,opponentId:t&&t.id,hasOpponentPublicKey:!!(t&&t.publicKey&&t.publicKey.body)}),!n.isOk)try{await e("importAll",{})}catch(n){G("encryptMessage:importAll:error",n),o.a.warn("Encrypt store auto import before send failed",n)}if(!n.isOk)throw G("encryptMessage:notReady"),new Error("Защитный ключ ещё не готов. Попробуйте отправить сообщение ещё раз.");if(!t.publicKey||!t.publicKey.body)throw new Error("У собеседника ещё не готов защитный ключ. Сообщение пока нельзя отправить.");let l=null;try{l=h.buildPublicKey(t.publicKey)}catch(n){throw n}let d=D.encryptMessage(r.body,l),c=D.encryptMessageSelf(r.body);return r.cryptoData={encryptDest:d,encryptSrc:c,recipientPublicKey:{body:t.publicKey.body,format:t.publicKey.format}},r.body="crypted:"+Date.now().toString(36)+":"+Math.random().toString(36).slice(2,8),r.isSecure=!0,r},async storeItemGet({},{name:n}){if(!L||!L.isOk)throw new Error("Encrypted storage not inited");return L.getItem(n)},async storeItemSet({dispatch:n},{name:e,value:r,commit:o=!1}){if(!L||!L.isOk)throw new Error("Encrypted storage not inited");L.setItem(e,r),o&&await n("storeCommit")},async storeCommit({dispatch:n}){let e=L.getEncrypted();P(L.passphrase,e),await n("commitStore",{body:e})}}},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:svg:PersonAdd.vue");var o=r(4),component=Object(o.a)({},function(){var n=this,e=n._self._c;return e("svg",{attrs:{version:"1.1",x:"0px",y:"0px",height:"1.5rem",viewBox:"0 0 70.87 56.69","enable-background":"new 0 0 70.87 56.69","xml:space":"preserve"}},[e("g",[e("path",{attrs:{fill:"none",stroke:"#010101","stroke-width":"6","stroke-miterlimit":"10",d:"M50.931,51.416\n\t\t\t\tc0-12.357-10.018-20.375-22.375-20.375S6.181,39.059,6.181,51.416l0,0H50.931L50.931,51.416z"}}),n._v(" "),e("circle",{attrs:{fill:"none",stroke:"#010101","stroke-width":"6","stroke-miterlimit":"10",cx:"28.056",cy:"18.542",r:"12.5"}}),n._v(" "),e("path",{attrs:{fill:"#010101",d:"M64.806,11.417h-6.125V5.292c0-1.312-1.063-2.375-2.375-2.375s-2.375,1.063-2.375,2.375v6.125h-6.125\n\t\t\t\tc-1.312,0-2.375,1.063-2.375,2.375s1.063,2.375,2.375,2.375h6.125v6.125c0,1.312,1.063,2.375,2.375,2.375\n\t\t\t\ts2.375-1.063,2.375-2.375v-6.125h6.125c1.312,0,2.375-1.063,2.375-2.375S66.117,11.417,64.806,11.417z"}})])])},[],!1,null,null,null);e.default=component.exports},,function(n,e,r){"use strict";r.r(e);r(1).get("interchat:UserListSelect.vue");var o=r(10),t=r(3),l=r(28);r(1).get("interchat:UserListSelect.vue");var d={name:"user-list-select",components:{avatar:l.default},props:{buttonDoneCaption:String,multi:{type:Boolean,default:!0}},data:()=>({filterText:"",selectedUsersId:{}}),computed:{selectedCount(){return Object.keys(this.selectedUsersId).length},filteredUsers(){return""===this.filterText?this.sortedUsers:Object.keys(this.sortedUsers).reduce(this.filterByUsername,{})},...Object(o.b)({sortedUsers:"Users/sortedUsers"}),...Object(o.c)("Users",{users:"users"})},methods:{isSelected(n){return this.selectedUsersId[n.id]},select(n){let e=this.isSelected(n);this.multi||(this.selectedUsersId={}),e?t.default.delete(this.selectedUsersId,n.id):t.default.set(this.selectedUsersId,n.id,1)},async done(){this.$emit("done",{selectedUsersId:this.selectedUsersId})},filterByUsername(n,e){return this.users[e].name.includes(this.filterText)&&(n[e]=this.users[e]),n}}},c=r(4),component=Object(c.a)(d,function(){var n=this,e=n._self._c;return e("div",{staticClass:"user_list_container border rounded flex flex-1 flex-col h-full overflow-hidden"},[e("div",{staticClass:"p-2 border-b"},[e("button",{staticClass:"btn bg-green w-full",attrs:{disabled:0==n.selectedCount},on:{click:n.done}},[n._v(n._s(this.buttonDoneCaption))])]),n._v(" "),e("div",{staticClass:"search p-2 border-b"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.filterText,expression:"filterText"}],staticClass:"input-control",attrs:{type:"text",placeholder:n.$t("Search")},domProps:{value:n.filterText},on:{input:function(e){e.target.composing||(n.filterText=e.target.value)}}})]),n._v(" "),e("div",{staticClass:"users app-height flex flex-1 h-full overflow-hidden",attrs:{"data-v-bar":""}},[e("div",{staticClass:"user-list-class"},n._l(n.filteredUsers,function(r){return e("div",{key:r.id,class:["flex items-center cursor-pointer text-sm text-dark-softner border-b p-2",n.isSelected(r)?"bg-grey-lighter":""],on:{click:function(e){return n.select(r)}}},[e("UserBadge",{staticClass:"py-2 ml-2",attrs:{user:r}}),n._v(" "),n._m(0,!0),n._v(" "),e("div",{staticClass:"flex items-center justify-end"},[e("button",{class:["btn inline-flex items-center",n.isSelected(r)?"btn-green":"bg-white"],on:{click:function(e){return e.stopPropagation(),e.preventDefault(),n.select(r)}}},[n._v(n._s(n.isSelected(r)?n.$t("dismis"):n.$t("select")))])])],1)}),0)])])},[function(){var n=this._self._c;return n("div",{staticClass:"py-2 mx-2 flex-1"},[n("div",{staticClass:"w-full text-center"})])}],!1,null,null,null);e.default=component.exports;installComponents(component,{UserBadge:r(208).default})},function(n,e,r){n.exports=r.p+"img/bg.65876e4.jpg"},function(n,e,r){"use strict";r.r(e);r(1).get("interchat:Chat.vue");var o=r(186),t=r(187),l=r(134),d=r(10),c=(r(188),r(5)),f=r(0),m=r(480),h=r(128),v=r(82),x=r(85);r(1).get("interchat:Chat.vue");var k={name:"chat",components:{ChatNewMessage:o.default,ChatMessage:t.default,UserListSelect:l.default,svgCall:m.default},data:()=>({showLimit:20,lastMessageId:null,ignoreScroll:!1,scrolledBottom:!1,forwardMessageText:null,messageInputFocused:!1,keyboardVisible:!1,keyboardOffset:0}),props:{conversation:Object,recipient:Object,userConversationOpponent:Object,userConversationMy:Object,showCallButton:{type:Boolean,default:!0}},computed:{...Object(d.b)({cryptAlertFlag:"crypt/alertFlag"}),...Object(d.c)("platformDevice",{deviceInBackground:"background"}),...Object(d.c)("Users",{me:"mySelf"}),isSecure(){return!this.cryptAlertFlag&&this.recipient&&this.recipient.publicKey&&this.recipient.publicKey.body},conversationId(){return this.conversation?this.conversation._id:null},messageLast(){return this.messagesAll[0]},messagesAll(){return this.conversation?this.conversation.messages:[]},messages(){return this.messagesAll.slice(0,this.showLimit)},messagesHiddenCount(){return Math.max(0,this.messagesAll.length-this.showLimit)},messagesTotal(){return this.conversation?this.conversation.messagesTotal:0},messagesLoadLeft(){return this.messagesTotal-this.messagesAll.length},messageUnread(){return this.userConversationOpponent?this.userConversationOpponent.msgUnreadCount:0},messagesMarked(){let n=this.messages,e=this.messageUnread;if(!e)return n;let r=this.$auth.user.id;if(!r)return n;n=[...n];for(let i=0;i0},chatRootStyle(){return this.keyboardPinActive?{height:`calc(100% - ${this.keyboardOffset}px)`}:null},newMessageStyle(){return this.keyboardPinActive||!this.keyboardOffset?null:{transform:`translateY(-${this.keyboardOffset}px)`,zIndex:1300}}},created(){window&&window.addEventListener("resize",this.windowResize)},destroyed(){window&&window.removeEventListener("resize",this.windowResize),this.removeViewportListeners(),"undefined"!=typeof document&&this._iosDragLockOn&&(document.removeEventListener("touchmove",this.onDocumentTouchMove,{passive:!1}),this._iosDragLockOn=!1)},mounted(){this.addViewportListeners(),this.$nextTick(()=>{this.scrollToEnd()})},beforeMount(){c.b.$on(c.a.LAYOUT_MENU_CLICK,()=>{this.$router.push(Object(h.GoToMenuUser)(this.recipient.id))}),c.b.$on(c.a.MESSAGE_FORWARD,this.openForwardSelect)},beforeDestroy(){c.b.$off(c.a.LAYOUT_MENU_CLICK),c.b.$off(c.a.MESSAGE_FORWARD,this.openForwardSelect)},methods:{addViewportListeners(){"undefined"!=typeof window&&(window.addEventListener("orientationchange",this.updateKeyboardViewport),window.visualViewport&&(window.visualViewport.addEventListener("resize",this.updateKeyboardViewport),window.visualViewport.addEventListener("scroll",this.updateKeyboardViewport)),this.updateKeyboardViewport())},removeViewportListeners(){"undefined"!=typeof window&&(window.removeEventListener("orientationchange",this.updateKeyboardViewport),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.updateKeyboardViewport),window.visualViewport.removeEventListener("scroll",this.updateKeyboardViewport)))},updateKeyboardViewport(){if("undefined"==typeof window||!window.visualViewport)return this.keyboardVisible=!1,void(this.keyboardOffset=0);const n=window.visualViewport,e=Math.max(0,window.innerHeight-n.height-n.offsetTop);this.keyboardOffset=e>80?Math.round(e):0,this.keyboardVisible=this.keyboardOffset>0,this.syncIosDragLock()},syncIosDragLock(){if("undefined"==typeof document)return;const n=this.isIosWeb&&this.keyboardVisible;n&&!this._iosDragLockOn?(document.addEventListener("touchmove",this.onDocumentTouchMove,{passive:!1}),this._iosDragLockOn=!0):!n&&this._iosDragLockOn&&(document.removeEventListener("touchmove",this.onDocumentTouchMove,{passive:!1}),this._iosDragLockOn=!1)},onDocumentTouchMove(n){let e=n.target;const r=this.$refs.chat_history;for(;e;){if(e===r)return;e=e.parentNode}n.cancelable&&n.preventDefault()},onMessageTextFocus(){this.messageInputFocused=!0,this.updateKeyboardViewport(),this.keepInputVisible()},onMessageTextBlur(){window.setTimeout(()=>{this.messageInputFocused=!1,this.updateKeyboardViewport()},180)},keepInputVisible(){const n=()=>{let n=this.$refs.new_message;n&&n.$el&&n.$el.scrollIntoView({block:"end",inline:"nearest"})};this.$nextTick(()=>{n(),window.setTimeout(n,120),window.setTimeout(n,450)})},openForwardSelect({text:text}){text&&(this.forwardMessageText=text)},cancelForward(){this.forwardMessageText=null},async forwardToUser({selectedUsersId:n}){let e=Object.keys(n||{});if(!e.length||!this.forwardMessageText)return;let body=this.forwardMessageText;this.forwardMessageText=null,await this.$store.dispatch("sendMessageToOpponent",{opponentId:e[0],body:body,silent:!1,crypt:!0})},setScrollSmooth(n){let e=this.$refs.chat_history;e&&(n?e.classList.add("scrolling_smooth"):e.classList.remove("scrolling_smooth"))},async pushMessage(n,e){try{e(null,await this.$store.dispatch("sendMessage",{message:n,opponent:this.recipient}))}catch(n){e(n)}},onScroll(){{let n=this.$refs.chat_history;if(n){let e=n.scrollHeight-n.clientHeight;this.scrolledBottom=n.scrollTop>e-10}}let n=this.$refs.chat_history;if(n&&!(n.scrollTop>10||this.ignoreScroll))return this.messagesHiddenCount?this.showMoreMessages():this.messagesLoadLeft?this.loadMoreMessages():void 0},async loadMoreMessages(){if(!this.recipient)return f.a.error("Load messages err recipient"+this.recipient);if(!(this.messagesLoadLeft<=0)){this.ignoreScroll=!0;try{await this.doChangeVisibleMessages(async()=>{await this.$store.dispatch("fetchConversationMessages",{opponentId:this.recipient.id,limit:20})})}catch(n){f.a.error("Load messages err "+n)}finally{this.ignoreScroll=!1}this.showMoreMessages()}},async doChangeVisibleMessages(n){let e=this.$refs.chat_history;if(!e)return;let r=e.scrollHeight;n&&await n(),this.$nextTick(()=>{this.$nextTick(()=>{let n=this.$refs.chat_history;n.scrollTop=n.scrollHeight-r})})},showMoreMessages(){this.messagesHiddenCount<=0||this.doChangeVisibleMessages(async()=>{this.showLimit+=20})},async onMessageRemove(n){try{await this.$store.dispatch("removeMessage",n)}catch(n){f.a.error("error removing",n)}},onResize(){this.$nextTick(()=>{this.windowResize()})},async setSecureCode(n,e){try{await this.$store.dispatch("crypt/storeSetPassphrase",{passphrase:n}),c.b.$emit(c.a.MODAL_SHOW,{title:this.$t("Notification"),text:"Secure code set successfuly"}),e(null,"")}catch(n){c.b.$emit(c.a.MODAL_SHOW,{title:this.$t("Notification"),text:"Secure code not correct or store corrupted"}),e(n)}},async pushMessageAudio(n,e){},async callStart({videoMode:n=!1}={}){await Object(v.doStartCallSingle)(this.$store.dispatch,this.recipient.id,n)},scrollToEnd(){let n=this.$refs.chat_history;n&&(n.scrollTop=n.scrollHeight)},windowResize(){this.$refs.chat_history&&this.scrolledBottom&&this.scrollToEnd()},sendCoversationClean(){this.$emit("conversationClean",this.conversationId)},goBack(){this.$emit("goBack")},checkLastMessageContent(){let n=this.messagesAll[0];if(!n)return;if(n.author!=this.$auth.user.id)return;let e=this.$refs.new_message;e&&e.deleteMessageWithContent(n.body)}},directives:{scrollBottom:{componentUpdated(n){n.scrollTop=n.scrollHeight}}},watch:{conversation(n){let e=this.$refs.new_message;e&&e.reloadNewMessage()},messagesAll(){f.a.debug("deviceInBackground = ",this.deviceInBackground),this.deviceInBackground||this.$store.dispatch("markConversationReadAll");let n=this.messagesAll[0]?this.messagesAll[0]._id:null;this.lastMessageId!=n&&(this.lastMessageId=n,this.$nextTick(()=>this.scrollToEnd()),this.checkLastMessageContent())},deviceInBackground(n){f.a.debug("deviceInBackground changed",n),n||this.$store.dispatch("markConversationReadAll")}}},w=(r(790),r(4)),component=Object(w.a)(k,function(){var n=this,e=n._self._c;return e("div",{staticClass:"chat flex flex-col flex-1 border rounded relative",class:{"chat--keyboard-visible":n.keyboardVisible},style:n.chatRootStyle},[n.recipient?[e("div",{ref:"chat_page",staticClass:"flex flex-col flex-1 h-full overflow-hidden"},[e("div",{staticClass:"app-height w-full py-2 v-scroll-bottom flex flex-1 h-full overflow-hidden relative",attrs:{"data-v-bar":""}},[e("div",{ref:"chat_history",staticClass:"chat-history",attrs:{"data-v-chat-scroll":"{always: true, smooth: true, scrollonremoved:true, smoothonremoved: true}"},on:{scroll:n.onScroll}},[e("div",{staticClass:"flex flex-col-reverse"},[n._l(this.messagesMarked,function(r){return[e("chat-message",{key:r.id,attrs:{me:n.me,recipientUser:n.recipient,message:r},on:{remove:n.onMessageRemove,callStart:n.callStart,resize:n.onResize}})]}),n._v(" "),n.messagesLoadLeft>0&&0==n.messagesHiddenCount?e("div",{staticClass:"w-full text-center p-1"},[e("button",{staticClass:"btn btn-green mx-1",on:{click:n.loadMoreMessages}},[n._v(n._s(n.$t("Show more")))])]):n._e()],2)]),n._v(" "),n.showCallButton?e("div",{staticClass:"absolute pin-l",staticStyle:{top:"50%","z-index":"60"}},[e("svgCall",{staticClass:"relative",staticStyle:{transform:"translateY(-50%)"},on:{click:function(e){return n.callStart()}}})],1):n._e(),n._v(" "),n.showScrollBottomButton?e("div",{staticClass:"chat-scroll-bottom-layer absolute pin-b pin-r opacity-75 mr-1"},[e("button",{staticClass:"scroll-bottom-button",attrs:{type:"button","aria-label":"Scroll to latest message"},on:{click:n.scrollToEnd}})]):n._e()]),n._v(" "),this.conversation?e("ChatNewMessage",{ref:"new_message",class:[n.isSecure?"chat_new_message_secure":"chat_new_message_danger"],style:n.newMessageStyle,attrs:{conversationId:this.conversation._id},on:{newMessage:n.pushMessage,callStart:n.callStart,onMessageTextFocus:n.onMessageTextFocus,onMessageTextBlur:n.onMessageTextBlur}}):n._e()],1)]:e("div",{staticClass:"chat-loading h-full flex justify-center items-center"},[e("h2",{},[n._v(n._s(n.$t("Loading")))])]),n._v(" "),n.forwardMessageText?e("div",{staticClass:"chat-forward-select",on:{click:function(e){return e.target!==e.currentTarget?null:n.cancelForward.apply(null,arguments)}}},[e("div",{staticClass:"chat-forward-select__panel",on:{click:function(n){n.stopPropagation()}}},[e("button",{staticClass:"chat-forward-select__close",attrs:{type:"button"},on:{click:n.cancelForward}},[n._v("x")]),n._v(" "),e("h2",{staticClass:"chat-forward-select__title"},[n._v("Переслать")]),n._v(" "),e("UserListSelect",{attrs:{buttonDoneCaption:"Переслать",multi:!1},on:{done:n.forwardToUser}})],1)]):n._e()],2)},[],!1,null,"5b56b266",null);e.default=component.exports;installComponents(component,{ChatMessage:r(187).default,ChatNewMessage:r(186).default,UserListSelect:r(134).default})},,,,,,,,,,,,,,,,function(n,e,r){n.exports=r.p+"img/bgCall.0b08045.jpg"},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(n,e,r){"use strict";(function(n){r.d(e,"a",function(){return m}),r.d(e,"b",function(){return h}),r.d(e,"d",function(){return v}),r.d(e,"c",function(){return x});var o=r(0),t=r(126),l=r(39);r(1).get("interchat:globalInputAudio.ts");let d;n.env.DISABLE_INPUT_MIXER||(d=new t.a);let c=null,f=null;async function m(n=!1){return n?(o.a.debug("DISABLE_INPUT_MIXER due VIDEO mode"),c=await Object(l.a)(void 0,n),c):d?(x(),c=await Object(l.a)(),f=d.getMixedAudioStream([c],{forceSingle:!0,useGain:!0}),f):(o.a.debug("DISABLE_INPUT_MIXER"),c=await Object(l.a)(),c)}function h(n){d&&d.setGain(n)}function v(){return c}function x(){c&&(Object(l.f)(c),c=null),f&&(Object(l.f)(f),f=null),d&&d.release()}}).call(this,r(16))},function(n,e,r){"use strict";(function(n){r.d(e,"d",function(){return x}),r.d(e,"c",function(){return y}),r.d(e,"e",function(){return C}),r.d(e,"f",function(){return E}),r.d(e,"a",function(){return D});r(23);var o=r(5),t=r(0),l=r(39),d=r(201);r(1).get("interchat:globalAudio.ts");let c,f;const m=!0;t.a.log(" SOUND_USE_WEB_AUDIO = ",m),t.a.log(" process.env.SOUND_USE_WEB_AUDIO = ","1");let h="/";async function v(){if(c)return;c=document.createElement("audio"),c.setAttribute("class","hidden"),c.setAttribute("loop","1"),t.a.debug("globalPlayer play");let n=c.play();n&&n.then(()=>{t.a.debug("global player play")}).catch(n=>{let e=n.message;t.a.error("global player err ",e,n)}),document.body.appendChild(c),t.a.debug("globalPlayer set"),o.b.$emit(o.a.PLAYER_SET,{})}async function x(){if(c)try{c.pause(),c.currentTime=0,c.src="",c.srcObject=null}catch(n){}}e.b=async({app:n})=>{t.a.log("register EEvents.ACTIVATE handler"),n&&n.router&&n.router.options&&(h=n.router.options.base),o.b.$on(o.a.ACTIVATE,async({})=>{t.a.log("on EEvents.ACTIVATE for globalAudio"),await v(),m&&await w()})};let k=null;async function w(){f||(f=Object(l.e)(),f&&(t.a.debug("creating audio context state",f.state),"suspended"===f.state&&await f.resume(),await async function(n){I=n.createMediaStreamDestination(),await Promise.all(Object.keys(M).map(async e=>{let r=M[e];t.a.log("Load sound ",e,r);try{A[e]=await async function(n,e){t.a.log("Load sound url ",e);let r=(await Object(d.a)(e,{withCredentials:!1,responseType:"arraybuffer"})).response;return await n.decodeAudioData(r)}(n,r),t.a.log("Load sound finished ",e,r)}catch(n){t.a.error("Error createSoundBuffer ",r,"error = ",n)}})),t.a.log("Load sound finished")}(f),o.b.$emit(o.a.AUDIO_CONTEXT_SET,{})))}async function y(){await async function(){f&&(await f.close(),f=null)}(),await w()}n.env.DISABLE_OUTPUT_MIXER;let S,_;async function C(n){return t.a.log("outputStreamPlay"),function(){try{if("undefined"==typeof window||"undefined"==typeof navigator||"undefined"==typeof document)return!1;if(window.cordova)return!1;const n=navigator.userAgent||"";return/iPad|iPhone|iPod/.test(n)||-1!=n.indexOf("Macintosh")&&"ontouchend"in document}catch(n){return!1}}()?(t.a.warn("outputStreamPlay iOS web ->