Your IP : 216.73.216.182


Current Path : /var/www/html/plugins/system/jomsocialchatbar/assets/js/
Upload File :
Current File : /var/www/html/plugins/system/jomsocialchatbar/assets/js/store.min.js

!function e(t,n,i){function a(s,r){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!r&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[s]={exports:{}};t[s][0].call(d.exports,function(e){var n=t[s][1][e];return a(n||e)},d,d.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(e,t,n){"use strict";var i,a=e("./store"),o=(i=a)&&i.__esModule?i:{default:i};window.joms=window.joms||{},window.joms.store=o.default},{"./store":12}],2:[function(e,t,n){"use strict";function i(e){return _.isArray(e)||(e=[e]),e=1===e.length?e[0]:e.length>1?(e=(e=(e=_.map(e,function(e,t){return e.indexOf("<")>=0&&((t=document.createElement("span")).innerHTML=e,e=t.innerText),(e=e.split(" "))[0]})).sort()).join(", ")).replace(/,\s([^\s]*)$/," and $1"):""}t.exports={fetch:function(e){var t=this,n=this.page||1,a=!0;return jQuery.Deferred(function(o){joms.ajax({func:"chat,ajaxInitializeChatData",data:[0,n],callback:function(s){_.each(s.buddies,function(t){e.commit("users/add",{data:t},{root:!0})}),_.each(s.list,function(t){t.id=String(t.chat_id),t.name=i(t.name),delete t.chat_id,e.commit("add",t),a=!1}),a?o.reject():(t.page=n+1,o.resolve())}})})},check:function(e){var t=_.map(e.getters.opened,function(e){return e.id});return e.dispatch("messages/check",{ids:t})},open:function(e,t){e.commit("open",t)},close:function(e,t){e.commit("close",t)},toggle:function(e,t){e.commit("toggle",t)},leave:function(e,t){e.commit("delete",t),joms.ajax({func:"chat,ajaxLeaveChat",data:[t]})},addUsers:function(e,t){var n=t.id,a=t.users;a=_.map(a,String),a=JSON.stringify(a),joms.ajax({func:"chat,ajaxAddPeople",data:[n,a],callback:function(){joms.ajax({func:"chat,ajaxGetChatList",data:[JSON.stringify([n])],callback:function(t){_.each(t.list,function(t){t.id=String(t.chat_id),t.name=i(t.name),delete t.chat_id,e.commit("update",{id:t.id,chat:t})})}})}})},mute:function(e,t){var n=t.id;e.commit("mute",n),joms.ajax({func:"chat,ajaxMuteChat",data:[n,1]})},unmute:function(e,t){var n=t.id;e.commit("unmute",n),joms.ajax({func:"chat,ajaxMuteChat",data:[n,0]})}}},{}],3:[function(e,t,n){"use strict";t.exports={opened:function(e,t){return _.filter(e.info,function(e){return e.open})}}},{}],4:[function(e,t,n){"use strict";t.exports={namespaced:!0,state:e("./state"),getters:e("./getters"),mutations:e("./mutations"),actions:e("./actions"),modules:{messages:e("./messages")}}},{"./actions":2,"./getters":3,"./messages":7,"./mutations":10,"./state":11}],5:[function(e,t,n){"use strict";t.exports={fetch:function(e,t){return jQuery.Deferred(function(n){var i=t.id,a=e.getters.oldestMessageID(i),o=[i];a&&o.push(a),joms.ajax({func:"chat,ajaxGetLastChat",data:o,callback:function(t){_.isArray(t.messages)&&_.each(t.messages,function(t){"string"==typeof t.attachment&&(t.attachment=JSON.parse(t.attachment)),e.commit("add",{id:i,message:t})}),n.resolve()}})})},submit:function(e,t){return jQuery.Deferred(function(n){var i=t.id,a=t.data,o=a.attachment||{},s="temp_"+(new Date).getTime();a=_.extend({},a,{id:s}),e.commit("add",{id:i,message:a}),o=o.type&&o.id?{type:o.type,id:o.id}:{},joms.ajax({func:"chat,ajaxAddChat",data:[i,a.content,JSON.stringify(o)],callback:function(t){t.reply_id&&(e.commit("delete",{id:i,messageId:s}),s=String(t.reply_id),a=_.extend({},a,{id:s}),e.commit("add",{id:i,message:a}))}})})},check:function(e,t){return jQuery.Deferred(function(n){var i=t.ids;_.isArray(i)&&i.length?(i=_.map(i,function(t){var n,i=e.getters.sortedMessages(t);return i&&i.length&&(n=(i=_.filter(i,function(e){return+e.id}))[i.length-1])&&+n.id&&(n=+n.id),[+t,n||0]}),joms.ajax({func:"chat,ajaxGetLatestActivities",data:[JSON.stringify(i)],callback:function(t){t&&_.each(t,function(t,n){_.each(t,function(t){"string"==typeof t.attachment&&(t.attachment=JSON.parse(t.attachment)),e.commit("add",{id:n,message:t})})}),n.resolve()}})):n.resolve()})}}},{}],6:[function(e,t,n){(function(e){"use strict";var n=("undefined"!=typeof window?window.joms:void 0!==e?e.joms:null).moment;function i(e){var t=n(),i=n(e),a="D MMM";return t.year()!==i.year()&&(a="D/MMM/YY"),i.format(a)}t.exports={sortedMessages:function(e,t){return function(t){var n,i=[];return e[t]&&(n=_.chain(e[t]).keys().sortBy(function(e){return+e}).value(),_.each(n,function(n){i.push(e[t][n])})),i}},groupedMessages:function(e,t){return function(a){var o,s,r,u=[];return e[a]&&(o=t.sortedMessages(a),_.each(o,function(e){var t,a,o,c,d=new Date(1e3*e.created_at),f=d.toJSON().slice(0,10).replace(/-/g,""),l=String(e.user_id),m=i(d.getTime()),p=(a=d.getTime(),o=n(a),c=(c=joms.getData("chat_time_format")||"g:i A").replace(/[GH]/g,"H").replace(/[gh]/g,"h").replace(/i/gi,"mm").replace(/s/gi,"ss"),i(a)+" "+o.format(c));f!==s&&(s=f,r=void 0,u.push({date:f,dateFormatted:m,messages:[]})),t=u[u.length-1].messages,"sent"!==e.action?(r=void 0,t.push({info:e.action,messages:[]})):l!==r&&(r=l,t.push({user:l,messages:[]})),(t=t[t.length-1].messages).push(_.extend({},e,{timeFormatted:p}))})),u}},oldestMessageID:function(e,t){return function(t){var n,i;return e[t]&&(n=_.chain(e[t]).keys().filter(function(e){return+e}).sortBy(function(e){return+e}).value()).length&&(i=n[0]),i}},newestMessageID:function(e,t){return function(t){var n,i;return e[t]&&(n=_.chain(e[t]).keys().filter(function(e){return+e}).sortBy(function(e){return+e}).value()).length&&(i=n[n.length-1]),i}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){"use strict";t.exports={namespaced:!0,state:e("./state"),getters:e("./getters"),mutations:e("./mutations"),actions:e("./actions")}},{"./actions":5,"./getters":6,"./mutations":8,"./state":9}],8:[function(e,t,n){(function(e){"use strict";var n=("undefined"!=typeof window?window.joms:void 0!==e?e.joms:null).Vue;t.exports={add:function(e,t){var i=t.id,a=t.message,o=a.id;e[i]||n.set(e,i,{}),n.set(e[i],o,a)},edit:function(e,t){var i,a=t.id,o=t.messageId,s=t.message;e[a]&&(i=e[a][o])&&(s=_.extend({},i,s),n.set(e[a],o,s))},delete:function(e,t){var n=t.id,i=t.messageId;e[n]&&delete e[n][i]}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,n){"use strict";t.exports={}},{}],10:[function(e,t,n){(function(e){"use strict";var n=("undefined"!=typeof window?window.joms:void 0!==e?e.joms:null).Vue,i=("undefined"!=typeof window?window.joms:void 0!==e?e.joms:null).storage;t.exports={add:function(e,t){var a=i.get("chatbar")||{},o=a&&a.windows||{};_.extend(t,o[t.id]||{}),n.set(e.info,t.id,t)},update:function(e,t){var i=t.id,a=t.chat,o=e.info[i];a=_.extend({},o||{},a),n.set(e.info,i,a)},delete:function(e,t){e.info[t]&&n.delete(e.info,t)},open:function(e,t){var a,o,s=e.info[t];s&&(n.set(s,"open",1),(o=(a=i.get("chatbar")||{}).windows||(a.windows={}))[t]=o[t]||(o[t]={}),o[t].open=1,i.set("chatbar",a))},close:function(e,t){var a,o,s=e.info[t];s&&(n.set(s,"open",0),(o=(a=i.get("chatbar")||{}).windows||(a.windows={}))[t]=o[t]||(o[t]={}),o[t].open=0,i.set("chatbar",a))},toggle:function(e,t){var a,o,s,r=e.info[t];r&&(s=2===r.open?1:2,n.set(r,"open",s),(o=(a=i.get("chatbar")||{}).windows||(a.windows={}))[t]=o[t]||(o[t]={}),o[t].open=s,i.set("chatbar",a))},mute:function(e,t){var i=e.info[t];i&&n.set(i,"mute",1)},unmute:function(e,t){var i=e.info[t];i&&n.set(i,"mute",0)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,n){"use strict";t.exports={info:{}}},{}],12:[function(e,t,n){(function(n){"use strict";var i=("undefined"!=typeof window?window.joms:void 0!==n?n.joms:null).Vuex;t.exports=new i.Store({modules:{users:e("./users"),chats:e("./chats")}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./chats":4,"./users":15}],13:[function(e,t,n){"use strict";t.exports={}},{}],14:[function(e,t,n){"use strict";t.exports={name:function(e,t){return function(t){var n;return e[t]&&(n=e[t].name),n}},avatar:function(e,t){return function(t){var n;return e[t]&&(n=e[t].avatar),n}},search:function(e,t){return function(t){return t=(t||"").trim().toLowerCase(),_.filter(e,function(e){return t&&-1!==(e.name||"").toLowerCase().indexOf(t)})}}}},{}],15:[function(e,t,n){arguments[4][7][0].apply(n,arguments)},{"./actions":13,"./getters":14,"./mutations":16,"./state":17,dup:7}],16:[function(e,t,n){(function(e){"use strict";var n=("undefined"!=typeof window?window.joms:void 0!==e?e.joms:null).Vue;t.exports={add:function(e,t){var i=t.data,a=i.id;n.set(e,a,i)},edit:function(e,t){var i=t.id,a=t.data,o=e[i];o&&(a=_.extend({},o,a),n.set(e,i,a))},delete:function(e,t){var n=t.id;t.messageId;e[n]&&delete e[n]}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(e,t,n){arguments[4][9][0].apply(n,arguments)},{dup:9}]},{},[1]);