@ngrdt/utils 0.0.4 → 0.0.6

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.
Files changed (58) hide show
  1. package/.swcrc +29 -0
  2. package/eslint.config.js +22 -0
  3. package/jest.config.ts +30 -0
  4. package/package.json +7 -5
  5. package/project.json +29 -0
  6. package/rollup.config.js +20 -0
  7. package/src/index.ts +17 -0
  8. package/src/lib/__test__/array.utils.spec.ts +13 -0
  9. package/src/lib/__test__/css.utils.spec.ts +27 -0
  10. package/src/lib/__test__/date-format.spec.ts +71 -0
  11. package/src/lib/__test__/date.utils.spec.ts +72 -0
  12. package/src/lib/__test__/file-zip.utils.spec.ts +14 -0
  13. package/src/lib/__test__/object.utils.spec.ts +23 -0
  14. package/src/lib/__test__/random.utils.spec.ts +7 -0
  15. package/src/lib/__test__/string.utils.spec.ts +17 -0
  16. package/src/lib/types/aria.ts +334 -0
  17. package/src/lib/types/encodings.ts +273 -0
  18. package/src/lib/types/keyboard.ts +29 -0
  19. package/src/lib/types/mime-types.ts +119 -0
  20. package/src/lib/types/router.ts +1 -0
  21. package/src/lib/types/type.ts +43 -0
  22. package/src/lib/utils/array.ts +30 -0
  23. package/src/lib/utils/css.ts +69 -0
  24. package/src/lib/utils/date-format.ts +580 -0
  25. package/src/lib/utils/date.ts +363 -0
  26. package/src/lib/utils/file.ts +258 -0
  27. package/src/lib/utils/html.ts +26 -0
  28. package/src/lib/utils/model.ts +73 -0
  29. package/src/lib/utils/names.ts +73 -0
  30. package/src/lib/utils/object.ts +58 -0
  31. package/src/lib/utils/random.ts +9 -0
  32. package/src/lib/utils/rxjs.ts +30 -0
  33. package/src/lib/utils/string.ts +123 -0
  34. package/tsconfig.json +22 -0
  35. package/tsconfig.lib.json +11 -0
  36. package/tsconfig.spec.json +14 -0
  37. package/index.cjs.d.ts +0 -1
  38. package/index.cjs.js +0 -1
  39. package/index.esm.d.ts +0 -1
  40. package/index.esm.js +0 -1
  41. package/src/index.d.ts +0 -16
  42. package/src/lib/array.utils.d.ts +0 -6
  43. package/src/lib/color.utils.d.ts +0 -5
  44. package/src/lib/css.utils.d.ts +0 -12
  45. package/src/lib/date-format.d.ts +0 -77
  46. package/src/lib/date.utils.d.ts +0 -60
  47. package/src/lib/encodings.d.ts +0 -44
  48. package/src/lib/file.utils.d.ts +0 -69
  49. package/src/lib/html.utils.d.ts +0 -4
  50. package/src/lib/keyboard.utils.d.ts +0 -36
  51. package/src/lib/mime-types.d.ts +0 -109
  52. package/src/lib/model.utils.d.ts +0 -22
  53. package/src/lib/names.d.ts +0 -19
  54. package/src/lib/object.utils.d.ts +0 -5
  55. package/src/lib/random.utils.d.ts +0 -4
  56. package/src/lib/rxjs.utils.d.ts +0 -6
  57. package/src/lib/string.utils.d.ts +0 -22
  58. package/src/lib/type.utils.d.ts +0 -13
