analytica.click 0.0.203 → 0.0.209

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 (2) hide show
  1. package/dist/index.js +14 -4298
  2. package/package.json +15 -14
package/dist/index.js CHANGED
@@ -1,2881 +1,11 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __commonJS = (cb, mod) => function __require() {
25
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
- };
27
- var __export = (target, all) => {
28
- for (var name in all)
29
- __defProp(target, name, { get: all[name], enumerable: true });
30
- };
31
- var __copyProps = (to, from, except, desc) => {
32
- if (from && typeof from === "object" || typeof from === "function") {
33
- for (let key of __getOwnPropNames(from))
34
- if (!__hasOwnProp.call(to, key) && key !== except)
35
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
- }
37
- return to;
38
- };
39
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
40
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
- var __async = (__this, __arguments, generator) => {
42
- return new Promise((resolve, reject) => {
43
- var fulfilled = (value) => {
44
- try {
45
- step(generator.next(value));
46
- } catch (e) {
47
- reject(e);
48
- }
49
- };
50
- var rejected = (value) => {
51
- try {
52
- step(generator.throw(value));
53
- } catch (e) {
54
- reject(e);
55
- }
56
- };
57
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
58
- step((generator = generator.apply(__this, __arguments)).next());
59
- });
60
- };
61
-
62
- // ../../node_modules/ag-common/dist/common/helpers/array.js
63
- var require_array = __commonJS({
64
- "../../node_modules/ag-common/dist/common/helpers/array.js"(exports) {
65
- "use strict";
66
- Object.defineProperty(exports, "__esModule", { value: true });
67
- exports.distinct = exports.distinctBy = exports.notEmpty = exports.partition = exports.chunk = exports.take = exports.flat = exports.toObject = void 0;
68
- var toObject = (arr, keyF) => {
69
- const ret = {};
70
- if (!arr || !keyF) {
71
- return ret;
72
- }
73
- arr.forEach((v) => {
74
- const k = keyF(v);
75
- ret[k] = v;
76
- });
77
- return ret;
78
- };
79
- exports.toObject = toObject;
80
- var flat = (arr) => [].concat(...arr);
81
- exports.flat = flat;
82
- var take = (array, num) => {
83
- const ret = JSON.parse(JSON.stringify(array));
84
- return { part: ret.slice(0, num), rest: ret.slice(num) };
85
- };
86
- exports.take = take;
87
- var chunk = (array, max) => {
88
- const rows = [];
89
- let row = [];
90
- for (const k in array) {
91
- const item = array[k];
92
- row.push(item);
93
- if (row.length >= max) {
94
- rows.push(row);
95
- row = [];
96
- }
97
- }
98
- if (row.length > 0) {
99
- rows.push(row);
100
- }
101
- return rows;
102
- };
103
- exports.chunk = chunk;
104
- var partition = (array, func) => !(array === null || array === void 0 ? void 0 : array.length) ? null : [array.filter((r) => func(r)), array.filter((r) => !func(r))];
105
- exports.partition = partition;
106
- function notEmpty(value) {
107
- return value !== null && value !== void 0 && value !== false;
108
- }
109
- exports.notEmpty = notEmpty;
110
- function distinctBy(data, key, ignoreEmpty) {
111
- if (!data || data.length === 0) {
112
- return data;
113
- }
114
- const hashSet = /* @__PURE__ */ new Set();
115
- return data.filter((x) => {
116
- let keyVal;
117
- if (typeof key === "string") {
118
- keyVal = x[key];
119
- } else {
120
- keyVal = key(x);
121
- }
122
- if (!keyVal && ignoreEmpty) {
123
- return false;
124
- }
125
- if (!hashSet.has(keyVal)) {
126
- hashSet.add(keyVal);
127
- return true;
128
- }
129
- return false;
130
- });
131
- }
132
- exports.distinctBy = distinctBy;
133
- var distinct = (arr) => [
134
- ...new Set(arr)
135
- ];
136
- exports.distinct = distinct;
137
- }
138
- });
139
-
140
- // ../../node_modules/ag-common/dist/common/helpers/async.js
141
- var require_async = __commonJS({
142
- "../../node_modules/ag-common/dist/common/helpers/async.js"(exports) {
143
- "use strict";
144
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
145
- function adopt(value) {
146
- return value instanceof P ? value : new P(function(resolve) {
147
- resolve(value);
148
- });
149
- }
150
- return new (P || (P = Promise))(function(resolve, reject) {
151
- function fulfilled(value) {
152
- try {
153
- step(generator.next(value));
154
- } catch (e) {
155
- reject(e);
156
- }
157
- }
158
- function rejected(value) {
159
- try {
160
- step(generator["throw"](value));
161
- } catch (e) {
162
- reject(e);
163
- }
164
- }
165
- function step(result) {
166
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
167
- }
168
- step((generator = generator.apply(thisArg, _arguments || [])).next());
169
- });
170
- };
171
- Object.defineProperty(exports, "__esModule", { value: true });
172
- exports.asyncMap = exports.asyncForEach = void 0;
173
- function asyncForEach(array, callback) {
174
- return __awaiter(this, void 0, void 0, function* () {
175
- for (let index = 0; index < array.length; index += 1) {
176
- yield callback(array[index], index, array);
177
- }
178
- });
179
- }
180
- exports.asyncForEach = asyncForEach;
181
- function asyncMap(array, callback) {
182
- return __awaiter(this, void 0, void 0, function* () {
183
- const ret = [];
184
- for (let index = 0; index < array.length; index += 1) {
185
- ret.push(yield callback(array[index], index, array));
186
- }
187
- return ret;
188
- });
189
- }
190
- exports.asyncMap = asyncMap;
191
- }
192
- });
193
-
194
- // ../../node_modules/ag-common/dist/common/helpers/string.js
195
- var require_string = __commonJS({
196
- "../../node_modules/ag-common/dist/common/helpers/string.js"(exports) {
197
- "use strict";
198
- Object.defineProperty(exports, "__esModule", { value: true });
199
- exports.stringToObject = exports.chunkString = exports.safeStringify = exports.containsInsensitive = exports.containsInsensitiveIndex = exports.replaceRemove = exports.toTitleCase = exports.niceUrl = exports.truncate = exports.trim = exports.trimSide = exports.csvJSON = exports.fromBase64 = exports.toBase64 = void 0;
200
- var toBase64 = (str) => Buffer.from(str).toString("base64");
201
- exports.toBase64 = toBase64;
202
- var fromBase64 = (str) => Buffer.from(decodeURIComponent(str), "base64").toString();
203
- exports.fromBase64 = fromBase64;
204
- var csvJSON = (csv) => {
205
- const lines = csv.split("\n");
206
- const result = [];
207
- const headers = lines[0].split(",");
208
- for (let i = 1; i < lines.length; i += 1) {
209
- const obj = {};
210
- const currentline = lines[i].split(",");
211
- for (let j = 0; j < headers.length; j += 1) {
212
- obj[headers[j]] = currentline[j];
213
- }
214
- result.push(obj);
215
- }
216
- return result;
217
- };
218
- exports.csvJSON = csvJSON;
219
- function trimSide(str, fromStart = true, ...params) {
220
- const pstr = params.join("");
221
- if (!str) {
222
- return str;
223
- }
224
- const ret = str.replace(new RegExp(`[${pstr}]*$`, "g"), "");
225
- if (fromStart) {
226
- return ret.replace(new RegExp(`^[${pstr}]*`, "g"), "");
227
- }
228
- return ret;
229
- }
230
- exports.trimSide = trimSide;
231
- function trim(str, ...params) {
232
- if (!str) {
233
- return "";
234
- }
235
- str = trimSide(str, true, ...params);
236
- str = trimSide(str, false, ...params);
237
- return str;
238
- }
239
- exports.trim = trim;
240
- function truncate(str, n, ellip) {
241
- if (!str) {
242
- return void 0;
243
- }
244
- return str.length > n ? str.substr(0, n - 1) + ellip : str;
245
- }
246
- exports.truncate = truncate;
247
- var niceUrl = (siteUrl) => {
248
- if (!siteUrl) {
249
- return void 0;
250
- }
251
- let niceSiteUrl = siteUrl.substring(siteUrl.indexOf(":") + 1).replace("sc-domain:", "").replace("https://", "").replace("http://", "");
252
- niceSiteUrl = trim(niceSiteUrl, "/");
253
- return { siteUrl, niceSiteUrl };
254
- };
255
- exports.niceUrl = niceUrl;
256
- function toTitleCase(str) {
257
- if (!str) {
258
- return str;
259
- }
260
- return str.replace(/\w\S*/g, (txt) => txt && txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase());
261
- }
262
- exports.toTitleCase = toTitleCase;
263
- function replaceRemove(str, ...params) {
264
- const replaceSingles = [];
265
- const replaceStrings = [];
266
- params.forEach((p) => {
267
- if (typeof p !== "string") {
268
- throw new Error("trim only supports strings");
269
- }
270
- if (p.length === 1) {
271
- replaceSingles.push(p);
272
- } else {
273
- replaceStrings.push(p);
274
- }
275
- });
276
- let firstLength = 0;
277
- let changedLength = 0;
278
- let ret = str;
279
- const singleRegex = `[${replaceSingles.join("")}]*`;
280
- const stringRegex = `(${replaceStrings.map((s) => `(${s})`).join("|")})*`;
281
- do {
282
- firstLength = ret.length;
283
- ret = ret.replace(new RegExp(stringRegex, "gim"), "");
284
- ret = ret.replace(new RegExp(singleRegex, "gim"), "");
285
- changedLength = ret.length;
286
- } while (changedLength < firstLength);
287
- return ret;
288
- }
289
- exports.replaceRemove = replaceRemove;
290
- function containsInsensitiveIndex({ str, fromLast = false }, ...args) {
291
- if (!str || !args) {
292
- return -1;
293
- }
294
- const largs = args.map((a) => a.toLowerCase());
295
- const lstr = str.toLowerCase();
296
- const finds = largs.map((arg) => fromLast ? lstr.lastIndexOf(arg) : lstr.indexOf(arg)).filter((s) => s !== -1).sort();
297
- if (finds.length === 0) {
298
- return -1;
299
- }
300
- return !fromLast ? finds[0] : finds[finds.length - 1];
301
- }
302
- exports.containsInsensitiveIndex = containsInsensitiveIndex;
303
- var containsInsensitive = (str, ...args) => containsInsensitiveIndex({ str }, ...args) !== -1;
304
- exports.containsInsensitive = containsInsensitive;
305
- var safeStringify = (obj, indent = 2) => {
306
- let cache2 = [];
307
- const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache2.includes(value) ? void 0 : cache2.push(value) && value : value, indent);
308
- cache2 = null;
309
- return retVal;
310
- };
311
- exports.safeStringify = safeStringify;
312
- var chunkString = (str, length) => str.match(new RegExp(`.{1,${length}}`, "g"));
313
- exports.chunkString = chunkString;
314
- function stringToObject(raw, splitKeyValue, splitKeys) {
315
- const ret = {};
316
- if (!stringToObject) {
317
- return ret;
318
- }
319
- raw.split(splitKeys).forEach((set) => {
320
- const [k, v] = set.split(splitKeyValue);
321
- if (k) {
322
- ret[k] = v;
323
- }
324
- });
325
- return ret;
326
- }
327
- exports.stringToObject = stringToObject;
328
- }
329
- });
330
-
331
- // ../../node_modules/ag-common/dist/common/helpers/binary.js
332
- var require_binary = __commonJS({
333
- "../../node_modules/ag-common/dist/common/helpers/binary.js"(exports) {
334
- "use strict";
335
- Object.defineProperty(exports, "__esModule", { value: true });
336
- exports.base64ToBinary = exports.arrayBufferToBase64 = void 0;
337
- var string_1 = require_string();
338
- function toBuffer(ab) {
339
- const buffer = new Buffer(ab.byteLength);
340
- const view = new Uint8Array(ab);
341
- for (let i = 0; i < buffer.length; ++i) {
342
- buffer[i] = view[i];
343
- }
344
- return buffer;
345
- }
346
- function toArrayBuffer(base64) {
347
- const binary_string = (0, string_1.fromBase64)(base64);
348
- const len = binary_string.length;
349
- const bytes = new Uint8Array(len);
350
- for (let i = 0; i < len; i += 1) {
351
- bytes[i] = binary_string.charCodeAt(i);
352
- }
353
- return bytes.buffer;
354
- }
355
- function arrayBufferToBase64(buffer) {
356
- let binary = "";
357
- const bytes = new Uint8Array(buffer);
358
- const len = bytes.byteLength;
359
- for (let i = 0; i < len; i += 1) {
360
- binary += String.fromCharCode(bytes[i]);
361
- }
362
- return (0, string_1.toBase64)(binary);
363
- }
364
- exports.arrayBufferToBase64 = arrayBufferToBase64;
365
- var base64ToBinary = (raw) => toBuffer(toArrayBuffer(raw));
366
- exports.base64ToBinary = base64ToBinary;
367
- }
368
- });
369
-
370
- // ../../node_modules/ag-common/dist/common/helpers/date.js
371
- var require_date = __commonJS({
372
- "../../node_modules/ag-common/dist/common/helpers/date.js"(exports) {
373
- "use strict";
374
- Object.defineProperty(exports, "__esModule", { value: true });
375
- exports.dateTimeToNearestMinute = exports.CSharpToJs = exports.dateDiffDays = exports.lastDayInMonth = exports.addMinutes = exports.addDays = exports.addHours = exports.getTimeSeconds = void 0;
376
- var getTimeSeconds = () => Math.ceil(new Date().getTime() / 1e3);
377
- exports.getTimeSeconds = getTimeSeconds;
378
- var addHours = (d, h) => {
379
- return new Date(d + h * 60 * 60 * 1e3);
380
- };
381
- exports.addHours = addHours;
382
- var addDays = (dIn, count) => {
383
- const d = new Date(dIn);
384
- d.setDate(d.getDate() + count);
385
- return d;
386
- };
387
- exports.addDays = addDays;
388
- var addMinutes = (date, minutes) => new Date(date.getTime() + minutes * 6e4);
389
- exports.addMinutes = addMinutes;
390
- var lastDayInMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0);
391
- exports.lastDayInMonth = lastDayInMonth;
392
- var dateDiffDays = (date1, date2) => {
393
- const dt1 = new Date(date1);
394
- const dt2 = new Date(date2);
395
- return Math.floor((Date.UTC(dt2.getFullYear(), dt2.getMonth(), dt2.getDate()) - Date.UTC(dt1.getFullYear(), dt1.getMonth(), dt1.getDate())) / 1e3);
396
- };
397
- exports.dateDiffDays = dateDiffDays;
398
- var CSharpToJs = (charpTicks) => {
399
- const ticks = charpTicks / 1e4;
400
- const epochMicrotimeDiff = Math.abs(new Date(0, 0, 1).setFullYear(1));
401
- const tickDate = new Date(ticks - epochMicrotimeDiff);
402
- return tickDate;
403
- };
404
- exports.CSharpToJs = CSharpToJs;
405
- var dateTimeToNearestMinute = (minutes, date) => {
406
- const coeff = 1e3 * 60 * minutes;
407
- if (!date) {
408
- date = new Date();
409
- }
410
- const rounded = new Date(Math.round(date.getTime() / coeff) * coeff);
411
- return rounded;
412
- };
413
- exports.dateTimeToNearestMinute = dateTimeToNearestMinute;
414
- }
415
- });
416
-
417
- // ../../node_modules/ag-common/dist/common/helpers/email.js
418
- var require_email = __commonJS({
419
- "../../node_modules/ag-common/dist/common/helpers/email.js"(exports) {
420
- "use strict";
421
- Object.defineProperty(exports, "__esModule", { value: true });
422
- exports.getEmailsErrors = exports.getEmailErrors = exports.isEmailValid = void 0;
423
- var array_1 = require_array();
424
- var regex = /^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
425
- var isEmailValid = (email) => {
426
- if (!email)
427
- return false;
428
- if (email.length > 256)
429
- return false;
430
- const valid = regex.test(email);
431
- if (!valid)
432
- return false;
433
- const parts = email.split("@");
434
- if (parts[0].length > 64)
435
- return false;
436
- const domainParts = parts[1].split(".");
437
- if (domainParts.some((part) => part.length > 64)) {
438
- return false;
439
- }
440
- return true;
441
- };
442
- exports.isEmailValid = isEmailValid;
443
- var getEmailErrors = (email, event) => {
444
- if (!(0, exports.isEmailValid)(email)) {
445
- return `email not valid:${email}`;
446
- }
447
- if (event.creatorId === email) {
448
- return `You cannot add the creator of this event as an admin`;
449
- }
450
- return void 0;
451
- };
452
- exports.getEmailErrors = getEmailErrors;
453
- var getEmailsErrors = (emails, event) => emails.map((email) => (0, exports.getEmailErrors)(email, event)).filter(array_1.notEmpty);
454
- exports.getEmailsErrors = getEmailsErrors;
455
- }
456
- });
457
-
458
- // ../../node_modules/ag-common/dist/common/helpers/func.js
459
- var require_func = __commonJS({
460
- "../../node_modules/ag-common/dist/common/helpers/func.js"(exports) {
461
- "use strict";
462
- Object.defineProperty(exports, "__esModule", { value: true });
463
- exports.retry = void 0;
464
- var log_1 = require_log();
465
- function retry(name, fn, retriesLeft = 3, interval = 1e3) {
466
- return new Promise((resolve, reject) => {
467
- fn().then(resolve).catch((e) => {
468
- setTimeout(() => {
469
- if (retriesLeft === 1) {
470
- (0, log_1.error)(`retry/${name} failed:${e}`);
471
- reject(e);
472
- } else {
473
- retry(name, fn, retriesLeft - 1, interval).then(resolve, reject);
474
- }
475
- }, interval);
476
- });
477
- });
478
- }
479
- exports.retry = retry;
480
- }
481
- });
482
-
483
- // ../../node_modules/ag-common/dist/common/helpers/generator.js
484
- var require_generator = __commonJS({
485
- "../../node_modules/ag-common/dist/common/helpers/generator.js"(exports) {
486
- "use strict";
487
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
488
- function adopt(value) {
489
- return value instanceof P ? value : new P(function(resolve) {
490
- resolve(value);
491
- });
492
- }
493
- return new (P || (P = Promise))(function(resolve, reject) {
494
- function fulfilled(value) {
495
- try {
496
- step(generator.next(value));
497
- } catch (e) {
498
- reject(e);
499
- }
500
- }
501
- function rejected(value) {
502
- try {
503
- step(generator["throw"](value));
504
- } catch (e) {
505
- reject(e);
506
- }
507
- }
508
- function step(result) {
509
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
510
- }
511
- step((generator = generator.apply(thisArg, _arguments || [])).next());
512
- });
513
- };
514
- Object.defineProperty(exports, "__esModule", { value: true });
515
- exports.runGenerator = void 0;
516
- function runGenerator(iter, partialRun) {
517
- return __awaiter(this, void 0, void 0, function* () {
518
- let curr;
519
- do {
520
- curr = yield iter.next();
521
- if (!(curr === null || curr === void 0 ? void 0 : curr.value) || curr.value.length === 0) {
522
- return;
523
- }
524
- yield partialRun(curr.value);
525
- } while (!curr.done);
526
- });
527
- }
528
- exports.runGenerator = runGenerator;
529
- }
530
- });
531
-
532
- // ../../node_modules/ag-common/dist/common/helpers/groupBy.js
533
- var require_groupBy = __commonJS({
534
- "../../node_modules/ag-common/dist/common/helpers/groupBy.js"(exports) {
535
- "use strict";
536
- Object.defineProperty(exports, "__esModule", { value: true });
537
- exports.groupByTwice = exports.groupByList = exports.groupBy = void 0;
538
- function groupBy(arr, getKey) {
539
- const ret = {};
540
- arr.forEach((item) => {
541
- const key = getKey(item);
542
- if (!ret[key]) {
543
- ret[key] = [];
544
- }
545
- ret[key].push(item);
546
- });
547
- return ret;
548
- }
549
- exports.groupBy = groupBy;
550
- function groupByList(arr, getKey) {
551
- const ret = [];
552
- arr.forEach((item) => {
553
- const key = getKey(item);
554
- const i = ret.find((r) => r.key === key);
555
- if (!i) {
556
- ret.push({ key, items: [item] });
557
- } else {
558
- i.items.push(item);
559
- }
560
- });
561
- return ret;
562
- }
563
- exports.groupByList = groupByList;
564
- function groupByTwice(arr, getKey, getSubKey) {
565
- const ret = {};
566
- arr.forEach((item) => {
567
- const key = getKey(item);
568
- const subkey = getSubKey(item);
569
- if (!ret[key]) {
570
- ret[key] = {};
571
- }
572
- ret[key][subkey] = item;
573
- });
574
- return ret;
575
- }
576
- exports.groupByTwice = groupByTwice;
577
- }
578
- });
579
-
580
- // ../../node_modules/ag-common/dist/common/helpers/hashCode.js
581
- var require_hashCode = __commonJS({
582
- "../../node_modules/ag-common/dist/common/helpers/hashCode.js"(exports) {
583
- "use strict";
584
- Object.defineProperty(exports, "__esModule", { value: true });
585
- exports.generateNewPK = exports.hashCode = void 0;
586
- var hashCode = (str, seed = 0) => {
587
- if (!str) {
588
- return "";
589
- }
590
- let h1 = 3735928559 ^ seed;
591
- let h2 = 1103547991 ^ seed;
592
- for (let i = 0, ch; i < str.length; i += 1) {
593
- ch = str.charCodeAt(i);
594
- h1 = Math.imul(h1 ^ ch, 2654435761);
595
- h2 = Math.imul(h2 ^ ch, 1597334677);
596
- }
597
- h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
598
- h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
599
- const ret = 4294967296 * (2097151 & h2) + (h1 >>> 0);
600
- return ret.toString();
601
- };
602
- exports.hashCode = hashCode;
603
- var generateNewPK = () => (0, exports.hashCode)(new Date().getTime().toString());
604
- exports.generateNewPK = generateNewPK;
605
- }
606
- });
607
-
608
- // ../../node_modules/ag-common/dist/common/helpers/i18n.js
609
- var require_i18n = __commonJS({
610
- "../../node_modules/ag-common/dist/common/helpers/i18n.js"(exports) {
611
- "use strict";
612
- Object.defineProperty(exports, "__esModule", { value: true });
613
- exports.t = exports.getValidatedLang = exports.AllLang = void 0;
614
- exports.AllLang = ["en", "id", "vi"];
615
- var getValidatedLang = (raw) => {
616
- const f = exports.AllLang.find((l) => l === raw);
617
- if (!f) {
618
- return "en";
619
- }
620
- return f;
621
- };
622
- exports.getValidatedLang = getValidatedLang;
623
- var t = (res, lang) => {
624
- var _a;
625
- return (_a = res[lang]) !== null && _a !== void 0 ? _a : res.en;
626
- };
627
- exports.t = t;
628
- }
629
- });
630
-
631
- // ../../node_modules/ag-common/dist/common/helpers/math.js
632
- var require_math = __commonJS({
633
- "../../node_modules/ag-common/dist/common/helpers/math.js"(exports) {
634
- "use strict";
635
- Object.defineProperty(exports, "__esModule", { value: true });
636
- exports.toFixedDown = exports.isNumber = exports.getRandomInt = exports.sumArray = exports.clamp = exports.roundToHalf = exports.toFixed = void 0;
637
- var toFixed = (num, fixed) => {
638
- var _a, _b;
639
- const re = new RegExp(`^-?\\d+(?:.\\d{0,${fixed || -1}})?`);
640
- const x = (_b = (_a = num === null || num === void 0 ? void 0 : num.toString()) === null || _a === void 0 ? void 0 : _a.match(re)) === null || _b === void 0 ? void 0 : _b[0];
641
- if (!x) {
642
- return num;
643
- }
644
- return Number.parseFloat(x);
645
- };
646
- exports.toFixed = toFixed;
647
- function roundToHalf(converted) {
648
- let decimal = converted - parseInt(converted.toString(), 10);
649
- decimal = Math.round(decimal * 10);
650
- if (decimal === 5) {
651
- return parseInt(converted.toString(), 10) + 0.5;
652
- }
653
- if (decimal < 3 || decimal > 7) {
654
- return Math.round(converted);
655
- }
656
- return parseInt(converted.toString(), 10) + 0.5;
657
- }
658
- exports.roundToHalf = roundToHalf;
659
- function clamp({ value, min, max }) {
660
- if (value < min) {
661
- return min;
662
- }
663
- if (value > max) {
664
- return max;
665
- }
666
- return value;
667
- }
668
- exports.clamp = clamp;
669
- function sumArray(array) {
670
- return array.reduce((a, b) => a + b);
671
- }
672
- exports.sumArray = sumArray;
673
- var getRandomInt = (max) => {
674
- return Math.floor(Math.random() * Math.floor(max));
675
- };
676
- exports.getRandomInt = getRandomInt;
677
- function isNumber(val) {
678
- const re = new RegExp(`(\\d+\\.?\\d*)(\\d)`);
679
- const m = val.toString().match(re);
680
- return !!m;
681
- }
682
- exports.isNumber = isNumber;
683
- function toFixedDown(num, scale) {
684
- if (!`${num}`.includes("e")) {
685
- return +`${Math.round(`${num}e+${scale}`)}e-${scale}`;
686
- }
687
- const arr = `${num}`.split("e");
688
- let sig = "";
689
- if (+arr[1] + scale > 0) {
690
- sig = "+";
691
- }
692
- return +`${Math.round(`${+arr[0]}e${sig}${+arr[1] + scale}`)}e-${scale}`;
693
- }
694
- exports.toFixedDown = toFixedDown;
695
- }
696
- });
697
-
698
- // ../../node_modules/ag-common/dist/common/helpers/memo.js
699
- var require_memo = __commonJS({
700
- "../../node_modules/ag-common/dist/common/helpers/memo.js"(exports) {
701
- "use strict";
702
- Object.defineProperty(exports, "__esModule", { value: true });
703
- exports.memo = void 0;
704
- var hashCode_1 = require_hashCode();
705
- var memoData = {};
706
- function memo(func, ...args) {
707
- const hc = (0, hashCode_1.hashCode)(JSON.stringify(args));
708
- if (!memoData[hc]) {
709
- memoData[hc] = func(...args);
710
- }
711
- return memoData[hc];
712
- }
713
- exports.memo = memo;
714
- }
715
- });
716
-
717
- // ../../node_modules/ag-common/dist/common/helpers/object.js
718
- var require_object = __commonJS({
719
- "../../node_modules/ag-common/dist/common/helpers/object.js"(exports) {
720
- "use strict";
721
- Object.defineProperty(exports, "__esModule", { value: true });
722
- exports.castStringlyObject = exports.removeUndefValuesFromObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
723
- var _1 = require_helpers();
724
- var tryJsonParse = (str, defaultValue) => {
725
- if (!str) {
726
- return null;
727
- }
728
- try {
729
- return JSON.parse(str);
730
- } catch (e) {
731
- return defaultValue;
732
- }
733
- };
734
- exports.tryJsonParse = tryJsonParse;
735
- function isJson(str) {
736
- try {
737
- JSON.parse(typeof str === "string" ? str : JSON.stringify(str));
738
- } catch (e) {
739
- return false;
740
- }
741
- return true;
742
- }
743
- exports.isJson = isJson;
744
- var objectKeysToLowerCase = (origObj) => {
745
- if (!origObj || Object.keys(origObj).length === 0) {
746
- return {};
747
- }
748
- return Object.keys(origObj).reduce((newObj, key) => {
749
- const val = origObj[key];
750
- const newVal = typeof val === "object" ? (0, exports.objectKeysToLowerCase)(val) : val;
751
- newObj[key.toLowerCase()] = newVal;
752
- return newObj;
753
- }, {});
754
- };
755
- exports.objectKeysToLowerCase = objectKeysToLowerCase;
756
- var getObjectKeysAsNumber = (o) => Object.keys(o).map((o2) => parseInt(o2, 10));
757
- exports.getObjectKeysAsNumber = getObjectKeysAsNumber;
758
- function objectToArray(obj) {
759
- if (!obj) {
760
- return [];
761
- }
762
- const ret = [];
763
- Object.keys(obj).forEach((ok) => {
764
- ret.push({ key: ok, value: obj[ok] });
765
- });
766
- return ret;
767
- }
768
- exports.objectToArray = objectToArray;
769
- var objectAlphaSort = (object, depthLeft = -1) => {
770
- if (depthLeft === 0) {
771
- return object;
772
- }
773
- if (object !== null && typeof object === "object") {
774
- return Object.keys(object).sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1).reduce((result, key) => {
775
- result[key] = (0, exports.objectAlphaSort)(object[key], depthLeft - 1);
776
- return result;
777
- }, {});
778
- } else if (Array.isArray(object)) {
779
- return object.map((obj) => (0, exports.objectAlphaSort)(obj, depthLeft - 1));
780
- } else {
781
- return object;
782
- }
783
- };
784
- exports.objectAlphaSort = objectAlphaSort;
785
- function paramsToObject(entries) {
786
- const result = {};
787
- for (const [key, value] of entries) {
788
- result[key] = value;
789
- }
790
- return result;
791
- }
792
- exports.paramsToObject = paramsToObject;
793
- function objectToString(obj, joinKeyValue, joinKeys) {
794
- let ret = "";
795
- if (!obj || Object.keys(obj).length === 0) {
796
- return ret;
797
- }
798
- Object.entries(obj).forEach(([key, value]) => {
799
- ret += `${joinKeys}${key}${joinKeyValue}${value}`;
800
- });
801
- ret = (0, _1.trim)(ret, joinKeyValue);
802
- return ret;
803
- }
804
- exports.objectToString = objectToString;
805
- var castObject = (orig, castF) => {
806
- const ret = {};
807
- Object.entries(orig).forEach(([k, v]) => {
808
- ret[k] = castF(v);
809
- });
810
- return ret;
811
- };
812
- exports.castObject = castObject;
813
- var removeUndefValuesFromObject = (orig) => {
814
- const ret = {};
815
- Object.entries(orig).forEach(([k, v]) => {
816
- if (v !== null && v !== void 0) {
817
- ret[k] = v;
818
- }
819
- });
820
- return ret;
821
- };
822
- exports.removeUndefValuesFromObject = removeUndefValuesFromObject;
823
- var castStringlyObject = (orig) => {
824
- const noundef = (0, exports.removeUndefValuesFromObject)(orig);
825
- return (0, exports.castObject)(noundef, (s) => {
826
- if (Array.isArray(s)) {
827
- return s.join(",");
828
- }
829
- return s;
830
- });
831
- };
832
- exports.castStringlyObject = castStringlyObject;
833
- }
834
- });
835
-
836
- // ../../node_modules/ag-common/dist/common/helpers/random.js
837
- var require_random = __commonJS({
838
- "../../node_modules/ag-common/dist/common/helpers/random.js"(exports) {
839
- "use strict";
840
- Object.defineProperty(exports, "__esModule", { value: true });
841
- exports.shuffle = void 0;
842
- function shuffle(array, seed) {
843
- let currentIndex = array.length;
844
- let temporaryValue;
845
- let randomIndex;
846
- seed = seed || 1;
847
- const random = function() {
848
- const x = Math.sin(seed += 1) * 1e4;
849
- return x - Math.floor(x);
850
- };
851
- while (currentIndex !== 0) {
852
- randomIndex = Math.floor(random() * currentIndex);
853
- currentIndex -= 1;
854
- temporaryValue = array[currentIndex];
855
- array[currentIndex] = array[randomIndex];
856
- array[randomIndex] = temporaryValue;
857
- }
858
- return array;
859
- }
860
- exports.shuffle = shuffle;
861
- }
862
- });
863
-
864
- // ../../node_modules/ag-common/dist/common/helpers/secondsInNearest.js
865
- var require_secondsInNearest = __commonJS({
866
- "../../node_modules/ag-common/dist/common/helpers/secondsInNearest.js"(exports) {
867
- "use strict";
868
- Object.defineProperty(exports, "__esModule", { value: true });
869
- exports.secondsInNearest = void 0;
870
- var toFixed = (num, fixed) => {
871
- var _a, _b;
872
- const re = new RegExp(`^-?\\d+(?:.\\d{0,${fixed || -1}})?`);
873
- const x = (_b = (_a = num === null || num === void 0 ? void 0 : num.toString()) === null || _a === void 0 ? void 0 : _a.match(re)) === null || _b === void 0 ? void 0 : _b[0];
874
- if (!x) {
875
- return num;
876
- }
877
- return Number.parseFloat(x);
878
- };
879
- var secondsInNearest = ({ seconds, precision = 2 }) => {
880
- if (seconds <= 0) {
881
- return "Now";
882
- }
883
- if (seconds < 90) {
884
- const v2 = toFixed(seconds, precision);
885
- return `${v2} ${v2 === 1 ? "second" : "seconds"}`;
886
- }
887
- const mins = seconds / 60;
888
- if (mins < 120) {
889
- const v2 = toFixed(mins, precision);
890
- return `${v2} ${v2 === 1 ? "minute" : "minutes"}`;
891
- }
892
- const hours = mins / 60;
893
- if (hours < 24) {
894
- const v2 = toFixed(hours, precision);
895
- return `${v2} ${v2 === 1 ? "hour" : "hours"}`;
896
- }
897
- const days = hours / 24;
898
- const v = toFixed(days, precision);
899
- return `${v} ${v === 1 ? "day" : "days"}`;
900
- };
901
- exports.secondsInNearest = secondsInNearest;
902
- }
903
- });
904
-
905
- // ../../node_modules/ag-common/dist/common/helpers/sleep.js
906
- var require_sleep = __commonJS({
907
- "../../node_modules/ag-common/dist/common/helpers/sleep.js"(exports) {
908
- "use strict";
909
- Object.defineProperty(exports, "__esModule", { value: true });
910
- exports.sleep = void 0;
911
- var sleep = (ms) => {
912
- return new Promise((resolve) => setTimeout(resolve, ms));
913
- };
914
- exports.sleep = sleep;
915
- }
916
- });
917
-
918
- // ../../node_modules/ag-common/dist/common/helpers/index.js
919
- var require_helpers = __commonJS({
920
- "../../node_modules/ag-common/dist/common/helpers/index.js"(exports) {
921
- "use strict";
922
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
923
- if (k2 === void 0)
924
- k2 = k;
925
- var desc = Object.getOwnPropertyDescriptor(m, k);
926
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
927
- desc = { enumerable: true, get: function() {
928
- return m[k];
929
- } };
930
- }
931
- Object.defineProperty(o, k2, desc);
932
- } : function(o, m, k, k2) {
933
- if (k2 === void 0)
934
- k2 = k;
935
- o[k2] = m[k];
936
- });
937
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
938
- for (var p in m)
939
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
940
- __createBinding(exports2, m, p);
941
- };
942
- Object.defineProperty(exports, "__esModule", { value: true });
943
- __exportStar(require_array(), exports);
944
- __exportStar(require_async(), exports);
945
- __exportStar(require_binary(), exports);
946
- __exportStar(require_date(), exports);
947
- __exportStar(require_email(), exports);
948
- __exportStar(require_func(), exports);
949
- __exportStar(require_generator(), exports);
950
- __exportStar(require_groupBy(), exports);
951
- __exportStar(require_hashCode(), exports);
952
- __exportStar(require_i18n(), exports);
953
- __exportStar(require_log(), exports);
954
- __exportStar(require_math(), exports);
955
- __exportStar(require_memo(), exports);
956
- __exportStar(require_object(), exports);
957
- __exportStar(require_random(), exports);
958
- __exportStar(require_secondsInNearest(), exports);
959
- __exportStar(require_sleep(), exports);
960
- __exportStar(require_string(), exports);
961
- }
962
- });
963
-
964
- // ../../node_modules/ag-common/dist/common/helpers/log.js
965
- var require_log = __commonJS({
966
- "../../node_modules/ag-common/dist/common/helpers/log.js"(exports) {
967
- "use strict";
968
- Object.defineProperty(exports, "__esModule", { value: true });
969
- exports.fatal = exports.error = exports.trace = exports.warn = exports.info = exports.debug = exports.SetLogLevel = exports.GetLogLevel = void 0;
970
- var _1 = require_helpers();
971
- var GetLogLevel = (l) => ["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"].findIndex((s) => s === l);
972
- exports.GetLogLevel = GetLogLevel;
973
- var userLogLevel = "WARN";
974
- var SetLogLevel = (l) => {
975
- const lu = l === null || l === void 0 ? void 0 : l.toUpperCase();
976
- if ((0, exports.GetLogLevel)(lu) === -1) {
977
- return;
978
- }
979
- userLogLevel = lu;
980
- };
981
- exports.SetLogLevel = SetLogLevel;
982
- (0, exports.SetLogLevel)(process.env.LOG_LEVEL || "");
983
- function logprocess(type, args) {
984
- const min = (0, exports.GetLogLevel)(userLogLevel);
985
- const typesLogLevel = (0, exports.GetLogLevel)(type);
986
- if (typesLogLevel < min) {
987
- return;
988
- }
989
- const datetime = new Date().toLocaleTimeString("en-GB");
990
- const log = [`[${datetime}]`, type, ...args.filter(_1.notEmpty)];
991
- switch (type) {
992
- case "TRACE": {
993
- console.trace(...log);
994
- break;
995
- }
996
- case "DEBUG": {
997
- console.debug(...log);
998
- break;
999
- }
1000
- case "INFO": {
1001
- console.log(...log);
1002
- break;
1003
- }
1004
- case "WARN": {
1005
- console.warn(...log);
1006
- break;
1007
- }
1008
- case "ERROR": {
1009
- console.error(...log);
1010
- break;
1011
- }
1012
- case "FATAL": {
1013
- console.error(...log);
1014
- break;
1015
- }
1016
- default: {
1017
- console.log(...log);
1018
- break;
1019
- }
1020
- }
1021
- }
1022
- function printStackTrace(...args) {
1023
- const callstack = [];
1024
- let isCallstackPopulated = false;
1025
- try {
1026
- throw new Error("Test");
1027
- } catch (e) {
1028
- const er = e;
1029
- if (er.stack) {
1030
- const lines = er.stack.split("\n");
1031
- for (let i = 0, len = lines.length; i < len; i += 1) {
1032
- callstack.push(` ${lines[i]} `);
1033
- }
1034
- callstack.shift();
1035
- isCallstackPopulated = true;
1036
- } else if (window.opera && er.message) {
1037
- const lines = er.message.split("\n");
1038
- for (let i = 0, len = lines.length; i < len; i += 1) {
1039
- if (lines[i].match(/^\s*[A-Za-z0-9\-_$]+\(/)) {
1040
- let entry = lines[i];
1041
- if (lines[i + 1]) {
1042
- entry += ` at ${lines[i + 1]}`;
1043
- i += 1;
1044
- }
1045
- callstack.push(entry);
1046
- }
1047
- }
1048
- callstack.shift();
1049
- isCallstackPopulated = true;
1050
- }
1051
- }
1052
- if (!isCallstackPopulated) {
1053
- let currentFunction = args.callee.caller;
1054
- while (currentFunction) {
1055
- const fn = currentFunction.toString();
1056
- const fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || "anonymous";
1057
- callstack.push(fname);
1058
- currentFunction = currentFunction.caller;
1059
- }
1060
- }
1061
- return callstack.join("\n");
1062
- }
1063
- var debug5 = (...args) => logprocess("DEBUG", args);
1064
- exports.debug = debug5;
1065
- var info2 = (...args) => logprocess("INFO", args);
1066
- exports.info = info2;
1067
- var warn7 = (...args) => logprocess("WARN", args);
1068
- exports.warn = warn7;
1069
- var trace = (...args) => {
1070
- args.push(printStackTrace());
1071
- logprocess("TRACE", args);
1072
- };
1073
- exports.trace = trace;
1074
- var error = (...args) => {
1075
- args.push(printStackTrace());
1076
- logprocess("ERROR", args);
1077
- };
1078
- exports.error = error;
1079
- var fatal = (...args) => {
1080
- args.push(printStackTrace());
1081
- logprocess("FATAL", args);
1082
- };
1083
- exports.fatal = fatal;
1084
- }
1085
- });
1086
-
1087
- // ../../node_modules/ag-common/dist/ui/helpers/cookie/const.js
1088
- var require_const = __commonJS({
1089
- "../../node_modules/ag-common/dist/ui/helpers/cookie/const.js"(exports) {
1090
- "use strict";
1091
- Object.defineProperty(exports, "__esModule", { value: true });
1092
- exports.maxCookieLen = exports.expireDate = void 0;
1093
- exports.expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
1094
- exports.maxCookieLen = 4e3;
1095
- }
1096
- });
1097
-
1098
- // ../../node_modules/ag-common/dist/ui/helpers/cookie/set.js
1099
- var require_set = __commonJS({
1100
- "../../node_modules/ag-common/dist/ui/helpers/cookie/set.js"(exports) {
1101
- "use strict";
1102
- Object.defineProperty(exports, "__esModule", { value: true });
1103
- exports.setCookieString = exports.setCookieRawWrapper = exports.wipeCookies = void 0;
1104
- var const_1 = require_const();
1105
- var get_1 = require_get();
1106
- var log_1 = require_log();
1107
- var string_1 = require_string();
1108
- function setCookieRaw({ name, value, expiryDays = 1 }) {
1109
- if (typeof window === void 0) {
1110
- return;
1111
- }
1112
- const d = new Date();
1113
- d.setTime(d.getTime() + expiryDays * 24 * 60 * 60 * 1e3);
1114
- const expires = `expires=${!value || expiryDays < 0 ? const_1.expireDate : d.toUTCString()}`;
1115
- document.cookie = `${name}=${!value ? "" : value};${expires};path=/`;
1116
- }
1117
- function wipeCookies2(name) {
1118
- if (typeof window === "undefined") {
1119
- (0, log_1.warn)("cant wipe cookies on server");
1120
- return;
1121
- }
1122
- let currentCount = 0;
1123
- while (true) {
1124
- if ((0, get_1.getCookieRaw)({
1125
- name: name + currentCount,
1126
- cookieDocument: ""
1127
- })) {
1128
- setCookieRaw({ name: name + currentCount, value: "", expiryDays: -1 });
1129
- currentCount += 1;
1130
- } else {
1131
- return;
1132
- }
1133
- }
1134
- }
1135
- exports.wipeCookies = wipeCookies2;
1136
- function setCookieRawWrapper(p) {
1137
- const stringify3 = (s) => {
1138
- if (p.stringify) {
1139
- return p.stringify(s);
1140
- }
1141
- return JSON.stringify(s);
1142
- };
1143
- wipeCookies2(p.name);
1144
- if (!p.value) {
1145
- return;
1146
- }
1147
- const str = (0, string_1.toBase64)(stringify3(p.value));
1148
- const chunks = (0, string_1.chunkString)(str, const_1.maxCookieLen);
1149
- for (const index1 in chunks) {
1150
- const chunk = chunks[index1];
1151
- setCookieRaw(Object.assign(Object.assign({}, p), { name: p.name + index1, value: chunk }));
1152
- }
1153
- }
1154
- exports.setCookieRawWrapper = setCookieRawWrapper;
1155
- var setCookieString = (p) => setCookieRawWrapper(Object.assign(Object.assign({}, p), { stringify: (s) => s }));
1156
- exports.setCookieString = setCookieString;
1157
- }
1158
- });
1159
-
1160
- // ../../node_modules/ag-common/dist/ui/helpers/cookie/get.js
1161
- var require_get = __commonJS({
1162
- "../../node_modules/ag-common/dist/ui/helpers/cookie/get.js"(exports) {
1163
- "use strict";
1164
- Object.defineProperty(exports, "__esModule", { value: true });
1165
- exports.getCookieString = exports.getCookieRawWrapper = exports.getCookieRaw = void 0;
1166
- var set_1 = require_set();
1167
- var log_1 = require_log();
1168
- var string_1 = require_string();
1169
- function getCookieRaw({ name, cookieDocument }) {
1170
- const nameeq = `${name}=`;
1171
- const ca1 = cookieDocument || typeof window !== "undefined" && document.cookie;
1172
- if (!ca1 || !(ca1 === null || ca1 === void 0 ? void 0 : ca1.trim())) {
1173
- return void 0;
1174
- }
1175
- const ca = ca1.split(";").map((t) => t.trim());
1176
- const c = ca.find((c2) => c2.startsWith(nameeq));
1177
- if (c) {
1178
- const raw = c.substr(nameeq.length, c.length);
1179
- return raw;
1180
- }
1181
- return void 0;
1182
- }
1183
- exports.getCookieRaw = getCookieRaw;
1184
- function getCookieRawWrapper({ name, cookieDocument, defaultValue, parse: parseRaw }) {
1185
- const parse = (s) => {
1186
- if (!s) {
1187
- return defaultValue;
1188
- }
1189
- if (parseRaw) {
1190
- return parseRaw(s);
1191
- }
1192
- return JSON.parse(s);
1193
- };
1194
- let raw = "";
1195
- let currentCount = 0;
1196
- while (true) {
1197
- const newv = getCookieRaw({
1198
- name: name + currentCount,
1199
- cookieDocument
1200
- });
1201
- if (!newv) {
1202
- break;
1203
- }
1204
- raw += newv;
1205
- currentCount += 1;
1206
- }
1207
- try {
1208
- return parse((0, string_1.fromBase64)(raw));
1209
- } catch (e) {
1210
- (0, log_1.warn)("cookie error:", e);
1211
- (0, set_1.wipeCookies)(name);
1212
- return defaultValue;
1213
- }
1214
- }
1215
- exports.getCookieRawWrapper = getCookieRawWrapper;
1216
- var getCookieString = (p) => getCookieRawWrapper(Object.assign(Object.assign({}, p), { parse: (s) => s, defaultValue: p.defaultValue || "" }));
1217
- exports.getCookieString = getCookieString;
1218
- }
1219
- });
1220
-
1221
- // ../../node_modules/ag-common/dist/ui/helpers/cookie/use.js
1222
- var require_use = __commonJS({
1223
- "../../node_modules/ag-common/dist/ui/helpers/cookie/use.js"(exports) {
1224
- "use strict";
1225
- Object.defineProperty(exports, "__esModule", { value: true });
1226
- exports.useCookieBoolean = exports.useCookieNumber = exports.useCookieString = exports.useCookie = void 0;
1227
- var get_1 = require_get();
1228
- var set_1 = require_set();
1229
- var react_1 = require("react");
1230
- function useCookie(p) {
1231
- const parse = (s) => {
1232
- if (!s) {
1233
- return p.defaultValue;
1234
- }
1235
- if (p.parse) {
1236
- return p.parse(s);
1237
- }
1238
- return JSON.parse(s);
1239
- };
1240
- const stringify3 = (s) => {
1241
- if (p.stringify) {
1242
- return p.stringify(s);
1243
- }
1244
- return JSON.stringify(s);
1245
- };
1246
- const [cookie, setCookie] = (0, react_1.useState)((0, get_1.getCookieRawWrapper)(Object.assign(Object.assign({}, p), { parse })) || p.defaultValue);
1247
- const setState = (valueRaw) => {
1248
- const value = valueRaw instanceof Function ? valueRaw(cookie) : valueRaw;
1249
- (0, set_1.setCookieRawWrapper)(Object.assign(Object.assign({}, p), { stringify: stringify3, value }));
1250
- setCookie(value);
1251
- };
1252
- return [cookie, setState];
1253
- }
1254
- exports.useCookie = useCookie;
1255
- var useCookieString2 = (p) => useCookie(Object.assign(Object.assign({}, p), { parse: (s) => s || "", stringify: (s) => s, defaultValue: p.defaultValue || "" }));
1256
- exports.useCookieString = useCookieString2;
1257
- var useCookieNumber = (p) => useCookie(Object.assign(Object.assign({}, p), { parse: (s) => !s ? void 0 : Number.parseFloat(s), stringify: (s) => !s ? "" : s.toString(), defaultValue: p.defaultValue }));
1258
- exports.useCookieNumber = useCookieNumber;
1259
- var useCookieBoolean = (p) => useCookie(Object.assign(Object.assign({}, p), { parse: (s) => s === "true", stringify: (s) => s.toString() }));
1260
- exports.useCookieBoolean = useCookieBoolean;
1261
- }
1262
- });
1263
-
1264
- // ../../node_modules/ag-common/dist/ui/helpers/cookie/index.js
1265
- var require_cookie = __commonJS({
1266
- "../../node_modules/ag-common/dist/ui/helpers/cookie/index.js"(exports) {
1267
- "use strict";
1268
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
1269
- if (k2 === void 0)
1270
- k2 = k;
1271
- var desc = Object.getOwnPropertyDescriptor(m, k);
1272
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1273
- desc = { enumerable: true, get: function() {
1274
- return m[k];
1275
- } };
1276
- }
1277
- Object.defineProperty(o, k2, desc);
1278
- } : function(o, m, k, k2) {
1279
- if (k2 === void 0)
1280
- k2 = k;
1281
- o[k2] = m[k];
1282
- });
1283
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
1284
- for (var p in m)
1285
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
1286
- __createBinding(exports2, m, p);
1287
- };
1288
- Object.defineProperty(exports, "__esModule", { value: true });
1289
- __exportStar(require_const(), exports);
1290
- __exportStar(require_get(), exports);
1291
- __exportStar(require_set(), exports);
1292
- __exportStar(require_use(), exports);
1293
- }
1294
- });
1295
-
1296
- // ../../node_modules/ag-common/dist/ui/helpers/callOpenApi/direct.js
1297
- var require_direct = __commonJS({
1298
- "../../node_modules/ag-common/dist/ui/helpers/callOpenApi/direct.js"(exports) {
1299
- "use strict";
1300
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
1301
- function adopt(value) {
1302
- return value instanceof P ? value : new P(function(resolve) {
1303
- resolve(value);
1304
- });
1305
- }
1306
- return new (P || (P = Promise))(function(resolve, reject) {
1307
- function fulfilled(value) {
1308
- try {
1309
- step(generator.next(value));
1310
- } catch (e) {
1311
- reject(e);
1312
- }
1313
- }
1314
- function rejected(value) {
1315
- try {
1316
- step(generator["throw"](value));
1317
- } catch (e) {
1318
- reject(e);
1319
- }
1320
- }
1321
- function step(result) {
1322
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1323
- }
1324
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1325
- });
1326
- };
1327
- Object.defineProperty(exports, "__esModule", { value: true });
1328
- exports.callOpenApi = void 0;
1329
- var cookie_1 = require_cookie();
1330
- var sleep_1 = require_sleep();
1331
- var array_1 = require_array();
1332
- var callOpenApi4 = ({ func, apiUrl, overrideAuth, refreshToken: refreshToken2, logout, newDefaultApi, headers }) => __awaiter(void 0, void 0, void 0, function* () {
1333
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1334
- let error;
1335
- let data = void 0;
1336
- const config = {
1337
- basePath: apiUrl,
1338
- baseOptions: { headers: Object.assign({ authorization: "" }, headers || {}) }
1339
- };
1340
- if (overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token) {
1341
- config.baseOptions.headers.authorization = `Bearer ${overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token}`;
1342
- } else {
1343
- const isAuthed = !!(0, cookie_1.getCookieString)({
1344
- name: "id_token",
1345
- defaultValue: ""
1346
- });
1347
- if (isAuthed) {
1348
- const updated = yield refreshToken2();
1349
- if ((_a = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _a === void 0 ? void 0 : _a.id_token) {
1350
- config.baseOptions.headers.authorization = `Bearer ${(_b = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _b === void 0 ? void 0 : _b.id_token}`;
1351
- }
1352
- }
1353
- }
1354
- const cl = newDefaultApi(config);
1355
- let errorCount = 0;
1356
- const errorMax = 3;
1357
- while (errorCount <= errorMax) {
1358
- errorCount += 1;
1359
- try {
1360
- const resp = yield func(cl);
1361
- if (resp.status < 400) {
1362
- data = resp.data;
1363
- break;
1364
- }
1365
- throw new Error(JSON.stringify(resp.data) || resp.statusText);
1366
- } catch (e) {
1367
- const ae = e;
1368
- const status = (_c = ae.response) === null || _c === void 0 ? void 0 : _c.status;
1369
- const errorMessage = [
1370
- (_f = (_e = (_d = ae.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : "",
1371
- (_j = (_h = (_g = ae.response) === null || _g === void 0 ? void 0 : _g.statusText) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _j !== void 0 ? _j : "",
1372
- (_m = (_l = (_k = ae.response) === null || _k === void 0 ? void 0 : _k.status) === null || _l === void 0 ? void 0 : _l.toString()) !== null && _m !== void 0 ? _m : "",
1373
- (_p = (_o = ae.message) === null || _o === void 0 ? void 0 : _o.toString()) !== null && _p !== void 0 ? _p : ""
1374
- ].filter(array_1.notEmpty).sort((a, b) => a.length < b.length ? -1 : 1).join("\n");
1375
- if (status === 403 || status === 401) {
1376
- logout();
1377
- return {
1378
- error: ae,
1379
- data: void 0
1380
- };
1381
- }
1382
- if (status !== 500 || errorCount === errorMax) {
1383
- error = Object.assign(Object.assign({}, ae), { message: errorMessage });
1384
- break;
1385
- }
1386
- }
1387
- yield (0, sleep_1.sleep)(2e3);
1388
- }
1389
- return Object.assign({ data }, error && { error });
1390
- });
1391
- exports.callOpenApi = callOpenApi4;
1392
- }
1393
- });
1394
-
1395
- // ../../node_modules/clone/clone.js
1396
- var require_clone = __commonJS({
1397
- "../../node_modules/clone/clone.js"(exports, module2) {
1398
- var clone = function() {
1399
- "use strict";
1400
- function _instanceof(obj, type) {
1401
- return type != null && obj instanceof type;
1402
- }
1403
- var nativeMap;
1404
- try {
1405
- nativeMap = Map;
1406
- } catch (_) {
1407
- nativeMap = function() {
1408
- };
1409
- }
1410
- var nativeSet;
1411
- try {
1412
- nativeSet = Set;
1413
- } catch (_) {
1414
- nativeSet = function() {
1415
- };
1416
- }
1417
- var nativePromise;
1418
- try {
1419
- nativePromise = Promise;
1420
- } catch (_) {
1421
- nativePromise = function() {
1422
- };
1423
- }
1424
- function clone2(parent, circular, depth, prototype, includeNonEnumerable) {
1425
- if (typeof circular === "object") {
1426
- depth = circular.depth;
1427
- prototype = circular.prototype;
1428
- includeNonEnumerable = circular.includeNonEnumerable;
1429
- circular = circular.circular;
1430
- }
1431
- var allParents = [];
1432
- var allChildren = [];
1433
- var useBuffer = typeof Buffer != "undefined";
1434
- if (typeof circular == "undefined")
1435
- circular = true;
1436
- if (typeof depth == "undefined")
1437
- depth = Infinity;
1438
- function _clone(parent2, depth2) {
1439
- if (parent2 === null)
1440
- return null;
1441
- if (depth2 === 0)
1442
- return parent2;
1443
- var child;
1444
- var proto;
1445
- if (typeof parent2 != "object") {
1446
- return parent2;
1447
- }
1448
- if (_instanceof(parent2, nativeMap)) {
1449
- child = new nativeMap();
1450
- } else if (_instanceof(parent2, nativeSet)) {
1451
- child = new nativeSet();
1452
- } else if (_instanceof(parent2, nativePromise)) {
1453
- child = new nativePromise(function(resolve, reject) {
1454
- parent2.then(function(value) {
1455
- resolve(_clone(value, depth2 - 1));
1456
- }, function(err) {
1457
- reject(_clone(err, depth2 - 1));
1458
- });
1459
- });
1460
- } else if (clone2.__isArray(parent2)) {
1461
- child = [];
1462
- } else if (clone2.__isRegExp(parent2)) {
1463
- child = new RegExp(parent2.source, __getRegExpFlags(parent2));
1464
- if (parent2.lastIndex)
1465
- child.lastIndex = parent2.lastIndex;
1466
- } else if (clone2.__isDate(parent2)) {
1467
- child = new Date(parent2.getTime());
1468
- } else if (useBuffer && Buffer.isBuffer(parent2)) {
1469
- if (Buffer.allocUnsafe) {
1470
- child = Buffer.allocUnsafe(parent2.length);
1471
- } else {
1472
- child = new Buffer(parent2.length);
1473
- }
1474
- parent2.copy(child);
1475
- return child;
1476
- } else if (_instanceof(parent2, Error)) {
1477
- child = Object.create(parent2);
1478
- } else {
1479
- if (typeof prototype == "undefined") {
1480
- proto = Object.getPrototypeOf(parent2);
1481
- child = Object.create(proto);
1482
- } else {
1483
- child = Object.create(prototype);
1484
- proto = prototype;
1485
- }
1486
- }
1487
- if (circular) {
1488
- var index = allParents.indexOf(parent2);
1489
- if (index != -1) {
1490
- return allChildren[index];
1491
- }
1492
- allParents.push(parent2);
1493
- allChildren.push(child);
1494
- }
1495
- if (_instanceof(parent2, nativeMap)) {
1496
- parent2.forEach(function(value, key) {
1497
- var keyChild = _clone(key, depth2 - 1);
1498
- var valueChild = _clone(value, depth2 - 1);
1499
- child.set(keyChild, valueChild);
1500
- });
1501
- }
1502
- if (_instanceof(parent2, nativeSet)) {
1503
- parent2.forEach(function(value) {
1504
- var entryChild = _clone(value, depth2 - 1);
1505
- child.add(entryChild);
1506
- });
1507
- }
1508
- for (var i in parent2) {
1509
- var attrs;
1510
- if (proto) {
1511
- attrs = Object.getOwnPropertyDescriptor(proto, i);
1512
- }
1513
- if (attrs && attrs.set == null) {
1514
- continue;
1515
- }
1516
- child[i] = _clone(parent2[i], depth2 - 1);
1517
- }
1518
- if (Object.getOwnPropertySymbols) {
1519
- var symbols = Object.getOwnPropertySymbols(parent2);
1520
- for (var i = 0; i < symbols.length; i++) {
1521
- var symbol = symbols[i];
1522
- var descriptor = Object.getOwnPropertyDescriptor(parent2, symbol);
1523
- if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
1524
- continue;
1525
- }
1526
- child[symbol] = _clone(parent2[symbol], depth2 - 1);
1527
- if (!descriptor.enumerable) {
1528
- Object.defineProperty(child, symbol, {
1529
- enumerable: false
1530
- });
1531
- }
1532
- }
1533
- }
1534
- if (includeNonEnumerable) {
1535
- var allPropertyNames = Object.getOwnPropertyNames(parent2);
1536
- for (var i = 0; i < allPropertyNames.length; i++) {
1537
- var propertyName = allPropertyNames[i];
1538
- var descriptor = Object.getOwnPropertyDescriptor(parent2, propertyName);
1539
- if (descriptor && descriptor.enumerable) {
1540
- continue;
1541
- }
1542
- child[propertyName] = _clone(parent2[propertyName], depth2 - 1);
1543
- Object.defineProperty(child, propertyName, {
1544
- enumerable: false
1545
- });
1546
- }
1547
- }
1548
- return child;
1549
- }
1550
- return _clone(parent, depth);
1551
- }
1552
- clone2.clonePrototype = function clonePrototype(parent) {
1553
- if (parent === null)
1554
- return null;
1555
- var c = function() {
1556
- };
1557
- c.prototype = parent;
1558
- return new c();
1559
- };
1560
- function __objToStr(o) {
1561
- return Object.prototype.toString.call(o);
1562
- }
1563
- clone2.__objToStr = __objToStr;
1564
- function __isDate(o) {
1565
- return typeof o === "object" && __objToStr(o) === "[object Date]";
1566
- }
1567
- clone2.__isDate = __isDate;
1568
- function __isArray(o) {
1569
- return typeof o === "object" && __objToStr(o) === "[object Array]";
1570
- }
1571
- clone2.__isArray = __isArray;
1572
- function __isRegExp(o) {
1573
- return typeof o === "object" && __objToStr(o) === "[object RegExp]";
1574
- }
1575
- clone2.__isRegExp = __isRegExp;
1576
- function __getRegExpFlags(re) {
1577
- var flags = "";
1578
- if (re.global)
1579
- flags += "g";
1580
- if (re.ignoreCase)
1581
- flags += "i";
1582
- if (re.multiline)
1583
- flags += "m";
1584
- return flags;
1585
- }
1586
- clone2.__getRegExpFlags = __getRegExpFlags;
1587
- return clone2;
1588
- }();
1589
- if (typeof module2 === "object" && module2.exports) {
1590
- module2.exports = clone;
1591
- }
1592
- }
1593
- });
1594
-
1595
- // ../../node_modules/node-cache/lib/node_cache.js
1596
- var require_node_cache = __commonJS({
1597
- "../../node_modules/node-cache/lib/node_cache.js"(exports, module2) {
1598
- (function() {
1599
- var EventEmitter, NodeCache, clone, splice = [].splice, boundMethodCheck = function(instance, Constructor) {
1600
- if (!(instance instanceof Constructor)) {
1601
- throw new Error("Bound instance method accessed before binding");
1602
- }
1603
- }, indexOf = [].indexOf;
1604
- clone = require_clone();
1605
- EventEmitter = require("events").EventEmitter;
1606
- module2.exports = NodeCache = function() {
1607
- class NodeCache2 extends EventEmitter {
1608
- constructor(options = {}) {
1609
- super();
1610
- this.get = this.get.bind(this);
1611
- this.mget = this.mget.bind(this);
1612
- this.set = this.set.bind(this);
1613
- this.mset = this.mset.bind(this);
1614
- this.del = this.del.bind(this);
1615
- this.take = this.take.bind(this);
1616
- this.ttl = this.ttl.bind(this);
1617
- this.getTtl = this.getTtl.bind(this);
1618
- this.keys = this.keys.bind(this);
1619
- this.has = this.has.bind(this);
1620
- this.getStats = this.getStats.bind(this);
1621
- this.flushAll = this.flushAll.bind(this);
1622
- this.flushStats = this.flushStats.bind(this);
1623
- this.close = this.close.bind(this);
1624
- this._checkData = this._checkData.bind(this);
1625
- this._check = this._check.bind(this);
1626
- this._isInvalidKey = this._isInvalidKey.bind(this);
1627
- this._wrap = this._wrap.bind(this);
1628
- this._getValLength = this._getValLength.bind(this);
1629
- this._error = this._error.bind(this);
1630
- this._initErrors = this._initErrors.bind(this);
1631
- this.options = options;
1632
- this._initErrors();
1633
- this.data = {};
1634
- this.options = Object.assign({
1635
- forceString: false,
1636
- objectValueSize: 80,
1637
- promiseValueSize: 80,
1638
- arrayValueSize: 40,
1639
- stdTTL: 0,
1640
- checkperiod: 600,
1641
- useClones: true,
1642
- deleteOnExpire: true,
1643
- enableLegacyCallbacks: false,
1644
- maxKeys: -1
1645
- }, this.options);
1646
- if (this.options.enableLegacyCallbacks) {
1647
- console.warn("WARNING! node-cache legacy callback support will drop in v6.x");
1648
- ["get", "mget", "set", "del", "ttl", "getTtl", "keys", "has"].forEach((methodKey) => {
1649
- var oldMethod;
1650
- oldMethod = this[methodKey];
1651
- this[methodKey] = function(...args) {
1652
- var cb, err, ref, res;
1653
- ref = args, [...args] = ref, [cb] = splice.call(args, -1);
1654
- if (typeof cb === "function") {
1655
- try {
1656
- res = oldMethod(...args);
1657
- cb(null, res);
1658
- } catch (error1) {
1659
- err = error1;
1660
- cb(err);
1661
- }
1662
- } else {
1663
- return oldMethod(...args, cb);
1664
- }
1665
- };
1666
- });
1667
- }
1668
- this.stats = {
1669
- hits: 0,
1670
- misses: 0,
1671
- keys: 0,
1672
- ksize: 0,
1673
- vsize: 0
1674
- };
1675
- this.validKeyTypes = ["string", "number"];
1676
- this._checkData();
1677
- return;
1678
- }
1679
- get(key) {
1680
- var _ret, err;
1681
- boundMethodCheck(this, NodeCache2);
1682
- if ((err = this._isInvalidKey(key)) != null) {
1683
- throw err;
1684
- }
1685
- if (this.data[key] != null && this._check(key, this.data[key])) {
1686
- this.stats.hits++;
1687
- _ret = this._unwrap(this.data[key]);
1688
- return _ret;
1689
- } else {
1690
- this.stats.misses++;
1691
- return void 0;
1692
- }
1693
- }
1694
- mget(keys) {
1695
- var _err, err, i, key, len, oRet;
1696
- boundMethodCheck(this, NodeCache2);
1697
- if (!Array.isArray(keys)) {
1698
- _err = this._error("EKEYSTYPE");
1699
- throw _err;
1700
- }
1701
- oRet = {};
1702
- for (i = 0, len = keys.length; i < len; i++) {
1703
- key = keys[i];
1704
- if ((err = this._isInvalidKey(key)) != null) {
1705
- throw err;
1706
- }
1707
- if (this.data[key] != null && this._check(key, this.data[key])) {
1708
- this.stats.hits++;
1709
- oRet[key] = this._unwrap(this.data[key]);
1710
- } else {
1711
- this.stats.misses++;
1712
- }
1713
- }
1714
- return oRet;
1715
- }
1716
- set(key, value, ttl) {
1717
- var _err, err, existent;
1718
- boundMethodCheck(this, NodeCache2);
1719
- if (this.options.maxKeys > -1 && this.stats.keys >= this.options.maxKeys) {
1720
- _err = this._error("ECACHEFULL");
1721
- throw _err;
1722
- }
1723
- if (this.options.forceString && !typeof value === "string") {
1724
- value = JSON.stringify(value);
1725
- }
1726
- if (ttl == null) {
1727
- ttl = this.options.stdTTL;
1728
- }
1729
- if ((err = this._isInvalidKey(key)) != null) {
1730
- throw err;
1731
- }
1732
- existent = false;
1733
- if (this.data[key]) {
1734
- existent = true;
1735
- this.stats.vsize -= this._getValLength(this._unwrap(this.data[key], false));
1736
- }
1737
- this.data[key] = this._wrap(value, ttl);
1738
- this.stats.vsize += this._getValLength(value);
1739
- if (!existent) {
1740
- this.stats.ksize += this._getKeyLength(key);
1741
- this.stats.keys++;
1742
- }
1743
- this.emit("set", key, value);
1744
- return true;
1745
- }
1746
- mset(keyValueSet) {
1747
- var _err, err, i, j, key, keyValuePair, len, len1, ttl, val;
1748
- boundMethodCheck(this, NodeCache2);
1749
- if (this.options.maxKeys > -1 && this.stats.keys + keyValueSet.length >= this.options.maxKeys) {
1750
- _err = this._error("ECACHEFULL");
1751
- throw _err;
1752
- }
1753
- for (i = 0, len = keyValueSet.length; i < len; i++) {
1754
- keyValuePair = keyValueSet[i];
1755
- ({ key, val, ttl } = keyValuePair);
1756
- if (ttl && typeof ttl !== "number") {
1757
- _err = this._error("ETTLTYPE");
1758
- throw _err;
1759
- }
1760
- if ((err = this._isInvalidKey(key)) != null) {
1761
- throw err;
1762
- }
1763
- }
1764
- for (j = 0, len1 = keyValueSet.length; j < len1; j++) {
1765
- keyValuePair = keyValueSet[j];
1766
- ({ key, val, ttl } = keyValuePair);
1767
- this.set(key, val, ttl);
1768
- }
1769
- return true;
1770
- }
1771
- del(keys) {
1772
- var delCount, err, i, key, len, oldVal;
1773
- boundMethodCheck(this, NodeCache2);
1774
- if (!Array.isArray(keys)) {
1775
- keys = [keys];
1776
- }
1777
- delCount = 0;
1778
- for (i = 0, len = keys.length; i < len; i++) {
1779
- key = keys[i];
1780
- if ((err = this._isInvalidKey(key)) != null) {
1781
- throw err;
1782
- }
1783
- if (this.data[key] != null) {
1784
- this.stats.vsize -= this._getValLength(this._unwrap(this.data[key], false));
1785
- this.stats.ksize -= this._getKeyLength(key);
1786
- this.stats.keys--;
1787
- delCount++;
1788
- oldVal = this.data[key];
1789
- delete this.data[key];
1790
- this.emit("del", key, oldVal.v);
1791
- }
1792
- }
1793
- return delCount;
1794
- }
1795
- take(key) {
1796
- var _ret;
1797
- boundMethodCheck(this, NodeCache2);
1798
- _ret = this.get(key);
1799
- if (_ret != null) {
1800
- this.del(key);
1801
- }
1802
- return _ret;
1803
- }
1804
- ttl(key, ttl) {
1805
- var err;
1806
- boundMethodCheck(this, NodeCache2);
1807
- ttl || (ttl = this.options.stdTTL);
1808
- if (!key) {
1809
- return false;
1810
- }
1811
- if ((err = this._isInvalidKey(key)) != null) {
1812
- throw err;
1813
- }
1814
- if (this.data[key] != null && this._check(key, this.data[key])) {
1815
- if (ttl >= 0) {
1816
- this.data[key] = this._wrap(this.data[key].v, ttl, false);
1817
- } else {
1818
- this.del(key);
1819
- }
1820
- return true;
1821
- } else {
1822
- return false;
1823
- }
1824
- }
1825
- getTtl(key) {
1826
- var _ttl, err;
1827
- boundMethodCheck(this, NodeCache2);
1828
- if (!key) {
1829
- return void 0;
1830
- }
1831
- if ((err = this._isInvalidKey(key)) != null) {
1832
- throw err;
1833
- }
1834
- if (this.data[key] != null && this._check(key, this.data[key])) {
1835
- _ttl = this.data[key].t;
1836
- return _ttl;
1837
- } else {
1838
- return void 0;
1839
- }
1840
- }
1841
- keys() {
1842
- var _keys;
1843
- boundMethodCheck(this, NodeCache2);
1844
- _keys = Object.keys(this.data);
1845
- return _keys;
1846
- }
1847
- has(key) {
1848
- var _exists;
1849
- boundMethodCheck(this, NodeCache2);
1850
- _exists = this.data[key] != null && this._check(key, this.data[key]);
1851
- return _exists;
1852
- }
1853
- getStats() {
1854
- boundMethodCheck(this, NodeCache2);
1855
- return this.stats;
1856
- }
1857
- flushAll(_startPeriod = true) {
1858
- boundMethodCheck(this, NodeCache2);
1859
- this.data = {};
1860
- this.stats = {
1861
- hits: 0,
1862
- misses: 0,
1863
- keys: 0,
1864
- ksize: 0,
1865
- vsize: 0
1866
- };
1867
- this._killCheckPeriod();
1868
- this._checkData(_startPeriod);
1869
- this.emit("flush");
1870
- }
1871
- flushStats() {
1872
- boundMethodCheck(this, NodeCache2);
1873
- this.stats = {
1874
- hits: 0,
1875
- misses: 0,
1876
- keys: 0,
1877
- ksize: 0,
1878
- vsize: 0
1879
- };
1880
- this.emit("flush_stats");
1881
- }
1882
- close() {
1883
- boundMethodCheck(this, NodeCache2);
1884
- this._killCheckPeriod();
1885
- }
1886
- _checkData(startPeriod = true) {
1887
- var key, ref, value;
1888
- boundMethodCheck(this, NodeCache2);
1889
- ref = this.data;
1890
- for (key in ref) {
1891
- value = ref[key];
1892
- this._check(key, value);
1893
- }
1894
- if (startPeriod && this.options.checkperiod > 0) {
1895
- this.checkTimeout = setTimeout(this._checkData, this.options.checkperiod * 1e3, startPeriod);
1896
- if (this.checkTimeout != null && this.checkTimeout.unref != null) {
1897
- this.checkTimeout.unref();
1898
- }
1899
- }
1900
- }
1901
- _killCheckPeriod() {
1902
- if (this.checkTimeout != null) {
1903
- return clearTimeout(this.checkTimeout);
1904
- }
1905
- }
1906
- _check(key, data) {
1907
- var _retval;
1908
- boundMethodCheck(this, NodeCache2);
1909
- _retval = true;
1910
- if (data.t !== 0 && data.t < Date.now()) {
1911
- if (this.options.deleteOnExpire) {
1912
- _retval = false;
1913
- this.del(key);
1914
- }
1915
- this.emit("expired", key, this._unwrap(data));
1916
- }
1917
- return _retval;
1918
- }
1919
- _isInvalidKey(key) {
1920
- var ref;
1921
- boundMethodCheck(this, NodeCache2);
1922
- if (ref = typeof key, indexOf.call(this.validKeyTypes, ref) < 0) {
1923
- return this._error("EKEYTYPE", {
1924
- type: typeof key
1925
- });
1926
- }
1927
- }
1928
- _wrap(value, ttl, asClone = true) {
1929
- var livetime, now, oReturn, ttlMultiplicator;
1930
- boundMethodCheck(this, NodeCache2);
1931
- if (!this.options.useClones) {
1932
- asClone = false;
1933
- }
1934
- now = Date.now();
1935
- livetime = 0;
1936
- ttlMultiplicator = 1e3;
1937
- if (ttl === 0) {
1938
- livetime = 0;
1939
- } else if (ttl) {
1940
- livetime = now + ttl * ttlMultiplicator;
1941
- } else {
1942
- if (this.options.stdTTL === 0) {
1943
- livetime = this.options.stdTTL;
1944
- } else {
1945
- livetime = now + this.options.stdTTL * ttlMultiplicator;
1946
- }
1947
- }
1948
- return oReturn = {
1949
- t: livetime,
1950
- v: asClone ? clone(value) : value
1951
- };
1952
- }
1953
- _unwrap(value, asClone = true) {
1954
- if (!this.options.useClones) {
1955
- asClone = false;
1956
- }
1957
- if (value.v != null) {
1958
- if (asClone) {
1959
- return clone(value.v);
1960
- } else {
1961
- return value.v;
1962
- }
1963
- }
1964
- return null;
1965
- }
1966
- _getKeyLength(key) {
1967
- return key.toString().length;
1968
- }
1969
- _getValLength(value) {
1970
- boundMethodCheck(this, NodeCache2);
1971
- if (typeof value === "string") {
1972
- return value.length;
1973
- } else if (this.options.forceString) {
1974
- return JSON.stringify(value).length;
1975
- } else if (Array.isArray(value)) {
1976
- return this.options.arrayValueSize * value.length;
1977
- } else if (typeof value === "number") {
1978
- return 8;
1979
- } else if (typeof (value != null ? value.then : void 0) === "function") {
1980
- return this.options.promiseValueSize;
1981
- } else if (typeof Buffer !== "undefined" && Buffer !== null ? Buffer.isBuffer(value) : void 0) {
1982
- return value.length;
1983
- } else if (value != null && typeof value === "object") {
1984
- return this.options.objectValueSize * Object.keys(value).length;
1985
- } else if (typeof value === "boolean") {
1986
- return 8;
1987
- } else {
1988
- return 0;
1989
- }
1990
- }
1991
- _error(type, data = {}) {
1992
- var error;
1993
- boundMethodCheck(this, NodeCache2);
1994
- error = new Error();
1995
- error.name = type;
1996
- error.errorcode = type;
1997
- error.message = this.ERRORS[type] != null ? this.ERRORS[type](data) : "-";
1998
- error.data = data;
1999
- return error;
2000
- }
2001
- _initErrors() {
2002
- var _errMsg, _errT, ref;
2003
- boundMethodCheck(this, NodeCache2);
2004
- this.ERRORS = {};
2005
- ref = this._ERRORS;
2006
- for (_errT in ref) {
2007
- _errMsg = ref[_errT];
2008
- this.ERRORS[_errT] = this.createErrorMessage(_errMsg);
2009
- }
2010
- }
2011
- createErrorMessage(errMsg) {
2012
- return function(args) {
2013
- return errMsg.replace("__key", args.type);
2014
- };
2015
- }
2016
- }
2017
- ;
2018
- NodeCache2.prototype._ERRORS = {
2019
- "ENOTFOUND": "Key `__key` not found",
2020
- "ECACHEFULL": "Cache max keys amount exceeded",
2021
- "EKEYTYPE": "The key argument has to be of type `string` or `number`. Found: `__key`",
2022
- "EKEYSTYPE": "The keys argument has to be an array.",
2023
- "ETTLTYPE": "The ttl argument has to be a number."
2024
- };
2025
- return NodeCache2;
2026
- }.call(this);
2027
- }).call(exports);
2028
- }
2029
- });
2030
-
2031
- // ../../node_modules/node-cache/index.js
2032
- var require_node_cache2 = __commonJS({
2033
- "../../node_modules/node-cache/index.js"(exports, module2) {
2034
- (function() {
2035
- var exports2;
2036
- exports2 = module2.exports = require_node_cache();
2037
- exports2.version = "5.1.2";
2038
- }).call(exports);
2039
- }
2040
- });
2041
-
2042
- // ../../node_modules/ag-common/dist/ui/helpers/callOpenApi/cached.js
2043
- var require_cached = __commonJS({
2044
- "../../node_modules/ag-common/dist/ui/helpers/callOpenApi/cached.js"(exports) {
2045
- "use strict";
2046
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2047
- function adopt(value) {
2048
- return value instanceof P ? value : new P(function(resolve) {
2049
- resolve(value);
2050
- });
2051
- }
2052
- return new (P || (P = Promise))(function(resolve, reject) {
2053
- function fulfilled(value) {
2054
- try {
2055
- step(generator.next(value));
2056
- } catch (e) {
2057
- reject(e);
2058
- }
2059
- }
2060
- function rejected(value) {
2061
- try {
2062
- step(generator["throw"](value));
2063
- } catch (e) {
2064
- reject(e);
2065
- }
2066
- }
2067
- function step(result) {
2068
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2069
- }
2070
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2071
- });
2072
- };
2073
- var __importDefault = exports && exports.__importDefault || function(mod) {
2074
- return mod && mod.__esModule ? mod : { "default": mod };
2075
- };
2076
- Object.defineProperty(exports, "__esModule", { value: true });
2077
- exports.callOpenApiCached = exports.callOpenApiCachedRaw = void 0;
2078
- var direct_1 = require_direct();
2079
- var cookie_1 = require_cookie();
2080
- var string_1 = require_string();
2081
- var node_cache_1 = __importDefault(require_node_cache2());
2082
- var callOpenApiCache;
2083
- function getCacheKey({ cacheKey, overrideAuth }) {
2084
- const authkeyPrefix = (overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token) || (0, cookie_1.getCookieString)({
2085
- name: "id_token",
2086
- defaultValue: ""
2087
- });
2088
- let cacheKeyRet;
2089
- if (cacheKey) {
2090
- const pref = !authkeyPrefix ? "" : (0, string_1.toBase64)(authkeyPrefix);
2091
- cacheKeyRet = cacheKey + "||" + pref;
2092
- }
2093
- return cacheKeyRet;
2094
- }
2095
- var callOpenApiCachedRaw = (p) => {
2096
- var _a, _b, _c;
2097
- const userPrefixedCacheKey = getCacheKey(p);
2098
- if (!userPrefixedCacheKey) {
2099
- return void 0;
2100
- }
2101
- if (!callOpenApiCache) {
2102
- callOpenApiCache = new node_cache_1.default({ stdTTL: p.cacheTtl || 120 });
2103
- }
2104
- const ssrCached = (_c = (_b = (_a = p.ssrCacheItems) === null || _a === void 0 ? void 0 : _a.find((s) => s.cacheKey === p.cacheKey)) === null || _b === void 0 ? void 0 : _b.prefillData) === null || _c === void 0 ? void 0 : _c.data;
2105
- if (!callOpenApiCache.get(userPrefixedCacheKey) && ssrCached) {
2106
- callOpenApiCache.set(userPrefixedCacheKey, ssrCached);
2107
- }
2108
- const data = callOpenApiCache.get(userPrefixedCacheKey) || ssrCached;
2109
- if (!data) {
2110
- return void 0;
2111
- }
2112
- return { data };
2113
- };
2114
- exports.callOpenApiCachedRaw = callOpenApiCachedRaw;
2115
- var callOpenApiCached = (p) => __awaiter(void 0, void 0, void 0, function* () {
2116
- const raw = (0, exports.callOpenApiCachedRaw)(p);
2117
- if (raw) {
2118
- return raw;
2119
- }
2120
- const resp = yield (0, direct_1.callOpenApi)(p);
2121
- if (resp.error) {
2122
- return { error: resp.error, data: void 0 };
2123
- }
2124
- const userPrefixedCacheKey = getCacheKey(p);
2125
- if (callOpenApiCache && userPrefixedCacheKey) {
2126
- callOpenApiCache.set(userPrefixedCacheKey, resp.data);
2127
- }
2128
- return resp;
2129
- });
2130
- exports.callOpenApiCached = callOpenApiCached;
2131
- }
2132
- });
2133
-
2134
- // ../../node_modules/ag-common/dist/ui/helpers/callOpenApi/hook.js
2135
- var require_hook = __commonJS({
2136
- "../../node_modules/ag-common/dist/ui/helpers/callOpenApi/hook.js"(exports) {
2137
- "use strict";
2138
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2139
- function adopt(value) {
2140
- return value instanceof P ? value : new P(function(resolve) {
2141
- resolve(value);
2142
- });
2143
- }
2144
- return new (P || (P = Promise))(function(resolve, reject) {
2145
- function fulfilled(value) {
2146
- try {
2147
- step(generator.next(value));
2148
- } catch (e) {
2149
- reject(e);
2150
- }
2151
- }
2152
- function rejected(value) {
2153
- try {
2154
- step(generator["throw"](value));
2155
- } catch (e) {
2156
- reject(e);
2157
- }
2158
- }
2159
- function step(result) {
2160
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2161
- }
2162
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2163
- });
2164
- };
2165
- Object.defineProperty(exports, "__esModule", { value: true });
2166
- exports.useCallOpenApi = void 0;
2167
- var cached_1 = require_cached();
2168
- var direct_1 = require_direct();
2169
- var react_1 = require("react");
2170
- var useCallOpenApi = (p) => {
2171
- var _a;
2172
- const defv = {
2173
- data: void 0,
2174
- url: "",
2175
- datetime: 0,
2176
- loadcount: 0,
2177
- loading: false,
2178
- loaded: false,
2179
- reFetch: () => __awaiter(void 0, void 0, void 0, function* () {
2180
- }),
2181
- setData: () => {
2182
- }
2183
- };
2184
- const cachedData = (_a = (0, cached_1.callOpenApiCachedRaw)(Object.assign(Object.assign({}, p), { onlyCached: true }))) === null || _a === void 0 ? void 0 : _a.data;
2185
- const [data, setData] = (0, react_1.useState)(Object.assign(Object.assign(Object.assign({}, defv), cachedData && { data: cachedData }), { loaded: !!cachedData }));
2186
- (0, react_1.useEffect)(() => {
2187
- function run() {
2188
- return __awaiter(this, void 0, void 0, function* () {
2189
- const resp = yield (0, direct_1.callOpenApi)(p);
2190
- setData((d) => Object.assign(Object.assign({}, resp), { loaded: true, loading: false, loadcount: d.loadcount + 1, reFetch: () => __awaiter(this, void 0, void 0, function* () {
2191
- }), url: "", datetime: new Date().getTime(), setData: () => {
2192
- } }));
2193
- });
2194
- }
2195
- const { error, loaded, loading, loadcount } = data;
2196
- const ng = p.disabled || loaded || loading || error && loadcount > 2;
2197
- if (ng) {
2198
- return;
2199
- }
2200
- setData((d) => Object.assign(Object.assign({}, d), { loading: true }));
2201
- void run();
2202
- }, [data, p, setData]);
2203
- return Object.assign(Object.assign({}, data), { reFetch: () => __awaiter(void 0, void 0, void 0, function* () {
2204
- setData(defv);
2205
- }), setData: (d) => {
2206
- setData(Object.assign(Object.assign({}, data), { data: d(data.data), datetime: new Date().getTime() }));
2207
- } });
2208
- };
2209
- exports.useCallOpenApi = useCallOpenApi;
2210
- }
2211
- });
2212
-
2213
- // ../../node_modules/ag-common/dist/ui/helpers/callOpenApi/types.js
2214
- var require_types = __commonJS({
2215
- "../../node_modules/ag-common/dist/ui/helpers/callOpenApi/types.js"(exports) {
2216
- "use strict";
2217
- Object.defineProperty(exports, "__esModule", { value: true });
2218
- }
2219
- });
2220
-
2221
- // ../../node_modules/ag-common/dist/ui/helpers/callOpenApi/index.js
2222
- var require_callOpenApi = __commonJS({
2223
- "../../node_modules/ag-common/dist/ui/helpers/callOpenApi/index.js"(exports) {
2224
- "use strict";
2225
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2226
- if (k2 === void 0)
2227
- k2 = k;
2228
- var desc = Object.getOwnPropertyDescriptor(m, k);
2229
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2230
- desc = { enumerable: true, get: function() {
2231
- return m[k];
2232
- } };
2233
- }
2234
- Object.defineProperty(o, k2, desc);
2235
- } : function(o, m, k, k2) {
2236
- if (k2 === void 0)
2237
- k2 = k;
2238
- o[k2] = m[k];
2239
- });
2240
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
2241
- for (var p in m)
2242
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
2243
- __createBinding(exports2, m, p);
2244
- };
2245
- Object.defineProperty(exports, "__esModule", { value: true });
2246
- __exportStar(require_direct(), exports);
2247
- __exportStar(require_cached(), exports);
2248
- __exportStar(require_hook(), exports);
2249
- __exportStar(require_types(), exports);
2250
- }
2251
- });
2252
-
2253
- // ../common/dist/api/base.js
2254
- var require_base = __commonJS({
2255
- "../common/dist/api/base.js"(exports) {
2256
- var __importDefault = exports && exports.__importDefault || function(mod) {
2257
- return mod && mod.__esModule ? mod : { "default": mod };
2258
- };
2259
- Object.defineProperty(exports, "__esModule", { value: true });
2260
- exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
2261
- var axios_1 = __importDefault(require("axios"));
2262
- exports.BASE_PATH = "https://api.analytica.click".replace(/\/+$/, "");
2263
- exports.COLLECTION_FORMATS = {
2264
- csv: ",",
2265
- ssv: " ",
2266
- tsv: " ",
2267
- pipes: "|"
2268
- };
2269
- var BaseAPI = class {
2270
- constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
2271
- this.basePath = basePath;
2272
- this.axios = axios;
2273
- if (configuration) {
2274
- this.configuration = configuration;
2275
- this.basePath = configuration.basePath || this.basePath;
2276
- }
2277
- }
2278
- };
2279
- exports.BaseAPI = BaseAPI;
2280
- var RequiredError = class extends Error {
2281
- constructor(field, msg) {
2282
- super(msg);
2283
- this.field = field;
2284
- this.name = "RequiredError";
2285
- }
2286
- };
2287
- exports.RequiredError = RequiredError;
2288
- }
2289
- });
2290
-
2291
- // ../common/dist/api/api.js
2292
- var require_api = __commonJS({
2293
- "../common/dist/api/api.js"(exports) {
2294
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2295
- if (k2 === void 0)
2296
- k2 = k;
2297
- var desc = Object.getOwnPropertyDescriptor(m, k);
2298
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2299
- desc = { enumerable: true, get: function() {
2300
- return m[k];
2301
- } };
2302
- }
2303
- Object.defineProperty(o, k2, desc);
2304
- } : function(o, m, k, k2) {
2305
- if (k2 === void 0)
2306
- k2 = k;
2307
- o[k2] = m[k];
2308
- });
2309
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
2310
- Object.defineProperty(o, "default", { enumerable: true, value: v });
2311
- } : function(o, v) {
2312
- o["default"] = v;
2313
- });
2314
- var __importStar = exports && exports.__importStar || function(mod) {
2315
- if (mod && mod.__esModule)
2316
- return mod;
2317
- var result = {};
2318
- if (mod != null) {
2319
- for (var k in mod)
2320
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
2321
- __createBinding(result, mod, k);
2322
- }
2323
- __setModuleDefault(result, mod);
2324
- return result;
2325
- };
2326
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2327
- function adopt(value) {
2328
- return value instanceof P ? value : new P(function(resolve) {
2329
- resolve(value);
2330
- });
2331
- }
2332
- return new (P || (P = Promise))(function(resolve, reject) {
2333
- function fulfilled(value) {
2334
- try {
2335
- step(generator.next(value));
2336
- } catch (e) {
2337
- reject(e);
2338
- }
2339
- }
2340
- function rejected(value) {
2341
- try {
2342
- step(generator["throw"](value));
2343
- } catch (e) {
2344
- reject(e);
2345
- }
2346
- }
2347
- function step(result) {
2348
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2349
- }
2350
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2351
- });
2352
- };
2353
- var __importDefault = exports && exports.__importDefault || function(mod) {
2354
- return mod && mod.__esModule ? mod : { "default": mod };
2355
- };
2356
- Object.defineProperty(exports, "__esModule", { value: true });
2357
- exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.Sentiment = void 0;
2358
- var globalImportUrl = __importStar(require("url"));
2359
- var axios_1 = __importDefault(require("axios"));
2360
- var base_1 = require_base();
2361
- var Sentiment;
2362
- (function(Sentiment2) {
2363
- Sentiment2["Good"] = "good";
2364
- Sentiment2["Bad"] = "bad";
2365
- Sentiment2["Neutral"] = "neutral";
2366
- })(Sentiment = exports.Sentiment || (exports.Sentiment = {}));
2367
- var DefaultApiAxiosParamCreator = function(configuration) {
2368
- return {
2369
- accountGet: (options = {}) => __awaiter(this, void 0, void 0, function* () {
2370
- const localVarPath = `/account`;
2371
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2372
- let baseOptions;
2373
- if (configuration) {
2374
- baseOptions = configuration.baseOptions;
2375
- }
2376
- const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
2377
- const localVarHeaderParameter = {};
2378
- const localVarQueryParameter = {};
2379
- if (configuration && configuration.apiKey) {
2380
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2381
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2382
- }
2383
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2384
- delete localVarUrlObj.search;
2385
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2386
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2387
- return {
2388
- url: globalImportUrl.format(localVarUrlObj),
2389
- options: localVarRequestOptions
2390
- };
2391
- }),
2392
- archiveError: (id, options = {}) => __awaiter(this, void 0, void 0, function* () {
2393
- if (id === null || id === void 0) {
2394
- throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling archiveError.");
2395
- }
2396
- const localVarPath = `/errors/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
2397
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2398
- let baseOptions;
2399
- if (configuration) {
2400
- baseOptions = configuration.baseOptions;
2401
- }
2402
- const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
2403
- const localVarHeaderParameter = {};
2404
- const localVarQueryParameter = {};
2405
- if (configuration && configuration.apiKey) {
2406
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2407
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2408
- }
2409
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2410
- delete localVarUrlObj.search;
2411
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2412
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2413
- return {
2414
- url: globalImportUrl.format(localVarUrlObj),
2415
- options: localVarRequestOptions
2416
- };
2417
- }),
2418
- archiveErrors: (archiveErrors, options = {}) => __awaiter(this, void 0, void 0, function* () {
2419
- if (archiveErrors === null || archiveErrors === void 0) {
2420
- throw new base_1.RequiredError("archiveErrors", "Required parameter archiveErrors was null or undefined when calling archiveErrors.");
2421
- }
2422
- const localVarPath = `/errors`;
2423
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2424
- let baseOptions;
2425
- if (configuration) {
2426
- baseOptions = configuration.baseOptions;
2427
- }
2428
- const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
2429
- const localVarHeaderParameter = {};
2430
- const localVarQueryParameter = {};
2431
- if (configuration && configuration.apiKey) {
2432
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2433
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2434
- }
2435
- localVarHeaderParameter["Content-Type"] = "application/json";
2436
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2437
- delete localVarUrlObj.search;
2438
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2439
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2440
- const needsSerialization = typeof archiveErrors !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2441
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(archiveErrors !== void 0 ? archiveErrors : {}) : archiveErrors || "";
2442
- return {
2443
- url: globalImportUrl.format(localVarUrlObj),
2444
- options: localVarRequestOptions
2445
- };
2446
- }),
2447
- bingIntegrationPost: (bingIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
2448
- if (bingIntegration === null || bingIntegration === void 0) {
2449
- throw new base_1.RequiredError("bingIntegration", "Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");
2450
- }
2451
- const localVarPath = `/account/integrations/bing`;
2452
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2453
- let baseOptions;
2454
- if (configuration) {
2455
- baseOptions = configuration.baseOptions;
2456
- }
2457
- const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
2458
- const localVarHeaderParameter = {};
2459
- const localVarQueryParameter = {};
2460
- if (configuration && configuration.apiKey) {
2461
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2462
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2463
- }
2464
- localVarHeaderParameter["Content-Type"] = "application/json";
2465
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2466
- delete localVarUrlObj.search;
2467
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2468
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2469
- const needsSerialization = typeof bingIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2470
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(bingIntegration !== void 0 ? bingIntegration : {}) : bingIntegration || "";
2471
- return {
2472
- url: globalImportUrl.format(localVarUrlObj),
2473
- options: localVarRequestOptions
2474
- };
2475
- }),
2476
- getTrackingAllSites: (minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
2477
- if (minDate === null || minDate === void 0) {
2478
- throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingAllSites.");
2479
- }
2480
- if (maxDate === null || maxDate === void 0) {
2481
- throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingAllSites.");
2482
- }
2483
- const localVarPath = `/site/tracking`;
2484
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2485
- let baseOptions;
2486
- if (configuration) {
2487
- baseOptions = configuration.baseOptions;
2488
- }
2489
- const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
2490
- const localVarHeaderParameter = {};
2491
- const localVarQueryParameter = {};
2492
- if (configuration && configuration.apiKey) {
2493
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2494
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2495
- }
2496
- if (minDate !== void 0) {
2497
- localVarQueryParameter["minDate"] = minDate;
2498
- }
2499
- if (maxDate !== void 0) {
2500
- localVarQueryParameter["maxDate"] = maxDate;
2501
- }
2502
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2503
- delete localVarUrlObj.search;
2504
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2505
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2506
- return {
2507
- url: globalImportUrl.format(localVarUrlObj),
2508
- options: localVarRequestOptions
2509
- };
2510
- }),
2511
- getTrackingSite: (id, minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
2512
- if (id === null || id === void 0) {
2513
- throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling getTrackingSite.");
2514
- }
2515
- if (minDate === null || minDate === void 0) {
2516
- throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingSite.");
2517
- }
2518
- if (maxDate === null || maxDate === void 0) {
2519
- throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingSite.");
2520
- }
2521
- const localVarPath = `/site/tracking/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
2522
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2523
- let baseOptions;
2524
- if (configuration) {
2525
- baseOptions = configuration.baseOptions;
2526
- }
2527
- const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
2528
- const localVarHeaderParameter = {};
2529
- const localVarQueryParameter = {};
2530
- if (configuration && configuration.apiKey) {
2531
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2532
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2533
- }
2534
- if (minDate !== void 0) {
2535
- localVarQueryParameter["minDate"] = minDate;
2536
- }
2537
- if (maxDate !== void 0) {
2538
- localVarQueryParameter["maxDate"] = maxDate;
2539
- }
2540
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2541
- delete localVarUrlObj.search;
2542
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2543
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2544
- return {
2545
- url: globalImportUrl.format(localVarUrlObj),
2546
- options: localVarRequestOptions
2547
- };
2548
- }),
2549
- googleIntegrationPost: (googleIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
2550
- if (googleIntegration === null || googleIntegration === void 0) {
2551
- throw new base_1.RequiredError("googleIntegration", "Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");
2552
- }
2553
- const localVarPath = `/account/integrations/google`;
2554
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2555
- let baseOptions;
2556
- if (configuration) {
2557
- baseOptions = configuration.baseOptions;
2558
- }
2559
- const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
2560
- const localVarHeaderParameter = {};
2561
- const localVarQueryParameter = {};
2562
- if (configuration && configuration.apiKey) {
2563
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2564
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2565
- }
2566
- localVarHeaderParameter["Content-Type"] = "application/json";
2567
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2568
- delete localVarUrlObj.search;
2569
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2570
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2571
- const needsSerialization = typeof googleIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2572
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(googleIntegration !== void 0 ? googleIntegration : {}) : googleIntegration || "";
2573
- return {
2574
- url: globalImportUrl.format(localVarUrlObj),
2575
- options: localVarRequestOptions
2576
- };
2577
- }),
2578
- postError: (postError, options = {}) => __awaiter(this, void 0, void 0, function* () {
2579
- if (postError === null || postError === void 0) {
2580
- throw new base_1.RequiredError("postError", "Required parameter postError was null or undefined when calling postError.");
2581
- }
2582
- const localVarPath = `/errors`;
2583
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2584
- let baseOptions;
2585
- if (configuration) {
2586
- baseOptions = configuration.baseOptions;
2587
- }
2588
- const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
2589
- const localVarHeaderParameter = {};
2590
- const localVarQueryParameter = {};
2591
- localVarHeaderParameter["Content-Type"] = "application/json";
2592
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2593
- delete localVarUrlObj.search;
2594
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2595
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2596
- const needsSerialization = typeof postError !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2597
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(postError !== void 0 ? postError : {}) : postError || "";
2598
- return {
2599
- url: globalImportUrl.format(localVarUrlObj),
2600
- options: localVarRequestOptions
2601
- };
2602
- }),
2603
- postPageTrack: (postSiteTrack, options = {}) => __awaiter(this, void 0, void 0, function* () {
2604
- if (postSiteTrack === null || postSiteTrack === void 0) {
2605
- throw new base_1.RequiredError("postSiteTrack", "Required parameter postSiteTrack was null or undefined when calling postPageTrack.");
2606
- }
2607
- const localVarPath = `/site`;
2608
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2609
- let baseOptions;
2610
- if (configuration) {
2611
- baseOptions = configuration.baseOptions;
2612
- }
2613
- const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
2614
- const localVarHeaderParameter = {};
2615
- const localVarQueryParameter = {};
2616
- localVarHeaderParameter["Content-Type"] = "application/json";
2617
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2618
- delete localVarUrlObj.search;
2619
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2620
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2621
- const needsSerialization = typeof postSiteTrack !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2622
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(postSiteTrack !== void 0 ? postSiteTrack : {}) : postSiteTrack || "";
2623
- return {
2624
- url: globalImportUrl.format(localVarUrlObj),
2625
- options: localVarRequestOptions
2626
- };
2627
- }),
2628
- putFeedback: (feedbackPutData, options = {}) => __awaiter(this, void 0, void 0, function* () {
2629
- if (feedbackPutData === null || feedbackPutData === void 0) {
2630
- throw new base_1.RequiredError("feedbackPutData", "Required parameter feedbackPutData was null or undefined when calling putFeedback.");
2631
- }
2632
- const localVarPath = `/feedback`;
2633
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2634
- let baseOptions;
2635
- if (configuration) {
2636
- baseOptions = configuration.baseOptions;
2637
- }
2638
- const localVarRequestOptions = Object.assign(Object.assign({ method: "PUT" }, baseOptions), options);
2639
- const localVarHeaderParameter = {};
2640
- const localVarQueryParameter = {};
2641
- localVarHeaderParameter["Content-Type"] = "application/json";
2642
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2643
- delete localVarUrlObj.search;
2644
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2645
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2646
- const needsSerialization = typeof feedbackPutData !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2647
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(feedbackPutData !== void 0 ? feedbackPutData : {}) : feedbackPutData || "";
2648
- return {
2649
- url: globalImportUrl.format(localVarUrlObj),
2650
- options: localVarRequestOptions
2651
- };
2652
- }),
2653
- sitePost: (postAccount, options = {}) => __awaiter(this, void 0, void 0, function* () {
2654
- if (postAccount === null || postAccount === void 0) {
2655
- throw new base_1.RequiredError("postAccount", "Required parameter postAccount was null or undefined when calling sitePost.");
2656
- }
2657
- const localVarPath = `/account/site`;
2658
- const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2659
- let baseOptions;
2660
- if (configuration) {
2661
- baseOptions = configuration.baseOptions;
2662
- }
2663
- const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
2664
- const localVarHeaderParameter = {};
2665
- const localVarQueryParameter = {};
2666
- if (configuration && configuration.apiKey) {
2667
- const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
2668
- localVarHeaderParameter["authorization"] = localVarApiKeyValue;
2669
- }
2670
- localVarHeaderParameter["Content-Type"] = "application/json";
2671
- localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
2672
- delete localVarUrlObj.search;
2673
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2674
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2675
- const needsSerialization = typeof postAccount !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
2676
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(postAccount !== void 0 ? postAccount : {}) : postAccount || "";
2677
- return {
2678
- url: globalImportUrl.format(localVarUrlObj),
2679
- options: localVarRequestOptions
2680
- };
2681
- })
2682
- };
2683
- };
2684
- exports.DefaultApiAxiosParamCreator = DefaultApiAxiosParamCreator;
2685
- var DefaultApiFp = function(configuration) {
2686
- return {
2687
- accountGet(options) {
2688
- return __awaiter(this, void 0, void 0, function* () {
2689
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).accountGet(options);
2690
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2691
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2692
- return axios.request(axiosRequestArgs);
2693
- };
2694
- });
2695
- },
2696
- archiveError(id, options) {
2697
- return __awaiter(this, void 0, void 0, function* () {
2698
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveError(id, options);
2699
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2700
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2701
- return axios.request(axiosRequestArgs);
2702
- };
2703
- });
2704
- },
2705
- archiveErrors(archiveErrors, options) {
2706
- return __awaiter(this, void 0, void 0, function* () {
2707
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveErrors(archiveErrors, options);
2708
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2709
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2710
- return axios.request(axiosRequestArgs);
2711
- };
2712
- });
2713
- },
2714
- bingIntegrationPost(bingIntegration, options) {
2715
- return __awaiter(this, void 0, void 0, function* () {
2716
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).bingIntegrationPost(bingIntegration, options);
2717
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2718
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2719
- return axios.request(axiosRequestArgs);
2720
- };
2721
- });
2722
- },
2723
- getTrackingAllSites(minDate, maxDate, options) {
2724
- return __awaiter(this, void 0, void 0, function* () {
2725
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingAllSites(minDate, maxDate, options);
2726
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2727
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2728
- return axios.request(axiosRequestArgs);
2729
- };
2730
- });
2731
- },
2732
- getTrackingSite(id, minDate, maxDate, options) {
2733
- return __awaiter(this, void 0, void 0, function* () {
2734
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingSite(id, minDate, maxDate, options);
2735
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2736
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2737
- return axios.request(axiosRequestArgs);
2738
- };
2739
- });
2740
- },
2741
- googleIntegrationPost(googleIntegration, options) {
2742
- return __awaiter(this, void 0, void 0, function* () {
2743
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).googleIntegrationPost(googleIntegration, options);
2744
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2745
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2746
- return axios.request(axiosRequestArgs);
2747
- };
2748
- });
2749
- },
2750
- postError(postError, options) {
2751
- return __awaiter(this, void 0, void 0, function* () {
2752
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postError(postError, options);
2753
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2754
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2755
- return axios.request(axiosRequestArgs);
2756
- };
2757
- });
2758
- },
2759
- postPageTrack(postSiteTrack, options) {
2760
- return __awaiter(this, void 0, void 0, function* () {
2761
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postPageTrack(postSiteTrack, options);
2762
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2763
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2764
- return axios.request(axiosRequestArgs);
2765
- };
2766
- });
2767
- },
2768
- putFeedback(feedbackPutData, options) {
2769
- return __awaiter(this, void 0, void 0, function* () {
2770
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).putFeedback(feedbackPutData, options);
2771
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2772
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2773
- return axios.request(axiosRequestArgs);
2774
- };
2775
- });
2776
- },
2777
- sitePost(postAccount, options) {
2778
- return __awaiter(this, void 0, void 0, function* () {
2779
- const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).sitePost(postAccount, options);
2780
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
2781
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
2782
- return axios.request(axiosRequestArgs);
2783
- };
2784
- });
2785
- }
2786
- };
2787
- };
2788
- exports.DefaultApiFp = DefaultApiFp;
2789
- var DefaultApiFactory = function(configuration, basePath, axios) {
2790
- return {
2791
- accountGet(options) {
2792
- return (0, exports.DefaultApiFp)(configuration).accountGet(options).then((request) => request(axios, basePath));
2793
- },
2794
- archiveError(id, options) {
2795
- return (0, exports.DefaultApiFp)(configuration).archiveError(id, options).then((request) => request(axios, basePath));
2796
- },
2797
- archiveErrors(archiveErrors, options) {
2798
- return (0, exports.DefaultApiFp)(configuration).archiveErrors(archiveErrors, options).then((request) => request(axios, basePath));
2799
- },
2800
- bingIntegrationPost(bingIntegration, options) {
2801
- return (0, exports.DefaultApiFp)(configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(axios, basePath));
2802
- },
2803
- getTrackingAllSites(minDate, maxDate, options) {
2804
- return (0, exports.DefaultApiFp)(configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(axios, basePath));
2805
- },
2806
- getTrackingSite(id, minDate, maxDate, options) {
2807
- return (0, exports.DefaultApiFp)(configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(axios, basePath));
2808
- },
2809
- googleIntegrationPost(googleIntegration, options) {
2810
- return (0, exports.DefaultApiFp)(configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(axios, basePath));
2811
- },
2812
- postError(postError, options) {
2813
- return (0, exports.DefaultApiFp)(configuration).postError(postError, options).then((request) => request(axios, basePath));
2814
- },
2815
- postPageTrack(postSiteTrack, options) {
2816
- return (0, exports.DefaultApiFp)(configuration).postPageTrack(postSiteTrack, options).then((request) => request(axios, basePath));
2817
- },
2818
- putFeedback(feedbackPutData, options) {
2819
- return (0, exports.DefaultApiFp)(configuration).putFeedback(feedbackPutData, options).then((request) => request(axios, basePath));
2820
- },
2821
- sitePost(postAccount, options) {
2822
- return (0, exports.DefaultApiFp)(configuration).sitePost(postAccount, options).then((request) => request(axios, basePath));
2823
- }
2824
- };
2825
- };
2826
- exports.DefaultApiFactory = DefaultApiFactory;
2827
- var DefaultApi4 = class extends base_1.BaseAPI {
2828
- accountGet(options) {
2829
- return (0, exports.DefaultApiFp)(this.configuration).accountGet(options).then((request) => request(this.axios, this.basePath));
2830
- }
2831
- archiveError(id, options) {
2832
- return (0, exports.DefaultApiFp)(this.configuration).archiveError(id, options).then((request) => request(this.axios, this.basePath));
2833
- }
2834
- archiveErrors(archiveErrors, options) {
2835
- return (0, exports.DefaultApiFp)(this.configuration).archiveErrors(archiveErrors, options).then((request) => request(this.axios, this.basePath));
2836
- }
2837
- bingIntegrationPost(bingIntegration, options) {
2838
- return (0, exports.DefaultApiFp)(this.configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(this.axios, this.basePath));
2839
- }
2840
- getTrackingAllSites(minDate, maxDate, options) {
2841
- return (0, exports.DefaultApiFp)(this.configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
2842
- }
2843
- getTrackingSite(id, minDate, maxDate, options) {
2844
- return (0, exports.DefaultApiFp)(this.configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
2845
- }
2846
- googleIntegrationPost(googleIntegration, options) {
2847
- return (0, exports.DefaultApiFp)(this.configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(this.axios, this.basePath));
2848
- }
2849
- postError(postError, options) {
2850
- return (0, exports.DefaultApiFp)(this.configuration).postError(postError, options).then((request) => request(this.axios, this.basePath));
2851
- }
2852
- postPageTrack(postSiteTrack, options) {
2853
- return (0, exports.DefaultApiFp)(this.configuration).postPageTrack(postSiteTrack, options).then((request) => request(this.axios, this.basePath));
2854
- }
2855
- putFeedback(feedbackPutData, options) {
2856
- return (0, exports.DefaultApiFp)(this.configuration).putFeedback(feedbackPutData, options).then((request) => request(this.axios, this.basePath));
2857
- }
2858
- sitePost(postAccount, options) {
2859
- return (0, exports.DefaultApiFp)(this.configuration).sitePost(postAccount, options).then((request) => request(this.axios, this.basePath));
2860
- }
2861
- };
2862
- exports.DefaultApi = DefaultApi4;
2863
- }
2864
- });
2865
-
2866
- // ../../node_modules/ag-common/dist/ui/components/Close/index.js
2867
- var require_Close = __commonJS({
2868
- "../../node_modules/ag-common/dist/ui/components/Close/index.js"(exports) {
2869
- "use strict";
2870
- var __importDefault = exports && exports.__importDefault || function(mod) {
2871
- return mod && mod.__esModule ? mod : { "default": mod };
2872
- };
2873
- Object.defineProperty(exports, "__esModule", { value: true });
2874
- exports.Close = void 0;
2875
- var styled_components_1 = __importDefault(require("styled-components"));
2876
- var react_1 = __importDefault(require("react"));
2877
- var SClose = styled_components_1.default.div`
1
+ var In=Object.create;var Ue=Object.defineProperty,Mn=Object.defineProperties,Ln=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,Vn=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable;var $t=(e,t,r)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&$t(e,r,t[r]);if(Jt)for(var r of Jt(t))Kn.call(t,r)&&$t(e,r,t[r]);return e},k=(e,t)=>Mn(e,Bn(t));var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Un=(e,t)=>{for(var r in t)Ue(e,r,{get:t[r],enumerable:!0})},Ht=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fn(t))!zt.call(e,i)&&i!==r&&Ue(e,i,{get:()=>t[i],enumerable:!(n=Ln(t,i))||n.enumerable});return e};var v=(e,t,r)=>(r=e!=null?In(Vn(e)):{},Ht(t||!e||!e.__esModule?Ue(r,"default",{value:e,enumerable:!0}):r,e)),Nn=e=>Ht(Ue({},"__esModule",{value:!0}),e);var T=(e,t,r)=>new Promise((n,i)=>{var o=a=>{try{l(r.next(a))}catch(u){i(u)}},s=a=>{try{l(r.throw(a))}catch(u){i(u)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,s);l((r=r.apply(e,t)).next())});var Ge=g(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.distinct=I.distinctBy=I.notEmpty=I.partition=I.chunk=I.take=I.flat=I.toObject=void 0;var Jn=(e,t)=>{let r={};return!e||!t||e.forEach(n=>{let i=t(n);r[i]=n}),r};I.toObject=Jn;var $n=e=>[].concat(...e);I.flat=$n;var zn=(e,t)=>{let r=JSON.parse(JSON.stringify(e));return{part:r.slice(0,t),rest:r.slice(t)}};I.take=zn;var Hn=(e,t)=>{let r=[],n=[];for(let i in e){let o=e[i];n.push(o),n.length>=t&&(r.push(n),n=[])}return n.length>0&&r.push(n),r};I.chunk=Hn;var Gn=(e,t)=>e?.length?[e.filter(r=>t(r)),e.filter(r=>!t(r))]:null;I.partition=Gn;function Wn(e){return e!=null&&e!==!1}I.notEmpty=Wn;function Yn(e,t,r){if(!e||e.length===0)return e;let n=new Set;return e.filter(i=>{let o;return typeof t=="string"?o=i[t]:o=t(i),!o&&r||n.has(o)?!1:(n.add(o),!0)})}I.distinctBy=Yn;var Qn=e=>[...new Set(e)];I.distinct=Qn});var Wt=g(fe=>{"use strict";var Gt=fe&&fe.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(fe,"__esModule",{value:!0});fe.asyncMap=fe.asyncForEach=void 0;function Zn(e,t){return Gt(this,void 0,void 0,function*(){for(let r=0;r<e.length;r+=1)yield t(e[r],r,e)})}fe.asyncForEach=Zn;function Xn(e,t){return Gt(this,void 0,void 0,function*(){let r=[];for(let n=0;n<e.length;n+=1)r.push(yield t(e[n],n,e));return r})}fe.asyncMap=Xn});var ke=g(_=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0});_.stringToObject=_.chunkString=_.safeStringify=_.containsInsensitive=_.containsInsensitiveIndex=_.replaceRemove=_.toTitleCase=_.niceUrl=_.truncate=_.trim=_.trimSide=_.csvJSON=_.fromBase64=_.toBase64=void 0;var ei=e=>Buffer.from(e).toString("base64");_.toBase64=ei;var ti=e=>Buffer.from(decodeURIComponent(e),"base64").toString();_.fromBase64=ti;var ri=e=>{let t=e.split(`
2
+ `),r=[],n=t[0].split(",");for(let i=1;i<t.length;i+=1){let o={},s=t[i].split(",");for(let l=0;l<n.length;l+=1)o[n[l]]=s[l];r.push(o)}return r};_.csvJSON=ri;function Tt(e,t=!0,...r){let n=r.join("");if(!e)return e;let i=e.replace(new RegExp(`[${n}]*$`,"g"),"");return t?i.replace(new RegExp(`^[${n}]*`,"g"),""):i}_.trimSide=Tt;function Yt(e,...t){return e?(e=Tt(e,!0,...t),e=Tt(e,!1,...t),e):""}_.trim=Yt;function ni(e,t,r){if(!!e)return e.length>t?e.substr(0,t-1)+r:e}_.truncate=ni;var ii=e=>{if(!e)return;let t=e.substring(e.indexOf(":")+1).replace("sc-domain:","").replace("https://","").replace("http://","");return t=Yt(t,"/"),{siteUrl:e,niceSiteUrl:t}};_.niceUrl=ii;function oi(e){return e&&e.replace(/\w\S*/g,t=>t&&t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())}_.toTitleCase=oi;function si(e,...t){let r=[],n=[];t.forEach(u=>{if(typeof u!="string")throw new Error("trim only supports strings");u.length===1?r.push(u):n.push(u)});let i=0,o=0,s=e,l=`[${r.join("")}]*`,a=`(${n.map(u=>`(${u})`).join("|")})*`;do i=s.length,s=s.replace(new RegExp(a,"gim"),""),s=s.replace(new RegExp(l,"gim"),""),o=s.length;while(o<i);return s}_.replaceRemove=si;function Qt({str:e,fromLast:t=!1},...r){if(!e||!r)return-1;let n=r.map(s=>s.toLowerCase()),i=e.toLowerCase(),o=n.map(s=>t?i.lastIndexOf(s):i.indexOf(s)).filter(s=>s!==-1).sort();return o.length===0?-1:t?o[o.length-1]:o[0]}_.containsInsensitiveIndex=Qt;var ai=(e,...t)=>Qt({str:e},...t)!==-1;_.containsInsensitive=ai;var ci=(e,t=2)=>{let r=[],n=JSON.stringify(e,(i,o)=>typeof o=="object"&&o!==null?r.includes(o)?void 0:r.push(o)&&o:o,t);return r=null,n};_.safeStringify=ci;var ui=(e,t)=>e.match(new RegExp(`.{1,${t}}`,"g"));_.chunkString=ui;function Zt(e,t,r){let n={};return Zt&&e.split(r).forEach(i=>{let[o,s]=i.split(t);o&&(n[o]=s)}),n}_.stringToObject=Zt});var er=g(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.base64ToBinary=Te.arrayBufferToBase64=void 0;var Xt=ke();function li(e){let t=new Buffer(e.byteLength),r=new Uint8Array(e);for(let n=0;n<t.length;++n)t[n]=r[n];return t}function di(e){let t=(0,Xt.fromBase64)(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i+=1)n[i]=t.charCodeAt(i);return n.buffer}function fi(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i+=1)t+=String.fromCharCode(r[i]);return(0,Xt.toBase64)(t)}Te.arrayBufferToBase64=fi;var hi=e=>li(di(e));Te.base64ToBinary=hi});var tr=g(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.dateTimeToNearestMinute=M.CSharpToJs=M.dateDiffDays=M.lastDayInMonth=M.addMinutes=M.addDays=M.addHours=M.getTimeSeconds=void 0;var pi=()=>Math.ceil(new Date().getTime()/1e3);M.getTimeSeconds=pi;var gi=(e,t)=>new Date(e+t*60*60*1e3);M.addHours=gi;var mi=(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r};M.addDays=mi;var yi=(e,t)=>new Date(e.getTime()+t*6e4);M.addMinutes=yi;var bi=e=>new Date(e.getFullYear(),e.getMonth()+1,0);M.lastDayInMonth=bi;var vi=(e,t)=>{let r=new Date(e),n=new Date(t);return Math.floor((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/1e3)};M.dateDiffDays=vi;var _i=e=>{let t=e/1e4,r=Math.abs(new Date(0,0,1).setFullYear(1));return new Date(t-r)};M.CSharpToJs=_i;var wi=(e,t)=>{let r=6e4*e;return t||(t=new Date),new Date(Math.round(t.getTime()/r)*r)};M.dateTimeToNearestMinute=wi});var rr=g(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.getEmailsErrors=te.getEmailErrors=te.isEmailValid=void 0;var Oi=Ge(),ji=/^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/,Ai=e=>{if(!e||e.length>256||!ji.test(e))return!1;let r=e.split("@");return!(r[0].length>64||r[1].split(".").some(i=>i.length>64))};te.isEmailValid=Ai;var Ei=(e,t)=>{if(!(0,te.isEmailValid)(e))return`email not valid:${e}`;if(t.creatorId===e)return"You cannot add the creator of this event as an admin"};te.getEmailErrors=Ei;var ki=(e,t)=>e.map(r=>(0,te.getEmailErrors)(r,t)).filter(Oi.notEmpty);te.getEmailsErrors=ki});var ir=g(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.retry=void 0;var Ti=$();function nr(e,t,r=3,n=1e3){return new Promise((i,o)=>{t().then(i).catch(s=>{setTimeout(()=>{r===1?((0,Ti.error)(`retry/${e} failed:${s}`),o(s)):nr(e,t,r-1,n).then(i,o)},n)})})}We.retry=nr});var or=g(Se=>{"use strict";var Si=Se&&Se.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(Se,"__esModule",{value:!0});Se.runGenerator=void 0;function Ci(e,t){return Si(this,void 0,void 0,function*(){let r;do{if(r=yield e.next(),!r?.value||r.value.length===0)return;yield t(r.value)}while(!r.done)})}Se.runGenerator=Ci});var sr=g(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.groupByTwice=he.groupByList=he.groupBy=void 0;function Pi(e,t){let r={};return e.forEach(n=>{let i=t(n);r[i]||(r[i]=[]),r[i].push(n)}),r}he.groupBy=Pi;function xi(e,t){let r=[];return e.forEach(n=>{let i=t(n),o=r.find(s=>s.key===i);o?o.items.push(n):r.push({key:i,items:[n]})}),r}he.groupByList=xi;function qi(e,t,r){let n={};return e.forEach(i=>{let o=t(i),s=r(i);n[o]||(n[o]={}),n[o][s]=i}),n}he.groupByTwice=qi});var St=g(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.generateNewPK=Oe.hashCode=void 0;var Di=(e,t=0)=>{if(!e)return"";let r=3735928559^t,n=1103547991^t;for(let o=0,s;o<e.length;o+=1)s=e.charCodeAt(o),r=Math.imul(r^s,2654435761),n=Math.imul(n^s,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),(4294967296*(2097151&n)+(r>>>0)).toString()};Oe.hashCode=Di;var Ri=()=>(0,Oe.hashCode)(new Date().getTime().toString());Oe.generateNewPK=Ri});var ar=g(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.t=le.getValidatedLang=le.AllLang=void 0;le.AllLang=["en","id","vi"];var Ii=e=>{let t=le.AllLang.find(r=>r===e);return t||"en"};le.getValidatedLang=Ii;var Mi=(e,t)=>{var r;return(r=e[t])!==null&&r!==void 0?r:e.en};le.t=Mi});var cr=g(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.toFixedDown=N.isNumber=N.getRandomInt=N.sumArray=N.clamp=N.roundToHalf=N.toFixed=void 0;var Li=(e,t)=>{var r,n;let i=new RegExp(`^-?\\d+(?:.\\d{0,${t||-1}})?`),o=(n=(r=e?.toString())===null||r===void 0?void 0:r.match(i))===null||n===void 0?void 0:n[0];return o?Number.parseFloat(o):e};N.toFixed=Li;function Bi(e){let t=e-parseInt(e.toString(),10);return t=Math.round(t*10),t===5?parseInt(e.toString(),10)+.5:t<3||t>7?Math.round(e):parseInt(e.toString(),10)+.5}N.roundToHalf=Bi;function Fi({value:e,min:t,max:r}){return e<t?t:e>r?r:e}N.clamp=Fi;function Vi(e){return e.reduce((t,r)=>t+r)}N.sumArray=Vi;var Ki=e=>Math.floor(Math.random()*Math.floor(e));N.getRandomInt=Ki;function Ui(e){let t=new RegExp("(\\d+\\.?\\d*)(\\d)");return!!e.toString().match(t)}N.isNumber=Ui;function Ni(e,t){if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;let r=`${e}`.split("e"),n="";return+r[1]+t>0&&(n="+"),+`${Math.round(`${+r[0]}e${n}${+r[1]+t}`)}e-${t}`}N.toFixedDown=Ni});var ur=g(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.memo=void 0;var Ji=St(),Ct={};function $i(e,...t){let r=(0,Ji.hashCode)(JSON.stringify(t));return Ct[r]||(Ct[r]=e(...t)),Ct[r]}Ye.memo=$i});var Qe=g(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.castStringlyObject=w.removeUndefValuesFromObject=w.castObject=w.objectToString=w.paramsToObject=w.objectAlphaSort=w.objectToArray=w.getObjectKeysAsNumber=w.objectKeysToLowerCase=w.isJson=w.tryJsonParse=void 0;var zi=Pt(),Hi=(e,t)=>{if(!e)return null;try{return JSON.parse(e)}catch{return t}};w.tryJsonParse=Hi;function Gi(e){try{JSON.parse(typeof e=="string"?e:JSON.stringify(e))}catch{return!1}return!0}w.isJson=Gi;var Wi=e=>!e||Object.keys(e).length===0?{}:Object.keys(e).reduce((t,r)=>{let n=e[r],i=typeof n=="object"?(0,w.objectKeysToLowerCase)(n):n;return t[r.toLowerCase()]=i,t},{});w.objectKeysToLowerCase=Wi;var Yi=e=>Object.keys(e).map(t=>parseInt(t,10));w.getObjectKeysAsNumber=Yi;function Qi(e){if(!e)return[];let t=[];return Object.keys(e).forEach(r=>{t.push({key:r,value:e[r]})}),t}w.objectToArray=Qi;var Zi=(e,t=-1)=>t===0?e:e!==null&&typeof e=="object"?Object.keys(e).sort((r,n)=>r.toLowerCase()<n.toLowerCase()?-1:1).reduce((r,n)=>(r[n]=(0,w.objectAlphaSort)(e[n],t-1),r),{}):Array.isArray(e)?e.map(r=>(0,w.objectAlphaSort)(r,t-1)):e;w.objectAlphaSort=Zi;function Xi(e){let t={};for(let[r,n]of e)t[r]=n;return t}w.paramsToObject=Xi;function eo(e,t,r){let n="";return!e||Object.keys(e).length===0||(Object.entries(e).forEach(([i,o])=>{n+=`${r}${i}${t}${o}`}),n=(0,zi.trim)(n,t)),n}w.objectToString=eo;var to=(e,t)=>{let r={};return Object.entries(e).forEach(([n,i])=>{r[n]=t(i)}),r};w.castObject=to;var ro=e=>{let t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(t[r]=n)}),t};w.removeUndefValuesFromObject=ro;var no=e=>{let t=(0,w.removeUndefValuesFromObject)(e);return(0,w.castObject)(t,r=>Array.isArray(r)?r.join(","):r)};w.castStringlyObject=no});var lr=g(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.shuffle=void 0;function io(e,t){let r=e.length,n,i;t=t||1;let o=function(){let s=Math.sin(t+=1)*1e4;return s-Math.floor(s)};for(;r!==0;)i=Math.floor(o()*r),r-=1,n=e[r],e[r]=e[i],e[i]=n;return e}Ze.shuffle=io});var dr=g(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.secondsInNearest=void 0;var Xe=(e,t)=>{var r,n;let i=new RegExp(`^-?\\d+(?:.\\d{0,${t||-1}})?`),o=(n=(r=e?.toString())===null||r===void 0?void 0:r.match(i))===null||n===void 0?void 0:n[0];return o?Number.parseFloat(o):e},oo=({seconds:e,precision:t=2})=>{if(e<=0)return"Now";if(e<90){let s=Xe(e,t);return`${s} ${s===1?"second":"seconds"}`}let r=e/60;if(r<120){let s=Xe(r,t);return`${s} ${s===1?"minute":"minutes"}`}let n=r/60;if(n<24){let s=Xe(n,t);return`${s} ${s===1?"hour":"hours"}`}let i=n/24,o=Xe(i,t);return`${o} ${o===1?"day":"days"}`};et.secondsInNearest=oo});var xt=g(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.sleep=void 0;var so=e=>new Promise(t=>setTimeout(t,e));tt.sleep=so});var Pt=g(S=>{"use strict";var ao=S&&S.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),L=S&&S.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ao(t,e,r)};Object.defineProperty(S,"__esModule",{value:!0});L(Ge(),S);L(Wt(),S);L(er(),S);L(tr(),S);L(rr(),S);L(ir(),S);L(or(),S);L(sr(),S);L(St(),S);L(ar(),S);L($(),S);L(cr(),S);L(ur(),S);L(Qe(),S);L(lr(),S);L(dr(),S);L(xt(),S);L(ke(),S)});var $=g(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.fatal=C.error=C.trace=C.warn=C.info=C.debug=C.SetLogLevel=C.GetLogLevel=void 0;var co=Pt(),uo=e=>["TRACE","DEBUG","INFO","WARN","ERROR","FATAL"].findIndex(t=>t===e);C.GetLogLevel=uo;var fr="WARN",lo=e=>{let t=e?.toUpperCase();(0,C.GetLogLevel)(t)!==-1&&(fr=t)};C.SetLogLevel=lo;(0,C.SetLogLevel)(process.env.LOG_LEVEL||"");function Ce(e,t){let r=(0,C.GetLogLevel)(fr);if((0,C.GetLogLevel)(e)<r)return;let o=[`[${new Date().toLocaleTimeString("en-GB")}]`,e,...t.filter(co.notEmpty)];switch(e){case"TRACE":{console.trace(...o);break}case"DEBUG":{console.debug(...o);break}case"INFO":{console.log(...o);break}case"WARN":{console.warn(...o);break}case"ERROR":{console.error(...o);break}case"FATAL":{console.error(...o);break}default:{console.log(...o);break}}}function qt(...e){let t=[],r=!1;try{throw new Error("Test")}catch(n){let i=n;if(i.stack){let o=i.stack.split(`
3
+ `);for(let s=0,l=o.length;s<l;s+=1)t.push(` ${o[s]} `);t.shift(),r=!0}else if(window.opera&&i.message){let o=i.message.split(`
4
+ `);for(let s=0,l=o.length;s<l;s+=1)if(o[s].match(/^\s*[A-Za-z0-9\-_$]+\(/)){let a=o[s];o[s+1]&&(a+=` at ${o[s+1]}`,s+=1),t.push(a)}t.shift(),r=!0}}if(!r){let n=e.callee.caller;for(;n;){let i=n.toString(),o=i.substring(i.indexOf("function")+8,i.indexOf("("))||"anonymous";t.push(o),n=n.caller}}return t.join(`
5
+ `)}var fo=(...e)=>Ce("DEBUG",e);C.debug=fo;var ho=(...e)=>Ce("INFO",e);C.info=ho;var po=(...e)=>Ce("WARN",e);C.warn=po;var go=(...e)=>{e.push(qt()),Ce("TRACE",e)};C.trace=go;var mo=(...e)=>{e.push(qt()),Ce("ERROR",e)};C.error=mo;var yo=(...e)=>{e.push(qt()),Ce("FATAL",e)};C.fatal=yo});var Dt=g(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.maxCookieLen=Pe.expireDate=void 0;Pe.expireDate="Thu, 01 Jan 1970 00:00:00 UTC";Pe.maxCookieLen=4e3});var rt=g(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.setCookieString=pe.setCookieRawWrapper=pe.wipeCookies=void 0;var pr=Dt(),bo=nt(),vo=$(),hr=ke();function gr({name:e,value:t,expiryDays:r=1}){if(typeof window===void 0)return;let n=new Date;n.setTime(n.getTime()+r*24*60*60*1e3);let i=`expires=${!t||r<0?pr.expireDate:n.toUTCString()}`;document.cookie=`${e}=${t||""};${i};path=/`}function mr(e){if(typeof window>"u"){(0,vo.warn)("cant wipe cookies on server");return}let t=0;for(;;)if((0,bo.getCookieRaw)({name:e+t,cookieDocument:""}))gr({name:e+t,value:"",expiryDays:-1}),t+=1;else return}pe.wipeCookies=mr;function yr(e){let t=i=>e.stringify?e.stringify(i):JSON.stringify(i);if(mr(e.name),!e.value)return;let r=(0,hr.toBase64)(t(e.value)),n=(0,hr.chunkString)(r,pr.maxCookieLen);for(let i in n){let o=n[i];gr(Object.assign(Object.assign({},e),{name:e.name+i,value:o}))}}pe.setCookieRawWrapper=yr;var _o=e=>yr(Object.assign(Object.assign({},e),{stringify:t=>t}));pe.setCookieString=_o});var nt=g(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.getCookieString=ge.getCookieRawWrapper=ge.getCookieRaw=void 0;var wo=rt(),Oo=$(),jo=ke();function br({name:e,cookieDocument:t}){let r=`${e}=`,n=t||typeof window<"u"&&document.cookie;if(!n||!n?.trim())return;let o=n.split(";").map(s=>s.trim()).find(s=>s.startsWith(r));if(o)return o.substr(r.length,o.length)}ge.getCookieRaw=br;function vr({name:e,cookieDocument:t,defaultValue:r,parse:n}){let i=l=>l?n?n(l):JSON.parse(l):r,o="",s=0;for(;;){let l=br({name:e+s,cookieDocument:t});if(!l)break;o+=l,s+=1}try{return i((0,jo.fromBase64)(o))}catch(l){return(0,Oo.warn)("cookie error:",l),(0,wo.wipeCookies)(e),r}}ge.getCookieRawWrapper=vr;var Ao=e=>vr(Object.assign(Object.assign({},e),{parse:t=>t,defaultValue:e.defaultValue||""}));ge.getCookieString=Ao});var _r=g(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.useCookieBoolean=re.useCookieNumber=re.useCookieString=re.useCookie=void 0;var Eo=nt(),ko=rt(),To=require("react");function it(e){let t=s=>s?e.parse?e.parse(s):JSON.parse(s):e.defaultValue,r=s=>e.stringify?e.stringify(s):JSON.stringify(s),[n,i]=(0,To.useState)((0,Eo.getCookieRawWrapper)(Object.assign(Object.assign({},e),{parse:t}))||e.defaultValue);return[n,s=>{let l=s instanceof Function?s(n):s;(0,ko.setCookieRawWrapper)(Object.assign(Object.assign({},e),{stringify:r,value:l})),i(l)}]}re.useCookie=it;var So=e=>it(Object.assign(Object.assign({},e),{parse:t=>t||"",stringify:t=>t,defaultValue:e.defaultValue||""}));re.useCookieString=So;var Co=e=>it(Object.assign(Object.assign({},e),{parse:t=>t?Number.parseFloat(t):void 0,stringify:t=>t?t.toString():"",defaultValue:e.defaultValue}));re.useCookieNumber=Co;var Po=e=>it(Object.assign(Object.assign({},e),{parse:t=>t==="true",stringify:t=>t.toString()}));re.useCookieBoolean=Po});var st=g(ne=>{"use strict";var xo=ne&&ne.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ot=ne&&ne.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&xo(t,e,r)};Object.defineProperty(ne,"__esModule",{value:!0});ot(Dt(),ne);ot(nt(),ne);ot(rt(),ne);ot(_r(),ne)});var at=g(xe=>{"use strict";var qo=xe&&xe.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(xe,"__esModule",{value:!0});xe.callOpenApi=void 0;var Do=st(),Ro=xt(),Io=Ge(),Mo=({func:e,apiUrl:t,overrideAuth:r,refreshToken:n,logout:i,newDefaultApi:o,headers:s})=>qo(void 0,void 0,void 0,function*(){var l,a,u,c,d,h,f,b,V,K,y,q,m,J;let O,X,ae={basePath:t,baseOptions:{headers:Object.assign({authorization:""},s||{})}};if(r?.id_token)ae.baseOptions.headers.authorization=`Bearer ${r?.id_token}`;else if(!!(0,Do.getCookieString)({name:"id_token",defaultValue:""})){let j=yield n();!((l=j?.jwt)===null||l===void 0)&&l.id_token&&(ae.baseOptions.headers.authorization=`Bearer ${(a=j?.jwt)===null||a===void 0?void 0:a.id_token}`)}let U=o(ae),R=0,z=3;for(;R<=z;){R+=1;try{let D=yield e(U);if(D.status<400){X=D.data;break}throw new Error(JSON.stringify(D.data)||D.statusText)}catch(D){let j=D,ce=(u=j.response)===null||u===void 0?void 0:u.status,ue=[(h=(d=(c=j.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.toString())!==null&&h!==void 0?h:"",(V=(b=(f=j.response)===null||f===void 0?void 0:f.statusText)===null||b===void 0?void 0:b.toString())!==null&&V!==void 0?V:"",(q=(y=(K=j.response)===null||K===void 0?void 0:K.status)===null||y===void 0?void 0:y.toString())!==null&&q!==void 0?q:"",(J=(m=j.message)===null||m===void 0?void 0:m.toString())!==null&&J!==void 0?J:""].filter(Io.notEmpty).sort((ee,W)=>ee.length<W.length?-1:1).join(`
6
+ `);if(ce===403||ce===401)return i(),{error:j,data:void 0};if(ce!==500||R===z){O=Object.assign(Object.assign({},j),{message:ue});break}}yield(0,Ro.sleep)(2e3)}return Object.assign({data:X},O&&{error:O})});xe.callOpenApi=Mo});var wr=g((Za,ct)=>{var Lo=function(){"use strict";function e(c,d){return d!=null&&c instanceof d}var t;try{t=Map}catch{t=function(){}}var r;try{r=Set}catch{r=function(){}}var n;try{n=Promise}catch{n=function(){}}function i(c,d,h,f,b){typeof d=="object"&&(h=d.depth,f=d.prototype,b=d.includeNonEnumerable,d=d.circular);var V=[],K=[],y=typeof Buffer<"u";typeof d>"u"&&(d=!0),typeof h>"u"&&(h=1/0);function q(m,J){if(m===null)return null;if(J===0)return m;var O,X;if(typeof m!="object")return m;if(e(m,t))O=new t;else if(e(m,r))O=new r;else if(e(m,n))O=new n(function(ee,W){m.then(function(Y){ee(q(Y,J-1))},function(Y){W(q(Y,J-1))})});else if(i.__isArray(m))O=[];else if(i.__isRegExp(m))O=new RegExp(m.source,u(m)),m.lastIndex&&(O.lastIndex=m.lastIndex);else if(i.__isDate(m))O=new Date(m.getTime());else{if(y&&Buffer.isBuffer(m))return Buffer.allocUnsafe?O=Buffer.allocUnsafe(m.length):O=new Buffer(m.length),m.copy(O),O;e(m,Error)?O=Object.create(m):typeof f>"u"?(X=Object.getPrototypeOf(m),O=Object.create(X)):(O=Object.create(f),X=f)}if(d){var ae=V.indexOf(m);if(ae!=-1)return K[ae];V.push(m),K.push(O)}e(m,t)&&m.forEach(function(ee,W){var Y=q(W,J-1),Ke=q(ee,J-1);O.set(Y,Ke)}),e(m,r)&&m.forEach(function(ee){var W=q(ee,J-1);O.add(W)});for(var U in m){var R;X&&(R=Object.getOwnPropertyDescriptor(X,U)),!(R&&R.set==null)&&(O[U]=q(m[U],J-1))}if(Object.getOwnPropertySymbols)for(var z=Object.getOwnPropertySymbols(m),U=0;U<z.length;U++){var D=z[U],j=Object.getOwnPropertyDescriptor(m,D);j&&!j.enumerable&&!b||(O[D]=q(m[D],J-1),j.enumerable||Object.defineProperty(O,D,{enumerable:!1}))}if(b)for(var ce=Object.getOwnPropertyNames(m),U=0;U<ce.length;U++){var ue=ce[U],j=Object.getOwnPropertyDescriptor(m,ue);j&&j.enumerable||(O[ue]=q(m[ue],J-1),Object.defineProperty(O,ue,{enumerable:!1}))}return O}return q(c,h)}i.clonePrototype=function(d){if(d===null)return null;var h=function(){};return h.prototype=d,new h};function o(c){return Object.prototype.toString.call(c)}i.__objToStr=o;function s(c){return typeof c=="object"&&o(c)==="[object Date]"}i.__isDate=s;function l(c){return typeof c=="object"&&o(c)==="[object Array]"}i.__isArray=l;function a(c){return typeof c=="object"&&o(c)==="[object RegExp]"}i.__isRegExp=a;function u(c){var d="";return c.global&&(d+="g"),c.ignoreCase&&(d+="i"),c.multiline&&(d+="m"),d}return i.__getRegExpFlags=u,i}();typeof ct=="object"&&ct.exports&&(ct.exports=Lo)});var Ar=g((Or,jr)=>{(function(){var e,t,r,n=[].splice,i=function(s,l){if(!(s instanceof l))throw new Error("Bound instance method accessed before binding")},o=[].indexOf;r=wr(),e=require("events").EventEmitter,jr.exports=t=function(){class s extends e{constructor(a={}){super();this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=a,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(u=>{var c;c=this[u],this[u]=function(...d){var h,f,b,V;if(b=d,[...d]=b,[h]=n.call(d,-1),typeof h=="function")try{V=c(...d),h(null,V)}catch(K){f=K,h(f)}else return c(...d,h)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(a){var u,c;if(i(this,s),(c=this._isInvalidKey(a))!=null)throw c;if(this.data[a]!=null&&this._check(a,this.data[a]))return this.stats.hits++,u=this._unwrap(this.data[a]),u;this.stats.misses++}mget(a){var u,c,d,h,f,b;if(i(this,s),!Array.isArray(a))throw u=this._error("EKEYSTYPE"),u;for(b={},d=0,f=a.length;d<f;d++){if(h=a[d],(c=this._isInvalidKey(h))!=null)throw c;this.data[h]!=null&&this._check(h,this.data[h])?(this.stats.hits++,b[h]=this._unwrap(this.data[h])):this.stats.misses++}return b}set(a,u,c){var d,h,f;if(i(this,s),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw d=this._error("ECACHEFULL"),d;if(this.options.forceString&&!typeof u==="string"&&(u=JSON.stringify(u)),c==null&&(c=this.options.stdTTL),(h=this._isInvalidKey(a))!=null)throw h;return f=!1,this.data[a]&&(f=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[a],!1))),this.data[a]=this._wrap(u,c),this.stats.vsize+=this._getValLength(u),f||(this.stats.ksize+=this._getKeyLength(a),this.stats.keys++),this.emit("set",a,u),!0}mset(a){var u,c,d,h,f,b,V,K,y,q;if(i(this,s),this.options.maxKeys>-1&&this.stats.keys+a.length>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;for(d=0,V=a.length;d<V;d++){if(b=a[d],{key:f,val:q,ttl:y}=b,y&&typeof y!="number")throw u=this._error("ETTLTYPE"),u;if((c=this._isInvalidKey(f))!=null)throw c}for(h=0,K=a.length;h<K;h++)b=a[h],{key:f,val:q,ttl:y}=b,this.set(f,q,y);return!0}del(a){var u,c,d,h,f,b;for(i(this,s),Array.isArray(a)||(a=[a]),u=0,d=0,f=a.length;d<f;d++){if(h=a[d],(c=this._isInvalidKey(h))!=null)throw c;this.data[h]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[h],!1)),this.stats.ksize-=this._getKeyLength(h),this.stats.keys--,u++,b=this.data[h],delete this.data[h],this.emit("del",h,b.v))}return u}take(a){var u;return i(this,s),u=this.get(a),u!=null&&this.del(a),u}ttl(a,u){var c;if(i(this,s),u||(u=this.options.stdTTL),!a)return!1;if((c=this._isInvalidKey(a))!=null)throw c;return this.data[a]!=null&&this._check(a,this.data[a])?(u>=0?this.data[a]=this._wrap(this.data[a].v,u,!1):this.del(a),!0):!1}getTtl(a){var u,c;if(i(this,s),!!a){if((c=this._isInvalidKey(a))!=null)throw c;if(this.data[a]!=null&&this._check(a,this.data[a]))return u=this.data[a].t,u}}keys(){var a;return i(this,s),a=Object.keys(this.data),a}has(a){var u;return i(this,s),u=this.data[a]!=null&&this._check(a,this.data[a]),u}getStats(){return i(this,s),this.stats}flushAll(a=!0){i(this,s),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(a),this.emit("flush")}flushStats(){i(this,s),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){i(this,s),this._killCheckPeriod()}_checkData(a=!0){var u,c,d;i(this,s),c=this.data;for(u in c)d=c[u],this._check(u,d);a&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,a),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(a,u){var c;return i(this,s),c=!0,u.t!==0&&u.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(a)),this.emit("expired",a,this._unwrap(u))),c}_isInvalidKey(a){var u;if(i(this,s),u=typeof a,o.call(this.validKeyTypes,u)<0)return this._error("EKEYTYPE",{type:typeof a})}_wrap(a,u,c=!0){var d,h,f,b;return i(this,s),this.options.useClones||(c=!1),h=Date.now(),d=0,b=1e3,u===0?d=0:u?d=h+u*b:this.options.stdTTL===0?d=this.options.stdTTL:d=h+this.options.stdTTL*b,f={t:d,v:c?r(a):a}}_unwrap(a,u=!0){return this.options.useClones||(u=!1),a.v!=null?u?r(a.v):a.v:null}_getKeyLength(a){return a.toString().length}_getValLength(a){return i(this,s),typeof a=="string"?a.length:this.options.forceString?JSON.stringify(a).length:Array.isArray(a)?this.options.arrayValueSize*a.length:typeof a=="number"?8:typeof a?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(a)?a.length:a!=null&&typeof a=="object"?this.options.objectValueSize*Object.keys(a).length:typeof a=="boolean"?8:0}_error(a,u={}){var c;return i(this,s),c=new Error,c.name=a,c.errorcode=a,c.message=this.ERRORS[a]!=null?this.ERRORS[a](u):"-",c.data=u,c}_initErrors(){var a,u,c;i(this,s),this.ERRORS={},c=this._ERRORS;for(u in c)a=c[u],this.ERRORS[u]=this.createErrorMessage(a)}createErrorMessage(a){return function(u){return a.replace("__key",u.type)}}}return s.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},s}.call(this)}).call(Or)});var Tr=g((Er,kr)=>{(function(){var e;e=kr.exports=Ar(),e.version="5.1.2"}).call(Er)});var Rt=g(Q=>{"use strict";var Bo=Q&&Q.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})},Fo=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Q,"__esModule",{value:!0});Q.callOpenApiCached=Q.callOpenApiCachedRaw=void 0;var Vo=at(),Ko=st(),Uo=ke(),No=Fo(Tr()),je;function Sr({cacheKey:e,overrideAuth:t}){let r=t?.id_token||(0,Ko.getCookieString)({name:"id_token",defaultValue:""}),n;if(e){let i=r?(0,Uo.toBase64)(r):"";n=e+"||"+i}return n}var Jo=e=>{var t,r,n;let i=Sr(e);if(!i)return;je||(je=new No.default({stdTTL:e.cacheTtl||120}));let o=(n=(r=(t=e.ssrCacheItems)===null||t===void 0?void 0:t.find(l=>l.cacheKey===e.cacheKey))===null||r===void 0?void 0:r.prefillData)===null||n===void 0?void 0:n.data;!je.get(i)&&o&&je.set(i,o);let s=je.get(i)||o;if(!!s)return{data:s}};Q.callOpenApiCachedRaw=Jo;var $o=e=>Bo(void 0,void 0,void 0,function*(){let t=(0,Q.callOpenApiCachedRaw)(e);if(t)return t;let r=yield(0,Vo.callOpenApi)(e);if(r.error)return{error:r.error,data:void 0};let n=Sr(e);return je&&n&&je.set(n,r.data),r});Q.callOpenApiCached=$o});var Pr=g(qe=>{"use strict";var ut=qe&&qe.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(qe,"__esModule",{value:!0});qe.useCallOpenApi=void 0;var zo=Rt(),Ho=at(),Cr=require("react"),Go=e=>{var t;let r={data:void 0,url:"",datetime:0,loadcount:0,loading:!1,loaded:!1,reFetch:()=>ut(void 0,void 0,void 0,function*(){}),setData:()=>{}},n=(t=(0,zo.callOpenApiCachedRaw)(Object.assign(Object.assign({},e),{onlyCached:!0})))===null||t===void 0?void 0:t.data,[i,o]=(0,Cr.useState)(Object.assign(Object.assign(Object.assign({},r),n&&{data:n}),{loaded:!!n}));return(0,Cr.useEffect)(()=>{function s(){return ut(this,void 0,void 0,function*(){let h=yield(0,Ho.callOpenApi)(e);o(f=>Object.assign(Object.assign({},h),{loaded:!0,loading:!1,loadcount:f.loadcount+1,reFetch:()=>ut(this,void 0,void 0,function*(){}),url:"",datetime:new Date().getTime(),setData:()=>{}}))})}let{error:l,loaded:a,loading:u,loadcount:c}=i;e.disabled||a||u||l&&c>2||(o(h=>Object.assign(Object.assign({},h),{loading:!0})),s())},[i,e,o]),Object.assign(Object.assign({},i),{reFetch:()=>ut(void 0,void 0,void 0,function*(){o(r)}),setData:s=>{o(Object.assign(Object.assign({},i),{data:s(i.data),datetime:new Date().getTime()}))}})};qe.useCallOpenApi=Go});var qr=g(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0})});var dt=g(ie=>{"use strict";var Wo=ie&&ie.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lt=ie&&ie.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Wo(t,e,r)};Object.defineProperty(ie,"__esModule",{value:!0});lt(at(),ie);lt(Rt(),ie);lt(Pr(),ie);lt(qr(),ie)});var Ir=g(H=>{var Yo=H&&H.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H,"__esModule",{value:!0});H.RequiredError=H.BaseAPI=H.COLLECTION_FORMATS=H.BASE_PATH=void 0;var Qo=Yo(require("axios"));H.BASE_PATH="https://api.analytica.click".replace(/\/+$/,"");H.COLLECTION_FORMATS={csv:",",ssv:" ",tsv:" ",pipes:"|"};var Dr=class{constructor(t,r=H.BASE_PATH,n=Qo.default){this.basePath=r,this.axios=n,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}};H.BaseAPI=Dr;var Rr=class extends Error{constructor(t,r){super(r);this.field=t,this.name="RequiredError"}};H.RequiredError=Rr});var ft=g(p=>{var Zo=p&&p.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Xo=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),es=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Zo(t,e,r);return Xo(t,e),t},x=p&&p.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})},ts=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(p,"__esModule",{value:!0});p.DefaultApi=p.DefaultApiFactory=p.DefaultApiFp=p.DefaultApiAxiosParamCreator=p.Sentiment=void 0;var P=es(require("url")),Z=ts(require("axios")),E=Ir(),rs;(function(e){e.Good="good",e.Bad="bad",e.Neutral="neutral"})(rs=p.Sentiment||(p.Sentiment={}));var ns=function(e){return{accountGet:(t={})=>x(this,void 0,void 0,function*(){let r="/account",n=P.parse(r,!0),i;e&&(i=e.baseOptions);let o=Object.assign(Object.assign({method:"GET"},i),t),s={},l={};if(e&&e.apiKey){let u=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=u}n.query=Object.assign(Object.assign(Object.assign({},n.query),l),t.query),delete n.search;let a=i&&i.headers?i.headers:{};return o.headers=Object.assign(Object.assign(Object.assign({},s),a),t.headers),{url:P.format(n),options:o}}),archiveError:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("id","Required parameter id was null or undefined when calling archiveError.");let n="/errors/{id}".replace("{id}",encodeURIComponent(String(t))),i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"DELETE"},o),r),l={},a={};if(e&&e.apiKey){let c=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=c}i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};return s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers),{url:P.format(i),options:s}}),archiveErrors:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("archiveErrors","Required parameter archiveErrors was null or undefined when calling archiveErrors.");let n="/errors",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"DELETE"},o),r),l={},a={};if(e&&e.apiKey){let d=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=d}l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),bingIntegrationPost:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("bingIntegration","Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");let n="/account/integrations/bing",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"POST"},o),r),l={},a={};if(e&&e.apiKey){let d=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=d}l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),getTrackingAllSites:(t,r,n={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingAllSites.");if(r==null)throw new E.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingAllSites.");let i="/site/tracking",o=P.parse(i,!0),s;e&&(s=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},s),n),a={},u={};if(e&&e.apiKey){let d=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;a.authorization=d}t!==void 0&&(u.minDate=t),r!==void 0&&(u.maxDate=r),o.query=Object.assign(Object.assign(Object.assign({},o.query),u),n.query),delete o.search;let c=s&&s.headers?s.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},a),c),n.headers),{url:P.format(o),options:l}}),getTrackingSite:(t,r,n,i={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("id","Required parameter id was null or undefined when calling getTrackingSite.");if(r==null)throw new E.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingSite.");if(n==null)throw new E.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingSite.");let o="/site/tracking/{id}".replace("{id}",encodeURIComponent(String(t))),s=P.parse(o,!0),l;e&&(l=e.baseOptions);let a=Object.assign(Object.assign({method:"GET"},l),i),u={},c={};if(e&&e.apiKey){let h=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;u.authorization=h}r!==void 0&&(c.minDate=r),n!==void 0&&(c.maxDate=n),s.query=Object.assign(Object.assign(Object.assign({},s.query),c),i.query),delete s.search;let d=l&&l.headers?l.headers:{};return a.headers=Object.assign(Object.assign(Object.assign({},u),d),i.headers),{url:P.format(s),options:a}}),googleIntegrationPost:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("googleIntegration","Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");let n="/account/integrations/google",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"POST"},o),r),l={},a={};if(e&&e.apiKey){let d=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=d}l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),postError:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("postError","Required parameter postError was null or undefined when calling postError.");let n="/errors",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"POST"},o),r),l={},a={};l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),postPageTrack:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("postSiteTrack","Required parameter postSiteTrack was null or undefined when calling postPageTrack.");let n="/site",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"POST"},o),r),l={},a={};l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),putFeedback:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("feedbackPutData","Required parameter feedbackPutData was null or undefined when calling putFeedback.");let n="/feedback",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"PUT"},o),r),l={},a={};l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}}),sitePost:(t,r={})=>x(this,void 0,void 0,function*(){if(t==null)throw new E.RequiredError("postAccount","Required parameter postAccount was null or undefined when calling sitePost.");let n="/account/site",i=P.parse(n,!0),o;e&&(o=e.baseOptions);let s=Object.assign(Object.assign({method:"POST"},o),r),l={},a={};if(e&&e.apiKey){let d=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=d}l["Content-Type"]="application/json",i.query=Object.assign(Object.assign(Object.assign({},i.query),a),r.query),delete i.search;let u=o&&o.headers?o.headers:{};s.headers=Object.assign(Object.assign(Object.assign({},l),u),r.headers);let c=typeof t!="string"||s.headers["Content-Type"]==="application/json";return s.data=c?JSON.stringify(t!==void 0?t:{}):t||"",{url:P.format(i),options:s}})}};p.DefaultApiAxiosParamCreator=ns;var is=function(e){return{accountGet(t){return x(this,void 0,void 0,function*(){let r=yield(0,p.DefaultApiAxiosParamCreator)(e).accountGet(t);return(n=Z.default,i=E.BASE_PATH)=>{let o=Object.assign(Object.assign({},r.options),{url:i+r.url});return n.request(o)}})},archiveError(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).archiveError(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},archiveErrors(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).archiveErrors(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},bingIntegrationPost(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).bingIntegrationPost(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},getTrackingAllSites(t,r,n){return x(this,void 0,void 0,function*(){let i=yield(0,p.DefaultApiAxiosParamCreator)(e).getTrackingAllSites(t,r,n);return(o=Z.default,s=E.BASE_PATH)=>{let l=Object.assign(Object.assign({},i.options),{url:s+i.url});return o.request(l)}})},getTrackingSite(t,r,n,i){return x(this,void 0,void 0,function*(){let o=yield(0,p.DefaultApiAxiosParamCreator)(e).getTrackingSite(t,r,n,i);return(s=Z.default,l=E.BASE_PATH)=>{let a=Object.assign(Object.assign({},o.options),{url:l+o.url});return s.request(a)}})},googleIntegrationPost(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).googleIntegrationPost(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},postError(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).postError(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},postPageTrack(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).postPageTrack(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},putFeedback(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).putFeedback(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})},sitePost(t,r){return x(this,void 0,void 0,function*(){let n=yield(0,p.DefaultApiAxiosParamCreator)(e).sitePost(t,r);return(i=Z.default,o=E.BASE_PATH)=>{let s=Object.assign(Object.assign({},n.options),{url:o+n.url});return i.request(s)}})}}};p.DefaultApiFp=is;var os=function(e,t,r){return{accountGet(n){return(0,p.DefaultApiFp)(e).accountGet(n).then(i=>i(r,t))},archiveError(n,i){return(0,p.DefaultApiFp)(e).archiveError(n,i).then(o=>o(r,t))},archiveErrors(n,i){return(0,p.DefaultApiFp)(e).archiveErrors(n,i).then(o=>o(r,t))},bingIntegrationPost(n,i){return(0,p.DefaultApiFp)(e).bingIntegrationPost(n,i).then(o=>o(r,t))},getTrackingAllSites(n,i,o){return(0,p.DefaultApiFp)(e).getTrackingAllSites(n,i,o).then(s=>s(r,t))},getTrackingSite(n,i,o,s){return(0,p.DefaultApiFp)(e).getTrackingSite(n,i,o,s).then(l=>l(r,t))},googleIntegrationPost(n,i){return(0,p.DefaultApiFp)(e).googleIntegrationPost(n,i).then(o=>o(r,t))},postError(n,i){return(0,p.DefaultApiFp)(e).postError(n,i).then(o=>o(r,t))},postPageTrack(n,i){return(0,p.DefaultApiFp)(e).postPageTrack(n,i).then(o=>o(r,t))},putFeedback(n,i){return(0,p.DefaultApiFp)(e).putFeedback(n,i).then(o=>o(r,t))},sitePost(n,i){return(0,p.DefaultApiFp)(e).sitePost(n,i).then(o=>o(r,t))}}};p.DefaultApiFactory=os;var Mr=class extends E.BaseAPI{accountGet(t){return(0,p.DefaultApiFp)(this.configuration).accountGet(t).then(r=>r(this.axios,this.basePath))}archiveError(t,r){return(0,p.DefaultApiFp)(this.configuration).archiveError(t,r).then(n=>n(this.axios,this.basePath))}archiveErrors(t,r){return(0,p.DefaultApiFp)(this.configuration).archiveErrors(t,r).then(n=>n(this.axios,this.basePath))}bingIntegrationPost(t,r){return(0,p.DefaultApiFp)(this.configuration).bingIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}getTrackingAllSites(t,r,n){return(0,p.DefaultApiFp)(this.configuration).getTrackingAllSites(t,r,n).then(i=>i(this.axios,this.basePath))}getTrackingSite(t,r,n,i){return(0,p.DefaultApiFp)(this.configuration).getTrackingSite(t,r,n,i).then(o=>o(this.axios,this.basePath))}googleIntegrationPost(t,r){return(0,p.DefaultApiFp)(this.configuration).googleIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}postError(t,r){return(0,p.DefaultApiFp)(this.configuration).postError(t,r).then(n=>n(this.axios,this.basePath))}postPageTrack(t,r){return(0,p.DefaultApiFp)(this.configuration).postPageTrack(t,r).then(n=>n(this.axios,this.basePath))}putFeedback(t,r){return(0,p.DefaultApiFp)(this.configuration).putFeedback(t,r).then(n=>n(this.axios,this.basePath))}sitePost(t,r){return(0,p.DefaultApiFp)(this.configuration).sitePost(t,r).then(n=>n(this.axios,this.basePath))}};p.DefaultApi=Mr});var Wr=g(Re=>{"use strict";var Gr=Re&&Re.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Re,"__esModule",{value:!0});Re.Close=void 0;var ps=Gr(require("styled-components")),gs=Gr(require("react")),ms=ps.default.div`
2878
7
  position: absolute;
8
+ z-index: 1;
2879
9
  width: 32px;
2880
10
  height: 32px;
2881
11
  opacity: 0.3;
@@ -2901,90 +31,7 @@ var require_Close = __commonJS({
2901
31
  &:after {
2902
32
  transform: rotate(-45deg);
2903
33
  }
2904
- `;
2905
- var Close = ({ className, onClick }) => react_1.default.createElement(SClose, { className, onClick: (e) => onClick === null || onClick === void 0 ? void 0 : onClick(e) });
2906
- exports.Close = Close;
2907
- }
2908
- });
2909
-
2910
- // ../../node_modules/ag-common/dist/ui/helpers/useOnClickOutside.js
2911
- var require_useOnClickOutside = __commonJS({
2912
- "../../node_modules/ag-common/dist/ui/helpers/useOnClickOutside.js"(exports) {
2913
- "use strict";
2914
- Object.defineProperty(exports, "__esModule", { value: true });
2915
- exports.useOnClickOutside = void 0;
2916
- var react_1 = require("react");
2917
- function useOnClickOutside({ ref, moveMouseOutside }, handler) {
2918
- (0, react_1.useEffect)(() => {
2919
- const listener = (event) => {
2920
- const el = ref === null || ref === void 0 ? void 0 : ref.current;
2921
- if (!el || el.contains((event === null || event === void 0 ? void 0 : event.target) || null)) {
2922
- return;
2923
- }
2924
- handler(event);
2925
- };
2926
- document.addEventListener(`mousedown`, listener);
2927
- document.addEventListener(`touchstart`, listener);
2928
- if (moveMouseOutside) {
2929
- document.addEventListener(`mousemove`, listener);
2930
- }
2931
- return () => {
2932
- document.removeEventListener(`mousedown`, listener);
2933
- document.removeEventListener(`touchstart`, listener);
2934
- document.removeEventListener(`mousemove`, listener);
2935
- };
2936
- }, [ref, handler, moveMouseOutside]);
2937
- }
2938
- exports.useOnClickOutside = useOnClickOutside;
2939
- }
2940
- });
2941
-
2942
- // ../../node_modules/ag-common/dist/ui/components/Modal/index.js
2943
- var require_Modal = __commonJS({
2944
- "../../node_modules/ag-common/dist/ui/components/Modal/index.js"(exports) {
2945
- "use strict";
2946
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2947
- if (k2 === void 0)
2948
- k2 = k;
2949
- var desc = Object.getOwnPropertyDescriptor(m, k);
2950
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2951
- desc = { enumerable: true, get: function() {
2952
- return m[k];
2953
- } };
2954
- }
2955
- Object.defineProperty(o, k2, desc);
2956
- } : function(o, m, k, k2) {
2957
- if (k2 === void 0)
2958
- k2 = k;
2959
- o[k2] = m[k];
2960
- });
2961
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
2962
- Object.defineProperty(o, "default", { enumerable: true, value: v });
2963
- } : function(o, v) {
2964
- o["default"] = v;
2965
- });
2966
- var __importStar = exports && exports.__importStar || function(mod) {
2967
- if (mod && mod.__esModule)
2968
- return mod;
2969
- var result = {};
2970
- if (mod != null) {
2971
- for (var k in mod)
2972
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
2973
- __createBinding(result, mod, k);
2974
- }
2975
- __setModuleDefault(result, mod);
2976
- return result;
2977
- };
2978
- var __importDefault = exports && exports.__importDefault || function(mod) {
2979
- return mod && mod.__esModule ? mod : { "default": mod };
2980
- };
2981
- Object.defineProperty(exports, "__esModule", { value: true });
2982
- exports.ModalDropList = exports.Modal = exports.ModalItem = void 0;
2983
- var Close_1 = require_Close();
2984
- var useOnClickOutside_1 = require_useOnClickOutside();
2985
- var react_1 = __importStar(require("react"));
2986
- var styled_components_1 = __importDefault(require("styled-components"));
2987
- var FixedBackground = styled_components_1.default.div`
34
+ `,ys=({className:e,onClick:t})=>gs.default.createElement(ms,{className:e,onClick:r=>t?.(r)});Re.Close=ys});var Yr=g(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.useOnClickOutside=void 0;var bs=require("react");function vs({ref:e,moveMouseOutside:t},r){(0,bs.useEffect)(()=>{let n=i=>{let o=e?.current;!o||o.contains(i?.target||null)||r(i)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),t&&document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),document.removeEventListener("mousemove",n)}},[e,r,t])}mt.useOnClickOutside=vs});var Qr=g(B=>{"use strict";var _s=B&&B.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ws=B&&B.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Os=B&&B.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_s(t,e,r);return ws(t,e),t},js=B&&B.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(B,"__esModule",{value:!0});B.ModalDropList=B.Modal=B.ModalItem=void 0;var As=Wr(),Es=Yr(),ye=Os(require("react")),Je=js(require("styled-components")),ks=Je.default.div`
2988
35
  position: fixed;
2989
36
  top: 0;
2990
37
  left: 0;
@@ -2995,8 +42,7 @@ var require_Modal = __commonJS({
2995
42
  display: flex;
2996
43
  justify-content: center;
2997
44
  align-items: center;
2998
- `;
2999
- var ModalBase = styled_components_1.default.div`
45
+ `,Ts=Je.default.div`
3000
46
  display: flex;
3001
47
  position: absolute;
3002
48
  z-index: 1;
@@ -3018,1347 +64,17 @@ var require_Modal = __commonJS({
3018
64
  &[data-topposition='top'] {
3019
65
  bottom: 0;
3020
66
  }
3021
- `;
3022
- exports.ModalItem = styled_components_1.default.div`
67
+ `;B.ModalItem=Je.default.div`
3023
68
  display: flex;
3024
69
  padding: 1rem;
3025
70
 
3026
71
  &:hover {
3027
72
  background-color: #eee;
3028
73
  }
3029
- `;
3030
- var CloseStyled = (0, styled_components_1.default)(Close_1.Close)`
74
+ `;var Ss=(0,Je.default)(As.Close)`
3031
75
  z-index: 1;
3032
- `;
3033
- var Modal = ({ open, setOpen, children, position = "left", topPosition = "bottom", showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true }) => {
3034
- const ref = (0, react_1.useRef)(null);
3035
- (0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: closeOnMoveMouseOutside }, () => {
3036
- if (closeOnClickOutside && open) {
3037
- setOpen(false);
3038
- }
3039
- });
3040
- if (!open) {
3041
- return react_1.default.createElement(react_1.default.Fragment, null);
3042
- }
3043
- return react_1.default.createElement(FixedBackground, null, react_1.default.createElement(ModalBase, { "data-position": position, "data-topposition": topPosition, ref, className }, showCloseButton && react_1.default.createElement(CloseStyled, { onClick: () => setOpen(false) }), children));
3044
- };
3045
- exports.Modal = Modal;
3046
- var ModalDropListStyled = (0, styled_components_1.default)(exports.Modal)`
76
+ `,Cs=({open:e,setOpen:t,children:r,position:n="left",topPosition:i="bottom",showCloseButton:o=!0,closeOnMoveMouseOutside:s=!1,className:l,closeOnClickOutside:a=!0})=>{let u=(0,ye.useRef)(null);return(0,Es.useOnClickOutside)({ref:u,moveMouseOutside:s},()=>{a&&e&&t(!1)}),e?ye.default.createElement(ks,null,ye.default.createElement(Ts,{"data-position":n,"data-topposition":i,ref:u,className:l},o&&ye.default.createElement(Ss,{onClick:()=>t(!1)}),r)):ye.default.createElement(ye.default.Fragment,null)};B.Modal=Cs;var Ps=(0,Je.default)(B.Modal)`
3047
77
  flex-flow: column;
3048
- `;
3049
- var ModalDropList = (p) => react_1.default.createElement(ModalDropListStyled, Object.assign({}, p, { className: p.className }), p.options.map((option, index) => react_1.default.createElement(exports.ModalItem, { key: option, onClick: (e) => {
3050
- var _a;
3051
- e.stopPropagation();
3052
- e.preventDefault();
3053
- (_a = p.onSelect) === null || _a === void 0 ? void 0 : _a.call(p, index, e);
3054
- p.setOpen(false);
3055
- } }, option)));
3056
- exports.ModalDropList = ModalDropList;
3057
- }
3058
- });
3059
-
3060
- // ../common-ui/dist/components/ErrorBoundary/index.js
3061
- var require_ErrorBoundary = __commonJS({
3062
- "../common-ui/dist/components/ErrorBoundary/index.js"(exports) {
3063
- var __importDefault = exports && exports.__importDefault || function(mod) {
3064
- return mod && mod.__esModule ? mod : { "default": mod };
3065
- };
3066
- Object.defineProperty(exports, "__esModule", { value: true });
3067
- exports.ErrorBoundary = void 0;
3068
- var Modal_1 = require_Modal();
3069
- var react_1 = __importDefault(require("react"));
3070
- var styled_components_1 = __importDefault(require("styled-components"));
3071
- var Base = styled_components_1.default.div`
78
+ `,xs=e=>ye.default.createElement(Ps,Object.assign({},e,{className:e.className}),e.options.map((t,r)=>ye.default.createElement(B.ModalItem,{key:t,onClick:n=>{var i;n.stopPropagation(),n.preventDefault(),(i=e.onSelect)===null||i===void 0||i.call(e,r,n),e.setOpen(!1)}},t)));B.ModalDropList=xs});var en=g(Ie=>{var Zr=Ie&&Ie.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.ErrorBoundary=void 0;var qs=Qr(),yt=Zr(require("react")),Ds=Zr(require("styled-components")),Rs=Ds.default.div`
3072
79
  font-size: 2rem;
3073
- `;
3074
- var ErrorBoundary2 = class extends react_1.default.Component {
3075
- constructor(props) {
3076
- super(props);
3077
- this.state = { hasError: void 0 };
3078
- }
3079
- static getDerivedStateFromError(errorV) {
3080
- var _a;
3081
- const href = typeof window !== "undefined" && ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href);
3082
- return {
3083
- hasError: Object.assign(Object.assign(Object.assign(Object.assign({}, errorV), { message: (errorV === null || errorV === void 0 ? void 0 : errorV.message) || errorV }), (errorV === null || errorV === void 0 ? void 0 : errorV.stack) && { stack: errorV === null || errorV === void 0 ? void 0 : errorV.stack }), href && { href })
3084
- };
3085
- }
3086
- render() {
3087
- const { hasError } = this.state;
3088
- const { children, notify } = this.props;
3089
- if (hasError) {
3090
- if (notify) {
3091
- notify(hasError);
3092
- }
3093
- return react_1.default.createElement(Modal_1.Modal, { open: true, setOpen: () => {
3094
- } }, react_1.default.createElement(Base, null, "A fatal error has occurred - the admin has been notified.", react_1.default.createElement("button", { type: "button", onClick: () => window.location.reload() }, "Press here to restart app")));
3095
- }
3096
- return children;
3097
- }
3098
- };
3099
- exports.ErrorBoundary = ErrorBoundary2;
3100
- }
3101
- });
3102
-
3103
- // ../../node_modules/@paciolan/remote-component/dist/createRequires.js
3104
- var require_createRequires = __commonJS({
3105
- "../../node_modules/@paciolan/remote-component/dist/createRequires.js"(exports) {
3106
- "use strict";
3107
- exports.__esModule = true;
3108
- exports.createRequires = void 0;
3109
- var sanitizeDependencies = function(dependencies) {
3110
- return typeof dependencies === "function" ? dependencies() : dependencies || {};
3111
- };
3112
- var createRequires2 = function(dependencies) {
3113
- var isSanitized = false;
3114
- return function(name) {
3115
- if (!isSanitized) {
3116
- dependencies = sanitizeDependencies(dependencies);
3117
- isSanitized = true;
3118
- }
3119
- if (!(name in dependencies)) {
3120
- throw new Error("Could not require '" + name + "'. '" + name + "' does not exist in dependencies.");
3121
- }
3122
- return dependencies[name];
3123
- };
3124
- };
3125
- exports.createRequires = createRequires2;
3126
- }
3127
- });
3128
-
3129
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/memoize.js
3130
- var require_memoize = __commonJS({
3131
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/memoize.js"(exports) {
3132
- "use strict";
3133
- exports.__esModule = true;
3134
- var memoize = function(func) {
3135
- var cache2 = {};
3136
- return function(key) {
3137
- if (key in cache2 == false) {
3138
- cache2[key] = func(key);
3139
- }
3140
- return cache2[key];
3141
- };
3142
- };
3143
- exports["default"] = memoize;
3144
- }
3145
- });
3146
-
3147
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/status.js
3148
- var require_status = __commonJS({
3149
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/status.js"(exports) {
3150
- "use strict";
3151
- exports.__esModule = true;
3152
- exports.InternalServerError = exports.OK = void 0;
3153
- exports.OK = 200;
3154
- exports.InternalServerError = 500;
3155
- }
3156
- });
3157
-
3158
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/nodeFetcher.js
3159
- var require_nodeFetcher = __commonJS({
3160
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/nodeFetcher.js"(exports) {
3161
- "use strict";
3162
- var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
3163
- if (pack || arguments.length === 2)
3164
- for (var i = 0, l = from.length, ar; i < l; i++) {
3165
- if (ar || !(i in from)) {
3166
- if (!ar)
3167
- ar = Array.prototype.slice.call(from, 0, i);
3168
- ar[i] = from[i];
3169
- }
3170
- }
3171
- return to.concat(ar || Array.prototype.slice.call(from));
3172
- };
3173
- exports.__esModule = true;
3174
- var http = require("http");
3175
- var https = require("https");
3176
- var status_1 = require_status();
3177
- var get = function(url) {
3178
- var args = [];
3179
- for (var _i = 1; _i < arguments.length; _i++) {
3180
- args[_i - 1] = arguments[_i];
3181
- }
3182
- if (typeof url !== "string") {
3183
- return {
3184
- on: function(eventName, callback) {
3185
- callback(new Error("URL must be a string."));
3186
- }
3187
- };
3188
- }
3189
- return url.indexOf("https://") === 0 ? https.get.apply(https, __spreadArray([url], args, false)) : http.get.apply(http, __spreadArray([url], args, false));
3190
- };
3191
- var nodeFetcher = function(url) {
3192
- return new Promise(function(resolve, reject) {
3193
- get(url, function(res) {
3194
- if (res.statusCode !== status_1.OK) {
3195
- return reject(new Error("HTTP Error Response: " + res.statusCode + " " + res.statusMessage + " (" + url + ")"));
3196
- }
3197
- var data = null;
3198
- res.on("data", function(chunk) {
3199
- if (data === null) {
3200
- data = chunk;
3201
- return;
3202
- }
3203
- data += chunk;
3204
- });
3205
- res.on("end", function() {
3206
- return resolve(data);
3207
- });
3208
- }).on("error", reject);
3209
- });
3210
- };
3211
- exports["default"] = nodeFetcher;
3212
- }
3213
- });
3214
-
3215
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/xmlHttpRequestFetcher/readyState.js
3216
- var require_readyState = __commonJS({
3217
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/xmlHttpRequestFetcher/readyState.js"(exports) {
3218
- "use strict";
3219
- exports.__esModule = true;
3220
- exports.DONE = exports.OPENED = exports.UNSENT = void 0;
3221
- exports.UNSENT = 0;
3222
- exports.OPENED = 1;
3223
- exports.DONE = 4;
3224
- }
3225
- });
3226
-
3227
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/xmlHttpRequestFetcher/index.js
3228
- var require_xmlHttpRequestFetcher = __commonJS({
3229
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/xmlHttpRequestFetcher/index.js"(exports) {
3230
- "use strict";
3231
- exports.__esModule = true;
3232
- var status_1 = require_status();
3233
- var readyState_1 = require_readyState();
3234
- var xmlHttpRequestFetcher = function(url) {
3235
- return new Promise(function(resolve, reject) {
3236
- var xhr = new XMLHttpRequest();
3237
- xhr.onreadystatechange = function() {
3238
- if (xhr.readyState !== readyState_1.DONE)
3239
- return;
3240
- xhr.status === status_1.OK ? resolve(xhr.responseText) : reject(new Error("HTTP Error Response: " + xhr.status + " " + xhr.statusText + " (" + url + ")"));
3241
- };
3242
- xhr.open("GET", url, true);
3243
- xhr.send();
3244
- });
3245
- };
3246
- exports["default"] = xmlHttpRequestFetcher;
3247
- }
3248
- });
3249
-
3250
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/loadRemoteModule.js
3251
- var require_loadRemoteModule = __commonJS({
3252
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/loadRemoteModule.js"(exports) {
3253
- "use strict";
3254
- exports.__esModule = true;
3255
- exports.createLoadRemoteModule = void 0;
3256
- var memoize_1 = require_memoize();
3257
- var nodeFetcher_1 = require_nodeFetcher();
3258
- var index_1 = require_xmlHttpRequestFetcher();
3259
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
3260
- var defaultFetcher = isBrowser ? index_1["default"] : nodeFetcher_1["default"];
3261
- var defaultRequires = function(name) {
3262
- throw new Error("Could not require '" + name + "'. The 'requires' function was not provided.");
3263
- };
3264
- var createLoadRemoteModule = function(_a) {
3265
- var _b = _a === void 0 ? {} : _a, requires = _b.requires, fetcher = _b.fetcher;
3266
- var _requires = requires || defaultRequires;
3267
- var _fetcher = fetcher || defaultFetcher;
3268
- return (0, memoize_1["default"])(function(url) {
3269
- return _fetcher(url).then(function(data) {
3270
- var exports2 = {};
3271
- var module3 = { exports: exports2 };
3272
- var func = new Function("require", "module", "exports", data);
3273
- func(_requires, module3, exports2);
3274
- return module3.exports;
3275
- });
3276
- });
3277
- };
3278
- exports.createLoadRemoteModule = createLoadRemoteModule;
3279
- }
3280
- });
3281
-
3282
- // ../../node_modules/@paciolan/remote-module-loader/dist/lib/createRequires.js
3283
- var require_createRequires2 = __commonJS({
3284
- "../../node_modules/@paciolan/remote-module-loader/dist/lib/createRequires.js"(exports) {
3285
- "use strict";
3286
- exports.__esModule = true;
3287
- exports.createRequires = void 0;
3288
- var createRequires2 = function(dependencies) {
3289
- return function(name) {
3290
- var _dependencies = dependencies || {};
3291
- if (!(name in _dependencies)) {
3292
- throw new Error("Could not require '" + name + "'. '" + name + "' does not exist in dependencies.");
3293
- }
3294
- return _dependencies[name];
3295
- };
3296
- };
3297
- exports.createRequires = createRequires2;
3298
- }
3299
- });
3300
-
3301
- // ../../node_modules/@paciolan/remote-module-loader/dist/index.js
3302
- var require_dist = __commonJS({
3303
- "../../node_modules/@paciolan/remote-module-loader/dist/index.js"(exports) {
3304
- "use strict";
3305
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
3306
- if (k2 === void 0)
3307
- k2 = k;
3308
- Object.defineProperty(o, k2, { enumerable: true, get: function() {
3309
- return m[k];
3310
- } });
3311
- } : function(o, m, k, k2) {
3312
- if (k2 === void 0)
3313
- k2 = k;
3314
- o[k2] = m[k];
3315
- });
3316
- exports.__esModule = true;
3317
- exports.createRequires = exports["default"] = void 0;
3318
- var loadRemoteModule_1 = require_loadRemoteModule();
3319
- __createBinding(exports, loadRemoteModule_1, "createLoadRemoteModule", "default");
3320
- var createRequires_1 = require_createRequires2();
3321
- __createBinding(exports, createRequires_1, "createRequires");
3322
- }
3323
- });
3324
-
3325
- // ../../node_modules/@paciolan/remote-component/dist/hooks/useRemoteComponent.js
3326
- var require_useRemoteComponent = __commonJS({
3327
- "../../node_modules/@paciolan/remote-component/dist/hooks/useRemoteComponent.js"(exports) {
3328
- "use strict";
3329
- var __importDefault = exports && exports.__importDefault || function(mod) {
3330
- return mod && mod.__esModule ? mod : { "default": mod };
3331
- };
3332
- exports.__esModule = true;
3333
- exports.createUseRemoteComponent = void 0;
3334
- var react_1 = require("react");
3335
- var remote_module_loader_1 = __importDefault(require_dist());
3336
- var createUseRemoteComponent2 = function(args) {
3337
- var loadRemoteModule = remote_module_loader_1["default"](args);
3338
- var useRemoteComponent = function(url) {
3339
- var _a = react_1.useState({
3340
- loading: true,
3341
- err: void 0,
3342
- component: void 0
3343
- }), _b = _a[0], loading = _b.loading, err = _b.err, component = _b.component, setState = _a[1];
3344
- react_1.useEffect(function() {
3345
- var update = setState;
3346
- update({ loading: true, err: void 0, component: void 0 });
3347
- loadRemoteModule(url).then(function(module3) {
3348
- return update({ loading: false, err: void 0, component: module3["default"] });
3349
- })["catch"](function(err2) {
3350
- return update({ loading: false, err: err2, component: void 0 });
3351
- });
3352
- return function() {
3353
- update = function() {
3354
- };
3355
- };
3356
- }, [url]);
3357
- return [loading, err, component];
3358
- };
3359
- return useRemoteComponent;
3360
- };
3361
- exports.createUseRemoteComponent = createUseRemoteComponent2;
3362
- }
3363
- });
3364
-
3365
- // ../../node_modules/ag-common/dist/ui/helpers/axiosHelper.js
3366
- var require_axiosHelper = __commonJS({
3367
- "../../node_modules/ag-common/dist/ui/helpers/axiosHelper.js"(exports) {
3368
- "use strict";
3369
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
3370
- function adopt(value) {
3371
- return value instanceof P ? value : new P(function(resolve) {
3372
- resolve(value);
3373
- });
3374
- }
3375
- return new (P || (P = Promise))(function(resolve, reject) {
3376
- function fulfilled(value) {
3377
- try {
3378
- step(generator.next(value));
3379
- } catch (e) {
3380
- reject(e);
3381
- }
3382
- }
3383
- function rejected(value) {
3384
- try {
3385
- step(generator["throw"](value));
3386
- } catch (e) {
3387
- reject(e);
3388
- }
3389
- }
3390
- function step(result) {
3391
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
3392
- }
3393
- step((generator = generator.apply(thisArg, _arguments || [])).next());
3394
- });
3395
- };
3396
- var __importDefault = exports && exports.__importDefault || function(mod) {
3397
- return mod && mod.__esModule ? mod : { "default": mod };
3398
- };
3399
- Object.defineProperty(exports, "__esModule", { value: true });
3400
- exports.axiosHelper = void 0;
3401
- var log_1 = require_log();
3402
- var object_1 = require_object();
3403
- var axios_1 = __importDefault(require("axios"));
3404
- var axiosHelper3 = ({ verb, url, body, headers, timeout = 3e4, retryMax = 0, onStaleAuth }) => __awaiter(void 0, void 0, void 0, function* () {
3405
- let retry = 0;
3406
- do {
3407
- try {
3408
- const setHeaders = Object.assign({ Accept: "application/json" }, headers);
3409
- if (verb === "get") {
3410
- const ret2 = yield axios_1.default.get(url, {
3411
- headers: setHeaders,
3412
- timeout,
3413
- timeoutErrorMessage: `${url} timeout`
3414
- });
3415
- return ret2;
3416
- }
3417
- let noBody = false;
3418
- let axios = axios_1.default.post;
3419
- if (verb === "put") {
3420
- axios = axios_1.default.put;
3421
- } else if (verb === "post") {
3422
- axios = axios_1.default.post;
3423
- } else if (verb === "patch") {
3424
- axios = axios_1.default.patch;
3425
- } else if (verb === "delete") {
3426
- axios = axios_1.default.delete;
3427
- noBody = true;
3428
- }
3429
- let ret;
3430
- if (noBody) {
3431
- ret = yield axios(url, {
3432
- headers: setHeaders,
3433
- timeout,
3434
- timeoutErrorMessage: `${url} timeout`
3435
- });
3436
- } else {
3437
- if (body && (0, object_1.isJson)(body)) {
3438
- setHeaders["Content-Type"] = setHeaders["Content-Type"] || "application/json";
3439
- }
3440
- ret = yield axios(url, body, { headers: setHeaders });
3441
- }
3442
- return ret;
3443
- } catch (e) {
3444
- const em = e;
3445
- if (em.code === "401" || em.code === "403") {
3446
- (0, log_1.debug)("auth expired");
3447
- onStaleAuth === null || onStaleAuth === void 0 ? void 0 : onStaleAuth();
3448
- retry = retryMax;
3449
- }
3450
- if (retry >= retryMax) {
3451
- throw em;
3452
- }
3453
- }
3454
- retry += 1;
3455
- } while (retry <= retryMax);
3456
- throw new Error("unexpected");
3457
- });
3458
- exports.axiosHelper = axiosHelper3;
3459
- }
3460
- });
3461
-
3462
- // ../common-ui/dist/helpers/dom.js
3463
- var require_dom = __commonJS({
3464
- "../common-ui/dist/helpers/dom.js"(exports) {
3465
- Object.defineProperty(exports, "__esModule", { value: true });
3466
- exports.stringify = exports.extractQs = exports.getClientY = exports.getChildrenPositions = exports.getChildrenArray = void 0;
3467
- var log_1 = require_log();
3468
- var querystring_1 = require("querystring");
3469
- var getChildrenArray = (ref) => {
3470
- var _a;
3471
- const children = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.children) || [];
3472
- const ret = [];
3473
- for (let i = 0; i < children.length; i += 1) {
3474
- ret.push(children[i]);
3475
- }
3476
- return ret;
3477
- };
3478
- exports.getChildrenArray = getChildrenArray;
3479
- var getChildrenPositions = (ref) => (0, exports.getChildrenArray)(ref).map((c) => c.getBoundingClientRect().top + c.getBoundingClientRect().height);
3480
- exports.getChildrenPositions = getChildrenPositions;
3481
- var getClientY = (e) => {
3482
- var _a, _b, _c, _d;
3483
- if (!e) {
3484
- return void 0;
3485
- }
3486
- let ret;
3487
- if ((e === null || e === void 0 ? void 0 : e.changedTouches) || (e === null || e === void 0 ? void 0 : e.touches)) {
3488
- const et = e;
3489
- ret = ((_b = (_a = et.changedTouches) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.clientY) || ((_d = (_c = et.touches) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientY);
3490
- } else if (e === null || e === void 0 ? void 0 : e.clientY) {
3491
- const me = e;
3492
- ret = me.clientY;
3493
- }
3494
- return ret;
3495
- };
3496
- exports.getClientY = getClientY;
3497
- var sanatiseString = (str) => str.replace(/[^a-zA-Z0-9\-_]/gim, "");
3498
- function extractQs2({ search, sanatise }) {
3499
- if (!search) {
3500
- return {};
3501
- }
3502
- const qs = (0, querystring_1.parse)(search.replace(/^[?]/, ""));
3503
- const ret = {};
3504
- Object.keys(qs).forEach((qk1) => {
3505
- const qk = !sanatise ? qk1 : sanatiseString(qk1);
3506
- if (qk1 !== qk) {
3507
- (0, log_1.debug)("sanatising qs input key for ", qk);
3508
- }
3509
- if (Array.isArray(qs[qk])) {
3510
- ret[qk] = qs[qk].join("");
3511
- } else {
3512
- ret[qk] = qs[qk];
3513
- }
3514
- const newV = !sanatise ? ret[qk] : sanatiseString(ret[qk]);
3515
- if (newV !== ret[qk]) {
3516
- (0, log_1.debug)("sanatising qs input for ", qk);
3517
- ret[qk] = newV;
3518
- }
3519
- });
3520
- return ret;
3521
- }
3522
- exports.extractQs = extractQs2;
3523
- var stringify3 = (p) => {
3524
- const params = new URLSearchParams();
3525
- Object.entries(p).forEach(([a, b]) => params.append(a, b));
3526
- return params;
3527
- };
3528
- exports.stringify = stringify3;
3529
- }
3530
- });
3531
-
3532
- // ../../node_modules/ag-common/dist/ui/helpers/useLocalStorage.js
3533
- var require_useLocalStorage = __commonJS({
3534
- "../../node_modules/ag-common/dist/ui/helpers/useLocalStorage.js"(exports) {
3535
- "use strict";
3536
- Object.defineProperty(exports, "__esModule", { value: true });
3537
- exports.UseLocalStorage = exports.getLocalStorageItem = exports.setLocalStorageItem = exports.clearAllLocalStorage = exports.clearLocalStorageItem = void 0;
3538
- var log_1 = require_log();
3539
- var object_1 = require_object();
3540
- var react_1 = require("react");
3541
- var getTimeSeconds = () => Math.ceil(new Date().getTime() / 1e3);
3542
- var clearLocalStorageItem2 = (key) => {
3543
- if (typeof window === "undefined") {
3544
- return;
3545
- }
3546
- try {
3547
- window.localStorage.removeItem(key);
3548
- } catch (e) {
3549
- (0, log_1.warn)("error clearing local storage:", e);
3550
- }
3551
- };
3552
- exports.clearLocalStorageItem = clearLocalStorageItem2;
3553
- var clearAllLocalStorage = (except) => {
3554
- try {
3555
- if (typeof window === "undefined") {
3556
- return;
3557
- }
3558
- for (let i = 0; i < localStorage.length; i += 1) {
3559
- const key = localStorage.key(i);
3560
- if (!key || (except === null || except === void 0 ? void 0 : except.includes(key))) {
3561
- return;
3562
- }
3563
- (0, exports.clearLocalStorageItem)(key);
3564
- }
3565
- } catch (e) {
3566
- (0, log_1.warn)("error clearing local storage:", e);
3567
- }
3568
- };
3569
- exports.clearAllLocalStorage = clearAllLocalStorage;
3570
- var setLocalStorageItem = (key, value, ttl) => {
3571
- try {
3572
- if (typeof window === "undefined") {
3573
- return;
3574
- }
3575
- const set = {
3576
- expiry: !ttl ? void 0 : getTimeSeconds() + ttl,
3577
- val: JSON.stringify(value)
3578
- };
3579
- window.localStorage.setItem(key, JSON.stringify(set));
3580
- } catch (e) {
3581
- (0, log_1.error)(`set LS error:${key}-${e}`);
3582
- (0, exports.clearLocalStorageItem)(key);
3583
- }
3584
- };
3585
- exports.setLocalStorageItem = setLocalStorageItem;
3586
- var getLocalStorageItem2 = (key, initialValue, ttl) => {
3587
- if (typeof window === "undefined") {
3588
- return initialValue;
3589
- }
3590
- const itemraw = window.localStorage.getItem(key);
3591
- const item = (0, object_1.tryJsonParse)(itemraw, void 0);
3592
- if (!item || item.expiry && getTimeSeconds() > item.expiry) {
3593
- (0, exports.setLocalStorageItem)(key, initialValue, ttl);
3594
- return initialValue;
3595
- }
3596
- const itemv = (0, object_1.tryJsonParse)(item.val, void 0);
3597
- if (!itemv) {
3598
- (0, exports.setLocalStorageItem)(key, initialValue, ttl);
3599
- return initialValue;
3600
- }
3601
- return itemv;
3602
- };
3603
- exports.getLocalStorageItem = getLocalStorageItem2;
3604
- function UseLocalStorage2(key, initialValue, ttl) {
3605
- const storedValue = (0, exports.getLocalStorageItem)(key, initialValue, ttl);
3606
- const [, setT] = (0, react_1.useState)(0);
3607
- const setValue = (value) => {
3608
- const valueToStore = value instanceof Function ? value(storedValue) : value;
3609
- (0, exports.setLocalStorageItem)(key, valueToStore, ttl);
3610
- setT(new Date().getTime());
3611
- };
3612
- return [storedValue, setValue];
3613
- }
3614
- exports.UseLocalStorage = UseLocalStorage2;
3615
- }
3616
- });
3617
-
3618
- // src/index.tsx
3619
- var src_exports = {};
3620
- __export(src_exports, {
3621
- AnalyticaConfigContext: () => AnalyticaConfigContext,
3622
- AnalyticaConfigProvider: () => AnalyticaConfigProvider,
3623
- CognitoAuthContext: () => CognitoAuthContext,
3624
- CognitoAuthProvider: () => CognitoAuthProvider,
3625
- ErrorBoundary: () => ErrorBoundary,
3626
- ExternalComponent: () => ExternalComponent,
3627
- Feedback: () => Feedback,
3628
- decodeIdToken: () => decodeIdToken,
3629
- errorTrack: () => errorTrack,
3630
- feedback: () => feedback,
3631
- getUserFromIdToken: () => getUserFromIdToken,
3632
- page: () => page,
3633
- tokenMissing: () => tokenMissing,
3634
- track: () => track,
3635
- useFeedback: () => useFeedback,
3636
- useTrack: () => useTrack
3637
- });
3638
- module.exports = __toCommonJS(src_exports);
3639
-
3640
- // src/helpers/errorTrack.tsx
3641
- var import_log = __toESM(require_log());
3642
- var import_callOpenApi = __toESM(require_callOpenApi());
3643
- var import_api = __toESM(require_api());
3644
- function callOpenApi(p) {
3645
- return (0, import_callOpenApi.callOpenApi)(__spreadProps(__spreadValues({}, p), {
3646
- func: (d) => p.func(d),
3647
- newDefaultApi: (opts) => new import_api.DefaultApi(opts),
3648
- logout: () => window.location.reload(),
3649
- refreshToken: () => __async(this, null, function* () {
3650
- return void 0;
3651
- })
3652
- }));
3653
- }
3654
- var errorTrack = (_0) => __async(void 0, [_0], function* ({
3655
- data,
3656
- overrideBaseUrl = "https://api.analytica.click"
3657
- }) {
3658
- var _a;
3659
- if (typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost") {
3660
- (0, import_log.debug)(`local error tracking ignored:${data.data.message} ${JSON.stringify(data)}, to ${overrideBaseUrl}`);
3661
- return {};
3662
- }
3663
- (0, import_log.debug)("error track", data.data.message, JSON.stringify(data));
3664
- const x = yield callOpenApi({
3665
- apiUrl: overrideBaseUrl,
3666
- func: (s) => s.postError(data)
3667
- });
3668
- if (x.error) {
3669
- return { error: x.error.message };
3670
- }
3671
- return {};
3672
- });
3673
-
3674
- // src/components/AnalyticaConfig/index.tsx
3675
- var import_react = __toESM(require("react"));
3676
- var stubState = {
3677
- analyticaToken: void 0,
3678
- overrideBaseUrl: void 0
3679
- };
3680
- var AnalyticaConfigContext = import_react.default.createContext(stubState);
3681
- function overloadConsole(values) {
3682
- if (!values.analyticaToken) {
3683
- return;
3684
- }
3685
- const tempError = window.console.error;
3686
- window.console.error = (...obj) => errorTrack({
3687
- data: {
3688
- data: { href: window.location.href, message: JSON.stringify(obj) },
3689
- key: values.analyticaToken
3690
- },
3691
- overrideBaseUrl: values.overrideBaseUrl
3692
- }).finally(() => tempError(...obj));
3693
- const tempWarn = window.console.warn;
3694
- window.console.warn = (...obj) => errorTrack({
3695
- data: {
3696
- data: { href: window.location.href, message: JSON.stringify(obj) },
3697
- key: values.analyticaToken
3698
- },
3699
- overrideBaseUrl: values.overrideBaseUrl
3700
- }).finally(() => tempWarn(...obj));
3701
- }
3702
- var AnalyticaConfigProvider = ({
3703
- children,
3704
- values
3705
- }) => {
3706
- const [state, setState] = (0, import_react.useState)(values);
3707
- (0, import_react.useEffect)(() => {
3708
- if (JSON.stringify(values) !== JSON.stringify(state)) {
3709
- setState(values);
3710
- }
3711
- }, [state, values]);
3712
- (0, import_react.useEffect)(() => {
3713
- overloadConsole(values);
3714
- }, []);
3715
- return /* @__PURE__ */ import_react.default.createElement(AnalyticaConfigContext.Provider, {
3716
- value: state
3717
- }, children);
3718
- };
3719
-
3720
- // src/helpers/log.ts
3721
- var tokenMissing = (comp) => `[Analytica.${comp}] Please load analytica token in AnalyticaConfigProvider to use this component`;
3722
-
3723
- // src/helpers/feedback.tsx
3724
- var import_log3 = __toESM(require_log());
3725
- var import_react2 = require("react");
3726
- var import_callOpenApi2 = __toESM(require_callOpenApi());
3727
- var import_api2 = __toESM(require_api());
3728
- function callOpenApi2(p) {
3729
- return (0, import_callOpenApi2.callOpenApi)(__spreadProps(__spreadValues({}, p), {
3730
- func: (d) => p.func(d),
3731
- newDefaultApi: (opts) => new import_api2.DefaultApi(opts),
3732
- logout: () => window.location.reload(),
3733
- refreshToken: () => __async(this, null, function* () {
3734
- return void 0;
3735
- })
3736
- }));
3737
- }
3738
- var feedback = (_0) => __async(void 0, [_0], function* ({
3739
- data,
3740
- analyticaToken,
3741
- overrideBaseUrl = "https://api.analytica.click"
3742
- }) {
3743
- var _a;
3744
- if (typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost") {
3745
- (0, import_log3.debug)(`local feedback ignored:${JSON.stringify(data)}, to ${overrideBaseUrl}`);
3746
- return {};
3747
- }
3748
- (0, import_log3.debug)("feedback", JSON.stringify(data));
3749
- const x = yield callOpenApi2({
3750
- apiUrl: overrideBaseUrl,
3751
- func: (s) => s.putFeedback({ key: analyticaToken, data })
3752
- });
3753
- if (x.error) {
3754
- return { error: x.error.message };
3755
- }
3756
- return {};
3757
- });
3758
- var useFeedback = () => {
3759
- const { analyticaToken, overrideBaseUrl } = (0, import_react2.useContext)(AnalyticaConfigContext);
3760
- if (!analyticaToken) {
3761
- (0, import_log3.warn)(tokenMissing("useFeedback"));
3762
- return { trackWithToken: () => ({ error: "no token" }) };
3763
- }
3764
- return {
3765
- trackWithToken: (d) => feedback(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
3766
- };
3767
- };
3768
-
3769
- // src/components/UserProvider/picture.ts
3770
- var parsePicture = (raw) => {
3771
- var _a, _b;
3772
- try {
3773
- return (_b = (_a = JSON.parse(raw)) == null ? void 0 : _a.data) == null ? void 0 : _b.url;
3774
- } catch (e) {
3775
- return raw;
3776
- }
3777
- };
3778
-
3779
- // src/helpers/jwt.ts
3780
- var import_jsonwebtoken = require("jsonwebtoken");
3781
- var decodeIdToken = (s) => (0, import_jsonwebtoken.decode)(s);
3782
- var getUserFromIdToken = (idToken) => {
3783
- var _a;
3784
- const idJwt = decodeIdToken(idToken);
3785
- if (!idJwt) {
3786
- throw new Error("bad token");
3787
- }
3788
- const defUser = {
3789
- userId: idJwt.email,
3790
- fullname: idJwt.name,
3791
- nickname: idJwt.nickname,
3792
- picture: parsePicture(idJwt.picture),
3793
- updatedAt: new Date().getTime(),
3794
- idJwt,
3795
- isAdmin: (_a = idJwt == null ? void 0 : idJwt["cognito:groups"]) == null ? void 0 : _a.includes("Admin")
3796
- };
3797
- return defUser;
3798
- };
3799
-
3800
- // src/helpers/track.ts
3801
- var import_log5 = __toESM(require_log());
3802
- var import_react3 = require("react");
3803
- var import_api3 = __toESM(require_api());
3804
- var import_callOpenApi3 = __toESM(require_callOpenApi());
3805
- function callOpenApi3(p) {
3806
- return (0, import_callOpenApi3.callOpenApi)(__spreadProps(__spreadValues({}, p), {
3807
- func: (d) => p.func(d),
3808
- newDefaultApi: (opts) => new import_api3.DefaultApi(opts),
3809
- logout: () => window.location.reload(),
3810
- refreshToken: () => __async(this, null, function* () {
3811
- return void 0;
3812
- })
3813
- }));
3814
- }
3815
- var track = (_0) => __async(void 0, [_0], function* ({
3816
- analyticaToken,
3817
- userData,
3818
- overrideBaseUrl = "https://api.analytica.click",
3819
- eventName
3820
- }) {
3821
- var _a, _b, _c;
3822
- let data = { eventName };
3823
- if (typeof window !== "undefined") {
3824
- data = __spreadProps(__spreadValues({}, data), {
3825
- pageLocation: window.location.href,
3826
- browserResolution: `${(_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.width}:${(_b = window == null ? void 0 : window.screen) == null ? void 0 : _b.height}`
3827
- });
3828
- }
3829
- if (typeof document !== "undefined") {
3830
- data = __spreadProps(__spreadValues({}, data), {
3831
- pageReferrer: document.referrer,
3832
- pageTitle: document.title
3833
- });
3834
- }
3835
- if (typeof navigator !== "undefined") {
3836
- data = __spreadProps(__spreadValues({}, data), {
3837
- browserLanguage: navigator.language
3838
- });
3839
- }
3840
- if (typeof window !== "undefined" && ((_c = window == null ? void 0 : window.location) == null ? void 0 : _c.hostname) === "localhost") {
3841
- (0, import_log5.debug)(`local page ignored: ${JSON.stringify(data)}, to ${overrideBaseUrl}`);
3842
- return {};
3843
- }
3844
- const x = yield callOpenApi3({
3845
- apiUrl: overrideBaseUrl,
3846
- func: (s) => s.postPageTrack({
3847
- key: analyticaToken,
3848
- data,
3849
- userData
3850
- })
3851
- });
3852
- if (x.error) {
3853
- return { error: x.error.message };
3854
- }
3855
- return {};
3856
- });
3857
- var page = (_0) => __async(void 0, [_0], function* ({
3858
- analyticaToken,
3859
- userData,
3860
- overrideBaseUrl = "https://api.analytica.click"
3861
- }) {
3862
- return track({ analyticaToken, userData, overrideBaseUrl, eventName: "PAGE" });
3863
- });
3864
- var useTrack = () => {
3865
- const { analyticaToken, overrideBaseUrl } = (0, import_react3.useContext)(AnalyticaConfigContext);
3866
- if (!analyticaToken) {
3867
- (0, import_log5.warn)(tokenMissing("useTrack"));
3868
- const def = () => __async(void 0, null, function* () {
3869
- return { error: "no token" };
3870
- });
3871
- return { page: def, track: def };
3872
- }
3873
- return {
3874
- page: (d) => page(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl })),
3875
- track: (d) => track(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
3876
- };
3877
- };
3878
-
3879
- // src/components/ErrorBoundary/index.tsx
3880
- var import_ErrorBoundary = __toESM(require_ErrorBoundary());
3881
- var import_react4 = __toESM(require("react"));
3882
- var import_log6 = __toESM(require_log());
3883
- function onBrowserError(_0) {
3884
- return __async(this, arguments, function* ({
3885
- ev,
3886
- analyticaToken,
3887
- filterBrowserError
3888
- }) {
3889
- if (filterBrowserError && filterBrowserError(ev) === false) {
3890
- return;
3891
- }
3892
- const message = (ev == null ? void 0 : ev.message) || (ev == null ? void 0 : ev.error);
3893
- const { href } = window.location;
3894
- const stack = ev == null ? void 0 : ev.stack;
3895
- const filename = ev == null ? void 0 : ev.filename;
3896
- yield errorTrack({
3897
- data: {
3898
- key: analyticaToken,
3899
- data: {
3900
- message,
3901
- stack,
3902
- filename,
3903
- href
3904
- }
3905
- }
3906
- });
3907
- });
3908
- }
3909
- var ErrorBoundary = ({
3910
- children,
3911
- filterBrowserError
3912
- }) => {
3913
- const { analyticaToken } = (0, import_react4.useContext)(AnalyticaConfigContext);
3914
- (0, import_react4.useEffect)(() => {
3915
- if (!analyticaToken) {
3916
- return () => {
3917
- };
3918
- }
3919
- const obe = (ev) => onBrowserError({ ev, analyticaToken, filterBrowserError });
3920
- window.addEventListener("error", obe);
3921
- return () => {
3922
- window.removeEventListener("error", obe);
3923
- };
3924
- }, [analyticaToken, filterBrowserError]);
3925
- if (!analyticaToken) {
3926
- (0, import_log6.warn)(tokenMissing("ErrorBoundary"));
3927
- return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, children);
3928
- }
3929
- return /* @__PURE__ */ import_react4.default.createElement(import_ErrorBoundary.ErrorBoundary, {
3930
- notify: (data) => __async(void 0, null, function* () {
3931
- const { href } = window.location;
3932
- yield errorTrack({
3933
- data: {
3934
- key: analyticaToken,
3935
- data: __spreadProps(__spreadValues({}, data), {
3936
- href
3937
- })
3938
- }
3939
- });
3940
- })
3941
- }, children);
3942
- };
3943
-
3944
- // src/components/ExternalComponent/index.tsx
3945
- var import_react5 = __toESM(require("react"));
3946
- var import_createRequires = __toESM(require_createRequires());
3947
- var import_useRemoteComponent = __toESM(require_useRemoteComponent());
3948
- var import_react_dom = __toESM(require("react-dom"));
3949
- var styled = require("styled-components");
3950
- var cache = {};
3951
- var ExternalComponent = ({
3952
- url,
3953
- props
3954
- }) => {
3955
- const requires = (0, import_createRequires.createRequires)(() => ({
3956
- react: import_react5.default,
3957
- "react-dom": import_react_dom.default,
3958
- "styled-components": styled
3959
- }));
3960
- let Component;
3961
- let loading = false;
3962
- let error;
3963
- if (cache[url]) {
3964
- Component = cache[url];
3965
- } else {
3966
- [loading, error, Component] = (0, import_useRemoteComponent.createUseRemoteComponent)({ requires })(url);
3967
- }
3968
- if (!cache[url] && !loading && !error && Component) {
3969
- cache[url] = Component;
3970
- }
3971
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, !loading && !error && /* @__PURE__ */ import_react5.default.createElement(Component, __spreadValues({}, props)), error && error);
3972
- };
3973
-
3974
- // src/components/Feedback/index.tsx
3975
- var import_react6 = __toESM(require("react"));
3976
- var import_log7 = __toESM(require_log());
3977
- var Feedback = (props) => {
3978
- const { analyticaToken, overrideBaseUrl, devMode } = (0, import_react6.useContext)(AnalyticaConfigContext);
3979
- if (!analyticaToken) {
3980
- (0, import_log7.warn)(tokenMissing("Feedback"));
3981
- return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null);
3982
- }
3983
- const int = __spreadProps(__spreadValues({}, props), {
3984
- submitFeedback: feedback,
3985
- analyticaToken,
3986
- overrideBaseUrl
3987
- });
3988
- let url = `https://cdn.analytica.click/feedback.js`;
3989
- if (devMode) {
3990
- url = `/feedback.js`;
3991
- }
3992
- return /* @__PURE__ */ import_react6.default.createElement(ExternalComponent, {
3993
- url,
3994
- props: int
3995
- });
3996
- };
3997
-
3998
- // src/components/UserProvider/cognito.ts
3999
- var import_cognitoidentity = __toESM(require("aws-sdk/clients/cognitoidentity"));
4000
- function getAwsCreds(_0) {
4001
- return __async(this, arguments, function* ({
4002
- user,
4003
- config
4004
- }) {
4005
- var _a, _b, _c;
4006
- if (!((_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token) || !user.idJwt || !config.identityPool) {
4007
- return void 0;
4008
- }
4009
- const idToken = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.id_token;
4010
- const logins = {
4011
- [user.idJwt.iss.replace("https://", "")]: idToken
4012
- };
4013
- const cognito = new import_cognitoidentity.default({ region: config.AWSRegion });
4014
- const identityId = yield cognito.getId({
4015
- IdentityPoolId: config.identityPool,
4016
- Logins: logins
4017
- }).promise();
4018
- if (!(identityId == null ? void 0 : identityId.IdentityId)) {
4019
- return void 0;
4020
- }
4021
- const roleArn = (_c = user.idJwt) == null ? void 0 : _c["cognito:preferred_role"];
4022
- const params = {
4023
- CustomRoleArn: roleArn,
4024
- IdentityId: identityId.IdentityId,
4025
- Logins: logins
4026
- };
4027
- const { Credentials: creds } = yield cognito.getCredentialsForIdentity(params).promise();
4028
- if (!(creds == null ? void 0 : creds.AccessKeyId) || !creds.SecretKey || !creds.SessionToken || !creds.Expiration) {
4029
- return void 0;
4030
- }
4031
- const credentials = {
4032
- accessKeyId: creds.AccessKeyId,
4033
- sessionToken: creds.SessionToken,
4034
- secretAccessKey: creds.SecretKey
4035
- };
4036
- return credentials;
4037
- });
4038
- }
4039
-
4040
- // src/components/UserProvider/jwt.ts
4041
- var jwtExpired = (j) => !(j == null ? void 0 : j.expires_at) || new Date().getTime() > j.expires_at;
4042
- var jwtGenerateExpiresAt = ({ expires_in }) => new Date().getTime() + parseInt(`${expires_in}000`, 10);
4043
-
4044
- // src/components/UserProvider/refreshToken.ts
4045
- var import_axiosHelper = __toESM(require_axiosHelper());
4046
- var import_log8 = __toESM(require_log());
4047
- var import_dom = __toESM(require_dom());
4048
- function refreshToken(_0) {
4049
- return __async(this, arguments, function* ({
4050
- user,
4051
- setUser,
4052
- setError,
4053
- config,
4054
- logout
4055
- }) {
4056
- var _a, _b;
4057
- try {
4058
- if (((_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token) && !jwtExpired(user == null ? void 0 : user.jwt)) {
4059
- return user;
4060
- }
4061
- const token = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.refresh_token;
4062
- if (!token || !user) {
4063
- (0, import_log8.warn)("no refresh token, wipe");
4064
- logout();
4065
- return void 0;
4066
- }
4067
- const resp = yield (0, import_axiosHelper.axiosHelper)({
4068
- url: config.cognitoRefresh,
4069
- verb: "post",
4070
- body: (0, import_dom.stringify)({
4071
- grant_type: "refresh_token",
4072
- client_id: config.ClientId,
4073
- refresh_token: token
4074
- }),
4075
- headers: {
4076
- "Content-Type": "application/x-www-form-urlencoded"
4077
- }
4078
- });
4079
- const newUser = __spreadProps(__spreadValues({}, user), {
4080
- jwt: __spreadProps(__spreadValues({}, resp.data), {
4081
- refresh_token: token,
4082
- expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
4083
- })
4084
- });
4085
- newUser.credentials = yield getAwsCreds({ user: newUser, config });
4086
- setUser(newUser);
4087
- return newUser;
4088
- } catch (e) {
4089
- const es = e.toString();
4090
- if (es.includes(400) || es.includes(401) || es.includes(403)) {
4091
- (0, import_log8.debug)("old refresh token, wipe");
4092
- setUser(void 0);
4093
- setError(void 0);
4094
- return void 0;
4095
- }
4096
- setError(e);
4097
- }
4098
- return void 0;
4099
- });
4100
- }
4101
-
4102
- // src/components/UserProvider/getTokensFromCode.ts
4103
- var import_axiosHelper2 = __toESM(require_axiosHelper());
4104
- var import_dom2 = __toESM(require_dom());
4105
- function getTokensFromCode(_0) {
4106
- return __async(this, arguments, function* ({
4107
- code,
4108
- setUser,
4109
- redirectUrl,
4110
- config
4111
- }) {
4112
- try {
4113
- const resp = yield (0, import_axiosHelper2.axiosHelper)({
4114
- verb: "post",
4115
- url: config.cognitoRefresh,
4116
- body: (0, import_dom2.stringify)({
4117
- grant_type: "authorization_code",
4118
- client_id: config.ClientId,
4119
- code,
4120
- redirect_uri: redirectUrl
4121
- }),
4122
- headers: {
4123
- "Content-Type": "application/x-www-form-urlencoded"
4124
- }
4125
- });
4126
- const newUser = __spreadProps(__spreadValues({}, getUserFromIdToken(resp.data.id_token)), {
4127
- jwt: __spreadProps(__spreadValues({}, resp.data), {
4128
- expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
4129
- })
4130
- });
4131
- if (config.identityPool) {
4132
- newUser.credentials = yield getAwsCreds({ user: newUser, config });
4133
- }
4134
- setUser(newUser);
4135
- return true;
4136
- } catch (e) {
4137
- }
4138
- return false;
4139
- });
4140
- }
4141
-
4142
- // src/components/UserProvider/index.tsx
4143
- var import_log9 = __toESM(require_log());
4144
- var import_react7 = __toESM(require("react"));
4145
- var import_useLocalStorage = __toESM(require_useLocalStorage());
4146
- var import_cookie = __toESM(require_cookie());
4147
- var import_dom3 = __toESM(require_dom());
4148
- var CognitoAuthContext = import_react7.default.createContext(void 0);
4149
- var CognitoAuthProvider = ({
4150
- config,
4151
- children,
4152
- goToPageUrl,
4153
- location,
4154
- redirectUrl = location.origin,
4155
- onMessage,
4156
- cookieDocument
4157
- }) => {
4158
- var _a, _b, _c;
4159
- const [error, setError] = (0, import_react7.useState)();
4160
- const [idTokenRaw, setIdToken] = (0, import_cookie.useCookieString)({
4161
- name: "id_token",
4162
- cookieDocument: typeof window === "undefined" ? cookieDocument : void 0,
4163
- defaultValue: ""
4164
- });
4165
- let idToken = idTokenRaw;
4166
- if (idToken && !decodeIdToken(idToken)) {
4167
- (0, import_log9.warn)(`bad token, logging out`);
4168
- (0, import_cookie.wipeCookies)("id_token");
4169
- void goToPageUrl({ url: location.origin, login: false });
4170
- idToken = "";
4171
- }
4172
- let defUser;
4173
- if (idToken && !(0, import_useLocalStorage.getLocalStorageItem)("user", void 0)) {
4174
- defUser = getUserFromIdToken(idToken);
4175
- }
4176
- const [user, setUser] = (0, import_useLocalStorage.UseLocalStorage)("user", defUser);
4177
- const [loading, setLoading] = (0, import_react7.useState)(false);
4178
- const qs = (0, import_dom3.extractQs)({
4179
- search: typeof window === "undefined" ? "" : window.location.search,
4180
- sanatise: false
4181
- });
4182
- const logout = () => __async(void 0, null, function* () {
4183
- (0, import_cookie.wipeCookies)("id_token");
4184
- (0, import_useLocalStorage.clearLocalStorageItem)("user");
4185
- setIdToken("");
4186
- setUser(void 0);
4187
- setError(void 0);
4188
- setLoading(true);
4189
- yield goToPageUrl({ url: location.origin, login: false });
4190
- setLoading(false);
4191
- });
4192
- const logoutCopy = logout;
4193
- (0, import_react7.useEffect)(() => {
4194
- var _a2;
4195
- const newT = (_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.id_token;
4196
- if (newT !== idToken) {
4197
- setIdToken(newT || "");
4198
- }
4199
- }, [idToken, setIdToken, user, (_a = user == null ? void 0 : user.jwt) == null ? void 0 : _a.id_token]);
4200
- const loginWithRedirect = (stateqs) => __async(void 0, null, function* () {
4201
- var _a2;
4202
- if (error || loading || location.hash && Object.keys(location.hash).length > 0 || location.search && ((_a2 = Object.keys(location.search)) == null ? void 0 : _a2.length) > 0) {
4203
- return;
4204
- }
4205
- setLoading(true);
4206
- const state = {
4207
- back: location.pathname
4208
- };
4209
- let url = config.vendToken + redirectUrl;
4210
- if (stateqs) {
4211
- url += `&state=${stateqs}`;
4212
- }
4213
- yield goToPageUrl({
4214
- url,
4215
- state,
4216
- login: true
4217
- });
4218
- });
4219
- (0, import_react7.useEffect)(() => {
4220
- function run() {
4221
- return __async(this, null, function* () {
4222
- var _a2, _b2, _c2;
4223
- const hasQs = !!(qs == null ? void 0 : qs.code) || !!(qs == null ? void 0 : qs.error);
4224
- const expired = jwtExpired(user == null ? void 0 : user.jwt);
4225
- const onlyJwt = !(user == null ? void 0 : user.userId) && !!(user == null ? void 0 : user.jwt);
4226
- if (!hasQs && !expired && !onlyJwt) {
4227
- return;
4228
- }
4229
- try {
4230
- setLoading(true);
4231
- if (hasQs && !expired) {
4232
- yield goToPageUrl({ url: redirectUrl, login: true });
4233
- } else if (hasQs) {
4234
- if (qs == null ? void 0 : qs.error) {
4235
- const newerror = {
4236
- message: (qs == null ? void 0 : qs.error_description) || "auth error"
4237
- };
4238
- if (JSON.stringify(newerror || {}) !== JSON.stringify(error || {})) {
4239
- setError(newerror);
4240
- }
4241
- } else if (qs == null ? void 0 : qs.code) {
4242
- yield getTokensFromCode({
4243
- code: qs.code,
4244
- redirectUrl,
4245
- config,
4246
- setUser
4247
- });
4248
- }
4249
- const newPath = "";
4250
- let url = newPath || redirectUrl || "/";
4251
- if (qs == null ? void 0 : qs.state) {
4252
- try {
4253
- if (!url.includes("?")) {
4254
- url += "?";
4255
- } else {
4256
- url += "&";
4257
- }
4258
- url += `state=${qs.state}`;
4259
- } catch (e) {
4260
- (0, import_log9.warn)("bad state passed in");
4261
- }
4262
- }
4263
- yield goToPageUrl({ url, login: true });
4264
- } else if (expired && ((_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.refresh_token)) {
4265
- yield refreshToken({
4266
- setUser,
4267
- setError,
4268
- user,
4269
- config,
4270
- logout: logoutCopy
4271
- });
4272
- } else if (onlyJwt) {
4273
- const token = (_c2 = (_b2 = user == null ? void 0 : user.jwt) == null ? void 0 : _b2.id_token) == null ? void 0 : _c2.substr(user.jwt.id_token.indexOf(" ") + 1);
4274
- if (!user || !token) {
4275
- (0, import_log9.info)("logging out no token");
4276
- setUser(void 0);
4277
- setError(void 0);
4278
- } else {
4279
- setUser(__spreadProps(__spreadValues({}, getUserFromIdToken(token)), {
4280
- jwt: user.jwt,
4281
- credentials: user.credentials
4282
- }));
4283
- }
4284
- }
4285
- } finally {
4286
- setLoading(false);
4287
- }
4288
- });
4289
- }
4290
- if (!loading && !error) {
4291
- run();
4292
- }
4293
- }, [
4294
- config,
4295
- error,
4296
- goToPageUrl,
4297
- logoutCopy,
4298
- loading,
4299
- qs,
4300
- redirectUrl,
4301
- setUser,
4302
- user
4303
- ]);
4304
- (0, import_react7.useEffect)(() => {
4305
- var _a2;
4306
- if (error) {
4307
- (0, import_log9.error)(JSON.stringify(error));
4308
- if (onMessage) {
4309
- onMessage(`error:${(_a2 = error.response) == null ? void 0 : _a2.status}`, { appearance: "error" });
4310
- }
4311
- }
4312
- }, [onMessage, error]);
4313
- if (error) {
4314
- return /* @__PURE__ */ import_react7.default.createElement("div", null, error.message);
4315
- }
4316
- const l2 = loading || !!(qs == null ? void 0 : qs.code);
4317
- const value = {
4318
- loading: l2,
4319
- isAuthenticated: !!((_b = user == null ? void 0 : user.idJwt) == null ? void 0 : _b.email),
4320
- refreshToken: () => refreshToken({
4321
- setUser,
4322
- setError,
4323
- user,
4324
- config,
4325
- logout
4326
- }),
4327
- loginWithRedirect,
4328
- logout,
4329
- error,
4330
- user: {
4331
- loading,
4332
- data: user,
4333
- reFetch: () => __async(void 0, null, function* () {
4334
- const ret = setUser(void 0);
4335
- return ret;
4336
- }),
4337
- error: void 0,
4338
- url: "auth",
4339
- datetime: ((_c = user == null ? void 0 : user.jwt) == null ? void 0 : _c.expires_at) || 0
4340
- }
4341
- };
4342
- return /* @__PURE__ */ import_react7.default.createElement(CognitoAuthContext.Provider, {
4343
- value
4344
- }, children);
4345
- };
4346
- // Annotate the CommonJS export names for ESM import in node:
4347
- 0 && (module.exports = {
4348
- AnalyticaConfigContext,
4349
- AnalyticaConfigProvider,
4350
- CognitoAuthContext,
4351
- CognitoAuthProvider,
4352
- ErrorBoundary,
4353
- ExternalComponent,
4354
- Feedback,
4355
- decodeIdToken,
4356
- errorTrack,
4357
- feedback,
4358
- getUserFromIdToken,
4359
- page,
4360
- tokenMissing,
4361
- track,
4362
- useFeedback,
4363
- useTrack
4364
- });
80
+ `,Xr=class extends yt.default.Component{constructor(t){super(t);this.state={hasError:void 0}}static getDerivedStateFromError(t){var r;let n=typeof window<"u"&&((r=window?.location)===null||r===void 0?void 0:r.href);return{hasError:Object.assign(Object.assign(Object.assign(Object.assign({},t),{message:t?.message||t}),t?.stack&&{stack:t?.stack}),n&&{href:n})}}render(){let{hasError:t}=this.state,{children:r,notify:n}=this.props;return t?(n&&n(t),yt.default.createElement(qs.Modal,{open:!0,setOpen:()=>{}},yt.default.createElement(Rs,null,"A fatal error has occurred - the admin has been notified.",yt.default.createElement("button",{type:"button",onClick:()=>window.location.reload()},"Press here to restart app")))):r}};Ie.ErrorBoundary=Xr});var nn=g(bt=>{"use strict";bt.__esModule=!0;bt.createRequires=void 0;var Ls=function(e){return typeof e=="function"?e():e||{}},Bs=function(e){var t=!1;return function(r){if(t||(e=Ls(e),t=!0),!(r in e))throw new Error("Could not require '"+r+"'. '"+r+"' does not exist in dependencies.");return e[r]}};bt.createRequires=Bs});var on=g(Lt=>{"use strict";Lt.__esModule=!0;var Fs=function(e){var t={};return function(r){return r in t||(t[r]=e(r)),t[r]}};Lt.default=Fs});var Bt=g(Me=>{"use strict";Me.__esModule=!0;Me.InternalServerError=Me.OK=void 0;Me.OK=200;Me.InternalServerError=500});var un=g($e=>{"use strict";var sn=$e&&$e.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};$e.__esModule=!0;var an=require("http"),cn=require("https"),Vs=Bt(),Ks=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return typeof e!="string"?{on:function(n,i){i(new Error("URL must be a string."))}}:e.indexOf("https://")===0?cn.get.apply(cn,sn([e],t,!1)):an.get.apply(an,sn([e],t,!1))},Us=function(e){return new Promise(function(t,r){Ks(e,function(n){if(n.statusCode!==Vs.OK)return r(new Error("HTTP Error Response: "+n.statusCode+" "+n.statusMessage+" ("+e+")"));var i=null;n.on("data",function(o){if(i===null){i=o;return}i+=o}),n.on("end",function(){return t(i)})}).on("error",r)})};$e.default=Us});var ln=g(ve=>{"use strict";ve.__esModule=!0;ve.DONE=ve.OPENED=ve.UNSENT=void 0;ve.UNSENT=0;ve.OPENED=1;ve.DONE=4});var dn=g(Ft=>{"use strict";Ft.__esModule=!0;var Ns=Bt(),Js=ln(),$s=function(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState===Js.DONE&&(n.status===Ns.OK?t(n.responseText):r(new Error("HTTP Error Response: "+n.status+" "+n.statusText+" ("+e+")")))},n.open("GET",e,!0),n.send()})};Ft.default=$s});var fn=g(vt=>{"use strict";vt.__esModule=!0;vt.createLoadRemoteModule=void 0;var zs=on(),Hs=un(),Gs=dn(),Ws=typeof window<"u"&&typeof window.document<"u",Ys=Ws?Gs.default:Hs.default,Qs=function(e){throw new Error("Could not require '"+e+"'. The 'requires' function was not provided.")},Zs=function(e){var t=e===void 0?{}:e,r=t.requires,n=t.fetcher,i=r||Qs,o=n||Ys;return(0,zs.default)(function(s){return o(s).then(function(l){var a={},u={exports:a},c=new Function("require","module","exports",l);return c(i,u,a),u.exports})})};vt.createLoadRemoteModule=Zs});var hn=g(_t=>{"use strict";_t.__esModule=!0;_t.createRequires=void 0;var Xs=function(e){return function(t){var r=e||{};if(!(t in r))throw new Error("Could not require '"+t+"'. '"+t+"' does not exist in dependencies.");return r[t]}};_t.createRequires=Xs});var gn=g(_e=>{"use strict";var pn=_e&&_e.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]});_e.__esModule=!0;_e.createRequires=_e.default=void 0;var ea=fn();pn(_e,ea,"createLoadRemoteModule","default");var ta=hn();pn(_e,ta,"createRequires")});var yn=g(Le=>{"use strict";var ra=Le&&Le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Le.__esModule=!0;Le.createUseRemoteComponent=void 0;var mn=require("react"),na=ra(gn()),ia=function(e){var t=na.default(e),r=function(n){var i=mn.useState({loading:!0,err:void 0,component:void 0}),o=i[0],s=o.loading,l=o.err,a=o.component,u=i[1];return mn.useEffect(function(){var c=u;return c({loading:!0,err:void 0,component:void 0}),t(n).then(function(d){return c({loading:!1,err:void 0,component:d.default})}).catch(function(d){return c({loading:!1,err:d,component:void 0})}),function(){c=function(){}}},[n]),[s,l,a]};return r};Le.createUseRemoteComponent=ia});var Kt=g(we=>{"use strict";var aa=we&&we.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(e,t||[])).next())})},ca=we&&we.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(we,"__esModule",{value:!0});we.axiosHelper=void 0;var ua=$(),la=Qe(),Fe=ca(require("axios")),da=({verb:e,url:t,body:r,headers:n,timeout:i=3e4,retryMax:o=0,onStaleAuth:s})=>aa(void 0,void 0,void 0,function*(){let l=0;do{try{let a=Object.assign({Accept:"application/json"},n);if(e==="get")return yield Fe.default.get(t,{headers:a,timeout:i,timeoutErrorMessage:`${t} timeout`});let u=!1,c=Fe.default.post;e==="put"?c=Fe.default.put:e==="post"?c=Fe.default.post:e==="patch"?c=Fe.default.patch:e==="delete"&&(c=Fe.default.delete,u=!0);let d;return u?d=yield c(t,{headers:a,timeout:i,timeoutErrorMessage:`${t} timeout`}):(r&&(0,la.isJson)(r)&&(a["Content-Type"]=a["Content-Type"]||"application/json"),d=yield c(t,r,{headers:a})),d}catch(a){let u=a;if((u.code==="401"||u.code==="403")&&((0,ua.debug)("auth expired"),s?.(),l=o),l>=o)throw u}l+=1}while(l<=o);throw new Error("unexpected")});we.axiosHelper=da});var Et=g(G=>{Object.defineProperty(G,"__esModule",{value:!0});G.stringify=G.extractQs=G.getClientY=G.getChildrenPositions=G.getChildrenArray=void 0;var jn=$(),fa=require("querystring"),ha=e=>{var t;let r=((t=e.current)===null||t===void 0?void 0:t.children)||[],n=[];for(let i=0;i<r.length;i+=1)n.push(r[i]);return n};G.getChildrenArray=ha;var pa=e=>(0,G.getChildrenArray)(e).map(t=>t.getBoundingClientRect().top+t.getBoundingClientRect().height);G.getChildrenPositions=pa;var ga=e=>{var t,r,n,i;if(!e)return;let o;if(e?.changedTouches||e?.touches){let s=e;o=((r=(t=s.changedTouches)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.clientY)||((i=(n=s.touches)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.clientY)}else e?.clientY&&(o=e.clientY);return o};G.getClientY=ga;var An=e=>e.replace(/[^a-zA-Z0-9\-_]/gim,"");function ma({search:e,sanatise:t}){if(!e)return{};let r=(0,fa.parse)(e.replace(/^[?]/,"")),n={};return Object.keys(r).forEach(i=>{let o=t?An(i):i;i!==o&&(0,jn.debug)("sanatising qs input key for ",o),Array.isArray(r[o])?n[o]=r[o].join(""):n[o]=r[o];let s=t?An(n[o]):n[o];s!==n[o]&&((0,jn.debug)("sanatising qs input for ",o),n[o]=s)}),n}G.extractQs=ma;var ya=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>t.append(r,n)),t};G.stringify=ya});var qn=g(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.UseLocalStorage=F.getLocalStorageItem=F.setLocalStorageItem=F.clearAllLocalStorage=F.clearLocalStorageItem=void 0;var Nt=$(),Pn=Qe(),ba=require("react"),xn=()=>Math.ceil(new Date().getTime()/1e3),va=e=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch(t){(0,Nt.warn)("error clearing local storage:",t)}};F.clearLocalStorageItem=va;var _a=e=>{try{if(typeof window>"u")return;for(let t=0;t<localStorage.length;t+=1){let r=localStorage.key(t);if(!r||e?.includes(r))return;(0,F.clearLocalStorageItem)(r)}}catch(t){(0,Nt.warn)("error clearing local storage:",t)}};F.clearAllLocalStorage=_a;var wa=(e,t,r)=>{try{if(typeof window>"u")return;let n={expiry:r?xn()+r:void 0,val:JSON.stringify(t)};window.localStorage.setItem(e,JSON.stringify(n))}catch(n){(0,Nt.error)(`set LS error:${e}-${n}`),(0,F.clearLocalStorageItem)(e)}};F.setLocalStorageItem=wa;var Oa=(e,t,r)=>{if(typeof window>"u")return t;let n=window.localStorage.getItem(e),i=(0,Pn.tryJsonParse)(n,void 0);if(!i||i.expiry&&xn()>i.expiry)return(0,F.setLocalStorageItem)(e,t,r),t;let o=(0,Pn.tryJsonParse)(i.val,void 0);return o||((0,F.setLocalStorageItem)(e,t,r),t)};F.getLocalStorageItem=Oa;function ja(e,t,r){let n=(0,F.getLocalStorageItem)(e,t,r),[,i]=(0,ba.useState)(0);return[n,s=>{let l=s instanceof Function?s(n):s;(0,F.setLocalStorageItem)(e,l,r),i(new Date().getTime())}]}F.UseLocalStorage=ja});var Ea={};Un(Ea,{AnalyticaConfigContext:()=>oe,AnalyticaConfigProvider:()=>us,CognitoAuthContext:()=>Rn,CognitoAuthProvider:()=>Aa,ErrorBoundary:()=>Ms,ExternalComponent:()=>Vt,Feedback:()=>sa,decodeIdToken:()=>pt,errorTrack:()=>Ae,feedback:()=>ht,getUserFromIdToken:()=>De,page:()=>Hr,tokenMissing:()=>de,track:()=>Mt,useFeedback:()=>ds,useTrack:()=>hs});module.exports=Nn(Ea);var It=v($()),Lr=v(dt()),Br=v(ft());function ss(e){return(0,Lr.callOpenApi)(k(A({},e),{func:t=>e.func(t),newDefaultApi:t=>new Br.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>T(this,null,function*(){})}))}var Ae=r=>T(void 0,[r],function*({data:e,overrideBaseUrl:t="https://api.analytica.click"}){var i;if(typeof window!="undefined"&&((i=window==null?void 0:window.location)==null?void 0:i.hostname)==="localhost")return(0,It.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${t}`),{};(0,It.debug)("error track",e.data.message,JSON.stringify(e));let n=yield ss({apiUrl:t,func:o=>o.postError(e)});return n.error?{error:n.error.message}:{}});var me=v(require("react")),as={analyticaToken:void 0,overrideBaseUrl:void 0},oe=me.default.createContext(as);function cs(e){if(!e.analyticaToken)return;let t=window.console.error;window.console.error=(...n)=>Ae({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>t(...n));let r=window.console.warn;window.console.warn=(...n)=>Ae({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>r(...n))}var us=({children:e,values:t})=>{let[r,n]=(0,me.useState)(t);return(0,me.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(r)&&n(t)},[r,t]),(0,me.useEffect)(()=>{cs(t)},[]),me.default.createElement(oe.Provider,{value:r},e)};var de=e=>`[Analytica.${e}] Please load analytica token in AnalyticaConfigProvider to use this component`;var Ne=v($()),Fr=require("react"),Vr=v(dt()),Kr=v(ft());function ls(e){return(0,Vr.callOpenApi)(k(A({},e),{func:t=>e.func(t),newDefaultApi:t=>new Kr.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>T(this,null,function*(){})}))}var ht=n=>T(void 0,[n],function*({data:e,analyticaToken:t,overrideBaseUrl:r="https://api.analytica.click"}){var o;if(typeof window!="undefined"&&((o=window==null?void 0:window.location)==null?void 0:o.hostname)==="localhost")return(0,Ne.debug)(`local feedback ignored:${JSON.stringify(e)}, to ${r}`),{};(0,Ne.debug)("feedback",JSON.stringify(e));let i=yield ls({apiUrl:r,func:s=>s.putFeedback({key:t,data:e})});return i.error?{error:i.error.message}:{}}),ds=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Fr.useContext)(oe);return e?{trackWithToken:r=>ht(k(A({},r),{analyticaToken:e,overrideBaseUrl:t}))}:((0,Ne.warn)(de("useFeedback")),{trackWithToken:()=>({error:"no token"})})};var Ur=e=>{var t,r;try{return(r=(t=JSON.parse(e))==null?void 0:t.data)==null?void 0:r.url}catch(n){return e}};var Nr=require("jsonwebtoken"),pt=e=>(0,Nr.decode)(e),De=e=>{var n;let t=pt(e);if(!t)throw new Error("bad token");return{userId:t.email,fullname:t.name,nickname:t.nickname,picture:Ur(t.picture),updatedAt:new Date().getTime(),idJwt:t,isAdmin:(n=t==null?void 0:t["cognito:groups"])==null?void 0:n.includes("Admin")}};var gt=v($()),Jr=require("react"),$r=v(ft()),zr=v(dt());function fs(e){return(0,zr.callOpenApi)(k(A({},e),{func:t=>e.func(t),newDefaultApi:t=>new $r.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>T(this,null,function*(){})}))}var Mt=i=>T(void 0,[i],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click",eventName:n}){var l,a,u;let o={eventName:n};if(typeof window!="undefined"&&(o=k(A({},o),{pageLocation:window.location.href,browserResolution:`${(l=window==null?void 0:window.screen)==null?void 0:l.width}:${(a=window==null?void 0:window.screen)==null?void 0:a.height}`})),typeof document!="undefined"&&(o=k(A({},o),{pageReferrer:document.referrer,pageTitle:document.title})),typeof navigator!="undefined"&&(o=k(A({},o),{browserLanguage:navigator.language})),typeof window!="undefined"&&((u=window==null?void 0:window.location)==null?void 0:u.hostname)==="localhost")return(0,gt.debug)(`local page ignored: ${JSON.stringify(o)}, to ${r}`),{};let s=yield fs({apiUrl:r,func:c=>c.postPageTrack({key:e,data:o,userData:t})});return s.error?{error:s.error.message}:{}}),Hr=n=>T(void 0,[n],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click"}){return Mt({analyticaToken:e,userData:t,overrideBaseUrl:r,eventName:"PAGE"})}),hs=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Jr.useContext)(oe);if(!e){(0,gt.warn)(de("useTrack"));let r=()=>T(void 0,null,function*(){return{error:"no token"}});return{page:r,track:r}}return{page:r=>Hr(k(A({},r),{analyticaToken:e,overrideBaseUrl:t})),track:r=>Mt(k(A({},r),{analyticaToken:e,overrideBaseUrl:t}))}};var tn=v(en()),be=v(require("react")),rn=v($());function Is(n){return T(this,arguments,function*({ev:e,analyticaToken:t,filterBrowserError:r}){if(r&&r(e)===!1)return;let i=(e==null?void 0:e.message)||(e==null?void 0:e.error),{href:o}=window.location,s=e==null?void 0:e.stack,l=e==null?void 0:e.filename;yield Ae({data:{key:t,data:{message:i,stack:s,filename:l,href:o}}})})}var Ms=({children:e,filterBrowserError:t})=>{let{analyticaToken:r}=(0,be.useContext)(oe);return(0,be.useEffect)(()=>{if(!r)return()=>{};let n=i=>Is({ev:i,analyticaToken:r,filterBrowserError:t});return window.addEventListener("error",n),()=>{window.removeEventListener("error",n)}},[r,t]),r?be.default.createElement(tn.ErrorBoundary,{notify:n=>T(void 0,null,function*(){let{href:i}=window.location;yield Ae({data:{key:r,data:k(A({},n),{href:i})}})})},e):((0,rn.warn)(de("ErrorBoundary")),be.default.createElement(be.default.Fragment,null,e))};var ze=v(require("react")),bn=v(nn()),vn=v(yn()),_n=v(require("react-dom")),oa=require("styled-components"),wt={},Vt=({url:e,props:t})=>{let r=(0,bn.createRequires)(()=>({react:ze.default,"react-dom":_n.default,"styled-components":oa})),n,i=!1,o;return wt[e]?n=wt[e]:[i,o,n]=(0,vn.createUseRemoteComponent)({requires:r})(e),!wt[e]&&!i&&!o&&n&&(wt[e]=n),ze.default.createElement(ze.default.Fragment,null,!i&&!o&&ze.default.createElement(n,A({},t)),o&&o)};var Be=v(require("react")),wn=v($()),sa=e=>{let{analyticaToken:t,overrideBaseUrl:r,devMode:n}=(0,Be.useContext)(oe);if(!t)return(0,wn.warn)(de("Feedback")),Be.default.createElement(Be.default.Fragment,null);let i=k(A({},e),{submitFeedback:ht,analyticaToken:t,overrideBaseUrl:r}),o="https://cdn.analytica.click/feedback.js";return n&&(o="/feedback.js"),Be.default.createElement(Vt,{url:o,props:i})};var On=v(require("aws-sdk/clients/cognitoidentity"));function Ot(r){return T(this,arguments,function*({user:e,config:t}){var d,h,f;if(!((d=e==null?void 0:e.jwt)!=null&&d.id_token)||!e.idJwt||!t.identityPool)return;let n=(h=e==null?void 0:e.jwt)==null?void 0:h.id_token,i={[e.idJwt.iss.replace("https://","")]:n},o=new On.default({region:t.AWSRegion}),s=yield o.getId({IdentityPoolId:t.identityPool,Logins:i}).promise();if(!(s!=null&&s.IdentityId))return;let a={CustomRoleArn:(f=e.idJwt)==null?void 0:f["cognito:preferred_role"],IdentityId:s.IdentityId,Logins:i},{Credentials:u}=yield o.getCredentialsForIdentity(a).promise();return!(u!=null&&u.AccessKeyId)||!u.SecretKey||!u.SessionToken||!u.Expiration?void 0:{accessKeyId:u.AccessKeyId,sessionToken:u.SessionToken,secretAccessKey:u.SecretKey}})}var jt=e=>!(e!=null&&e.expires_at)||new Date().getTime()>e.expires_at,At=({expires_in:e})=>new Date().getTime()+parseInt(`${e}000`,10);var En=v(Kt()),kt=v($()),kn=v(Et());function Ut(o){return T(this,arguments,function*({user:e,setUser:t,setError:r,config:n,logout:i}){var s,l;try{if(((s=e==null?void 0:e.jwt)==null?void 0:s.id_token)&&!jt(e==null?void 0:e.jwt))return e;let a=(l=e==null?void 0:e.jwt)==null?void 0:l.refresh_token;if(!a||!e){(0,kt.warn)("no refresh token, wipe"),i();return}let u=yield(0,En.axiosHelper)({url:n.cognitoRefresh,verb:"post",body:(0,kn.stringify)({grant_type:"refresh_token",client_id:n.ClientId,refresh_token:a}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),c=k(A({},e),{jwt:k(A({},u.data),{refresh_token:a,expires_at:At({expires_in:u.data.expires_in})})});return c.credentials=yield Ot({user:c,config:n}),t(c),c}catch(a){let u=a.toString();if(u.includes(400)||u.includes(401)||u.includes(403)){(0,kt.debug)("old refresh token, wipe"),t(void 0),r(void 0);return}r(a)}})}var Tn=v(Kt()),Sn=v(Et());function Cn(i){return T(this,arguments,function*({code:e,setUser:t,redirectUrl:r,config:n}){try{let o=yield(0,Tn.axiosHelper)({verb:"post",url:n.cognitoRefresh,body:(0,Sn.stringify)({grant_type:"authorization_code",client_id:n.ClientId,code:e,redirect_uri:r}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),s=k(A({},De(o.data.id_token)),{jwt:k(A({},o.data),{expires_at:At({expires_in:o.data.expires_in})})});return n.identityPool&&(s.credentials=yield Ot({user:s,config:n})),t(s),!0}catch(o){}return!1})}var Ee=v($()),se=v(require("react")),Ve=v(qn()),He=v(st()),Dn=v(Et()),Rn=se.default.createContext(void 0),Aa=({config:e,children:t,goToPageUrl:r,location:n,redirectUrl:i=n.origin,onMessage:o,cookieDocument:s})=>{var ae,U;let[l,a]=(0,se.useState)(),[u,c]=(0,He.useCookieString)({name:"id_token",cookieDocument:typeof window=="undefined"?s:void 0,defaultValue:""}),d=u;d&&!pt(d)&&((0,Ee.warn)("bad token, logging out"),(0,He.wipeCookies)("id_token"),r({url:n.origin,login:!1}),d="");let h;d&&!(0,Ve.getLocalStorageItem)("user",void 0)&&(h=De(d));let[f,b]=(0,Ve.UseLocalStorage)("user",h),[V,K]=(0,se.useState)(!1),y=(0,Dn.extractQs)({search:typeof window=="undefined"?"":window.location.search,sanatise:!1}),q=()=>T(void 0,null,function*(){(0,He.wipeCookies)("id_token"),(0,Ve.clearLocalStorageItem)("user"),c(""),b(void 0),a(void 0),K(!0),yield r({url:n.origin,login:!1}),K(!1)}),m=q;(0,se.useEffect)(()=>{var z;let R=(z=f==null?void 0:f.jwt)==null?void 0:z.id_token;R!==d&&c(R||"")},[d,c,f,(ae=f==null?void 0:f.jwt)==null?void 0:ae.id_token]);let J=R=>T(void 0,null,function*(){var j;if(l||V||n.hash&&Object.keys(n.hash).length>0||n.search&&((j=Object.keys(n.search))==null?void 0:j.length)>0)return;K(!0);let z={back:n.pathname},D=e.vendToken+i;R&&(D+=`&state=${R}`),yield r({url:D,state:z,login:!0})});(0,se.useEffect)(()=>{function R(){return T(this,null,function*(){var ce,ue,ee;let z=!!(y!=null&&y.code)||!!(y!=null&&y.error),D=jt(f==null?void 0:f.jwt),j=!(f!=null&&f.userId)&&!!(f!=null&&f.jwt);if(!(!z&&!D&&!j))try{if(K(!0),z&&!D)yield r({url:i,login:!0});else if(z){if(y!=null&&y.error){let Ke={message:(y==null?void 0:y.error_description)||"auth error"};JSON.stringify(Ke||{})!==JSON.stringify(l||{})&&a(Ke)}else y!=null&&y.code&&(yield Cn({code:y.code,redirectUrl:i,config:e,setUser:b}));let Y=""||i||"/";if(y!=null&&y.state)try{Y.includes("?")?Y+="&":Y+="?",Y+=`state=${y.state}`}catch(Ke){(0,Ee.warn)("bad state passed in")}yield r({url:Y,login:!0})}else if(D&&((ce=f==null?void 0:f.jwt)==null?void 0:ce.refresh_token))yield Ut({setUser:b,setError:a,user:f,config:e,logout:m});else if(j){let W=(ee=(ue=f==null?void 0:f.jwt)==null?void 0:ue.id_token)==null?void 0:ee.substr(f.jwt.id_token.indexOf(" ")+1);!f||!W?((0,Ee.info)("logging out no token"),b(void 0),a(void 0)):b(k(A({},De(W)),{jwt:f.jwt,credentials:f.credentials}))}}finally{K(!1)}})}!V&&!l&&R()},[e,l,r,m,V,y,i,b,f]),(0,se.useEffect)(()=>{var R;l&&((0,Ee.error)(JSON.stringify(l)),o&&o(`error:${(R=l.response)==null?void 0:R.status}`,{appearance:"error"}))},[o,l]);let X={loading:!l&&(V||!!(y!=null&&y.code)),isAuthenticated:!l&&!!((U=f==null?void 0:f.idJwt)!=null&&U.email),refreshToken:()=>Ut({setUser:b,setError:a,user:f,config:e,logout:q}),loginWithRedirect:J,logout:q,error:l,user:f};return se.default.createElement(Rn.Provider,{value:X},t)};0&&(module.exports={AnalyticaConfigContext,AnalyticaConfigProvider,CognitoAuthContext,CognitoAuthProvider,ErrorBoundary,ExternalComponent,Feedback,decodeIdToken,errorTrack,feedback,getUserFromIdToken,page,tokenMissing,track,useFeedback,useTrack});