@olenbetong/appframe-core 2.11.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/af.common.js +121 -135
- package/dist/esm/af.common.legacy.js +127 -141
- package/dist/esm/af.common.legacy.min.js +1 -1
- package/dist/esm/af.common.legacy.min.js.map +4 -4
- package/dist/esm/af.common.min.js +2 -2
- package/dist/esm/af.common.min.js.map +4 -4
- package/dist/iife/af.common.js +121 -135
- package/dist/iife/af.common.legacy.js +127 -141
- package/dist/iife/af.common.legacy.min.js +1 -1
- package/dist/iife/af.common.legacy.min.js.map +4 -4
- package/dist/iife/af.common.min.js +2 -2
- package/dist/iife/af.common.min.js.map +4 -4
- package/es/SessionHandler.js +1 -3
- package/es/UserSession.js +33 -29
- package/es/date.js +3 -3
- package/es/date.test.d.ts +1 -0
- package/es/date.test.js +23 -0
- package/es/errorHandler.d.ts +1 -0
- package/es/errorHandler.js +5 -21
- package/es/expose.d.ts +1 -1
- package/es/expose.test.d.ts +10 -0
- package/es/expose.test.js +36 -0
- package/es/getUserImage.test.d.ts +1 -0
- package/es/getUserImage.test.js +30 -0
- package/es/index.js +1 -1
- package/es/invariant.test.d.ts +1 -0
- package/es/invariant.test.js +19 -0
- package/es/localStorage.js +1 -3
- package/es/parseFunc.js +1 -1
- package/es/parseFunc.test.d.ts +1 -0
- package/es/parseFunc.test.js +14 -0
- package/package.json +5 -3
- package/src/date.test.ts +27 -0
- package/src/date.ts +3 -3
- package/src/errorHandler.ts +6 -21
- package/src/expose.test.ts +59 -0
- package/src/expose.ts +1 -1
- package/src/getUserImage.test.ts +50 -0
- package/src/invariant.test.ts +23 -0
- package/src/parseFunc.test.ts +17 -0
- package/src/parseFunc.ts +1 -1
|
@@ -186,29 +186,131 @@ af.common = (() => {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
// src/log.ts
|
|
190
|
+
async function logActivity(activity, parameters = {}, timeElapsed = 0) {
|
|
191
|
+
var _a2;
|
|
192
|
+
try {
|
|
193
|
+
let response = await fetch("/api/logging/log-activity", {
|
|
194
|
+
method: "POST",
|
|
195
|
+
body: JSON.stringify({
|
|
196
|
+
article: af.article.id,
|
|
197
|
+
timeElapsed,
|
|
198
|
+
action: activity,
|
|
199
|
+
parameters: __spreadProps(__spreadValues({}, parameters), {
|
|
200
|
+
_session: getSessionData()
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
204
|
+
});
|
|
205
|
+
if (!response.ok) {
|
|
206
|
+
if ((_a2 = response.headers.get("Content-Type")) == null ? void 0 : _a2.includes("application/json")) {
|
|
207
|
+
let data = await response.json();
|
|
208
|
+
console.error(data.error);
|
|
209
|
+
} else {
|
|
210
|
+
console.error("".concat(response.status, " ").concat(response.statusText));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function startActivity(activity, startParameters = {}) {
|
|
217
|
+
let start = performance.now();
|
|
218
|
+
return (endParameters = {}) => logActivity(activity, __spreadValues(__spreadValues({}, startParameters), endParameters), performance.now() - start);
|
|
219
|
+
}
|
|
220
|
+
async function time(callback) {
|
|
221
|
+
let start = performance.now();
|
|
222
|
+
let returnValue = await callback();
|
|
223
|
+
return [returnValue, performance.now() - start];
|
|
224
|
+
}
|
|
225
|
+
async function logError(error) {
|
|
226
|
+
var _a2;
|
|
227
|
+
try {
|
|
228
|
+
if (!error)
|
|
229
|
+
return;
|
|
230
|
+
let data = typeof error === "string" ? { error } : typeof error === "object" ? "message" in error ? {
|
|
231
|
+
error: error.message,
|
|
232
|
+
stack: (_a2 = error.stack) != null ? _a2 : null
|
|
233
|
+
} : { error: error.toString() } : { error: "Unspecified error" };
|
|
234
|
+
console.error(error);
|
|
235
|
+
let result = await fetch("/data/Logger/LogError", {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: JSON.stringify(data),
|
|
238
|
+
headers: {
|
|
239
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
if (result.ok) {
|
|
243
|
+
return await result.json();
|
|
244
|
+
}
|
|
245
|
+
console.error(Error("Failed to log error"));
|
|
246
|
+
} catch (e) {
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function getSessionId() {
|
|
250
|
+
var _a2;
|
|
251
|
+
return (_a2 = crypto.randomUUID) == null ? void 0 : _a2.call(crypto);
|
|
252
|
+
}
|
|
253
|
+
var sessionStart = Date.now();
|
|
254
|
+
var sessionId = getSessionId();
|
|
255
|
+
var deviceId = "";
|
|
256
|
+
var browserSessionId = "";
|
|
257
|
+
if ("document" in window) {
|
|
258
|
+
let startSession = () => {
|
|
259
|
+
var _a2;
|
|
260
|
+
return logActivity("AfSessionInit", {
|
|
261
|
+
"appframe-core": af.common.version,
|
|
262
|
+
"appframe-data": (_a2 = af.data) == null ? void 0 : _a2.version,
|
|
263
|
+
"app-version": af.article.version
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
267
|
+
deviceId = localStorage.getItem("_afDeviceId");
|
|
268
|
+
browserSessionId = sessionStorage.getItem("_afSessionId");
|
|
269
|
+
if (!deviceId) {
|
|
270
|
+
deviceId = getSessionId();
|
|
271
|
+
localStorage.setItem("_afDeviceId", deviceId);
|
|
272
|
+
}
|
|
273
|
+
if (!browserSessionId) {
|
|
274
|
+
browserSessionId = sessionId;
|
|
275
|
+
sessionStorage.setItem("_afSessionId", browserSessionId);
|
|
276
|
+
}
|
|
277
|
+
startSession();
|
|
278
|
+
});
|
|
279
|
+
document.addEventListener("visibilitychange", function logData() {
|
|
280
|
+
if (document.visibilityState === "hidden") {
|
|
281
|
+
navigator.sendBeacon(
|
|
282
|
+
"/api/logging/log-activity",
|
|
283
|
+
JSON.stringify({
|
|
284
|
+
article: af.article.id,
|
|
285
|
+
action: "AfSessionEnd",
|
|
286
|
+
parameters: {
|
|
287
|
+
_session: getSessionData()
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
);
|
|
291
|
+
} else {
|
|
292
|
+
startSession();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function getSessionData() {
|
|
297
|
+
return {
|
|
298
|
+
browserSessionId,
|
|
299
|
+
sessionStart,
|
|
300
|
+
sessionLength: Date.now() - sessionStart,
|
|
301
|
+
sessionId,
|
|
302
|
+
deviceId
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
189
306
|
// src/errorHandler.ts
|
|
190
307
|
var _a;
|
|
191
308
|
if (true) {
|
|
192
309
|
(_a = window.window) == null ? void 0 : _a.addEventListener("error", (event) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
file: event.filename,
|
|
198
|
-
line: (_d = event.lineno) != null ? _d : 0,
|
|
199
|
-
column: (_e = event.colno) != null ? _e : 0,
|
|
200
|
-
stack: (_g = (_f = event.error) == null ? void 0 : _f.stack) != null ? _g : null
|
|
201
|
-
};
|
|
202
|
-
fetch("/data/Logger/LogError", {
|
|
203
|
-
body: JSON.stringify(data),
|
|
204
|
-
headers: {
|
|
205
|
-
Accept: "application/json",
|
|
206
|
-
"Content-Type": "application/json; charset=utf-8",
|
|
207
|
-
"X-Requested-With": "XMLHttpRequest"
|
|
208
|
-
},
|
|
209
|
-
method: "POST"
|
|
210
|
-
});
|
|
211
|
-
} catch (ex) {
|
|
310
|
+
if (typeof event === "object" && "error" in event) {
|
|
311
|
+
logError(event.error);
|
|
312
|
+
} else if (typeof event === "object" && "message" in event) {
|
|
313
|
+
logError(event);
|
|
212
314
|
}
|
|
213
315
|
});
|
|
214
316
|
}
|
|
@@ -257,13 +359,13 @@ af.common = (() => {
|
|
|
257
359
|
function toLocalISODate(date) {
|
|
258
360
|
return date ? toLocalISODateTime(date).substring(0, 10) : null;
|
|
259
361
|
}
|
|
260
|
-
function pad(num) {
|
|
261
|
-
return String(num).padStart(
|
|
362
|
+
function pad(num, digits = 2) {
|
|
363
|
+
return String(num).padStart(digits, "0");
|
|
262
364
|
}
|
|
263
365
|
function toLocalISODateTime(date) {
|
|
264
366
|
return date ? "".concat(date.getFullYear(), "-").concat(pad(date.getMonth() + 1), "-").concat(pad(date.getDate()), "T").concat(pad(date.getHours()), ":").concat(pad(
|
|
265
367
|
date.getMinutes()
|
|
266
|
-
), ":").concat(pad(date.getSeconds()), ".").concat(pad(date.getMilliseconds())) : null;
|
|
368
|
+
), ":").concat(pad(date.getSeconds()), ".").concat(pad(date.getMilliseconds(), 3)) : null;
|
|
267
369
|
}
|
|
268
370
|
function toLocalDateTime(date) {
|
|
269
371
|
return date ? date.toISOString().substring(0, 16) : "";
|
|
@@ -357,9 +459,10 @@ af.common = (() => {
|
|
|
357
459
|
// src/parseFunc.ts
|
|
358
460
|
var funcRegex = /^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;
|
|
359
461
|
function parseFunc(func) {
|
|
462
|
+
var _a2;
|
|
360
463
|
var match = func.toString().match(funcRegex);
|
|
361
464
|
invariant(match, "Unable to parse function!");
|
|
362
|
-
return { name: match[1], args: match[2].split(","), body: match[3] };
|
|
465
|
+
return { name: (_a2 = func.name) != null ? _a2 : match[1], args: match[2].split(",").map((a) => a.trim()), body: match[3] };
|
|
363
466
|
}
|
|
364
467
|
|
|
365
468
|
// src/Namespace.ts
|
|
@@ -498,123 +601,6 @@ af.common = (() => {
|
|
|
498
601
|
return localized;
|
|
499
602
|
}
|
|
500
603
|
|
|
501
|
-
// src/log.ts
|
|
502
|
-
async function logActivity(activity, parameters = {}, timeElapsed = 0) {
|
|
503
|
-
var _a2;
|
|
504
|
-
try {
|
|
505
|
-
let response = await fetch("/api/logging/log-activity", {
|
|
506
|
-
method: "POST",
|
|
507
|
-
body: JSON.stringify({
|
|
508
|
-
article: af.article.id,
|
|
509
|
-
timeElapsed,
|
|
510
|
-
action: activity,
|
|
511
|
-
parameters: __spreadProps(__spreadValues({}, parameters), {
|
|
512
|
-
_session: getSessionData()
|
|
513
|
-
})
|
|
514
|
-
}),
|
|
515
|
-
headers: { "Content-Type": "application/json", Accept: "application/json" }
|
|
516
|
-
});
|
|
517
|
-
if (!response.ok) {
|
|
518
|
-
if ((_a2 = response.headers.get("Content-Type")) == null ? void 0 : _a2.includes("application/json")) {
|
|
519
|
-
let data = await response.json();
|
|
520
|
-
console.error(data.error);
|
|
521
|
-
} else {
|
|
522
|
-
console.error("".concat(response.status, " ").concat(response.statusText));
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
} catch (error) {
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
function startActivity(activity, startParameters = {}) {
|
|
529
|
-
let start = performance.now();
|
|
530
|
-
return (endParameters = {}) => logActivity(activity, __spreadValues(__spreadValues({}, startParameters), endParameters), performance.now() - start);
|
|
531
|
-
}
|
|
532
|
-
async function time(callback) {
|
|
533
|
-
let start = performance.now();
|
|
534
|
-
let returnValue = await callback();
|
|
535
|
-
return [returnValue, performance.now() - start];
|
|
536
|
-
}
|
|
537
|
-
async function logError(error) {
|
|
538
|
-
var _a2;
|
|
539
|
-
try {
|
|
540
|
-
if (!error)
|
|
541
|
-
return;
|
|
542
|
-
let data = typeof error === "string" ? { error } : typeof error === "object" ? "message" in error ? {
|
|
543
|
-
error: error.message,
|
|
544
|
-
stack: (_a2 = error.stack) != null ? _a2 : null
|
|
545
|
-
} : { error: error.toString() } : { error: "Unspecified error" };
|
|
546
|
-
console.error(error);
|
|
547
|
-
let result = await fetch("/data/Logger/LogError", {
|
|
548
|
-
method: "POST",
|
|
549
|
-
body: JSON.stringify(data),
|
|
550
|
-
headers: {
|
|
551
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
if (result.ok) {
|
|
555
|
-
return await result.json();
|
|
556
|
-
}
|
|
557
|
-
console.error(Error("Failed to log error"));
|
|
558
|
-
} catch (e) {
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
function getSessionId() {
|
|
562
|
-
var _a2;
|
|
563
|
-
return (_a2 = crypto.randomUUID) == null ? void 0 : _a2.call(crypto);
|
|
564
|
-
}
|
|
565
|
-
var sessionStart = Date.now();
|
|
566
|
-
var sessionId = getSessionId();
|
|
567
|
-
var deviceId = "";
|
|
568
|
-
var browserSessionId = "";
|
|
569
|
-
if ("document" in window) {
|
|
570
|
-
let startSession = () => {
|
|
571
|
-
var _a2;
|
|
572
|
-
return logActivity("AfSessionInit", {
|
|
573
|
-
"appframe-core": af.common.version,
|
|
574
|
-
"appframe-data": (_a2 = af.data) == null ? void 0 : _a2.version,
|
|
575
|
-
"app-version": af.article.version
|
|
576
|
-
});
|
|
577
|
-
};
|
|
578
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
579
|
-
deviceId = localStorage.getItem("_afDeviceId");
|
|
580
|
-
browserSessionId = sessionStorage.getItem("_afSessionId");
|
|
581
|
-
if (!deviceId) {
|
|
582
|
-
deviceId = getSessionId();
|
|
583
|
-
localStorage.setItem("_afDeviceId", deviceId);
|
|
584
|
-
}
|
|
585
|
-
if (!browserSessionId) {
|
|
586
|
-
browserSessionId = sessionId;
|
|
587
|
-
sessionStorage.setItem("_afSessionId", browserSessionId);
|
|
588
|
-
}
|
|
589
|
-
startSession();
|
|
590
|
-
});
|
|
591
|
-
document.addEventListener("visibilitychange", function logData() {
|
|
592
|
-
if (document.visibilityState === "hidden") {
|
|
593
|
-
navigator.sendBeacon(
|
|
594
|
-
"/api/logging/log-activity",
|
|
595
|
-
JSON.stringify({
|
|
596
|
-
article: af.article.id,
|
|
597
|
-
action: "AfSessionEnd",
|
|
598
|
-
parameters: {
|
|
599
|
-
_session: getSessionData()
|
|
600
|
-
}
|
|
601
|
-
})
|
|
602
|
-
);
|
|
603
|
-
} else {
|
|
604
|
-
startSession();
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
function getSessionData() {
|
|
609
|
-
return {
|
|
610
|
-
browserSessionId,
|
|
611
|
-
sessionStart,
|
|
612
|
-
sessionLength: Date.now() - sessionStart,
|
|
613
|
-
sessionId,
|
|
614
|
-
deviceId
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
|
|
618
604
|
// src/settings.ts
|
|
619
605
|
function getKey(article) {
|
|
620
606
|
const articleKey = article || af.article.id;
|
|
@@ -747,6 +733,6 @@ af.common = (() => {
|
|
|
747
733
|
}
|
|
748
734
|
|
|
749
735
|
// src/index.ts
|
|
750
|
-
var version = "2.11.
|
|
736
|
+
var version = "2.11.1";
|
|
751
737
|
return __toCommonJS(src_exports);
|
|
752
738
|
})();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var af=af||{};af.common=(()=>{var D=Object.defineProperty,fe=Object.defineProperties,pe=Object.getOwnPropertyDescriptor,me=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,q=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var j=(e,t,o)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,m=(e,t)=>{for(var o in t||(t={}))k.call(t,o)&&j(e,o,t[o]);if(q)for(var o of q(t))ye.call(t,o)&&j(e,o,t[o]);return e},B=(e,t)=>fe(e,me(t));var he=(e,t)=>{for(var o in t)D(e,o,{get:t[o],enumerable:!0})},Se=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ge(t))!k.call(e,r)&&r!==o&&D(e,r,{get:()=>t[r],enumerable:!(n=pe(t,r))||n.enumerable});return e};var xe=e=>Se(D({},"__esModule",{value:!0}),e);var l=(e,t,o)=>(j(e,typeof t!="symbol"?t+"":t,o),o);var Ie={};he(Ie,{ConfirmButtons:()=>M,SessionHandler:()=>p,UserSession:()=>L,alert:()=>se,confirm:()=>le,downloadBlob:()=>E,downloadRequest:()=>X,expose:()=>U,getLocalizedString:()=>d,getSessionData:()=>z,getSettings:()=>ie,getUserImage:()=>_,has:()=>y,invariant:()=>u,localStorage:()=>K,localize:()=>G,logActivity:()=>T,logError:()=>te,mitt:()=>I,openAlertDialog:()=>O,saveSettings:()=>ae,startActivity:()=>P,time:()=>ee,toLocalDateTime:()=>Z,toLocalISODate:()=>V,toLocalISODateTime:()=>R,version:()=>De,waitForDialog:()=>H});function I(e){return{all:e=e||new Map,on:function(t,o){var n=e.get(t);n?n.push(o):e.set(t,[o])},off:function(t,o){var n=e.get(t);n&&(o?n.splice(n.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var n=e.get(t);n&&n.slice().map(function(r){r(o)}),(n=e.get("*"))&&n.slice().map(function(r){r(t,o)})}}}var p=class{constructor(){l(this,"eventHandler",I())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,o){try{let n=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t==null||t(),a()};this.eventHandler.on("onAuthenticated",i)}),r=document.querySelector("dialog.session-expired-dialog");if(r)await n;else{r=document.createElement("dialog"),r.className="session-expired-dialog",r.style.display="flex",r.style.padding="0",r.style.left="50%",r.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";o!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",r.innerHTML='<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="'.concat(a,'" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>'),document.body.append(r),r.showModal(),await n,r.remove()}}catch(n){window.location.href="/login?ReturnUrl=".concat(encodeURIComponent(window.location.pathname)).concat(encodeURIComponent(window.location.search))}}attachEvent(t,o){return this.eventHandler.on(t,o)}detachEvent(t,o){return this.eventHandler.off(t,o)}};var L=class extends p{constructor(o){super();l(this,"amDesignator","a.m.");l(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);l(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);l(this,"decimalSeparator",".");l(this,"domain","OB");l(this,"email");l(this,"formats");l(this,"groupSeparator",null);l(this,"integratedSecurity",!1);l(this,"isDeveloper",!1);l(this,"login","");l(this,"loginType");l(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);l(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);l(this,"name");l(this,"pmDesignator","p.m.");l(this,"shortDateFormat","dd.MM.yyyy");l(this,"culture","en-GB");l(this,"uiculture","en-GB");this.formats={},Object.assign(this,o)}};var F;(F=window.window)==null||F.addEventListener("error",e=>{var t,o,n,r,a,i,f;try{let c={error:(n=(o=(t=e.error)==null?void 0:t.message)!=null?o:e.message)!=null?n:null,file:e.filename,line:(r=e.lineno)!=null?r:0,column:(a=e.colno)!=null?a:0,stack:(f=(i=e.error)==null?void 0:i.stack)!=null?f:null};fetch("/data/Logger/LogError",{body:JSON.stringify(c),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(c){}});function J(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var N=class{constructor(){l(this,"isPersisted",()=>!0)}getLocalStorageKey(t,o){return o?["common",t].join("."):J(t)}get(t,o,n){let r=this.getLocalStorageKey(t,n),a=localStorage.getItem(r);return a!==null?JSON.parse(a):o}set(t,o,n){localStorage.setItem(this.getLocalStorageKey(t,n),JSON.stringify(o))}remove(t,o){let n=this.getLocalStorageKey(t,o);return localStorage.getItem(n)!==null?(localStorage.removeItem(n),!0):!1}clear(){let t=J("");for(let o in localStorage)o.slice(0,t.length)===t&&localStorage.removeItem(o)}},K=new N;function V(e){return e?R(e).substring(0,10):null}function g(e){return String(e).padStart(2,"0")}function R(e){return e?"".concat(e.getFullYear(),"-").concat(g(e.getMonth()+1),"-").concat(g(e.getDate()),"T").concat(g(e.getHours()),":").concat(g(e.getMinutes()),":").concat(g(e.getSeconds()),".").concat(g(e.getMilliseconds())):null}function Z(e){return e?e.toISOString().substring(0,16):""}function E(e,t){return new Promise(function(o,n){try{let r=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=r,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(r),o()},250)}catch(r){n(r)}})}function u(e,t){if(e)return;let o=typeof t=="function"?t():t;throw new Error(o!=null?o:"Invariant failed")}async function X(e,{fileName:t,signal:o,onProgress:n}){var a;let r=0;n==null||n({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if((a=i.headers.get("content-type"))!=null&&a.includes("application/json")){let c=await i.json();u(!c.error,c.error)}throw new Error("".concat(i.status," ").concat(i.statusText))}try{let c=i.body.getReader(),A=new ReadableStream({start:function(h){function S(){return c.read().then(function(s){if(s.done){h.close();return}return r+=s.value.length,n==null||n({bytesReceived:r,status:"downloading"}),h.enqueue(s.value),S()})}return S()}});i=new Response(A)}catch(c){}let f=await i.blob();n==null||n({bytesReceived:r,status:"downloaded"}),await E(f,t),n==null||n({bytesReceived:r,status:"completed"})}catch(i){o!=null&&o.aborted?n==null||n({status:"cancelled"}):n==null||n({error:i.message,status:"error"})}}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var be=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function $(e){var t=e.toString().match(be);return u(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function Y(){}Y.prototype=Object.create(null);var W=Y;function C(e,t){if(typeof e=="object"){if(typeof t=="string"){let o=t.split(".");return C(e,o)}else if(Array.isArray(t)){let o=e;for(let n=0;n<t.length;n++)o=o[t[n]]=o[t[n]]||new W;return o}}}function U(e,t,o={}){if(Array.isArray(t))for(let n of t){let{name:r}=$(n);u(r,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),U(e,n)}else{let n,r;if(typeof t=="function"&&(n=$(t).name),typeof e=="string"){let a=e.split(".");n||(n=a[a.length-1],a=a.slice(0,a.length-1)),r=C(window,a)}else n&&(typeof e=="object"||typeof e=="function")?r=e:u(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");y(r,n)&&(o==null?void 0:o.overwrite)!==!0?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var ve={xs:64,sm:128,md:256,lg:512,xl:void 0};function _(e,t,o,n="xs"){if(e&&typeof e=="object")return _(e.primKey,e.login,e.hash,e.size);if(!e||!o)return"";let r=ve[n];return"/api/data/blob/EmployeesLookup/".concat(e,"/Image/").concat(encodeURIComponent(t!=null?t:"")).concat(t?".":"").concat(encodeURIComponent(o),".jpg").concat(r?"?width=".concat(r):"")}async function we(e){try{let t=await fetch("/api/user/localize/new/".concat(af.article.id),{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch(t){}return e}function d(e,t){var o,n;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((n=(o=window.af)==null?void 0:o.article)==null?void 0:n.i18n)!==void 0){if(!y(af.article.i18n,e)){af.article.i18n[e]=e;let r=we(e).then(a=>(af.article.i18n[e]=a,a));if(t)return r}return af.article.i18n[e]}else return e}function G(e,...t){u(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let o=e.map((r,a)=>a===e.length-1?r:"".concat(r,"$").concat(a)).join(""),n=d(o);return t.forEach((r,a)=>{n=n.replace("$"+a,r)}),n}async function T(e,t={},o=0){var n;try{let r=await fetch("/api/logging/log-activity",{method:"POST",body:JSON.stringify({article:af.article.id,timeElapsed:o,action:e,parameters:B(m({},t),{_session:z()})}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(!r.ok)if((n=r.headers.get("Content-Type"))!=null&&n.includes("application/json")){let a=await r.json();console.error(a.error)}else console.error("".concat(r.status," ").concat(r.statusText))}catch(r){}}function P(e,t={}){let o=performance.now();return(n={})=>T(e,m(m({},t),n),performance.now()-o)}async function ee(e){let t=performance.now();return[await e(),performance.now()-t]}async function te(e){var t;try{if(!e)return;let o=typeof e=="string"?{error:e}:typeof e=="object"?"message"in e?{error:e.message,stack:(t=e.stack)!=null?t:null}:{error:e.toString()}:{error:"Unspecified error"};console.error(e);let n=await fetch("/data/Logger/LogError",{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json; charset=utf-8"}});if(n.ok)return await n.json();console.error(Error("Failed to log error"))}catch(o){}}function ne(){var e;return(e=crypto.randomUUID)==null?void 0:e.call(crypto)}var Q=Date.now(),oe=ne(),b="",v="";if("document"in window){let e=()=>{var t;return T("AfSessionInit",{"appframe-core":af.common.version,"appframe-data":(t=af.data)==null?void 0:t.version,"app-version":af.article.version})};document.addEventListener("DOMContentLoaded",()=>{b=localStorage.getItem("_afDeviceId"),v=sessionStorage.getItem("_afSessionId"),b||(b=ne(),localStorage.setItem("_afDeviceId",b)),v||(v=oe,sessionStorage.setItem("_afSessionId",v)),e()}),document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"?navigator.sendBeacon("/api/logging/log-activity",JSON.stringify({article:af.article.id,action:"AfSessionEnd",parameters:{_session:z()}})):e()})}function z(){return{browserSessionId:v,sessionStart:Q,sessionLength:Date.now()-Q,sessionId:oe,deviceId:b}}function re(e){let t=e||af.article.id;return"".concat(t,".").concat(af.userSession.login)}function ie(e,t){if(!(af!=null&&af.userSession))return null;let o=re(t),n=JSON.parse(localStorage.getItem(o)||"{}");return e?n[e]||null:n}function ae(e,t,o){if(!(af!=null&&af.userSession))return;let n=re(o),r=JSON.parse(localStorage.getItem(n)||"{}");typeof t<"u"?r[e]=t:r=e,localStorage.setItem(n,JSON.stringify(r))}var Ae='\n <dialog class="alert-dialog">\n <form method="dialog">\n <article></article>\n <footer>\n <menu></menu>\n </footer>\n </form>\n </dialog>\n';if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=Ae,document.body.append(e)}function H(e,t="No"){return new Promise(o=>{let n=new AbortController;e.addEventListener("close",()=>{o(e.returnValue),n.abort()},{signal:n.signal}),e.addEventListener("cancel",()=>{o(t),n.abort()},{signal:n.signal})})}var w=new Map;async function O({buttons:e,content:t,className:o,id:n,title:r}){var h,S;if(n&&w.has(n))return await w.get(n);let a=document.querySelector("#AlertDialogTemplate");if(!a)throw Error("No alert dialog template found");let i=(h=a.content.firstElementChild)==null?void 0:h.cloneNode(!0),f=i==null?void 0:i.querySelector("article"),c=i==null?void 0:i.querySelector("footer menu");if(!i||!f||!c)throw Error("Invalid alert dialog template");if(o&&o.split(/\s+/).forEach(s=>i==null?void 0:i.classList.add(s)),r){let s=document.createElement("header");s.append(r),(S=f.parentNode)==null||S.insertBefore(s,f)}f.appendChild(typeof t=="string"?document.createTextNode(t):t);for(let{label:s,value:ce,primary:ue}of e){let de=document.createElement("li"),x=document.createElement("button");x.value=ce,ue&&x.classList.add("primary"),x.textContent=s,de.appendChild(x),c.appendChild(x)}document.body.appendChild(i),i.showModal();let A=H(i).then(s=>(n&&w.has(n)&&w.delete(n),i&&document.body.removeChild(i),s));return n&&w.set(n,A),await A}var M=(o=>(o[o.YesNo=0]="YesNo",o[o.OkCancel=1]="OkCancel",o))(M||{});async function le(e,t={}){let{buttons:o=0,title:n}=t,r=o===1?[{label:d("OK"),value:"yes",primary:!0},{label:d("Cancel"),value:"no"}]:[{label:d("Yes"),value:"yes",primary:!0},{label:d("No"),value:"no"}];return await O({content:e,buttons:r,className:"alert-dialog-confirm",title:n})==="yes"}async function se(e,t={}){await O(m({content:e,className:"alert-dialog-alert",buttons:[{label:d("OK"),value:"ok",primary:!0}]},t))}var De="2.11.0";return xe(Ie);})();
|
|
1
|
+
var af=af||{};af.common=(()=>{var I=Object.defineProperty,fe=Object.defineProperties,me=Object.getOwnPropertyDescriptor,pe=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var N=(e,t,n)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))B.call(t,n)&&N(e,n,t[n]);if(k)for(var n of k(t))ye.call(t,n)&&N(e,n,t[n]);return e},F=(e,t)=>fe(e,pe(t));var he=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},Se=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ge(t))!B.call(e,r)&&r!==n&&I(e,r,{get:()=>t[r],enumerable:!(o=me(t,r))||o.enumerable});return e};var be=e=>Se(I({},"__esModule",{value:!0}),e);var l=(e,t,n)=>(N(e,typeof t!="symbol"?t+"":t,n),n);var Ie={};he(Ie,{ConfirmButtons:()=>q,SessionHandler:()=>f,UserSession:()=>E,alert:()=>se,confirm:()=>le,downloadBlob:()=>O,downloadRequest:()=>ee,expose:()=>_,getLocalizedString:()=>u,getSessionData:()=>z,getSettings:()=>ie,getUserImage:()=>H,has:()=>y,invariant:()=>c,localStorage:()=>W,localize:()=>oe,logActivity:()=>T,logError:()=>w,mitt:()=>L,openAlertDialog:()=>j,saveSettings:()=>ae,startActivity:()=>K,time:()=>V,toLocalDateTime:()=>P,toLocalISODate:()=>Q,toLocalISODateTime:()=>$,version:()=>Ae,waitForDialog:()=>M});function L(e){return{all:e=e||new Map,on:function(t,n){var o=e.get(t);o?o.push(n):e.set(t,[n])},off:function(t,n){var o=e.get(t);o&&(n?o.splice(o.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var o=e.get(t);o&&o.slice().map(function(r){r(n)}),(o=e.get("*"))&&o.slice().map(function(r){r(t,n)})}}}var f=class{constructor(){l(this,"eventHandler",L())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let o=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t==null||t(),a()};this.eventHandler.on("onAuthenticated",i)}),r=document.querySelector("dialog.session-expired-dialog");if(r)await o;else{r=document.createElement("dialog"),r.className="session-expired-dialog",r.style.display="flex",r.style.padding="0",r.style.left="50%",r.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",r.innerHTML='<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="'.concat(a,'" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>'),document.body.append(r),r.showModal(),await o,r.remove()}}catch(o){window.location.href="/login?ReturnUrl=".concat(encodeURIComponent(window.location.pathname)).concat(encodeURIComponent(window.location.search))}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var E=class extends f{constructor(n){super();l(this,"amDesignator","a.m.");l(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);l(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);l(this,"decimalSeparator",".");l(this,"domain","OB");l(this,"email");l(this,"formats");l(this,"groupSeparator",null);l(this,"integratedSecurity",!1);l(this,"isDeveloper",!1);l(this,"login","");l(this,"loginType");l(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);l(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);l(this,"name");l(this,"pmDesignator","p.m.");l(this,"shortDateFormat","dd.MM.yyyy");l(this,"culture","en-GB");l(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};async function T(e,t={},n=0){var o;try{let r=await fetch("/api/logging/log-activity",{method:"POST",body:JSON.stringify({article:af.article.id,timeElapsed:n,action:e,parameters:F(p({},t),{_session:z()})}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(!r.ok)if((o=r.headers.get("Content-Type"))!=null&&o.includes("application/json")){let a=await r.json();console.error(a.error)}else console.error("".concat(r.status," ").concat(r.statusText))}catch(r){}}function K(e,t={}){let n=performance.now();return(o={})=>T(e,p(p({},t),o),performance.now()-n)}async function V(e){let t=performance.now();return[await e(),performance.now()-t]}async function w(e){var t;try{if(!e)return;let n=typeof e=="string"?{error:e}:typeof e=="object"?"message"in e?{error:e.message,stack:(t=e.stack)!=null?t:null}:{error:e.toString()}:{error:"Unspecified error"};console.error(e);let o=await fetch("/data/Logger/LogError",{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json; charset=utf-8"}});if(o.ok)return await o.json();console.error(Error("Failed to log error"))}catch(n){}}function Z(){var e;return(e=crypto.randomUUID)==null?void 0:e.call(crypto)}var J=Date.now(),Y=Z(),x="",v="";if("document"in window){let e=()=>{var t;return T("AfSessionInit",{"appframe-core":af.common.version,"appframe-data":(t=af.data)==null?void 0:t.version,"app-version":af.article.version})};document.addEventListener("DOMContentLoaded",()=>{x=localStorage.getItem("_afDeviceId"),v=sessionStorage.getItem("_afSessionId"),x||(x=Z(),localStorage.setItem("_afDeviceId",x)),v||(v=Y,sessionStorage.setItem("_afSessionId",v)),e()}),document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"?navigator.sendBeacon("/api/logging/log-activity",JSON.stringify({article:af.article.id,action:"AfSessionEnd",parameters:{_session:z()}})):e()})}function z(){return{browserSessionId:v,sessionStart:J,sessionLength:Date.now()-J,sessionId:Y,deviceId:x}}var X;(X=window.window)==null||X.addEventListener("error",e=>{typeof e=="object"&&"error"in e?w(e.error):typeof e=="object"&&"message"in e&&w(e)});function G(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var R=class{constructor(){l(this,"isPersisted",()=>!0)}getLocalStorageKey(t,n){return n?["common",t].join("."):G(t)}get(t,n,o){let r=this.getLocalStorageKey(t,o),a=localStorage.getItem(r);return a!==null?JSON.parse(a):n}set(t,n,o){localStorage.setItem(this.getLocalStorageKey(t,o),JSON.stringify(n))}remove(t,n){let o=this.getLocalStorageKey(t,n);return localStorage.getItem(o)!==null?(localStorage.removeItem(o),!0):!1}clear(){let t=G("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},W=new R;function Q(e){return e?$(e).substring(0,10):null}function g(e,t=2){return String(e).padStart(t,"0")}function $(e){return e?"".concat(e.getFullYear(),"-").concat(g(e.getMonth()+1),"-").concat(g(e.getDate()),"T").concat(g(e.getHours()),":").concat(g(e.getMinutes()),":").concat(g(e.getSeconds()),".").concat(g(e.getMilliseconds(),3)):null}function P(e){return e?e.toISOString().substring(0,16):""}function O(e,t){return new Promise(function(n,o){try{let r=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=r,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(r),n()},250)}catch(r){o(r)}})}function c(e,t){if(e)return;let n=typeof t=="function"?t():t;throw new Error(n!=null?n:"Invariant failed")}async function ee(e,{fileName:t,signal:n,onProgress:o}){var a;let r=0;o==null||o({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if((a=i.headers.get("content-type"))!=null&&a.includes("application/json")){let d=await i.json();c(!d.error,d.error)}throw new Error("".concat(i.status," ").concat(i.statusText))}try{let d=i.body.getReader(),A=new ReadableStream({start:function(h){function S(){return d.read().then(function(s){if(s.done){h.close();return}return r+=s.value.length,o==null||o({bytesReceived:r,status:"downloading"}),h.enqueue(s.value),S()})}return S()}});i=new Response(A)}catch(d){}let m=await i.blob();o==null||o({bytesReceived:r,status:"downloaded"}),await O(m,t),o==null||o({bytesReceived:r,status:"completed"})}catch(i){n!=null&&n.aborted?o==null||o({status:"cancelled"}):o==null||o({error:i.message,status:"error"})}}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var xe=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function C(e){var n;var t=e.toString().match(xe);return c(t,"Unable to parse function!"),{name:(n=e.name)!=null?n:t[1],args:t[2].split(",").map(o=>o.trim()),body:t[3]}}function te(){}te.prototype=Object.create(null);var ne=te;function U(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return U(e,n)}else if(Array.isArray(t)){let n=e;for(let o=0;o<t.length;o++)n=n[t[o]]=n[t[o]]||new ne;return n}}}function _(e,t,n={}){if(Array.isArray(t))for(let o of t){let{name:r}=C(o);c(r,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),_(e,o)}else{let o,r;if(typeof t=="function"&&(o=C(t).name),typeof e=="string"){let a=e.split(".");o||(o=a[a.length-1],a=a.slice(0,a.length-1)),r=U(window,a)}else o&&(typeof e=="object"||typeof e=="function")?r=e:c(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");y(r,o)&&(n==null?void 0:n.overwrite)!==!0?console.warn([e,o].join(".")+" is already defined!"):r[o]=t}}var ve={xs:64,sm:128,md:256,lg:512,xl:void 0};function H(e,t,n,o="xs"){if(e&&typeof e=="object")return H(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let r=ve[o];return"/api/data/blob/EmployeesLookup/".concat(e,"/Image/").concat(encodeURIComponent(t!=null?t:"")).concat(t?".":"").concat(encodeURIComponent(n),".jpg").concat(r?"?width=".concat(r):"")}async function we(e){try{let t=await fetch("/api/user/localize/new/".concat(af.article.id),{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch(t){}return e}function u(e,t){var n,o;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((o=(n=window.af)==null?void 0:n.article)==null?void 0:o.i18n)!==void 0){if(!y(af.article.i18n,e)){af.article.i18n[e]=e;let r=we(e).then(a=>(af.article.i18n[e]=a,a));if(t)return r}return af.article.i18n[e]}else return e}function oe(e,...t){c(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let n=e.map((r,a)=>a===e.length-1?r:"".concat(r,"$").concat(a)).join(""),o=u(n);return t.forEach((r,a)=>{o=o.replace("$"+a,r)}),o}function re(e){let t=e||af.article.id;return"".concat(t,".").concat(af.userSession.login)}function ie(e,t){if(!(af!=null&&af.userSession))return null;let n=re(t),o=JSON.parse(localStorage.getItem(n)||"{}");return e?o[e]||null:o}function ae(e,t,n){if(!(af!=null&&af.userSession))return;let o=re(n),r=JSON.parse(localStorage.getItem(o)||"{}");typeof t<"u"?r[e]=t:r=e,localStorage.setItem(o,JSON.stringify(r))}var De='\n <dialog class="alert-dialog">\n <form method="dialog">\n <article></article>\n <footer>\n <menu></menu>\n </footer>\n </form>\n </dialog>\n';if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=De,document.body.append(e)}function M(e,t="No"){return new Promise(n=>{let o=new AbortController;e.addEventListener("close",()=>{n(e.returnValue),o.abort()},{signal:o.signal}),e.addEventListener("cancel",()=>{n(t),o.abort()},{signal:o.signal})})}var D=new Map;async function j({buttons:e,content:t,className:n,id:o,title:r}){var h,S;if(o&&D.has(o))return await D.get(o);let a=document.querySelector("#AlertDialogTemplate");if(!a)throw Error("No alert dialog template found");let i=(h=a.content.firstElementChild)==null?void 0:h.cloneNode(!0),m=i==null?void 0:i.querySelector("article"),d=i==null?void 0:i.querySelector("footer menu");if(!i||!m||!d)throw Error("Invalid alert dialog template");if(n&&n.split(/\s+/).forEach(s=>i==null?void 0:i.classList.add(s)),r){let s=document.createElement("header");s.append(r),(S=m.parentNode)==null||S.insertBefore(s,m)}m.appendChild(typeof t=="string"?document.createTextNode(t):t);for(let{label:s,value:ce,primary:ue}of e){let de=document.createElement("li"),b=document.createElement("button");b.value=ce,ue&&b.classList.add("primary"),b.textContent=s,de.appendChild(b),d.appendChild(b)}document.body.appendChild(i),i.showModal();let A=M(i).then(s=>(o&&D.has(o)&&D.delete(o),i&&document.body.removeChild(i),s));return o&&D.set(o,A),await A}var q=(n=>(n[n.YesNo=0]="YesNo",n[n.OkCancel=1]="OkCancel",n))(q||{});async function le(e,t={}){let{buttons:n=0,title:o}=t,r=n===1?[{label:u("OK"),value:"yes",primary:!0},{label:u("Cancel"),value:"no"}]:[{label:u("Yes"),value:"yes",primary:!0},{label:u("No"),value:"no"}];return await j({content:e,buttons:r,className:"alert-dialog-confirm",title:o})==="yes"}async function se(e,t={}){await j(p({content:e,className:"alert-dialog-alert",buttons:[{label:u("OK"),value:"ok",primary:!0}]},t))}var Ae="2.11.1";return be(Ie);})();
|
|
2
2
|
//# sourceMappingURL=af.common.legacy.min.js.map
|