@@ -0,0 +1,73 @@
1
+ /**
2
+ * From @nx/devkit because it has nodejs as dependency and won't transpile.
3
+ * Util function to generate different strings based off the provided name.
4
+ *
5
+ * Examples:
6
+ *
7
+ * ```typescript
8
+ * names("my-name") // {name: 'my-name', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}
9
+ * names("myName") // {name: 'myName', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}
10
+ * ```
11
+ * @param name
12
+ */
13
+ export function names(name: string): {
14
+ name: string;
15
+ className: string;
16
+ propertyName: string;
17
+ constantName: string;
18
+ fileName: string;
19
+ } {
20
+ return {
21
+ name,
22
+ className: toClassName(name),
23
+ propertyName: toPropertyName(name),
24
+ constantName: toConstantName(name),
25
+ fileName: toFileName(name),
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Hyphenated to UpperCamelCase
31
+ */
32
+ function toClassName(str: string): string {
33
+ return toCapitalCase(toPropertyName(str));
34
+ }
35
+
36
+ /**
37
+ * Hyphenated to lowerCamelCase
38
+ */
39
+ function toPropertyName(s: string): string {
40
+ return s
41
+ .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) =>
42
+ chr ? chr.toUpperCase() : ''
43
+ )
44
+ .replace(/[^a-zA-Z\d]/g, '')
45
+ .replace(/^([A-Z])/, m => m.toLowerCase());
46
+ }
47
+
48
+ /**
49
+ * Hyphenated to CONSTANT_CASE
50
+ */
51
+ function toConstantName(s: string): string {
52
+ const normalizedS = s.toUpperCase() === s ? s.toLowerCase() : s;
53
+ return toFileName(toPropertyName(normalizedS))
54
+ .replace(/([^a-zA-Z0-9])/g, '_')
55
+ .toUpperCase();
56
+ }
57
+
58
+ /**
59
+ * Upper camelCase to lowercase, hyphenated
60
+ */
61
+ function toFileName(s: string): string {
62
+ return s
63
+ .replace(/([a-z\d])([A-Z])/g, '$1_$2')
64
+ .toLowerCase()
65
+ .replace(/(?!^_)[ _]/g, '-');
66
+ }
67
+
68
+ /**
69
+ * Capitalizes the first letter of a string
70
+ */
71
+ function toCapitalCase(s: string): string {
72
+ return s.charAt(0).toUpperCase() + s.slice(1);
73
+ }
@@ -0,0 +1,58 @@
1
+ export class RdtObjectUtils {
2
+ static pluck<T>(obj: T, path: string | (string | number)[]) {
3
+ if (!obj) {
4
+ return undefined;
5
+ }
6
+ const parts = Array.isArray(path) ? path : path.split('.');
7
+ let current: any = obj;
8
+
9
+ for (const key of parts) {
10
+ if (current == undefined) {
11
+ return undefined;
12
+ }
13
+ if (Array.isArray(current) && typeof key === 'string') {
14
+ current = current[parseInt(key)];
15
+ } else {
16
+ current = current[key];
17
+ }
18
+ }
19
+ return current;
20
+ }
21
+
22
+ static notNullGuard<T>(value: T | undefined | null): value is T {
23
+ return value != null;
24
+ }
25
+
26
+ static expandKey(key: string, value: any) {
27
+ const parts = key.split('.');
28
+ if (parts.length === 0) {
29
+ return value;
30
+ }
31
+ const first = getObjectFromKey(parts[0]);
32
+ let current = first;
33
+
34
+ for (let i = 1; i < parts.length; i++) {
35
+ const next = getObjectFromKey(parts[i]);
36
+ current.obj[current.key] = next.obj;
37
+ current = next;
38
+ }
39
+ current.obj[current.key] = value;
40
+
41
+ return first.obj;
42
+ }
43
+ }
44
+
45
+ function getObjectFromKey(key: string) {
46
+ const int = parseInt(key);
47
+ if (isNaN(int)) {
48
+ return {
49
+ obj: {} as any,
50
+ key: key,
51
+ } as const;
52
+ } else {
53
+ return {
54
+ obj: [] as any[],
55
+ key: int,
56
+ } as const;
57
+ }
58
+ }
@@ -0,0 +1,9 @@
1
+ export class RdtRandomUtils {
2
+ static randomId(): string {
3
+ return Math.random().toString(36).substring(2);
4
+ }
5
+
6
+ static trueFalse(): boolean {
7
+ return Math.random() < 0.5;
8
+ }
9
+ }
@@ -0,0 +1,30 @@
1
+ import {
2
+ Observable,
3
+ combineLatest,
4
+ map,
5
+ startWith,
6
+ switchMap,
7
+ EMPTY,
8
+ of,
9
+ } from 'rxjs';
10
+
11
+ export class RdtRxUtils {
12
+ // Will repeat last value when notifier$ emits anything.
13
+ static repeatLatestWhen<T>(notifier$: Observable<any>) {
14
+ return (source: Observable<T>) => {
15
+ return combineLatest([source, notifier$.pipe(startWith(null))]).pipe(
16
+ map(([val]) => val)
17
+ );
18
+ };
19
+ }
20
+
21
+ static completeIfNull<T>(source$: Observable<T>): Observable<NonNullable<T>> {
22
+ return source$.pipe(
23
+ switchMap((value) => (value == null ? EMPTY : of(value)))
24
+ );
25
+ }
26
+
27
+ static makeObservable<T>(value: T | Observable<T>): Observable<T> {
28
+ return value instanceof Observable ? value : of(value);
29
+ }
30
+ }
@@ -0,0 +1,123 @@
1
+ import { Params } from '@angular/router';
2
+ import { Nullable } from '../types/type';
3
+
4
+ export class RdtStringUtils {
5
+ static tokenize(value: string | undefined): string[] {
6
+ return value ? value.split(/\W+/).filter((tokens) => !!tokens) : [];
7
+ }
8
+
9
+ static joinPaths(parent: string, child: string) {
10
+ const b = parent.endsWith('/');
11
+ const p = child.startsWith('/');
12
+ if (b && p) {
13
+ return parent.slice(0, -1) + child;
14
+ } else if (b || p) {
15
+ return parent + child;
16
+ } else {
17
+ return parent + '/' + child;
18
+ }
19
+ }
20
+
21
+ static isAlphabetCharacter(char: string) {
22
+ if (char.length > 1) {
23
+ return false;
24
+ }
25
+ return char.toLocaleLowerCase() !== char.toLocaleUpperCase();
26
+ }
27
+
28
+ static isNumericCharacter(char: string) {
29
+ return !isNaN(parseInt(char));
30
+ }
31
+
32
+ static capitalize(str: string) {
33
+ return str.charAt(0).toLocaleUpperCase() + str.slice(1);
34
+ }
35
+
36
+ static toDataTestId(str: string) {
37
+ return RdtStringUtils.removeAccents(str).toLowerCase()?.replace(/ /g, '-');
38
+ }
39
+
40
+ static removeAccents(str: string) {
41
+ return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
42
+ }
43
+
44
+ static stripTrailingSlash(url: string): string {
45
+ const match = url.match(/#|\?|$/);
46
+ const pathEndIdx = (match && match.index) || url.length;
47
+ const droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
48
+ return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
49
+ }
50
+
51
+ static createAbsoluteUrl(url: string, baseHref: string) {
52
+ return RdtStringUtils.joinPaths(baseHref, url);
53
+ }
54
+
55
+ static appendQueryParams(url: string, params: Nullable<Params>) {
56
+ if (!params || Object.keys(params).length === 0) {
57
+ return url;
58
+ } else {
59
+ const queryParams = new URLSearchParams(params);
60
+ return `${url}?${queryParams}`;
61
+ }
62
+ }
63
+
64
+ static localeCompare(
65
+ a: Nullable<string>,
66
+ b: Nullable<string>,
67
+ order: 'asc' | 'desc' = 'asc'
68
+ ) {
69
+ const mult = order === 'asc' ? 1 : -1;
70
+ if (a == b) {
71
+ return 0;
72
+ } else if (a == null) {
73
+ return -mult;
74
+ } else if (b == null) {
75
+ return mult;
76
+ }
77
+ return a.localeCompare(b) * mult;
78
+ }
79
+
80
+ static komixcomlocalReplaceString(url: string) {
81
+ const hostname = location.hostname;
82
+ const replaceString = url.includes('komix.com')
83
+ ? 'komix.com'
84
+ : 'komix.local';
85
+ const toReplace = hostname.includes('komix.com')
86
+ ? 'komix.com'
87
+ : 'komix.local';
88
+ return { replaceString, toReplace };
89
+ }
90
+
91
+ static swapChars(src: string, i: number, j: number) {
92
+ if (i < 0 || j < 0 || i >= src.length || j >= src.length) {
93
+ return src;
94
+ }
95
+ if (j < i) {
96
+ [i, j] = [j, i];
97
+ }
98
+ return (
99
+ src.slice(0, i) + src[j] + src.slice(i + 1, j) + src[i] + src.slice(j + 1)
100
+ );
101
+ }
102
+
103
+ static insertAt(src: string, index: number, value: string) {
104
+ return src.slice(0, index) + value + src.slice(index);
105
+ }
106
+
107
+ static getDataTestId(
108
+ label: string,
109
+ prefix?: Nullable<string>,
110
+ suffix?: Nullable<string>
111
+ ) {
112
+ let dataTestId = label.toLowerCase()?.replace(/ /g, '-');
113
+
114
+ if (prefix) {
115
+ dataTestId = `${prefix}__${dataTestId}`;
116
+ }
117
+ if (suffix) {
118
+ dataTestId = `${dataTestId}--${suffix}`;
119
+ }
120
+
121
+ return RdtStringUtils.removeAccents(dataTestId);
122
+ }
123
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noImplicitReturns": true,
9
+ "noFallthroughCasesInSwitch": true,
10
+ "noPropertyAccessFromIndexSignature": true
11
+ },
12
+ "files": [],
13
+ "include": [],
14
+ "references": [
15
+ {
16
+ "path": "./tsconfig.lib.json"
17
+ },
18
+ {
19
+ "path": "./tsconfig.spec.json"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"],
7
+ "allowJs": true
8
+ },
9
+ "include": ["src/**/*.ts"],
10
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
11
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "jest.config.ts",
10
+ "src/**/*.test.ts",
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }
package/index.cjs.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src\\index";
package/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var t=require("rxjs");function e(t){return{name:t,className:(s=t,e=a(s),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:a(t),constantName:n(t),fileName:r(t)};var e,s}function a(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,a)=>a?a.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function n(t){return r(a(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function r(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const s=["je","lze"];function i(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class o{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=o.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return o.joinPaths(e,t)}static appendQueryParams(t,e){if(0===Object.keys(e).length)return t;return`${t}?${new URLSearchParams(e)}`}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),o.removeAccents(r)}}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},l.apply(this,arguments)}const p={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},c={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:p},u=l({},c,{SPACEBAR:"Space"}),d=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),g=d.map((t=>`Key${t.toUpperCase()}`));class m{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class h{static getDays(t,e){return h.getDayOffset(new Date(t))-h.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-h.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(h.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(h.hhMmSsMsRegex.test(t)){const a=t.match(h.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(h.hhMmSsRegex.test(t)){const a=t.match(h.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(h.hhMmRegex.test(t)){const a=t.match(h.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=h.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return h.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return h.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return h.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return h.isLeapYear(e+1)?365*e+r+h.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+h.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=h.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=h.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var f,x,M;h.MS=1,h.SECOND=1e3*h.MS,h.MINUTE=60*h.SECOND,h.HOUR=60*h.MINUTE,h.DAY=24*h.HOUR,h.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,h.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,h.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,h.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],h.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],exports.Month=void 0,(f=exports.Month||(exports.Month={}))[f.January=0]="January",f[f.February=1]="February",f[f.March=2]="March",f[f.April=3]="April",f[f.May=4]="May",f[f.June=5]="June",f[f.July=6]="July",f[f.August=7]="August",f[f.September=8]="September",f[f.October=9]="October",f[f.November=10]="November",f[f.December=11]="December",exports.RdtMimeType=void 0,(x=exports.RdtMimeType||(exports.RdtMimeType={})).DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",x.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",x.PDF="application/pdf",x.TXT="text/plain",x.CSV="text/csv",x.ZIP="application/zip",x.JPG="image/jpeg",x.PNG="image/png",x.GIF="image/gif",x.SVG="image/svg+xml",x.HTML="text/html",x.XML="application/xml",x.JSON="application/json",x.MP3="audio/mpeg",x.MP4="video/mp4",x.OGG="audio/ogg",x.WEBM="video/webm",x.WAV="audio/wav",x.AVI="video/x-msvideo",x.MPEG="video/mpeg",x.WEBP="image/webp",x.ICO="image/x-icon",x.TTF="font/ttf",x.WOFF="font/woff",x.WOFF2="font/woff2",x.EOT="application/vnd.ms-fontobject",x.OTF="font/otf",x.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",x.PPT="application/vnd.ms-powerpoint",x.XLS="application/vnd.ms-excel",x.DOC="application/msword",x.ODT="application/vnd.oasis.opendocument.text",x.ODS="application/vnd.oasis.opendocument.spreadsheet",x.ODP="application/vnd.oasis.opendocument.presentation",x.ODF="application/vnd.oasis.opendocument.formula",x.RAR="application/vnd.rar",x.TAR="application/x-tar",x.GZIP="application/gzip",x.BZIP2="application/x-bzip2",x.XZ="application/x-xz",x.SEVENZ="application/x-7z-compressed",x.RAR5="application/x-rar-compressed",x.WMA="audio/x-ms-wma",x.WMV="video/x-ms-wmv",x.FLV="video/x-flv",x.OGV="video/ogg",x.BIN="application/octet-stream",exports.VnshCombinedMimeType=void 0,(M=exports.VnshCombinedMimeType||(exports.VnshCombinedMimeType={})).IMAGE="image/*",M.AUDIO="audio/*",M.VIDEO="video/*",M.FONT="font/*",M.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",M.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",M.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",M.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed";const y={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin"},v={};for(const[t,e]of Object.entries(y))v[e]=t;var D,w;exports.RdtMsOfficeAction=void 0,(D=exports.RdtMsOfficeAction||(exports.RdtMsOfficeAction={})).Edit="ofe|u|",D.View="ofv|u|",exports.RdtMsOfficeApp=void 0,(w=exports.RdtMsOfficeApp||(exports.RdtMsOfficeApp={})).Word="ms-word",w.Excel="ms-excel",w.PowerPoint="ms-powerpoint";const b=exports.RdtMimeType.BIN,O="ofv|u|";var I;exports.FileSizeUnit=void 0,(I=exports.FileSizeUnit||(exports.FileSizeUnit={})).B="B",I.KB="KB",I.MB="MB",I.GB="GB",I.TB="TB",I.PB="PB",I.EB="EB",I.ZB="ZB",I.YB="YB";const R=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class S{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:S.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:O}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(S.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=S.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)}))}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:S.getMimeTypeFromFileName(e))?n:S.getMimeTypeFromBase64(t);const r=S.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:S.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=S.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();var a;return null!=(a=v[e])?a:b}static getFileName(t,e){if(e){const a=y[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+R[a]}static convertToBytes(t,e){const a=R.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===R.indexOf(r)?null:S.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case exports.RdtMimeType.DOC:case exports.RdtMimeType.DOCX:case exports.RdtMimeType.ODT:return"ms-word";case exports.RdtMimeType.XLS:case exports.RdtMimeType.XLSX:case exports.RdtMimeType.ODS:return"ms-excel";case exports.RdtMimeType.PPT:case exports.RdtMimeType.PPTX:case exports.RdtMimeType.ODP:return"ms-powerpoint";default:return null}}}class _{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?_.normalizeHex(e):this.isRgbColor(e)?_.normalizeRgb(e):this.isRgbaColor(e)?_.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(_.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(_.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(_.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return _.rgbRegex.test(t)}static isHexColor(t){return _.hexRegex.test(t)}static isRgbaColor(t){return _.rgbaRegex.test(t)}}var T;_.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,_.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,_.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(T||(T={}));var F,N,A,C,E;exports.RdtInsertMode=void 0,(F=exports.RdtInsertMode||(exports.RdtInsertMode={}))[F.Overwrite=0]="Overwrite",F[F.Shift=1]="Shift",exports.RdtPasteMode=void 0,(N=exports.RdtPasteMode||(exports.RdtPasteMode={}))[N.Replace=0]="Replace",N[N.Insert=1]="Insert",exports.RdtYearInputMode=void 0,(A=exports.RdtYearInputMode||(exports.RdtYearInputMode={}))[A.FourDigit=1]="FourDigit",A[A.TwoDigit=2]="TwoDigit",A[A.Both=3]="Both",exports.RdtLeadingZeroInputMode=void 0,(C=exports.RdtLeadingZeroInputMode||(exports.RdtLeadingZeroInputMode={}))[C.NoLeadingZero=1]="NoLeadingZero",C[C.LeadingZero=2]="LeadingZero",C[C.Both=3]="Both";exports.RdtEncoding=void 0,(E=exports.RdtEncoding||(exports.RdtEncoding={})).UTF_8="utf-8",E.IBM_866="ibm866",E.ISO_8859_2="iso-8859-2",E.ISO_8859_3="iso-8859-3",E.ISO_8859_4="iso-8859-4",E.ISO_8859_5="iso-8859-5",E.ISO_8859_6="iso-8859-6",E.ISO_8859_7="iso-8859-7",E.ISO_8859_8="iso-8859-8",E.ISO_8859_8_I="iso-8859-8-i",E.ISO_8859_10="iso-8859-10",E.ISO_8859_13="iso-8859-13",E.ISO_8859_14="iso-8859-14",E.ISO_8859_15="iso-8859-15",E.ISO_8859_16="iso-8859-16",E.KOI8_R="koi8-r",E.MACINTOSH="macintosh",E.WINDOWS_874="windows-874",E.WINDOWS_1250="windows-1250",E.WINDOWS_1251="windows-1251",E.WINDOWS_1252="windows-1252",E.WINDOWS_1253="windows-1253",E.WINDOWS_1254="windows-1254",E.WINDOWS_1255="windows-1255",E.WINDOWS_1256="windows-1256",E.WINDOWS_1257="windows-1257",E.WINDOWS_1258="windows-1258",E.X_MAC_CYRILLIC="x-mac-cyrillic",E.GBK="gbk",E.GB18030="gb18030",E.BIG5="big5",E.EUC_JP="euc-jp",E.ISO_2022_JP="iso-2022-jp",E.SHIFT_JIS="shift-jis",E.EUC_KR="euc-kr",E.HZ_GB_2312="hz-gb-2312",E.ISO_2022_CN="iso-2022-cn",E.ISO_2022_CN_EXT="iso-2022-cn-ext",E.ISO_2022_KR="iso-2022-kr",E.UTF_16="utf-16",E.X_USER_DEFINED="x-user-defined",exports.ALPHABET_KB_KEYS=d,exports.ARROW=p,exports.EXTENSION_BY_MIME_TYPE=y,exports.FileUtils=S,exports.KB_ALPHABET_CODES=g,exports.KB_CODE=u,exports.KB_KEY=c,exports.MIME_TYPE_BY_EXTENSION=v,exports.PRIMENG_DATE_FORMAT_META={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}},exports.RdtArrayUtils=class{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}},exports.RdtCssUtils=_,exports.RdtDateParser=class{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}get leadingZeroMode(){return this.cfg.leadingZeroMode}get yearInputMode(){return this.cfg.yearInputMode}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}get insertMode(){return this.cfg.insertMode}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,m.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,l="",p=e,c=!0,u=!1;for(let d=0;d<this._parsedFormat.length&&0!==n.length;d++){const g=this._parsedFormat[d],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;p-=g.value.length-e.length}n=n.substring(m)}l+=g.value}else{if(m<0)break;if(p>l.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&d!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-l.length<=5&&o.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),l+=t,a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a))}else n.match(/^\d{3}/)?(l+=n.substring(0,3),n=n.substring(3),l.length<=p&&(c=!1)):(l=n.substring(0,2),n=n.substring(2),l.length<=p&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||d===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?h.doubleDigitYearToPast(e):h.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),l+=t,1&this.cfg.yearInputMode&&d===this._parsedFormat.length-1&&(u=!0)}else n.match(/^\d/)&&(l+=n[0],n=n.substring(1),l.length<=p&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}}}let d=null;if(null!==i&&null!==s&&null!==r&&(d=new Date(i,s-1,r),d.getMonth()!==s-1&&(d=null)),p=Math.min(p,l.length+1),a)d||(l=t,p=e);else if(e===t.length)p=l.length;else if(c)for(;p>0&&l.length>p&&!o.isNumericCharacter(l[p]);)p++;return{prettyInput:l,date:d,complete:null!==d,caret:p,ambiguous:u||null===d}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",p=!1;if(1&this.cfg.leadingZeroMode){var c,u;let r=null!=(u=null==(c=n.match(/^\d+/))?void 0:c[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(p=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,p&&!s,s)),{value:o,complete:p,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let a=t.format;const n=[];for(;a.length>0;){const r=e.map((t=>a.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&o.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}},exports.RdtDateUtils=h,exports.RdtHTMLUtils=m,exports.RdtModelUtils=class{static inferPropertyInfo(t,a){const n=e(a).fileName.split("-"),r={};n.forEach((t=>r[t]=1));let i=0,o="";t.forEach((({key:t})=>{const a=e(t).fileName.split("-");let n=0;a.forEach((t=>{var e;return n+=null!=(e=r[t])?e:0}));const s=a.includes("id");n>i&&s?(i=n,o=t):n===i&&s&&t.length<o.length&&(o=t)}));return t.map((t=>{const a=e(t.key).fileName.split("-"),n=a.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===o,foreignKey:n&&t.key!==o,probablyBoolean:s.includes(a[0])&&"number"===t.type}}))}static names(t){return e(t)}},exports.RdtObjectUtils=class{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=i(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=i(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}},exports.RdtRandomUtils=class{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}},exports.RdtRxUtils=class{static repeatLatestWhen(e){return a=>t.combineLatest([a,e.pipe(t.startWith(null))]).pipe(t.map((([t])=>t)))}static completeIfNull(e){return e.pipe(t.switchMap((e=>null==e?t.EMPTY:t.of(e))))}static makeObservable(e){return e instanceof t.Observable?e:t.of(e)}},exports.RdtStringUtils=o,exports.Rdt_DEFAULT_MIME_TYPE=b,exports.Rdt_DEFAULT_MS_OFFICE_ACTION=O;
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src\\index";
package/index.esm.js DELETED
@@ -1 +0,0 @@
1
- import{combineLatest as t,startWith as e,map as a,switchMap as n,EMPTY as r,of as s,Observable as i}from"rxjs";function o(t){return{name:t,className:(a=t,e=l(a),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:l(t),constantName:c(t),fileName:p(t)};var e,a}function l(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,a)=>a?a.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function c(t){return p(l(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function p(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const u=["je","lze"];class g{static inferPropertyInfo(t,e){const a=o(e).fileName.split("-"),n={};a.forEach((t=>n[t]=1));let r=0,s="";t.forEach((({key:t})=>{const e=o(t).fileName.split("-");let a=0;e.forEach((t=>{var e;return a+=null!=(e=n[t])?e:0}));const i=e.includes("id");a>r&&i?(r=a,s=t):a===r&&i&&t.length<s.length&&(s=t)}));return t.map((t=>{const e=o(t.key).fileName.split("-"),a=e.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===s,foreignKey:a&&t.key!==s,probablyBoolean:u.includes(e[0])&&"number"===t.type}}))}static names(t){return o(t)}}class m{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}}class d{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=h(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=h(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}}function h(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class f{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}}class w{static repeatLatestWhen(n){return r=>t([r,n.pipe(e(null))]).pipe(a((([t])=>t)))}static completeIfNull(t){return t.pipe(n((t=>null==t?r:s(t))))}static makeObservable(t){return t instanceof i?t:s(t)}}class y{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=y.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return y.joinPaths(e,t)}static appendQueryParams(t,e){if(0===Object.keys(e).length)return t;return`${t}?${new URLSearchParams(e)}`}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),y.removeAccents(r)}}function D(){return D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},D.apply(this,arguments)}const v={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},x={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:v},b=D({},x,{SPACEBAR:"Space"}),M=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),O=M.map((t=>`Key${t.toUpperCase()}`));class S{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class I{static getDays(t,e){return I.getDayOffset(new Date(t))-I.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-I.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(I.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(I.hhMmSsMsRegex.test(t)){const a=t.match(I.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(I.hhMmSsRegex.test(t)){const a=t.match(I.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(I.hhMmRegex.test(t)){const a=t.match(I.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=I.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return I.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return I.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return I.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return I.isLeapYear(e+1)?365*e+r+I.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+I.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=I.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=I.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var F,_,N;I.MS=1,I.SECOND=1e3*I.MS,I.MINUTE=60*I.SECOND,I.HOUR=60*I.MINUTE,I.DAY=24*I.HOUR,I.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,I.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,I.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,I.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],I.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],function(t){t[t.January=0]="January",t[t.February=1]="February",t[t.March=2]="March",t[t.April=3]="April",t[t.May=4]="May",t[t.June=5]="June",t[t.July=6]="July",t[t.August=7]="August",t[t.September=8]="September",t[t.October=9]="October",t[t.November=10]="November",t[t.December=11]="December"}(F||(F={})),function(t){t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.ZIP="application/zip",t.JPG="image/jpeg",t.PNG="image/png",t.GIF="image/gif",t.SVG="image/svg+xml",t.HTML="text/html",t.XML="application/xml",t.JSON="application/json",t.MP3="audio/mpeg",t.MP4="video/mp4",t.OGG="audio/ogg",t.WEBM="video/webm",t.WAV="audio/wav",t.AVI="video/x-msvideo",t.MPEG="video/mpeg",t.WEBP="image/webp",t.ICO="image/x-icon",t.TTF="font/ttf",t.WOFF="font/woff",t.WOFF2="font/woff2",t.EOT="application/vnd.ms-fontobject",t.OTF="font/otf",t.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",t.PPT="application/vnd.ms-powerpoint",t.XLS="application/vnd.ms-excel",t.DOC="application/msword",t.ODT="application/vnd.oasis.opendocument.text",t.ODS="application/vnd.oasis.opendocument.spreadsheet",t.ODP="application/vnd.oasis.opendocument.presentation",t.ODF="application/vnd.oasis.opendocument.formula",t.RAR="application/vnd.rar",t.TAR="application/x-tar",t.GZIP="application/gzip",t.BZIP2="application/x-bzip2",t.XZ="application/x-xz",t.SEVENZ="application/x-7z-compressed",t.RAR5="application/x-rar-compressed",t.WMA="audio/x-ms-wma",t.WMV="video/x-ms-wmv",t.FLV="video/x-flv",t.OGV="video/ogg",t.BIN="application/octet-stream"}(_||(_={})),function(t){t.IMAGE="image/*",t.AUDIO="audio/*",t.VIDEO="video/*",t.FONT="font/*",t.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",t.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",t.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",t.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed"}(N||(N={}));const T={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin"},C={};for(const[t,e]of Object.entries(T))C[e]=t;var A,R;!function(t){t.Edit="ofe|u|",t.View="ofv|u|"}(A||(A={})),function(t){t.Word="ms-word",t.Excel="ms-excel",t.PowerPoint="ms-powerpoint"}(R||(R={}));const B=_.BIN,$="ofv|u|";var L;!function(t){t.B="B",t.KB="KB",t.MB="MB",t.GB="GB",t.TB="TB",t.PB="PB",t.EB="EB",t.ZB="ZB",t.YB="YB"}(L||(L={}));const E=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class P{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:P.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:$}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(P.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=P.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)}))}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:P.getMimeTypeFromFileName(e))?n:P.getMimeTypeFromBase64(t);const r=P.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:P.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=P.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();var a;return null!=(a=C[e])?a:B}static getFileName(t,e){if(e){const a=T[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+E[a]}static convertToBytes(t,e){const a=E.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===E.indexOf(r)?null:P.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case _.DOC:case _.DOCX:case _.ODT:return"ms-word";case _.XLS:case _.XLSX:case _.ODS:return"ms-excel";case _.PPT:case _.PPTX:case _.ODP:return"ms-powerpoint";default:return null}}}class W{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?W.normalizeHex(e):this.isRgbColor(e)?W.normalizeRgb(e):this.isRgbaColor(e)?W.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(W.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(W.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(W.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return W.rgbRegex.test(t)}static isHexColor(t){return W.hexRegex.test(t)}static isRgbaColor(t){return W.rgbaRegex.test(t)}}var Y;W.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,W.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,W.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(Y||(Y={}));const U={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}};var k,z,H,j,V;!function(t){t[t.Overwrite=0]="Overwrite",t[t.Shift=1]="Shift"}(k||(k={})),function(t){t[t.Replace=0]="Replace",t[t.Insert=1]="Insert"}(z||(z={})),function(t){t[t.FourDigit=1]="FourDigit",t[t.TwoDigit=2]="TwoDigit",t[t.Both=3]="Both"}(H||(H={})),function(t){t[t.NoLeadingZero=1]="NoLeadingZero",t[t.LeadingZero=2]="LeadingZero",t[t.Both=3]="Both"}(j||(j={}));class Z{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}get leadingZeroMode(){return this.cfg.leadingZeroMode}get yearInputMode(){return this.cfg.yearInputMode}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}get insertMode(){return this.cfg.insertMode}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,S.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,o="",l=e,c=!0,p=!1;for(let u=0;u<this._parsedFormat.length&&0!==n.length;u++){const g=this._parsedFormat[u],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;l-=g.value.length-e.length}n=n.substring(m)}o+=g.value}else{if(m<0)break;if(l>o.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&u!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-o.length<=5&&y.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),o+=t,a||({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a))}else n.match(/^\d{3}/)?(o+=n.substring(0,3),n=n.substring(3),o.length<=l&&(c=!1)):(o=n.substring(0,2),n=n.substring(2),o.length<=l&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||u===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?I.doubleDigitYearToPast(e):I.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),o+=t,1&this.cfg.yearInputMode&&u===this._parsedFormat.length-1&&(p=!0)}else n.match(/^\d/)&&(o+=n[0],n=n.substring(1),o.length<=l&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,o,n,l,a);o=t.output,n=t.rest,l=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),!t.complete&&o.length<=l&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,o,n,l,a);o=t.output,n=t.rest,l=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),!t.complete&&o.length<=l&&(c=!1))}}}let u=null;if(null!==i&&null!==s&&null!==r&&(u=new Date(i,s-1,r),u.getMonth()!==s-1&&(u=null)),l=Math.min(l,o.length+1),a)u||(o=t,l=e);else if(e===t.length)l=o.length;else if(c)for(;l>0&&o.length>l&&!y.isNumericCharacter(o[l]);)l++;return{prettyInput:o,date:u,complete:null!==u,caret:l,ambiguous:p||null===u}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",c=!1;if(1&this.cfg.leadingZeroMode){var p,u;let r=null!=(u=null==(p=n.match(/^\d+/))?void 0:p[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(c=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,c&&!s,s)),{value:o,complete:c,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let a=t.format;const n=[];for(;a.length>0;){const r=e.map((t=>a.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&y.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}}!function(t){t.UTF_8="utf-8",t.IBM_866="ibm866",t.ISO_8859_2="iso-8859-2",t.ISO_8859_3="iso-8859-3",t.ISO_8859_4="iso-8859-4",t.ISO_8859_5="iso-8859-5",t.ISO_8859_6="iso-8859-6",t.ISO_8859_7="iso-8859-7",t.ISO_8859_8="iso-8859-8",t.ISO_8859_8_I="iso-8859-8-i",t.ISO_8859_10="iso-8859-10",t.ISO_8859_13="iso-8859-13",t.ISO_8859_14="iso-8859-14",t.ISO_8859_15="iso-8859-15",t.ISO_8859_16="iso-8859-16",t.KOI8_R="koi8-r",t.MACINTOSH="macintosh",t.WINDOWS_874="windows-874",t.WINDOWS_1250="windows-1250",t.WINDOWS_1251="windows-1251",t.WINDOWS_1252="windows-1252",t.WINDOWS_1253="windows-1253",t.WINDOWS_1254="windows-1254",t.WINDOWS_1255="windows-1255",t.WINDOWS_1256="windows-1256",t.WINDOWS_1257="windows-1257",t.WINDOWS_1258="windows-1258",t.X_MAC_CYRILLIC="x-mac-cyrillic",t.GBK="gbk",t.GB18030="gb18030",t.BIG5="big5",t.EUC_JP="euc-jp",t.ISO_2022_JP="iso-2022-jp",t.SHIFT_JIS="shift-jis",t.EUC_KR="euc-kr",t.HZ_GB_2312="hz-gb-2312",t.ISO_2022_CN="iso-2022-cn",t.ISO_2022_CN_EXT="iso-2022-cn-ext",t.ISO_2022_KR="iso-2022-kr",t.UTF_16="utf-16",t.X_USER_DEFINED="x-user-defined"}(V||(V={}));export{M as ALPHABET_KB_KEYS,v as ARROW,T as EXTENSION_BY_MIME_TYPE,L as FileSizeUnit,P as FileUtils,O as KB_ALPHABET_CODES,b as KB_CODE,x as KB_KEY,C as MIME_TYPE_BY_EXTENSION,F as Month,U as PRIMENG_DATE_FORMAT_META,m as RdtArrayUtils,W as RdtCssUtils,Z as RdtDateParser,I as RdtDateUtils,V as RdtEncoding,S as RdtHTMLUtils,k as RdtInsertMode,j as RdtLeadingZeroInputMode,_ as RdtMimeType,g as RdtModelUtils,A as RdtMsOfficeAction,R as RdtMsOfficeApp,d as RdtObjectUtils,z as RdtPasteMode,f as RdtRandomUtils,w as RdtRxUtils,y as RdtStringUtils,H as RdtYearInputMode,B as Rdt_DEFAULT_MIME_TYPE,$ as Rdt_DEFAULT_MS_OFFICE_ACTION,N as VnshCombinedMimeType};
package/src/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export * from './lib/model.utils';
2
- export * from './lib/array.utils';
3
- export * from './lib/color.utils';
4
- export * from './lib/object.utils';
5
- export * from './lib/random.utils';
6
- export * from './lib/rxjs.utils';
7
- export * from './lib/type.utils';
8
- export * from './lib/string.utils';
9
- export * from './lib/keyboard.utils';
10
- export * from './lib/html.utils';
11
- export * from './lib/date.utils';
12
- export * from './lib/file.utils';
13
- export * from './lib/mime-types';
14
- export * from './lib/css.utils';
15
- export * from './lib/date-format';
16
- export * from './lib/encodings';
@@ -1,6 +0,0 @@
1
- import { Nullable } from './type.utils';
2
- export declare class RdtArrayUtils {
3
- static removeAt<T>(array: T[], index: number): T[];
4
- static insertAt<T>(array: T[], index: number, item: T): T[];
5
- static isEqual<T>(a: Nullable<Readonly<T[]>>, b: Nullable<Readonly<T[]>>): boolean;
6
- }
@@ -1,5 +0,0 @@
1
- export interface RdtRgbColor {
2
- r: number;
3
- g: number;
4
- b: number;
5
- }
@@ -1,12 +0,0 @@
1
- export declare class RdtCssUtils {
2
- static normalizeColor(color: string): string | null;
3
- private static normalizeHex;
4
- private static normalizeRgb;
5
- private static normalizeRgba;
6
- private static isRgbColor;
7
- private static isHexColor;
8
- private static isRgbaColor;
9
- private static rgbRegex;
10
- private static rgbaRegex;
11
- private static hexRegex;
12
- }
@@ -1,77 +0,0 @@
1
- interface RdtNumericNode {
2
- type: RdtFormatType.Day | RdtFormatType.Month | RdtFormatType.Year;
3
- maxLength: number;
4
- minLength: number;
5
- }
6
- declare enum RdtFormatType {
7
- Day = "day",
8
- Month = "month",
9
- Year = "year",
10
- Constant = "constant"
11
- }
12
- export declare const PRIMENG_DATE_FORMAT_META: Record<string, RdtNumericNode>;
13
- export interface RdtDateInputConfig {
14
- format: string;
15
- yearInputMode: RdtYearInputMode;
16
- twoDigitYearInputStrategy: RdtTwoDigitYearInputConversionStrategy;
17
- leadingZeroMode: RdtLeadingZeroInputMode;
18
- symbolMeta: Record<string, RdtNumericNode>;
19
- insertMode: RdtInsertMode;
20
- }
21
- export declare enum RdtInsertMode {
22
- Overwrite = 0,
23
- Shift = 1
24
- }
25
- export declare enum RdtPasteMode {
26
- Replace = 0,
27
- Insert = 1
28
- }
29
- export declare enum RdtYearInputMode {
30
- FourDigit = 1,
31
- TwoDigit = 2,
32
- Both = 3
33
- }
34
- export declare enum RdtLeadingZeroInputMode {
35
- NoLeadingZero = 1,
36
- LeadingZero = 2,
37
- Both = 3
38
- }
39
- export type RdtTwoDigitYearInputConversionStrategy = 'past' | 'future';
40
- export declare class RdtDateParser {
41
- private cfg;
42
- private _value;
43
- private _inputValue;
44
- private _parsedFormat;
45
- private deleting;
46
- private caretPosition;
47
- constructor(cfg: RdtDateInputConfig);
48
- set leadingZeroMode(mode: RdtLeadingZeroInputMode);
49
- set yearInputMode(mode: RdtYearInputMode);
50
- set twoDigitYearInputStrategy(strategy: RdtTwoDigitYearInputConversionStrategy);
51
- set insertMode(mode: RdtInsertMode);
52
- set format(format: string);
53
- get format(): string;
54
- get leadingZeroMode(): RdtLeadingZeroInputMode;
55
- get yearInputMode(): RdtYearInputMode;
56
- get twoDigitYearInputStrategy(): RdtTwoDigitYearInputConversionStrategy;
57
- get insertMode(): RdtInsertMode;
58
- onKeyDown(event: KeyboardEvent): void;
59
- onKeyUp(event: KeyboardEvent): void;
60
- onInput(event: InputEvent): void;
61
- get value(): Date | null;
62
- set value(d: Date | null);
63
- set inputValue(value: string);
64
- get inputValue(): string;
65
- parse(input: string, caretPosition?: number, deleting?: boolean): {
66
- prettyInput: string;
67
- date: Date | null;
68
- complete: boolean;
69
- caret: number;
70
- ambiguous: boolean;
71
- };
72
- private readNumber;
73
- private parseFormat;
74
- private useUpNumbersUntilNextSeparator;
75
- private containsNonNumericCharacters;
76
- }
77
- export {};