drill-widgets 2.7.14 → 2.7.15
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/drill-widgets.es.js +128 -73
- package/dist/drill-widgets.umd.js +59 -23
- package/dist/lib.d.ts +2 -0
- package/package.json +1 -1
package/dist/drill-widgets.es.js
CHANGED
|
@@ -282,7 +282,7 @@ U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[H("elementProper
|
|
|
282
282
|
* Copyright 2017 Google LLC
|
|
283
283
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
284
284
|
*/
|
|
285
|
-
const V = globalThis, X = V.trustedTypes, we = X ? X.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ze = "$lit$",
|
|
285
|
+
const V = globalThis, X = V.trustedTypes, we = X ? X.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ze = "$lit$", E = `lit$${Math.random().toFixed(9).slice(2)}$`, Ie = "?" + E, Ye = `<${Ie}>`, I = document, j = () => I.createComment(""), B = (s) => s === null || typeof s != "object" && typeof s != "function", fe = Array.isArray, qe = (s) => fe(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", re = `[
|
|
286
286
|
\f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Se = /-->/g, ke = />/g, T = RegExp(`>|${re}(?:([^\\s"'>=/]+)(${re}*=${re}*(?:[^
|
|
287
287
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), $e = /'/g, De = /"/g, Pe = /^(?:script|style|textarea|title)$/i, Ke = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), d = Ke(1), P = Symbol.for("lit-noChange"), x = Symbol.for("lit-nothing"), Ce = /* @__PURE__ */ new WeakMap(), F = I.createTreeWalker(I, 129);
|
|
288
288
|
function Ue(s, e) {
|
|
@@ -297,7 +297,7 @@ const Je = (s, e) => {
|
|
|
297
297
|
let p, c, u = -1, h = 0;
|
|
298
298
|
for (; h < l.length && (o.lastIndex = h, c = o.exec(l), c !== null); ) h = o.lastIndex, o === R ? c[1] === "!--" ? o = Se : c[1] !== void 0 ? o = ke : c[2] !== void 0 ? (Pe.test(c[2]) && (n = RegExp("</" + c[2], "g")), o = T) : c[3] !== void 0 && (o = T) : o === T ? c[0] === ">" ? (o = n ?? R, u = -1) : c[1] === void 0 ? u = -2 : (u = o.lastIndex - c[2].length, p = c[1], o = c[3] === void 0 ? T : c[3] === '"' ? De : $e) : o === De || o === $e ? o = T : o === Se || o === ke ? o = R : (o = T, n = void 0);
|
|
299
299
|
const g = o === T && s[a + 1].startsWith("/>") ? " " : "";
|
|
300
|
-
r += o === R ? l + Ye : u >= 0 ? (i.push(p), l.slice(0, u) + ze + l.slice(u) +
|
|
300
|
+
r += o === R ? l + Ye : u >= 0 ? (i.push(p), l.slice(0, u) + ze + l.slice(u) + E + g) : l + E + (u === -2 ? a : g);
|
|
301
301
|
}
|
|
302
302
|
return [Ue(s, r + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
303
303
|
};
|
|
@@ -314,11 +314,11 @@ class Q {
|
|
|
314
314
|
for (; (n = F.nextNode()) !== null && l.length < a; ) {
|
|
315
315
|
if (n.nodeType === 1) {
|
|
316
316
|
if (n.hasAttributes()) for (const u of n.getAttributeNames()) if (u.endsWith(ze)) {
|
|
317
|
-
const h = c[o++], g = n.getAttribute(u).split(
|
|
317
|
+
const h = c[o++], g = n.getAttribute(u).split(E), v = /([.?@])?(.*)/.exec(h);
|
|
318
318
|
l.push({ type: 1, index: r, name: v[2], strings: g, ctor: v[1] === "." ? Ze : v[1] === "?" ? et : v[1] === "@" ? tt : se }), n.removeAttribute(u);
|
|
319
|
-
} else u.startsWith(
|
|
319
|
+
} else u.startsWith(E) && (l.push({ type: 6, index: r }), n.removeAttribute(u));
|
|
320
320
|
if (Pe.test(n.tagName)) {
|
|
321
|
-
const u = n.textContent.split(
|
|
321
|
+
const u = n.textContent.split(E), h = u.length - 1;
|
|
322
322
|
if (h > 0) {
|
|
323
323
|
n.textContent = X ? X.emptyScript : "";
|
|
324
324
|
for (let g = 0; g < h; g++) n.append(u[g], j()), F.nextNode(), l.push({ type: 2, index: ++r });
|
|
@@ -328,7 +328,7 @@ class Q {
|
|
|
328
328
|
} else if (n.nodeType === 8) if (n.data === Ie) l.push({ type: 2, index: r });
|
|
329
329
|
else {
|
|
330
330
|
let u = -1;
|
|
331
|
-
for (; (u = n.data.indexOf(
|
|
331
|
+
for (; (u = n.data.indexOf(E, u + 1)) !== -1; ) l.push({ type: 7, index: r }), u += E.length - 1;
|
|
332
332
|
}
|
|
333
333
|
r++;
|
|
334
334
|
}
|
|
@@ -599,11 +599,11 @@ function C(s) {
|
|
|
599
599
|
function b(s) {
|
|
600
600
|
return C({ ...s, state: !0, attribute: !1 });
|
|
601
601
|
}
|
|
602
|
-
const
|
|
602
|
+
const w = [];
|
|
603
603
|
for (let s = 0; s < 256; ++s)
|
|
604
|
-
|
|
604
|
+
w.push((s + 256).toString(16).slice(1));
|
|
605
605
|
function ot(s, e = 0) {
|
|
606
|
-
return (
|
|
606
|
+
return (w[s[e + 0]] + w[s[e + 1]] + w[s[e + 2]] + w[s[e + 3]] + "-" + w[s[e + 4]] + w[s[e + 5]] + "-" + w[s[e + 6]] + w[s[e + 7]] + "-" + w[s[e + 8]] + w[s[e + 9]] + "-" + w[s[e + 10]] + w[s[e + 11]] + w[s[e + 12]] + w[s[e + 13]] + w[s[e + 14]] + w[s[e + 15]]).toLowerCase();
|
|
607
607
|
}
|
|
608
608
|
let le;
|
|
609
609
|
const at = new Uint8Array(16);
|
|
@@ -615,11 +615,11 @@ function lt() {
|
|
|
615
615
|
}
|
|
616
616
|
return le(at);
|
|
617
617
|
}
|
|
618
|
-
const dt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
619
|
-
function
|
|
618
|
+
const dt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ae = { randomUUID: dt };
|
|
619
|
+
function A(s, e, t) {
|
|
620
620
|
var n;
|
|
621
|
-
if (
|
|
622
|
-
return
|
|
621
|
+
if (Ae.randomUUID && !s)
|
|
622
|
+
return Ae.randomUUID();
|
|
623
623
|
s = s || {};
|
|
624
624
|
const i = s.random ?? ((n = s.rng) == null ? void 0 : n.call(s)) ?? lt();
|
|
625
625
|
if (i.length < 16)
|
|
@@ -3031,6 +3031,26 @@ const pt = O`
|
|
|
3031
3031
|
width: 16px;
|
|
3032
3032
|
height: 16px;
|
|
3033
3033
|
}
|
|
3034
|
+
|
|
3035
|
+
.assignment-name-fields {
|
|
3036
|
+
display: flex;
|
|
3037
|
+
gap: 8px;
|
|
3038
|
+
margin-top: 8px;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
.assignment-name-input {
|
|
3042
|
+
flex: 1;
|
|
3043
|
+
padding: 8px 12px;
|
|
3044
|
+
border: 1px solid #d1d5db;
|
|
3045
|
+
border-radius: 6px;
|
|
3046
|
+
font-size: 14px;
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
.assignment-name-input:focus {
|
|
3050
|
+
outline: none;
|
|
3051
|
+
border-color: #3b82f6;
|
|
3052
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
3053
|
+
}
|
|
3034
3054
|
`, ht = O`
|
|
3035
3055
|
/* Modal Overlay */
|
|
3036
3056
|
.modal-overlay {
|
|
@@ -3418,7 +3438,7 @@ var gt = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, S = (s, e,
|
|
|
3418
3438
|
(o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
|
|
3419
3439
|
return i && n && gt(e, t, n), n;
|
|
3420
3440
|
};
|
|
3421
|
-
let
|
|
3441
|
+
let _ = class extends L {
|
|
3422
3442
|
constructor() {
|
|
3423
3443
|
super(...arguments), this._templateData = {
|
|
3424
3444
|
name: "",
|
|
@@ -3427,7 +3447,7 @@ let w = class extends L {
|
|
|
3427
3447
|
}, this._showStepModal = !1, this._stepFormData = {
|
|
3428
3448
|
title: "",
|
|
3429
3449
|
description: ""
|
|
3430
|
-
}, this._draggedStepId = null, this._dragOverStepId = null, this._selectedStepId = null, this._questions = [], this._editingStepId = null, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "", this._openMenuStepId = null;
|
|
3450
|
+
}, this._draggedStepId = null, this._dragOverStepId = null, this._selectedStepId = null, this._questions = [], this._editingStepId = null, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "", this._stepAssignmentFirstName = "", this._stepAssignmentLastName = "", this._openMenuStepId = null;
|
|
3431
3451
|
}
|
|
3432
3452
|
connectedCallback() {
|
|
3433
3453
|
super.connectedCallback(), this.workflow ? (this._templateData = { ...this.workflow }, this.workflow.steps && this.workflow.steps.length > 0 && (this._selectedStepId = this.workflow.steps[0].id), console.log("Builder loaded with existing workflow:", this.workflow.name)) : this._templateData = this._getDefaultWorkflowData(), this._clickOutsideHandler = () => this._closeStepMenu(), document.addEventListener("click", this._clickOutsideHandler);
|
|
@@ -3441,7 +3461,7 @@ let w = class extends L {
|
|
|
3441
3461
|
}
|
|
3442
3462
|
_getDefaultWorkflowData() {
|
|
3443
3463
|
const s = {
|
|
3444
|
-
id:
|
|
3464
|
+
id: A(),
|
|
3445
3465
|
title: "Step 1",
|
|
3446
3466
|
description: "",
|
|
3447
3467
|
order: 1,
|
|
@@ -3453,7 +3473,7 @@ let w = class extends L {
|
|
|
3453
3473
|
status: "pending"
|
|
3454
3474
|
};
|
|
3455
3475
|
return {
|
|
3456
|
-
id:
|
|
3476
|
+
id: A(),
|
|
3457
3477
|
name: "",
|
|
3458
3478
|
description: "",
|
|
3459
3479
|
steps: [s]
|
|
@@ -3481,7 +3501,7 @@ let w = class extends L {
|
|
|
3481
3501
|
var s, e, t;
|
|
3482
3502
|
if ((s = this._templateData.name) != null && s.trim()) {
|
|
3483
3503
|
const i = {
|
|
3484
|
-
id: this._templateData.id ||
|
|
3504
|
+
id: this._templateData.id || A(),
|
|
3485
3505
|
name: this._templateData.name,
|
|
3486
3506
|
description: this._templateData.description || "",
|
|
3487
3507
|
steps: this._templateData.steps || []
|
|
@@ -3500,7 +3520,7 @@ let w = class extends L {
|
|
|
3500
3520
|
console.log("🔹 Closing step creation modal"), this._showStepModal = !1, this._editingStepId = null, this._stepFormData = {
|
|
3501
3521
|
title: "",
|
|
3502
3522
|
description: ""
|
|
3503
|
-
}, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "";
|
|
3523
|
+
}, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "", this._stepAssignmentFirstName = "", this._stepAssignmentLastName = "";
|
|
3504
3524
|
}
|
|
3505
3525
|
_handleStepFormInput(s) {
|
|
3506
3526
|
const e = s.target, { name: t, value: i } = e;
|
|
@@ -3518,10 +3538,17 @@ let w = class extends L {
|
|
|
3518
3538
|
_editStep(s) {
|
|
3519
3539
|
var t;
|
|
3520
3540
|
const e = (t = this._templateData.steps) == null ? void 0 : t.find((i) => i.id === s);
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3541
|
+
if (e) {
|
|
3542
|
+
if (this._editingStepId = s, this._stepFormData = {
|
|
3543
|
+
title: e.title,
|
|
3544
|
+
description: e.description
|
|
3545
|
+
}, this._stepAssignmentCategory = e.assignment.category, this._stepAssignmentType = e.assignment.type, this._stepAssignmentTarget = e.assignment.email || e.assignment.targetId || "", this._stepAssignmentType === "specific_user") {
|
|
3546
|
+
const n = (e.assignment.targetName || "").split(" ");
|
|
3547
|
+
this._stepAssignmentFirstName = n[0] || "", this._stepAssignmentLastName = n.slice(1).join(" ") || "";
|
|
3548
|
+
} else
|
|
3549
|
+
this._stepAssignmentFirstName = "", this._stepAssignmentLastName = "";
|
|
3550
|
+
this._showStepModal = !0, this._closeStepMenu(), console.log("Editing step:", s);
|
|
3551
|
+
}
|
|
3525
3552
|
}
|
|
3526
3553
|
_duplicateStep(s) {
|
|
3527
3554
|
var n, r;
|
|
@@ -3529,12 +3556,12 @@ let w = class extends L {
|
|
|
3529
3556
|
if (!e) return;
|
|
3530
3557
|
const t = this._templateData.steps || [], i = {
|
|
3531
3558
|
...e,
|
|
3532
|
-
id:
|
|
3559
|
+
id: A(),
|
|
3533
3560
|
title: `${e.title} (Copy)`,
|
|
3534
3561
|
order: t.length + 1,
|
|
3535
3562
|
elements: ((r = e.elements) == null ? void 0 : r.map((o) => ({
|
|
3536
3563
|
...o,
|
|
3537
|
-
id:
|
|
3564
|
+
id: A()
|
|
3538
3565
|
}))) || []
|
|
3539
3566
|
};
|
|
3540
3567
|
this._templateData = {
|
|
@@ -3561,7 +3588,7 @@ let w = class extends L {
|
|
|
3561
3588
|
category: this._stepAssignmentCategory,
|
|
3562
3589
|
type: this._stepAssignmentType
|
|
3563
3590
|
};
|
|
3564
|
-
if (this._stepAssignmentType === "specific_user" && this._stepAssignmentTarget ? e.email = this._stepAssignmentTarget : this._stepAssignmentType === "instance_role_assignee_select" && this._stepAssignmentTarget && (e.targetId = this._stepAssignmentTarget), this._editingStepId) {
|
|
3591
|
+
if (this._stepAssignmentType === "specific_user" && this._stepAssignmentTarget ? (e.email = this._stepAssignmentTarget, this._stepAssignmentFirstName || this._stepAssignmentLastName ? e.targetName = `${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim() : e.targetName = this._stepAssignmentTarget) : this._stepAssignmentType === "instance_role_assignee_select" && this._stepAssignmentTarget && (e.targetId = this._stepAssignmentTarget), this._editingStepId) {
|
|
3565
3592
|
const n = s.map((r) => {
|
|
3566
3593
|
var o;
|
|
3567
3594
|
return r.id === this._editingStepId ? {
|
|
@@ -3577,7 +3604,7 @@ let w = class extends L {
|
|
|
3577
3604
|
}, console.log("✅ Step updated:", this._editingStepId);
|
|
3578
3605
|
} else {
|
|
3579
3606
|
const n = {
|
|
3580
|
-
id:
|
|
3607
|
+
id: A(),
|
|
3581
3608
|
title: this._stepFormData.title.trim(),
|
|
3582
3609
|
description: ((i = this._stepFormData.description) == null ? void 0 : i.trim()) || "",
|
|
3583
3610
|
order: s.length + 1,
|
|
@@ -3651,7 +3678,7 @@ let w = class extends L {
|
|
|
3651
3678
|
}
|
|
3652
3679
|
if (["text", "html", "divider", "markdown"].includes(s)) {
|
|
3653
3680
|
let r = {
|
|
3654
|
-
id:
|
|
3681
|
+
id: A(),
|
|
3655
3682
|
type: s,
|
|
3656
3683
|
order: (((i = e.elements) == null ? void 0 : i.length) || 0) + 1
|
|
3657
3684
|
};
|
|
@@ -3681,7 +3708,7 @@ Use **bold** and *italic* text.`;
|
|
|
3681
3708
|
}, console.log("✅ Content element added to step:", this._selectedStepId);
|
|
3682
3709
|
} else {
|
|
3683
3710
|
const r = {
|
|
3684
|
-
id:
|
|
3711
|
+
id: A(),
|
|
3685
3712
|
// Simple ID generation
|
|
3686
3713
|
type: s,
|
|
3687
3714
|
// Default type
|
|
@@ -3712,7 +3739,7 @@ Use **bold** and *italic* text.`;
|
|
|
3712
3739
|
return;
|
|
3713
3740
|
}
|
|
3714
3741
|
let t = {
|
|
3715
|
-
id:
|
|
3742
|
+
id: A(),
|
|
3716
3743
|
type: s,
|
|
3717
3744
|
order: (((n = e.elements) == null ? void 0 : n.length) || 0) + 1
|
|
3718
3745
|
};
|
|
@@ -4525,6 +4552,28 @@ Use **bold** and *italic* text.`;
|
|
|
4525
4552
|
</div>
|
|
4526
4553
|
|
|
4527
4554
|
${this._stepAssignmentType === "specific_user" ? d`
|
|
4555
|
+
<div class="assignment-name-fields">
|
|
4556
|
+
<input
|
|
4557
|
+
type="text"
|
|
4558
|
+
class="assignment-name-input"
|
|
4559
|
+
placeholder="First name"
|
|
4560
|
+
.value=${this._stepAssignmentFirstName}
|
|
4561
|
+
@input=${(t) => {
|
|
4562
|
+
const i = t.target;
|
|
4563
|
+
this._stepAssignmentFirstName = i.value;
|
|
4564
|
+
}}
|
|
4565
|
+
/>
|
|
4566
|
+
<input
|
|
4567
|
+
type="text"
|
|
4568
|
+
class="assignment-name-input"
|
|
4569
|
+
placeholder="Last name"
|
|
4570
|
+
.value=${this._stepAssignmentLastName}
|
|
4571
|
+
@input=${(t) => {
|
|
4572
|
+
const i = t.target;
|
|
4573
|
+
this._stepAssignmentLastName = i.value;
|
|
4574
|
+
}}
|
|
4575
|
+
/>
|
|
4576
|
+
</div>
|
|
4528
4577
|
<input
|
|
4529
4578
|
type="email"
|
|
4530
4579
|
class="assignment-select"
|
|
@@ -4979,7 +5028,7 @@ Use **bold** and *italic* text.`;
|
|
|
4979
5028
|
`;
|
|
4980
5029
|
}
|
|
4981
5030
|
};
|
|
4982
|
-
|
|
5031
|
+
_.styles = O`
|
|
4983
5032
|
${pt}
|
|
4984
5033
|
${ct}
|
|
4985
5034
|
${ut}
|
|
@@ -4988,49 +5037,55 @@ w.styles = O`
|
|
|
4988
5037
|
`;
|
|
4989
5038
|
S([
|
|
4990
5039
|
b()
|
|
4991
|
-
],
|
|
5040
|
+
], _.prototype, "_templateData", 2);
|
|
5041
|
+
S([
|
|
5042
|
+
b()
|
|
5043
|
+
], _.prototype, "_showStepModal", 2);
|
|
5044
|
+
S([
|
|
5045
|
+
b()
|
|
5046
|
+
], _.prototype, "_stepFormData", 2);
|
|
4992
5047
|
S([
|
|
4993
5048
|
b()
|
|
4994
|
-
],
|
|
5049
|
+
], _.prototype, "_draggedStepId", 2);
|
|
4995
5050
|
S([
|
|
4996
5051
|
b()
|
|
4997
|
-
],
|
|
5052
|
+
], _.prototype, "_dragOverStepId", 2);
|
|
4998
5053
|
S([
|
|
4999
5054
|
b()
|
|
5000
|
-
],
|
|
5055
|
+
], _.prototype, "_selectedStepId", 2);
|
|
5001
5056
|
S([
|
|
5002
5057
|
b()
|
|
5003
|
-
],
|
|
5058
|
+
], _.prototype, "_questions", 2);
|
|
5004
5059
|
S([
|
|
5005
5060
|
b()
|
|
5006
|
-
],
|
|
5061
|
+
], _.prototype, "_editingStepId", 2);
|
|
5007
5062
|
S([
|
|
5008
5063
|
b()
|
|
5009
|
-
],
|
|
5064
|
+
], _.prototype, "_stepAssignmentCategory", 2);
|
|
5010
5065
|
S([
|
|
5011
5066
|
b()
|
|
5012
|
-
],
|
|
5067
|
+
], _.prototype, "_stepAssignmentType", 2);
|
|
5013
5068
|
S([
|
|
5014
5069
|
b()
|
|
5015
|
-
],
|
|
5070
|
+
], _.prototype, "_stepAssignmentTarget", 2);
|
|
5016
5071
|
S([
|
|
5017
5072
|
b()
|
|
5018
|
-
],
|
|
5073
|
+
], _.prototype, "_stepAssignmentFirstName", 2);
|
|
5019
5074
|
S([
|
|
5020
5075
|
b()
|
|
5021
|
-
],
|
|
5076
|
+
], _.prototype, "_stepAssignmentLastName", 2);
|
|
5022
5077
|
S([
|
|
5023
5078
|
C({ attribute: !1 })
|
|
5024
|
-
],
|
|
5079
|
+
], _.prototype, "onCancel", 2);
|
|
5025
5080
|
S([
|
|
5026
5081
|
C({ attribute: !1 })
|
|
5027
|
-
],
|
|
5082
|
+
], _.prototype, "workflow", 2);
|
|
5028
5083
|
S([
|
|
5029
5084
|
b()
|
|
5030
|
-
],
|
|
5031
|
-
|
|
5085
|
+
], _.prototype, "_openMenuStepId", 2);
|
|
5086
|
+
_ = S([
|
|
5032
5087
|
Le("builder-widget")
|
|
5033
|
-
],
|
|
5088
|
+
], _);
|
|
5034
5089
|
class ft {
|
|
5035
5090
|
constructor(e, t) {
|
|
5036
5091
|
this.signaturePads = e, this.savedSignatures = t;
|
|
@@ -6470,7 +6525,7 @@ class ue extends $t {
|
|
|
6470
6525
|
}
|
|
6471
6526
|
}
|
|
6472
6527
|
ue.directiveName = "unsafeHTML", ue.resultType = 1;
|
|
6473
|
-
const
|
|
6528
|
+
const Ee = kt(ue);
|
|
6474
6529
|
class D {
|
|
6475
6530
|
static renderMarkdown(e) {
|
|
6476
6531
|
return e.replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim, "<strong>$1</strong>").replace(/\*(.*?)\*/gim, "<em>$1</em>").replace(/`(.*?)`/gim, "<code>$1</code>").replace(/^> (.*$)/gim, "<blockquote>$1</blockquote>").replace(/\n/gim, "<br>");
|
|
@@ -6486,7 +6541,7 @@ class D {
|
|
|
6486
6541
|
return d`
|
|
6487
6542
|
<div class="content-element markdown-content">
|
|
6488
6543
|
<div class="markdown-text">
|
|
6489
|
-
${
|
|
6544
|
+
${Ee(D.renderMarkdown(e.content))}
|
|
6490
6545
|
</div>
|
|
6491
6546
|
</div>
|
|
6492
6547
|
`;
|
|
@@ -6502,7 +6557,7 @@ class D {
|
|
|
6502
6557
|
static renderHtml(e) {
|
|
6503
6558
|
return d`
|
|
6504
6559
|
<div class="content-element html-content">
|
|
6505
|
-
<div class="html-content-wrapper">${
|
|
6560
|
+
<div class="html-content-wrapper">${Ee(e.content)}</div>
|
|
6506
6561
|
</div>
|
|
6507
6562
|
`;
|
|
6508
6563
|
}
|
|
@@ -6818,8 +6873,8 @@ class de {
|
|
|
6818
6873
|
r(u), a !== "preview" && o(e, c);
|
|
6819
6874
|
}
|
|
6820
6875
|
}
|
|
6821
|
-
var Ct = Object.defineProperty,
|
|
6822
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
6876
|
+
var Ct = Object.defineProperty, At = Object.getOwnPropertyDescriptor, y = (s, e, t, i) => {
|
|
6877
|
+
for (var n = i > 1 ? void 0 : i ? At(e, t) : e, r = s.length - 1, o; r >= 0; r--)
|
|
6823
6878
|
(o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
|
|
6824
6879
|
return i && n && Ct(e, t, n), n;
|
|
6825
6880
|
};
|
|
@@ -7602,61 +7657,61 @@ f.CONTENT_ELEMENT_TYPES = [
|
|
|
7602
7657
|
"divider",
|
|
7603
7658
|
"markdown"
|
|
7604
7659
|
];
|
|
7605
|
-
|
|
7660
|
+
y([
|
|
7606
7661
|
C({ type: Object })
|
|
7607
7662
|
], f.prototype, "instance", 2);
|
|
7608
|
-
|
|
7663
|
+
y([
|
|
7609
7664
|
C({ type: Object })
|
|
7610
7665
|
], f.prototype, "workflow", 2);
|
|
7611
|
-
|
|
7666
|
+
y([
|
|
7612
7667
|
C({ type: String })
|
|
7613
7668
|
], f.prototype, "mode", 2);
|
|
7614
|
-
|
|
7669
|
+
y([
|
|
7615
7670
|
C({ type: Boolean })
|
|
7616
7671
|
], f.prototype, "isLoading", 2);
|
|
7617
|
-
|
|
7672
|
+
y([
|
|
7618
7673
|
C({ type: Object })
|
|
7619
7674
|
], f.prototype, "currentUser", 2);
|
|
7620
|
-
|
|
7675
|
+
y([
|
|
7621
7676
|
C({ type: Function })
|
|
7622
7677
|
], f.prototype, "onSignatureCaptured", 2);
|
|
7623
|
-
|
|
7678
|
+
y([
|
|
7624
7679
|
C({ type: Function })
|
|
7625
7680
|
], f.prototype, "onFileUploaded", 2);
|
|
7626
|
-
|
|
7681
|
+
y([
|
|
7627
7682
|
b()
|
|
7628
7683
|
], f.prototype, "_currentStepIndex", 2);
|
|
7629
|
-
|
|
7684
|
+
y([
|
|
7630
7685
|
b()
|
|
7631
7686
|
], f.prototype, "_formData", 2);
|
|
7632
|
-
|
|
7687
|
+
y([
|
|
7633
7688
|
b()
|
|
7634
7689
|
], f.prototype, "_validationErrors", 2);
|
|
7635
|
-
|
|
7690
|
+
y([
|
|
7636
7691
|
b()
|
|
7637
7692
|
], f.prototype, "_internalCompletedSteps", 2);
|
|
7638
|
-
|
|
7693
|
+
y([
|
|
7639
7694
|
b()
|
|
7640
7695
|
], f.prototype, "_formRestorationComplete", 2);
|
|
7641
|
-
|
|
7696
|
+
y([
|
|
7642
7697
|
b()
|
|
7643
7698
|
], f.prototype, "_savedSignatures", 2);
|
|
7644
|
-
|
|
7699
|
+
y([
|
|
7645
7700
|
b()
|
|
7646
7701
|
], f.prototype, "_replacingSignatures", 2);
|
|
7647
|
-
|
|
7702
|
+
y([
|
|
7648
7703
|
b()
|
|
7649
7704
|
], f.prototype, "_savedInstance", 2);
|
|
7650
|
-
|
|
7705
|
+
y([
|
|
7651
7706
|
b()
|
|
7652
7707
|
], f.prototype, "_isSubmitted", 2);
|
|
7653
|
-
|
|
7708
|
+
y([
|
|
7654
7709
|
b()
|
|
7655
7710
|
], f.prototype, "_userStepsSubmitted", 2);
|
|
7656
|
-
|
|
7711
|
+
y([
|
|
7657
7712
|
b()
|
|
7658
7713
|
], f.prototype, "_justSaved", 2);
|
|
7659
|
-
f =
|
|
7714
|
+
f = y([
|
|
7660
7715
|
Le("runner-widget")
|
|
7661
7716
|
], f);
|
|
7662
7717
|
function Jt(s, e = {}) {
|
|
@@ -7687,7 +7742,7 @@ function Jt(s, e = {}) {
|
|
|
7687
7742
|
<hr class="print-question-separator" />
|
|
7688
7743
|
|
|
7689
7744
|
${r ? Vt(s, o) : ""}
|
|
7690
|
-
${s.steps.map((l) =>
|
|
7745
|
+
${s.steps.map((l) => Et(l)).join(`
|
|
7691
7746
|
`)}
|
|
7692
7747
|
</div>
|
|
7693
7748
|
</body>
|
|
@@ -7696,7 +7751,7 @@ function Jt(s, e = {}) {
|
|
|
7696
7751
|
generatedAt: o
|
|
7697
7752
|
};
|
|
7698
7753
|
}
|
|
7699
|
-
function
|
|
7754
|
+
function Et(s) {
|
|
7700
7755
|
return `
|
|
7701
7756
|
<div class="print-step">
|
|
7702
7757
|
<!-- Step Header -->
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:We,defineProperty:
|
|
9
|
+
*/const{is:We,defineProperty:je,getOwnPropertyDescriptor:Ve,getOwnPropertyNames:Be,getOwnPropertySymbols:Qe,getPrototypeOf:Ge}=Object,T=globalThis,we=T.trustedTypes,Ye=we?we.emptyScript:"",ae=T.reactiveElementPolyfillSupport,W=(s,e)=>s,K={toAttribute(s,e){switch(e){case Boolean:s=s?Ye:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},le=(s,e)=>!We(s,e),Se={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:le};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),T.litPropertyMetadata??(T.litPropertyMetadata=new WeakMap);let O=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);n!==void 0&&je(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:r}=Ve(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:n,set(o){const a=n==null?void 0:n.call(this);r==null||r.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Se}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=Ge(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,i=[...Be(t),...Qe(t)];for(const n of i)this.createProperty(n,t[n])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,n]of t)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const n=this._$Eu(t,i);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(ye(n))}else e!==void 0&&t.push(ye(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var r;const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(n!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:K).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){var r,o;const i=this.constructor,n=i._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const a=i.getPropertyOptions(n),l=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:K;this._$Em=n,this[n]=l.fromAttribute(t,a.type)??((o=this._$Ej)==null?void 0:o.get(n))??null,this._$Em=null}}requestUpdate(e,t,i){var n;if(e!==void 0){const r=this.constructor,o=this[e];if(i??(i=r.getPropertyOptions(e)),!((i.hasChanged??le)(o,t)||i.useDefault&&i.reflect&&o===((n=this._$Ej)==null?void 0:n.get(e))&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),n===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,o]of n){const{wrapped:a}=o,l=this[r];a!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,o,l)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[W("elementProperties")]=new Map,O[W("finalized")]=new Map,ae==null||ae({ReactiveElement:O}),(T.reactiveElementVersions??(T.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const j=globalThis,J=j.trustedTypes,ke=J?J.createPolicy("lit-html",{createHTML:s=>s}):void 0,$e="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+F,qe=`<${De}>`,z=document,V=()=>z.createComment(""),B=s=>s===null||typeof s!="object"&&typeof s!="function",de=Array.isArray,Ke=s=>de(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",pe=`[
|
|
14
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ae=/>/g,I=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ee=/'/g,Me=/"/g,Te=/^(?:script|style|textarea|title)$/i,Je=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),d=Je(1),P=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),Fe=new WeakMap,U=z.createTreeWalker(z,129);function ze(s,e){if(!de(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Xe=(s,e)=>{const t=s.length-1,i=[];let n,r=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const l=s[a];let p,c,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,c=o.exec(l),c!==null);)h=o.lastIndex,o===Q?c[1]==="!--"?o=Ce:c[1]!==void 0?o=Ae:c[2]!==void 0?(Te.test(c[2])&&(n=RegExp("</"+c[2],"g")),o=I):c[3]!==void 0&&(o=I):o===I?c[0]===">"?(o=n??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?I:c[3]==='"'?Me:Ee):o===Me||o===Ee?o=I:o===Ce||o===Ae?o=Q:(o=I,n=void 0);const m=o===I&&s[a+1].startsWith("/>")?" ":"";r+=o===Q?l+qe:u>=0?(i.push(p),l.slice(0,u)+$e+l.slice(u)+F+m):l+F+(u===-2?a:m)}return[ze(s,r+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class G{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,o=0;const a=e.length-1,l=this.parts,[p,c]=Xe(e,t);if(this.el=G.createElement(p,i),U.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=U.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const u of n.getAttributeNames())if(u.endsWith($e)){const h=c[o++],m=n.getAttribute(u).split(F),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:r,name:v[2],strings:m,ctor:v[1]==="."?et:v[1]==="?"?tt:v[1]==="@"?it:X}),n.removeAttribute(u)}else u.startsWith(F)&&(l.push({type:6,index:r}),n.removeAttribute(u));if(Te.test(n.tagName)){const u=n.textContent.split(F),h=u.length-1;if(h>0){n.textContent=J?J.emptyScript:"";for(let m=0;m<h;m++)n.append(u[m],V()),U.nextNode(),l.push({type:2,index:++r});n.append(u[h],V())}}}else if(n.nodeType===8)if(n.data===De)l.push({type:2,index:r});else{let u=-1;for(;(u=n.data.indexOf(F,u+1))!==-1;)l.push({type:7,index:r}),u+=F.length-1}r++}}static createElement(e,t){const i=z.createElement("template");return i.innerHTML=e,i}}function R(s,e,t=s,i){var o,a;if(e===P)return e;let n=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const r=B(e)?void 0:e._$litDirective$;return(n==null?void 0:n.constructor)!==r&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),r===void 0?n=void 0:(n=new r(s),n._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=n:t._$Cl=n),n!==void 0&&(e=R(s,n._$AS(s,e.values),n,i)),e}class Ze{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,n=((e==null?void 0:e.creationScope)??z).importNode(t,!0);U.currentNode=n;let r=U.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new Y(r,r.nextSibling,this,e):l.type===1?p=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(p=new st(r,this,e)),this._$AV.push(p),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=U.nextNode(),o++)}return U.currentNode=z,n}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Y{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,n){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=R(this,e,t),B(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==P&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==x&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:i}=e,n=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=G.createElement(ze(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===n)this._$AH.p(t);else{const o=new Ze(n,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new G(e)),t}k(e){de(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const r of e)n===t.length?t.push(i=new Y(this.O(V()),this.O(V()),this,this.options)):i=t[n],i._$AI(r),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,n,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=x}_$AI(e,t=this,i,n){const r=this.strings;let o=!1;if(r===void 0)e=R(this,e,t,0),o=!B(e)||e!==this._$AH&&e!==P,o&&(this._$AH=e);else{const a=e;let l,p;for(e=r[0],l=0;l<r.length-1;l++)p=R(this,a[i+l],t,l),p===P&&(p=this._$AH[l]),o||(o=!B(p)||p!==this._$AH[l]),p===x?e=x:e!==x&&(e+=(p??"")+r[l+1]),this._$AH[l]=p}o&&!n&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class et extends X{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}class tt extends X{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}}class it extends X{constructor(e,t,i,n,r){super(e,t,i,n,r),this.type=5}_$AI(e,t=this){if((e=R(this,e,t,0)??x)===P)return;const i=this._$AH,n=e===x&&i!==x||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==x&&(i===x||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class st{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){R(this,e)}}const ce=j.litHtmlPolyfillSupport;ce==null||ce(G,Y),(j.litHtmlVersions??(j.litHtmlVersions=[])).push("3.3.0");const nt=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let n=i._$litPart$;if(n===void 0){const r=(t==null?void 0:t.renderBefore)??null;i._$litPart$=n=new Y(e.insertBefore(V(),r),r,void 0,t??{})}return n._$AI(s),n};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const L=globalThis;let H=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=nt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return
|
|
19
|
+
*/const L=globalThis;let H=class extends O{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=nt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return P}};H._$litElement$=!0,H.finalized=!0,(Oe=L.litElementHydrateSupport)==null||Oe.call(L,{LitElement:H});const ue=L.litElementPolyfillSupport;ue==null||ue({LitElement:H}),(L.litElementVersions??(L.litElementVersions=[])).push("4.2.0");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const rt={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:le},ot=(s=rt,e,t)=>{const{kind:i,metadata:n}=t;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),i==="setter"&&((s=Object.create(s)).wrapped=!0),r.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,s)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(i==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,s)}}throw Error("Unsupported decorator location: "+i)};function
|
|
27
|
+
*/const rt={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:le},ot=(s=rt,e,t)=>{const{kind:i,metadata:n}=t;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),i==="setter"&&((s=Object.create(s)).wrapped=!0),r.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,s)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(i==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,s)}}throw Error("Unsupported decorator location: "+i)};function A(s){return(e,t)=>typeof t=="object"?ot(s,e,t):((i,n,r)=>{const o=n.hasOwnProperty(r);return n.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(n,r):void 0})(s,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function f(s){return A({...s,state:!0,attribute:!1})}const w=[];for(let s=0;s<256;++s)w.push((s+256).toString(16).slice(1));function at(s,e=0){return(w[s[e+0]]+w[s[e+1]]+w[s[e+2]]+w[s[e+3]]+"-"+w[s[e+4]]+w[s[e+5]]+"-"+w[s[e+6]]+w[s[e+7]]+"-"+w[s[e+8]]+w[s[e+9]]+"-"+w[s[e+10]]+w[s[e+11]]+w[s[e+12]]+w[s[e+13]]+w[s[e+14]]+w[s[e+15]]).toLowerCase()}let he;const lt=new Uint8Array(16);function dt(){if(!he){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");he=crypto.getRandomValues.bind(crypto)}return he(lt)}const Pe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function E(s,e,t){var n;if(Pe.randomUUID&&!s)return Pe.randomUUID();s=s||{};const i=s.random??((n=s.rng)==null?void 0:n.call(s))??dt();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,at(i)}const pt=N`
|
|
32
32
|
:host {
|
|
33
33
|
display: block;
|
|
34
34
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
border-radius: 4px;
|
|
653
653
|
border-left: 3px solid #e5e7eb;
|
|
654
654
|
}
|
|
655
|
-
`,
|
|
655
|
+
`,Ue=N`
|
|
656
656
|
/* Builder Step Styles */
|
|
657
657
|
.steps-list {
|
|
658
658
|
display: flex;
|
|
@@ -2433,6 +2433,26 @@
|
|
|
2433
2433
|
width: 16px;
|
|
2434
2434
|
height: 16px;
|
|
2435
2435
|
}
|
|
2436
|
+
|
|
2437
|
+
.assignment-name-fields {
|
|
2438
|
+
display: flex;
|
|
2439
|
+
gap: 8px;
|
|
2440
|
+
margin-top: 8px;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
.assignment-name-input {
|
|
2444
|
+
flex: 1;
|
|
2445
|
+
padding: 8px 12px;
|
|
2446
|
+
border: 1px solid #d1d5db;
|
|
2447
|
+
border-radius: 6px;
|
|
2448
|
+
font-size: 14px;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
.assignment-name-input:focus {
|
|
2452
|
+
outline: none;
|
|
2453
|
+
border-color: #3b82f6;
|
|
2454
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
2455
|
+
}
|
|
2436
2456
|
`,ht=N`
|
|
2437
2457
|
/* Modal Overlay */
|
|
2438
2458
|
.modal-overlay {
|
|
@@ -2814,9 +2834,9 @@
|
|
|
2814
2834
|
flex-direction: column;
|
|
2815
2835
|
}
|
|
2816
2836
|
}
|
|
2817
|
-
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,S=(s,e,t,i)=>{for(var n=i>1?void 0:i?mt(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&>(e,t,n),n};let
|
|
2837
|
+
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,S=(s,e,t,i)=>{for(var n=i>1?void 0:i?mt(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&>(e,t,n),n};let _=class extends H{constructor(){super(...arguments),this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[],this._editingStepId=null,this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName="",this._openMenuStepId=null}connectedCallback(){super.connectedCallback(),this.workflow?(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Builder loaded with existing workflow:",this.workflow.name)):this._templateData=this._getDefaultWorkflowData(),this._clickOutsideHandler=()=>this._closeStepMenu(),document.addEventListener("click",this._clickOutsideHandler)}disconnectedCallback(){super.disconnectedCallback(),this._clickOutsideHandler&&document.removeEventListener("click",this._clickOutsideHandler)}updated(s){s.has("workflow")&&this.workflow&&(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Workflow property changed, reloading template data"))}_getDefaultWorkflowData(){const s={id:E(),title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:E(),name:"",description:"",steps:[s]}}_handleTitleChange(s){const e=s.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(s){const e=s.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var s;console.log("🚫 Builder Widget: Cancel button clicked"),(s=this.onCancel)==null||s.call(this)}_handleSave(){var s,e,t;if((s=this._templateData.name)!=null&&s.trim()){const i={id:this._templateData.id||E(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[]};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(i,null,2)),this.workflow?(console.log("Calling onWorkflowUpdated callback"),(e=this.onWorkflowUpdated)==null||e.call(this,i)):(console.log("Calling onWorkflowCreated callback"),(t=this.onWorkflowCreated)==null||t.call(this,i))}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._editingStepId=null,this._stepFormData={title:"",description:""},this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName=""}_handleStepFormInput(s){const e=s.target,{name:t,value:i}=e;this._stepFormData={...this._stepFormData,[t]:i}}_toggleStepMenu(s,e){s.stopPropagation(),this._openMenuStepId=this._openMenuStepId===e?null:e}_closeStepMenu(){this._openMenuStepId=null}_editStep(s){var t;const e=(t=this._templateData.steps)==null?void 0:t.find(i=>i.id===s);if(e){if(this._editingStepId=s,this._stepFormData={title:e.title,description:e.description},this._stepAssignmentCategory=e.assignment.category,this._stepAssignmentType=e.assignment.type,this._stepAssignmentTarget=e.assignment.email||e.assignment.targetId||"",this._stepAssignmentType==="specific_user"){const n=(e.assignment.targetName||"").split(" ");this._stepAssignmentFirstName=n[0]||"",this._stepAssignmentLastName=n.slice(1).join(" ")||""}else this._stepAssignmentFirstName="",this._stepAssignmentLastName="";this._showStepModal=!0,this._closeStepMenu(),console.log("Editing step:",s)}}_duplicateStep(s){var n,r;const e=(n=this._templateData.steps)==null?void 0:n.find(o=>o.id===s);if(!e)return;const t=this._templateData.steps||[],i={...e,id:E(),title:`${e.title} (Copy)`,order:t.length+1,elements:((r=e.elements)==null?void 0:r.map(o=>({...o,id:E()})))||[]};this._templateData={...this._templateData,steps:[...t,i]},this._closeStepMenu(),console.log("Step duplicated:",s)}_deleteStep(s){const e=(this._templateData.steps||[]).filter(t=>t.id!==s);e.forEach((t,i)=>{t.order=i+1}),this._templateData={...this._templateData,steps:e},this._selectedStepId===s&&(this._selectedStepId=e.length>0?e[0].id:null),this._closeStepMenu(),console.log("Step deleted:",s)}_createStep(){var t,i;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const s=this._templateData.steps||[],e={category:this._stepAssignmentCategory,type:this._stepAssignmentType};if(this._stepAssignmentType==="specific_user"&&this._stepAssignmentTarget?(e.email=this._stepAssignmentTarget,this._stepAssignmentFirstName||this._stepAssignmentLastName?e.targetName=`${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim():e.targetName=this._stepAssignmentTarget):this._stepAssignmentType==="instance_role_assignee_select"&&this._stepAssignmentTarget&&(e.targetId=this._stepAssignmentTarget),this._editingStepId){const n=s.map(r=>{var o;return r.id===this._editingStepId?{...r,title:this._stepFormData.title.trim(),description:((o=this._stepFormData.description)==null?void 0:o.trim())||"",assignment:e}:r});this._templateData={...this._templateData,steps:n},console.log("✅ Step updated:",this._editingStepId)}else{const n={id:E(),title:this._stepFormData.title.trim(),description:((i=this._stepFormData.description)==null?void 0:i.trim())||"",order:s.length+1,assignment:e,elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...s,n]},this._selectedStepId=n.id,console.log("✅ Step created and selected:",n)}this._closeStepModal()}_selectStep(s){this._selectedStepId=s,console.log("🎯 Step selected:",s)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(s=>s.id===this._selectedStepId)||null}_handleDragStart(s,e){this._draggedStepId=e,s.dataTransfer&&(s.dataTransfer.effectAllowed="move",s.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(s){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(s,e){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(s){const e=s.relatedTarget;s.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(s,e){if(s.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],i=t.findIndex(a=>a.id===this._draggedStepId),n=t.findIndex(a=>a.id===e);if(i===-1||n===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,l)=>`${l+1}: ${a.title}`));const r=[...t],[o]=r.splice(i,1);r.splice(n,0,o),r.forEach((a,l)=>{a.order=l+1}),console.log("🔄 After reorder:",r.map((a,l)=>`${l+1}: ${a.title}`)),this._templateData={...this._templateData,steps:r},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(s="text_input"){var i,n;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(s)){let r={id:E(),type:s,order:(((i=e.elements)==null?void 0:i.length)||0)+1};switch(s){case"text":r.content="Enter your text content here...";break;case"html":r.content="<p>Enter your HTML content here...</p>";break;case"divider":r.content="",r.caption="Section Divider";break;case"markdown":r.content=`## Enter your markdown content here...
|
|
2818
2838
|
|
|
2819
|
-
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const r={id:
|
|
2839
|
+
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const r={id:E(),type:s,label:this._getQuestionTypeDisplayName(s),order:(((n=e.elements)==null?void 0:n.length)||0)+1,required:!1};["select","radio","checkbox"].includes(s)&&(r.options=["Option 1","Option 2"]);const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(s){var n;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add content without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}let t={id:E(),type:s,order:(((n=e.elements)==null?void 0:n.length)||0)+1};switch(s){case"text":t.content="Enter your text content here...";break;case"html":t.content="<p>Enter your HTML content here...</p>";break;case"image":t.content="",t.url="",t.alt="",t.caption="";break;case"video":t.content="",t.url="",t.caption="";break;case"file":t.content="",t.url="",t.caption="";break;case"divider":t.content="",t.caption="Section Divider";break;case"markdown":t.content=`## Enter your markdown content here...
|
|
2820
2840
|
|
|
2821
2841
|
Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r.id===this._selectedStepId?{...r,elements:[...r.elements||[],t]}:r);this._templateData={...this._templateData,steps:i},console.log("✅ Content element added to step:",this._selectedStepId)}_updateQuestion(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(n=>{var r;return n.id===this._selectedStepId?{...n,elements:((r=n.elements)==null?void 0:r.map(o=>o.id===s?{...o,...e}:o))||[]}:n});this._templateData={...this._templateData,steps:t}}_updateContentElement(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(n=>{var r;return n.id===this._selectedStepId?{...n,elements:((r=n.elements)==null?void 0:r.map(o=>o.id===s?{...o,...e}:o))||[]}:n});this._templateData={...this._templateData,steps:t}}_deleteQuestion(s){var t;if(!this._selectedStepId)return;const e=(t=this._templateData.steps)==null?void 0:t.map(i=>{var n;return i.id===this._selectedStepId?{...i,elements:((n=i.elements)==null?void 0:n.filter(r=>r.id!==s))||[]}:i});this._templateData={...this._templateData,steps:e},console.log("🗑️ Question deleted:",s)}_renderQuestionTypeSpecificFields(s){switch(s.type){case"select":case"radio":return d`
|
|
2822
2842
|
<div class="question-options-section">
|
|
@@ -3297,6 +3317,22 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3297
3317
|
</div>
|
|
3298
3318
|
|
|
3299
3319
|
${this._stepAssignmentType==="specific_user"?d`
|
|
3320
|
+
<div class="assignment-name-fields">
|
|
3321
|
+
<input
|
|
3322
|
+
type="text"
|
|
3323
|
+
class="assignment-name-input"
|
|
3324
|
+
placeholder="First name"
|
|
3325
|
+
.value=${this._stepAssignmentFirstName}
|
|
3326
|
+
@input=${t=>{const i=t.target;this._stepAssignmentFirstName=i.value}}
|
|
3327
|
+
/>
|
|
3328
|
+
<input
|
|
3329
|
+
type="text"
|
|
3330
|
+
class="assignment-name-input"
|
|
3331
|
+
placeholder="Last name"
|
|
3332
|
+
.value=${this._stepAssignmentLastName}
|
|
3333
|
+
@input=${t=>{const i=t.target;this._stepAssignmentLastName=i.value}}
|
|
3334
|
+
/>
|
|
3335
|
+
</div>
|
|
3300
3336
|
<input
|
|
3301
3337
|
type="email"
|
|
3302
3338
|
class="assignment-select"
|
|
@@ -3679,13 +3715,13 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3679
3715
|
</div>
|
|
3680
3716
|
</div>
|
|
3681
3717
|
</div>
|
|
3682
|
-
`}};
|
|
3718
|
+
`}};_.styles=N`
|
|
3683
3719
|
${pt}
|
|
3684
3720
|
${ct}
|
|
3685
3721
|
${ut}
|
|
3686
|
-
${
|
|
3722
|
+
${Ue}
|
|
3687
3723
|
${ht}
|
|
3688
|
-
`,S([
|
|
3724
|
+
`,S([f()],_.prototype,"_templateData",2),S([f()],_.prototype,"_showStepModal",2),S([f()],_.prototype,"_stepFormData",2),S([f()],_.prototype,"_draggedStepId",2),S([f()],_.prototype,"_dragOverStepId",2),S([f()],_.prototype,"_selectedStepId",2),S([f()],_.prototype,"_questions",2),S([f()],_.prototype,"_editingStepId",2),S([f()],_.prototype,"_stepAssignmentCategory",2),S([f()],_.prototype,"_stepAssignmentType",2),S([f()],_.prototype,"_stepAssignmentTarget",2),S([f()],_.prototype,"_stepAssignmentFirstName",2),S([f()],_.prototype,"_stepAssignmentLastName",2),S([A({attribute:!1})],_.prototype,"onCancel",2),S([A({attribute:!1})],_.prototype,"workflow",2),S([f()],_.prototype,"_openMenuStepId",2),_=S([Ie("builder-widget")],_);class ft{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,i){if(i==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let n=!0;const r={};for(const o of e.elements)if(this.isQuestionElement(o)){const a=o;if(a.required){const l=this.validateQuestion(a,t[a.id]);l&&(n=!1,r[a.id]=l.message)}}return{isValid:n,errors:r}}validateQuestion(e,t){switch(e.type){case"checkbox":return this.validateCheckbox(e,t);case"signature":return this.validateSignature(e,t);case"file_upload":return this.validateFileUpload(e,t);default:return this.validateBasicField(e,t)}}validateCheckbox(e,t){if(e.options&&e.options.length>0){if(!Array.isArray(t)||t.length===0)return{questionId:e.id,message:`${e.label} is required.`}}else if(t!==!0)return{questionId:e.id,message:`${e.label} is required.`};return null}validateSignature(e,t){const i=this.signaturePads.get(e.id);return!i||i.isEmpty()?{questionId:e.id,message:`${e.label} is required.`}:this.savedSignatures.has(e.id)?null:{questionId:e.id,message:`Please save your ${e.label} before continuing.`}}validateFileUpload(e,t){return!t||t===null||t===void 0?{questionId:e.id,message:`${e.label} is required.`}:null}validateBasicField(e,t){return t==null||t===""?{questionId:e.id,message:`${e.label} is required.`}:null}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e.type)}}class bt{getStorageKey(e){return`runner-form-data-${e||"default"}`}saveFormData(e,t,i,n,r,o){var c,u,h;const a=this.getStorageKey(e),l=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[i])==null?void 0:u.id,completedSteps:Array.from(r),steps:(h=o.steps)==null?void 0:h.map(m=>({...m,responses:m.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:i,savedSignatures:Array.from(n),completedSteps:Array.from(r),instance:l};try{localStorage.setItem(a,JSON.stringify(p))}catch(m){console.warn("Failed to save form data to localStorage:",m)}}restoreFormData(e){const t=this.getStorageKey(e);try{const i=localStorage.getItem(t);if(!i)return null;const n=JSON.parse(i);return{formData:n.formData||{},stepIndex:n.stepIndex||0,savedSignatures:new Set(n.savedSignatures||[]),completedSteps:new Set(n.completedSteps||[]),savedInstance:n.instance||null}}catch(i){return console.warn("Failed to restore form data from localStorage:",i),null}}clearFormData(e,t="completed workflow"){const i=this.getStorageKey(e);try{localStorage.removeItem(i),console.log(`Cleared saved form data for ${t}`)}catch(n){console.warn("Failed to clear saved form data:",n)}}shouldRestoreData(e){return e==="default"}}/*!
|
|
3689
3725
|
* Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
|
|
3690
3726
|
* (c) 2025 Szymon Nowak | Released under the MIT license
|
|
3691
3727
|
*/class Z{constructor(e,t,i,n){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=i||0,this.time=n||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class ge{static fromPoints(e,t){const i=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],i,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,i){const n=e.x-t.x,r=e.y-t.y,o=t.x-i.x,a=t.y-i.y,l={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+i.x)/2,y:(t.y+i.y)/2},c=Math.sqrt(n*n+r*r),u=Math.sqrt(o*o+a*a),h=l.x-p.x,m=l.y-p.y,v=c+u==0?0:u/(c+u),D={x:p.x+h*v,y:p.y+m*v},se=t.x-D.x,ne=t.y-D.y;return{c1:new Z(l.x+se,l.y+ne),c2:new Z(p.x+se,p.y+ne)}}constructor(e,t,i,n,r,o){this.startPoint=e,this.control2=t,this.control1=i,this.endPoint=n,this.startWidth=r,this.endWidth=o}length(){let t=0,i,n;for(let r=0;r<=10;r+=1){const o=r/10,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const p=a-i,c=l-n;t+=Math.sqrt(p*p+c*c)}i=a,n=l}return t}point(e,t,i,n,r){return t*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*n*(1-e)*e*e+r*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,i){this._et.addEventListener(e,t,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,i){this._et.removeEventListener(e,t,i)}}function xt(s,e=250){let t=0,i=null,n,r,o;const a=()=>{t=Date.now(),i=null,n=s.apply(r,o),i||(r=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return r=this,o=p,u<=0||u>e?(i&&(clearTimeout(i),i=null),t=c,n=s.apply(r,o),i||(r=null,o=[])):i||(i=window.setTimeout(a,u)),n}}class ee extends vt{constructor(e,t={}){var i,n,r;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=(i=t.throttle)!==null&&i!==void 0?i:16,this.minDistance=(n=t.minDistance)!==null&&n!==void 0?n:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=(r=t.canvasContextOptions)!==null&&r!==void 0?r:{},this._strokeMoveUpdate=this.throttle?xt(ee.prototype._strokeUpdate,this.throttle):ee.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(e,t={}){return new Promise((i,n)=>{const r=new Image,o=t.ratio||window.devicePixelRatio||1,a=t.width||this.canvas.width/o,l=t.height||this.canvas.height/o,p=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),r.onload=()=>{this._ctx.drawImage(r,p,c,a,l),i()},r.onerror=u=>{n(u)},r.crossOrigin="anonymous",r.src=e,this._isEmpty=!1})}toDataURL(e="image/png",t){switch(e){case"image/svg+xml":return typeof t!="object"&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!="number"&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)!==null&&e!==void 0?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)===1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return typeof this._strokePointerId>"u"?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){this._drawingStroke||!this._isLeftButtonPressed(e)||!this._allowPointerId(e,!0)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){this._isLeftButtonPressed(e)||!this._allowPointerId(e)||(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:i}=this._getListenerFunctions();switch(e.event.type){case"mousedown":i("mousemove",this._handleMouseMove,{passive:!1}),i("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":i("touchmove",this._handleTouchMove,{passive:!1}),i("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":i("pointermove",this._handlePointerMove,{passive:!1}),i("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},n),{points:[]});this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),i=this._data[this._data.length-1],n=i.points,r=n.length>0&&n[n.length-1],o=r?t.distanceTo(r)<=this.minDistance:!1,a=this._getPointGroupOptions(i);if(!r||!(r&&o)){const l=this._addPoint(t,a);r?l&&this._drawCurve(l,a):this._drawDot(t,a),n.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,i){const n=this.canvas.getBoundingClientRect();return new Z(e-n.left,t-n.top,i,new Date().getTime())}_addPoint(e,t){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const n=this._calculateCurveWidths(i[1],i[2],t),r=ge.fromPoints(i,n);return i.shift(),r}return null}_calculateCurveWidths(e,t,i){const n=i.velocityFilterWeight*t.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(n,i),o={end:r,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=r,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,i){const n=this._ctx;n.moveTo(e,t),n.arc(e,t,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const i=this._ctx,n=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=t.penColor;for(let o=0;o<r;o+=1){const a=o/r,l=a*a,p=l*a,c=1-a,u=c*c,h=u*c;let m=h*e.startPoint.x;m+=3*u*a*e.control1.x,m+=3*c*l*e.control2.x,m+=p*e.endPoint.x;let v=h*e.startPoint.y;v+=3*u*a*e.control1.y,v+=3*c*l*e.control2.y,v+=p*e.endPoint.y;const D=Math.min(e.startWidth+p*n,t.maxWidth);this._drawCurveSegment(m,v,D)}i.closePath(),i.fill()}_drawDot(e,t){const i=this._ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,n),i.closePath(),i.fillStyle=t.penColor,i.fill()}_fromData(e,t,i){for(const n of e){const{points:r}=n,o=this._getPointGroupOptions(n);if(r.length>1)for(let a=0;a<r.length;a+=1){const l=r[a],p=new Z(l.x,l.y,l.pressure,l.time);a===0&&this._reset(o);const c=this._addPoint(p,o);c&&t(c,o)}else this._reset(o),i(r[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,r=0,o=this.canvas.width/i,a=this.canvas.height/i,l=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),l.setAttribute("viewBox",`${n} ${r} ${o} ${a}`),l.setAttribute("width",o.toString()),l.setAttribute("height",a.toString()),e&&this.backgroundColor){const p=document.createElement("rect");p.setAttribute("width","100%"),p.setAttribute("height","100%"),p.setAttribute("fill",this.backgroundColor),l.appendChild(p)}return this._fromData(t,(p,{penColor:c})=>{const u=document.createElement("path");if(!isNaN(p.control1.x)&&!isNaN(p.control1.y)&&!isNaN(p.control2.x)&&!isNaN(p.control2.y)){const h=`M ${p.startPoint.x.toFixed(3)},${p.startPoint.y.toFixed(3)} C ${p.control1.x.toFixed(3)},${p.control1.y.toFixed(3)} ${p.control2.x.toFixed(3)},${p.control2.y.toFixed(3)} ${p.endPoint.x.toFixed(3)},${p.endPoint.y.toFixed(3)}`;u.setAttribute("d",h),u.setAttribute("stroke-width",(p.endWidth*2.25).toFixed(3)),u.setAttribute("stroke",c),u.setAttribute("fill","none"),u.setAttribute("stroke-linecap","round"),l.appendChild(u)}},(p,{penColor:c,dotSize:u,minWidth:h,maxWidth:m})=>{const v=document.createElement("circle"),D=u>0?u:(h+m)/2;v.setAttribute("r",D.toString()),v.setAttribute("cx",p.x.toString()),v.setAttribute("cy",p.y.toString()),v.setAttribute("fill",c),l.appendChild(v)}),l.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const i=t==null?void 0:t.getElementById(`signature-${e}`);if(!i)return null;this.clearSignaturePad(e),this.resizeCanvas(i);const n=new ee(i,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,n),this.canvasElements.set(e,i),n.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),n}handleSignatureChange(e){var r;const t=this.signaturePads.get(e);if(!t)return;const i=!t.isEmpty(),n=i?t.toData():null;(r=this.onSignatureChange)==null||r.call(this,{questionId:e,hasSignature:i,signatureData:n})}clearSignature(e){const t=this.signaturePads.get(e);t&&(t.clear(),this.handleSignatureChange(e))}saveSignature(e){const t=this.signaturePads.get(e);if(!t||t.isEmpty())return null;const i=t.toSVG(),n=t.toDataURL();return{questionId:e,svgData:i,dataURL:n}}restoreSignature(e,t){const i=this.signaturePads.get(e);if(!i||!t)return!1;try{return i.clear(),i.fromData(t),!0}catch(n){return console.warn(`Failed to restore signature for ${e}:`,n),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const i=this.canvasElements.get(t);if(i){this.resizeCanvas(i);const n=e.toData();e.clear(),e.fromData(n)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),i=window.getComputedStyle(e),n=parseFloat(i.width),r=parseFloat(i.height);e.width=n*t,e.height=r*t;const o=e.getContext("2d");o&&o.scale(t,t)}clearSignaturePad(e){var t;this.signaturePads.has(e)&&((t=this.signaturePads.get(e))==null||t.off(),this.signaturePads.delete(e),this.canvasElements.delete(e))}getSignaturePad(e){return this.signaturePads.get(e)}hasSignaturePads(){return this.signaturePads.size>0}getAllSignaturePads(){return new Map(this.signaturePads)}destroy(){this.signaturePads.forEach(e=>{e.off()}),this.signaturePads.clear(),this.canvasElements.clear()}}class yt{trackQuestionResponse(e,t,i){if(!e)return;e.responses||(e.responses=[]);const n=e.responses.findIndex(o=>o.elementId===t),r={elementId:t,value:i,answeredAt:new Date};n>=0?e.responses[n]=r:e.responses.push(r)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(n=>{if(this.isQuestionElement(n.type)){const r=t[n.id];if(r!==void 0&&i.responses){let o=i.responses.find(a=>a.elementId===n.id);o?(o.value=r,o.answeredAt=new Date):(o={elementId:n.id,value:r,answeredAt:new Date},i.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),t}hasChangedFromPrevious(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.responses.find(o=>o.elementId===e);if(r)return r.value!==t}return!0}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e)}}class wt{constructor(e,t){this.mode=e,this.currentUser=t}updateMode(e){this.mode=e}updateCurrentUser(e){this.currentUser=e}isStepAssignedToUser(e){if(!this.currentUser)return!1;const t=e.assignment;return!!(this.currentUser.targetId&&t.targetId&&this.currentUser.targetId===t.targetId||this.currentUser.email&&t.email&&this.currentUser.email===t.email)}getAssignedSteps(e){return e!=null&&e.steps?e.steps.filter(t=>this.isStepAssignedToUser(t)):[]}findNextAssignedStep(e,t){if(!(t!=null&&t.steps))return-1;if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print")return e+1<t.steps.length?e+1:-1;for(let i=e+1;i<t.steps.length;i++){const n=t.steps[i];if(this.isStepAssignedToUser(n))return i}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const i=t==null?void 0:t.steps;return e===((i==null?void 0:i.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,i,n,r,o){if((r||o)&&this.mode!=="admin"&&this.mode!=="view-only"&&this.mode!=="print")return{canNavigate:!1,newStepIndex:t,reason:"Navigation blocked: workflow submitted"};if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const p=i.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=i.steps;if(!a||e<0||e>=a.length)return{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"};const l=a[e];if(this.isStepAssignedToUser(l)){const p=n.has(l.id),c=this.isStepWithinAllowedRange(e,i,n);return p||c?{canNavigate:!0,newStepIndex:e}:{canNavigate:!1,newStepIndex:t,reason:"Step not accessible yet"}}else return{canNavigate:!0,newStepIndex:e}}isStepWithinAllowedRange(e,t,i){if(!(t!=null&&t.steps))return!1;const r=this.getAssignedSteps(t).map(l=>t.steps.findIndex(p=>p.id===l.id)).sort((l,p)=>l-p);let o=-1;for(const l of r){const p=t.steps[l];i.has(p.id)&&(o=l)}let a=-1;for(const l of r)if(l>o){a=l;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const te=class te{constructor(){this.formData={},this.validationErrors={}}updateFormData(e){this.formData={...e}}mergeFormData(e){this.formData={...this.formData,...e}}setFormField(e,t){this.formData={...this.formData,[e]:t}}removeFormField(e){const t={...this.formData};delete t[e],this.formData=t}getFormData(){return{...this.formData}}getFormField(e){return this.formData[e]}hasFormField(e){return e in this.formData}setValidationErrors(e){this.validationErrors={...e}}getValidationErrors(){return{...this.validationErrors}}clearValidationError(e){if(this.validationErrors[e]){const t={...this.validationErrors};delete t[e],this.validationErrors=t}}hasValidationError(e){return!!this.validationErrors[e]}setValidationError(e,t){this.validationErrors={...this.validationErrors,[e]:t}}clearAllValidationErrors(){this.validationErrors={}}initializeFromResponses(e){const t={};e.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return te.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var i;const t={};return(i=e.elements)==null||i.forEach(n=>{if(this.isQuestionElement(n)){const r=n,o=this.formData[r.id];o!==void 0&&(t[r.id]=o)}}),t}hasFormData(){return Object.keys(this.formData).length>0}getFormFieldIds(){return Object.keys(this.formData)}getValidationErrorCount(){return Object.keys(this.validationErrors).length}};te.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let me=te;const ie=class ie{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,i){var p,c,u,h,m;const n=t.target,r=(p=n.files)==null?void 0:p[0];if(!r){this.clearFile(e),(c=i.onRequestUpdate)==null||c.call(i);return}const o=this.validateFileSize(r);if(o){this.handleFileValidationError(e,o,n),(u=i.onRequestUpdate)==null||u.call(i);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(r);this.formStateManager.setFormField(e,a);const l=this.hasFileChanged(e,a,i.savedInstance);l&&i.mode!=="preview"?this.executeFileUploadCallback(e,r,a,i):this.logSkippedCallback(e,i.mode,l),(h=i.onRequestUpdate)==null||h.call(i),i.mode!=="admin"&&((m=i.onFormDataSave)==null||m.call(i))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>ie.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,i){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),i.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.responses.find(o=>o.elementId===e);if(r&&r.value&&typeof r.value=="object"){const o=r.value;return o.name!==t.name||o.size!==t.size||o.type!==t.type||o.lastModified!==t.lastModified}}return!0}executeFileUploadCallback(e,t,i,n){var r,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!n.onFileUploaded),n.onFileUploaded&&n.onFileUploaded({instanceId:(r=n.instance)==null?void 0:r.id,stepId:(o=n.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:i.name,fileSize:i.size,fileType:i.type})}logSkippedCallback(e,t,i){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):i||console.log("File unchanged, skipping callback for:",e)}};ie.MAX_FILE_SIZE=5*1024*1024;let fe=ie;class k{static _isInputDisabled(e){return(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="admin"||e.mode==="view-only"||e.mode==="print"||e.mode==="default"&&!e.handlers.isCurrentStepAssigned()}static _formatFileSize(e){if(e===0)return"0 Bytes";const t=1024,i=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(2))+" "+i[n]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),i=t[t.length-1];return i&&i.includes(".")?i:"Uploaded File"}}static _guessFileTypeFromUrl(e){var r;const i=(r=k._extractFilenameFromUrl(e).split(".").pop())==null?void 0:r.toLowerCase();return i?{pdf:"PDF Document",doc:"Word Document",docx:"Word Document",xls:"Excel Spreadsheet",xlsx:"Excel Spreadsheet",png:"PNG Image",jpg:"JPEG Image",jpeg:"JPEG Image",gif:"GIF Image",svg:"SVG Image",txt:"Text File",csv:"CSV File",zip:"ZIP Archive",mp4:"MP4 Video",mp3:"MP3 Audio"}[i]||`${i.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,i){return i.mode==="print"?d`<div class="print-response-value textarea-response">
|
|
@@ -3923,7 +3959,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3923
3959
|
* @license
|
|
3924
3960
|
* Copyright 2017 Google LLC
|
|
3925
3961
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3926
|
-
*/class be extends $t{constructor(e){if(super(e),this.it=x,e.type!==St.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||e==null)return this._t=void 0,this.it=e;if(e===
|
|
3962
|
+
*/class be extends $t{constructor(e){if(super(e),this.it=x,e.type!==St.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||e==null)return this._t=void 0,this.it=e;if(e===P)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const Le=kt(be);class ${static renderMarkdown(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*?)\*/gim,"<em>$1</em>").replace(/`(.*?)`/gim,"<code>$1</code>").replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/\n/gim,"<br>")}static renderText(e){return d`
|
|
3927
3963
|
<div class="content-element text-content">
|
|
3928
3964
|
<p>${e.content}</p>
|
|
3929
3965
|
</div>
|
|
@@ -4124,7 +4160,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4124
4160
|
${e.mode==="admin"?e.justSaved?"✓ Saved!":"Save":e.isLastStep?"Submit":"Next"}
|
|
4125
4161
|
</button>
|
|
4126
4162
|
</div>
|
|
4127
|
-
`}}class ve{static handleInputChange(e,t,i,n,r,o){const a=t.target;let l;a.type==="radio"?l=a.value:a.type==="checkbox"?l=a.checked:l=a.value;const p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxChange(e,t,i,n,r,o){const l=t.target.checked,p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxGroupChange(e,t,i,n,r,o,a){const l=i.target,p=n[e];let c=Array.isArray(p)?[...p]:[];l.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...n,[e]:c};r(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,_=(s,e,t,i)=>{for(var n=i>1?void 0:i?Et(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Ct(e,t,n),n};let f=class extends H{constructor(){super(...arguments),this.mode="default",this.isLoading=!1,this._currentStepIndex=0,this._formData={},this._validationErrors={},this._internalCompletedSteps=new Set,this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._isSubmitted=!1,this._userStepsSubmitted=!1,this._justSaved=!1}willUpdate(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.getAllSignaturePads())||new Map,this._savedSignatures)}_getRenderContext(){return{formData:this._formData,validationErrors:this._validationErrors,currentStepIndex:this._currentStepIndex,internalCompletedSteps:this._internalCompletedSteps,savedSignatures:this._savedSignatures,replacingSignatures:this._replacingSignatures,isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,justSaved:this._justSaved,validationService:this.validationService,persistenceManager:this.persistenceManager,signatureManager:this.signatureManager,responseTracker:this.responseTracker,navigationService:this.navigationService,formStateManager:this.formStateManager,fileUploadManager:this.fileUploadManager,mode:this.mode||"default",instance:this.instance,workflow:this.workflow,currentUser:this.currentUser,isLoading:this.isLoading,handlers:{handleInputChange:this._handleInputChange.bind(this),handleCheckboxChange:this._handleCheckboxChange.bind(this),handleCheckboxGroupChange:this._handleCheckboxGroupChange.bind(this),startReplaceSignature:this._startReplaceSignature.bind(this),cancelReplaceSignature:this._cancelReplaceSignature.bind(this),clearSignature:this._clearSignature.bind(this),saveSignature:this._saveSignature.bind(this),handleFileUpload:this._handleFileUpload.bind(this),trackQuestionResponse:this._trackQuestionResponse.bind(this),isCurrentStepAssigned:this._isCurrentStepAssigned.bind(this)}}}_handleSignatureChange(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.reset(),this._validationErrors={},this._formData={},this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._savedInstance=void 0,this._justSaved=!1,this._isSubmitted=((e=this.instance)==null?void 0:e.status)==="completed"||!1,this.instance&&this.instance.status!=="completed"){const i=this._getAssignedSteps(),n=i.filter(r=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(r.id)});this._userStepsSubmitted=i.length>0&&n.length===i.length}else this._userStepsSubmitted=((t=this.instance)==null?void 0:t.status)==="completed"||!1;this.mode==="preview"&&this.workflow?this._initializePreviewMode():this.mode==="view-only"&&this.instance?this._initializeViewOnlyMode():this.mode==="print"&&this.instance?this._initializePrintMode():this.instance&&this._initializeDefaultMode()}_initializePreviewMode(){var s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.steps)||this.workflow.steps.length===0){console.warn("Workflow has no steps in preview mode.");return}this.formStateManager.reset(),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this._internalCompletedSteps=new Set,console.log("Preview mode initialized with empty form data.")}_initializeDefaultMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.instance.completedSteps?this._internalCompletedSteps=new Set(this.instance.completedSteps):this._internalCompletedSteps=new Set(this.instance.steps.filter(e=>e.status==="completed").map(e=>e.id)),this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=this.instance.steps.findIndex(e=>{var t;return e.id===((t=this.instance)==null?void 0:t.currentStepId)}),this._currentStepIndex<0&&(this._currentStepIndex=0),this.instance.steps.forEach((e,t)=>{this._internalCompletedSteps.has(e.id)?e.status="completed":t===this._currentStepIndex?e.status="active":e.status="pending"}))}_initializeViewOnlyMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("View-only mode initialized with existing responses:",this._formData))}_initializePrintMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("Print mode initialized with existing responses:",this._formData))}_isStepAssignedToUser(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return Ne.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){ve.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){ve.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){ve.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,n,r;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(r=this.onSignatureCaptured)==null||r.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(n=this._currentStep)==null?void 0:n.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var n;(n=this.instance)!=null&&n.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,e,{instance:this.instance,currentStep:this._currentStep,mode:this.mode||"default",savedInstance:this._savedInstance,onFileUploaded:this.onFileUploaded,onFormDataSave:()=>this._saveFormDataToHistory(),onRequestUpdate:()=>{this._formData=this.formStateManager.getFormData(),this._validationErrors=this.formStateManager.getValidationErrors();const t=this._formData[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return k.render(s,this._getRenderContext())}_renderContentElement(s){return $.render(s,this._getRenderContext())}_isQuestionElement(s){return f.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return f.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):d`<div class="unknown-element">
|
|
4163
|
+
`}}class ve{static handleInputChange(e,t,i,n,r,o){const a=t.target;let l;a.type==="radio"?l=a.value:a.type==="checkbox"?l=a.checked:l=a.value;const p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxChange(e,t,i,n,r,o){const l=t.target.checked,p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxGroupChange(e,t,i,n,r,o,a){const l=i.target,p=n[e];let c=Array.isArray(p)?[...p]:[];l.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...n,[e]:c};r(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,At=Object.getOwnPropertyDescriptor,y=(s,e,t,i)=>{for(var n=i>1?void 0:i?At(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Ct(e,t,n),n};let b=class extends H{constructor(){super(...arguments),this.mode="default",this.isLoading=!1,this._currentStepIndex=0,this._formData={},this._validationErrors={},this._internalCompletedSteps=new Set,this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._isSubmitted=!1,this._userStepsSubmitted=!1,this._justSaved=!1}willUpdate(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.getAllSignaturePads())||new Map,this._savedSignatures)}_getRenderContext(){return{formData:this._formData,validationErrors:this._validationErrors,currentStepIndex:this._currentStepIndex,internalCompletedSteps:this._internalCompletedSteps,savedSignatures:this._savedSignatures,replacingSignatures:this._replacingSignatures,isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,justSaved:this._justSaved,validationService:this.validationService,persistenceManager:this.persistenceManager,signatureManager:this.signatureManager,responseTracker:this.responseTracker,navigationService:this.navigationService,formStateManager:this.formStateManager,fileUploadManager:this.fileUploadManager,mode:this.mode||"default",instance:this.instance,workflow:this.workflow,currentUser:this.currentUser,isLoading:this.isLoading,handlers:{handleInputChange:this._handleInputChange.bind(this),handleCheckboxChange:this._handleCheckboxChange.bind(this),handleCheckboxGroupChange:this._handleCheckboxGroupChange.bind(this),startReplaceSignature:this._startReplaceSignature.bind(this),cancelReplaceSignature:this._cancelReplaceSignature.bind(this),clearSignature:this._clearSignature.bind(this),saveSignature:this._saveSignature.bind(this),handleFileUpload:this._handleFileUpload.bind(this),trackQuestionResponse:this._trackQuestionResponse.bind(this),isCurrentStepAssigned:this._isCurrentStepAssigned.bind(this)}}}_handleSignatureChange(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.reset(),this._validationErrors={},this._formData={},this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._savedInstance=void 0,this._justSaved=!1,this._isSubmitted=((e=this.instance)==null?void 0:e.status)==="completed"||!1,this.instance&&this.instance.status!=="completed"){const i=this._getAssignedSteps(),n=i.filter(r=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(r.id)});this._userStepsSubmitted=i.length>0&&n.length===i.length}else this._userStepsSubmitted=((t=this.instance)==null?void 0:t.status)==="completed"||!1;this.mode==="preview"&&this.workflow?this._initializePreviewMode():this.mode==="view-only"&&this.instance?this._initializeViewOnlyMode():this.mode==="print"&&this.instance?this._initializePrintMode():this.instance&&this._initializeDefaultMode()}_initializePreviewMode(){var s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.steps)||this.workflow.steps.length===0){console.warn("Workflow has no steps in preview mode.");return}this.formStateManager.reset(),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this._internalCompletedSteps=new Set,console.log("Preview mode initialized with empty form data.")}_initializeDefaultMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.instance.completedSteps?this._internalCompletedSteps=new Set(this.instance.completedSteps):this._internalCompletedSteps=new Set(this.instance.steps.filter(e=>e.status==="completed").map(e=>e.id)),this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=this.instance.steps.findIndex(e=>{var t;return e.id===((t=this.instance)==null?void 0:t.currentStepId)}),this._currentStepIndex<0&&(this._currentStepIndex=0),this.instance.steps.forEach((e,t)=>{this._internalCompletedSteps.has(e.id)?e.status="completed":t===this._currentStepIndex?e.status="active":e.status="pending"}))}_initializeViewOnlyMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("View-only mode initialized with existing responses:",this._formData))}_initializePrintMode(){var s;!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("Print mode initialized with existing responses:",this._formData))}_isStepAssignedToUser(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return Ne.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){ve.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){ve.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){ve.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,n,r;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(r=this.onSignatureCaptured)==null||r.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(n=this._currentStep)==null?void 0:n.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var n;(n=this.instance)!=null&&n.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,e,{instance:this.instance,currentStep:this._currentStep,mode:this.mode||"default",savedInstance:this._savedInstance,onFileUploaded:this.onFileUploaded,onFormDataSave:()=>this._saveFormDataToHistory(),onRequestUpdate:()=>{this._formData=this.formStateManager.getFormData(),this._validationErrors=this.formStateManager.getValidationErrors();const t=this._formData[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return k.render(s,this._getRenderContext())}_renderContentElement(s){return $.render(s,this._getRenderContext())}_isQuestionElement(s){return b.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return b.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):d`<div class="unknown-element">
|
|
4128
4164
|
<p>⚠️ Unknown element type: ${s.type}</p>
|
|
4129
4165
|
</div>`:this._isQuestionElement(s)?d`<div class="runner-card">${this._renderQuestion(s)}</div>`:this._isContentElement(s)?d`<div class="runner-card">${this._renderContentElement(s)}</div>`:d`<div class="runner-card">
|
|
4130
4166
|
<div class="unknown-element">
|
|
@@ -4181,7 +4217,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4181
4217
|
</div>
|
|
4182
4218
|
`:""}
|
|
4183
4219
|
</div>
|
|
4184
|
-
`}};
|
|
4220
|
+
`}};b.styles=[Ue],b.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],b.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],y([A({type:Object})],b.prototype,"instance",2),y([A({type:Object})],b.prototype,"workflow",2),y([A({type:String})],b.prototype,"mode",2),y([A({type:Boolean})],b.prototype,"isLoading",2),y([A({type:Object})],b.prototype,"currentUser",2),y([A({type:Function})],b.prototype,"onSignatureCaptured",2),y([A({type:Function})],b.prototype,"onFileUploaded",2),y([f()],b.prototype,"_currentStepIndex",2),y([f()],b.prototype,"_formData",2),y([f()],b.prototype,"_validationErrors",2),y([f()],b.prototype,"_internalCompletedSteps",2),y([f()],b.prototype,"_formRestorationComplete",2),y([f()],b.prototype,"_savedSignatures",2),y([f()],b.prototype,"_replacingSignatures",2),y([f()],b.prototype,"_savedInstance",2),y([f()],b.prototype,"_isSubmitted",2),y([f()],b.prototype,"_userStepsSubmitted",2),y([f()],b.prototype,"_justSaved",2),b=y([Ie("runner-widget")],b);function Et(s,e={}){const{title:t=s.name||"Workflow Instance",includeStyles:i=!0,customCSS:n="",showTimestamps:r=!1}=e,o=new Date;if(!(s!=null&&s.steps)||s.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
|
|
4185
4221
|
<html lang="en">
|
|
4186
4222
|
<head>
|
|
4187
4223
|
<meta charset="UTF-8">
|
|
@@ -4198,7 +4234,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4198
4234
|
</div>
|
|
4199
4235
|
<hr class="print-question-separator" />
|
|
4200
4236
|
|
|
4201
|
-
${r?
|
|
4237
|
+
${r?Vt(s,o):""}
|
|
4202
4238
|
${s.steps.map(l=>Mt(l)).join(`
|
|
4203
4239
|
`)}
|
|
4204
4240
|
</div>
|
|
@@ -4218,11 +4254,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4218
4254
|
${s.description?`<div class="print-step-description">${g(s.description)}</div>`:""}
|
|
4219
4255
|
<hr class="print-question-separator" />
|
|
4220
4256
|
</div>
|
|
4221
|
-
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=
|
|
4257
|
+
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=jt(s.id,e.responses),i=t==null?void 0:t.value,r=s.type==="checkbox"&&(!s.options||s.options.length===0)?"":`
|
|
4222
4258
|
<div class="print-question-title">
|
|
4223
4259
|
${g(s.label)}:
|
|
4224
4260
|
</div>
|
|
4225
|
-
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return r+
|
|
4261
|
+
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return r+Pt(s,i)+o;case"textarea":return r+Ut(s,i)+o;case"select":return r+Lt(s,i)+o;case"radio":return r+Nt(s,i)+o;case"checkbox":return r+Ot(s,i)+o;case"file_upload":return r+Rt(s,i)+o;case"signature":return r+Ht(s,i)+o;default:return r+`
|
|
4226
4262
|
<div class="unknown-element">
|
|
4227
4263
|
<p>⚠️ Unknown question type: ${g(s.type)}</p>
|
|
4228
4264
|
</div>
|
|
@@ -4301,11 +4337,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4301
4337
|
</div>
|
|
4302
4338
|
${e}
|
|
4303
4339
|
</div>
|
|
4304
|
-
`}}function
|
|
4340
|
+
`}}function Pt(s,e){const t=e!=null?g(String(e)):"";return`
|
|
4305
4341
|
<div class="print-response-value input-response">
|
|
4306
4342
|
${(s.type==="date"&&e?new Date(e).toLocaleDateString():t)||'<span class="print-no-response">No response</span>'}
|
|
4307
4343
|
</div>
|
|
4308
|
-
`}function
|
|
4344
|
+
`}function Ut(s,e){return`
|
|
4309
4345
|
<div class="print-response-value textarea-response">
|
|
4310
4346
|
${(e!=null?g(String(e)):"")||'<span class="print-no-response">No response</span>'}
|
|
4311
4347
|
</div>
|
|
@@ -4350,7 +4386,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4350
4386
|
<div class="signature-fallback">
|
|
4351
4387
|
<div class="signature-error">Unable to display signature</div>
|
|
4352
4388
|
</div>
|
|
4353
|
-
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function
|
|
4389
|
+
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function jt(s,e){return e==null?void 0:e.find(t=>t.elementId===s)}function Vt(s,e){return`
|
|
4354
4390
|
<div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
|
|
4355
4391
|
<div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
|
|
4356
4392
|
<div>
|
|
@@ -4873,4 +4909,4 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4873
4909
|
margin: 2px 0;
|
|
4874
4910
|
line-height: 1.4;
|
|
4875
4911
|
}
|
|
4876
|
-
`}function qt(s,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&i.addEventListener("instance-updated",n=>{const r=n;try{e.onInstanceUpdated(r.detail)}catch(o){console.error("Error executing onInstanceUpdated callback:",o)}}),t.appendChild(i),console.log(`Drill Runner mounted on #${s}`),i}function Jt(s,e){const t=s.getFormData(),i=JSON.parse(JSON.stringify(e));return i.steps&&i.steps.forEach(n=>{n.responses||(n.responses=[]),n.elements.forEach(r=>{if(r.type==="text_input"||r.type==="textarea"||r.type==="select"||r.type==="number"||r.type==="radio"||r.type==="checkbox"||r.type==="date"||r.type==="file_upload"||r.type==="signature"){const o=t[r.id];if(o!==void 0){let a=n.responses.find(l=>l.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},n.responses.push(a))}}})}),i}function Xt(s,e){const t={};e.steps&&e.steps.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),s.restoreFormData(),console.log("Form data restored to runner widget:",t)}C.createBuilder=qt,C.createRunner=Kt,C.generateInstanceHTML=
|
|
4912
|
+
`}function qt(s,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&i.addEventListener("instance-updated",n=>{const r=n;try{e.onInstanceUpdated(r.detail)}catch(o){console.error("Error executing onInstanceUpdated callback:",o)}}),t.appendChild(i),console.log(`Drill Runner mounted on #${s}`),i}function Jt(s,e){const t=s.getFormData(),i=JSON.parse(JSON.stringify(e));return i.steps&&i.steps.forEach(n=>{n.responses||(n.responses=[]),n.elements.forEach(r=>{if(r.type==="text_input"||r.type==="textarea"||r.type==="select"||r.type==="number"||r.type==="radio"||r.type==="checkbox"||r.type==="date"||r.type==="file_upload"||r.type==="signature"){const o=t[r.id];if(o!==void 0){let a=n.responses.find(l=>l.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},n.responses.push(a))}}})}),i}function Xt(s,e){const t={};e.steps&&e.steps.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),s.restoreFormData(),console.log("Form data restored to runner widget:",t)}C.createBuilder=qt,C.createRunner=Kt,C.generateInstanceHTML=Et,C.restoreFormDataToRunner=Xt,C.updateInstanceFromRunnerForm=Jt,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
package/dist/lib.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export declare class BuilderWidget extends LitElement {
|
|
|
34
34
|
private _stepAssignmentCategory;
|
|
35
35
|
private _stepAssignmentType;
|
|
36
36
|
private _stepAssignmentTarget;
|
|
37
|
+
private _stepAssignmentFirstName;
|
|
38
|
+
private _stepAssignmentLastName;
|
|
37
39
|
onCancel?: () => void;
|
|
38
40
|
onWorkflowCreated?: (workflow: Workflow) => void;
|
|
39
41
|
onWorkflowDeleted?: (workflowId: string) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drill-widgets",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.15",
|
|
4
4
|
"description": "Easily embed powerful workflow building and running capabilities into your web applications with Lit-based web components. Includes HTML export for server-side PDF generation.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|