@selfcommunity/utils 0.2.7-alpha.0 → 0.2.7-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/utils/array.d.ts +7 -0
- package/lib/cjs/utils/array.js +17 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/lib/esm/utils/array.d.ts +7 -0
- package/lib/esm/utils/array.js +15 -0
- package/lib/umd/utils.js +1 -1
- package/package.json +2 -2
package/lib/cjs/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams,
|
|
|
3
3
|
import { getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering } from './utils/window';
|
|
4
4
|
import { mergeDeep, isObject, objectWithoutProperties, isFunc } from './utils/object';
|
|
5
5
|
import { isInteger } from './utils/number';
|
|
6
|
-
import { arraysEqual, groupBy } from './utils/array';
|
|
6
|
+
import { arraysEqual, groupBy, sortByAttr } from './utils/array';
|
|
7
7
|
import { loadVersionBrowser, iOS } from './utils/browser';
|
|
8
8
|
import { LocalStorageDB } from './utils/localStorage';
|
|
9
9
|
import LRUCache, { LruCache, LruCacheType, CacheStrategies } from './utils/cache';
|
|
@@ -13,4 +13,4 @@ import { resizeImage } from './utils/image';
|
|
|
13
13
|
/**
|
|
14
14
|
* Export all utilities
|
|
15
15
|
*/
|
|
16
|
-
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, LruCacheType, CacheStrategies, resizeImage };
|
|
16
|
+
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, sortByAttr, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, LruCacheType, CacheStrategies, resizeImage };
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resizeImage = exports.CacheStrategies = exports.LruCache = exports.LRUCache = exports.LocalStorageDB = exports.iOS = exports.loadVersionBrowser = exports.WSClient = exports.groupBy = exports.arraysEqual = exports.isInteger = exports.isFunc = exports.objectWithoutProperties = exports.isObject = exports.mergeDeep = exports.Logger = exports.isClientSideRendering = exports.getWindowHeight = exports.getWindowWidth = exports.getHighestSafeWindowContext = exports.updateQueryStringParameter = exports.getQueryStringParameter = exports.urlB64ToUint8Array = exports.appendURLSearchParams = exports.getDomain = exports.urlReplacer = exports.isValidUrls = exports.isValidUrl = exports.slugify = exports.random = exports.fallbackCopyTextToClipboard = exports.copyTextToClipboard = exports.camelCase = exports.stripHtml = exports.isString = exports.capitalize = void 0;
|
|
3
|
+
exports.resizeImage = exports.CacheStrategies = exports.LruCache = exports.LRUCache = exports.LocalStorageDB = exports.iOS = exports.loadVersionBrowser = exports.WSClient = exports.sortByAttr = exports.groupBy = exports.arraysEqual = exports.isInteger = exports.isFunc = exports.objectWithoutProperties = exports.isObject = exports.mergeDeep = exports.Logger = exports.isClientSideRendering = exports.getWindowHeight = exports.getWindowWidth = exports.getHighestSafeWindowContext = exports.updateQueryStringParameter = exports.getQueryStringParameter = exports.urlB64ToUint8Array = exports.appendURLSearchParams = exports.getDomain = exports.urlReplacer = exports.isValidUrls = exports.isValidUrl = exports.slugify = exports.random = exports.fallbackCopyTextToClipboard = exports.copyTextToClipboard = exports.camelCase = exports.stripHtml = exports.isString = exports.capitalize = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const string_1 = require("./utils/string");
|
|
6
6
|
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_1.capitalize; } });
|
|
@@ -35,6 +35,7 @@ Object.defineProperty(exports, "isInteger", { enumerable: true, get: function ()
|
|
|
35
35
|
const array_1 = require("./utils/array");
|
|
36
36
|
Object.defineProperty(exports, "arraysEqual", { enumerable: true, get: function () { return array_1.arraysEqual; } });
|
|
37
37
|
Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return array_1.groupBy; } });
|
|
38
|
+
Object.defineProperty(exports, "sortByAttr", { enumerable: true, get: function () { return array_1.sortByAttr; } });
|
|
38
39
|
const browser_1 = require("./utils/browser");
|
|
39
40
|
Object.defineProperty(exports, "loadVersionBrowser", { enumerable: true, get: function () { return browser_1.loadVersionBrowser; } });
|
|
40
41
|
Object.defineProperty(exports, "iOS", { enumerable: true, get: function () { return browser_1.iOS; } });
|
package/lib/cjs/utils/array.d.ts
CHANGED
|
@@ -12,3 +12,10 @@ export declare const arraysEqual: (a: any, b: any) => boolean;
|
|
|
12
12
|
* @return {Object} The grouped object
|
|
13
13
|
*/
|
|
14
14
|
export declare const groupBy: (arr: any, criteria: any) => any;
|
|
15
|
+
/**
|
|
16
|
+
* Sort an array of objects by attr.
|
|
17
|
+
* @param arr The array to group items from
|
|
18
|
+
* @param attr Order attribute
|
|
19
|
+
* @param asc Sort asc/desc
|
|
20
|
+
*/
|
|
21
|
+
export declare const sortByAttr: (arr: any, attr: any, asc?: boolean) => any;
|
package/lib/cjs/utils/array.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupBy = exports.arraysEqual = void 0;
|
|
3
|
+
exports.sortByAttr = exports.groupBy = exports.arraysEqual = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Check if two arrays are equal
|
|
6
6
|
* @param a
|
|
@@ -47,3 +47,19 @@ const groupBy = (arr, criteria) => {
|
|
|
47
47
|
}, {});
|
|
48
48
|
};
|
|
49
49
|
exports.groupBy = groupBy;
|
|
50
|
+
/**
|
|
51
|
+
* Sort an array of objects by attr.
|
|
52
|
+
* @param arr The array to group items from
|
|
53
|
+
* @param attr Order attribute
|
|
54
|
+
* @param asc Sort asc/desc
|
|
55
|
+
*/
|
|
56
|
+
const sortByAttr = (arr, attr, asc = true) => {
|
|
57
|
+
if (!Array.isArray(arr)) {
|
|
58
|
+
return arr;
|
|
59
|
+
}
|
|
60
|
+
const f = asc
|
|
61
|
+
? (a, b) => a[attr] - b[attr]
|
|
62
|
+
: (a, b) => b[attr] - a[attr];
|
|
63
|
+
return arr.sort(f);
|
|
64
|
+
};
|
|
65
|
+
exports.sortByAttr = sortByAttr;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams,
|
|
|
3
3
|
import { getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering } from './utils/window';
|
|
4
4
|
import { mergeDeep, isObject, objectWithoutProperties, isFunc } from './utils/object';
|
|
5
5
|
import { isInteger } from './utils/number';
|
|
6
|
-
import { arraysEqual, groupBy } from './utils/array';
|
|
6
|
+
import { arraysEqual, groupBy, sortByAttr } from './utils/array';
|
|
7
7
|
import { loadVersionBrowser, iOS } from './utils/browser';
|
|
8
8
|
import { LocalStorageDB } from './utils/localStorage';
|
|
9
9
|
import LRUCache, { LruCache, LruCacheType, CacheStrategies } from './utils/cache';
|
|
@@ -13,4 +13,4 @@ import { resizeImage } from './utils/image';
|
|
|
13
13
|
/**
|
|
14
14
|
* Export all utilities
|
|
15
15
|
*/
|
|
16
|
-
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, LruCacheType, CacheStrategies, resizeImage };
|
|
16
|
+
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, sortByAttr, WSClient, WSClientType, WSClientPropTypes, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, LruCacheType, CacheStrategies, resizeImage };
|
package/lib/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams,
|
|
|
3
3
|
import { getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering } from './utils/window';
|
|
4
4
|
import { mergeDeep, isObject, objectWithoutProperties, isFunc } from './utils/object';
|
|
5
5
|
import { isInteger } from './utils/number';
|
|
6
|
-
import { arraysEqual, groupBy } from './utils/array';
|
|
6
|
+
import { arraysEqual, groupBy, sortByAttr } from './utils/array';
|
|
7
7
|
import { loadVersionBrowser, iOS } from './utils/browser';
|
|
8
8
|
import { LocalStorageDB } from './utils/localStorage';
|
|
9
9
|
import LRUCache, { LruCache, CacheStrategies } from './utils/cache';
|
|
@@ -13,4 +13,4 @@ import { resizeImage } from './utils/image';
|
|
|
13
13
|
/**
|
|
14
14
|
* Export all utilities
|
|
15
15
|
*/
|
|
16
|
-
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, WSClient, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, CacheStrategies, resizeImage };
|
|
16
|
+
export { capitalize, isString, stripHtml, camelCase, copyTextToClipboard, fallbackCopyTextToClipboard, random, slugify, isValidUrl, isValidUrls, urlReplacer, getDomain, appendURLSearchParams, urlB64ToUint8Array, getQueryStringParameter, updateQueryStringParameter, getHighestSafeWindowContext, getWindowWidth, getWindowHeight, isClientSideRendering, Logger, mergeDeep, isObject, objectWithoutProperties, isFunc, isInteger, arraysEqual, groupBy, sortByAttr, WSClient, loadVersionBrowser, iOS, LocalStorageDB, LRUCache, LruCache, CacheStrategies, resizeImage };
|
package/lib/esm/utils/array.d.ts
CHANGED
|
@@ -12,3 +12,10 @@ export declare const arraysEqual: (a: any, b: any) => boolean;
|
|
|
12
12
|
* @return {Object} The grouped object
|
|
13
13
|
*/
|
|
14
14
|
export declare const groupBy: (arr: any, criteria: any) => any;
|
|
15
|
+
/**
|
|
16
|
+
* Sort an array of objects by attr.
|
|
17
|
+
* @param arr The array to group items from
|
|
18
|
+
* @param attr Order attribute
|
|
19
|
+
* @param asc Sort asc/desc
|
|
20
|
+
*/
|
|
21
|
+
export declare const sortByAttr: (arr: any, attr: any, asc?: boolean) => any;
|
package/lib/esm/utils/array.js
CHANGED
|
@@ -42,3 +42,18 @@ export const groupBy = (arr, criteria) => {
|
|
|
42
42
|
return obj;
|
|
43
43
|
}, {});
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Sort an array of objects by attr.
|
|
47
|
+
* @param arr The array to group items from
|
|
48
|
+
* @param attr Order attribute
|
|
49
|
+
* @param asc Sort asc/desc
|
|
50
|
+
*/
|
|
51
|
+
export const sortByAttr = (arr, attr, asc = true) => {
|
|
52
|
+
if (!Array.isArray(arr)) {
|
|
53
|
+
return arr;
|
|
54
|
+
}
|
|
55
|
+
const f = asc
|
|
56
|
+
? (a, b) => a[attr] - b[attr]
|
|
57
|
+
: (a, b) => b[attr] - a[attr];
|
|
58
|
+
return arr.sort(f);
|
|
59
|
+
};
|
package/lib/umd/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see utils.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SelfCommunityUtils=t():e.SelfCommunityUtils=t()}(self,(()=>(()=>{"use strict";var e={469:(e,t)=>{t.__esModule=!0,t.groupBy=t.arraysEqual=void 0,t.arraysEqual=(e,t)=>{if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0},t.groupBy=(e,t)=>e.reduce((function(e,r){let n="function"==typeof t?t(r):r[t];return e.hasOwnProperty(n)||(e[n]=[]),e[n].push(r),e}),{})},285:(e,t)=>{t.__esModule=!0,t.loadVersionBrowser=t.iOS=void 0,t.loadVersionBrowser=()=>{if("userAgentData"in navigator){const e=navigator.userAgentData;let t,r,n=null;for(let i=0;i<e.brands.length;i++){const o=e.brands[i].brand;if(r=e.brands[i].version,null!==o.match(/opera|chrome|edge|safari|firefox|msie|trident/i)){if(null===o.match(/chrome/i))return t=o.substr(o.indexOf(" ")+1),{name:t,version:r};n=r}}if(null!==n)return{name:"chrome",version:n}}let e,t=navigator.userAgent,r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(r[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],{name:"IE",version:e[1]||""}):"Chrome"===r[1]&&(e=t.match(/\bOPR\/(\d+)/),null!=e)?{name:"Opera",version:e[1]}:(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&r.splice(1,1,e[1]),{name:r[0],version:r[1]})},t.iOS=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},466:(e,t)=>{t.__esModule=!0,t.default=t.LruCache=t.CacheStrategies=void 0;class r{constructor(e=1e4){this.values=new Map,this.maxEntries=e,this.ssr="undefined"==typeof window,this.ssr||(window.__viewSCCache=this.values)}get(e,t,r={noSsr:!0}){let n;return this.values.has(e)?(n=this.values.get(e),this.values.delete(e),this.values.set(e,n)):t&&(n=t,(!this.ssr||!r.noSsr)&&this.values.set(e,n)),n}set(e,t,r={noSsr:!0}){if(!this.ssr||!r.noSsr){if(this.values.size>=this.maxEntries){const e=this.values.keys().next().value;this.values.delete(e)}this.values.set(e,t)}}hasKey(e){return this.values.has(e)}delete(e){this.values.has(e)&&this.values.delete(e)}deleteKeys(e){e.forEach((e=>{this.values.has(e)&&this.values.delete(e)}))}deleteKeysWithPrefix(e){this.values.forEach(((t,r)=>{r.startsWith(e)&&this.values.delete(r)}))}clean(){this.values=new Map}evaluate(){console.log(this.values)}}let n;t.LruCache=r,t.CacheStrategies=n,function(e){e.CACHE_FIRST="Cache-first",e.NETWORK_ONLY="Network-only",e.STALE_WHILE_REVALIDATE="Stale-While-Revalidate"}(n||(t.CacheStrategies=n={}));var i=new r;t.default=i},858:(e,t)=>{t.__esModule=!0,t.resizeImage=void 0,t.resizeImage=e=>new Promise(((t,r)=>{const n=new FileReader;n.onload=e=>{let r=new Image;r.onload=function(e){let n=document.createElement("canvas"),i=1920,o=r.width,s=r.height;o>s?o>i&&(s*=i/o,o=i):s>i&&(o*=i/s,s=i),n.width=o,n.height=s,n.getContext("2d").drawImage(r,0,0,o,s),t((e=>{let t;t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):unescape(e.split(",")[1]);let r=e.split(",")[0].split(":")[1].split(";")[0],n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new Blob([n],{type:r})})(n.toDataURL("image/jpeg")))},r.src=e.target.result},n.onerror=r,n.readAsDataURL(e)}))},153:(e,t)=>{t.__esModule=!0,t.LocalStorageDB=void 0,t.LocalStorageDB=class{static set(e,t){if(this.checkifSupport())try{window.localStorage.setItem(e,t)}catch(e){console.error(e)}else console.error("No support. Use a fallback such as browser cookies or store on the server.")}static get(e){try{let t=window.localStorage.getItem(e);return t&&"object"==typeof t?JSON.parse(t):t}catch(e){return null}}static getAll(){let e=[];for(let t=0;t<window.localStorage.length;t++){let r=localStorage.key(t);e.push(this.get(r))}return e}static remove(e){try{window.localStorage.removeItem(e),0==window.localStorage.length&&this.clearAll()}catch(e){console.error(e)}finally{this.get(e)&&(delete window.localStorage[e],0==window.localStorage.length&&this.clearAll())}}static clearAll(){try{window.localStorage.clear()}catch(e){console.error(e)}}static checkifSupport(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}}},502:(e,t)=>{t.__esModule=!0,t.Logger=void 0,t.Logger=class{static info(e,t){console.info(`%c[${e}]`,"color:#008080",` ${t}`)}static warn(e,t){console.warn(`%c[${e}]`,"color:#008080",` ${t}`)}static error(e,t){console.error(`%c[${e}]`,"color:#008080",` ${t}`)}static log(e,t){console.log(`%c[${e}]`,"color:#008080",` ${t}`)}static debug(e,t){console.debug(`%c[${e}]`,"color:#008080",` ${t}`)}}},597:(e,t)=>{t.__esModule=!0,t.isInteger=function(e){return!isNaN(e)&&parseInt(String(Number(e)))==e&&!isNaN(parseInt(String(e),10))}},297:(e,t)=>{function r(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}t.__esModule=!0,t.isFunc=function(e){return"function"==typeof e},t.isObject=r,t.mergeDeep=function e(t,n){let i=Object.assign({},t);return r(t)&&r(n)&&Object.keys(n).forEach((o=>{r(n[o])?o in t?i[o]=e(t[o],n[o]):Object.assign(i,{[o]:n[o]}):Object.assign(i,{[o]:n[o]})})),i},t.objectWithoutProperties=function(e,t){let r=e?Object.assign({},e):null;return t.forEach((function(e){r&&e in r&&delete r[e]})),r}},884:(e,t)=>{function r(e){let t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),Promise.resolve()}catch(e){return document.body.removeChild(t),Promise.reject(e)}}t.__esModule=!0,t.camelCase=function(e){return e.toLowerCase().replace(/[-_]+/g," ").replace(/[^\w\s]/g,"").replace(/ (.)/g,(e=>e.toUpperCase())).replace(/ /g,"")},t.capitalize=function(e){let t="",r=e.split(" ");for(let e=0;e<r.length;e++)t+=r[e].substring(0,1).toUpperCase()+r[e].substring(1,r[e].length);return t},t.copyTextToClipboard=function(e){return navigator.clipboard?navigator.clipboard.writeText(e):r(e)},t.fallbackCopyTextToClipboard=r,t.isString=function(e){return"string"==typeof e||e instanceof String},t.random=function(){return(Math.random()+1).toString(36).substring(7)},t.slugify=function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")},t.stripHtml=function(e){return e.replace(/<[^>]*>?/gm,"").trim()}},735:(e,t)=>{t.__esModule=!0,t.appendURLSearchParams=function(e,t){let r=e;if(t.length&&r){const e=Object.keys(t[0])[0];r+=(r.split("?")[1]?"&":"?")+`${e}=${t[0][e]}`,t.slice(1).map((e=>{const t=Object.keys(e)[0];r+=`&${t}=${e[t]}`}))}return r},t.urlReplacer=t.urlB64ToUint8Array=t.updateQueryStringParameter=t.isValidUrls=t.isValidUrl=t.getQueryStringParameter=t.getDomain=void 0,t.urlReplacer=e=>t=>function(e,t){const r=/\$\(([^)]+)?\)/g;let n=r.exec(e);for(;n;)e=e.replace(n[0],t[n[1]]),r.lastIndex=0,n=r.exec(e);return e}(e,t),t.getDomain=e=>{const t=e.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);return t&&t[1]?t[1]:""};const r=e=>/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(e);t.isValidUrl=r,t.isValidUrls=(e,t)=>e.trim().split(t).every(r),t.urlB64ToUint8Array=e=>{const t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;++e)n[e]=r.charCodeAt(e);return n},t.getQueryStringParameter=(e,t)=>e&&t?new URL(e).searchParams.get(t):null,t.updateQueryStringParameter=(e,t,r)=>{if(e&&t&&r){let n=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=-1!==e.indexOf("?")?"&":"?";return e.match(n)?e.replace(n,"$1"+t+"="+r+"$2"):e+i+t+"="+r}return e}},507:(e,t)=>{t.__esModule=!0,t.default=void 0;class r{constructor(e){this._attempts=1,this._heartbeatInterval=null,this._missedHeartbeats=0,this.isValidOptions(e)&&(this._cfg=Object.assign({},{heartbeatMsg:null,debug:!1,mustReconnect:!0},e),this.connect())}static getInstance(e){return this._instance=this._instance||new r(e),this._instance}connect(){try{if(this._ws&&(this.isConnecting()||this.isConnected()))return void(this._cfg.debug&&console.info("Websocket is connecting or already connected."));"function"==typeof this._cfg.connecting&&this._cfg.connecting(),this._cfg.debug&&console.info(`Connecting to ${this._cfg.uri} ...`),this._ws=new WebSocket(this._cfg.uri,this._cfg.protocols),this._ws.onopen=this.onOpen.bind(this),this._ws.onmessage=this.onMessage.bind(this),this._ws.onerror=this.onError.bind(this),this._ws.onclose=this.onClose.bind(this),this._timer=null}catch(e){console.error(e),this.tryToReconnect()}}isValidOptions(e){let t=!1;return e?(e.uri||(console.error("Invalid WSClient Uri options."),t=!0),e&&e.connecting&&"function"!=typeof e.connecting&&(console.error("Invalid WSClient connecting options."),t=!0),e&&e.connected&&"function"!=typeof e.connected&&(console.error("Invalid WSClient connected options."),t=!0),e&&e.receiveMessage&&"function"!=typeof e.receiveMessage&&(console.error("Invalid WSClient receiveMessage options."),t=!0),e&&e.disconnected&&"function"!=typeof e.disconnected&&(console.error("Invalid WSClient connecting options."),t=!0),e&&e.heartbeatMsg&&"string"!=typeof e.heartbeatMsg&&(console.error("Invalid WSClient heartbeatMsg options."),t=!0),e&&e.debug&&"boolean"!=typeof e.debug&&(console.error("Invalid WSClient debug options."),t=!0),!t):(console.error("Invalid WSClient options."),t)}tryToReconnect(){if(this._cfg.mustReconnect&&!this._timer){this._cfg.debug&&console.info("Reconnecting...");let e=this.generateInterval(this._attempts);this._timer=setTimeout(this.reconnect.bind(this),e)}}reconnect(){this._attempts++,this.connect()}sendHeartbeat(){try{if(this._missedHeartbeats++,this._missedHeartbeats>3)throw new Error("Too many missed heartbeats.");this._ws.send(this._cfg.heartbeatMsg)}catch(e){clearInterval(this._heartbeatInterval),this._heartbeatInterval=null,this._cfg.debug&&console.warn(`Closing connection. Reason: ${e.message}`),this.isClosing()||this.isClosed()||this.close()}}onOpen(){this._cfg.debug&&console.info("Connected!"),this._attempts=1,this._cfg.heartbeatMsg&&null===this._heartbeatInterval&&(this._missedHeartbeats=0,this._heartbeatInterval=setInterval(this.sendHeartbeat.bind(this),5e3)),"function"==typeof this._cfg.connected&&this._cfg.connected()}onClose(e){this._cfg.debug&&console.info("Connection closed!"),"function"==typeof this._cfg.disconnected&&this._cfg.disconnected(e),this.tryToReconnect()}onError(e){this._cfg.debug&&console.error("Websocket connection is broken!"),this._cfg.debug&&console.error(e)}onMessage(e){if(this._cfg.heartbeatMsg&&e.data===this._cfg.heartbeatMsg)this._missedHeartbeats=0;else if("function"==typeof this._cfg.receiveMessage)return this._cfg.receiveMessage(e.data)}generateInterval(e){let t=1e3*(Math.pow(2,e)-1);return t>3e4&&(t=3e4),Math.random()*t}sendMessage(e){this._ws&&this._ws.send(e)}getState(){return this._ws&&this._ws.readyState}isConnecting(){return this._ws&&0===this._ws.readyState}isConnected(){return this._ws&&1===this._ws.readyState}isClosing(){return this._ws&&2===this._ws.readyState}isClosed(){return this._ws&&3===this._ws.readyState}close(){clearInterval(this._heartbeatInterval),this._cfg.mustReconnect=!1,this.isClosing()&&this.isClosed()||(this._ws.close(),this._cfg.debug&&console.error("Websocket closed."))}}t.default=r},474:(e,t,r)=>{t.__esModule=!0,t.getHighestSafeWindowContext=function e(t=r.g.window.self){return t===r.g.window.top||(()=>{try{return r.g.window.location.hostname!==r.g.window.parent.location.hostname}catch(e){return!0}})()?t:e(t.parent)},t.getWindowHeight=function(){return void 0!==r.g.window?r.g.window.innerHeight:0},t.getWindowWidth=function(){return void 0!==r.g.window?r.g.window.innerWidth:0},t.isClientSideRendering=function(){return"undefined"!=typeof window}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var n={};return(()=>{var e=n;e.__esModule=!0;var t=r(884);e.capitalize=t.capitalize,e.isString=t.isString,e.stripHtml=t.stripHtml,e.camelCase=t.camelCase,e.copyTextToClipboard=t.copyTextToClipboard,e.fallbackCopyTextToClipboard=t.fallbackCopyTextToClipboard,e.random=t.random,e.slugify=t.slugify;var i=r(735);e.isValidUrl=i.isValidUrl,e.isValidUrls=i.isValidUrls,e.urlReplacer=i.urlReplacer,e.getDomain=i.getDomain,e.appendURLSearchParams=i.appendURLSearchParams,e.urlB64ToUint8Array=i.urlB64ToUint8Array,e.getQueryStringParameter=i.getQueryStringParameter,e.updateQueryStringParameter=i.updateQueryStringParameter;var o=r(474);e.getHighestSafeWindowContext=o.getHighestSafeWindowContext,e.getWindowWidth=o.getWindowWidth,e.getWindowHeight=o.getWindowHeight,e.isClientSideRendering=o.isClientSideRendering;var s=r(297);e.mergeDeep=s.mergeDeep,e.isObject=s.isObject,e.objectWithoutProperties=s.objectWithoutProperties,e.isFunc=s.isFunc;var a=r(597);e.isInteger=a.isInteger;var l=r(469);e.arraysEqual=l.arraysEqual,e.groupBy=l.groupBy;var c=r(285);e.loadVersionBrowser=c.loadVersionBrowser,e.iOS=c.iOS;var u=r(153);e.LocalStorageDB=u.LocalStorageDB;var h=w(r(466));e.LRUCache=h.default,e.LruCache=h.LruCache,e.LruCacheType=h.LruCacheType,e.CacheStrategies=h.CacheStrategies;var d=r(502);e.Logger=d.Logger;var g=w(r(507));e.WSClient=g.default,e.WSClientType=g.WSClientType,e.WSClientPropTypes=g.WSClientPropTypes;var f=r(858);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(p=function(e){return e?r:t})(e)}function w(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=p(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}e.resizeImage=f.resizeImage})(),n})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SelfCommunityUtils=t():e.SelfCommunityUtils=t()}(self,(()=>(()=>{"use strict";var e={469:(e,t)=>{t.__esModule=!0,t.sortByAttr=t.groupBy=t.arraysEqual=void 0,t.arraysEqual=(e,t)=>{if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0},t.groupBy=(e,t)=>e.reduce((function(e,r){let n="function"==typeof t?t(r):r[t];return e.hasOwnProperty(n)||(e[n]=[]),e[n].push(r),e}),{}),t.sortByAttr=(e,t,r=!0)=>{if(!Array.isArray(e))return e;const n=r?(e,r)=>e[t]-r[t]:(e,r)=>r[t]-e[t];return e.sort(n)}},285:(e,t)=>{t.__esModule=!0,t.loadVersionBrowser=t.iOS=void 0,t.loadVersionBrowser=()=>{if("userAgentData"in navigator){const e=navigator.userAgentData;let t,r,n=null;for(let i=0;i<e.brands.length;i++){const o=e.brands[i].brand;if(r=e.brands[i].version,null!==o.match(/opera|chrome|edge|safari|firefox|msie|trident/i)){if(null===o.match(/chrome/i))return t=o.substr(o.indexOf(" ")+1),{name:t,version:r};n=r}}if(null!==n)return{name:"chrome",version:n}}let e,t=navigator.userAgent,r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(r[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],{name:"IE",version:e[1]||""}):"Chrome"===r[1]&&(e=t.match(/\bOPR\/(\d+)/),null!=e)?{name:"Opera",version:e[1]}:(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&r.splice(1,1,e[1]),{name:r[0],version:r[1]})},t.iOS=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},466:(e,t)=>{t.__esModule=!0,t.default=t.LruCache=t.CacheStrategies=void 0;class r{constructor(e=1e4){this.values=new Map,this.maxEntries=e,this.ssr="undefined"==typeof window,this.ssr||(window.__viewSCCache=this.values)}get(e,t,r={noSsr:!0}){let n;return this.values.has(e)?(n=this.values.get(e),this.values.delete(e),this.values.set(e,n)):t&&(n=t,(!this.ssr||!r.noSsr)&&this.values.set(e,n)),n}set(e,t,r={noSsr:!0}){if(!this.ssr||!r.noSsr){if(this.values.size>=this.maxEntries){const e=this.values.keys().next().value;this.values.delete(e)}this.values.set(e,t)}}hasKey(e){return this.values.has(e)}delete(e){this.values.has(e)&&this.values.delete(e)}deleteKeys(e){e.forEach((e=>{this.values.has(e)&&this.values.delete(e)}))}deleteKeysWithPrefix(e){this.values.forEach(((t,r)=>{r.startsWith(e)&&this.values.delete(r)}))}clean(){this.values=new Map}evaluate(){console.log(this.values)}}let n;t.LruCache=r,t.CacheStrategies=n,function(e){e.CACHE_FIRST="Cache-first",e.NETWORK_ONLY="Network-only",e.STALE_WHILE_REVALIDATE="Stale-While-Revalidate"}(n||(t.CacheStrategies=n={}));var i=new r;t.default=i},858:(e,t)=>{t.__esModule=!0,t.resizeImage=void 0,t.resizeImage=e=>new Promise(((t,r)=>{const n=new FileReader;n.onload=e=>{let r=new Image;r.onload=function(e){let n=document.createElement("canvas"),i=1920,o=r.width,s=r.height;o>s?o>i&&(s*=i/o,o=i):s>i&&(o*=i/s,s=i),n.width=o,n.height=s,n.getContext("2d").drawImage(r,0,0,o,s),t((e=>{let t;t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):unescape(e.split(",")[1]);let r=e.split(",")[0].split(":")[1].split(";")[0],n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new Blob([n],{type:r})})(n.toDataURL("image/jpeg")))},r.src=e.target.result},n.onerror=r,n.readAsDataURL(e)}))},153:(e,t)=>{t.__esModule=!0,t.LocalStorageDB=void 0,t.LocalStorageDB=class{static set(e,t){if(this.checkifSupport())try{window.localStorage.setItem(e,t)}catch(e){console.error(e)}else console.error("No support. Use a fallback such as browser cookies or store on the server.")}static get(e){try{let t=window.localStorage.getItem(e);return t&&"object"==typeof t?JSON.parse(t):t}catch(e){return null}}static getAll(){let e=[];for(let t=0;t<window.localStorage.length;t++){let r=localStorage.key(t);e.push(this.get(r))}return e}static remove(e){try{window.localStorage.removeItem(e),0==window.localStorage.length&&this.clearAll()}catch(e){console.error(e)}finally{this.get(e)&&(delete window.localStorage[e],0==window.localStorage.length&&this.clearAll())}}static clearAll(){try{window.localStorage.clear()}catch(e){console.error(e)}}static checkifSupport(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}}},502:(e,t)=>{t.__esModule=!0,t.Logger=void 0,t.Logger=class{static info(e,t){console.info(`%c[${e}]`,"color:#008080",` ${t}`)}static warn(e,t){console.warn(`%c[${e}]`,"color:#008080",` ${t}`)}static error(e,t){console.error(`%c[${e}]`,"color:#008080",` ${t}`)}static log(e,t){console.log(`%c[${e}]`,"color:#008080",` ${t}`)}static debug(e,t){console.debug(`%c[${e}]`,"color:#008080",` ${t}`)}}},597:(e,t)=>{t.__esModule=!0,t.isInteger=function(e){return!isNaN(e)&&parseInt(String(Number(e)))==e&&!isNaN(parseInt(String(e),10))}},297:(e,t)=>{function r(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}t.__esModule=!0,t.isFunc=function(e){return"function"==typeof e},t.isObject=r,t.mergeDeep=function e(t,n){let i=Object.assign({},t);return r(t)&&r(n)&&Object.keys(n).forEach((o=>{r(n[o])?o in t?i[o]=e(t[o],n[o]):Object.assign(i,{[o]:n[o]}):Object.assign(i,{[o]:n[o]})})),i},t.objectWithoutProperties=function(e,t){let r=e?Object.assign({},e):null;return t.forEach((function(e){r&&e in r&&delete r[e]})),r}},884:(e,t)=>{function r(e){let t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),Promise.resolve()}catch(e){return document.body.removeChild(t),Promise.reject(e)}}t.__esModule=!0,t.camelCase=function(e){return e.toLowerCase().replace(/[-_]+/g," ").replace(/[^\w\s]/g,"").replace(/ (.)/g,(e=>e.toUpperCase())).replace(/ /g,"")},t.capitalize=function(e){let t="",r=e.split(" ");for(let e=0;e<r.length;e++)t+=r[e].substring(0,1).toUpperCase()+r[e].substring(1,r[e].length);return t},t.copyTextToClipboard=function(e){return navigator.clipboard?navigator.clipboard.writeText(e):r(e)},t.fallbackCopyTextToClipboard=r,t.isString=function(e){return"string"==typeof e||e instanceof String},t.random=function(){return(Math.random()+1).toString(36).substring(7)},t.slugify=function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")},t.stripHtml=function(e){return e.replace(/<[^>]*>?/gm,"").trim()}},735:(e,t)=>{t.__esModule=!0,t.appendURLSearchParams=function(e,t){let r=e;if(t.length&&r){const e=Object.keys(t[0])[0];r+=(r.split("?")[1]?"&":"?")+`${e}=${t[0][e]}`,t.slice(1).map((e=>{const t=Object.keys(e)[0];r+=`&${t}=${e[t]}`}))}return r},t.urlReplacer=t.urlB64ToUint8Array=t.updateQueryStringParameter=t.isValidUrls=t.isValidUrl=t.getQueryStringParameter=t.getDomain=void 0,t.urlReplacer=e=>t=>function(e,t){const r=/\$\(([^)]+)?\)/g;let n=r.exec(e);for(;n;)e=e.replace(n[0],t[n[1]]),r.lastIndex=0,n=r.exec(e);return e}(e,t),t.getDomain=e=>{const t=e.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);return t&&t[1]?t[1]:""};const r=e=>/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(e);t.isValidUrl=r,t.isValidUrls=(e,t)=>e.trim().split(t).every(r),t.urlB64ToUint8Array=e=>{const t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;++e)n[e]=r.charCodeAt(e);return n},t.getQueryStringParameter=(e,t)=>e&&t?new URL(e).searchParams.get(t):null,t.updateQueryStringParameter=(e,t,r)=>{if(e&&t&&r){let n=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=-1!==e.indexOf("?")?"&":"?";return e.match(n)?e.replace(n,"$1"+t+"="+r+"$2"):e+i+t+"="+r}return e}},507:(e,t)=>{t.__esModule=!0,t.default=void 0;class r{constructor(e){this._attempts=1,this._heartbeatInterval=null,this._missedHeartbeats=0,this.isValidOptions(e)&&(this._cfg=Object.assign({},{heartbeatMsg:null,debug:!1,mustReconnect:!0},e),this.connect())}static getInstance(e){return this._instance=this._instance||new r(e),this._instance}connect(){try{if(this._ws&&(this.isConnecting()||this.isConnected()))return void(this._cfg.debug&&console.info("Websocket is connecting or already connected."));"function"==typeof this._cfg.connecting&&this._cfg.connecting(),this._cfg.debug&&console.info(`Connecting to ${this._cfg.uri} ...`),this._ws=new WebSocket(this._cfg.uri,this._cfg.protocols),this._ws.onopen=this.onOpen.bind(this),this._ws.onmessage=this.onMessage.bind(this),this._ws.onerror=this.onError.bind(this),this._ws.onclose=this.onClose.bind(this),this._timer=null}catch(e){console.error(e),this.tryToReconnect()}}isValidOptions(e){let t=!1;return e?(e.uri||(console.error("Invalid WSClient Uri options."),t=!0),e&&e.connecting&&"function"!=typeof e.connecting&&(console.error("Invalid WSClient connecting options."),t=!0),e&&e.connected&&"function"!=typeof e.connected&&(console.error("Invalid WSClient connected options."),t=!0),e&&e.receiveMessage&&"function"!=typeof e.receiveMessage&&(console.error("Invalid WSClient receiveMessage options."),t=!0),e&&e.disconnected&&"function"!=typeof e.disconnected&&(console.error("Invalid WSClient connecting options."),t=!0),e&&e.heartbeatMsg&&"string"!=typeof e.heartbeatMsg&&(console.error("Invalid WSClient heartbeatMsg options."),t=!0),e&&e.debug&&"boolean"!=typeof e.debug&&(console.error("Invalid WSClient debug options."),t=!0),!t):(console.error("Invalid WSClient options."),t)}tryToReconnect(){if(this._cfg.mustReconnect&&!this._timer){this._cfg.debug&&console.info("Reconnecting...");let e=this.generateInterval(this._attempts);this._timer=setTimeout(this.reconnect.bind(this),e)}}reconnect(){this._attempts++,this.connect()}sendHeartbeat(){try{if(this._missedHeartbeats++,this._missedHeartbeats>3)throw new Error("Too many missed heartbeats.");this._ws.send(this._cfg.heartbeatMsg)}catch(e){clearInterval(this._heartbeatInterval),this._heartbeatInterval=null,this._cfg.debug&&console.warn(`Closing connection. Reason: ${e.message}`),this.isClosing()||this.isClosed()||this.close()}}onOpen(){this._cfg.debug&&console.info("Connected!"),this._attempts=1,this._cfg.heartbeatMsg&&null===this._heartbeatInterval&&(this._missedHeartbeats=0,this._heartbeatInterval=setInterval(this.sendHeartbeat.bind(this),5e3)),"function"==typeof this._cfg.connected&&this._cfg.connected()}onClose(e){this._cfg.debug&&console.info("Connection closed!"),"function"==typeof this._cfg.disconnected&&this._cfg.disconnected(e),this.tryToReconnect()}onError(e){this._cfg.debug&&console.error("Websocket connection is broken!"),this._cfg.debug&&console.error(e)}onMessage(e){if(this._cfg.heartbeatMsg&&e.data===this._cfg.heartbeatMsg)this._missedHeartbeats=0;else if("function"==typeof this._cfg.receiveMessage)return this._cfg.receiveMessage(e.data)}generateInterval(e){let t=1e3*(Math.pow(2,e)-1);return t>3e4&&(t=3e4),Math.random()*t}sendMessage(e){this._ws&&this._ws.send(e)}getState(){return this._ws&&this._ws.readyState}isConnecting(){return this._ws&&0===this._ws.readyState}isConnected(){return this._ws&&1===this._ws.readyState}isClosing(){return this._ws&&2===this._ws.readyState}isClosed(){return this._ws&&3===this._ws.readyState}close(){clearInterval(this._heartbeatInterval),this._cfg.mustReconnect=!1,this.isClosing()&&this.isClosed()||(this._ws.close(),this._cfg.debug&&console.error("Websocket closed."))}}t.default=r},474:(e,t,r)=>{t.__esModule=!0,t.getHighestSafeWindowContext=function e(t=r.g.window.self){return t===r.g.window.top||(()=>{try{return r.g.window.location.hostname!==r.g.window.parent.location.hostname}catch(e){return!0}})()?t:e(t.parent)},t.getWindowHeight=function(){return void 0!==r.g.window?r.g.window.innerHeight:0},t.getWindowWidth=function(){return void 0!==r.g.window?r.g.window.innerWidth:0},t.isClientSideRendering=function(){return"undefined"!=typeof window}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var n={};return(()=>{var e=n;e.__esModule=!0;var t=r(884);e.capitalize=t.capitalize,e.isString=t.isString,e.stripHtml=t.stripHtml,e.camelCase=t.camelCase,e.copyTextToClipboard=t.copyTextToClipboard,e.fallbackCopyTextToClipboard=t.fallbackCopyTextToClipboard,e.random=t.random,e.slugify=t.slugify;var i=r(735);e.isValidUrl=i.isValidUrl,e.isValidUrls=i.isValidUrls,e.urlReplacer=i.urlReplacer,e.getDomain=i.getDomain,e.appendURLSearchParams=i.appendURLSearchParams,e.urlB64ToUint8Array=i.urlB64ToUint8Array,e.getQueryStringParameter=i.getQueryStringParameter,e.updateQueryStringParameter=i.updateQueryStringParameter;var o=r(474);e.getHighestSafeWindowContext=o.getHighestSafeWindowContext,e.getWindowWidth=o.getWindowWidth,e.getWindowHeight=o.getWindowHeight,e.isClientSideRendering=o.isClientSideRendering;var s=r(297);e.mergeDeep=s.mergeDeep,e.isObject=s.isObject,e.objectWithoutProperties=s.objectWithoutProperties,e.isFunc=s.isFunc;var a=r(597);e.isInteger=a.isInteger;var l=r(469);e.arraysEqual=l.arraysEqual,e.groupBy=l.groupBy,e.sortByAttr=l.sortByAttr;var c=r(285);e.loadVersionBrowser=c.loadVersionBrowser,e.iOS=c.iOS;var u=r(153);e.LocalStorageDB=u.LocalStorageDB;var h=w(r(466));e.LRUCache=h.default,e.LruCache=h.LruCache,e.LruCacheType=h.LruCacheType,e.CacheStrategies=h.CacheStrategies;var d=r(502);e.Logger=d.Logger;var g=w(r(507));e.WSClient=g.default,e.WSClientType=g.WSClientType,e.WSClientPropTypes=g.WSClientPropTypes;var f=r(858);function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(p=function(e){return e?r:t})(e)}function w(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=p(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}e.resizeImage=f.resizeImage})(),n})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfcommunity/utils",
|
|
3
|
-
"version": "0.2.7-alpha.
|
|
3
|
+
"version": "0.2.7-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"bugs": {
|
|
102
102
|
"url": "https://github.com/selfcommunity/community-js/issues"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "d649556130501ba008d78e89446f6a133236a2b1"
|
|
105
105
|
}
|