UNPKG

ice-utilities

Version:

Utilities for manage arrays, breadcrumb, dom elements, dates, injectors, local storage, login, objects, router animations, router, session storage, strings and translate utilities, encryption, for angular 6+ with ECMAScript 6 - ECMAScript 2015

1,560 lines (1,547 loc) 221 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('simple-crypto-js/src/SimpleCrypto'), require('devextreme/ui/notify'), require('@angular/router'), require('@angular/core'), require('@angular/animations')) : typeof define === 'function' && define.amd ? define('ice-utilities', ['exports', 'simple-crypto-js/src/SimpleCrypto', 'devextreme/ui/notify', '@angular/router', '@angular/core', '@angular/animations'], factory) : (factory((global['ice-utilities'] = {}),global.SimpleCrypto,global.notify,global.ng.router,global.ng.core,global.ng.animations)); }(this, (function (exports,SimpleCrypto,notify,router,core,animations) { 'use strict'; SimpleCrypto = SimpleCrypto && SimpleCrypto.hasOwnProperty('default') ? SimpleCrypto['default'] : SimpleCrypto; notify = notify && notify.hasOwnProperty('default') ? notify['default'] : notify; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ ObjectUtils = /** @class */ (function () { function ObjectUtils() { } /** * @param {?} obj * @return {?} */ ObjectUtils.isObject = /** * @param {?} obj * @return {?} */ function (obj) { return (typeof obj === 'object'); }; /** * @param {?} obj * @return {?} */ ObjectUtils.isEmpty = /** * @param {?} obj * @return {?} */ function (obj) { return (this.isObject(obj) && (JSON.stringify(obj) === JSON.stringify({}))); }; /** * @param {?} obj * @return {?} */ ObjectUtils.isEmptyCircular = /** * @param {?} obj * @return {?} */ function (obj) { /** @type {?} */ var isEmpty = true; Object.keys(obj).forEach(function (key) { isEmpty = false; }); return isEmpty; }; /** * @param {?} myObject * @return {?} */ ObjectUtils.copyNestedObject = /** * @param {?} myObject * @return {?} */ function (myObject) { return __assign({}, myObject); // JSON.parse(JSON.stringify(myObject)); }; /** * @param {?} myObject * @return {?} */ ObjectUtils.copyObject = /** * @param {?} myObject * @return {?} */ function (myObject) { return this.copyNestedObject(myObject); }; /** * @param {?} obj * @return {?} */ ObjectUtils.objectToNum = /** * @param {?} obj * @return {?} */ function (obj) { /** @type {?} */ var newObj = {}; Object.keys(obj).forEach(function (prop) { newObj[prop] = +obj[prop]; }); }; /** * @param {?=} obj1 * @param {?=} obj2 * @return {?} */ ObjectUtils.merge = /** * @param {?=} obj1 * @param {?=} obj2 * @return {?} */ function (obj1, obj2) { if (obj1 === void 0) { obj1 = {}; } if (obj2 === void 0) { obj2 = {}; } return __assign({}, obj1, obj2); }; return ObjectUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ EncryptUtils = /** @class */ (function () { function EncryptUtils() { } /** * @param {?} key * @return {?} */ EncryptUtils.setKey = /** * @param {?} key * @return {?} */ function (key) { if (key && key !== null && key.length > 0) { this._key = key; this._SimpleCrypto = new SimpleCrypto(this._key); } }; /** * @return {?} */ EncryptUtils.hasEncryption = /** * @return {?} */ function () { return (this._key && this._key.length > 0 && this._SimpleCrypto); }; /** * @param {?} data * @return {?} */ EncryptUtils.encrypt = /** * @param {?} data * @return {?} */ function (data) { if (this.hasEncryption() && data && data !== null) { return this._SimpleCrypto.encrypt(data); } else { return ''; } }; /** * @param {?} ciphered * @return {?} */ EncryptUtils.decrypt = /** * @param {?} ciphered * @return {?} */ function (ciphered) { if (this.hasEncryption() && ciphered && ciphered !== null && ciphered.length > 0) { /** @type {?} */ var val = this._SimpleCrypto.decrypt(ciphered); try { val = JSON.parse(val); } catch (e) { } return val; } else { return null; } }; /** * @return {?} */ EncryptUtils.generateKey = /** * @return {?} */ function () { return SimpleCrypto.generateRandom(); }; return EncryptUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ SessionUtils = /** @class */ (function () { function SessionUtils() { } /** * @private * @param {?} key * @return {?} */ SessionUtils.codeKey = /** * @private * @param {?} key * @return {?} */ function (key) { return btoa(key.toUpperCase()); }; /** * @param {?} key * @param {?} value * @return {?} */ SessionUtils.setSession = /** * @param {?} key * @param {?} value * @return {?} */ function (key, value) { if (EncryptUtils.hasEncryption()) { sessionStorage.setItem(this.codeKey(key), EncryptUtils.encrypt(value)); } else { /** @type {?} */ var val = void 0; if (ObjectUtils.isObject(value)) { val = JSON.stringify(value); } else { val = value; } sessionStorage.setItem(key, val); } }; /** * @param {?} key * @return {?} */ SessionUtils.deleteSession = /** * @param {?} key * @return {?} */ function (key) { if (EncryptUtils.hasEncryption()) { sessionStorage.removeItem(this.codeKey(key)); } else { sessionStorage.removeItem(key); } }; /** * @param {?} key * @return {?} */ SessionUtils.getSession = /** * @param {?} key * @return {?} */ function (key) { if (EncryptUtils.hasEncryption()) { return EncryptUtils.decrypt(sessionStorage.getItem(this.codeKey(key))); } else { /** @type {?} */ var val = sessionStorage.getItem(key); try { val = JSON.parse(val); } catch (e) { } return val; } }; return SessionUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Created by ICEMANven on 22/08/2018. */ /** * * Base64 encode / decode * http://www.webtoolkit.info/ * **/ var Base64 = /** @class */ (function () { function Base64() { this._keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; } // public method for encoding // public method for encoding /** * @param {?} input * @return {?} */ Base64.prototype.encode = // public method for encoding /** * @param {?} input * @return {?} */ function (input) { /** @type {?} */ var output = ''; /** @type {?} */ var chr1; /** @type {?} */ var chr2; /** @type {?} */ var chr3; /** @type {?} */ var enc1; /** @type {?} */ var enc2; /** @type {?} */ var enc3; /** @type {?} */ var enc4; /** @type {?} */ var i = 0; input = this._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }; // public method for decoding // public method for decoding /** * @param {?} input * @return {?} */ Base64.prototype.decode = // public method for decoding /** * @param {?} input * @return {?} */ function (input) { /** @type {?} */ var output = ''; /** @type {?} */ var chr1; /** @type {?} */ var chr2; /** @type {?} */ var chr3; /** @type {?} */ var enc1; /** @type {?} */ var enc2; /** @type {?} */ var enc3; /** @type {?} */ var enc4; /** @type {?} */ var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 !== 64) { output = output + String.fromCharCode(chr2); } if (enc4 !== 64) { output = output + String.fromCharCode(chr3); } } output = this._utf8_decode(output); // output = this._utf8_encode(output); return output; }; // private method for UTF-8 encoding // private method for UTF-8 encoding /** * @param {?} string * @return {?} */ Base64.prototype._utf8_encode = // private method for UTF-8 encoding /** * @param {?} string * @return {?} */ function (string) { string = string.replace(/\r\n/g, '\n'); /** @type {?} */ var utftext = ''; for (var n = 0; n < string.length; n++) { /** @type {?} */ var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }; // private method for UTF-8 decoding // private method for UTF-8 decoding /** * @param {?} utftext * @return {?} */ Base64.prototype._utf8_decode = // private method for UTF-8 decoding /** * @param {?} utftext * @return {?} */ function (utftext) { /** @type {?} */ var string = ''; /** @type {?} */ var i = 0; /** @type {?} */ var c1; /** @type {?} */ var c2; /** @type {?} */ var c3; /** @type {?} */ var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }; return Base64; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Taken from https://github.com/killmenot/webtoolkit.md5 /** @type {?} */ var md5 = function (string) { /** * @param {?} lValue * @param {?} iShiftBits * @return {?} */ function RotateLeft(lValue, iShiftBits) { return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); } /** * @param {?} lX * @param {?} lY * @return {?} */ function AddUnsigned(lX, lY) { /** @type {?} */ var lX4; /** @type {?} */ var lY4; /** @type {?} */ var lX8; /** @type {?} */ var lY8; /** @type {?} */ var lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } } /** * @param {?} x * @param {?} y * @param {?} z * @return {?} */ function F(x, y, z) { return (x & y) | ((~x) & z); } /** * @param {?} x * @param {?} y * @param {?} z * @return {?} */ function G(x, y, z) { return (x & z) | (y & (~z)); } /** * @param {?} x * @param {?} y * @param {?} z * @return {?} */ function H(x, y, z) { return (x ^ y ^ z); } /** * @param {?} x * @param {?} y * @param {?} z * @return {?} */ function I(x, y, z) { return (y ^ (x | (~z))); } /** * @param {?} a * @param {?} b * @param {?} c * @param {?} d * @param {?} x * @param {?} s * @param {?} ac * @return {?} */ function FF(a, b, c, d, x, s, ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); } /** * @param {?} a * @param {?} b * @param {?} c * @param {?} d * @param {?} x * @param {?} s * @param {?} ac * @return {?} */ function GG(a, b, c, d, x, s, ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); } /** * @param {?} a * @param {?} b * @param {?} c * @param {?} d * @param {?} x * @param {?} s * @param {?} ac * @return {?} */ function HH(a, b, c, d, x, s, ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); } /** * @param {?} a * @param {?} b * @param {?} c * @param {?} d * @param {?} x * @param {?} s * @param {?} ac * @return {?} */ function II(a, b, c, d, x, s, ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); } /** * @param {?} string * @return {?} */ function ConvertToWordArray(string) { /** @type {?} */ var lWordCount; /** @type {?} */ var lMessageLength = string.length; /** @type {?} */ var lNumberOfWords_temp1 = lMessageLength + 8; /** @type {?} */ var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64; /** @type {?} */ var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16; /** @type {?} */ var lWordArray = Array(lNumberOfWords - 1); /** @type {?} */ var lBytePosition = 0; /** @type {?} */ var lByteCount = 0; while (lByteCount < lMessageLength) { lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); lByteCount++; } lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); lWordArray[lNumberOfWords - 2] = lMessageLength << 3; lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; return lWordArray; } /** * @param {?} lValue * @return {?} */ function WordToHex(lValue) { /** @type {?} */ var WordToHexValue = ""; /** @type {?} */ var WordToHexValue_temp = ""; /** @type {?} */ var lByte; /** @type {?} */ var lCount; for (lCount = 0; lCount <= 3; lCount++) { lByte = (lValue >>> (lCount * 8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2); } return WordToHexValue; } /** * @param {?} string * @return {?} */ function Utf8Encode(string) { string = string.replace(/\r\n/g, "\n"); /** @type {?} */ var utftext = ""; for (var n = 0; n < string.length; n++) { /** @type {?} */ var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } /** @type {?} */ var x = Array(); /** @type {?} */ var k; /** @type {?} */ var AA; /** @type {?} */ var BB; /** @type {?} */ var CC; /** @type {?} */ var DD; /** @type {?} */ var a; /** @type {?} */ var b; /** @type {?} */ var c; /** @type {?} */ var d; /** @type {?} */ var S11 = 7; /** @type {?} */ var S12 = 12; /** @type {?} */ var S13 = 17; /** @type {?} */ var S14 = 22; /** @type {?} */ var S21 = 5; /** @type {?} */ var S22 = 9; /** @type {?} */ var S23 = 14; /** @type {?} */ var S24 = 20; /** @type {?} */ var S31 = 4; /** @type {?} */ var S32 = 11; /** @type {?} */ var S33 = 16; /** @type {?} */ var S34 = 23; /** @type {?} */ var S41 = 6; /** @type {?} */ var S42 = 10; /** @type {?} */ var S43 = 15; /** @type {?} */ var S44 = 21; string = Utf8Encode(string); x = ConvertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k = 0; k < x.length; k += 16) { AA = a; BB = b; CC = c; DD = d; a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478); d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB); b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A); c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613); b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501); a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8); d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122); d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193); c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E); b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821); a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562); d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340); c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51); b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D); d = GG(d, a, b, c, x[k + 10], S22, 0x2441453); c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6); c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED); a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9); b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681); c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05); a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); a = II(a, b, c, d, x[k + 0], S41, 0xF4292244); d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97); c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7); b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039); a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3); d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1); a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); c = II(c, d, a, b, x[k + 6], S43, 0xA3014314); b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1); a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82); d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235); c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391); a = AddUnsigned(a, AA); b = AddUnsigned(b, BB); c = AddUnsigned(c, CC); d = AddUnsigned(d, DD); } /** @type {?} */ var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d); return temp.toLowerCase(); }; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ StringUtils = /** @class */ (function () { function StringUtils() { } /** * @param {?} sanitizer * @return {?} */ StringUtils.setSanitizerInstance = /** * @param {?} sanitizer * @return {?} */ function (sanitizer) { if (!this.sanitizer && sanitizer) { this.sanitizer = sanitizer; } }; /** * @param {?} str * @param {?} find * @return {?} */ StringUtils.includes = /** * @param {?} str * @param {?} find * @return {?} */ function (str, find) { return str.includes(find); }; /** * @param {?} str * @param {?} find * @return {?} */ StringUtils.startsWith = /** * @param {?} str * @param {?} find * @return {?} */ function (str, find) { return str.startsWith(find); }; /** * @param {?} str * @param {?} find * @return {?} */ StringUtils.endsWith = /** * @param {?} str * @param {?} find * @return {?} */ function (str, find) { return str.endsWith(find); }; /** * @param {?} val * @return {?} */ StringUtils.isString = /** * @param {?} val * @return {?} */ function (val) { return (typeof val === 'string' || val instanceof String); }; /** * @param {?} text * @return {?} */ StringUtils.removeAccents = /** * @param {?} text * @return {?} */ function (text) { return text ? text.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : ''; }; /** * @param {?} st * @return {?} */ StringUtils.StringToNumber = /** * @param {?} st * @return {?} */ function (st) { return parseInt(st, 10); }; /** * @param {?} st * @return {?} */ StringUtils.Utf8Encode = /** * @param {?} st * @return {?} */ function (st) { // return this.b64._utf8_encode(st); // const sst = this.utf8.utf8decode(st); return st; }; /** * @param {?} st * @return {?} */ StringUtils.Utf8Decode = /** * @param {?} st * @return {?} */ function (st) { // return this.b64._utf8_decode(st); // const sst = this.utf8.utf8decode(st); return st; }; /** * @param {?} bb * @return {?} */ StringUtils.base64Decode = /** * @param {?} bb * @return {?} */ function (bb) { /** @type {?} */ var b64 = new Base64(); return b64.decode(bb); }; /** * @param {?} text * @return {?} */ StringUtils.isEmpty = /** * @param {?} text * @return {?} */ function (text) { return (text === ''); }; /** * @param {?} text * @return {?} */ StringUtils.bypassSecurityTrustUrl = /** * @param {?} text * @return {?} */ function (text) { return this.sanitizer.bypassSecurityTrustUrl(text); }; /** * @param {?} text * @return {?} */ StringUtils.toMd5 = /** * @param {?} text * @return {?} */ function (text) { return md5(text); }; return StringUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ TranslateUtils = /** @class */ (function () { function TranslateUtils() { } /** * @param {?} translateService * @return {?} */ TranslateUtils.setTranlateInstance = /** * @param {?} translateService * @return {?} */ function (translateService) { if (!this.translateService && translateService) { this.translateService = translateService; } }; /** * @param {?} text * @return {?} */ TranslateUtils.Translate = /** * @param {?} text * @return {?} */ function (text) { if (this.translateService) { /** @type {?} */ var translation_1 = ''; this.translateService.get(text).subscribe(function (trans) { translation_1 = trans; }); return translation_1; } else { return text; } }; return TranslateUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var GlobalUtils = /** @class */ (function () { function GlobalUtils() { } /** * @param {?} responsiveWidth * @return {?} */ GlobalUtils.setResponsiveWidth = /** * @param {?} responsiveWidth * @return {?} */ function (responsiveWidth) { if (!this.responsiveWidth && responsiveWidth) { this.responsiveWidth = responsiveWidth; } }; /** * @param {?} timeshow * @return {?} */ GlobalUtils.setTimeShow = /** * @param {?} timeshow * @return {?} */ function (timeshow) { if (!this.timeshow && timeshow) { this.timeshow = timeshow; } }; /** * @param {?} obj1 * @param {?} obj2 * @return {?} */ GlobalUtils.areEquals = /** * @param {?} obj1 * @param {?} obj2 * @return {?} */ function (obj1, obj2) { return JSON.stringify(obj1) === JSON.stringify(obj2); }; /** * @param {?} data * @return {?} */ GlobalUtils.isEmptyData = /** * @param {?} data * @return {?} */ function (data) { return (this.areEquals(data, '') || this.areEquals(data, 0) || data === null || this.areEquals(data, {}) || this.areEquals(data, [])); }; /** * @param {?} data * @return {?} */ GlobalUtils.isUndefined = /** * @param {?} data * @return {?} */ function (data) { return typeof data === 'undefined'; }; /** * @param {?} name * @return {?} */ GlobalUtils.setSysname = /** * @param {?} name * @return {?} */ function (name) { SessionUtils.setSession('sysname', name); }; /** * @return {?} */ GlobalUtils.getSysname = /** * @return {?} */ function () { return SessionUtils.getSession('sysname'); }; /** * @param {?} width * @param {?} actstt * @return {?} */ GlobalUtils.autoFixSidebarState = /** * @param {?} width * @param {?} actstt * @return {?} */ function (width, actstt) { if (width <= this.responsiveWidth) { return 'inres'; } else { if (actstt === 'inres') { return 'out'; } else { return actstt; } } }; /** * @param {?} stt * @param {?} width * @param {?} actstt * @param {?} responsiveWidth * @return {?} */ GlobalUtils.fixsidebarState = /** * @param {?} stt * @param {?} width * @param {?} actstt * @param {?} responsiveWidth * @return {?} */ function (stt, width, actstt, responsiveWidth) { if (width <= responsiveWidth) { if (actstt === 'inres') { return 'in'; } else { return 'inres'; } } else { return stt; } }; /** * @param {?} stt * @param {?} width * @param {?} responsiveWidth * @return {?} */ GlobalUtils.fixContainerState = /** * @param {?} stt * @param {?} width * @param {?} responsiveWidth * @return {?} */ function (stt, width, responsiveWidth) { if (width <= responsiveWidth) { return 'inres'; } else { return stt; } }; /** * @param {?} men * @param {?} data * @return {?} */ GlobalUtils.successNotify = /** * @param {?} men * @param {?} data * @return {?} */ function (men, data) { notify(TranslateUtils.Translate(men) + ' ' + JSON.stringify(data), 'success', this.timeshow); }; /** * @param {?} error * @param {?} men * @param {?=} type * @return {?} */ GlobalUtils.cathNotify = /** * @param {?} error * @param {?} men * @param {?=} type * @return {?} */ function (error, men, type) { if (type === void 0) { type = 'warning'; } /** @type {?} */ var tmen = TranslateUtils.Translate(men); this.notifyError(tmen, error, type); }; /** * @private * @param {?} tmen * @param {?} error * @param {?} type * @return {?} */ GlobalUtils.notifyError = /** * @private * @param {?} tmen * @param {?} error * @param {?} type * @return {?} */ function (tmen, error, type) { notify(tmen + " :" + this.errorCath(error), type, this.timeshow); if (type === 'error') { throw new Error(tmen); } }; /** * @param {?} error * @param {?} men * @param {?} extraMen * @param {?=} type * @return {?} */ GlobalUtils.cathNotifyExtraMen = /** * @param {?} error * @param {?} men * @param {?} extraMen * @param {?=} type * @return {?} */ function (error, men, extraMen, type) { if (type === void 0) { type = 'warning'; } /** @type {?} */ var tmen = TranslateUtils.Translate(men) + " " + extraMen; this.notifyError(tmen, error, type); }; /** * @param {?} error * @return {?} */ GlobalUtils.errorCath = /** * @param {?} error * @return {?} */ function (error) { /** @type {?} */ var errorMen = ''; if (StringUtils.isString(error)) { errorMen = error; } else if (ObjectUtils.isObject(error)) { if (error.error) { if (StringUtils.isString(error.error)) { errorMen = error.error; } else if (ObjectUtils.isObject(error.error) && error.error.ResponseStatus) { if (error.error.ResponseStatus.Message) { errorMen = error.error.ResponseStatus.Message; } else if (error.error.ResponseStatus.ErrorCode) { errorMen = error.error.ResponseStatus.ErrorCode; } } else if (StringUtils.isString(error.message)) { errorMen = error.message; } } else { if (error.message) { errorMen = error.message; } else if (error.statusText) { errorMen = error.statusText; } } } return TranslateUtils.Translate(errorMen); }; /** * @return {?} */ GlobalUtils.getNativeWindow = /** * @return {?} */ function () { return window; }; /** * @param {?} url * @param {?=} config * @return {?} */ GlobalUtils.openWindow = /** * @param {?} url * @param {?=} config * @return {?} */ function (url, config) { return window.open(url, '', 'location=no,width=1800,height=900,scrollbars=yes,top=100,left=700,resizable = no'); }; /** * @param {?=} whm * @return {?} */ GlobalUtils.setWithHeight = /** * @param {?=} whm * @return {?} */ function (whm) { if (whm && whm.fullScreen) { return { fullscreen: 1, }; } /** @type {?} */ var mm = 1.5; if (whm && whm.Media) { mm = whm.Media; } /** @type {?} */ var val = { width: window.innerWidth / mm, height: window.innerHeight / mm }; if (whm && whm.hasOwnProperty('width')) { val.width = whm.width; } if (whm && whm.hasOwnProperty('height')) { val.height = whm.height; } return val; }; GlobalUtils.responsiveWidth = 960; GlobalUtils.timeshow = 8000; return GlobalUtils; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // @dynamic /** * @abstract */ var // @dynamic /** * @abstract */ ArrayUtils = /** @class */ (function () { function ArrayUtils() { } /** * @param {?} array * @param {?} find * @return {?} */ ArrayUtils.inArray = /** * @param {?} array * @param {?} find * @return {?} */ function (array, find) { return array.includes(find); }; /** * @param {?} array * @param {?} find * @return {?} */ ArrayUtils.notInArray = /** * @param {?} array * @param {?} find * @return {?} */ function (array, find) { return (!this.inArray(array, find)); }; /** * @param {?} arr * @param {?} obj * @return {?} */ ArrayUtils.objectInArray = /** * @param {?} arr * @param {?} obj * @return {?} */ function (arr, obj) { return (arr.find(function (oo) { return GlobalUtils