Your IP : 18.219.229.1


Current Path : /home/bitrix/ext_www/easy-comfort.com.ua/bitrix/js/messenger/utils/
Upload File :
Current File : /home/bitrix/ext_www/easy-comfort.com.ua/bitrix/js/messenger/utils/messenger.utils.bundle.min.js

(function(e){"use strict";if(!window.BX){window.BX={}}if(typeof window.BX.Messenger=="undefined"){window.BX.Messenger={}}if(typeof window.BX.Messenger.Const=="undefined"){window.BX.Messenger.Const={}}if(typeof window.BX.Messenger.Utils=="undefined"){window.BX.Messenger.Utils={}}BX.Messenger.Const.dateFormat=Object.freeze({groupTitle:"groupTitle",message:"message",recentTitle:"recentTitle",recentLinesTitle:"recentLinesTitle",default:"default"});BX.Messenger.Utils={browser:{isSafari:function e(){if(!navigator.userAgent.toLowerCase().includes("safari")){return false}return!this.isSafariBased()},isSafariBased:function e(){if(!navigator.userAgent.toLowerCase().includes("applewebkit")){return false}return navigator.userAgent.toLowerCase().includes("yabrowser")||navigator.userAgent.toLowerCase().includes("yaapp_ios_browser")||navigator.userAgent.toLowerCase().includes("crios")},isChrome:function e(){return navigator.userAgent.toLowerCase().includes("chrome")},isFirefox:function e(){return navigator.userAgent.toLowerCase().includes("firefox")},isIe:function e(){return navigator.userAgent.match(/(Trident\/|MSIE\/)/)!==null}},platform:{isMac:function e(){return navigator.userAgent.toLowerCase().includes("macintosh")},isLinux:function e(){return navigator.userAgent.toLowerCase().includes("linux")},isWindows:function e(){return navigator.userAgent.toLowerCase().includes("windows")||!this.isMac()&&!this.isLinux()},isBitrixMobile:function e(){return navigator.userAgent&&navigator.userAgent.toLowerCase().includes("bitrixmobile")},isBitrixDesktop:function e(){return navigator.userAgent.toLowerCase().includes("bitrixdesktop")},isMobile:function e(){return this.isAndroid()||this.isIos()||this.isBitrixMobile()},isIos:function e(){return navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad")},getIosVersion:function e(){if(!this.isIos()){return null}var t=navigator.userAgent.toLowerCase().match(/(iphone|ipad)(.+)(OS\s([0-9]+))/i);if(!t||!t[4]){return null}return t[4]},isAndroid:function e(){return navigator.userAgent.toLowerCase().includes("android")}},device:{isDesktop:function e(){return!this.isMobile()},isMobile:function e(){if(typeof this.isMobileStatic!=="undefined"){return this.isMobileStatic}this.isMobileStatic=navigator.userAgent.toLowerCase().includes("android")||navigator.userAgent.toLowerCase().includes("webos")||navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad")||navigator.userAgent.toLowerCase().includes("ipod")||navigator.userAgent.toLowerCase().includes("blackberry")||navigator.userAgent.toLowerCase().includes("windows phone");return this.isMobileStatic},orientationHorizontal:"horizontal",orientationPortrait:"portrait",getOrientation:function e(){if(!this.isMobile()){return this.orientationHorizontal}return Math.abs(window.orientation)===0?this.orientationPortrait:this.orientationHorizontal}},types:{isString:function e(t){return t===""?true:t?typeof t=="string"||t instanceof String:false},isArray:function e(t){return t&&Object.prototype.toString.call(t)=="[object Array]"},isFunction:function e(t){return t===null?false:typeof t=="function"||t instanceof Function},isDomNode:function e(t){return t&&babelHelpers.typeof(t)=="object"&&"nodeType"in t},isDate:function e(t){return t&&Object.prototype.toString.call(t)=="[object Date]"},isPlainObject:function e(t){if(!t||babelHelpers.typeof(t)!=="object"||t.nodeType){return false}var i=Object.prototype.hasOwnProperty;try{if(t.constructor&&!i.call(t,"constructor")&&!i.call(t.constructor.prototype,"isPrototypeOf")){return false}}catch(e){return false}var n;return typeof n==="undefined"||i.call(t,n)}},isDarkColor:function e(t){if(!t||!t.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)){return false}if(t.length===4){t=t.replace(/#([A-Fa-f0-9])/gi,"$1$1")}else{t=t.replace(/#([A-Fa-f0-9])/gi,"$1")}t=t.toLowerCase();var i=["#17a3ea","#00aeef","#00c4fb","#47d1e2","#75d900","#ffab00","#ff5752","#468ee5","#1eae43"];if(i.includes("#"+t)){return true}var n=parseInt(t,16);var r=n>>16&255;var o=n>>8&255;var s=n&255;var a=(r*299+o*587+s*114)/1e3;return a<128},getDateFormatType:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:BX.Messenger.Const.dateFormat.default;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!i){i=BX.message}var n=[];if(t===BX.Messenger.Const.dateFormat.groupTitle){n=[["tommorow","tommorow"],["today","today"],["yesterday","yesterday"],["",BX.Main.Date.convertBitrixFormat(i["IM_UTILS_FORMAT_DATE"])]]}else if(t===BX.Messenger.Const.dateFormat.message){n=[["",i["IM_UTILS_FORMAT_TIME"]]]}else if(t===BX.Messenger.Const.dateFormat.recentTitle){n=[["tommorow","today"],["today","today"],["yesterday","yesterday"],["",BX.Main.Date.convertBitrixFormat(i["IM_UTILS_FORMAT_DATE_RECENT"])]]}else if(t===BX.Messenger.Const.dateFormat.recentLinesTitle){n=[["tommorow","tommorow"],["today","today"],["yesterday","yesterday"],["",BX.Main.Date.convertBitrixFormat(i["IM_UTILS_FORMAT_DATE_RECENT"])]]}else{n=[["tommorow","tommorow, "+i["IM_UTILS_FORMAT_TIME"]],["today","today, "+i["IM_UTILS_FORMAT_TIME"]],["yesterday","yesterday, "+i["IM_UTILS_FORMAT_TIME"]],["",BX.Main.Date.convertBitrixFormat(i["FORMAT_DATETIME"])]]}return n},hashCode:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var i=0;if(babelHelpers.typeof(t)==="object"&&t){t=JSON.stringify(t)}else if(typeof t!=="string"){t=t.toString()}if(typeof t!=="string"){return i}for(var n=0;n<t.length;n++){var r=t.charCodeAt(n);i=(i<<5)-i+r;i=i&i}return i},throttle:function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var r=null;var o=null;var s=function e(){t.apply(n,o);r=null};return function(){if(!r){o=arguments;r=setTimeout(s,i)}}},debounce:function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var r=null;var o=null;var s=function e(){t.apply(n,o)};return function(){o=arguments;clearTimeout(r);r=setTimeout(s,i)}},htmlspecialchars:function e(t){if(typeof t!=="string"){return t}return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},htmlspecialcharsback:function e(t){if(typeof t!=="string"){return t}return t.replace(/\&quot;/g,'"').replace(/&#39;/g,"'").replace(/\&lt;/g,"<").replace(/\&gt;/g,">").replace(/\&amp;/g,"&").replace(/\&nbsp;/g," ")},getLogTrackingParams:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=[];var n=t.name,r=n===void 0?"tracking":n,o=t.data,s=o===void 0?[]:o,a=t.dialog,u=a===void 0?null:a,l=t.message,c=l===void 0?null:l,f=t.files,d=f===void 0?null:f;r=encodeURIComponent(r);if(s&&!(s instanceof Array)&&babelHelpers.typeof(s)==="object"){var g=[];for(var p in s){if(s.hasOwnProperty(p)){g.push(encodeURIComponent(p)+"="+encodeURIComponent(s[p]))}}s=g}else if(!s instanceof Array){s=[]}if(u){i.push("timType="+u.type);if(u.type==="lines"){i.push("timLinesType="+u.entityId.split("|")[0])}}if(d){var y="file";if(d instanceof Array&&d[0]){y=d[0].type}else{y=d.type}i.push("timMessageType="+y)}else if(c){i.push("timMessageType=text")}if(this.platform.isBitrixMobile()){i.push("timDevice=bitrixMobile")}else if(this.platform.isBitrixDesktop()){i.push("timDevice=bitrixDesktop")}else if(this.platform.isIos()||this.platform.isAndroid()){i.push("timDevice=mobile")}else{i.push("timDevice=web")}return r+(s.length?"&"+s.join("&"):"")+(i.length?"&"+i.join("&"):"")}}})(this.window=this.window||{});
//# sourceMappingURL=messenger.utils.bundle.map.js