coer-elements 0.0.4 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/index.mjs +2 -2
- package/fesm2022/coer-elements.mjs +0 -1000
- package/fesm2022/coer-elements.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/{Tools → tools}/src/Breadcrumbs.class.ts +1 -1
- package/{Tools → tools}/src/Files.class.ts +1 -1
- package/{Tools → tools}/src/Page.class.ts +4 -2
- package/{Tools → tools}/src/Source.class.ts +2 -1
- package/Signals/index.ts +0 -3
- package/Signals/src/breakpoint.signal.ts +0 -3
- package/Signals/src/isLoading.signal.ts +0 -2
- package/Signals/src/isModalOpen.signal.ts +0 -2
- package/Tools/index.d.ts +0 -8
- package/Tools/src/Breadcrumbs.class.d.ts +0 -18
- package/Tools/src/ControlValue.d.ts +0 -23
- package/Tools/src/DateTime.class.d.ts +0 -11
- package/Tools/src/Files.class.d.ts +0 -16
- package/Tools/src/Page.class.d.ts +0 -66
- package/Tools/src/Screen.class.d.ts +0 -11
- package/Tools/src/Source.class.d.ts +0 -20
- package/Tools/src/Tools.d.ts +0 -33
- package/components/index.d.ts +0 -2
- package/components/src/coer-alert/coer-alert.component.d.ts +0 -23
- package/components/src/components.module.d.ts +0 -10
- package/esm2022/Tools/index.mjs +0 -9
- package/esm2022/Tools/src/Breadcrumbs.class.mjs +0 -63
- package/esm2022/Tools/src/ControlValue.mjs +0 -44
- package/esm2022/Tools/src/DateTime.class.mjs +0 -22
- package/esm2022/Tools/src/Files.class.mjs +0 -93
- package/esm2022/Tools/src/Page.class.mjs +0 -160
- package/esm2022/Tools/src/Screen.class.mjs +0 -43
- package/esm2022/Tools/src/Source.class.mjs +0 -79
- package/esm2022/Tools/src/Tools.mjs +0 -200
- package/esm2022/components/index.mjs +0 -3
- package/esm2022/components/src/coer-alert/coer-alert.component.mjs +0 -227
- package/esm2022/components/src/components.module.mjs +0 -92
- package/esm2022/interfaces/index.mjs +0 -7
- package/esm2022/interfaces/src/IAppSource.interface.mjs +0 -2
- package/esm2022/interfaces/src/IBreadcrumb.interface.mjs +0 -2
- package/esm2022/interfaces/src/ICoerRef.interface.mjs +0 -2
- package/esm2022/interfaces/src/IGoBack.interface.mjs +0 -2
- package/esm2022/interfaces/src/IPatch.interface.mjs +0 -2
- package/esm2022/interfaces/src/IScreenSize.interface.mjs +0 -2
- package/interfaces/index.d.ts +0 -6
- package/interfaces/src/IAppSource.interface.d.ts +0 -4
- package/interfaces/src/IBreadcrumb.interface.d.ts +0 -6
- package/interfaces/src/ICoerRef.interface.d.ts +0 -10
- package/interfaces/src/IGoBack.interface.d.ts +0 -6
- package/interfaces/src/IPatch.interface.d.ts +0 -5
- package/interfaces/src/IScreenSize.interface.d.ts +0 -5
- /package/{Tools → tools}/index.ts +0 -0
- /package/{Tools → tools}/src/ControlValue.ts +0 -0
- /package/{Tools → tools}/src/DateTime.class.ts +0 -0
- /package/{Tools → tools}/src/Screen.class.ts +0 -0
- /package/{Tools → tools}/src/Tools.ts +0 -0
@@ -1,44 +0,0 @@
|
|
1
|
-
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
2
|
-
import { forwardRef } from "@angular/core";
|
3
|
-
export const CONTROL_VALUE = (component) => {
|
4
|
-
return {
|
5
|
-
provide: NG_VALUE_ACCESSOR,
|
6
|
-
useExisting: forwardRef(() => component),
|
7
|
-
multi: true
|
8
|
-
};
|
9
|
-
};
|
10
|
-
export class ControlValue {
|
11
|
-
constructor() {
|
12
|
-
this._isTouched = false;
|
13
|
-
}
|
14
|
-
get isTouched() {
|
15
|
-
return this._isTouched;
|
16
|
-
}
|
17
|
-
/** */
|
18
|
-
SetValue(value) {
|
19
|
-
if (typeof this._UpdateValue === 'function') {
|
20
|
-
this._UpdateValue(value);
|
21
|
-
}
|
22
|
-
this._value = value;
|
23
|
-
}
|
24
|
-
/** */
|
25
|
-
SetTouched(isTouched) {
|
26
|
-
if (typeof this._IsTouched === 'function') {
|
27
|
-
this._IsTouched(isTouched);
|
28
|
-
}
|
29
|
-
this._isTouched = isTouched;
|
30
|
-
}
|
31
|
-
/** */
|
32
|
-
writeValue(value) {
|
33
|
-
this._value = value;
|
34
|
-
}
|
35
|
-
/** */
|
36
|
-
registerOnChange(callback) {
|
37
|
-
this._UpdateValue = callback;
|
38
|
-
}
|
39
|
-
/** */
|
40
|
-
registerOnTouched(callback) {
|
41
|
-
this._IsTouched = callback;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29udHJvbFZhbHVlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9Ub29scy9zcmMvQ29udHJvbFZhbHVlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBd0IsaUJBQWlCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN6RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTNDLE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBRyxDQUFJLFNBQVksRUFBRSxFQUFFO0lBQzdDLE9BQU87UUFDSCxPQUFPLEVBQUUsaUJBQWlCO1FBQzFCLFdBQVcsRUFBRSxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsU0FBUyxDQUFDO1FBQ3hDLEtBQUssRUFBRSxJQUFJO0tBQ2QsQ0FBQTtBQUNMLENBQUMsQ0FBQTtBQUdELE1BQU0sT0FBTyxZQUFZO0lBQXpCO1FBSVksZUFBVSxHQUFZLEtBQUssQ0FBQztJQThDeEMsQ0FBQztJQXpDRyxJQUFXLFNBQVM7UUFDaEIsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDO0lBQzNCLENBQUM7SUFHRCxNQUFNO0lBQ0ksUUFBUSxDQUFDLEtBQVU7UUFDekIsSUFBRyxPQUFPLElBQUksQ0FB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QpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhpcy5faXNUb3VjaGVkID0gaXNUb3VjaGVkO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyB3cml0ZVZhbHVlKHZhbHVlOiBhbnkpOiB2b2lkIHtcclxuICAgICAgICB0aGlzLl92YWx1ZSA9IHZhbHVlO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyByZWdpc3Rlck9uQ2hhbmdlKGNhbGxiYWNrOiBGdW5jdGlvbik6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuX1VwZGF0ZVZhbHVlID0gY2FsbGJhY2s7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiAqL1xyXG4gICAgcHVibGljIHJlZ2lzdGVyT25Ub3VjaGVkKGNhbGxiYWNrOiBGdW5jdGlvbik6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuX0lzVG91Y2hlZCA9IGNhbGxiYWNrO1xyXG4gICAgfVxyXG59Il19
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import moment from "moment";
|
2
|
-
export class DateTime {
|
3
|
-
/** Get UTC Offset */
|
4
|
-
static GetUTCOffset() {
|
5
|
-
return moment().utcOffset();
|
6
|
-
}
|
7
|
-
/** Convert UTC Date to Local Zone */
|
8
|
-
static ToLocalZone(utcDate) {
|
9
|
-
return moment(utcDate).add(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
10
|
-
}
|
11
|
-
/** Convert Local Zone Date to UTC */
|
12
|
-
static ToUTC(utcDate) {
|
13
|
-
return moment(utcDate).subtract(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
|
14
|
-
}
|
15
|
-
/** DD MMM YYYY */
|
16
|
-
static GetDateFormat(date) {
|
17
|
-
if ((typeof date === 'string'))
|
18
|
-
date = date.replaceAll('/', '-');
|
19
|
-
return moment(date).par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2V0KCksICdtaW51dGVzJykuZm9ybWF0KCdZWVlZLU1NLUREIEhIOm1tOnNzJyk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBERCBNTU0gWVlZWSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBHZXREYXRlRm9ybWF0KGRhdGU6IHN0cmluZyB8IERhdGUgfCBtb21lbnQuTW9tZW50KTogc3RyaW5nIHtcclxuICAgICAgICBpZiAoKHR5cGVvZiBkYXRlID09PSAnc3RyaW5nJykpIGRhdGUgPSBkYXRlLnJlcGxhY2VBbGwoJy8nLCAnLScpO1xyXG4gICAgICAgIHJldHVybiBtb21lbnQoZGF0ZSkucGFyc2Vab25lKCkubG9jYWwodHJ1ZSkuZm9ybWF0KCdERCBNTU0gWVlZWScpO1xyXG4gICAgfVxyXG59Il19
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import { Tools } from "../";
|
2
|
-
import * as XLSX from 'xlsx';
|
3
|
-
export class Files {
|
4
|
-
static { this.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv']; }
|
5
|
-
/** Get Extension File */
|
6
|
-
static GetExtension(file) {
|
7
|
-
const fileName = file.name;
|
8
|
-
if (fileName.includes('.')) {
|
9
|
-
let worlds = fileName.split('.');
|
10
|
-
if (worlds.length > 0) {
|
11
|
-
let extension = worlds.pop();
|
12
|
-
extension = extension.trim().toLowerCase();
|
13
|
-
if (extension.length > 0)
|
14
|
-
return extension;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
return null;
|
18
|
-
}
|
19
|
-
/** Is Excel File */
|
20
|
-
static IsExcel(file) {
|
21
|
-
const EXTENSION = Files.GetExtension(file);
|
22
|
-
return Tools.IsNotNull(EXTENSION)
|
23
|
-
? this.EXCEL_EXTENSIONS.includes(EXTENSION)
|
24
|
-
: false;
|
25
|
-
}
|
26
|
-
/** Read excel file */
|
27
|
-
static ReadExcel(file) {
|
28
|
-
return new Promise(Resolve => {
|
29
|
-
let columns = [];
|
30
|
-
let rows = [];
|
31
|
-
const reader = new FileReader();
|
32
|
-
reader.readAsArrayBuffer(file);
|
33
|
-
reader.onload = () => {
|
34
|
-
const dataBytes = new Uint8Array(reader.result);
|
35
|
-
if (dataBytes) {
|
36
|
-
const workbook = XLSX.read(dataBytes, {});
|
37
|
-
const sheet = workbook.Sheets[workbook.SheetNames[0]];
|
38
|
-
let dataSheet = XLSX.utils.sheet_to_json(sheet, {
|
39
|
-
header: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
40
|
-
});
|
41
|
-
//Get Headers
|
42
|
-
for (const column in dataSheet[0]) {
|
43
|
-
columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
|
44
|
-
}
|
45
|
-
//Get Rows
|
46
|
-
rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
|
47
|
-
rows.shift();
|
48
|
-
rows = rows.map(row => {
|
49
|
-
const item = Tools.BreakReference(row);
|
50
|
-
delete item['__rowNum__'];
|
51
|
-
return item;
|
52
|
-
});
|
53
|
-
}
|
54
|
-
Resolve({ columns, rows });
|
55
|
-
};
|
56
|
-
reader.onerror = () => { Resolve({ columns, rows }); };
|
57
|
-
});
|
58
|
-
}
|
59
|
-
/** Export to excel file */
|
60
|
-
static ExportExcel(data, fileName = 'coer_report', sheetName = 'Sheet1') {
|
61
|
-
sheetName = Tools.CleanUpBlanks(sheetName);
|
62
|
-
fileName = Tools.CleanUpBlanks(fileName);
|
63
|
-
if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
|
64
|
-
if (fileName.includes('.xls')) {
|
65
|
-
fileName = fileName.replaceAll('.xls', '.xlsx');
|
66
|
-
}
|
67
|
-
if (fileName.includes('.csv')) {
|
68
|
-
fileName = fileName.replaceAll('.csv', '.xlsx');
|
69
|
-
}
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
fileName += '.xlsx';
|
73
|
-
}
|
74
|
-
const WORK_SHEET = XLSX.utils.json_to_sheet(data);
|
75
|
-
const WORK_BOOK = XLSX.utils.book_new();
|
76
|
-
XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, 'Sheet1');
|
77
|
-
XLSX.writeFile(WORK_BOOK, fileName);
|
78
|
-
}
|
79
|
-
/** Convert file to string base64 */
|
80
|
-
static ConvertToBase64(file) {
|
81
|
-
return new Promise(Resolve => {
|
82
|
-
const reader = new FileReader();
|
83
|
-
reader.readAsDataURL(file);
|
84
|
-
reader.onload = () => {
|
85
|
-
Resolve(reader.result?.toString() || '');
|
86
|
-
};
|
87
|
-
reader.onerror = () => {
|
88
|
-
Resolve('');
|
89
|
-
};
|
90
|
-
});
|
91
|
-
}
|
92
|
-
}
|
93
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRmlsZXMuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL1Rvb2xzL3NyYy9GaWxlcy5jbGFzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBQzVCLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRTdCLE1BQU0sT0FBTyxLQUFLO2FBQ1MscUJBQWdCLEdBQWEsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBRTNFLHlCQUF5QjtJQUNsQixNQUFNLENBQUMsWUFBWSxDQUFDLElBQVU7UUFDakMsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQztRQUUzQixJQUFJLFFBQVEsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLEV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0aCA+IDApIHtcclxuICAgICAgICAgICAgICAgIGxldCBleHRlbnNpb24gPSB3b3JsZHMucG9wKCkhO1xyXG4gICAgICAgICAgICAgICAgZXh0ZW5zaW9uID0gZXh0ZW5zaW9uLnRyaW0oKS50b0xvd2VyQ2FzZSgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGV4dGVuc2lvbi5sZW5ndGggPiAwKSByZXR1cm4gZXh0ZW5zaW9uO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIElzIEV4Y2VsIEZpbGUgKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgSXNFeGNlbChmaWxlOiBGaWxlKTogYm9vbGVhbiB7XHJcbiAgICAgICAgY29uc3QgRVhURU5TSU9OID0gRmlsZXMuR2V0RXh0ZW5zaW9uKGZpbGUpO1xyXG5cclxuICAgICAgICByZXR1cm4gVG9vbHMuSXNOb3ROdWxsKEVYVEVOU0lPTilcclxuICAgICAgICAgICAgPyB0aGlzLkVYQ0VMX0VYVEVOU0lPTlMuaW5jbHVkZXMoRVhURU5TSU9OISlcclxuICAgICAgICAgICAgOiBmYWxzZTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIFJlYWQgZXhjZWwgZmlsZSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBSZWFkRXhjZWw8VD4oZmlsZTogRmlsZSkge1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZTx7IGNvbHVtbnM6IHN0cmluZ1tdOyByb3dzOiBUW107IH0+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBsZXQgY29sdW1uczogc3RyaW5nW10gPSBbXTtcclxuICAgICAgICAgICAgbGV0IHJvd3M6IFRbXSA9IFtdO1xyXG5cclxuICAgICAgICAgICAgY29uc3QgcmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0FycmF5QnVmZmVyKGZpbGUpO1xyXG5cclxuICAgICAgICAgICAgcmVhZGVyLm9ubG9hZCA9ICgpID0+IHtcclxuICAgICAgICAgICAgICAgIGNvbnN0IGRhdGFCeXRlcyA9IG5ldyBVaW50OEFycmF5KHJlYWRlci5yZXN1bHQgYXMgYW55KTtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZGF0YUJ5dGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgd29ya2Jvb2sgPSBYTFNYLnJlYWQoZGF0YUJ5dGVzLCB7fSk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hlZXQgPSB3b3JrYm9vay5TaGVldHNbd29ya2Jvb2suU2hlZXROYW1lc1swXV07XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFTaGVldDogYW55W10gPSBYTFNYLnV0aWxzLnNoZWV0X3RvX2pzb24oc2hlZXQsIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyOiBbJ0EnLCAnQicsICdDJywgJ0QnLCAnRScsICdGJywgJ0cnLCAnSCcsICdJJywgJ0onLCAnSycsICdMJywgJ00nLCAnTicsICdPJywgJ1AnLCAnUScsICdSJywgJ1MnLCAnVCcsICdVJywgJ1YnLCAnVycsICdYJywgJ1knLCAnWiddXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vR2V0IEhlYWRlcnNcclxuICAgICAgICAgICAgICAgICAgICBmb3IoY29uc3QgY29sdW1uIGluIGRhdGFTaGVldFswXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goVG9vbHMuRmlyc3RDaGFyVG9Mb3dlcihTdHJpbmcoZGF0YVNoZWV0WzBdW2NvbHVtbl0pLnJlcGxhY2VBbGwoJyAnLCAnJykpKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vR2V0IFJvd3NcclxuICAgICAgICAgICAgICAgICAgICByb3dzID0gWExTWC51dGlscy5zaGVldF90b19qc29uKHNoZWV0LCB7IGhlYWRlcjogY29sdW1ucyB9KTtcclxuICAgICAgICAgICAgICAgICAgICByb3dzLnNoaWZ0KCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIHJvd3MgPSByb3dzLm1hcChyb3cgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpdGVtID0gVG9vbHMuQnJlYWtSZWZlcmVuY2U8YW55Pihyb3cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgaXRlbVsnX19yb3dOdW1fXyddO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXRlbTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBSZXNvbHZlKHsgY29sdW1ucywgcm93cyB9KTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgcmVhZGVyLm9uZXJyb3IgPSAoKSA9PiB7IFJlc29sdmUoeyBjb2x1bW5zLCByb3dzIH0pIH1cclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIEV4cG9ydCB0byBleGNlbCBmaWxlICovXHJcbiAgICBwdWJsaWMgc3RhdGljIEV4cG9ydEV4Y2VsPFQ+KGRhdGE6IFRbXSwgZmlsZU5hbWU6IHN0cmluZyA9ICdjb2VyX3JlcG9ydCcsIHNoZWV0TmFtZTogc3RyaW5nID0gJ1NoZWV0MScpIHtcclxuICAgICAgICBzaGVldE5hbWUgPSBUb29scy5DbGVhblVwQmxhbmtzKHNoZWV0TmFtZSk7XHJcbiAgICAgICAgZmlsZU5hbWUgPSBUb29scy5DbGVhblVwQmxhbmtzKGZpbGVOYW1lKTtcclxuXHJcbiAgICAgICAgaWYoZmlsZU5hbWUuZW5kc1dpdGgoJy54bHMnKSB8fCBmaWxlTmFtZS5lbmRzV2l0aCgnLnhsc3gnKSB8fCBmaWxlTmFtZS5lbmRzV2l0aCgnLmNzdicpKSB7XHJcbiAgICAgICAgICAgIGlmIChmaWxlTmFtZS5pbmNsdWRlcygnLnhscycpKSB7XHJcbiAgICAgICAgICAgICAgICBmaWxlTmFtZSA9IGZpbGVOYW1lLnJlcGxhY2VBbGwoJy54bHMnLCAnLnhsc3gnKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKGZpbGVOYW1lLmluY2x1ZGVzKCcuY3N2JykpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVOYW1lID0gZmlsZU5hbWUucmVwbGFjZUFsbCgnLmNzdicsICcueGxzeCcpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgZmlsZU5hbWUgKz0gJy54bHN4JztcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGNvbnN0IFdPUktfU0hFRVQgPSBYTFNYLnV0aWxzLmpzb25fdG9fc2hlZXQoZGF0YSk7XHJcbiAgICAgICAgY29uc3QgV09SS19CT09LID0gWExTWC51dGlscy5ib29rX25ldygpO1xyXG4gICAgICAgIFhMU1gudXRpbHMuYm9va19hcHBlbmRfc2hlZXQoV09SS19CT09LLCBXT1JLX1NIRUVULCAnU2hlZXQxJyk7XHJcbiAgICAgICAgWExTWC53cml0ZUZpbGUoV09SS19CT09LLCBmaWxlTmFtZSk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBDb252ZXJ0IGZpbGUgdG8gc3RyaW5nIGJhc2U2NCAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBDb252ZXJ0VG9CYXNlNjQoZmlsZTogRmlsZSkge1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZTxzdHJpbmc+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBjb25zdCByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBSZXNvbHZlKHJlYWRlci5yZXN1bHQ/LnRvU3RyaW5nKCkgfHwgJycpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICByZWFkZXIub25lcnJvciA9ICgpID0+IHtcclxuICAgICAgICAgICAgICAgIFJlc29sdmUoJycpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcbn0iXX0=
|
@@ -1,160 +0,0 @@
|
|
1
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
2
|
-
import { Component, Inject, inject } from '@angular/core';
|
3
|
-
import { CoerAlert } from '../../components';
|
4
|
-
import { Breadcrumbs, Source, Tools } from '../';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
export class Page {
|
7
|
-
constructor(page) {
|
8
|
-
//Injection
|
9
|
-
this.alert = inject(CoerAlert);
|
10
|
-
this.router = inject(Router);
|
11
|
-
this.activatedRoute = inject(ActivatedRoute);
|
12
|
-
/** */
|
13
|
-
this.isUpdate = false;
|
14
|
-
/** */
|
15
|
-
this.isLoading = false;
|
16
|
-
/** */
|
17
|
-
this.isReady = false;
|
18
|
-
/** */
|
19
|
-
this.enableAnimations = false;
|
20
|
-
/** */
|
21
|
-
this.breadcrumbs = [];
|
22
|
-
/** */
|
23
|
-
this.pageResponse = null;
|
24
|
-
/** */
|
25
|
-
this.goBack = { show: false };
|
26
|
-
//Private Variables
|
27
|
-
this._page = '';
|
28
|
-
this._source = null;
|
29
|
-
this._preventDestroy = false;
|
30
|
-
/** */
|
31
|
-
this.GoBack = (path) => (() => {
|
32
|
-
if (path)
|
33
|
-
Breadcrumbs.Remove(path);
|
34
|
-
else
|
35
|
-
Breadcrumbs.RemoveLast();
|
36
|
-
});
|
37
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
38
|
-
this.IsNotNull = Tools.IsNotNull;
|
39
|
-
/** Returns true if the value is null or undefined, false otherwise */
|
40
|
-
this.IsNull = Tools.IsNull;
|
41
|
-
/** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
|
42
|
-
this.IsOnlyWhiteSpace = Tools.IsOnlyWhiteSpace;
|
43
|
-
this.SetPageName(page);
|
44
|
-
this.SetSource();
|
45
|
-
this.GetSource();
|
46
|
-
this.GetNavigation();
|
47
|
-
this.SetGoBack();
|
48
|
-
this.GetPageResponse();
|
49
|
-
}
|
50
|
-
ngAfterViewInit() {
|
51
|
-
this.routeParams = this.activatedRoute.snapshot.params;
|
52
|
-
this.queryParams = this.activatedRoute.snapshot.queryParams;
|
53
|
-
setTimeout(() => {
|
54
|
-
this.isReady = true;
|
55
|
-
this.RunPage();
|
56
|
-
setTimeout(() => { this.enableAnimations = true; }, 1000);
|
57
|
-
});
|
58
|
-
}
|
59
|
-
ngOnDestroy() {
|
60
|
-
if (!this._preventDestroy)
|
61
|
-
Source.ClearPageResponse();
|
62
|
-
}
|
63
|
-
/** Main method. Starts after ngAfterViewInit() */
|
64
|
-
RunPage() { }
|
65
|
-
;
|
66
|
-
/** Rename the last breadcrumb and update the url id */
|
67
|
-
SetPageName(name, id = null) {
|
68
|
-
this._page = name;
|
69
|
-
let path = this.router.url;
|
70
|
-
if (path.includes('?'))
|
71
|
-
path = path.split('?')[0];
|
72
|
-
if (id) {
|
73
|
-
const PATH_ARRAY = path.split('/');
|
74
|
-
const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
|
75
|
-
if (PATH_ID) {
|
76
|
-
PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
|
77
|
-
path = PATH_ARRAY.join('/');
|
78
|
-
}
|
79
|
-
}
|
80
|
-
if (this.breadcrumbs.length > 0) {
|
81
|
-
this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
|
82
|
-
this.breadcrumbs[this.breadcrumbs.length - 1].path = path;
|
83
|
-
Breadcrumbs.SetLast(name, path);
|
84
|
-
}
|
85
|
-
this.router.navigateByUrl(path);
|
86
|
-
}
|
87
|
-
/** */
|
88
|
-
SetSource() {
|
89
|
-
Source.Set(this._page);
|
90
|
-
}
|
91
|
-
/** */
|
92
|
-
GetSource() {
|
93
|
-
this._source = Source.Get();
|
94
|
-
}
|
95
|
-
/** */
|
96
|
-
GetPageResponse() {
|
97
|
-
this.pageResponse = Source.GetPageResponse();
|
98
|
-
}
|
99
|
-
/** */
|
100
|
-
GetNavigation() {
|
101
|
-
if (this._source) {
|
102
|
-
this.breadcrumbs = Breadcrumbs.Get().map(item => Object.assign({
|
103
|
-
page: item.page,
|
104
|
-
path: item.path,
|
105
|
-
click: this.GoBack(item.path)
|
106
|
-
}));
|
107
|
-
}
|
108
|
-
else
|
109
|
-
this.breadcrumbs = [{ page: this._page }];
|
110
|
-
}
|
111
|
-
/** */
|
112
|
-
SetGoBack() {
|
113
|
-
if (this._source) {
|
114
|
-
this.goBack = {
|
115
|
-
show: true,
|
116
|
-
path: this._source.path,
|
117
|
-
click: this.GoBack()
|
118
|
-
};
|
119
|
-
}
|
120
|
-
}
|
121
|
-
/** Navigate to previous page */
|
122
|
-
GoToSource(pageResponse = null) {
|
123
|
-
if (this._source) {
|
124
|
-
Breadcrumbs.RemoveLast();
|
125
|
-
this.SetPageResponse(pageResponse);
|
126
|
-
Tools.Sleep().then(_ => this.router.navigateByUrl(this._source.path));
|
127
|
-
}
|
128
|
-
}
|
129
|
-
;
|
130
|
-
/** */
|
131
|
-
SetPageResponse(pageResponse = null) {
|
132
|
-
if (Tools.IsNotNull(pageResponse)) {
|
133
|
-
this._preventDestroy = true;
|
134
|
-
Source.SetPageResponse(pageResponse);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
;
|
138
|
-
/** */
|
139
|
-
ReloadPage() {
|
140
|
-
Breadcrumbs.RemoveLast();
|
141
|
-
Tools.Sleep().then(_ => window.location.reload());
|
142
|
-
}
|
143
|
-
/** */
|
144
|
-
Log(value, log = null) {
|
145
|
-
if (Tools.IsNotNull(log))
|
146
|
-
console.log({ log, value });
|
147
|
-
else
|
148
|
-
console.log(value);
|
149
|
-
}
|
150
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, deps: [{ token: String }], target: i0.ɵɵFactoryTarget.Component }); }
|
151
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: Page, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
|
152
|
-
}
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Page, decorators: [{
|
154
|
-
type: Component,
|
155
|
-
args: [{ template: '' }]
|
156
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
157
|
-
type: Inject,
|
158
|
-
args: [String]
|
159
|
-
}] }] });
|
160
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGFnZS5jbGFzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvZXItZWxlbWVudHMvVG9vbHMvc3JjL1BhZ2UuY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RCxPQUFPLEVBQWlCLFNBQVMsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFhLE1BQU0sZUFBZSxDQUFDO0FBRXBGLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUM3QyxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFBRSxLQUFLLEV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ZWN0ZWQgSXNOb3ROdWxsID0gVG9vbHMuSXNOb3ROdWxsO1xyXG5cclxuICAgIC8qKiBSZXR1cm5zIHRydWUgaWYgdGhlIHZhbHVlIGlzIG51bGwgb3IgdW5kZWZpbmVkLCBmYWxzZSBvdGhlcndpc2UgKi9cclxuICAgIHByb3RlY3RlZCBJc051bGwgPSBUb29scy5Jc051bGw7XHJcblxyXG4gICAgLyoqIFJldHVybnMgdHJ1ZSBpZiB0aGUgdmFsdWUgaXMgbnVsbCBvciB1bmRlZmluZWQgb3IgY29udGFpbnMgb25seSB3aGl0ZXNwYWNlLCBmYWxzZSBvdGhlcndpc2UgKi9cclxuICAgIHByb3RlY3RlZCBJc09ubHlXaGl0ZVNwYWNlICA9IFRvb2xzLklzT25seVdoaXRlU3BhY2U7XHJcbn0iXX0=
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { Observable } from "rxjs";
|
2
|
-
export class Screen {
|
3
|
-
static get WINDOW_WIDTH() {
|
4
|
-
return window.innerWidth;
|
5
|
-
}
|
6
|
-
static get WINDOW_HEIGHT() {
|
7
|
-
return window.innerHeight;
|
8
|
-
}
|
9
|
-
static get DEVICE_WIDTH() {
|
10
|
-
return window.screen.width;
|
11
|
-
}
|
12
|
-
static get DEVICE_HEIGHT() {
|
13
|
-
return window.screen.height;
|
14
|
-
}
|
15
|
-
static get BREAKPOINT() {
|
16
|
-
if (window.innerWidth < 576)
|
17
|
-
return 'xs';
|
18
|
-
else if (window.innerWidth >= 576 && window.innerWidth < 768)
|
19
|
-
return 'sm';
|
20
|
-
else if (window.innerWidth >= 768 && window.innerWidth < 992)
|
21
|
-
return 'md';
|
22
|
-
else if (window.innerWidth >= 992 && window.innerWidth < 1200)
|
23
|
-
return 'lg';
|
24
|
-
else if (window.innerWidth >= 1200 && window.innerWidth < 1400)
|
25
|
-
return 'xl';
|
26
|
-
else
|
27
|
-
return 'xxl';
|
28
|
-
}
|
29
|
-
/** */
|
30
|
-
static { this.Resize = new Observable(subscriber => {
|
31
|
-
window.addEventListener("load", () => {
|
32
|
-
window.dispatchEvent(new Event('resize'));
|
33
|
-
});
|
34
|
-
window.onresize = () => {
|
35
|
-
subscriber.next({
|
36
|
-
width: window.innerWidth,
|
37
|
-
height: window.innerHeight,
|
38
|
-
breakpoin: this.BREAKPOINT
|
39
|
-
});
|
40
|
-
};
|
41
|
-
}); }
|
42
|
-
}
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2NyZWVuLmNsYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9Ub29scy9zcmMvU2NyZWVuLmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFbEMsTUFBTSxPQUFPLE1BQU07SUFFUixNQUFNLEtBQUssWUFBWTtRQUMxQixPQUFPLE1BQU0sQ0FBQyxVQUFVLENBQUM7SUFDN0IsQ0FBQztJQUdNLE1BQU0sS0FBSyxhQUFhO1FBQzNCLE9BQU8sTUFBTSxDQUFDLFdBQVcsQ0FBQztJQUM5QixDQUFDO0lBR00sTUFBTSxLQUFLLFlBQVk7UUFDMUIsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQztJQUMvQixDQUFDO0lBR00sTUFBTSxLQUFLLGFBQWE7UUFDM0IsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQztJQUNoQyxDQUFDO0lBR00sTUFBTSxLQUFLLFVBQVU7UUFDeEIsSUFBSSxNQUFNLENBQUMsVUFBVSxHQUFHLEdBQUc7WUFBRSxPQUFPLElBQUksQ0FBQzthQUNwQyxJQUFJLE1BQU0sQ0FBQyxVQUFVLElBQUksR0FBRyxJQUFJLE1BQU0sQ0FBQyxVQUFVL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mlubmVyV2lkdGggPj0gOTkyICYmIHdpbmRvdy5pbm5lcldpZHRoIDwgMTIwMCkgcmV0dXJuICdsZyc7XHJcbiAgICAgICAgZWxzZSBpZiAod2luZG93LmlubmVyV2lkdGggPj0gMTIwMCAmJiB3aW5kb3cuaW5uZXJXaWR0aCA8IDE0MDApIHJldHVybiAneGwnO1xyXG4gICAgICAgIGVsc2UgcmV0dXJuICd4eGwnO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgUmVzaXplID0gbmV3IE9ic2VydmFibGU8SVNjcmVlblNpemU+KHN1YnNjcmliZXIgPT4ge1xyXG4gICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKFwibG9hZFwiLCAoKSA9PiB7XHJcbiAgICAgICAgICAgIHdpbmRvdy5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVzaXplJykpO1xyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB3aW5kb3cub25yZXNpemUgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgIHN1YnNjcmliZXIubmV4dCh7XHJcbiAgICAgICAgICAgICAgICB3aWR0aDogd2luZG93LmlubmVyV2lkdGgsXHJcbiAgICAgICAgICAgICAgICBoZWlnaHQ6IHdpbmRvdy5pbm5lckhlaWdodCxcclxuICAgICAgICAgICAgICAgIGJyZWFrcG9pbjogdGhpcy5CUkVBS1BPSU5UXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuICAgIH0pO1xyXG59Il19
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { Router } from '@angular/router';
|
2
|
-
import { inject } from "@angular/core";
|
3
|
-
import { Breadcrumbs, Tools } from '../../Tools';
|
4
|
-
export class Source {
|
5
|
-
static { this.storage = 'COER-System'; }
|
6
|
-
/** */
|
7
|
-
static Set(page) {
|
8
|
-
const ROUTER = inject(Router);
|
9
|
-
let path = ROUTER.url;
|
10
|
-
if (path.includes('?'))
|
11
|
-
path = path.split('?')[0];
|
12
|
-
Breadcrumbs.Add(page, path);
|
13
|
-
const breadcrumbs = Breadcrumbs.Get();
|
14
|
-
if (breadcrumbs.length >= 2) {
|
15
|
-
breadcrumbs.pop();
|
16
|
-
const breadcrumb = breadcrumbs.pop();
|
17
|
-
this.Save({ page: breadcrumb.page, path: breadcrumb.path });
|
18
|
-
}
|
19
|
-
else
|
20
|
-
this.Save(null);
|
21
|
-
}
|
22
|
-
/** */
|
23
|
-
static Save(source) {
|
24
|
-
let storage = sessionStorage.getItem(this.storage);
|
25
|
-
if (storage)
|
26
|
-
storage = JSON.parse(storage);
|
27
|
-
storage = Object.assign({}, storage, { source });
|
28
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
29
|
-
}
|
30
|
-
/** */
|
31
|
-
static Get() {
|
32
|
-
let storage = sessionStorage.getItem(this.storage);
|
33
|
-
if (storage) {
|
34
|
-
storage = JSON.parse(storage);
|
35
|
-
if (storage.hasOwnProperty('source')) {
|
36
|
-
return storage.source;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
return null;
|
40
|
-
}
|
41
|
-
/** */
|
42
|
-
static GetRoot() {
|
43
|
-
const breadcrumbs = Breadcrumbs.Get();
|
44
|
-
return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
|
45
|
-
}
|
46
|
-
/** */
|
47
|
-
static SetPageResponse(pageResponse) {
|
48
|
-
let storage = sessionStorage.getItem(this.storage);
|
49
|
-
storage = JSON.parse(storage);
|
50
|
-
storage = Object.assign({}, storage, { pageResponse });
|
51
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
52
|
-
}
|
53
|
-
/** */
|
54
|
-
static GetPageResponse() {
|
55
|
-
let storage = sessionStorage.getItem(this.storage);
|
56
|
-
if (storage) {
|
57
|
-
storage = JSON.parse(storage);
|
58
|
-
if (storage.hasOwnProperty('pageResponse')) {
|
59
|
-
return Tools.BreakReference(storage.pageResponse);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
return null;
|
63
|
-
}
|
64
|
-
/** */
|
65
|
-
static ClearPageResponse() {
|
66
|
-
let storage = sessionStorage.getItem(this.storage);
|
67
|
-
storage = JSON.parse(storage);
|
68
|
-
if (storage.hasOwnProperty('pageResponse')) {
|
69
|
-
delete storage.pageResponse;
|
70
|
-
}
|
71
|
-
storage = Object.assign({}, storage);
|
72
|
-
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
73
|
-
}
|
74
|
-
/** Clear Source */
|
75
|
-
static Reset() {
|
76
|
-
sessionStorage.removeItem(this.storage);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU291cmNlLmNsYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9Ub29scy9zcmMvU291cmNlLmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUN6QyxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRXZDLE9BQU8sRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBRWpELE1BQU0sT0FBTyxNQUFNO2FBRVMsWUFBTyxHQUFHLGFBQWEsQ0FBQztJQUVoRCxNQUFNO0lBQ0MsTUFBTSxDQUFDLEdBQUcsQ0FBQyxJQUFZO1FBQzFCLE1BQU0sTUFBTSxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUU5QixJQUFJLElBQUksR0FBRyxNQUFNLENBQUMsR0FBRyxDQUFDO1FBQ3RCLElBQUksSUFBSSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUM7WUFBRSxJQUFJLEdBQUcsSU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