@magicfeedback/popup-sdk 1.17.2 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/MagicfeedbackPopupSdk.podspec +18 -0
  2. package/README.md +33 -1
  3. package/dist/2.2.38-CCK7SF4A.mjs +2343 -0
  4. package/dist/2.2.38-CCK7SF4A.mjs.map +1 -0
  5. package/dist/2.2.38-LGZRM7GX.mjs +2343 -0
  6. package/dist/2.2.38-LGZRM7GX.mjs.map +1 -0
  7. package/dist/2.2.39-BJJ3YRJ4.mjs +2344 -0
  8. package/dist/2.2.39-BJJ3YRJ4.mjs.map +1 -0
  9. package/dist/2.2.39-HPNDYUPP.mjs +2344 -0
  10. package/dist/2.2.39-HPNDYUPP.mjs.map +1 -0
  11. package/dist/assets/assets/style.css +165 -1
  12. package/dist/assets/assets/survey-css/2.2.38.css +2335 -0
  13. package/dist/assets/assets/survey-css/2.2.39.css +2336 -0
  14. package/dist/chunk-3QS3WKRC.mjs +31 -0
  15. package/dist/chunk-3QS3WKRC.mjs.map +1 -0
  16. package/dist/chunk-7ZQOAKXR.mjs +3335 -0
  17. package/dist/chunk-7ZQOAKXR.mjs.map +1 -0
  18. package/dist/chunk-BJTO5JO5.mjs +11 -0
  19. package/dist/chunk-BJTO5JO5.mjs.map +1 -0
  20. package/dist/{chunk-AFRHPS3K.mjs → chunk-EW2ARDEY.mjs} +591 -51
  21. package/dist/chunk-EW2ARDEY.mjs.map +1 -0
  22. package/dist/{chunk-VHTN5UXD.mjs → chunk-XOEEBDBJ.mjs} +630 -10
  23. package/dist/chunk-XOEEBDBJ.mjs.map +1 -0
  24. package/dist/index.d.mts +159 -10
  25. package/dist/index.d.ts +159 -10
  26. package/dist/index.js +7275 -1466
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +318 -41
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/index.native.d.mts +1616 -0
  31. package/dist/index.native.d.ts +1616 -0
  32. package/dist/index.native.js +15853 -0
  33. package/dist/index.native.js.map +1 -0
  34. package/dist/index.native.mjs +3914 -0
  35. package/dist/index.native.mjs.map +1 -0
  36. package/dist/react-native.d.mts +105 -8
  37. package/dist/react-native.d.ts +105 -8
  38. package/dist/react-native.js +5827 -132
  39. package/dist/react-native.js.map +1 -1
  40. package/dist/react-native.mjs +313 -43
  41. package/dist/react-native.mjs.map +1 -1
  42. package/dist/renderPopup-2Y4QMWR7.mjs +3847 -0
  43. package/dist/renderPopup-2Y4QMWR7.mjs.map +1 -0
  44. package/dist/renderPopup-YDJUON42.mjs +3847 -0
  45. package/dist/renderPopup-YDJUON42.mjs.map +1 -0
  46. package/dist/{renderPopup-L2Q3KJAZ.mjs → renderPopup-ZHTRMFO2.mjs} +142 -9
  47. package/dist/renderPopup-ZHTRMFO2.mjs.map +1 -0
  48. package/ios/DeepdotsBackgroundTask.m +71 -0
  49. package/package.json +14 -5
  50. package/react-native.config.js +9 -0
  51. package/dist/chunk-AFRHPS3K.mjs.map +0 -1
  52. package/dist/chunk-VHTN5UXD.mjs.map +0 -1
  53. package/dist/renderPopup-L2Q3KJAZ.mjs.map +0 -1
  54. package/dist/renderPopup-PQWJSBOY.mjs +0 -3622
  55. package/dist/renderPopup-PQWJSBOY.mjs.map +0 -1
@@ -1,3622 +0,0 @@
1
- import {
2
- REVEAL_TIMEOUT_MS,
3
- __commonJS,
4
- __toESM,
5
- applySurveyPrimaryColor,
6
- buildFontFaceCss,
7
- buildFontFamilyValue,
8
- buildSurveyIdentity,
9
- directionFor,
10
- getLabels,
11
- resolveActionLabels,
12
- revealWhenPainted,
13
- sdkError,
14
- sdkLog,
15
- sdkWarn,
16
- setSurveyBusy,
17
- style_default
18
- } from "./chunk-AFRHPS3K.mjs";
19
-
20
- // node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
21
- var require_magicfeedback_sdk_browser = __commonJS({
22
- "node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js"(exports, module) {
23
- "use strict";
24
- !(function(e, t) {
25
- "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.magicfeedback = t() : e.magicfeedback = t();
26
- })(self, (() => {
27
- return e = { 6539: function(e2, t2) {
28
- var i = "undefined" != typeof self ? self : this, n = (function() {
29
- function e3() {
30
- this.fetch = false, this.DOMException = i.DOMException;
31
- }
32
- return e3.prototype = i, new e3();
33
- })();
34
- !(function(e3) {
35
- !(function(t3) {
36
- var i2 = "URLSearchParams" in e3, n2 = "Symbol" in e3 && "iterator" in Symbol, r2 = "FileReader" in e3 && "Blob" in e3 && (function() {
37
- try {
38
- return new Blob(), true;
39
- } catch (e4) {
40
- return false;
41
- }
42
- })(), o = "FormData" in e3, a = "ArrayBuffer" in e3;
43
- if (a) var s = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
44
- return e4 && s.indexOf(Object.prototype.toString.call(e4)) > -1;
45
- };
46
- function d(e4) {
47
- if ("string" != typeof e4 && (e4 = String(e4)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e4)) throw new TypeError("Invalid character in header field name");
48
- return e4.toLowerCase();
49
- }
50
- function c(e4) {
51
- return "string" != typeof e4 && (e4 = String(e4)), e4;
52
- }
53
- function u(e4) {
54
- var t4 = { next: function() {
55
- var t5 = e4.shift();
56
- return { done: void 0 === t5, value: t5 };
57
- } };
58
- return n2 && (t4[Symbol.iterator] = function() {
59
- return t4;
60
- }), t4;
61
- }
62
- function p(e4) {
63
- this.map = {}, e4 instanceof p ? e4.forEach((function(e5, t4) {
64
- this.append(t4, e5);
65
- }), this) : Array.isArray(e4) ? e4.forEach((function(e5) {
66
- this.append(e5[0], e5[1]);
67
- }), this) : e4 && Object.getOwnPropertyNames(e4).forEach((function(t4) {
68
- this.append(t4, e4[t4]);
69
- }), this);
70
- }
71
- function m(e4) {
72
- if (e4.bodyUsed) return Promise.reject(new TypeError("Already read"));
73
- e4.bodyUsed = true;
74
- }
75
- function h(e4) {
76
- return new Promise((function(t4, i3) {
77
- e4.onload = function() {
78
- t4(e4.result);
79
- }, e4.onerror = function() {
80
- i3(e4.error);
81
- };
82
- }));
83
- }
84
- function f(e4) {
85
- var t4 = new FileReader(), i3 = h(t4);
86
- return t4.readAsArrayBuffer(e4), i3;
87
- }
88
- function g(e4) {
89
- if (e4.slice) return e4.slice(0);
90
- var t4 = new Uint8Array(e4.byteLength);
91
- return t4.set(new Uint8Array(e4)), t4.buffer;
92
- }
93
- function y() {
94
- return this.bodyUsed = false, this._initBody = function(e4) {
95
- var t4;
96
- this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : r2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : o && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() : a && r2 && (t4 = e4) && DataView.prototype.isPrototypeOf(t4) ? (this._bodyArrayBuffer = g(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a && (ArrayBuffer.prototype.isPrototypeOf(e4) || l(e4)) ? this._bodyArrayBuffer = g(e4) : this._bodyText = e4 = Object.prototype.toString.call(e4) : this._bodyText = "", this.headers.get("content-type") || ("string" == typeof e4 ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : i2 && URLSearchParams.prototype.isPrototypeOf(e4) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
97
- }, r2 && (this.blob = function() {
98
- var e4 = m(this);
99
- if (e4) return e4;
100
- if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
101
- if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
102
- if (this._bodyFormData) throw new Error("could not read FormData body as blob");
103
- return Promise.resolve(new Blob([this._bodyText]));
104
- }, this.arrayBuffer = function() {
105
- return this._bodyArrayBuffer ? m(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
106
- }), this.text = function() {
107
- var e4, t4, i3, n3 = m(this);
108
- if (n3) return n3;
109
- if (this._bodyBlob) return e4 = this._bodyBlob, i3 = h(t4 = new FileReader()), t4.readAsText(e4), i3;
110
- if (this._bodyArrayBuffer) return Promise.resolve((function(e5) {
111
- for (var t5 = new Uint8Array(e5), i4 = new Array(t5.length), n4 = 0; n4 < t5.length; n4++) i4[n4] = String.fromCharCode(t5[n4]);
112
- return i4.join("");
113
- })(this._bodyArrayBuffer));
114
- if (this._bodyFormData) throw new Error("could not read FormData body as text");
115
- return Promise.resolve(this._bodyText);
116
- }, o && (this.formData = function() {
117
- return this.text().then(E);
118
- }), this.json = function() {
119
- return this.text().then(JSON.parse);
120
- }, this;
121
- }
122
- p.prototype.append = function(e4, t4) {
123
- e4 = d(e4), t4 = c(t4);
124
- var i3 = this.map[e4];
125
- this.map[e4] = i3 ? i3 + ", " + t4 : t4;
126
- }, p.prototype.delete = function(e4) {
127
- delete this.map[d(e4)];
128
- }, p.prototype.get = function(e4) {
129
- return e4 = d(e4), this.has(e4) ? this.map[e4] : null;
130
- }, p.prototype.has = function(e4) {
131
- return this.map.hasOwnProperty(d(e4));
132
- }, p.prototype.set = function(e4, t4) {
133
- this.map[d(e4)] = c(t4);
134
- }, p.prototype.forEach = function(e4, t4) {
135
- for (var i3 in this.map) this.map.hasOwnProperty(i3) && e4.call(t4, this.map[i3], i3, this);
136
- }, p.prototype.keys = function() {
137
- var e4 = [];
138
- return this.forEach((function(t4, i3) {
139
- e4.push(i3);
140
- })), u(e4);
141
- }, p.prototype.values = function() {
142
- var e4 = [];
143
- return this.forEach((function(t4) {
144
- e4.push(t4);
145
- })), u(e4);
146
- }, p.prototype.entries = function() {
147
- var e4 = [];
148
- return this.forEach((function(t4, i3) {
149
- e4.push([i3, t4]);
150
- })), u(e4);
151
- }, n2 && (p.prototype[Symbol.iterator] = p.prototype.entries);
152
- var v = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
153
- function b(e4, t4) {
154
- var i3, n3, r3 = (t4 = t4 || {}).body;
155
- if (e4 instanceof b) {
156
- if (e4.bodyUsed) throw new TypeError("Already read");
157
- this.url = e4.url, this.credentials = e4.credentials, t4.headers || (this.headers = new p(e4.headers)), this.method = e4.method, this.mode = e4.mode, this.signal = e4.signal, r3 || null == e4._bodyInit || (r3 = e4._bodyInit, e4.bodyUsed = true);
158
- } else this.url = String(e4);
159
- if (this.credentials = t4.credentials || this.credentials || "same-origin", !t4.headers && this.headers || (this.headers = new p(t4.headers)), this.method = (n3 = (i3 = t4.method || this.method || "GET").toUpperCase(), v.indexOf(n3) > -1 ? n3 : i3), this.mode = t4.mode || this.mode || null, this.signal = t4.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && r3) throw new TypeError("Body not allowed for GET or HEAD requests");
160
- this._initBody(r3);
161
- }
162
- function E(e4) {
163
- var t4 = new FormData();
164
- return e4.trim().split("&").forEach((function(e5) {
165
- if (e5) {
166
- var i3 = e5.split("="), n3 = i3.shift().replace(/\+/g, " "), r3 = i3.join("=").replace(/\+/g, " ");
167
- t4.append(decodeURIComponent(n3), decodeURIComponent(r3));
168
- }
169
- })), t4;
170
- }
171
- function A(e4, t4) {
172
- t4 || (t4 = {}), this.type = "default", this.status = void 0 === t4.status ? 200 : t4.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in t4 ? t4.statusText : "OK", this.headers = new p(t4.headers), this.url = t4.url || "", this._initBody(e4);
173
- }
174
- b.prototype.clone = function() {
175
- return new b(this, { body: this._bodyInit });
176
- }, y.call(b.prototype), y.call(A.prototype), A.prototype.clone = function() {
177
- return new A(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
178
- }, A.error = function() {
179
- var e4 = new A(null, { status: 0, statusText: "" });
180
- return e4.type = "error", e4;
181
- };
182
- var k = [301, 302, 303, 307, 308];
183
- A.redirect = function(e4, t4) {
184
- if (-1 === k.indexOf(t4)) throw new RangeError("Invalid status code");
185
- return new A(null, { status: t4, headers: { location: e4 } });
186
- }, t3.DOMException = e3.DOMException;
187
- try {
188
- new t3.DOMException();
189
- } catch (e4) {
190
- t3.DOMException = function(e5, t4) {
191
- this.message = e5, this.name = t4;
192
- var i3 = Error(e5);
193
- this.stack = i3.stack;
194
- }, t3.DOMException.prototype = Object.create(Error.prototype), t3.DOMException.prototype.constructor = t3.DOMException;
195
- }
196
- function T(e4, i3) {
197
- return new Promise((function(n3, o2) {
198
- var a2 = new b(e4, i3);
199
- if (a2.signal && a2.signal.aborted) return o2(new t3.DOMException("Aborted", "AbortError"));
200
- var s2 = new XMLHttpRequest();
201
- function l2() {
202
- s2.abort();
203
- }
204
- s2.onload = function() {
205
- var e5, t4, i4 = { status: s2.status, statusText: s2.statusText, headers: (e5 = s2.getAllResponseHeaders() || "", t4 = new p(), e5.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(e6) {
206
- var i5 = e6.split(":"), n4 = i5.shift().trim();
207
- if (n4) {
208
- var r4 = i5.join(":").trim();
209
- t4.append(n4, r4);
210
- }
211
- })), t4) };
212
- i4.url = "responseURL" in s2 ? s2.responseURL : i4.headers.get("X-Request-URL");
213
- var r3 = "response" in s2 ? s2.response : s2.responseText;
214
- n3(new A(r3, i4));
215
- }, s2.onerror = function() {
216
- o2(new TypeError("Network request failed"));
217
- }, s2.ontimeout = function() {
218
- o2(new TypeError("Network request failed"));
219
- }, s2.onabort = function() {
220
- o2(new t3.DOMException("Aborted", "AbortError"));
221
- }, s2.open(a2.method, a2.url, true), "include" === a2.credentials ? s2.withCredentials = true : "omit" === a2.credentials && (s2.withCredentials = false), "responseType" in s2 && r2 && (s2.responseType = "blob"), a2.headers.forEach((function(e5, t4) {
222
- s2.setRequestHeader(t4, e5);
223
- })), a2.signal && (a2.signal.addEventListener("abort", l2), s2.onreadystatechange = function() {
224
- 4 === s2.readyState && a2.signal.removeEventListener("abort", l2);
225
- }), s2.send(void 0 === a2._bodyInit ? null : a2._bodyInit);
226
- }));
227
- }
228
- T.polyfill = true, e3.fetch || (e3.fetch = T, e3.Headers = p, e3.Request = b, e3.Response = A), t3.Headers = p, t3.Request = b, t3.Response = A, t3.fetch = T, Object.defineProperty(t3, "__esModule", { value: true });
229
- })({});
230
- })(n), n.fetch.ponyfill = true, delete n.fetch.polyfill;
231
- var r = n;
232
- (t2 = r.fetch).default = r.fetch, t2.fetch = r.fetch, t2.Headers = r.Headers, t2.Request = r.Request, t2.Response = r.Response, e2.exports = t2;
233
- }, 5867: (e2, t2) => {
234
- "use strict";
235
- Object.defineProperty(t2, "__esModule", { value: true }), t2.HOST_API_URL_DEV = t2.HOST_API_URL = void 0, t2.HOST_API_URL = "https://api.deepdots.com/", t2.HOST_API_URL_DEV = "https://api-dev.deepdots.com/";
236
- }, 1422: function(e2, t2, i) {
237
- "use strict";
238
- var n = this && this.__importDefault || function(e3) {
239
- return e3 && e3.__esModule ? e3 : { default: e3 };
240
- };
241
- Object.defineProperty(t2, "__esModule", { value: true });
242
- const r = n(i(8453));
243
- let o = null;
244
- o || (o = (0, r.default)()), t2.default = o;
245
- }, 8453: function(e2, t2, i) {
246
- "use strict";
247
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
248
- return new (i2 || (i2 = Promise))((function(r2, o2) {
249
- function a2(e4) {
250
- try {
251
- l2(n2.next(e4));
252
- } catch (e5) {
253
- o2(e5);
254
- }
255
- }
256
- function s2(e4) {
257
- try {
258
- l2(n2.throw(e4));
259
- } catch (e5) {
260
- o2(e5);
261
- }
262
- }
263
- function l2(e4) {
264
- var t4;
265
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
266
- e5(t4);
267
- }))).then(a2, s2);
268
- }
269
- l2((n2 = n2.apply(e3, t3 || [])).next());
270
- }));
271
- };
272
- Object.defineProperty(t2, "__esModule", { value: true });
273
- const r = i(1167), o = i(7490), a = i(9303), s = i(4070), l = i(9071), d = i(5867), c = i(3433);
274
- t2.default = function() {
275
- const e3 = new a.Config();
276
- let t3 = new s.Log(e3);
277
- return { init: function(i2) {
278
- "boolean" == typeof (null == i2 ? void 0 : i2.debug) && e3.set("debug", i2.debug), "boolean" == typeof (null == i2 ? void 0 : i2.dryRun) && e3.set("dryRun", i2.dryRun), (null == i2 ? void 0 : i2.lang) && e3.set("lang", (0, c.normalizeSurveyLang)(i2.lang)), e3.set("url", (null == i2 ? void 0 : i2.env) && "dev" === (null == i2 ? void 0 : i2.env) ? d.HOST_API_URL_DEV : d.HOST_API_URL), e3.set("env", null == i2 ? void 0 : i2.env), t3.log("Initialized Magicfeedback", e3);
279
- }, send: function(i2, r2, o2, a2 = true, s2, d2) {
280
- var u;
281
- return n(this, void 0, void 0, (function* () {
282
- i2 || t3.err("No appID provided"), r2 || t3.err("No publicKey provided"), o2 || t3.err("No feedback provided"), o2.answers || o2.profile || o2.metrics || o2.metadata || t3.err("No feedback data provided");
283
- const n2 = e3.get("url"), p = { integration: i2, publicKey: r2, privateKey: d2, completed: a2, id: s2, feedback: o2, lang: null !== (u = (0, c.detectSurveyLang)(e3.get("lang"))) && void 0 !== u ? u : void 0 };
284
- try {
285
- if (e3.get("dryRun")) return t3.log("Dry run enabled: skipping native feedback submit"), `dry-run-${Date.now()}`;
286
- const i3 = yield (0, l.sendFeedback)(n2, p, t3);
287
- return t3.log("sent native feedback"), i3;
288
- } catch (e4) {
289
- return t3.err("error native feedback", e4), false;
290
- }
291
- }));
292
- }, form: function(i2, n2, o2, a2) {
293
- return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new r.Form(e3, i2, n2, o2, a2);
294
- }, agentForm: function(i2, n2, r2) {
295
- return i2 || t3.err("No integrationId provided"), n2 || t3.err("No publicKey provided"), new o.AgentForm(e3, i2, n2, r2);
296
- }, session: function(i2) {
297
- return i2 || t3.err("No sessionId provided"), new r.Form(e3, i2);
298
- }, previewPage: function(i2, o2, a2) {
299
- return n(this, void 0, void 0, (function* () {
300
- i2 || t3.err("No selector provided"), o2 && o2.page || t3.err("No page provided for preview");
301
- const n2 = (null == o2 ? void 0 : o2.appId) || `preview-${Date.now()}`, s2 = new r.Form(e3, n2);
302
- return yield s2.previewPage(i2, o2, a2), s2;
303
- }));
304
- } };
305
- };
306
- }, 9481: (e2, t2) => {
307
- "use strict";
308
- Object.defineProperty(t2, "__esModule", { value: true }), t2.History = void 0, t2.History = class {
309
- constructor() {
310
- this.items = [];
311
- }
312
- enqueue(e3) {
313
- this.items.push(e3);
314
- }
315
- dequeue() {
316
- return this.items.shift();
317
- }
318
- rollback() {
319
- return this.items.pop();
320
- }
321
- front() {
322
- return this.items[0];
323
- }
324
- back() {
325
- return this.items[this.items.length - 1];
326
- }
327
- isEmpty() {
328
- return 0 === this.items.length;
329
- }
330
- size() {
331
- return this.items.length;
332
- }
333
- get(e3) {
334
- return this.items[e3];
335
- }
336
- };
337
- }, 7490: function(e2, t2, i) {
338
- "use strict";
339
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
340
- return new (i2 || (i2 = Promise))((function(r2, o2) {
341
- function a2(e4) {
342
- try {
343
- l2(n2.next(e4));
344
- } catch (e5) {
345
- o2(e5);
346
- }
347
- }
348
- function s2(e4) {
349
- try {
350
- l2(n2.throw(e4));
351
- } catch (e5) {
352
- o2(e5);
353
- }
354
- }
355
- function l2(e4) {
356
- var t4;
357
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
358
- e5(t4);
359
- }))).then(a2, s2);
360
- }
361
- l2((n2 = n2.apply(e3, t3 || [])).next());
362
- }));
363
- };
364
- Object.defineProperty(t2, "__esModule", { value: true }), t2.AgentForm = void 0;
365
- const r = i(4070), o = i(3501), a = i(4759), s = i(1351), l = i(5349), d = i(2335), c = i(8129), u = i(7643), p = i(7627), m = i(9089), h = i(9039);
366
- t2.AgentForm = class {
367
- constructor(e3, t3, i2, n2) {
368
- this.config = e3, this.log = new r.Log(e3), this.url = e3.get("url"), this.integrationId = t3, this.publicKey = i2, this.privateKey = n2, this.formOptionsConfig = { addButton: true, addSuccessScreen: true, questionFormat: "standard", answerDelimiter: s.DEFAULT_ANSWER_DELIMITER, resume: true, allowBack: false, emptyAnswerText: "" }, this.selector = "", this.language = "en", this.product = { customIcons: false }, this.integrationData = null, this.started = false, this.sessionId = "", this.conversation = [], this.askedRefs = [], this.currentTurn = 1, this.maxTurns = 0, this.currentQuestion = null, this.questionHistory = [], this.busy = false, this.rateLimitTimer = null, this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
369
- }
370
- generate(e3, t3 = {}) {
371
- var i2, r2;
372
- return n(this, void 0, void 0, (function* () {
373
- this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3, t3.lang && (this.language = t3.lang), t3.primaryColor && (this.primaryColor = t3.primaryColor);
374
- const n2 = false === this.formOptionsConfig.resume || this.isPreview() ? null : this.restore(), o2 = null === (r2 = null === (i2 = this.integrationData) || void 0 === i2 ? void 0 : i2.style) || void 0 === r2 ? void 0 : r2.startMessage;
375
- if (n2 || !o2) yield this.open(n2);
376
- else try {
377
- this.renderWelcome(o2);
378
- } catch (e4) {
379
- this.log.err(`Could not show the introduction of ${this.integrationId}:`, e4), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
380
- }
381
- }));
382
- }
383
- startForm() {
384
- return n(this, void 0, void 0, (function* () {
385
- this.started || (yield this.open(null));
386
- }));
387
- }
388
- renderWelcome(e3) {
389
- var t3;
390
- const i2 = (0, d.generateContainer)(this.selector, this.integrationId);
391
- this.primaryColor && (0, d.applyPrimaryColor)(i2, this.primaryColor), (0, d.applyDirection)(i2, this.language), i2.appendChild((0, u.renderStartMessage)(e3, this.formOptionsConfig.addButton, this.formOptionsConfig.startButtonText || (0, p.t)(this.language, "action.start"), (() => this.startForm()))), this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, formData: null !== (t3 = this.integrationData) && void 0 !== t3 ? t3 : void 0, lang: this.language });
392
- }
393
- open(e3) {
394
- var t3, i2, r2;
395
- return n(this, void 0, void 0, (function* () {
396
- this.started = true;
397
- try {
398
- if (e3) this.log.log(`Resuming agent session ${e3.sessionId} at turn ${e3.currentTurn}`), this.mountForm(), this.renderStep();
399
- else {
400
- const e4 = yield this.startWithRetry();
401
- this.sessionId = e4.sessionId, this.maxTurns = e4.maxTurns, this.currentTurn = null !== (t3 = e4.currentTurn) && void 0 !== t3 ? t3 : 1, this.total = Math.max(this.maxTurns - 1, 0);
402
- const n2 = (0, s.toAgentStep)(e4, this.adapterContext());
403
- if (this.mountForm(), "END" === n2.kind) return yield this.renderEnd(n2), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, sessionId: this.sessionId, formData: null !== (i2 = this.integrationData) && void 0 !== i2 ? i2 : void 0, lang: this.language, completed: true })));
404
- this.acceptQuestion(n2), this.renderStep(), this.persist();
405
- }
406
- this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, sessionId: this.sessionId, formData: null !== (r2 = this.integrationData) && void 0 !== r2 ? r2 : void 0, lang: this.language, formOptionsConfig: this.formOptionsConfig }));
407
- } catch (e4) {
408
- this.log.err(`Could not start the agent survey ${this.integrationId}:`, e4), this.renderFatal(e4), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
409
- }
410
- }));
411
- }
412
- next() {
413
- return n(this, void 0, void 0, (function* () {
414
- return this.runTurn();
415
- }));
416
- }
417
- answer() {
418
- const e3 = document.getElementById(this.formId());
419
- return e3 ? (0, l.scrapeInputs)(e3) : [];
420
- }
421
- getConversation() {
422
- return [...this.conversation];
423
- }
424
- getSessionId() {
425
- return this.sessionId;
426
- }
427
- reset() {
428
- this.sessionId = "", this.conversation = [], this.askedRefs = [], this.currentTurn = 1, this.maxTurns = 0, this.currentQuestion = null, this.questionHistory = [], this.busy = false, this.completed = false, this.progress = 0, this.clearRateLimitTimer(), this.clearPersisted();
429
- }
430
- runTurn() {
431
- var e3;
432
- return n(this, void 0, void 0, (function* () {
433
- if (this.busy || this.completed || !this.currentQuestion) return;
434
- (0, h.cancelAutoAdvance)(document.getElementById(this.questionsId())), this.busy = true, this.setSubmitDisabled(true), this.clearError();
435
- const t3 = this.currentQuestion;
436
- try {
437
- const i2 = document.getElementById(this.formId()), n2 = document.getElementById(this.questionsId());
438
- if (!i2) throw new Error("Agent form not found");
439
- yield (0, c.awaitUploadReady)(n2);
440
- const r2 = (0, l.scrapeInputs)(i2);
441
- let o2 = (0, s.encodeAnswer)(r2, t3, this.formOptionsConfig.answerDelimiter);
442
- if ("" === o2) {
443
- if (t3.require) return void this.showError(this.formOptionsConfig.requiredMessage || (0, p.t)(this.language, "message.required"));
444
- o2 = this.formOptionsConfig.emptyAnswerText || "";
445
- }
446
- this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
447
- const d2 = { role: "user", content: o2, questionType: t3.type, questionRef: t3.ref }, u2 = this.currentTurn + 1, m2 = yield (0, a.nextAgentTurn)(this.url, Object.assign({ publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId, sessionId: this.sessionId, conversation: [...this.conversation], currentTurn: u2, lastAnswer: o2, lastQuestionRef: t3.ref, askedRefs: [...this.askedRefs] }, this.previewFlag()), this.log);
448
- this.conversation.push(d2), this.currentTurn = null !== (e3 = m2.currentTurn) && void 0 !== e3 ? e3 : u2, m2.maxTurns && (this.maxTurns = m2.maxTurns), this.total = Math.max(this.maxTurns - 1, 0);
449
- const h2 = (0, s.toAgentStep)(m2, this.adapterContext());
450
- if ("END" === h2.kind) return void (yield this.renderEnd(h2));
451
- if (this.maxTurns > 0 && this.currentTurn > this.maxTurns + 1) return void (yield this.renderEnd({ kind: "END", reason: "MAX_TURNS", currentTurn: this.currentTurn, maxTurns: this.maxTurns }));
452
- this.acceptQuestion(h2), this.renderStep(), this.persist(), this.formOptionsConfig.onAgentTurnEvent && (yield this.formOptionsConfig.onAgentTurnEvent({ turn: this.currentTurn, maxTurns: this.maxTurns, question: h2.question, isFromBase: h2.isFromBase, topic: h2.topic, coverageGaps: h2.coverageGaps, coverageSummary: h2.coverageSummary, conversation: this.getConversation() })), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.sessionId, loading: false, progress: this.progress, total: this.total, completed: false, error: null }));
453
- } catch (e4) {
454
- yield this.handleTurnError(e4);
455
- } finally {
456
- this.completed || (this.busy = false, this.rateLimitTimer || this.setSubmitDisabled(false));
457
- }
458
- }));
459
- }
460
- handleTurnError(e3) {
461
- return n(this, void 0, void 0, (function* () {
462
- this.log.err(`An error occurred during the agent turn ${this.integrationId}:`, e3), e3 instanceof o.AgentApiError && "RATE_LIMITED" === e3.kind ? this.startRateLimitCountdown(e3.retryAfterMs || 6e4) : this.showError(this.errorMessageFor(e3)), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: false, error: e3 }));
463
- }));
464
- }
465
- acceptQuestion(e3) {
466
- const t3 = e3.question;
467
- e3.isFromBase && t3.ref && !this.askedRefs.includes(t3.ref) && this.askedRefs.push(t3.ref), this.conversation.push({ role: "agent", content: t3.title, questionType: t3.type, questionRef: t3.ref }), this.currentQuestion = t3, this.questionHistory.push(t3), this.progress = Math.max(this.currentTurn - 1, 0);
468
- }
469
- formId() {
470
- return "magicfeedback-agent-" + this.integrationId;
471
- }
472
- questionsId() {
473
- return "magicfeedback-agent-questions-" + this.integrationId;
474
- }
475
- mountForm() {
476
- const e3 = (0, d.generateContainer)(this.selector, this.integrationId);
477
- this.primaryColor && (0, d.applyPrimaryColor)(e3, this.primaryColor), (0, d.applyDirection)(e3, this.language);
478
- const t3 = document.createElement("form");
479
- t3.classList.add("magicfeedback-form"), t3.classList.add("magicfeedback-agent-form"), t3.id = this.formId(), t3.addEventListener("submit", ((e4) => {
480
- e4.preventDefault(), this.runTurn();
481
- }));
482
- const i2 = document.createElement("div");
483
- i2.classList.add("magicfeedback-questions"), i2.id = this.questionsId(), t3.appendChild(i2), this.formOptionsConfig.addButton && t3.appendChild((0, u.renderActions)(this.formOptionsConfig.allowBack ? "MAGICSURVEY" : "MAGICFORM", (() => this.back()), this.formOptionsConfig.sendButtonText || (0, p.t)(this.language, "action.send"), this.formOptionsConfig.backButtonText || (0, p.t)(this.language, "action.back"), this.formOptionsConfig.nextButtonText || (0, p.t)(this.language, "action.next"))), e3.appendChild(t3);
484
- }
485
- renderStep() {
486
- const e3 = document.getElementById(this.questionsId());
487
- e3 && this.currentQuestion && (e3.innerHTML = "", (0, u.renderQuestions)([this.currentQuestion], this.formOptionsConfig.questionFormat, this.language, this.product, (() => this.runTurn())).forEach(((t3) => e3.appendChild(t3))), (0, m.armGhostTapGuard)(e3));
488
- }
489
- renderEnd(e3) {
490
- return n(this, void 0, void 0, (function* () {
491
- this.completed = true, this.currentQuestion = null, this.busy = false, this.timeToCompleted = this.timeToCompleted ? Date.now() - this.timeToCompleted : 0, this.clearRateLimitTimer(), this.clearPersisted();
492
- const t3 = document.getElementById("magicfeedback-container-" + this.integrationId);
493
- if (t3 && false !== this.formOptionsConfig.addSuccessScreen) {
494
- t3.innerHTML = "";
495
- const i2 = "BLOCKED" === e3.reason ? this.formOptionsConfig.blockedMessage || (0, p.t)(this.language, "message.blocked") : this.formOptionsConfig.successMessage || (0, p.t)(this.language, "message.success"), n2 = (0, u.renderSuccess)(i2);
496
- n2.classList.add("magicfeedback-success-message"), n2.classList.add("magicfeedback-agent-end"), "BLOCKED" === e3.reason && n2.classList.add("magicfeedback-agent-end--blocked"), t3.appendChild(n2);
497
- }
498
- this.formOptionsConfig.onFinishEvent && (yield this.formOptionsConfig.onFinishEvent({ sessionId: this.sessionId, reason: e3.reason, turns: this.currentTurn, maxTurns: this.maxTurns, conversation: this.getConversation(), coverageSummary: e3.coverageSummary, timeToCompleted: this.timeToCompleted })), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.sessionId, loading: false, progress: this.progress, total: this.total, completed: true, error: null }));
499
- }));
500
- }
501
- back() {
502
- return n(this, void 0, void 0, (function* () {
503
- this.busy || this.completed || this.formOptionsConfig.allowBack && (this.questionHistory.length < 2 || (this.questionHistory.pop(), this.conversation.pop(), this.conversation.pop(), this.currentQuestion = this.questionHistory[this.questionHistory.length - 1], this.currentTurn = Math.max(this.currentTurn - 1, 1), this.progress = Math.max(this.currentTurn - 1, 0), this.clearError(), this.renderStep(), this.persist(), this.formOptionsConfig.onBackEvent && (yield this.formOptionsConfig.onBackEvent({ progress: this.progress, total: this.total }))));
504
- }));
505
- }
506
- renderFatal(e3) {
507
- try {
508
- (0, d.generateContainer)(this.selector, this.integrationId).appendChild((0, u.renderError)(this.errorMessageFor(e3)));
509
- } catch (e4) {
510
- }
511
- }
512
- errorMessageFor(e3) {
513
- if (!(e3 instanceof o.AgentApiError)) return "Something went wrong. Please try again.";
514
- switch (e3.kind) {
515
- case "AUTH":
516
- case "NOT_FOUND":
517
- case "BAD_CONFIG":
518
- return "This survey is not available right now.";
519
- case "AI_UNAVAILABLE":
520
- return "We couldn't start the survey. Please try again in a moment.";
521
- default:
522
- return "Something went wrong. Please try again.";
523
- }
524
- }
525
- adapterContext() {
526
- return { integrationId: this.integrationId, sessionId: this.sessionId, language: this.language, log: this.log };
527
- }
528
- startWithRetry() {
529
- return n(this, void 0, void 0, (function* () {
530
- const e3 = Object.assign({ publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId }, this.previewFlag());
531
- try {
532
- return yield (0, a.startAgentSurvey)(this.url, e3, this.log);
533
- } catch (t3) {
534
- if (t3 instanceof o.AgentApiError && "AI_UNAVAILABLE" === t3.kind) return this.log.log("Retrying /start after a transient AI failure"), yield new Promise(((e4) => setTimeout(e4, 1500))), yield (0, a.startAgentSurvey)(this.url, e3, this.log);
535
- throw t3;
536
- }
537
- }));
538
- }
539
- setSubmitDisabled(e3) {
540
- const t3 = document.getElementById("magicfeedback-submit");
541
- t3 && (t3.disabled = e3);
542
- }
543
- clearError() {
544
- const e3 = document.getElementById(this.questionsId());
545
- null == e3 || e3.querySelectorAll(".magicfeedback-error").forEach(((e4) => e4.remove()));
546
- }
547
- showError(e3) {
548
- const t3 = document.getElementById(this.questionsId());
549
- t3 && (this.clearError(), t3.insertBefore((0, u.renderError)(e3), t3.firstChild));
550
- }
551
- startRateLimitCountdown(e3) {
552
- this.clearRateLimitTimer(), this.setSubmitDisabled(true);
553
- let t3 = Math.ceil(e3 / 1e3);
554
- const i2 = this.formOptionsConfig.rateLimitMessage || (0, p.t)(this.language, "message.rateLimit"), n2 = () => {
555
- if (t3 <= 0) return this.clearRateLimitTimer(), this.clearError(), void this.setSubmitDisabled(false);
556
- this.showError(i2.replace("{seconds}", String(t3))), t3 -= 1;
557
- };
558
- n2(), this.rateLimitTimer = setInterval(n2, 1e3);
559
- }
560
- clearRateLimitTimer() {
561
- this.rateLimitTimer && (clearInterval(this.rateLimitTimer), this.rateLimitTimer = null);
562
- }
563
- storageKey() {
564
- return `magicfeedback-agent-${this.integrationId}`;
565
- }
566
- isPreview() {
567
- return Boolean(this.config.get("dryRun"));
568
- }
569
- previewFlag() {
570
- return this.isPreview() ? { preview: true } : {};
571
- }
572
- persist() {
573
- if (!this.isPreview() && false !== this.formOptionsConfig.resume) try {
574
- const e3 = { sessionId: this.sessionId, conversation: this.conversation, currentTurn: this.currentTurn, maxTurns: this.maxTurns, askedRefs: this.askedRefs, questionHistory: this.questionHistory, savedAt: Date.now() };
575
- localStorage.setItem(this.storageKey(), JSON.stringify(e3));
576
- } catch (e3) {
577
- this.log.log("Could not persist the agent session", e3);
578
- }
579
- }
580
- restore() {
581
- var e3;
582
- try {
583
- const t3 = localStorage.getItem(this.storageKey());
584
- if (!t3) return null;
585
- const i2 = JSON.parse(t3);
586
- return (null == i2 ? void 0 : i2.sessionId) && (null === (e3 = i2.questionHistory) || void 0 === e3 ? void 0 : e3.length) ? Date.now() - (i2.savedAt || 0) > 18e5 ? (this.clearPersisted(), null) : (this.sessionId = i2.sessionId, this.conversation = i2.conversation || [], this.currentTurn = i2.currentTurn || 1, this.maxTurns = i2.maxTurns || 0, this.askedRefs = i2.askedRefs || [], this.questionHistory = i2.questionHistory, this.currentQuestion = this.questionHistory[this.questionHistory.length - 1], this.total = Math.max(this.maxTurns - 1, 0), this.progress = Math.max(this.currentTurn - 1, 0), i2) : null;
587
- } catch (e4) {
588
- return this.log.log("Could not restore the agent session", e4), null;
589
- }
590
- }
591
- clearPersisted() {
592
- try {
593
- localStorage.removeItem(this.storageKey());
594
- } catch (e3) {
595
- }
596
- }
597
- applyIntegrationContext(e3) {
598
- var t3, i2;
599
- this.integrationData = e3, (null === (t3 = null == e3 ? void 0 : e3.lang) || void 0 === t3 ? void 0 : t3.length) && (this.language = e3.lang[0]), (null == e3 ? void 0 : e3.product) && (this.product = e3.product), (null === (i2 = null == e3 ? void 0 : e3.style) || void 0 === i2 ? void 0 : i2.primaryColor) && (this.primaryColor = e3.style.primaryColor);
600
- }
601
- };
602
- }, 9303: (e2, t2) => {
603
- "use strict";
604
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Config = void 0, t2.Config = class {
605
- constructor() {
606
- this.variables = {}, this.variables.env = "prod", this.variables.debug = false, this.variables.dryRun = false;
607
- }
608
- get(e3) {
609
- return this.variables[e3];
610
- }
611
- set(e3, t3) {
612
- this.variables[e3] = t3;
613
- }
614
- };
615
- }, 1167: function(e2, t2, i) {
616
- "use strict";
617
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
618
- return new (i2 || (i2 = Promise))((function(r2, o2) {
619
- function a2(e4) {
620
- try {
621
- l2(n2.next(e4));
622
- } catch (e5) {
623
- o2(e5);
624
- }
625
- }
626
- function s2(e4) {
627
- try {
628
- l2(n2.throw(e4));
629
- } catch (e5) {
630
- o2(e5);
631
- }
632
- }
633
- function l2(e4) {
634
- var t4;
635
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
636
- e5(t4);
637
- }))).then(a2, s2);
638
- }
639
- l2((n2 = n2.apply(e3, t3 || [])).next());
640
- }));
641
- };
642
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Form = void 0;
643
- const r = i(4760), o = i(7490), a = i(4070), s = i(9071), l = i(7643), d = i(8129), c = i(2335), u = i(5349), p = i(1719), m = i(3378), h = i(7305), f = i(9481), g = i(7170), y = i(7627), v = i(3433), b = i(9089), E = i(4069), A = i(9039), k = [r.FEEDBACKAPPANSWERTYPE.INFO_PAGE, r.FEEDBACKAPPANSWERTYPE.PASSWORD, r.FEEDBACKAPPANSWERTYPE.EMAIL, r.FEEDBACKAPPANSWERTYPE.CONTACT, r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, r.FEEDBACKAPPANSWERTYPE.MAX_DIFF];
644
- t2.Form = class {
645
- constructor(e3, t3, i2, n2, r2) {
646
- this.urlAutoAdvanceChecked = false, this.config = e3, this.log = new a.Log(e3), this.formOptionsConfig = { addButton: true, addSuccessScreen: true, getMetaData: true, customMetaData: [], questionFormat: "standard" }, this.selector = "", this.appId = t3, this.publicKey = i2 || "", this.url = e3.get("url"), this.id = "", this.formData = null, this.activeLang = null, this.feedback = { text: "", answers: [], profile: null != n2 ? n2 : [], metrics: [], metadata: null != r2 ? r2 : [] }, this.history = new f.History(), this.agentForm = null, this.graph = new p.PageGraph([]), this.progress = 0, this.total = 0, this.completed = false, this.sending = false, this.timeToCompleted = 0;
647
- }
648
- generate(e3, t3) {
649
- var i2, r2, a2, l2, d2, c2, u2;
650
- return n(this, void 0, void 0, (function* () {
651
- try {
652
- this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3;
653
- let n2 = this.formData;
654
- const p2 = (0, v.detectSurveyLang)((null == t3 ? void 0 : t3.lang) || this.config.get("lang"));
655
- if (void 0 !== this.formData && this.formData || (n2 = "" !== this.publicKey ? yield (0, s.getForm)(this.url, this.appId, this.publicKey, this.log, p2) : yield (0, s.getSessionForm)(this.url, this.appId, this.log, p2)), void 0 === n2 || !n2) throw new Error(`No data for app ${this.appId}`);
656
- if (null === (i2 = n2.error) || void 0 === i2 ? void 0 : i2.message) throw new Error(n2.error.message);
657
- if ("AGENT" === n2.mode) return this.agentForm = new o.AgentForm(this.config, this.appId, this.publicKey), this.agentForm.applyIntegrationContext(n2), void (yield this.agentForm.generate(e3, t3));
658
- if (n2.questions = (null === (r2 = n2.questions) || void 0 === r2 ? void 0 : r2.filter(((e4) => "ACTIVE" === e4.status))) || [], n2.pages = (null === (a2 = n2.pages) || void 0 === a2 ? void 0 : a2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (l2 = n2.pages) || void 0 === l2 || l2.forEach(((e4) => {
659
- var t4;
660
- return e4.integrationQuestions = null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.filter(((e5) => "ACTIVE" === e5.status));
661
- })), this.formData = n2, this.activeLang = this.resolveActiveLang(p2), !this.formData.savedAt) {
662
- this.formData.savedAt = /* @__PURE__ */ new Date();
663
- try {
664
- localStorage.setItem(`magicfeedback-${this.appId}-${this.lang()}`, JSON.stringify(this.formData));
665
- } catch (e4) {
666
- this.log.log("Could not cache the form data", e4);
667
- }
668
- }
669
- if (void 0 === this.formData.questions || !this.formData.questions) throw new Error(`No questions for app ${this.appId}`);
670
- this.formData.pages && 0 !== (null === (d2 = this.formData.pages) || void 0 === d2 ? void 0 : d2.length) || this.formatPages(), null === (c2 = this.formData.questions) || void 0 === c2 || c2.sort(((e4, t4) => e4.position - t4.position)), this.formData.pages = this.formData.pages.filter(((e4) => {
671
- var t4;
672
- return (null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.length) > 0;
673
- })), this.formOptionsConfig.getMetaData && this.getMetaData(), (null === (u2 = this.formData.style) || void 0 === u2 ? void 0 : u2.startMessage) ? yield this.generateWelcomeMessage(this.formData.style.startMessage) : this.generateForm("open");
674
- } catch (e4) {
675
- return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
676
- }
677
- }));
678
- }
679
- previewPage(e3, t3, i2 = {}) {
680
- var r2, o2, a2, s2, l2, d2, c2, u2, p2;
681
- return n(this, void 0, void 0, (function* () {
682
- try {
683
- if (!t3 || !t3.page) throw new Error("[MagicFeedback] No page provided for preview");
684
- if (!t3.page.integrationQuestions || 0 === t3.page.integrationQuestions.length) throw new Error("[MagicFeedback] No questions provided for preview");
685
- this.config.set("dryRun", true), this.formOptionsConfig = Object.assign(Object.assign(Object.assign({}, this.formOptionsConfig), { getMetaData: false }), i2), this.selector = e3;
686
- const n2 = (t3.page.integrationQuestions || []).filter(((e4) => !e4.status || "ACTIVE" === e4.status)).sort(((e4, t4) => e4.position - t4.position)), h2 = new m.Page(null !== (r2 = t3.page.id) && void 0 !== r2 ? r2 : "1", null !== (o2 = t3.page.position) && void 0 !== o2 ? o2 : 1, null !== (a2 = t3.appId) && void 0 !== a2 ? a2 : this.appId, n2, null !== (s2 = t3.page.integrationPageRoutes) && void 0 !== s2 ? s2 : []);
687
- this.formData = { id: null !== (l2 = t3.appId) && void 0 !== l2 ? l2 : this.appId, identity: null !== (d2 = t3.identity) && void 0 !== d2 ? d2 : "MAGICFORM", lang: [null !== (c2 = t3.lang) && void 0 !== c2 ? c2 : "en"], product: null !== (u2 = t3.product) && void 0 !== u2 ? u2 : { customIcons: false }, style: null !== (p2 = t3.style) && void 0 !== p2 ? p2 : {}, questions: n2, pages: [h2] }, yield this.generateForm();
688
- } catch (e4) {
689
- return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
690
- }
691
- }));
692
- }
693
- formatPages() {
694
- var e3;
695
- if (this.formData) switch (this.formData.identity) {
696
- case "MAGICSURVEY":
697
- this.formData.pages = [], null === (e3 = this.formData.questions) || void 0 === e3 || e3.forEach(((e4) => {
698
- var t4, i2;
699
- const n2 = new h.PageRoute(e4.id, e4.ref, h.OperatorType.NOEQUAL, [], h.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), r2 = new m.Page(e4.position.toString(), e4.position, this.appId, [e4], [n2]);
700
- null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(r2);
701
- }));
702
- break;
703
- case "MAGICFORM":
704
- const t3 = new m.Page("1", 1, this.appId, this.formData.questions, []);
705
- this.formData.pages = [t3];
706
- }
707
- }
708
- generateContainer() {
709
- var e3, t3;
710
- const i2 = (0, c.generateContainer)(this.selector, this.appId), n2 = null === (t3 = null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.style) || void 0 === t3 ? void 0 : t3.primaryColor;
711
- return n2 && (0, c.applyPrimaryColor)(i2, n2), (0, c.applyDirection)(i2, this.lang()), i2;
712
- }
713
- generateForm(e3 = "open") {
714
- var t3, i2, r2;
715
- return n(this, void 0, void 0, (function* () {
716
- try {
717
- if (!this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
718
- this.graph = new p.PageGraph(this.formData.pages.sort(((e4, t4) => e4.position - t4.position)));
719
- let n2 = this.generateContainer();
720
- const o2 = document.createElement("form");
721
- o2.classList.add("magicfeedback-form"), o2.id = "magicfeedback-" + this.appId, o2.addEventListener("submit", ((e4) => e4.preventDefault()));
722
- const a2 = document.createElement("div");
723
- a2.classList.add("magicfeedback-questions"), a2.id = "magicfeedback-questions-" + this.appId;
724
- const s2 = this.graph.getFirstPage();
725
- if (!s2) throw new Error("No page found");
726
- if (this.total = this.graph.findMaxDepth(), s2.elements = (0, l.renderQuestions)(s2.questions, this.formOptionsConfig.questionFormat, this.lang(), null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.autoSend())), null === (i2 = s2.elements) || void 0 === i2 || i2.forEach(((e4) => a2.appendChild(e4))), o2.appendChild(a2), (0, b.armGhostTapGuard)(a2), this.history.enqueue(s2), n2.appendChild(o2), this.progress = this.total - this.graph.findMaxDepth(s2), this.formOptionsConfig.addButton) {
727
- const e4 = (0, l.renderActions)(null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText || (0, y.t)(this.lang(), "action.send"), this.formOptionsConfig.backButtonText || (0, y.t)(this.lang(), "action.back"), this.formOptionsConfig.nextButtonText || (0, y.t)(this.lang(), "action.next"));
728
- o2.appendChild(e4), this.syncBackButton();
729
- }
730
- this.formOptionsConfig.addButton && o2.addEventListener("submit", ((e4) => {
731
- e4.preventDefault(), this.send();
732
- })), this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, formData: this.formData, lang: this.lang(), formOptionsConfig: this.formOptionsConfig })), this.autofocusAfterRender(e3), this.autoAdvanceFromUrl(a2, s2);
733
- } catch (e4) {
734
- return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
735
- }
736
- }));
737
- }
738
- autoAdvanceFromUrl(e3, t3) {
739
- if (this.urlAutoAdvanceChecked) return;
740
- if (this.urlAutoAdvanceChecked = true, !(0, A.autoAdvanceRequested)() || 1 !== t3.questions.length) return;
741
- const i2 = (0, A.answeredInput)(e3, t3.questions[0].ref);
742
- i2 && (0, A.scheduleAutoAdvance)(i2, (() => this.autoSend()));
743
- }
744
- startForm() {
745
- this.agentForm ? this.agentForm.startForm() : this.generateForm("navigation");
746
- }
747
- focusFirstQuestion() {
748
- return "undefined" != typeof document && (0, E.focusFirstTextQuestion)(document.getElementById("magicfeedback-questions-" + this.appId));
749
- }
750
- autofocusAfterRender(e3) {
751
- const t3 = this.formOptionsConfig.autofocus;
752
- t3 && ("open" === e3 && "always" !== t3 || this.focusFirstQuestion());
753
- }
754
- lang() {
755
- var e3;
756
- return this.activeLang || (null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang) && this.formData.lang[0] || "en";
757
- }
758
- getLang() {
759
- return this.lang();
760
- }
761
- resolveActiveLang(e3) {
762
- var t3, i2;
763
- const n2 = (null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.lang) || [];
764
- return (null === (i2 = this.formData) || void 0 === i2 ? void 0 : i2.servedLang) ? this.formData.servedLang : e3 && n2.includes(e3) ? e3 : n2[0] || null;
765
- }
766
- generateWelcomeMessage(e3) {
767
- return n(this, void 0, void 0, (function* () {
768
- try {
769
- const t3 = this.generateContainer(), i2 = (0, l.renderStartMessage)(e3, this.formOptionsConfig.addButton, this.formOptionsConfig.startButtonText || (0, y.t)(this.lang(), "action.start"), (() => this.startForm()));
770
- t3.appendChild(i2), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, formData: this.formData, lang: this.lang() }));
771
- } catch (e4) {
772
- return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
773
- }
774
- }));
775
- }
776
- getMetaData() {
777
- this.formOptionsConfig.customMetaData && (this.feedback.metadata = [...this.feedback.metadata, ...this.formOptionsConfig.customMetaData]), this.feedback.metadata.push({ key: "navigator-url", value: [window.location.href] }), this.feedback.metadata.push({ key: "navigator-origin", value: [window.location.origin] }), this.feedback.metadata.push({ key: "navigator-pathname", value: [window.location.pathname] }), this.feedback.metadata.push({ key: "navigator-search", value: [window.location.search] });
778
- const e3 = new URLSearchParams(window.location.search);
779
- Array.from(new Set(e3.keys())).forEach(((t3) => {
780
- const i2 = e3.getAll(t3);
781
- i2.length > 0 && this.feedback.metadata.push({ key: `query-${t3}`, value: i2 });
782
- })), this.feedback.metadata.push({ key: "navigator-user", value: [navigator.userAgent] }), this.feedback.metadata.push({ key: "navigator-language", value: [navigator.language] }), this.feedback.metadata.push({ key: "navigator-platform", value: [navigator.platform] }), this.feedback.metadata.push({ key: "navigator-appVersion", value: [navigator.appVersion] }), this.feedback.metadata.push({ key: "navigator-appName", value: [navigator.appName] }), this.feedback.metadata.push({ key: "navigator-product", value: [navigator.product] }), this.feedback.metadata.push({ key: "screen-width", value: [window.screen.width.toString()] }), this.feedback.metadata.push({ key: "screen-height", value: [window.screen.height.toString()] }), this.appId && "" === this.publicKey && this.feedback.metadata.push({ key: "MAGICFEEDBACK_SESSION", value: [this.appId] });
783
- }
784
- send(e3, t3, i2, o2) {
785
- var a2, s2;
786
- return n(this, void 0, void 0, (function* () {
787
- if (this.agentForm) return this.agentForm.next();
788
- const n2 = document.getElementById("magicfeedback-questions-" + this.appId);
789
- (0, A.cancelAutoAdvance)(n2), this.sending = true;
790
- try {
791
- if (i2 && (this.feedback.profile = [...this.feedback.profile, ...i2]), t3 && (this.feedback.metrics = [...this.feedback.metrics, ...t3]), e3 && (this.feedback.metadata = [...this.feedback.metadata, ...e3]), o2) {
792
- this.feedback.answers = [...this.feedback.answers, ...o2], this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
793
- const e4 = yield this.pushAnswers(false);
794
- if (!e4) throw new Error("No response");
795
- return this.id = e4, void (this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total })));
796
- }
797
- yield (0, d.awaitUploadReady)(n2), this.answer(), this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
798
- const l2 = this.history.back();
799
- if (!l2) throw new Error("No page found");
800
- for (const e4 of l2.questions.filter(((e5) => e5.require && ![r.FEEDBACKAPPANSWERTYPE.CONSENT, r.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
801
- const t4 = e4.assets, i3 = this.feedback.answers.filter(((t5) => t5.key.includes(e4.ref) && !t5.key.includes("extra-option")));
802
- if (0 === i3.length || i3.find(((e5) => 0 === e5.value.length))) throw this.log.err(`The question ${e4.ref} is required`), new Error("No response");
803
- if (null == t4 ? void 0 : t4.minOptions) {
804
- let n3 = [];
805
- if ((null == t4 ? void 0 : t4.exclusiveAnswers) && (n3 = null == t4 ? void 0 : t4.exclusiveAnswers), !i3[0].value.find(((e5) => n3.includes(e5))) && i3[0].value.length < (null == t4 ? void 0 : t4.minOptions)) throw this.log.err(`The question ${e4.ref} requires at least ${null == t4 ? void 0 : t4.minOptions} options`), new Error("No response");
806
- }
807
- if (e4.type === r.FEEDBACKAPPANSWERTYPE.MAX_DIFF) {
808
- const t5 = null !== (s2 = null === (a2 = e4.assets) || void 0 === a2 ? void 0 : a2.setIndex) && void 0 !== s2 ? s2 : 1, i4 = this.parseMaxDiffAnswer(this.feedback.answers.find(((t6) => t6.key === e4.ref))).find(((e5) => e5.set === t5));
809
- if (!(null == i4 ? void 0 : i4.best) || !(null == i4 ? void 0 : i4.worst)) throw this.log.err(`The MaxDiff question ${e4.ref} requires the most and the least important`), new Error("No response");
810
- }
811
- if (e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) {
812
- const i4 = this.feedback.answers.find(((t5) => t5.key === e4.ref));
813
- if (!i4) throw this.log.err(`The matrix question ${e4.ref} is required`), new Error("No response");
814
- const n3 = this.parseMatrixAnswerPre(i4), r2 = Array.isArray(null == t4 ? void 0 : t4.options) ? t4.options : [];
815
- if (r2.length > 0) {
816
- if (r2.find(((e5) => {
817
- const t5 = n3.find(((t6) => t6.key === e5));
818
- return !t5 || !Array.isArray(t5.value) || 0 === t5.value.length;
819
- }))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
820
- } else if (0 === n3.length || n3.some(((e5) => !Array.isArray(e5.value) || 0 === e5.value.length))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
821
- }
822
- }
823
- const c2 = yield this.pushAnswers(false);
824
- if (!c2) throw new Error("No response");
825
- this.id = c2, yield this.processNextQuestion(n2);
826
- } catch (e4) {
827
- this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, error: e4 }));
828
- } finally {
829
- this.sending = false;
830
- }
831
- }));
832
- }
833
- autoSend() {
834
- if (!this.sending) return this.send();
835
- }
836
- answer() {
837
- const e3 = "magicfeedback-" + this.appId, t3 = document.getElementById(e3);
838
- if (!t3) return this.log.err(`Form "${e3}" not found.`), this.feedback.answers = [], [];
839
- const i2 = this.history.back();
840
- if (!i2) return this.feedback.answers = (0, u.scrapeInputs)(t3), this.feedback.answers;
841
- const n2 = [];
842
- let o2 = false;
843
- const a2 = t3.querySelectorAll(".magicfeedback-input"), l2 = {}, c2 = {}, p2 = {}, m2 = {};
844
- if (a2.forEach(((e4) => {
845
- var t4, a3;
846
- const u2 = e4, h3 = i2.questions.find(((e5) => {
847
- var t5;
848
- return null === (t5 = u2.name) || void 0 === t5 ? void 0 : t5.includes(e5.ref);
849
- })), f2 = u2.type, g2 = u2.classList[0], y2 = { key: u2.name, value: [] }, v2 = "magicfeedback-consent" === g2 ? u2.checked.toString() : u2.value;
850
- if (y2.key && "" !== y2.key) if (y2.key.startsWith("extra-option-")) "" !== v2 && (y2.value.push(v2), n2.push(y2));
851
- else switch (null == h3 ? void 0 : h3.type) {
852
- case r.FEEDBACKAPPANSWERTYPE.EMAIL:
853
- case r.FEEDBACKAPPANSWERTYPE.TEXT:
854
- case r.FEEDBACKAPPANSWERTYPE.LONGTEXT:
855
- case r.FEEDBACKAPPANSWERTYPE.NUMBER:
856
- case r.FEEDBACKAPPANSWERTYPE.DATE:
857
- case r.FEEDBACKAPPANSWERTYPE.CONTACT:
858
- case r.FEEDBACKAPPANSWERTYPE.PASSWORD:
859
- "" !== v2 && ("email" === f2 ? (0, s.validateEmail)(v2) ? (this.feedback.profile.push({ key: "email", value: [v2] }), y2.value.push(v2), n2.push(y2)) : (this.log.err("Invalid email"), o2 = true) : (y2.value.push(v2), n2.push(y2)));
860
- break;
861
- case r.FEEDBACKAPPANSWERTYPE.RADIO:
862
- u2.checked && (y2.value.push(v2), n2.push(y2));
863
- break;
864
- case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
865
- case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
866
- u2.checked && (c2[y2.key] || (c2[y2.key] = []), c2[y2.key].push(v2));
867
- break;
868
- case r.FEEDBACKAPPANSWERTYPE.BOOLEAN:
869
- u2.checked && (y2.value.push(v2), n2.push(y2));
870
- break;
871
- case r.FEEDBACKAPPANSWERTYPE.CONSENT:
872
- y2.value.push(u2.checked.toString()), n2.push(y2);
873
- break;
874
- case r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
875
- case r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
876
- case r.FEEDBACKAPPANSWERTYPE.RATING_STAR:
877
- u2.checked && (y2.value.push(v2), n2.push(y2));
878
- break;
879
- case r.FEEDBACKAPPANSWERTYPE.SELECT:
880
- "" !== v2 && (y2.value.push(v2), n2.push(y2));
881
- break;
882
- case r.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
883
- "number" === f2 && u2.id && (p2[y2.key] || (p2[y2.key] = []), "" !== v2 && p2[y2.key].push(`${u2.id}:${v2}%`));
884
- break;
885
- case r.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
886
- "hidden" === f2 && (l2[y2.key] || (l2[y2.key] = []), l2[y2.key].push(v2));
887
- break;
888
- case r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
889
- e4.checked && (y2.value.push(v2), n2.push(y2));
890
- break;
891
- case r.FEEDBACKAPPANSWERTYPE.MAX_DIFF: {
892
- if ("radio" !== f2 || !h3) break;
893
- const e5 = y2.key === `${h3.ref}-best` ? "best" : y2.key === `${h3.ref}-worst` ? "worst" : null;
894
- if (!e5) break;
895
- m2[h3.ref] || (m2[h3.ref] = { set: null !== (a3 = null === (t4 = h3.assets) || void 0 === t4 ? void 0 : t4.setIndex) && void 0 !== a3 ? a3 : 1, shown: [], best: null, worst: null });
896
- const i3 = m2[h3.ref];
897
- "best" === e5 && i3.shown.push(v2), u2.checked && (i3[e5] = v2);
898
- break;
899
- }
900
- case r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
901
- case r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE: {
902
- const e5 = (0, d.getUploadValues)(u2);
903
- e5.length && (y2.value.push(...e5), n2.push(y2));
904
- break;
905
- }
906
- }
907
- })), o2) return [];
908
- Object.entries(c2).forEach((([e4, t4]) => {
909
- t4 && 0 !== t4.length && n2.push({ key: e4, value: t4 });
910
- })), Object.entries(p2).forEach((([e4, t4]) => {
911
- t4 && 0 !== t4.length && n2.push({ key: e4, value: t4 });
912
- })), Object.entries(l2).forEach((([e4, t4]) => {
913
- if (!t4 || 0 === t4.length) return;
914
- const i3 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
915
- n2.push({ key: e4, value: i3 });
916
- })), Object.entries(m2).forEach((([e4, t4]) => {
917
- (t4.best || t4.worst) && n2.push({ key: e4, value: [JSON.stringify([t4])] });
918
- }));
919
- try {
920
- i2.questions.filter(((e4) => e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)).forEach(((e4) => {
921
- const t4 = e4.ref + "-", i3 = n2.filter(((e5) => e5.key.startsWith(t4)));
922
- if (0 === i3.length) return;
923
- const r2 = i3.map(((e5) => ({ key: e5.key.substring(t4.length), value: e5.value }))), o3 = { key: e4.ref, value: [JSON.stringify(r2)] };
924
- for (const e5 of i3) {
925
- const t5 = n2.findIndex(((t6) => t6.key === e5.key));
926
- -1 !== t5 && n2.splice(t5, 1);
927
- }
928
- const a3 = n2.findIndex(((t5) => t5.key === e4.ref));
929
- -1 !== a3 ? n2[a3] = o3 : n2.push(o3);
930
- }));
931
- } catch (e4) {
932
- this.log.err("Error agrupando MULTI_QUESTION_MATRIX", e4);
933
- }
934
- const h2 = this.withEarlierMaxDiffSets((0, v.toBaseAnswers)(n2, i2.questions), i2.questions);
935
- return this.feedback.answers = h2, i2.setAnswer(h2), h2;
936
- }
937
- withEarlierMaxDiffSets(e3, t3) {
938
- return e3.map(((e4) => {
939
- if (!t3.some(((t4) => t4.ref === e4.key && t4.type === r.FEEDBACKAPPANSWERTYPE.MAX_DIFF))) return e4;
940
- const i2 = this.parseMaxDiffAnswer(e4), n2 = [...this.parseMaxDiffAnswer(this.earlierAnswer(e4.key)).filter(((e5) => !i2.some(((t4) => t4.set === e5.set)))), ...i2].sort(((e5, t4) => e5.set - t4.set));
941
- return Object.assign(Object.assign({}, e4), { value: [JSON.stringify(n2)] });
942
- }));
943
- }
944
- earlierAnswer(e3) {
945
- var t3, i2;
946
- for (let n2 = this.history.size() - 2; n2 >= 0; n2--) {
947
- const r2 = null === (i2 = null === (t3 = this.history.get(n2)) || void 0 === t3 ? void 0 : t3.answers) || void 0 === i2 ? void 0 : i2.find(((t4) => t4.key === e3));
948
- if (r2) return r2;
949
- }
950
- }
951
- finish() {
952
- return n(this, void 0, void 0, (function* () {
953
- if (this.completed = true, this.timeToCompleted = Date.now() - this.timeToCompleted, this.feedback.metadata.push({ key: "time-to-complete", value: [this.timeToCompleted.toString()] }), this.formOptionsConfig.addSuccessScreen) {
954
- const e3 = document.getElementById("magicfeedback-container-" + this.appId);
955
- e3.childNodes.length > 0 && e3.removeChild(e3.childNodes[0]);
956
- const t3 = (0, l.renderSuccess)(this.formOptionsConfig.successMessage || (0, y.t)(this.lang(), "message.success"));
957
- e3.appendChild(t3);
958
- }
959
- this.feedback.answers = [];
960
- try {
961
- const e3 = yield this.pushAnswers(true);
962
- if (!e3) throw this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: this.completed, error: `An error occurred while submitting the form ${this.appId}:` })), new Error("An error occurred while submitting the form ${this.appId}:");
963
- this.id = e3, this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, completed: this.completed, error: null }));
964
- } catch (e3) {
965
- this.log.err(`An error occurred while submitting the form ${this.appId}:`, e3), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: this.completed, error: e3 }));
966
- }
967
- }));
968
- }
969
- pushAnswers(e3 = false) {
970
- return n(this, void 0, void 0, (function* () {
971
- try {
972
- if (this.config.get("dryRun")) {
973
- const e4 = this.id || `dry-run-${this.appId}-${Date.now()}`;
974
- return this.log.log(`Dry run enabled: skipping feedback submit for form ${this.appId}`), e4;
975
- }
976
- const t3 = this.config.get("url"), i2 = { integration: this.appId, publicKey: this.publicKey, feedback: this.feedback, completed: e3, lang: this.lang() };
977
- return yield (0, s.sendFeedback)(t3, this.id ? Object.assign(Object.assign({}, i2), { sessionId: this.id }) : i2, this.log);
978
- } catch (e4) {
979
- return this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), "";
980
- }
981
- }));
982
- }
983
- callFollowUpQuestion(e3) {
984
- var t3, i2;
985
- return n(this, void 0, void 0, (function* () {
986
- if (!(null == e3 ? void 0 : e3.followup)) return null;
987
- const n2 = null !== (t3 = this.feedback.answers.find(((t4) => t4.key === e3.ref))) && void 0 !== t3 ? t3 : this.feedback.answers.find(((t4) => t4.key.includes(e3.ref) && !t4.key.includes("extra-option"))), r2 = null === (i2 = null == n2 ? void 0 : n2.value) || void 0 === i2 ? void 0 : i2.find(((e4) => null != e4 && "" !== e4));
988
- if (void 0 === r2) return this.log.log(`The question ${e3.ref} has no answer, skipping its follow up`), null;
989
- try {
990
- const t4 = this.config.get("url"), i3 = Object.assign(Object.assign(Object.assign({ answer: r2 }, "" !== this.publicKey && { publicKey: this.publicKey }), "" === this.publicKey && { campaignSessionId: this.appId }), { sessionId: this.id, question: e3, previousAnswers: this.previousAnswers(e3), upcomingQuestions: this.upcomingQuestions() });
991
- return yield (0, s.getFollowUpQuestion)(t4, i3, this.log);
992
- } catch (t4) {
993
- return this.log.err(`An error occurred while requesting the follow up of ${e3.ref} in the form ${this.appId}:`, t4), null;
994
- }
995
- }));
996
- }
997
- previousAnswers(e3) {
998
- var t3;
999
- const i2 = /* @__PURE__ */ new Map();
1000
- for (let n2 = 0; n2 < this.history.size(); n2++) {
1001
- const r2 = this.history.get(n2);
1002
- if (r2) for (const n3 of r2.questions) {
1003
- if (n3.ref === e3.ref) continue;
1004
- if (k.includes(n3.type)) continue;
1005
- const o2 = this.followUpAnswerValue(n3, null === (t3 = r2.answers) || void 0 === t3 ? void 0 : t3.find(((e4) => e4.key === n3.ref)));
1006
- void 0 !== o2 && (i2.delete(n3.ref), i2.set(n3.ref, { title: n3.title, answer: o2 }));
1007
- }
1008
- }
1009
- return [...i2.values()];
1010
- }
1011
- followUpAnswerValue(e3, t3) {
1012
- var i2;
1013
- const n2 = (null !== (i2 = null == t3 ? void 0 : t3.value) && void 0 !== i2 ? i2 : []).filter(((e4) => null != e4 && "" !== e4));
1014
- if (0 === n2.length) return;
1015
- if (e3.type === r.FEEDBACKAPPANSWERTYPE.BOOLEAN && 1 === n2.length && ["Yes", "No"].includes(n2[0])) return "Yes" === n2[0];
1016
- if (e3.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) {
1017
- const t4 = this.parseMatrixAnswerPre({ key: e3.ref, value: n2 }).map(((e4) => `${e4.key}: ${(Array.isArray(e4.value) ? e4.value : [e4.value]).join(", ")}`));
1018
- return t4.length > 0 ? t4 : void 0;
1019
- }
1020
- const o2 = n2.map(((e4) => "string" == typeof e4 ? e4 : JSON.stringify(e4)));
1021
- return 1 === o2.length ? o2[0] : o2;
1022
- }
1023
- upcomingQuestions() {
1024
- var e3, t3;
1025
- const i2 = this.history.back();
1026
- if (!i2) return [];
1027
- const n2 = [], o2 = /* @__PURE__ */ new Set(), a2 = /* @__PURE__ */ new Set();
1028
- let s2 = i2.isFollowup && i2.origin ? i2.origin : i2, l2 = null !== (e3 = s2.answers) && void 0 !== e3 ? e3 : [];
1029
- for (; !a2.has(s2.id); ) {
1030
- let e4;
1031
- if (a2.add(s2.id), l2) {
1032
- const i4 = this.graph.findRoute(s2, l2);
1033
- e4 = i4 ? i4.transition === h.TransitionType.PAGE && null !== (t3 = i4.transitionDestiny) && void 0 !== t3 ? t3 : void 0 : this.graph.getNextEdgeByDefault(s2);
1034
- } else {
1035
- if (s2.edges.some(((e5) => e5.typeCondition !== h.ConditionType.DIRECT && e5.typeCondition !== h.ConditionType.PRECONDITIONAL))) break;
1036
- e4 = this.graph.getNextEdgeByDefault(s2);
1037
- }
1038
- const i3 = e4 ? this.graph.getNodeById(e4) : void 0;
1039
- if (!i3) break;
1040
- if (i3.edges.filter(((e5) => e5.typeCondition === h.ConditionType.PRECONDITIONAL)).some(((e5) => !this.latestAnswer(e5.questionRef)))) break;
1041
- if (this.skipsByPreconditions(i3)) s2 = i3, l2 = [];
1042
- else {
1043
- for (const e5 of i3.questions) e5.type !== r.FEEDBACKAPPANSWERTYPE.INFO_PAGE && (o2.has(e5.ref) || (o2.add(e5.ref), n2.push({ title: e5.title })));
1044
- s2 = i3, l2 = null;
1045
- }
1046
- }
1047
- return n2;
1048
- }
1049
- processNextQuestion(e3) {
1050
- var t3, i2;
1051
- return n(this, void 0, void 0, (function* () {
1052
- const n2 = this.history.back();
1053
- if (!n2) throw new Error("No page found");
1054
- const r2 = n2.isFollowup ? [] : n2.getFollowupQuestions();
1055
- if (0 === (null == r2 ? void 0 : r2.length)) return void (yield this.renderNextQuestion(e3, n2));
1056
- const o2 = [];
1057
- for (const e4 of r2) {
1058
- const t4 = n2.questions.find(((t5) => t5.ref === e4));
1059
- if (t4) {
1060
- const e5 = yield this.callFollowUpQuestion(t4);
1061
- e5 && o2.push(e5);
1062
- }
1063
- }
1064
- if (0 === o2.length) return void (yield this.renderNextQuestion(e3, n2));
1065
- const a2 = new m.Page(n2.id, n2.position, this.appId, o2, n2.edges), s2 = new g.PageNode(n2.id, n2.position, n2.edges, a2, o2, true);
1066
- s2.origin = n2.isFollowup && n2.origin ? n2.origin : n2, s2.elements = (0, l.renderQuestions)(o2, this.formOptionsConfig.questionFormat, this.lang(), null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.autoSend())), this.history.enqueue(s2), this.syncBackButton(), this.progress += 0.5, e3.innerHTML = "", null === (i2 = s2.elements) || void 0 === i2 || i2.forEach(((t4) => e3.appendChild(t4))), (0, b.armGhostTapGuard)(e3), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: s2.isFollowup, completed: this.completed, error: null })), this.autofocusAfterRender("navigation");
1067
- }));
1068
- }
1069
- renderNextQuestion(e3, t3) {
1070
- var i2, r2, o2;
1071
- return n(this, void 0, void 0, (function* () {
1072
- const n2 = t3.isFollowup && t3.origin ? t3.origin : t3, a2 = n2 === t3 ? this.feedback.answers : [...null !== (i2 = n2.answers) && void 0 !== i2 ? i2 : [], ...this.feedback.answers];
1073
- let s2 = this.graph.getNextPage(n2, a2);
1074
- if (s2) {
1075
- if (this.skipsByPreconditions(s2)) return this.feedback.answers = [], void (yield this.renderNextQuestion(e3, s2));
1076
- s2.elements = (0, l.renderQuestions)(s2.questions, this.formOptionsConfig.questionFormat, this.lang(), null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.product, (() => this.autoSend())), e3.innerHTML = "", null === (o2 = s2.elements) || void 0 === o2 || o2.forEach(((t4) => e3.appendChild(t4))), (0, b.armGhostTapGuard)(e3), this.history.enqueue(s2), this.syncBackButton(), this.progress = this.total - this.graph.findMaxDepth(s2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: s2.isFollowup, completed: this.completed, error: null })), this.autofocusAfterRender("navigation");
1077
- } else this.finish();
1078
- }));
1079
- }
1080
- skipsByPreconditions(e3) {
1081
- var t3;
1082
- const i2 = e3.edges.filter(((e4) => "PRECONDITIONAL" === e4.typeCondition)).sort(((e4, t4) => e4.position < t4.position ? -1 : e4.position > t4.position ? 1 : 0));
1083
- if (0 === i2.length) return false;
1084
- const n2 = i2.some(((e4) => e4.transition === h.TransitionType.ALLOW));
1085
- let o2 = n2;
1086
- for (const e4 of i2) {
1087
- const i3 = this.latestAnswer(e4.questionRef);
1088
- let n3 = false;
1089
- if (i3) {
1090
- const o3 = null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.questions.find(((t4) => t4.ref === e4.questionRef)), a2 = Array.isArray(i3.value) ? i3.value : [i3.value], s2 = Array.isArray(e4.value) ? e4.value : [e4.value];
1091
- if ((null == o3 ? void 0 : o3.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) n3 = this.evaluateMatrixPreconditional(e4, i3);
1092
- else switch (e4.typeOperator) {
1093
- case "EQUAL":
1094
- case "INQ":
1095
- n3 = a2.some(((e5) => s2.includes(e5)));
1096
- break;
1097
- case "NOEQUAL":
1098
- case "NINQ":
1099
- n3 = a2.every(((e5) => !s2.includes(e5)));
1100
- break;
1101
- case "GREATER":
1102
- n3 = a2.some(((e5) => Number(e5) > Number(s2[0])));
1103
- break;
1104
- case "LESS":
1105
- n3 = a2.some(((e5) => Number(e5) < Number(s2[0])));
1106
- break;
1107
- case "GREATEREQUAL":
1108
- n3 = a2.some(((e5) => Number(e5) >= Number(s2[0])));
1109
- break;
1110
- case "LESSEQUAL":
1111
- n3 = a2.some(((e5) => Number(e5) <= Number(s2[0])));
1112
- }
1113
- }
1114
- if (e4.transition === h.TransitionType.ALLOW) n3 || (o2 = false);
1115
- else if (e4.transition === h.TransitionType.NEXT && n3) return true;
1116
- }
1117
- return !!n2 && !o2;
1118
- }
1119
- latestAnswer(e3) {
1120
- var t3, i2;
1121
- for (let n2 = this.history.size() - 1; n2 >= 0; n2--) {
1122
- const r2 = null === (i2 = null === (t3 = this.history.get(n2)) || void 0 === t3 ? void 0 : t3.answers) || void 0 === i2 ? void 0 : i2.find(((t4) => t4.key === e3));
1123
- if (r2) return r2;
1124
- }
1125
- }
1126
- syncBackButton() {
1127
- const e3 = document.getElementById("magicfeedback-" + this.appId), t3 = null == e3 ? void 0 : e3.querySelector(".magicfeedback-back");
1128
- t3 && (t3.hidden = this.history.size() <= 1);
1129
- }
1130
- back() {
1131
- var e3;
1132
- return n(this, void 0, void 0, (function* () {
1133
- if (this.history.size() <= 1) return;
1134
- const t3 = document.getElementById("magicfeedback-questions-" + this.appId);
1135
- (0, A.cancelAutoAdvance)(t3), t3 && t3.childNodes.length > 0 && (t3.innerHTML = ""), this.history.rollback(), this.syncBackButton();
1136
- const i2 = this.history.back();
1137
- i2 ? (null === (e3 = i2.elements) || void 0 === e3 || e3.forEach(((e4) => t3.appendChild(e4))), (0, b.armGhostTapGuard)(t3), this.progress = this.total - this.graph.findMaxDepth(i2)) : this.progress = this.history.size(), this.formOptionsConfig.onBackEvent && (yield this.formOptionsConfig.onBackEvent({ loading: false, progress: this.progress, followup: (null == i2 ? void 0 : i2.isFollowup) || false, error: i2 ? null : "No page found" })), i2 && this.autofocusAfterRender("navigation");
1138
- }));
1139
- }
1140
- previewQuestion(e3, t3, i2) {
1141
- var n2, r2;
1142
- const o2 = Array.isArray(t3) ? t3 : [t3];
1143
- if (!o2 || 0 === o2.length) throw new Error("[MagicFeedback] No question provided for preview");
1144
- const a2 = document.getElementById(e3);
1145
- if (!a2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
1146
- const { format: s2 = this.formOptionsConfig.questionFormat || "standard", language: d2 = this.lang(), product: u2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.product) || { customIcons: false }, style: p2 = (null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.style) || {}, clearContainer: m2 = true, wrap: h2 = true } = i2 || {};
1147
- m2 && (a2.innerHTML = ""), (null == p2 ? void 0 : p2.primaryColor) && (0, c.applyPrimaryColor)(a2, p2.primaryColor), (0, c.applyDirection)(a2, d2);
1148
- let f2 = [];
1149
- try {
1150
- f2 = (0, l.renderQuestions)(o2, s2, d2, u2);
1151
- } catch (e4) {
1152
- throw this.log.err(e4), e4;
1153
- }
1154
- let g2 = a2;
1155
- if (h2) {
1156
- const e4 = document.createElement("div");
1157
- e4.classList.add("magicfeedback-preview-question"), g2.appendChild(e4), g2 = e4;
1158
- }
1159
- return f2.forEach(((e4) => g2.appendChild(e4))), a2;
1160
- }
1161
- parseMaxDiffAnswer(e3) {
1162
- var t3;
1163
- if (!e3 || "string" != typeof (null === (t3 = e3.value) || void 0 === t3 ? void 0 : t3[0])) return [];
1164
- try {
1165
- const t4 = JSON.parse(e3.value[0]);
1166
- return Array.isArray(t4) ? t4 : [];
1167
- } catch (e4) {
1168
- return [];
1169
- }
1170
- }
1171
- parseMatrixAnswerPre(e3) {
1172
- if (!e3 || !e3.value) return [];
1173
- if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
1174
- const t3 = JSON.parse(e3.value[0]);
1175
- if (Array.isArray(t3)) return t3;
1176
- } catch (e4) {
1177
- return [];
1178
- }
1179
- return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
1180
- }
1181
- evaluateMatrixPreconditional(e3, t3) {
1182
- const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = this.parseMatrixAnswerPre(t3);
1183
- if (!r2.length) return false;
1184
- const o2 = n2.size > 0 ? r2.filter(((e4) => n2.has(e4.key))) : r2;
1185
- if (!o2.length) return false;
1186
- switch (e3.typeOperator) {
1187
- case "EQUAL":
1188
- case "INQ":
1189
- return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
1190
- case "NOEQUAL":
1191
- case "NINQ":
1192
- return o2.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
1193
- case "GREATER":
1194
- return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
1195
- case "LESS":
1196
- return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
1197
- case "GREATEREQUAL":
1198
- return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
1199
- case "LESSEQUAL":
1200
- return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
1201
- default:
1202
- return false;
1203
- }
1204
- }
1205
- };
1206
- }, 3378: (e2, t2) => {
1207
- "use strict";
1208
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Page = void 0, t2.Page = class {
1209
- constructor(e3, t3, i, n, r) {
1210
- this.id = e3, this.position = t3, this.generatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.status = "ACTIVE", this.integrationId = i, this.integrationQuestions = n, this.integrationPageRoutes = r;
1211
- }
1212
- };
1213
- }, 1719: (e2, t2, i) => {
1214
- "use strict";
1215
- Object.defineProperty(t2, "__esModule", { value: true }), t2.PageGraph = void 0;
1216
- const n = i(7170), r = i(4760), o = i(7305);
1217
- t2.PageGraph = class {
1218
- constructor(e3) {
1219
- this.nodes = /* @__PURE__ */ new Map(), this.buildGraph(e3);
1220
- }
1221
- buildGraph(e3) {
1222
- e3.forEach(((e4) => {
1223
- var t3;
1224
- e4.integrationPageRoutes && (e4.integrationPageRoutes = (null === (t3 = e4.integrationPageRoutes) || void 0 === t3 ? void 0 : t3.sort(((e5, t4) => {
1225
- const i3 = new Date((null == e5 ? void 0 : e5.generatedAt) || 0).getTime(), n2 = new Date((null == t4 ? void 0 : t4.generatedAt) || 0).getTime();
1226
- return i3 !== n2 ? i3 - n2 : "DIRECT" === e5.typeCondition && "DIRECT" !== t4.typeCondition ? 1 : "DIRECT" !== e5.typeCondition && "DIRECT" === t4.typeCondition ? -1 : 0;
1227
- }))) || []);
1228
- const i2 = new n.PageNode(e4.id, e4.position, e4.integrationPageRoutes || [], e4, e4.integrationQuestions);
1229
- this.nodes.set(i2.id, i2);
1230
- }));
1231
- }
1232
- getNodeById(e3) {
1233
- return this.nodes.get(e3);
1234
- }
1235
- getNextEdgeByDefault(e3) {
1236
- if (!e3) return;
1237
- const t3 = e3.edges.find(((e4) => e4.typeCondition === o.ConditionType.DIRECT));
1238
- if (!t3 || ![o.TransitionType.FINISH, o.TransitionType.REDIRECT].includes(t3.transition)) {
1239
- if (t3 && t3.transitionDestiny) return t3.transitionDestiny;
1240
- for (const t4 of this.nodes.values()) if (t4.position === e3.position + 1) return t4.id;
1241
- }
1242
- }
1243
- getFirstPage() {
1244
- let e3, t3 = Number.MAX_VALUE;
1245
- for (const i2 of this.nodes.values()) i2.position < t3 && (t3 = i2.position, e3 = i2);
1246
- return e3;
1247
- }
1248
- getNextPage(e3, t3) {
1249
- var i2;
1250
- if (!e3) return;
1251
- const n2 = this.findRoute(e3, t3);
1252
- if (!n2) {
1253
- const t4 = this.getNextEdgeByDefault(e3);
1254
- if (!t4) return;
1255
- return this.getNodeById(t4);
1256
- }
1257
- switch (n2.transition) {
1258
- case o.TransitionType.PAGE:
1259
- if (!n2.transitionDestiny) return;
1260
- return this.getNodeById(n2.transitionDestiny);
1261
- case o.TransitionType.FINISH:
1262
- return;
1263
- case o.TransitionType.REDIRECT:
1264
- return void (window.location.href = (null === (i2 = n2.transitionDestiny) || void 0 === i2 ? void 0 : i2.includes("?")) ? `${n2.transitionDestiny}&${window.location.search.slice(1)}` : `${n2.transitionDestiny}${window.location.search}`);
1265
- default:
1266
- return;
1267
- }
1268
- }
1269
- findRoute(e3, t3) {
1270
- return e3.edges.sort(((e4, t4) => "DIRECT" === e4.typeCondition ? 1 : "DIRECT" === t4.typeCondition ? -1 : 0)), e3.edges.find(((i2) => {
1271
- const n2 = e3.questions.find(((e4) => e4.ref === i2.questionRef)), a = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i2.questionRef));
1272
- if ("DIRECT" === i2.typeCondition) return true;
1273
- if (!a || 0 === a.length) return false;
1274
- if ((null == n2 ? void 0 : n2.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i2, a);
1275
- const s = Array.isArray(i2.value) ? i2.value : [i2.value];
1276
- switch (i2.typeOperator) {
1277
- case o.OperatorType.EQUAL:
1278
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.includes(e5)))));
1279
- case o.OperatorType.NOEQUAL:
1280
- return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !s.includes(e5)))));
1281
- case o.OperatorType.GREATER:
1282
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) > Number(t4)))))));
1283
- case o.OperatorType.LESS:
1284
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) < Number(t4)))))));
1285
- case o.OperatorType.GREATEREQUAL:
1286
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) >= Number(t4)))))));
1287
- case o.OperatorType.LESSEQUAL:
1288
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) <= Number(t4)))))));
1289
- case o.OperatorType.INQ:
1290
- return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.includes(e5)))));
1291
- case o.OperatorType.NINQ:
1292
- return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !s.includes(e5)))));
1293
- default:
1294
- return false;
1295
- }
1296
- }));
1297
- }
1298
- findDepth(e3) {
1299
- const t3 = this.getNodeById(e3);
1300
- if (!t3) return 0;
1301
- const i2 = /* @__PURE__ */ new Set();
1302
- return this.DFSUtil(t3, i2, 0);
1303
- }
1304
- findMaxDepth(e3) {
1305
- if (e3 || (e3 = this.getFirstPage()), !e3) return 0;
1306
- const t3 = /* @__PURE__ */ new Set();
1307
- let i2 = 1;
1308
- return i2 = Math.max(i2, this.DFSUtil(e3, t3, i2)), i2;
1309
- }
1310
- DFSUtil(e3, t3, i2) {
1311
- t3.add(e3);
1312
- let n2 = i2;
1313
- const r2 = [...e3.edges.filter(((e4) => e4.typeCondition !== o.ConditionType.PRECONDITIONAL)) || []], a = this.getNextEdgeByDefault(e3);
1314
- if (a) {
1315
- const i3 = this.getNodeById(a);
1316
- i3 && !t3.has(i3) && r2.push(new o.PageRoute(i3.id, "", o.OperatorType.DEFAULT, [""], o.TransitionType.PAGE, i3.id, e3.id));
1317
- }
1318
- for (const e4 of r2) {
1319
- if (!e4.transitionDestiny) continue;
1320
- const r3 = this.getNodeById(e4.transitionDestiny);
1321
- if (r3 && !t3.has(r3)) {
1322
- const e5 = i2 + 1, o2 = new Set(t3), a2 = this.DFSUtil(r3, o2, e5);
1323
- n2 = Math.max(n2, a2);
1324
- }
1325
- }
1326
- return n2;
1327
- }
1328
- parseMatrixAnswer(e3) {
1329
- if (!e3 || !e3.value) return [];
1330
- if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
1331
- const t3 = JSON.parse(e3.value[0]);
1332
- if (Array.isArray(t3)) return t3;
1333
- } catch (e4) {
1334
- return [];
1335
- }
1336
- return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
1337
- }
1338
- evaluateMatrixCondition(e3, t3) {
1339
- const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = t3[0], a = this.parseMatrixAnswer(r2);
1340
- if (!a.length) return false;
1341
- const s = n2.size > 0 ? a.filter(((e4) => n2.has(e4.key))) : a;
1342
- if (!s.length) return false;
1343
- switch (e3.typeOperator) {
1344
- case o.OperatorType.EQUAL:
1345
- case o.OperatorType.INQ:
1346
- return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
1347
- case o.OperatorType.NOEQUAL:
1348
- case o.OperatorType.NINQ:
1349
- return s.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
1350
- case o.OperatorType.GREATER:
1351
- return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
1352
- case o.OperatorType.LESS:
1353
- return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
1354
- case o.OperatorType.GREATEREQUAL:
1355
- return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
1356
- case o.OperatorType.LESSEQUAL:
1357
- return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
1358
- default:
1359
- return false;
1360
- }
1361
- }
1362
- };
1363
- }, 7170: (e2, t2) => {
1364
- "use strict";
1365
- Object.defineProperty(t2, "__esModule", { value: true }), t2.PageNode = void 0, t2.PageNode = class {
1366
- constructor(e3, t3, i, n, r, o = false) {
1367
- this.answers = [], this.id = e3, this.position = t3, this.edges = i, this.data = n, this.questions = r.sort(((e4, t4) => e4.position - t4.position)), this.elements = [], this.isFollowup = o;
1368
- }
1369
- getFollowupQuestions() {
1370
- return this.questions.filter(((e3) => e3.followup)).map(((e3) => e3.ref));
1371
- }
1372
- getRequiredQuestions() {
1373
- return this.questions.filter(((e3) => e3.require)).map(((e3) => e3.ref));
1374
- }
1375
- setAnswer(e3) {
1376
- this.answers = e3;
1377
- }
1378
- };
1379
- }, 7305: (e2, t2) => {
1380
- "use strict";
1381
- var i, n, r, o;
1382
- Object.defineProperty(t2, "__esModule", { value: true }), t2.PageRoute = t2.StatusType = t2.OperatorType = t2.ConditionType = t2.TransitionType = void 0, (o = t2.TransitionType || (t2.TransitionType = {})).PAGE = "PAGE", o.FINISH = "FINISH", o.REDIRECT = "REDIRECT", o.NEXT = "NEXT", o.ALLOW = "ALLOW", (function(e3) {
1383
- e3.LOGICAL = "LOGICAL", e3.DIRECT = "DIRECT", e3.PRECONDITIONAL = "PRECONDITIONAL";
1384
- })(i = t2.ConditionType || (t2.ConditionType = {})), (r = t2.OperatorType || (t2.OperatorType = {})).EQUAL = "EQUAL", r.NOEQUAL = "NOEQUAL", r.GREATER = "GREATER", r.LESS = "LESS", r.GREATEREQUAL = "GREATEREQUAL", r.LESSEQUAL = "LESSEQUAL", r.INQ = "INQ", r.NINQ = "NINQ", r.DEFAULT = "DEFAULT", (function(e3) {
1385
- e3.ACTIVE = "ACTIVE", e3.DEPRECATED = "DEPRECATED", e3.DELETE = "DELETE";
1386
- })(n = t2.StatusType || (t2.StatusType = {})), t2.PageRoute = class {
1387
- constructor(e3, t3, r2, o2, a, s, l, d, c, u) {
1388
- this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = r2, this.value = o2 || [], this.transition = a, this.transitionDestiny = s, this.status = n.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
1389
- }
1390
- };
1391
- }, 4760: (e2, t2) => {
1392
- "use strict";
1393
- var i, n;
1394
- Object.defineProperty(t2, "__esModule", { value: true }), t2.AGENT_ANSWER_TYPE_BLOCKED = t2.QuestionType = t2.FEEDBACKAPPANSWERTYPE = void 0, (n = t2.FEEDBACKAPPANSWERTYPE || (t2.FEEDBACKAPPANSWERTYPE = {})).CONTACT = "CONTACT", n.MULTIPLECHOISE_IMAGE = "MULTIPLECHOISE_IMAGE", n.EMAIL = "EMAIL", n.RATING_STAR = "RATING_STAR", n.RADIO = "RADIO", n.MULTIPLECHOICE = "MULTIPLECHOICE", n.SELECT = "SELECT", n.TEXT = "TEXT", n.LONGTEXT = "LONGTEXT", n.NUMBER = "NUMBER", n.RATING_EMOJI = "RATING_EMOJI", n.RATING_NUMBER = "RATING_NUMBER", n.DATE = "DATE", n.BOOLEAN = "BOOLEAN", n.PASSWORD = "PASSWORD", n.CONSENT = "CONSENT", n.MULTI_QUESTION_MATRIX = "MULTI_QUESTION_MATRIX", n.POINT_SYSTEM = "POINT_SYSTEM", n.PRIORITY_LIST = "PRIORITY_LIST", n.INFO_PAGE = "INFO_PAGE", n.UPLOAD_FILE = "UPLOAD_FILE", n.UPLOAD_IMAGE = "UPLOAD_IMAGE", n.MAX_DIFF = "MAX_DIFF", t2.QuestionType = class {
1395
- }, t2.AGENT_ANSWER_TYPE_BLOCKED = "ABUSIVE_OR_OFFENSIVE", (function(e3) {
1396
- e3.FORM = "form", e3.DIV = "div";
1397
- })(i || (i = {}));
1398
- }, 2335: (e2, t2, i) => {
1399
- "use strict";
1400
- Object.defineProperty(t2, "__esModule", { value: true }), t2.applyDirection = t2.applyPrimaryColor = t2.generateContainer = void 0;
1401
- const n = i(7627);
1402
- t2.generateContainer = function(e3, t3) {
1403
- let i2 = document.getElementById(e3);
1404
- if (!i2 && (i2 = document.getElementById("magicfeedback-container-" + t3), !i2)) throw new Error(`Element with ID '${e3}' not found.`);
1405
- return i2.classList.add("magicfeedback-container"), i2.id = "magicfeedback-container-" + t3, i2.innerHTML = "", i2;
1406
- }, t2.applyPrimaryColor = function(e3, t3) {
1407
- e3.style.setProperty("--mf-primary", t3), e3.style.setProperty("--mf-primary-hover", `color-mix(in srgb, ${t3} 85%, black)`), e3.style.setProperty("--mf-primary-light", `color-mix(in srgb, ${t3} 15%, white)`), e3.style.setProperty("--mf-primary-border", `color-mix(in srgb, ${t3} 35%, transparent)`), e3.style.setProperty("--mf-border-focus", t3);
1408
- }, t2.applyDirection = function(e3, t3) {
1409
- const i2 = (0, n.isRtlLanguage)(t3);
1410
- e3.setAttribute("dir", i2 ? "rtl" : "ltr"), e3.classList.toggle("magicfeedback-rtl", i2);
1411
- };
1412
- }, 1366: (e2, t2, i) => {
1413
- "use strict";
1414
- Object.defineProperty(t2, "__esModule", { value: true }), t2.getUrlParam = t2.getBooleanOptions = t2.parseTitle = void 0;
1415
- const n = i(7627);
1416
- t2.parseTitle = function(e3, t3) {
1417
- return e3 ? "object" == typeof e3 ? e3[t3] || e3.en : e3 : "";
1418
- }, t2.getBooleanOptions = function(e3) {
1419
- return [(0, n.t)(e3, "boolean.yes"), (0, n.t)(e3, "boolean.no")];
1420
- }, t2.getUrlParam = function(e3) {
1421
- return new URLSearchParams(window.location.search).get(e3);
1422
- };
1423
- }, 2709: (e2, t2, i) => {
1424
- "use strict";
1425
- Object.defineProperty(t2, "__esModule", { value: true }), t2.RATING_NUMBER_MIN_CHIP_WIDTH = t2.usesLegacyRatingNumber = t2.createRatingNumberElement = t2.createStarRating = t2.createRatingPlaceholder = void 0;
1426
- const n = i(7627), r = i(9039);
1427
- function o(e3, t3, i2 = "ltr") {
1428
- const n2 = document.createElement("div");
1429
- n2.classList.add("magicfeedback-rating-placeholder");
1430
- const r2 = document.createElement("span");
1431
- r2.textContent = null != e3 ? e3 : "", r2.classList.add("magicfeedback-rating-placeholder-value");
1432
- const o2 = document.createElement("span");
1433
- return o2.textContent = null != t3 ? t3 : "", o2.classList.add("magicfeedback-rating-placeholder-value"), "ltr" === i2 ? (e3 && n2.appendChild(r2), t3 && n2.appendChild(o2)) : (t3 && n2.appendChild(o2), e3 && n2.appendChild(r2)), n2;
1434
- }
1435
- t2.createRatingPlaceholder = o, t2.createStarRating = function(e3, t3, i2, n2 = () => {
1436
- }, a) {
1437
- const s = document.createElement("div");
1438
- s.classList.add("magicfeedback-rating-star-container"), s.style.maxWidth = "300px", s.style.margin = "auto", s.dataset.originalSelection = "0";
1439
- const l = (e4) => {
1440
- s.querySelectorAll(".rating__star").forEach(((t4, i3) => {
1441
- t4.classList.toggle("magicfeedback-rating-star-selected", i3 < e4);
1442
- }));
1443
- };
1444
- for (let t4 = 1; t4 <= 5; t4++) {
1445
- const i3 = document.createElement("label");
1446
- i3.classList.add("magicfeedback-rating-star-option");
1447
- const o2 = document.createElement("input");
1448
- o2.id = `rating-${e3}-${t4}`, o2.type = "radio", o2.name = e3, o2.value = t4.toString(), o2.style.position = "absolute", o2.style.opacity = "0", o2.style.width = "0", o2.style.height = "0", o2.classList.add("magicfeedback-input"), a && a === o2.value && (o2.checked = true), o2.addEventListener("change", (() => {
1449
- l(Number(o2.value)), s.dataset.originalSelection = o2.value;
1450
- })), (0, r.autoAdvanceOn)(o2, n2), i3.appendChild(o2);
1451
- const d2 = document.createElement("label");
1452
- d2.htmlFor = `rating-${e3}-${t4}`, d2.classList.add("rating__star"), d2.textContent = "\u2605", d2.style.fontSize = "40px", d2.style.color = "#CCCCCC", d2.style.cursor = "pointer", d2.addEventListener("mouseenter", (() => l(t4))), d2.addEventListener("mouseleave", (() => l(Number(s.dataset.originalSelection || "0")))), i3.appendChild(d2), s.appendChild(i3);
1453
- }
1454
- const d = s.querySelector("input:checked");
1455
- d && (s.dataset.originalSelection = d.value, l(Number(d.value)));
1456
- const c = o(t3, i2);
1457
- return c.childElementCount > 0 && s.appendChild(c), s;
1458
- }, t2.createRatingNumberElement = function(e3, i2, o2, a, s, l, d, c, u = {}) {
1459
- var p, m;
1460
- const h = document.createElement("div");
1461
- h.classList.add("magicfeedback-rating-number");
1462
- const f = !!u.legacy, g = f && !!u.isPhone, y = g ? (function(e4) {
1463
- const t3 = (null == e4 ? void 0 : e4.max) ? Number(e4.max) : 10, i3 = (null == e4 ? void 0 : e4.min) ? Number(e4.min) : 0;
1464
- return (n2) => {
1465
- var r2;
1466
- return (null === (r2 = null == e4 ? void 0 : e4.numberPlaceholders) || void 0 === r2 ? void 0 : r2[n2]) || (n2 === i3 ? null == e4 ? void 0 : e4.minPlaceholder : void 0) || (n2 === t3 ? null == e4 ? void 0 : e4.maxPlaceholder : void 0) || void 0;
1467
- };
1468
- })(i2) : null;
1469
- g && (a = "column", i2 = Object.assign(Object.assign({}, i2), { minPlaceholder: void 0, maxPlaceholder: void 0, numberPlaceholders: void 0 })), f && h.classList.add("magicfeedback-rating-number--legacy");
1470
- const v = "column" === a, b = "ltr" === o2 ? a : `${a}-reverse`, E = document.createElement("div");
1471
- E.classList.add("magicfeedback-rating-number-container"), E.classList.add(`magicfeedback-rating-number-container-${o2}`), E.classList.add(`magicfeedback-rating-number-container-${a}`), E.style.display = "flex", E.style.flexDirection = b, E.setAttribute("role", "radiogroup"), E.setAttribute("aria-label", (null == i2 ? void 0 : i2.ariaLabel) || (0, n.t)(c, "rating.ariaLabel"));
1472
- const A = (null == i2 ? void 0 : i2.max) ? Number(null == i2 ? void 0 : i2.max) : 10, k = (null == i2 ? void 0 : i2.min) ? Number(null == i2 ? void 0 : i2.min) : 0;
1473
- !v && A - k + 1 > 6 && E.classList.add("magicfeedback-rating-number-container-row--dense");
1474
- const T = (null == i2 ? void 0 : i2.numberPlaceholders) || null, C = !(!T || !Object.keys(T).length);
1475
- let P = null;
1476
- if (!v && ((null == i2 ? void 0 : i2.minPlaceholder) || (null == i2 ? void 0 : i2.maxPlaceholder))) {
1477
- P = document.createElement("div"), P.classList.add("magicfeedback-rating-number-scale-labels");
1478
- const e4 = document.createElement("span");
1479
- e4.classList.add("magicfeedback-rating-number-scale-label"), e4.textContent = null !== (p = null == i2 ? void 0 : i2.minPlaceholder) && void 0 !== p ? p : "";
1480
- const t3 = document.createElement("span");
1481
- t3.classList.add("magicfeedback-rating-number-scale-label"), t3.textContent = null !== (m = null == i2 ? void 0 : i2.maxPlaceholder) && void 0 !== m ? m : "", "ltr" === o2 ? (P.appendChild(e4), P.appendChild(t3)) : (P.appendChild(t3), P.appendChild(e4));
1482
- }
1483
- let w = null;
1484
- if (v && !C && E.classList.add("magicfeedback-rating-number-container-column--bare"), (!v || !C) && ((null == i2 ? void 0 : i2.minPlaceholder) || (null == i2 ? void 0 : i2.maxPlaceholder))) {
1485
- const e4 = "ltr" === o2 ? null == i2 ? void 0 : i2.minPlaceholder : null == i2 ? void 0 : i2.maxPlaceholder, t3 = "ltr" === o2 ? null == i2 ? void 0 : i2.maxPlaceholder : null == i2 ? void 0 : i2.minPlaceholder, n2 = (e5) => {
1486
- const t4 = document.createElement("div");
1487
- return t4.classList.add("magicfeedback-rating-number-scale-label-block"), v || (t4.classList.add("magicfeedback-rating-number-scale-label-block--stacked"), t4.style.display = "none"), t4.textContent = e5, t4;
1488
- };
1489
- e4 && h.appendChild(n2(e4)), t3 && (w = n2(t3));
1490
- }
1491
- for (let t3 = k; t3 <= A; t3++) {
1492
- const n2 = document.createElement("div");
1493
- n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add(`magicfeedback-rating-number-option-${a}`);
1494
- const o3 = document.createElement("label");
1495
- o3.htmlFor = `rating-${e3}-${t3}`, o3.classList.add("magicfeedback-rating-number-option-label-container");
1496
- const c2 = C && (T[t3] || (t3 === k ? null == i2 ? void 0 : i2.minPlaceholder : void 0) || (t3 === A ? null == i2 ? void 0 : i2.maxPlaceholder : void 0)), u2 = document.createElement("input");
1497
- u2.id = `rating-${e3}-${t3}`, u2.type = "radio", u2.name = e3, u2.value = t3.toString(), u2.classList.add(s), u2.classList.add("magicfeedback-input");
1498
- const p2 = null == y ? void 0 : y(t3);
1499
- u2.setAttribute("aria-label", c2 ? `${t3} \u2014 ${c2}` : p2 ? `${t3} \u2014 ${p2}` : `${t3}`), (0, r.autoAdvanceOn)(u2, l), d && d === u2.value && (u2.checked = true), o3.appendChild(u2);
1500
- const m2 = document.createElement("span");
1501
- m2.classList.add("magicfeedback-rating-number-value");
1502
- const h2 = document.createElement("span");
1503
- if (h2.textContent = p2 ? `${t3} = ${p2}` : t3.toString(), h2.classList.add("magicfeedback-rating-number-value-num"), f && (h2.style.fontWeight = "normal"), m2.appendChild(h2), v) {
1504
- if (c2) {
1505
- const e4 = document.createElement("span");
1506
- e4.textContent = c2, e4.classList.add("magicfeedback-rating-number-value-label"), m2.appendChild(e4);
1507
- }
1508
- } else T && T[t3] && (o3.title = T[t3]);
1509
- o3.appendChild(m2), n2.appendChild(o3), E.appendChild(n2);
1510
- }
1511
- if (h.appendChild(E), w && h.appendChild(w), P && h.appendChild(P), v || f || (function(e4, i3, n2, r2) {
1512
- if ("undefined" == typeof ResizeObserver) return;
1513
- const o3 = i3.classList.contains("magicfeedback-rating-number-container-row--dense");
1514
- let a2 = 0, s2 = false;
1515
- const l2 = "function" == typeof requestAnimationFrame ? requestAnimationFrame : (e5) => (e5(0), 0);
1516
- let d2 = 0, c2 = false;
1517
- new ResizeObserver(((u2) => {
1518
- var p2;
1519
- const m2 = null === (p2 = u2[0]) || void 0 === p2 ? void 0 : p2.contentRect.width;
1520
- m2 && m2 !== d2 && (d2 = m2, c2 || (c2 = true, l2((() => {
1521
- c2 = false, s2 || (a2 = parseFloat(getComputedStyle(i3).columnGap) || 0);
1522
- const l3 = n2 * t2.RATING_NUMBER_MIN_CHIP_WIDTH + (n2 - 1) * a2;
1523
- var u3;
1524
- (u3 = d2 < l3) !== s2 && (s2 = u3, e4.classList.toggle("magicfeedback-rating-number--stacked", u3), e4.querySelectorAll(":scope > .magicfeedback-rating-number-scale-labels").forEach(((e5) => {
1525
- e5.style.display = u3 ? "none" : "";
1526
- })), e4.querySelectorAll(":scope > .magicfeedback-rating-number-scale-label-block--stacked").forEach(((e5) => {
1527
- e5.style.display = u3 ? "" : "none";
1528
- })), i3.classList.toggle("magicfeedback-rating-number-container-row", !u3), i3.classList.toggle("magicfeedback-rating-number-container-row--dense", !u3 && o3), i3.classList.toggle("magicfeedback-rating-number-container-column", u3), i3.classList.toggle("magicfeedback-rating-number-container-column--bare", u3), i3.style.flexDirection = u3 ? "ltr" === r2 ? "column" : "column-reverse" : "ltr" === r2 ? "row" : "row-reverse", i3.querySelectorAll(":scope > .magicfeedback-rating-number-option").forEach(((e5) => {
1529
- e5.classList.toggle("magicfeedback-rating-number-option-row", !u3), e5.classList.toggle("magicfeedback-rating-number-option-column", u3);
1530
- })));
1531
- }))));
1532
- })).observe(e4);
1533
- })(h, E, A - k + 1, o2), (null == i2 ? void 0 : i2.extraOption) && (null == i2 ? void 0 : i2.extraOptionText)) {
1534
- const t3 = document.createElement("div");
1535
- t3.classList.add("magicfeedback-rating-number-extra-row");
1536
- const n2 = document.createElement("div");
1537
- n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add("magicfeedback-rating-number-option--extra");
1538
- const o3 = document.createElement("label");
1539
- o3.htmlFor = `rating-${e3}-extra`, o3.classList.add("magicfeedback-rating-number-option-label-container");
1540
- const a2 = document.createElement("input");
1541
- a2.id = `rating-${e3}-extra`, a2.type = "radio", a2.name = e3, a2.value = "-", a2.classList.add(s), a2.classList.add("magicfeedback-input"), a2.setAttribute("aria-label", null == i2 ? void 0 : i2.extraOptionText), (0, r.autoAdvanceOn)(a2, l);
1542
- const d2 = document.createElement("span");
1543
- d2.classList.add("magicfeedback-rating-number-value");
1544
- const c2 = document.createElement("span");
1545
- c2.textContent = null == i2 ? void 0 : i2.extraOptionText, c2.classList.add("magicfeedback-rating-number-value-label"), d2.appendChild(c2), o3.appendChild(a2), o3.appendChild(d2), n2.appendChild(o3), t3.appendChild(n2), h.appendChild(t3);
1546
- }
1547
- return h;
1548
- }, t2.usesLegacyRatingNumber = function(e3) {
1549
- return !!e3 && /matas/i.test(e3);
1550
- }, t2.RATING_NUMBER_MIN_CHIP_WIDTH = 44;
1551
- }, 368: (e2, t2, i) => {
1552
- "use strict";
1553
- Object.defineProperty(t2, "__esModule", { value: true }), t2.getQuestionRenderer = void 0;
1554
- const n = i(4760), r = i(620), o = i(9006), a = i(3034), s = i(8924), l = i(2807), d = i(2311), c = i(8139), u = i(6363), p = i(7282), m = i(9369), h = i(2626), f = i(2255), g = i(1042), y = i(1994), v = i(1615), b = i(8160), E = i(9169), A = i(1724), k = i(2287), T = i(9796), C = i(5430), P = /* @__PURE__ */ new Map([[n.FEEDBACKAPPANSWERTYPE.TEXT, s.renderText], [n.FEEDBACKAPPANSWERTYPE.LONGTEXT, o.renderLongText], [n.FEEDBACKAPPANSWERTYPE.NUMBER, a.renderNumber], [n.FEEDBACKAPPANSWERTYPE.RADIO, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.BOOLEAN, l.renderBoolean], [n.FEEDBACKAPPANSWERTYPE.SELECT, d.renderSelect], [n.FEEDBACKAPPANSWERTYPE.DATE, c.renderDate], [n.FEEDBACKAPPANSWERTYPE.EMAIL, u.renderEmail], [n.FEEDBACKAPPANSWERTYPE.PASSWORD, p.renderPassword], [n.FEEDBACKAPPANSWERTYPE.CONSENT, m.renderConsent], [n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI, h.renderRatingEmoji], [n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER, f.renderRatingNumber], [n.FEEDBACKAPPANSWERTYPE.RATING_STAR, g.renderRatingStar], [n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX, y.renderMatrix], [n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST, v.renderPriorityList], [n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM, b.renderPointSystem], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, E.renderUploadImage], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, A.renderUploadFile], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, k.renderMultipleChoiceImage], [n.FEEDBACKAPPANSWERTYPE.INFO_PAGE, T.renderInfoPage], [n.FEEDBACKAPPANSWERTYPE.MAX_DIFF, C.renderMaxDiff]]);
1555
- t2.getQuestionRenderer = function(e3) {
1556
- return P.get(e3);
1557
- };
1558
- }, 2807: (e2, t2, i) => {
1559
- "use strict";
1560
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderBoolean = void 0;
1561
- const n = i(1366), r = i(9039);
1562
- t2.renderBoolean = ({ question: e3, language: t3, urlParamValue: i2, send: o }) => {
1563
- const { ref: a, assets: s } = e3, l = document.createElement("div"), d = "magicfeedback-radio", c = document.createElement("div");
1564
- return c.classList.add("magicfeedback-boolean-container"), c.style.display = "flex", c.style.flexDirection = "row", c.style.justifyContent = "space-between", c.style.width = "70%", c.style.margin = "auto", ((null == s ? void 0 : s.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (0, n.getBooleanOptions)(t3)).forEach(((e4, t4) => {
1565
- const n2 = document.createElement("label");
1566
- n2.classList.add("magicfeedback-boolean-option"), n2.htmlFor = `rating-${a}-${t4}`, n2.style.cursor = "pointer", n2.style.display = "flex", n2.style.justifyContent = "center", n2.style.alignItems = "center", n2.style.margin = "auto", n2.style.padding = "0", n2.style.width = "45%", n2.style.height = "38px";
1567
- const s2 = document.createElement("label");
1568
- s2.htmlFor = `rating-${a}-${t4}`, s2.textContent = e4, s2.style.margin = "0", s2.style.padding = "0";
1569
- const l2 = document.createElement("input");
1570
- l2.id = `rating-${a}-${t4}`, l2.type = "radio", l2.name = a, l2.value = ["Yes", "No"][t4], l2.classList.add(d), l2.classList.add("magicfeedback-input"), l2.style.position = "absolute", l2.style.opacity = "0", l2.style.width = "0", l2.style.height = "0", l2.style.margin = "0", (0, r.autoAdvanceOn)(l2, o), i2 && i2.toLowerCase() === l2.value.toLowerCase() && (l2.checked = true), n2.appendChild(l2), n2.appendChild(s2), c.appendChild(n2);
1571
- })), l.appendChild(c), { element: l, elementTypeClass: d };
1572
- };
1573
- }, 620: (e2, t2, i) => {
1574
- "use strict";
1575
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderChoice = void 0;
1576
- const n = i(4760), r = i(3262), o = i(9039);
1577
- t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: a, send: s }) => {
1578
- const { type: l, ref: d, value: c, defaultValue: u, assets: p } = e3, m = document.createElement("div"), h = "magicfeedback-" + ("MULTIPLECHOICE" === l ? "checkbox" : "radio");
1579
- let f = c || [];
1580
- a && (f = f.sort((() => Math.random() - 0.5)));
1581
- let g = (null == p ? void 0 : p.exclusiveAnswers) || [];
1582
- (null == p ? void 0 : p.extraOption) && (g = g.filter(((e4) => e4 !== p.extraOptionText))), g.length > 0 && (null == g || g.forEach(((e4) => {
1583
- f.includes(e4) || f.push(e4);
1584
- })));
1585
- const y = null == p ? void 0 : p.extraOptionText;
1586
- return (null == p ? void 0 : p.extraOption) && y && !f.includes(y) && f.push(y), f.forEach(((e4, a2) => {
1587
- const c2 = document.createElement("div");
1588
- c2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === l ? "checkbox" : "radio"}-container`);
1589
- const y2 = document.createElement("label"), v = document.createElement("input");
1590
- if (v.id = `rating-${d}-${a2}`, v.type = "MULTIPLECHOICE" === l ? "checkbox" : "radio", v.name = d, v.value = e4, v.classList.add(h), v.classList.add("magicfeedback-input"), l === n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == p ? void 0 : p.maxOptions) && (null == p ? void 0 : p.maxOptions) > 0 && v.addEventListener("change", (() => {
1591
- document.querySelectorAll(`input[name="${d}"]:checked`).length > (null == p ? void 0 : p.maxOptions) && (v.checked = false);
1592
- })), l === n.FEEDBACKAPPANSWERTYPE.RADIO && s && (!(null == p ? void 0 : p.extraOptionText) || (null == p ? void 0 : p.extraOptionText) && e4 !== (null == p ? void 0 : p.extraOptionText)) && (0, o.autoAdvanceOn)(v, s), e4 !== u && e4 !== i2 || (v.checked = true), y2.textContent = e4, y2.htmlFor = `rating-${d}-${a2}`, v.addEventListener("change", ((t4) => {
1593
- const i3 = document.getElementById(`extra-option-${d}`);
1594
- t4.target.checked && g.includes(e4) ? (f.forEach(((t5) => {
1595
- t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1596
- })), i3 && (i3.style.display = "none")) : g.forEach(((t5) => {
1597
- t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1598
- })), (null == p ? void 0 : p.extraOption) && e4 === (null == p ? void 0 : p.extraOptionText) && i3 && (i3.style.display = t4.target.checked ? "block" : "none");
1599
- })), c2.appendChild(v), c2.appendChild(y2), m.appendChild(c2), (null == p ? void 0 : p.extraOption) && e4 === (null == p ? void 0 : p.extraOptionText)) {
1600
- const e5 = document.createElement("input");
1601
- e5.type = "text", e5.placeholder = (null == p ? void 0 : p.extraOptionPlaceholder) || r.placeholder.answer(t3 || "en"), e5.classList.add("magicfeedback-extra-option"), e5.classList.add("magicfeedback-input"), e5.id = `extra-option-${d}`, e5.name = `extra-option-${d}`, e5.style.display = "none", m.appendChild(e5);
1602
- }
1603
- })), { element: m, elementTypeClass: h };
1604
- };
1605
- }, 9369: (e2, t2, i) => {
1606
- "use strict";
1607
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderConsent = void 0;
1608
- const n = i(9039);
1609
- t2.renderConsent = ({ question: e3, urlParamValue: t3, send: i2 }) => {
1610
- const { id: r, ref: o, value: a, require: s } = e3, l = document.createElement("input");
1611
- return l.type = "checkbox", l.id = `magicfeedback-${r}`, l.name = o, l.value = "true", l.required = s, l.classList.add("magicfeedback-consent"), l.classList.add("magicfeedback-input"), t3 && a.includes(t3) && (l.checked = true), (0, n.autoAdvanceOn)(l, i2), { element: l, elementTypeClass: "magicfeedback-consent" };
1612
- };
1613
- }, 8139: (e2, t2, i) => {
1614
- "use strict";
1615
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderDate = void 0;
1616
- const n = i(3262);
1617
- t2.renderDate = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1618
- const r = document.createElement("input");
1619
- return r.type = "date", r.placeholder = t3 || n.placeholder.date(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-date" };
1620
- };
1621
- }, 6363: (e2, t2) => {
1622
- "use strict";
1623
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderEmail = void 0, t2.renderEmail = ({ placeholderText: e3, urlParamValue: t3 }) => {
1624
- const i = document.createElement("input");
1625
- return i.type = "email", i.placeholder = e3 || "you@example.com", t3 && (i.value = t3), { element: i, elementTypeClass: "magicfeedback-email" };
1626
- };
1627
- }, 9796: (e2, t2) => {
1628
- "use strict";
1629
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderInfoPage = void 0, t2.renderInfoPage = ({ question: e3, placeholderText: t3 }) => {
1630
- var i, n;
1631
- const r = document.createElement("div");
1632
- if ("string" == typeof (null === (i = e3.assets) || void 0 === i ? void 0 : i.placeholder) ? "" !== e3.assets.placeholder.trim() : Boolean(null === (n = e3.assets) || void 0 === n ? void 0 : n.placeholder)) {
1633
- const e4 = document.createElement("div");
1634
- e4.classList.add("magicfeedback-info-message"), e4.innerHTML = t3 || "", r.appendChild(e4);
1635
- }
1636
- return { element: r, elementTypeClass: "magicfeedback-info-page" };
1637
- };
1638
- }, 9006: (e2, t2, i) => {
1639
- "use strict";
1640
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderLongText = void 0;
1641
- const n = i(3262);
1642
- t2.renderLongText = ({ language: e3, placeholderText: t3, urlParamValue: i2, maxCharacters: r }) => {
1643
- const o = document.createElement("textarea");
1644
- return o.rows = 3, r > 0 && (o.maxLength = r), o.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (o.value = i2), { element: o, elementTypeClass: "magicfeedback-longtext" };
1645
- };
1646
- }, 1994: (e2, t2) => {
1647
- "use strict";
1648
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMatrix = void 0, t2.renderMatrix = ({ question: e3, isPhone: t3, randomPosition: i }) => {
1649
- const { ref: n, value: r, assets: o } = e3, a = document.createElement("div"), s = document.createElement("div");
1650
- s.classList.add("magicfeedback-multi-question-matrix-container");
1651
- let l = (null == o ? void 0 : o.options) || [], d = [...r], c = [];
1652
- if (i && (l = null == l ? void 0 : l.sort((() => Math.random() - 0.5)), d = [...d].sort((() => Math.random() - 0.5))), (null == o ? void 0 : o.exclusiveAnswers) && (c = null == o ? void 0 : o.exclusiveAnswers, null == c || c.forEach(((e4) => {
1653
- d.includes(e4) || d.push(e4);
1654
- }))), t3) {
1655
- const e4 = document.createElement("div");
1656
- e4.classList.add("magicfeedback-multi-question-matrix-list"), null == l || l.forEach(((t4) => {
1657
- const i2 = document.createElement("div");
1658
- i2.classList.add("magicfeedback-multi-question-matrix-list-item"), i2.style.display = "flex", i2.style.flexDirection = "column", i2.style.alignItems = "flex-start", i2.style.marginBottom = "10px";
1659
- const r2 = document.createElement("label");
1660
- r2.classList.add("magicfeedback-multi-question-matrix-label"), r2.style.paddingBottom = "10px", r2.textContent = t4, i2.appendChild(r2), d.forEach(((e5) => {
1661
- const r3 = document.createElement("div");
1662
- r3.classList.add("magicfeedback-radio-container"), r3.style.display = "flex", r3.style.alignItems = "center", r3.style.justifyContent = "flex-start", r3.style.width = "99%", r3.style.margin = "5px auto";
1663
- const o2 = document.createElement("label"), a2 = document.createElement("input");
1664
- a2.id = `${n}-${t4}-${e5}`, a2.type = "radio", a2.name = `${n}-${t4}`, a2.value = e5, a2.classList.add("magicfeedback-input"), o2.textContent = e5, o2.htmlFor = `${n}-${t4}-${e5}`, r3.appendChild(a2), r3.appendChild(o2), i2.appendChild(r3);
1665
- })), e4.appendChild(i2);
1666
- })), s.appendChild(e4);
1667
- } else {
1668
- const e4 = document.createElement("table");
1669
- e4.classList.add("magicfeedback-multi-question-matrix-table");
1670
- const t4 = document.createElement("thead");
1671
- t4.classList.add("magicfeedback-multi-question-matrix-header"), t4.style.paddingBottom = "15px";
1672
- const i2 = document.createElement("tr"), r2 = document.createElement("th");
1673
- i2.appendChild(r2), d.forEach(((e5) => {
1674
- const t5 = document.createElement("th");
1675
- t5.textContent = e5, i2.appendChild(t5);
1676
- })), t4.appendChild(i2), e4.appendChild(t4);
1677
- const o2 = document.createElement("tbody");
1678
- null == l || l.forEach(((e5) => {
1679
- const t5 = document.createElement("tr");
1680
- t5.classList.add("magicfeedback-multi-question-matrix-row-tr");
1681
- const i3 = document.createElement("td");
1682
- i3.classList.add("magicfeedback-multi-question-matrix-question");
1683
- const r3 = document.createElement("label");
1684
- r3.classList.add("magicfeedback-multi-question-matrix-label"), r3.textContent = e5, i3.appendChild(r3), t5.appendChild(i3), d.forEach(((i4) => {
1685
- const r4 = document.createElement("td"), o3 = document.createElement("input");
1686
- o3.type = "radio", o3.name = `${n}-${e5}`, o3.value = i4, o3.id = `${n}-${e5}-${i4}`, o3.classList.add("magicfeedback-input");
1687
- const a2 = document.createElement("label");
1688
- a2.classList.add("magicfeedback-multi-question-matrix-option-label"), a2.htmlFor = o3.id, a2.textContent = i4, r4.classList.add("magicfeedback-multi-question-matrix-option"), r4.appendChild(o3), r4.appendChild(a2), t5.appendChild(r4);
1689
- })), o2.appendChild(t5);
1690
- })), e4.appendChild(o2), s.appendChild(e4);
1691
- }
1692
- return a.appendChild(s), { element: a, elementTypeClass: "magicfeedback-multi-question-matrix" };
1693
- };
1694
- }, 5430: (e2, t2, i) => {
1695
- "use strict";
1696
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMaxDiff = void 0;
1697
- const n = i(1366), r = i(7627), o = "http://www.w3.org/2000/svg";
1698
- t2.renderMaxDiff = ({ question: e3, language: t3, randomPosition: i2 }) => {
1699
- const { ref: a, value: s, assets: l } = e3, d = document.createElement("div");
1700
- let c = [...s || []];
1701
- i2 && (c = c.sort((() => Math.random() - 0.5)));
1702
- const u = { best: (0, n.parseTitle)(null == l ? void 0 : l.bestLabel, t3) || (0, r.t)(t3, "maxDiff.best"), worst: (0, n.parseTitle)(null == l ? void 0 : l.worstLabel, t3) || (0, r.t)(t3, "maxDiff.worst") }, p = document.createElement("div");
1703
- p.classList.add("magicfeedback-max-diff-container");
1704
- const m = Number(null == l ? void 0 : l.setIndex) || 1, h = Number(null == l ? void 0 : l.setCount) || 1;
1705
- (null == l ? void 0 : l.showSetProgress) && h > 1 && p.appendChild((function(e4, t4, i3) {
1706
- const n2 = document.createElement("div");
1707
- n2.classList.add("magicfeedback-max-diff-progress");
1708
- const o2 = document.createElement("span");
1709
- o2.classList.add("magicfeedback-max-diff-progress-label"), o2.textContent = (0, r.t)(i3, "maxDiff.setProgress", { k: e4, n: t4 });
1710
- const a2 = document.createElement("span");
1711
- a2.classList.add("magicfeedback-max-diff-progress-track"), a2.setAttribute("aria-hidden", "true");
1712
- const s2 = document.createElement("span");
1713
- return s2.classList.add("magicfeedback-max-diff-progress-fill"), s2.style.width = `${Math.min(100, e4 / t4 * 100)}%`, a2.appendChild(s2), n2.appendChild(o2), n2.appendChild(a2), n2;
1714
- })(m, h, t3));
1715
- const f = document.createElement("table");
1716
- f.classList.add("magicfeedback-max-diff-table");
1717
- const g = (e4) => {
1718
- const t4 = document.createElement("th");
1719
- t4.scope = "col", t4.classList.add("magicfeedback-max-diff-head", `magicfeedback-max-diff-head-${e4}`);
1720
- const i3 = document.createElement("span");
1721
- return i3.classList.add("magicfeedback-max-diff-head-label"), i3.appendChild((function(e5) {
1722
- const t5 = document.createElementNS(o, "svg");
1723
- t5.setAttribute("viewBox", "0 0 24 24"), t5.setAttribute("width", "16"), t5.setAttribute("height", "16"), t5.setAttribute("fill", "none"), t5.setAttribute("stroke", "currentColor"), t5.setAttribute("stroke-width", "2.6"), t5.setAttribute("stroke-linecap", "round"), t5.setAttribute("stroke-linejoin", "round"), t5.setAttribute("aria-hidden", "true");
1724
- const i4 = document.createElementNS(o, "path");
1725
- return i4.setAttribute("d", "best" === e5 ? "M12 19V5M5 12l7-7 7 7" : "M12 5v14M19 12l-7 7-7-7"), t5.appendChild(i4), t5;
1726
- })(e4)), i3.appendChild(document.createTextNode(u[e4])), t4.appendChild(i3), t4;
1727
- }, y = document.createElement("thead"), v = document.createElement("tr"), b = document.createElement("td");
1728
- b.classList.add("magicfeedback-max-diff-head-spacer"), v.appendChild(g("best")), v.appendChild(b), v.appendChild(g("worst")), y.appendChild(v), f.appendChild(y);
1729
- const E = (e4, t4, i3) => {
1730
- const n2 = document.createElement("td");
1731
- n2.classList.add("magicfeedback-max-diff-cell");
1732
- const r2 = document.createElement("label");
1733
- r2.classList.add("magicfeedback-max-diff-pick");
1734
- const o2 = document.createElement("input");
1735
- return o2.type = "radio", o2.name = `${a}-${e4}`, o2.value = t4, o2.id = `${a}-${e4}-${i3}`, o2.classList.add("magicfeedback-input", "magicfeedback-max-diff-input", `magicfeedback-max-diff-${e4}`), o2.setAttribute("aria-label", `${t4}: ${u[e4]}`), r2.appendChild(o2), n2.appendChild(r2), n2;
1736
- }, A = document.createElement("tbody");
1737
- return c.forEach(((e4, t4) => {
1738
- const i3 = document.createElement("tr");
1739
- i3.classList.add("magicfeedback-max-diff-row");
1740
- const n2 = document.createElement("th");
1741
- n2.scope = "row", n2.classList.add("magicfeedback-max-diff-item"), n2.textContent = e4, i3.appendChild(E("best", e4, t4)), i3.appendChild(n2), i3.appendChild(E("worst", e4, t4)), A.appendChild(i3);
1742
- })), f.appendChild(A), f.addEventListener("change", ((e4) => {
1743
- var t4;
1744
- const i3 = e4.target;
1745
- i3.classList.contains("magicfeedback-max-diff-input") && (null === (t4 = i3.closest("tr")) || void 0 === t4 || t4.querySelectorAll(".magicfeedback-max-diff-input").forEach(((e5) => {
1746
- e5 !== i3 && (e5.checked = false);
1747
- })));
1748
- })), p.appendChild(f), d.appendChild(p), { element: d, elementTypeClass: "magicfeedback-max-diff" };
1749
- };
1750
- }, 2287: (e2, t2, i) => {
1751
- "use strict";
1752
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMultipleChoiceImage = void 0;
1753
- const n = i(9039);
1754
- t2.renderMultipleChoiceImage = ({ question: e3, randomPosition: t3, urlParamValue: i2, send: r }) => {
1755
- const o = document.createElement("div"), { ref: a, assets: s } = e3;
1756
- let l = [...e3.value];
1757
- const d = document.createElement("div");
1758
- d.classList.add("magicfeedback-multiple-choice-image-container"), d.style.display = "flex", d.style.flexDirection = "row", d.style.flexWrap = "wrap", d.style.justifyContent = "center";
1759
- const c = l.length;
1760
- let u = 1, p = 1;
1761
- if (window.innerWidth < 600) u = 1, p = c;
1762
- else switch (c) {
1763
- case 1:
1764
- case 2:
1765
- case 3:
1766
- u = c, p = 1;
1767
- break;
1768
- case 4:
1769
- case 5:
1770
- case 6:
1771
- p = 2, u = Math.ceil(c / p);
1772
- break;
1773
- case 7:
1774
- case 8:
1775
- case 9:
1776
- p = 3, u = Math.ceil(c / p);
1777
- break;
1778
- default:
1779
- p = 4, u = Math.ceil(c / p);
1780
- }
1781
- const m = void 0 !== (null == s ? void 0 : s.addTitle) && (null == s ? void 0 : s.addTitle), h = void 0 !== (null == s ? void 0 : s.multiOption) && (null == s ? void 0 : s.multiOption), f = void 0 !== (null == s ? void 0 : s.extraOption) && (null == s ? void 0 : s.extraOption);
1782
- function g(e4) {
1783
- try {
1784
- const { position: t4, url: o2, value: s2 } = e4, l2 = document.createElement("div");
1785
- l2.classList.add("magicfeedback-multiple-choice-image-option"), l2.style.width = `calc(100% / ${u} - 2px)`, l2.style.height = `calc(100% / ${p} - 2px)`, l2.style.padding = "8px", l2.style.margin = "0";
1786
- const c2 = document.createElement("label");
1787
- c2.classList.add("magicfeedback-image-option-label-container"), c2.htmlFor = `rating-${a}-${t4}`, c2.style.cursor = "pointer", c2.addEventListener("click", (() => {
1788
- c2.style.border = "2px solid #000";
1789
- }));
1790
- const f2 = document.createElement("label");
1791
- f2.textContent = s2, f2.classList.add("magicfeedback-multiple-choice-image-label");
1792
- const g2 = document.createElement("input");
1793
- g2.id = `rating-${a}-${t4}`, g2.type = h ? "checkbox" : "radio", g2.name = a, g2.value = s2, g2.style.position = "absolute", g2.style.opacity = "0", g2.style.width = "0", g2.style.height = "0", g2.classList.add("magicfeedback-input"), i2 && i2 === g2.value && (g2.checked = true), h || (0, n.autoAdvanceOn)(g2, r);
1794
- const y = document.createElement("img");
1795
- y.classList.add("magicfeedback-multiple-choice-image-image"), y.src = o2, y.style.cursor = "pointer", y.style.backgroundSize = "cover", y.style.backgroundPosition = "center", y.style.width = "100%", y.style.height = "100%", y.style.objectFit = "cover", y.style.margin = "auto", c2.appendChild(g2), c2.appendChild(y), m && c2.appendChild(f2), l2.appendChild(c2), d.appendChild(l2);
1796
- } catch (e5) {
1797
- console.error(e5);
1798
- }
1799
- }
1800
- return t3 && (l = l.sort((() => Math.random() - 0.5))), l.forEach(((e4) => g(JSON.parse(e4)))), f && (null == s ? void 0 : s.extraOptionValue) && (null == s ? void 0 : s.extraOptionValue.length) > 0 && g(null == s ? void 0 : s.extraOptionValue[0]), o.appendChild(d), { element: o, elementTypeClass: "magicfeedback-multiple-choice-image" };
1801
- };
1802
- }, 3034: (e2, t2, i) => {
1803
- "use strict";
1804
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderNumber = void 0;
1805
- const n = i(3262), r = i(1366);
1806
- t2.renderNumber = ({ question: e3, format: t3, language: i2, urlParamValue: o }) => {
1807
- const a = document.createElement("input");
1808
- a.type = "number", a.placeholder = "slim" === t3 ? (0, r.parseTitle)(e3.title, i2) : n.placeholder.number(i2 || "en");
1809
- const { value: s } = e3;
1810
- return s.length && (s.sort(((e4, t4) => Number(e4) - Number(t4))), a.max = s[s.length - 1], a.min = s[0], a.value = s[0]), o && !isNaN(Number(o)) && (a.value = o), { element: a, elementTypeClass: "magicfeedback-number" };
1811
- };
1812
- }, 7282: (e2, t2, i) => {
1813
- "use strict";
1814
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPassword = void 0;
1815
- const n = i(3262);
1816
- t2.renderPassword = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1817
- const r = document.createElement("input");
1818
- return r.type = "password", r.placeholder = t3 || n.placeholder.password(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-password" };
1819
- };
1820
- }, 8160: (e2, t2, i) => {
1821
- "use strict";
1822
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPointSystem = void 0;
1823
- const n = i(3262);
1824
- t2.renderPointSystem = ({ question: e3, language: t3 }) => {
1825
- const { ref: i2, value: r } = e3, o = document.createElement("div"), a = document.createElement("div");
1826
- a.classList.add("magicfeedback-point-system-container");
1827
- const s = document.createElement("ul");
1828
- s.classList.add("magicfeedback-point-system-list"), s.style.padding = "0";
1829
- const l = 100 / r.length, d = document.createElement("div");
1830
- d.classList.add("magicfeedback-error"), d.textContent = n.placeholder.pointsystemerror(t3 || "en"), d.style.color = "#C70039", d.style.fontSize = "14px", d.style.textAlign = "end", d.style.width = "100%", d.style.display = "none";
1831
- const c = document.createElement("div");
1832
- c.classList.add("magicfeedback-point-system-total"), c.style.textAlign = "end", c.style.fontSize = "15px", c.style.marginTop = "5px";
1833
- const u = document.createElement("bdi");
1834
- return u.setAttribute("dir", "ltr"), u.textContent = "0 / 100 %", c.appendChild(u), r.forEach(((e4, t4) => {
1835
- const n2 = document.createElement("li");
1836
- n2.classList.add("magicfeedback-point-system-item"), n2.style.display = "flex", n2.style.justifyContent = "space-between", n2.style.alignItems = "center", n2.style.margin = "5px";
1837
- const r2 = document.createElement("label");
1838
- r2.textContent = e4, r2.style.fontSize = "15px", n2.appendChild(r2);
1839
- const o2 = document.createElement("span");
1840
- o2.classList.add("magicfeedback-point-system-input-container");
1841
- const a2 = document.createElement("input");
1842
- a2.name = i2, a2.id = `${e4}`, a2.type = "number", a2.min = "0", a2.max = "100", a2.value = "0", a2.classList.add("magicfeedback-input"), a2.style.width = "40px", a2.style.border = "0", a2.style.textAlign = "center", a2.style.margin = "0 5px", a2.autofocus = 0 === t4;
1843
- const p = document.createElement("span");
1844
- p.textContent = "%", p.style.color = "#000", a2.addEventListener("input", (() => {
1845
- const e5 = s.querySelectorAll("input");
1846
- let t5 = 0;
1847
- e5.forEach(((e6) => {
1848
- t5 += Number(e6.value);
1849
- })), t5 > 100 && (a2.value = `${l}%`, t5 -= Number(a2.value));
1850
- const i3 = document.getElementById("magicfeedback-submit");
1851
- i3 && (t5 < 100 ? (c.style.color = "orange", i3.setAttribute("disabled", "true")) : (d.style.display = "none", c.style.color = "green", i3.removeAttribute("disabled"))), u.textContent = `${t5} / 100 %`;
1852
- })), a2.addEventListener("focus", (() => {
1853
- const e5 = document.getElementById("magicfeedback-submit");
1854
- e5 && (e5.setAttribute("disabled", "true"), e5.addEventListener("pointerover", (() => {
1855
- const e6 = s.querySelectorAll("input");
1856
- let t5 = 0;
1857
- e6.forEach(((e7) => {
1858
- t5 += Number(e7.value);
1859
- })), t5 < 100 && (d.style.display = "block");
1860
- })));
1861
- })), o2.appendChild(a2), o2.appendChild(p), n2.appendChild(o2), s.appendChild(n2);
1862
- })), a.appendChild(s), a.appendChild(c), a.appendChild(d), o.appendChild(a), { element: o, elementTypeClass: "magicfeedback-point-system" };
1863
- };
1864
- }, 1615: (e2, t2, i) => {
1865
- "use strict";
1866
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPriorityList = void 0;
1867
- const n = i(7627);
1868
- t2.renderPriorityList = ({ question: e3, randomPosition: t3, language: i2 }) => {
1869
- var r, o, a;
1870
- const s = document.createElement("div"), l = (function(e4) {
1871
- const { value: t4, ref: i3, randomPosition: r2 = false, limitPriority: o2 = false, maxPriority: a2 = 0, language: s2 = "en", placeholder: l2 = "" } = e4, d = (e5) => (0, n.t)(s2, "priority." + e5), c = document.createElement("div");
1872
- if (c.classList.add("magicfeedback-priority-list-container"), o2 && a2 && a2 > 0) {
1873
- const e5 = [], o3 = document.createElement("div");
1874
- o3.classList.add("magicfeedback-priority-list-header");
1875
- const u2 = document.createElement("div");
1876
- u2.classList.add("magicfeedback-priority-list-instruction"), u2.textContent = "" !== l2 ? l2 : `${d("instruction")}`, u2.style.display = "none";
1877
- const p2 = document.createElement("button");
1878
- p2.type = "button", p2.textContent = d("selectOptions"), p2.classList.add("magicfeedback-button"), p2.classList.add("magicfeedback-priority-list-open-btn"), o3.appendChild(p2), o3.appendChild(u2);
1879
- const m = document.createElement("div");
1880
- m.classList.add("magicfeedback-priority-list-reorder");
1881
- const h = document.createElement("ul");
1882
- h.classList.add("magicfeedback-priority-list-list"), m.appendChild(h);
1883
- const f = () => {
1884
- h.innerHTML = "", e5.forEach(((t5, n2) => {
1885
- const r3 = document.createElement("li");
1886
- r3.classList.add("magicfeedback-priority-list-item");
1887
- const o4 = document.createElement("input");
1888
- o4.classList.add("magicfeedback-input-magicfeedback-priority-list"), o4.classList.add("magicfeedback-input"), o4.type = "hidden", o4.id = `priority-list-${i3}`, o4.name = i3, o4.value = `${n2 + 1}. ${t5}`, r3.appendChild(o4);
1889
- const a3 = document.createElement("label");
1890
- a3.classList.add("magicfeedback-priority-list-item-label"), a3.textContent = `${n2 + 1}. ${t5}`, r3.appendChild(a3);
1891
- const s3 = document.createElement("div");
1892
- s3.classList.add("magicfeedback-priority-list-arrows");
1893
- const l3 = document.createElement("img");
1894
- l3.classList.add("magicfeedback-priority-list-arrow-up"), l3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l3.style.visibility = 0 === n2 ? "hidden" : "visible";
1895
- const d2 = document.createElement("img");
1896
- d2.classList.add("magicfeedback-priority-list-arrow-down"), d2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", d2.style.transform = "rotate(180deg)", d2.style.visibility = n2 === e5.length - 1 ? "hidden" : "visible", l3.addEventListener("click", (() => {
1897
- var i4, n3, s4, c2;
1898
- const u3 = r3.previousElementSibling;
1899
- if (u3) {
1900
- const p3 = Number(null === (i4 = o4.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) - 1;
1901
- o4.value = `${p3}. ${t5}`, a3.textContent = `${p3}. ${t5}`, l3.style.visibility = 1 === p3 ? "hidden" : "visible", d2.style.visibility = p3 === e5.length ? "hidden" : "visible";
1902
- const m2 = u3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f2 = u3.querySelector(".magicfeedback-priority-list-item-label"), g2 = u3.querySelector(".magicfeedback-priority-list-arrow-up"), y2 = u3.querySelector(".magicfeedback-priority-list-arrow-down");
1903
- if (m2 && f2 && g2 && y2) {
1904
- const t6 = Number(null === (n3 = m2.value) || void 0 === n3 ? void 0 : n3.split(".")[0]) + 1;
1905
- m2.value = `${t6}.${null === (s4 = f2.textContent) || void 0 === s4 ? void 0 : s4.split(".")[1]}`, f2.textContent = `${t6}.${null === (c2 = f2.textContent) || void 0 === c2 ? void 0 : c2.split(".")[1]}`, g2.style.visibility = 1 === t6 ? "hidden" : "visible", y2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1906
- }
1907
- h.insertBefore(r3, u3);
1908
- }
1909
- })), d2.addEventListener("click", (() => {
1910
- var i4, n3, s4;
1911
- const c2 = r3.nextElementSibling;
1912
- if (c2) {
1913
- const u3 = Number(null === (i4 = o4.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) + 1;
1914
- o4.value = `${u3}. ${t5}`, a3.textContent = `${u3}. ${t5}`, l3.style.visibility = 1 === u3 ? "hidden" : "visible", d2.style.visibility = u3 === e5.length ? "hidden" : "visible";
1915
- const p3 = c2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), m2 = c2.querySelector(".magicfeedback-priority-list-item-label"), f2 = c2.querySelector(".magicfeedback-priority-list-arrow-up"), g2 = c2.querySelector(".magicfeedback-priority-list-arrow-down");
1916
- if (p3 && m2 && f2 && g2) {
1917
- const t6 = Number(p3.value.split(".")[0]) - 1;
1918
- p3.value = `${t6}.${null === (n3 = m2.textContent) || void 0 === n3 ? void 0 : n3.split(".")[1]}`, m2.textContent = `${t6}.${null === (s4 = m2.textContent) || void 0 === s4 ? void 0 : s4.split(".")[1]}`, f2.style.visibility = 1 === t6 ? "hidden" : "visible", g2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1919
- }
1920
- h.insertBefore(c2, r3);
1921
- }
1922
- })), s3.appendChild(l3), s3.appendChild(d2), r3.appendChild(s3), h.appendChild(r3);
1923
- }));
1924
- }, g = document.createElement("div");
1925
- g.classList.add("magicfeedback-modal-backdrop"), g.setAttribute("dir", (0, n.isRtlLanguage)(s2) ? "rtl" : "ltr"), g.style.position = "fixed", g.style.top = "0", g.style.left = "0", g.style.width = "100vw", g.style.height = "100vh", g.style.background = "rgba(0,0,0,0.4)", g.style.display = "none", g.style.alignItems = "center", g.style.justifyContent = "center", g.style.zIndex = "9999";
1926
- const y = document.createElement("div");
1927
- y.classList.add("magicfeedback-modal"), y.style.background = "#fff", y.style.borderRadius = "8px", y.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", y.style.maxWidth = "520px", y.style.width = "90%", y.style.maxHeight = "80vh", y.style.display = "flex", y.style.flexDirection = "column", y.style.overflow = "hidden", y.style.padding = "16px", y.style.position = "relative";
1928
- const v = document.createElement("h5");
1929
- v.classList.add("magicfeedback-modal-title"), v.style.flexShrink = "0", v.style.marginTop = "0";
1930
- const b = () => Math.min(e5.length + 1, a2), E = () => {
1931
- v.textContent = `${d("selectOptionNumber")}${b()}`;
1932
- };
1933
- E();
1934
- const A = document.createElement("div");
1935
- A.classList.add("magicfeedback-modal-list"), A.style.flex = "1 1 auto", A.style.overflowY = "auto", A.style.minHeight = "0", (r2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
1936
- const n2 = document.createElement("label");
1937
- n2.classList.add("magicfeedback-modal-row");
1938
- const r3 = document.createElement("input");
1939
- r3.type = "checkbox", r3.classList.add("magicfeedback-input"), r3.name = `${i3}-selection`, r3.value = t5;
1940
- const o4 = document.createElement("span");
1941
- o4.textContent = t5, r3.addEventListener("change", (() => {
1942
- if (r3.checked) {
1943
- if (e5.length >= a2) return r3.checked = false, n2.classList.add("magicfeedback-warning"), void setTimeout((() => {
1944
- n2.classList.remove("magicfeedback-warning");
1945
- }), 800);
1946
- e5.push(t5);
1947
- } else {
1948
- const i4 = e5.indexOf(t5);
1949
- -1 !== i4 && e5.splice(i4, 1);
1950
- }
1951
- E(), C();
1952
- })), n2.appendChild(r3), n2.appendChild(o4), A.appendChild(n2);
1953
- }));
1954
- const k = document.createElement("div");
1955
- k.classList.add("magicfeedback-modal-actions"), k.style.flexShrink = "0";
1956
- const T = document.createElement("div");
1957
- T.classList.add("magicfeedback-modal-counter");
1958
- const C = () => {
1959
- const t5 = d("of");
1960
- T.textContent = `${d("prioritized")} ${e5.length} ${t5} ${a2}`, u2.style.display = e5.length > 0 ? "block" : "none";
1961
- };
1962
- C();
1963
- const P = document.createElement("button");
1964
- P.type = "button", P.classList.add("magicfeedback-modal-close"), P.setAttribute("aria-label", d("cancel")), P.title = d("cancel"), P.textContent = "\xD7", P.style.position = "absolute", P.style.top = "8px", P.style.setProperty("inset-inline-end", "8px"), P.style.border = "none", P.style.background = "transparent", P.style.fontSize = "24px", P.style.cursor = "pointer";
1965
- const w = () => {
1966
- document.body.appendChild(g), g.style.display = "flex", E(), C();
1967
- }, x = () => {
1968
- g.style.display = "none", c.appendChild(g);
1969
- };
1970
- P.addEventListener("click", (() => {
1971
- x();
1972
- }));
1973
- const S = document.createElement("button");
1974
- return S.type = "button", S.textContent = d("confirm"), S.classList.add("magicfeedback-button"), S.classList.add("magicfeedback-button-primary"), S.addEventListener("click", (() => {
1975
- x(), f();
1976
- })), k.appendChild(T), k.appendChild(S), y.appendChild(P), y.appendChild(v), y.appendChild(A), y.appendChild(k), g.appendChild(y), p2.addEventListener("click", (() => {
1977
- w();
1978
- })), g.addEventListener("click", ((e6) => {
1979
- e6.target === g && x();
1980
- })), c.appendChild(o3), c.appendChild(m), c.appendChild(g), f(), c;
1981
- }
1982
- const u = document.createElement("ul");
1983
- u.classList.add("magicfeedback-priority-list-list");
1984
- const p = r2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4];
1985
- return p.forEach(((e5, t5) => {
1986
- const n2 = document.createElement("li");
1987
- n2.classList.add("magicfeedback-priority-list-item"), n2.style.display = "flex", n2.style.justifyContent = "space-between", n2.style.alignItems = "center", n2.style.margin = "5px";
1988
- const r3 = document.createElement("input");
1989
- r3.classList.add("magicfeedback-input-magicfeedback-priority-list"), r3.classList.add("magicfeedback-input"), r3.type = "hidden", r3.id = `priority-list-${i3}`, r3.name = i3, r3.value = `${t5 + 1}. ${e5}`, n2.appendChild(r3);
1990
- const o3 = document.createElement("label");
1991
- o3.classList.add("magicfeedback-priority-list-item-label"), o3.textContent = `${t5 + 1}. ${e5}`, n2.appendChild(o3);
1992
- const a3 = document.createElement("div");
1993
- a3.style.display = "flex", a3.style.alignItems = "center", a3.style.justifyContent = "space-between";
1994
- const s3 = document.createElement("img");
1995
- s3.classList.add("magicfeedback-priority-list-arrow-up"), s3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", s3.style.width = "20px", s3.style.height = "20px", s3.style.cursor = "pointer", s3.style.margin = "0 5px", s3.style.color = "#000", s3.style.visibility = 0 === t5 ? "hidden" : "visible", s3.addEventListener("click", (() => {
1996
- var t6, i4, a4, d2;
1997
- const c2 = n2.previousElementSibling;
1998
- if (c2) {
1999
- const m = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
2000
- r3.value = `${m}. ${e5}`, o3.textContent = `${m}. ${e5}`, s3.style.visibility = 1 === m ? "hidden" : "visible", l3.style.visibility = m === p.length ? "hidden" : "visible";
2001
- const h = c2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f = c2.querySelector(".magicfeedback-priority-list-item-label"), g = c2.querySelector(".magicfeedback-priority-list-arrow-up"), y = c2.querySelector(".magicfeedback-priority-list-arrow-down");
2002
- if (h && f && g && y) {
2003
- const e6 = Number(null === (i4 = h.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) + 1;
2004
- h.value = `${e6}.${null === (a4 = f.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.textContent = `${e6}.${null === (d2 = f.textContent) || void 0 === d2 ? void 0 : d2.split(".")[1]}`, g.style.visibility = 1 === e6 ? "hidden" : "visible", y.style.visibility = e6 === p.length ? "hidden" : "visible";
2005
- }
2006
- u.insertBefore(n2, c2);
2007
- }
2008
- }));
2009
- const l3 = document.createElement("img");
2010
- l3.classList.add("magicfeedback-priority-list-arrow-down"), l3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l3.style.width = "20px", l3.style.height = "20px", l3.style.cursor = "pointer", l3.style.margin = "0 5px", l3.style.color = "#000", l3.style.transform = "rotate(180deg)", l3.style.visibility = t5 === p.length - 1 ? "hidden" : "visible", l3.addEventListener("click", (() => {
2011
- var t6, i4, a4;
2012
- const d2 = n2.nextElementSibling;
2013
- if (d2) {
2014
- const c2 = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
2015
- r3.value = `${c2}. ${e5}`, o3.textContent = `${c2}. ${e5}`, s3.style.visibility = 1 === c2 ? "hidden" : "visible", l3.style.visibility = c2 === p.length ? "hidden" : "visible";
2016
- const m = d2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h = d2.querySelector(".magicfeedback-priority-list-item-label"), f = d2.querySelector(".magicfeedback-priority-list-arrow-up"), g = d2.querySelector(".magicfeedback-priority-list-arrow-down");
2017
- if (m && h && f && g) {
2018
- const e6 = Number(m.value.split(".")[0]) - 1;
2019
- m.value = `${e6}.${null === (i4 = h.textContent) || void 0 === i4 ? void 0 : i4.split(".")[1]}`, h.textContent = `${e6}.${null === (a4 = h.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.style.visibility = 1 === e6 ? "hidden" : "visible", g.style.visibility = e6 === p.length ? "hidden" : "visible";
2020
- }
2021
- u.insertBefore(d2, n2);
2022
- }
2023
- })), a3.appendChild(s3), a3.appendChild(l3), n2.appendChild(a3), u.appendChild(n2);
2024
- })), c.appendChild(u), c;
2025
- })({ value: e3.value, ref: e3.ref, randomPosition: t3, limitPriority: (null === (r = e3.assets) || void 0 === r ? void 0 : r.limitPriority) || false, maxPriority: (null === (o = e3.assets) || void 0 === o ? void 0 : o.maxPriority) || 0, placeholder: (null === (a = e3.assets) || void 0 === a ? void 0 : a.placeholder) || "", language: i2 || "en" });
2026
- return s.appendChild(l), { element: s, elementTypeClass: "magicfeedback-priority-list" };
2027
- };
2028
- }, 2626: (e2, t2, i) => {
2029
- "use strict";
2030
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingEmoji = void 0;
2031
- const n = i(2709), r = i(9039), o = "https://survey-dev.magicfeedback.io/assets/emojis";
2032
- t2.renderRatingEmoji = ({ question: e3, url: t3, send: i2, urlParamValue: a }) => {
2033
- const { ref: s, assets: l } = e3, d = document.createElement("div"), c = "magicfeedback-rating", u = document.createElement("div");
2034
- u.classList.add("magicfeedback-rating-container");
2035
- const p = (null == l ? void 0 : l.max) ? Number(null == l ? void 0 : l.max) : 5, m = (null == l ? void 0 : l.min) ? Number(null == l ? void 0 : l.min) : 1, h = (0, n.createRatingPlaceholder)(null == l ? void 0 : l.minPlaceholder, null == l ? void 0 : l.maxPlaceholder);
2036
- for (let e4 = m; e4 <= p; e4++) {
2037
- const n2 = document.createElement("div");
2038
- n2.classList.add("magicfeedback-rating-option");
2039
- const l2 = document.createElement("label");
2040
- l2.htmlFor = `rating-${s}-${e4}`, l2.classList.add("magicfeedback-rating-option-label-container");
2041
- const d2 = document.createElement("label");
2042
- d2.htmlFor = `rating-${s}-${e4}`, d2.textContent = e4.toString();
2043
- const h2 = document.createElement("img");
2044
- if (h2.alt = `face-${s}-${e4}`, h2.className = `rating-image${e4}`, 0 === m && 10 === p) h2.src = `${t3}/${e4}.svg`, h2.onerror = () => h2.src = `${o}/${e4}.svg`;
2045
- else if (1 === m && 5 === p) switch (e4) {
2046
- case 1:
2047
- h2.src = `${t3}/1.svg`, h2.onerror = () => h2.src = `${o}/1.svg`;
2048
- break;
2049
- case 2:
2050
- h2.src = `${t3}/2.svg`, h2.onerror = () => h2.src = `${o}/2.svg`;
2051
- break;
2052
- case 3:
2053
- h2.src = `${t3}/6.svg`, h2.onerror = () => h2.src = `${o}/6.svg`;
2054
- break;
2055
- case 4:
2056
- h2.src = `${t3}/9.svg`, h2.onerror = () => h2.src = `${o}/9.svg`;
2057
- break;
2058
- case 5:
2059
- h2.src = `${t3}/10.svg`, h2.onerror = () => h2.src = `${o}/10.svg`;
2060
- }
2061
- else {
2062
- const i3 = Math.round(10 / (p - m) * (e4 - m));
2063
- h2.src = `${t3}/${i3}.svg`, h2.onerror = () => h2.src = `${o}/${i3}.svg`;
2064
- }
2065
- const f = document.createElement("input");
2066
- f.id = `rating-${s}-${e4}`, f.type = "radio", f.name = s, f.value = e4.toString(), f.classList.add(c), f.classList.add("magicfeedback-input"), (0, r.autoAdvanceOn)(f, i2), a && a === f.value && (f.checked = true), l2.appendChild(f), l2.appendChild(h2), l2.appendChild(d2), n2.appendChild(l2), u.appendChild(n2);
2067
- }
2068
- if ((null == l ? void 0 : l.extraOption) && (null == l ? void 0 : l.extraOptionText)) {
2069
- const e4 = document.createElement("div");
2070
- e4.classList.add("magicfeedback-rating-option");
2071
- const t4 = document.createElement("label");
2072
- t4.htmlFor = `rating-${s}-extra`, t4.classList.add("magicfeedback-rating-option-label-container");
2073
- const n2 = document.createElement("label");
2074
- n2.htmlFor = `rating-${s}-extra`, n2.textContent = null == l ? void 0 : l.extraOptionText;
2075
- const o2 = document.createElement("img");
2076
- o2.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", o2.alt = `face-${s}-extra`, o2.className = "magicfeedback-rating-image-extra";
2077
- const a2 = document.createElement("input");
2078
- a2.id = `rating-${s}-extra`, a2.type = "radio", a2.name = s, a2.value = "-", a2.classList.add(c), a2.classList.add("magicfeedback-input"), (0, r.autoAdvanceOn)(a2, i2), t4.appendChild(a2), t4.appendChild(o2), t4.appendChild(n2), e4.appendChild(t4), u.appendChild(e4);
2079
- }
2080
- return h.childElementCount > 0 && u.appendChild(h), d.appendChild(u), { element: d, elementTypeClass: c };
2081
- };
2082
- }, 2255: (e2, t2, i) => {
2083
- "use strict";
2084
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingNumber = void 0;
2085
- const n = i(2709);
2086
- t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2, send: r, urlParamValue: o, language: a, isPhone: s, productId: l }) => {
2087
- const d = "magicfeedback-rating-number";
2088
- return { element: (0, n.createRatingNumberElement)(e3.ref, e3.assets, t3, i2, d, r, o, a, { legacy: (0, n.usesLegacyRatingNumber)(l), isPhone: s }), elementTypeClass: d };
2089
- };
2090
- }, 1042: (e2, t2, i) => {
2091
- "use strict";
2092
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingStar = void 0;
2093
- const n = i(2709);
2094
- t2.renderRatingStar = ({ question: e3, send: t3, urlParamValue: i2 }) => {
2095
- var r, o;
2096
- const a = document.createElement("div"), s = (0, n.createStarRating)(e3.ref, null === (r = e3.assets) || void 0 === r ? void 0 : r.minPlaceholder, null === (o = e3.assets) || void 0 === o ? void 0 : o.maxPlaceholder, t3, i2);
2097
- return a.appendChild(s), { element: a, elementTypeClass: "magicfeedback-rating-star" };
2098
- };
2099
- }, 2311: (e2, t2, i) => {
2100
- "use strict";
2101
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderSelect = void 0;
2102
- const n = i(1366), r = i(7627);
2103
- t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: o }) => {
2104
- const { title: a, value: s, defaultValue: l } = e3, d = document.createElement("select"), c = document.createElement("option");
2105
- return c.value = "", c.text = "slim" === t3 ? (0, n.parseTitle)(a, i2) : l || (0, r.t)(i2, "select.placeholder"), c.disabled = true, c.selected = true, d.appendChild(c), s.forEach(((e4) => {
2106
- const t4 = document.createElement("option");
2107
- t4.value = e4, t4.text = e4, d.appendChild(t4);
2108
- })), o && s.includes(o) && (d.value = o), { element: d, elementTypeClass: "magicfeedback-select" };
2109
- };
2110
- }, 8924: (e2, t2, i) => {
2111
- "use strict";
2112
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderText = void 0;
2113
- const n = i(3262);
2114
- t2.renderText = ({ language: e3, placeholderText: t3, urlParamValue: i2, send: r }) => {
2115
- const o = document.createElement("input");
2116
- return o.type = "text", o.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (o.value = i2), o.addEventListener("keyup", ((e4) => {
2117
- e4.preventDefault(), "Enter" === e4.key && r && r();
2118
- })), { element: o, elementTypeClass: "magicfeedback-text" };
2119
- };
2120
- }, 1724: (e2, t2, i) => {
2121
- "use strict";
2122
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadFile = void 0;
2123
- const n = i(8129);
2124
- t2.renderUploadFile = ({ question: e3, language: t3 }) => (0, n.createUploadControl)(e3, t3, "file");
2125
- }, 9169: (e2, t2, i) => {
2126
- "use strict";
2127
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadImage = void 0;
2128
- const n = i(8129);
2129
- t2.renderUploadImage = ({ question: e3, language: t3 }) => (0, n.createUploadControl)(e3, t3, "image");
2130
- }, 8129: function(e2, t2, i) {
2131
- "use strict";
2132
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
2133
- return new (i2 || (i2 = Promise))((function(r2, o2) {
2134
- function a2(e4) {
2135
- try {
2136
- l2(n2.next(e4));
2137
- } catch (e5) {
2138
- o2(e5);
2139
- }
2140
- }
2141
- function s2(e4) {
2142
- try {
2143
- l2(n2.throw(e4));
2144
- } catch (e5) {
2145
- o2(e5);
2146
- }
2147
- }
2148
- function l2(e4) {
2149
- var t4;
2150
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
2151
- e5(t4);
2152
- }))).then(a2, s2);
2153
- }
2154
- l2((n2 = n2.apply(e3, t3 || [])).next());
2155
- }));
2156
- };
2157
- Object.defineProperty(t2, "__esModule", { value: true }), t2.createUploadControl = t2.awaitUploadReady = t2.getUploadValues = t2.formatFileSize = void 0;
2158
- const r = i(3262), o = i(1366), a = "__mfUploadValues", s = "__mfUploadReady";
2159
- function l(e3) {
2160
- if ("number" != typeof e3 || isNaN(e3)) return "";
2161
- if (e3 < 1024) return `${e3} B`;
2162
- const t3 = e3 / 1024;
2163
- if (t3 < 1024) return `${t3 < 10 ? t3.toFixed(1) : Math.round(t3)} KB`;
2164
- const i2 = t3 / 1024;
2165
- return `${i2 < 10 ? i2.toFixed(1) : Math.round(i2)} MB`;
2166
- }
2167
- t2.formatFileSize = l, t2.getUploadValues = function(e3) {
2168
- const t3 = e3[a];
2169
- return Array.isArray(t3) ? t3 : [];
2170
- }, t2.awaitUploadReady = function(e3) {
2171
- return n(this, void 0, void 0, (function* () {
2172
- if (!e3) return;
2173
- const t3 = Array.from(e3.querySelectorAll(".magicfeedback-upload-native"));
2174
- yield Promise.all(t3.map(((e4) => e4[s])).filter(Boolean));
2175
- }));
2176
- }, t2.createUploadControl = function(e3, t3, i2) {
2177
- const { ref: n2, require: d, title: c, assets: u } = e3, p = "image" === i2 ? "magicfeedback-upload-image" : "magicfeedback-upload-file", m = (null == u ? void 0 : u.multiple) || false, h = m ? (null == u ? void 0 : u.maxFiles) || 0 : 1, f = Number(null == u ? void 0 : u.maxFileSize) > 0 ? Number(null == u ? void 0 : u.maxFileSize) : 0, g = 1024 * f * 1024, y = document.createElement("div");
2178
- y.classList.add("magicfeedback-upload");
2179
- const v = document.createElement("input");
2180
- v.type = "file", "image" === i2 && (v.accept = "image/*"), v.multiple = m, v.required = d, v.name = n2, v.id = `magicfeedback-upload-input-${n2}`, v.classList.add(p), v.classList.add("magicfeedback-input"), v.classList.add("magicfeedback-upload-native"), v[a] = [], v[s] = Promise.resolve();
2181
- const b = (0, o.parseTitle)(c, t3);
2182
- b && v.setAttribute("aria-label", b);
2183
- const E = document.createElement("div");
2184
- E.classList.add("magicfeedback-upload-dropzone");
2185
- const A = document.createElement("span");
2186
- A.classList.add("magicfeedback-upload-icon"), A.innerHTML = "image" === i2 ? '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>' : '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 16l-4-4-4 4"/><path d="M12 12v9"/><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"/></svg>';
2187
- const k = document.createElement("span");
2188
- k.classList.add("magicfeedback-upload-cta"), k.textContent = r.placeholder.upload.cta(t3);
2189
- const T = document.createElement("span");
2190
- T.classList.add("magicfeedback-upload-hint"), T.textContent = (function(e4, t4, i3, n3, o2) {
2191
- const a2 = [r.placeholder.upload.formats(e4, t4)];
2192
- return i3 && n3 > 0 && a2.push(r.placeholder.upload.maxFiles(e4, n3)), o2 > 0 && a2.push(r.placeholder.upload.maxSize(e4, o2)), a2.filter(Boolean).join(" \xB7 ");
2193
- })(t3, i2, m, h, f), E.appendChild(v), E.appendChild(A), E.appendChild(k), E.appendChild(T);
2194
- const C = document.createElement("div");
2195
- C.classList.add("magicfeedback-upload-error");
2196
- const P = document.createElement("ul");
2197
- P.classList.add("magicfeedback-upload-list"), y.appendChild(E), y.appendChild(C), y.appendChild(P);
2198
- const w = /* @__PURE__ */ new WeakMap(), x = (e4) => {
2199
- const t4 = w.get(e4);
2200
- return t4 ? Promise.resolve(t4) : new Promise(((t5) => {
2201
- const i3 = new FileReader(), n3 = (i4) => {
2202
- const n4 = JSON.stringify({ name: e4.name, type: e4.type, size: e4.size, content: i4 });
2203
- w.set(e4, n4), t5(n4);
2204
- };
2205
- i3.onload = () => n3("string" == typeof i3.result ? i3.result : ""), i3.onerror = () => n3(""), i3.readAsDataURL(e4);
2206
- }));
2207
- }, S = [], O = (e4) => {
2208
- try {
2209
- const t4 = h > 0 ? e4.slice(0, h) : e4, i3 = new DataTransfer();
2210
- t4.forEach(((e5) => i3.items.add(e5))), v.files = i3.files;
2211
- } catch (e5) {
2212
- }
2213
- !(function() {
2214
- S.forEach(((e6) => URL.revokeObjectURL(e6))), S.length = 0, P.innerHTML = "";
2215
- const e5 = Array.from(v.files || []);
2216
- y.classList.toggle("magicfeedback-upload--has-files", e5.length > 0), e5.forEach(((e6, n3) => {
2217
- const o2 = document.createElement("li");
2218
- o2.classList.add("magicfeedback-upload-file-item");
2219
- const a2 = document.createElement("span");
2220
- if (a2.classList.add("magicfeedback-upload-thumb"), "image" === i2 && e6.type.startsWith("image/")) {
2221
- const t4 = URL.createObjectURL(e6);
2222
- S.push(t4);
2223
- const i3 = document.createElement("img");
2224
- i3.src = t4, i3.alt = e6.name, a2.appendChild(i3);
2225
- } else a2.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/></svg>';
2226
- const s2 = document.createElement("span");
2227
- s2.classList.add("magicfeedback-upload-file-info");
2228
- const d2 = document.createElement("span");
2229
- d2.classList.add("magicfeedback-upload-file-name"), d2.textContent = e6.name, d2.title = e6.name;
2230
- const c2 = document.createElement("span");
2231
- c2.classList.add("magicfeedback-upload-file-size"), c2.textContent = l(e6.size), s2.appendChild(d2), s2.appendChild(c2);
2232
- const u2 = document.createElement("button");
2233
- u2.type = "button", u2.classList.add("magicfeedback-upload-remove"), u2.setAttribute("aria-label", `${r.placeholder.upload.remove(t3)}: ${e6.name}`), u2.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', u2.addEventListener("click", ((e7) => {
2234
- e7.preventDefault(), e7.stopPropagation(), O(Array.from(v.files || []).filter(((e8, t4) => t4 !== n3)));
2235
- })), o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(u2), P.appendChild(o2);
2236
- }));
2237
- })(), (() => {
2238
- const e5 = Array.from(v.files || []), t4 = Promise.all(e5.map(x)).then(((e6) => {
2239
- v[a] = e6;
2240
- }));
2241
- v[s] = t4;
2242
- })();
2243
- }, L = (e4) => {
2244
- if (!e4.length) return C.textContent = "", void C.classList.remove("is-visible");
2245
- const i3 = e4.map(((e5) => e5.name)).join(", ");
2246
- C.textContent = `${r.placeholder.upload.tooLarge(t3, f)}: ${i3}`, C.classList.add("is-visible");
2247
- }, N = (e4) => {
2248
- if (!g) return { accepted: e4, rejected: [] };
2249
- const t4 = [], i3 = [];
2250
- return e4.forEach(((e5) => (e5.size <= g ? t4 : i3).push(e5))), { accepted: t4, rejected: i3 };
2251
- };
2252
- v.addEventListener("change", (() => {
2253
- const { accepted: e4, rejected: t4 } = N(Array.from(v.files || []));
2254
- L(t4), O(e4);
2255
- }));
2256
- const I = (e4) => {
2257
- e4.preventDefault(), e4.stopPropagation();
2258
- };
2259
- return ["dragenter", "dragover"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
2260
- I(e5), E.classList.add("is-dragover");
2261
- })))), ["dragleave", "dragend"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
2262
- I(e5), E.classList.remove("is-dragover");
2263
- })))), E.addEventListener("drop", ((e4) => {
2264
- I(e4), E.classList.remove("is-dragover");
2265
- const t4 = e4.dataTransfer;
2266
- let n3 = t4 ? Array.from(t4.files) : [];
2267
- if ("image" === i2 && (n3 = n3.filter(((e5) => e5.type.startsWith("image/")))), !n3.length) return;
2268
- const { accepted: r2, rejected: o2 } = N(n3);
2269
- if (L(o2), !r2.length) return;
2270
- const a2 = m ? Array.from(v.files || []) : [];
2271
- O(a2.concat(r2));
2272
- })), { element: y, elementTypeClass: p };
2273
- };
2274
- }, 4759: function(e2, t2, i) {
2275
- "use strict";
2276
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
2277
- return new (i2 || (i2 = Promise))((function(r2, o2) {
2278
- function a2(e4) {
2279
- try {
2280
- l2(n2.next(e4));
2281
- } catch (e5) {
2282
- o2(e5);
2283
- }
2284
- }
2285
- function s2(e4) {
2286
- try {
2287
- l2(n2.throw(e4));
2288
- } catch (e5) {
2289
- o2(e5);
2290
- }
2291
- }
2292
- function l2(e4) {
2293
- var t4;
2294
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
2295
- e5(t4);
2296
- }))).then(a2, s2);
2297
- }
2298
- l2((n2 = n2.apply(e3, t3 || [])).next());
2299
- }));
2300
- }, r = this && this.__importDefault || function(e3) {
2301
- return e3 && e3.__esModule ? e3 : { default: e3 };
2302
- };
2303
- Object.defineProperty(t2, "__esModule", { value: true }), t2.nextAgentTurn = t2.startAgentSurvey = void 0;
2304
- const o = r(i(6539)), a = i(9071), s = i(5407), l = i(3501);
2305
- function d(e3, t3, i2, r2, s2) {
2306
- var d2;
2307
- return n(this, void 0, void 0, (function* () {
2308
- let n2;
2309
- try {
2310
- n2 = yield (0, o.default)(e3 + t3, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, a.header), body: JSON.stringify(i2) });
2311
- } catch (e4) {
2312
- throw r2.err(`[agentSurvey/${s2}] network error`, e4), new l.AgentApiError("NETWORK", (null == e4 ? void 0 : e4.message) || "Network error");
2313
- }
2314
- if (!n2.ok) {
2315
- let e4 = null;
2316
- try {
2317
- e4 = yield n2.json();
2318
- } catch (e5) {
2319
- }
2320
- const t4 = (0, l.mapAgentStatus)(n2.status, s2);
2321
- throw r2.err(`[agentSurvey/${s2}] ${n2.status}`, e4), new l.AgentApiError(t4, (null === (d2 = null == e4 ? void 0 : e4.error) || void 0 === d2 ? void 0 : d2.message) || (null == e4 ? void 0 : e4.message) || n2.statusText, n2.status, "RATE_LIMITED" === t4 ? (function(e5) {
2322
- var t5, i3;
2323
- const n3 = null === (i3 = null === (t5 = null == e5 ? void 0 : e5.headers) || void 0 === t5 ? void 0 : t5.get) || void 0 === i3 ? void 0 : i3.call(t5, "Retry-After"), r3 = n3 ? Number(n3) : NaN;
2324
- return Number.isFinite(r3) && r3 > 0 ? 1e3 * r3 : 6e4;
2325
- })(n2) : void 0, e4);
2326
- }
2327
- try {
2328
- const e4 = yield n2.json();
2329
- return r2.log(`[agentSurvey/${s2}] ok`, e4), e4;
2330
- } catch (e4) {
2331
- throw new l.AgentApiError("MALFORMED", "Unreadable response body", n2.status);
2332
- }
2333
- }));
2334
- }
2335
- t2.startAgentSurvey = function(e3, t3, i2) {
2336
- return d(e3, s.endpoints.sdk.agentSurveyStart, t3, i2, "start");
2337
- }, t2.nextAgentTurn = function(e3, t3, i2) {
2338
- return d(e3, s.endpoints.sdk.agentSurveyNext, t3, i2, "next");
2339
- };
2340
- }, 3501: (e2, t2) => {
2341
- "use strict";
2342
- Object.defineProperty(t2, "__esModule", { value: true }), t2.mapAgentStatus = t2.AgentApiError = void 0;
2343
- class i extends Error {
2344
- constructor(e3, t3, n, r, o) {
2345
- super(t3), this.kind = e3, this.status = n, this.retryAfterMs = r, this.body = o, this.name = "AgentApiError", Object.setPrototypeOf(this, i.prototype);
2346
- }
2347
- get retryable() {
2348
- return "RATE_LIMITED" === this.kind || "AI_UNAVAILABLE" === this.kind || "NETWORK" === this.kind;
2349
- }
2350
- }
2351
- t2.AgentApiError = i, t2.mapAgentStatus = function(e3, t3) {
2352
- return 429 === e3 ? "RATE_LIMITED" : 406 === e3 || 401 === e3 || 403 === e3 ? "AUTH" : 404 === e3 ? "NOT_FOUND" : 400 === e3 || 422 === e3 ? "BAD_CONFIG" : e3 >= 500 ? "start" === t3 ? "AI_UNAVAILABLE" : "NETWORK" : "MALFORMED";
2353
- };
2354
- }, 1351: (e2, t2, i) => {
2355
- "use strict";
2356
- Object.defineProperty(t2, "__esModule", { value: true }), t2.encodeAnswer = t2.toAgentStep = t2.ratingBounds = t2.mapAgentType = t2.DEFAULT_ANSWER_DELIMITER = void 0;
2357
- const n = i(4760), r = i(1366);
2358
- t2.DEFAULT_ANSWER_DELIMITER = ", ";
2359
- const o = [n.FEEDBACKAPPANSWERTYPE.RADIO, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, n.FEEDBACKAPPANSWERTYPE.SELECT, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE], a = Object.values(n.FEEDBACKAPPANSWERTYPE);
2360
- function s(e3, t3, i2) {
2361
- var s2, l2, d2;
2362
- const c2 = String(e3 || "").trim().toUpperCase();
2363
- return "RATING" === c2 ? n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER : c2 === n.FEEDBACKAPPANSWERTYPE.CONTACT ? (null === (s2 = i2.log) || void 0 === s2 || s2.log("[agentSurvey] CONTACT has no renderer, falling back to TEXT"), n.FEEDBACKAPPANSWERTYPE.TEXT) : a.includes(c2) ? o.includes(c2) && 0 === t3.length ? (null === (d2 = i2.log) || void 0 === d2 || d2.err(`[agentSurvey] ${c2} arrived with no options, falling back to TEXT`), n.FEEDBACKAPPANSWERTYPE.TEXT) : c2 !== n.FEEDBACKAPPANSWERTYPE.BOOLEAN || 2 !== t3.length || (function(e4, t4) {
2364
- if (2 !== e4.length) return false;
2365
- const i3 = e4.map(((e5) => String(e5).trim().toLowerCase())), n2 = (0, r.getBooleanOptions)(t4).map(((e5) => e5.toLowerCase())), o2 = ["yes", "no"];
2366
- return i3[0] === o2[0] && i3[1] === o2[1] || i3[0] === n2[0] && i3[1] === n2[1];
2367
- })(t3, i2.language) ? c2 : n.FEEDBACKAPPANSWERTYPE.RADIO : (null === (l2 = i2.log) || void 0 === l2 || l2.err(`[agentSurvey] unknown question type "${e3}", falling back to TEXT`), n.FEEDBACKAPPANSWERTYPE.TEXT);
2368
- }
2369
- function l(e3) {
2370
- const t3 = e3.map(Number).filter(((e4) => Number.isFinite(e4)));
2371
- return t3.length >= 2 ? { min: Math.min(...t3), max: Math.max(...t3) } : { min: 1, max: 5 };
2372
- }
2373
- function d(e3, t3, i2) {
2374
- const r2 = { randomPosition: false, direction: "row", order: "ltr" };
2375
- return e3 !== n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER && e3 !== n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI || Object.assign(r2, l(t3)), e3 === n.FEEDBACKAPPANSWERTYPE.LONGTEXT && (r2.maxCharacters = 0), Object.assign(Object.assign({}, r2), (null == i2 ? void 0 : i2.assets) || {});
2376
- }
2377
- function c(e3, t3, i2) {
2378
- var n2, r2, o2, a2;
2379
- const { full: l2, title: c2 } = t3, u = [...null !== (r2 = null !== (n2 = e3.questionValues) && void 0 !== n2 ? n2 : null == l2 ? void 0 : l2.value) && void 0 !== r2 ? r2 : []], p = s(null !== (o2 = null == l2 ? void 0 : l2.type) && void 0 !== o2 ? o2 : e3.questionType, u, i2), m = e3.questionRef || (null == l2 ? void 0 : l2.ref) || `agent-q-${e3.currentTurn}`;
2380
- return { id: (null == l2 ? void 0 : l2.id) || `agent-${i2.sessionId}-${e3.currentTurn}`, title: c2 || "", type: p, questionType: { conf: null }, ref: m, require: null === (a2 = null == l2 ? void 0 : l2.require) || void 0 === a2 || a2, external_id: (null == l2 ? void 0 : l2.external_id) || "", value: u, defaultValue: (null == l2 ? void 0 : l2.defaultValue) || "", followup: false, position: e3.currentTurn, assets: d(p, u, l2), refMetric: (null == l2 ? void 0 : l2.refMetric) || "", integrationId: i2.integrationId, integrationPageId: "", status: "ACTIVE" };
2381
- }
2382
- t2.mapAgentType = s, t2.ratingBounds = l, t2.toAgentStep = function(e3, t3) {
2383
- var i2, r2, o2;
2384
- const a2 = e3, s2 = e3.currentTurn, l2 = e3.maxTurns, d2 = a2.coverageSummary, u = (e4) => ({ kind: "END", reason: e4, currentTurn: s2, maxTurns: l2, coverageSummary: d2 });
2385
- if (a2.answerType === n.AGENT_ANSWER_TYPE_BLOCKED) return u("BLOCKED");
2386
- if (true === a2.shouldEnd) return u("SHOULD_END");
2387
- const p = (function(e4) {
2388
- const t4 = e4.question && "object" == typeof e4.question ? e4.question : e4.nextQuestion && "object" == typeof e4.nextQuestion ? e4.nextQuestion : null;
2389
- if (t4) {
2390
- const e5 = t4, i3 = e5.title;
2391
- return { full: e5, title: "string" == typeof i3 ? i3 : i3 ? JSON.stringify(i3) : null };
2392
- }
2393
- return { full: null, title: "string" == typeof e4.nextQuestion ? e4.nextQuestion : null };
2394
- })(e3);
2395
- return "NONE" === String(null !== (o2 = null !== (r2 = null === (i2 = p.full) || void 0 === i2 ? void 0 : i2.type) && void 0 !== r2 ? r2 : e3.questionType) && void 0 !== o2 ? o2 : "").trim().toUpperCase() ? u("TYPE_NONE") : p.title && p.title.trim() ? { kind: "QUESTION", question: c(e3, p, t3), isFromBase: true === e3.isFromBase, currentTurn: s2, maxTurns: l2, topic: a2.topic, coverageGaps: e3.coverageGaps, coverageSummary: d2 } : u("NO_QUESTION");
2396
- }, t2.encodeAnswer = function(e3, i2, n2 = t2.DEFAULT_ANSWER_DELIMITER) {
2397
- const r2 = i2.ref, o2 = (e4) => e4.flatMap(((e5) => Array.isArray(e5.value) ? e5.value : [e5.value])).map(((e5) => "string" == typeof e5 ? e5 : JSON.stringify(e5))).map(((e5) => (e5 || "").trim())).filter(((e5) => "" !== e5)), a2 = o2(e3.filter(((e4) => e4.key === r2))), s2 = o2(e3.filter(((e4) => e4.key === `extra-option-${r2}`)));
2398
- return [a2.filter(((e4, t3) => a2.indexOf(e4) === t3)).join(n2), s2.join(n2)].filter(((e4) => "" !== e4)).join(n2);
2399
- };
2400
- }, 5349: (e2, t2, i) => {
2401
- "use strict";
2402
- Object.defineProperty(t2, "__esModule", { value: true }), t2.scrapeInputs = void 0;
2403
- const n = i(8129);
2404
- t2.scrapeInputs = function(e3) {
2405
- const t3 = e3.querySelectorAll(".magicfeedback-input"), i2 = [], r = {};
2406
- return t3.forEach(((e4) => {
2407
- var t4;
2408
- const o = e4, a = o.name;
2409
- if (!a) return;
2410
- const s = o.type;
2411
- if (("radio" === s || "checkbox" === s) && !o.checked) return;
2412
- const l = o.value, d = o.classList[0];
2413
- if ((null == d ? void 0 : d.includes("magicfeedback-priority-list")) || (null === (t4 = o.id) || void 0 === t4 ? void 0 : t4.startsWith("priority-list-"))) return r[a] || (r[a] = []), void r[a].push(l);
2414
- if (null == d ? void 0 : d.includes("magicfeedback-upload")) {
2415
- const e5 = (0, n.getUploadValues)(o);
2416
- return void (e5.length && i2.push({ key: a, value: e5 }));
2417
- }
2418
- const c = "magicfeedback-consent" === d ? o.checked.toString() : l;
2419
- null != c && i2.push({ key: a, value: [c] });
2420
- })), Object.entries(r).forEach((([e4, t4]) => {
2421
- const n2 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
2422
- i2.push({ key: e4, value: n2 });
2423
- })), i2;
2424
- };
2425
- }, 7627: (e2, t2) => {
2426
- "use strict";
2427
- Object.defineProperty(t2, "__esModule", { value: true }), t2.t = t2.isLanguageSupported = t2.isRtlLanguage = t2.hasOwnTranslation = t2.TRANSLATION_KEYS = t2.normalizeLanguage = t2.RTL_LANGUAGES = t2.AVAILABLE_LANGUAGES = t2.SUPPORTED_LANGUAGES = void 0;
2428
- const i = { "placeholder.answer": "Write your answer here...", "placeholder.number": "Write your number here...", "placeholder.email": "Write your email here...", "placeholder.date": "Write your date here...", "placeholder.password": "Write your password here...", "pointSystem.error": "The total points must be 100 %", "boolean.yes": "Yes", "boolean.no": "No", "upload.cta": "Drag & drop or click to upload", "upload.imagesOnly": "Images only", "upload.anyFileType": "Any file type", "upload.maxFiles": "Max {n} files", "upload.maxSize": "Max {mb} MB", "upload.tooLarge": "File is too large (max {mb} MB)", "upload.remove": "Remove", "select.placeholder": "Select an option", "rating.ariaLabel": "Rating", "maxDiff.best": "Most important", "maxDiff.worst": "Least important", "maxDiff.setProgress": "Block {k} of {n}", "priority.selectUpTo": "Select up to", "priority.options": "options", "priority.thenOrder": "and then order them", "priority.selectOptions": "Select options", "priority.cancel": "Cancel", "priority.confirm": "Confirm", "priority.selectOptionNumber": "Select option #", "priority.prioritized": "Prioritized", "priority.of": "of", "priority.instruction": "Your priority list can be seen below. If you wish, you can rearrange your choices using the arrows. Click 'Next' to confirm your selection and proceed.", "action.send": "Send", "action.back": "Back", "action.next": "Next", "action.start": "Go!", "message.success": "Thank you for your feedback!", "message.blocked": "Thanks for your time - we'll end the conversation here.", "message.required": "Please answer before continuing.", "message.rateLimit": "Too many requests. Retrying in {seconds}s..." }, n = { en: i, es: { "placeholder.answer": "Escribe tu respuesta aqu\xED...", "placeholder.number": "Escribe tu n\xFAmero aqu\xED...", "placeholder.email": "Escribe tu correo electr\xF3nico aqu\xED...", "placeholder.date": "Escribe tu fecha aqu\xED...", "placeholder.password": "Escribe tu contrase\xF1a aqu\xED...", "pointSystem.error": "El total de puntos debe ser 100 %", "boolean.yes": "S\xED", "boolean.no": "No", "upload.cta": "Arrastra y suelta o haz clic para subir", "upload.imagesOnly": "Solo im\xE1genes", "upload.anyFileType": "Cualquier tipo de archivo", "upload.maxFiles": "M\xE1x. {n} archivos", "upload.maxSize": "M\xE1x. {mb} MB", "upload.tooLarge": "Archivo demasiado grande (m\xE1x. {mb} MB)", "upload.remove": "Eliminar", "select.placeholder": "Selecciona una opci\xF3n", "rating.ariaLabel": "Valoraci\xF3n", "maxDiff.best": "M\xE1s importante", "maxDiff.worst": "Menos importante", "maxDiff.setProgress": "Bloque {k} de {n}", "priority.selectUpTo": "Selecciona hasta", "priority.options": "opciones", "priority.thenOrder": "y luego ord\xE9nalas", "priority.selectOptions": "Seleccionar opciones", "priority.cancel": "Cancelar", "priority.confirm": "Confirmar", "priority.selectOptionNumber": "Selecciona la opci\xF3n #", "priority.prioritized": "Priorizadas", "priority.of": "de", "priority.instruction": 'Tu lista priorizada se muestra abajo. Si deseas, puedes reordenar las opciones con las flechas. Haz clic en "Siguiente" para confirmar y continuar.', "action.send": "Enviar", "action.back": "Atr\xE1s", "action.next": "Siguiente", "action.start": "\xA1Empezar!", "message.success": "\xA1Gracias por tus comentarios!", "message.blocked": "Gracias por tu tiempo, terminamos aqu\xED la conversaci\xF3n.", "message.required": "Por favor, responde antes de continuar.", "message.rateLimit": "Demasiadas solicitudes. Reintentando en {seconds} s..." }, de: { "placeholder.answer": "Schreiben Sie hier Ihre Antwort...", "placeholder.number": "Geben Sie hier Ihre Zahl ein...", "placeholder.email": "Geben Sie hier Ihre E-Mail-Adresse ein...", "placeholder.date": "Geben Sie hier Ihr Datum ein...", "placeholder.password": "Geben Sie hier Ihr Passwort ein...", "pointSystem.error": "Die Gesamtpunktzahl muss 100 % betragen", "boolean.yes": "Ja", "boolean.no": "Nein", "upload.cta": "Ziehen Sie Dateien hierher oder klicken Sie zum Hochladen", "upload.imagesOnly": "Nur Bilder", "upload.anyFileType": "Beliebiger Dateityp", "upload.maxFiles": "Max. {n} Dateien", "upload.maxSize": "Max. {mb} MB", "upload.tooLarge": "Datei ist zu gro\xDF (max. {mb} MB)", "upload.remove": "Entfernen", "select.placeholder": "Option ausw\xE4hlen", "rating.ariaLabel": "Bewertung", "maxDiff.best": "Am wichtigsten", "maxDiff.worst": "Am wenigsten wichtig", "maxDiff.setProgress": "Block {k} von {n}", "priority.selectUpTo": "W\xE4hlen Sie bis zu", "priority.options": "Optionen", "priority.thenOrder": "und ordnen Sie sie dann", "priority.selectOptions": "Optionen ausw\xE4hlen", "priority.cancel": "Abbrechen", "priority.confirm": "Best\xE4tigen", "priority.selectOptionNumber": "W\xE4hlen Sie Option #", "priority.prioritized": "Priorisiert", "priority.of": "von", "priority.instruction": 'Ihre Priorit\xE4tenliste wird unten angezeigt. Wenn Sie m\xF6chten, k\xF6nnen Sie Ihre Auswahl mit den Pfeilen neu anordnen. Klicken Sie auf "Weiter", um Ihre Auswahl zu best\xE4tigen und fortzufahren.', "action.send": "Senden", "action.back": "Zur\xFCck", "action.next": "Weiter", "action.start": "Los!", "message.success": "Vielen Dank f\xFCr Ihr Feedback!", "message.blocked": "Danke f\xFCr Ihre Zeit - wir beenden das Gespr\xE4ch hier.", "message.required": "Bitte antworten Sie, bevor Sie fortfahren.", "message.rateLimit": "Zu viele Anfragen. Erneuter Versuch in {seconds} s..." }, fr: { "placeholder.answer": "\xC9crivez votre r\xE9ponse ici...", "placeholder.number": "\xC9crivez votre nombre ici...", "placeholder.email": "\xC9crivez votre e-mail ici...", "placeholder.date": "\xC9crivez votre date ici...", "placeholder.password": "\xC9crivez votre mot de passe ici...", "pointSystem.error": "Le total des points doit \xEAtre de 100 %", "boolean.yes": "Oui", "boolean.no": "Non", "upload.cta": "Glissez-d\xE9posez ou cliquez pour t\xE9l\xE9verser", "upload.imagesOnly": "Images uniquement", "upload.anyFileType": "Tout type de fichier", "upload.maxFiles": "Max. {n} fichiers", "upload.maxSize": "Max. {mb} Mo", "upload.tooLarge": "Fichier trop volumineux (max. {mb} Mo)", "upload.remove": "Supprimer", "select.placeholder": "S\xE9lectionnez une option", "rating.ariaLabel": "\xC9valuation", "maxDiff.best": "Le plus important", "maxDiff.worst": "Le moins important", "maxDiff.setProgress": "Bloc {k} sur {n}", "priority.selectUpTo": "S\xE9lectionnez jusqu'\xE0", "priority.options": "options", "priority.thenOrder": "puis classez-les", "priority.selectOptions": "S\xE9lectionner des options", "priority.cancel": "Annuler", "priority.confirm": "Confirmer", "priority.selectOptionNumber": "S\xE9lectionnez l'option #", "priority.prioritized": "Prioris\xE9es", "priority.of": "sur", "priority.instruction": `Votre liste de priorit\xE9s est affich\xE9e ci-dessous. Si vous le souhaitez, vous pouvez r\xE9organiser vos choix \xE0 l'aide des fl\xE8ches. Cliquez sur "Suivant" pour confirmer votre s\xE9lection et continuer.`, "action.send": "Envoyer", "action.back": "Retour", "action.next": "Suivant", "action.start": "C'est parti !", "message.success": "Merci pour votre retour !", "message.blocked": "Merci pour votre temps, nous terminons la conversation ici.", "message.required": "Veuillez r\xE9pondre avant de continuer.", "message.rateLimit": "Trop de requ\xEAtes. Nouvelle tentative dans {seconds} s..." }, pt: { "placeholder.answer": "Escreva sua resposta aqui...", "placeholder.number": "Escreva seu n\xFAmero aqui...", "placeholder.email": "Escreva seu e-mail aqui...", "placeholder.date": "Escreva sua data aqui...", "placeholder.password": "Escreva sua senha aqui...", "pointSystem.error": "O total de pontos deve ser 100 %", "boolean.yes": "Sim", "boolean.no": "N\xE3o", "upload.cta": "Arraste e solte ou clique para enviar", "upload.imagesOnly": "Somente imagens", "upload.anyFileType": "Qualquer tipo de arquivo", "upload.maxFiles": "M\xE1x. {n} arquivos", "upload.maxSize": "M\xE1x. {mb} MB", "upload.tooLarge": "Arquivo muito grande (m\xE1x. {mb} MB)", "upload.remove": "Remover", "select.placeholder": "Selecione uma op\xE7\xE3o", "rating.ariaLabel": "Avalia\xE7\xE3o", "maxDiff.best": "Mais importante", "maxDiff.worst": "Menos importante", "maxDiff.setProgress": "Bloco {k} de {n}", "priority.selectUpTo": "Selecione at\xE9", "priority.options": "op\xE7\xF5es", "priority.thenOrder": "e depois ordene-as", "priority.selectOptions": "Selecionar op\xE7\xF5es", "priority.cancel": "Cancelar", "priority.confirm": "Confirmar", "priority.selectOptionNumber": "Selecione a op\xE7\xE3o #", "priority.prioritized": "Priorizadas", "priority.of": "de", "priority.instruction": 'Sua lista de prioridades pode ser vista abaixo. Se quiser, voc\xEA pode reorganizar suas escolhas usando as setas. Clique em "Pr\xF3ximo" para confirmar sua sele\xE7\xE3o e continuar.', "action.send": "Enviar", "action.back": "Voltar", "action.next": "Pr\xF3ximo", "action.start": "Come\xE7ar!", "message.success": "Obrigado pelo seu feedback!", "message.blocked": "Obrigado pelo seu tempo, encerramos a conversa por aqui.", "message.required": "Responda antes de continuar.", "message.rateLimit": "Muitas solicita\xE7\xF5es. Tentando novamente em {seconds} s..." }, da: { "placeholder.answer": "Skriv dit svar her...", "placeholder.number": "Skriv dit nummer her...", "placeholder.email": "Skriv din e-mail her...", "placeholder.date": "Skriv din dato her...", "placeholder.password": "Skriv dit kodeord her...", "pointSystem.error": "Samlet antal point skal v\xE6re 100 %", "boolean.yes": "Ja", "boolean.no": "Nej", "upload.cta": "Tr\xE6k og slip eller klik for at uploade", "upload.imagesOnly": "Kun billeder", "upload.anyFileType": "Enhver filtype", "upload.maxFiles": "Maks. {n} filer", "upload.maxSize": "Maks. {mb} MB", "upload.tooLarge": "Filen er for stor (maks. {mb} MB)", "upload.remove": "Fjern", "select.placeholder": "V\xE6lg en mulighed", "rating.ariaLabel": "Bed\xF8mmelse", "maxDiff.best": "Vigtigst", "maxDiff.worst": "Mindst vigtigt", "maxDiff.setProgress": "Blok {k} af {n}", "priority.selectUpTo": "V\xE6lg op til", "priority.options": "muligheder", "priority.thenOrder": "og sorter dem derefter", "priority.selectOptions": "V\xE6lg muligheder", "priority.cancel": "Annuller", "priority.confirm": "Bekr\xE6ft", "priority.selectOptionNumber": "V\xE6lg mulighed #", "priority.prioritized": "Prioriteret", "priority.of": "af", "priority.instruction": 'Din prioritetsliste vises nedenfor. Hvis du \xF8nsker det, kan du omarrangere dine valg ved hj\xE6lp af pilene. Klik p\xE5 "N\xE6ste" for at bekr\xE6fte dit valg og forts\xE6tte.', "action.send": "Send", "action.back": "Tilbage", "action.next": "N\xE6ste", "action.start": "Start!", "message.success": "Tak for din feedback!", "message.blocked": "Tak for din tid - vi afslutter samtalen her.", "message.required": "Svar venligst, f\xF8r du forts\xE6tter.", "message.rateLimit": "For mange foresp\xF8rgsler. Pr\xF8ver igen om {seconds} s..." }, fi: { "placeholder.answer": "Kirjoita vastauksesi t\xE4h\xE4n...", "placeholder.number": "Kirjoita numerosi t\xE4h\xE4n...", "placeholder.email": "Kirjoita s\xE4hk\xF6postiosoitteesi t\xE4h\xE4n...", "placeholder.date": "Kirjoita p\xE4iv\xE4m\xE4\xE4r\xE4si t\xE4h\xE4n...", "placeholder.password": "Kirjoita salasanasi t\xE4h\xE4n...", "pointSystem.error": "Kokonaispisteiden on oltava 100 %", "boolean.yes": "Kyll\xE4", "boolean.no": "Ei", "upload.cta": "Ved\xE4 ja pudota tai napsauta ladataksesi", "upload.imagesOnly": "Vain kuvat", "upload.anyFileType": "Mik\xE4 tahansa tiedostotyyppi", "upload.maxFiles": "Enint\xE4\xE4n {n} tiedostoa", "upload.maxSize": "Enint\xE4\xE4n {mb} MB", "upload.tooLarge": "Tiedosto on liian suuri (enint\xE4\xE4n {mb} MB)", "upload.remove": "Poista", "select.placeholder": "Valitse vaihtoehto", "rating.ariaLabel": "Arvio", "maxDiff.best": "T\xE4rkein", "maxDiff.worst": "V\xE4hiten t\xE4rke\xE4", "maxDiff.setProgress": "Osa {k}/{n}", "priority.selectUpTo": "Valitse enint\xE4\xE4n", "priority.options": "vaihtoehtoa", "priority.thenOrder": "ja j\xE4rjest\xE4 ne sitten", "priority.selectOptions": "Valitse vaihtoehdot", "priority.cancel": "Peruuta", "priority.confirm": "Vahvista", "priority.selectOptionNumber": "Valitse vaihtoehto #", "priority.prioritized": "Priorisoitu", "priority.of": " / ", "priority.instruction": 'Prioriteettilistasi n\xE4kyy alla. Voit halutessasi j\xE4rjest\xE4\xE4 valinnat uudelleen nuolien avulla. Napsauta "Seuraava" vahvistaaksesi valinnan ja jatkaaksesi.', "action.send": "L\xE4het\xE4", "action.back": "Takaisin", "action.next": "Seuraava", "action.start": "Aloita!", "message.success": "Kiitos palautteestasi!", "message.blocked": "Kiitos ajastasi - lopetamme keskustelun t\xE4h\xE4n.", "message.required": "Vastaa ennen jatkamista.", "message.rateLimit": "Liikaa pyynt\xF6j\xE4. Yritet\xE4\xE4n uudelleen {seconds} s kuluttua..." }, no: { "placeholder.answer": "Skriv svaret ditt her...", "placeholder.number": "Skriv nummeret ditt her...", "placeholder.email": "Skriv e-posten din her...", "placeholder.date": "Skriv datoen din her...", "placeholder.password": "Skriv passordet ditt her...", "pointSystem.error": "Totalt antall poeng m\xE5 v\xE6re 100 %", "boolean.yes": "Ja", "boolean.no": "Nei", "upload.cta": "Dra og slipp eller klikk for \xE5 laste opp", "upload.imagesOnly": "Kun bilder", "upload.anyFileType": "Alle filtyper", "upload.maxFiles": "Maks {n} filer", "upload.maxSize": "Maks {mb} MB", "upload.tooLarge": "Filen er for stor (maks {mb} MB)", "upload.remove": "Fjern", "select.placeholder": "Velg et alternativ", "rating.ariaLabel": "Vurdering", "maxDiff.best": "Viktigst", "maxDiff.worst": "Minst viktig", "maxDiff.setProgress": "Blokk {k} av {n}", "priority.selectUpTo": "Velg opptil", "priority.options": "alternativer", "priority.thenOrder": "og ordne dem deretter", "priority.selectOptions": "Velg alternativer", "priority.cancel": "Avbryt", "priority.confirm": "Bekreft", "priority.selectOptionNumber": "Velg alternativ #", "priority.prioritized": "Prioritert", "priority.of": "av", "priority.instruction": 'Prioriteringslisten din vises nedenfor. Hvis du \xF8nsker det, kan du ordne valgene dine ved hjelp av pilene. Klikk p\xE5 "Neste" for \xE5 bekrefte valget ditt og fortsette.', "action.send": "Send", "action.back": "Tilbake", "action.next": "Neste", "action.start": "Start!", "message.success": "Takk for tilbakemeldingen!", "message.blocked": "Takk for tiden din - vi avslutter samtalen her.", "message.required": "Vennligst svar f\xF8r du fortsetter.", "message.rateLimit": "For mange foresp\xF8rsler. Pr\xF8ver igjen om {seconds} s..." }, sv: { "placeholder.answer": "Skriv ditt svar h\xE4r...", "placeholder.number": "Skriv ditt nummer h\xE4r...", "placeholder.email": "Skriv din e-post h\xE4r...", "placeholder.date": "Skriv ditt datum h\xE4r...", "placeholder.password": "Skriv ditt l\xF6senord h\xE4r...", "pointSystem.error": "Totala po\xE4ng m\xE5ste vara 100 %", "boolean.yes": "Ja", "boolean.no": "Nej", "upload.cta": "Dra och sl\xE4pp eller klicka f\xF6r att ladda upp", "upload.imagesOnly": "Endast bilder", "upload.anyFileType": "Alla filtyper", "upload.maxFiles": "Max {n} filer", "upload.maxSize": "Max {mb} MB", "upload.tooLarge": "Filen \xE4r f\xF6r stor (max {mb} MB)", "upload.remove": "Ta bort", "select.placeholder": "V\xE4lj ett alternativ", "rating.ariaLabel": "Betyg", "maxDiff.best": "Viktigast", "maxDiff.worst": "Minst viktig", "maxDiff.setProgress": "Block {k} av {n}", "priority.selectUpTo": "V\xE4lj upp till", "priority.options": "alternativ", "priority.thenOrder": "och ordna dem sedan", "priority.selectOptions": "V\xE4lj alternativ", "priority.cancel": "Avbryt", "priority.confirm": "Bekr\xE4fta", "priority.selectOptionNumber": "V\xE4lj alternativ #", "priority.prioritized": "Prioriterat", "priority.of": "av", "priority.instruction": 'Din prioriteringslista visas nedan. Om du vill kan du ordna om dina val med hj\xE4lp av pilarna. Klicka p\xE5 "N\xE4sta" f\xF6r att bekr\xE4fta ditt val och forts\xE4tta.', "action.send": "Skicka", "action.back": "Tillbaka", "action.next": "N\xE4sta", "action.start": "K\xF6r!", "message.success": "Tack f\xF6r din feedback!", "message.blocked": "Tack f\xF6r din tid - vi avslutar samtalet h\xE4r.", "message.required": "Svara innan du forts\xE4tter.", "message.rateLimit": "F\xF6r m\xE5nga f\xF6rfr\xE5gningar. F\xF6rs\xF6ker igen om {seconds} s..." }, ar: { "placeholder.answer": "\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627...", "placeholder.number": "\u0627\u0643\u062A\u0628 \u0631\u0642\u0645\u0643 \u0647\u0646\u0627...", "placeholder.email": "\u0627\u0643\u062A\u0628 \u0628\u0631\u064A\u062F\u0643 \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A \u0647\u0646\u0627...", "placeholder.date": "\u0627\u0643\u062A\u0628 \u062A\u0627\u0631\u064A\u062E\u0643 \u0647\u0646\u0627...", "placeholder.password": "\u0627\u0643\u062A\u0628 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0647\u0646\u0627...", "pointSystem.error": "\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0646\u0642\u0627\u0637 \u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A\u0629 100 %", "boolean.yes": "\u0646\u0639\u0645", "boolean.no": "\u0644\u0627", "upload.cta": "\u0627\u0633\u062D\u0628 \u0648\u0623\u0641\u0644\u062A \u0623\u0648 \u0627\u0646\u0642\u0631 \u0644\u0644\u062A\u062D\u0645\u064A\u0644", "upload.imagesOnly": "\u0627\u0644\u0635\u0648\u0631 \u0641\u0642\u0637", "upload.anyFileType": "\u0623\u064A \u0646\u0648\u0639 \u0645\u0646 \u0627\u0644\u0645\u0644\u0641\u0627\u062A", "upload.maxFiles": "{n} \u0645\u0644\u0641\u0627\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649", "upload.maxSize": "{mb} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649", "upload.tooLarge": "\u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {mb} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A)", "upload.remove": "\u0625\u0632\u0627\u0644\u0629", "select.placeholder": "\u0627\u062E\u062A\u0631 \u062E\u064A\u0627\u0631\u064B\u0627", "rating.ariaLabel": "\u0627\u0644\u062A\u0642\u064A\u064A\u0645", "maxDiff.best": "\u0627\u0644\u0623\u0643\u062B\u0631 \u0623\u0647\u0645\u064A\u0629", "maxDiff.worst": "\u0627\u0644\u0623\u0642\u0644 \u0623\u0647\u0645\u064A\u0629", "maxDiff.setProgress": "\u0627\u0644\u0645\u062C\u0645\u0648\u0639\u0629 {k} \u0645\u0646 {n}", "priority.selectUpTo": "\u0627\u062E\u062A\u0631 \u062D\u062A\u0649", "priority.options": "\u062E\u064A\u0627\u0631\u0627\u062A", "priority.thenOrder": "\u062B\u0645 \u0631\u062A\u0628\u0647\u0627", "priority.selectOptions": "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A", "priority.cancel": "\u0625\u0644\u063A\u0627\u0621", "priority.confirm": "\u062A\u0623\u0643\u064A\u062F", "priority.selectOptionNumber": "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631 #", "priority.prioritized": "\u062A\u0645 \u0627\u0644\u062A\u0631\u062A\u064A\u0628", "priority.of": "\u0645\u0646", "priority.instruction": '\u062A\u0638\u0647\u0631 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0648\u0644\u0648\u064A\u0627\u062A \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0623\u062F\u0646\u0627\u0647. \u0625\u0630\u0627 \u0631\u063A\u0628\u062A\u060C \u064A\u0645\u0643\u0646\u0643 \u0625\u0639\u0627\u062F\u0629 \u062A\u0631\u062A\u064A\u0628 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A\u0643 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0623\u0633\u0647\u0645. \u0627\u0646\u0642\u0631 \u0639\u0644\u0649 "\u0627\u0644\u062A\u0627\u0644\u064A" \u0644\u062A\u0623\u0643\u064A\u062F \u0627\u062E\u062A\u064A\u0627\u0631\u0643 \u0648\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629.', "action.send": "\u0625\u0631\u0633\u0627\u0644", "action.back": "\u0631\u062C\u0648\u0639", "action.next": "\u0627\u0644\u062A\u0627\u0644\u064A", "action.start": "\u0627\u0628\u062F\u0623!", "message.success": "\u0634\u0643\u0631\u064B\u0627 \u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643!", "message.blocked": "\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0648\u0642\u062A\u0643\u060C \u0633\u0646\u0646\u0647\u064A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0647\u0646\u0627.", "message.required": "\u064A\u0631\u062C\u0649 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0642\u0628\u0644 \u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629.", "message.rateLimit": "\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627. \u0633\u0646\u0639\u064A\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u062E\u0644\u0627\u0644 {seconds} \u062B\u0627\u0646\u064A\u0629..." }, bn: { "placeholder.answer": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u0989\u09A4\u09CD\u09A4\u09B0 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.number": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09B8\u0982\u0996\u09CD\u09AF\u09BE \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.email": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u0987\u09AE\u09C7\u0987\u09B2 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.date": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09A4\u09BE\u09B0\u09BF\u0996 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.password": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AA\u09BE\u09B8\u0993\u09AF\u09BC\u09BE\u09B0\u09CD\u09A1 \u09B2\u09BF\u0996\u09C1\u09A8...", "pointSystem.error": "\u09AE\u09CB\u099F \u09AA\u09AF\u09BC\u09C7\u09A8\u09CD\u099F 100 % \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7", "boolean.yes": "\u09B9\u09CD\u09AF\u09BE\u0981", "boolean.no": "\u09A8\u09BE", "upload.cta": "\u099F\u09C7\u09A8\u09C7 \u0986\u09A8\u09C1\u09A8 \u09AC\u09BE \u0986\u09AA\u09B2\u09CB\u09A1 \u0995\u09B0\u09A4\u09C7 \u0995\u09CD\u09B2\u09BF\u0995 \u0995\u09B0\u09C1\u09A8", "upload.imagesOnly": "\u09B6\u09C1\u09A7\u09C1\u09AE\u09BE\u09A4\u09CD\u09B0 \u099B\u09AC\u09BF", "upload.anyFileType": "\u09AF\u09C7\u0995\u09CB\u09A8\u09CB \u09A7\u09B0\u09A8\u09C7\u09B0 \u09AB\u09BE\u0987\u09B2", "upload.maxFiles": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {n}\u099F\u09BF \u09AB\u09BE\u0987\u09B2", "upload.maxSize": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {mb} MB", "upload.tooLarge": "\u09AB\u09BE\u0987\u09B2\u099F\u09BF \u0996\u09C1\u09AC \u09AC\u09A1\u09BC (\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {mb} MB)", "upload.remove": "\u09B8\u09B0\u09BE\u09A8", "select.placeholder": "\u098F\u0995\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "rating.ariaLabel": "\u09B0\u09C7\u099F\u09BF\u0982", "maxDiff.best": "\u09B8\u09AC\u099A\u09C7\u09AF\u09BC\u09C7 \u0997\u09C1\u09B0\u09C1\u09A4\u09CD\u09AC\u09AA\u09C2\u09B0\u09CD\u09A3", "maxDiff.worst": "\u09B8\u09AC\u099A\u09C7\u09AF\u09BC\u09C7 \u0995\u09AE \u0997\u09C1\u09B0\u09C1\u09A4\u09CD\u09AC\u09AA\u09C2\u09B0\u09CD\u09A3", "maxDiff.setProgress": "\u09AC\u09CD\u09B2\u0995 {k}/{n}", "priority.selectUpTo": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.options": "\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA", "priority.thenOrder": "\u09A4\u09BE\u09B0\u09AA\u09B0 \u09B8\u09C7\u0997\u09C1\u09B2\u09CB \u09B8\u09BE\u099C\u09BE\u09A8", "priority.selectOptions": "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.cancel": "\u09AC\u09BE\u09A4\u09BF\u09B2", "priority.confirm": "\u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8", "priority.selectOptionNumber": "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA # \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.prioritized": "\u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0\u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4", "priority.of": "\u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7", "priority.instruction": '\u0986\u09AA\u09A8\u09BE\u09B0 \u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0 \u09A4\u09BE\u09B2\u09BF\u0995\u09BE \u09A8\u09BF\u099A\u09C7 \u09A6\u09C7\u0996\u09BE\u09A8\u09CB \u09B9\u09AF\u09BC\u09C7\u099B\u09C7\u0964 \u099A\u09BE\u0987\u09B2\u09C7 \u09A4\u09C0\u09B0 \u099A\u09BF\u09B9\u09CD\u09A8 \u09AC\u09CD\u09AF\u09AC\u09B9\u09BE\u09B0 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AA\u099B\u09A8\u09CD\u09A6\u0997\u09C1\u09B2\u09CB \u09AA\u09C1\u09A8\u09B0\u09BE\u09AF\u09BC \u09B8\u09BE\u099C\u09BE\u09A4\u09C7 \u09AA\u09BE\u09B0\u09C7\u09A8\u0964 "\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0" \u0995\u09CD\u09B2\u09BF\u0995 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8 \u098F\u09AC\u0982 \u098F\u0997\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8\u0964', "action.send": "\u09AA\u09BE\u09A0\u09BE\u09A8", "action.back": "\u09AA\u09BF\u099B\u09A8\u09C7", "action.next": "\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0", "action.start": "\u09B6\u09C1\u09B0\u09C1 \u0995\u09B0\u09C1\u09A8!", "message.success": "\u0986\u09AA\u09A8\u09BE\u09B0 \u09AE\u09A4\u09BE\u09AE\u09A4\u09C7\u09B0 \u099C\u09A8\u09CD\u09AF \u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6!", "message.blocked": "\u0986\u09AA\u09A8\u09BE\u09B0 \u09B8\u09AE\u09AF\u09BC\u09C7\u09B0 \u099C\u09A8\u09CD\u09AF \u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6, \u0986\u09AE\u09B0\u09BE \u098F\u0996\u09BE\u09A8\u09C7\u0987 \u0995\u09A5\u09CB\u09AA\u0995\u09A5\u09A8 \u09B6\u09C7\u09B7 \u0995\u09B0\u099B\u09BF\u0964", "message.required": "\u099A\u09BE\u09B2\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u0993\u09AF\u09BC\u09BE\u09B0 \u0986\u0997\u09C7 \u0985\u09A8\u09C1\u0997\u09CD\u09B0\u09B9 \u0995\u09B0\u09C7 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A6\u09BF\u09A8\u0964", "message.rateLimit": "\u0985\u09A8\u09C7\u0995 \u09AC\u09C7\u09B6\u09BF \u0985\u09A8\u09C1\u09B0\u09CB\u09A7\u0964 {seconds} \u09B8\u09C7\u0995\u09C7\u09A8\u09CD\u09A1\u09C7 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09BE \u09B9\u099A\u09CD\u099B\u09C7..." }, it: { "boolean.yes": "S\xEC", "boolean.no": "No", "priority.selectUpTo": "Seleziona fino a", "priority.options": "opzioni", "priority.thenOrder": "e poi ordinali", "priority.selectOptions": "Seleziona opzioni", "priority.cancel": "Annulla", "priority.confirm": "Conferma", "priority.selectOptionNumber": "Seleziona opzione #", "priority.prioritized": "Prioritizzate", "priority.of": "di", "priority.instruction": 'La tua lista di priorit\xE0 \xE8 mostrata qui sotto. Se vuoi, puoi riordinare le tue scelte usando le frecce. Clicca su "Avanti" per confermare la selezione e continuare.' }, nl: { "boolean.yes": "Ja", "boolean.no": "Nee", "priority.selectUpTo": "Selecteer tot", "priority.options": "opties", "priority.thenOrder": "en rangschik ze vervolgens", "priority.selectOptions": "Selecteer opties", "priority.cancel": "Annuleren", "priority.confirm": "Bevestigen", "priority.selectOptionNumber": "Selecteer optie #", "priority.prioritized": "Geprioriteerd", "priority.of": "van", "priority.instruction": 'Je prioriteitenlijst wordt hieronder weergegeven. Als je wilt, kun je je keuzes herschikken met behulp van de pijlen. Klik op "Volgende" om je selectie te bevestigen en door te gaan.' }, pl: { "boolean.yes": "Tak", "boolean.no": "Nie", "priority.selectUpTo": "Wybierz do", "priority.options": "opcje", "priority.thenOrder": "a nast\u0119pnie je uporz\u0105dkuj", "priority.selectOptions": "Wybierz opcje", "priority.cancel": "Anuluj", "priority.confirm": "Potwierd\u017A", "priority.selectOptionNumber": "Wybierz opcj\u0119 #", "priority.prioritized": "Priorytetowe", "priority.of": "z", "priority.instruction": 'Twoja lista priorytet\xF3w jest pokazana poni\u017Cej. Je\u015Bli chcesz, mo\u017Cesz zmieni\u0107 kolejno\u015B\u0107 swoich wybor\xF3w za pomoc\u0105 strza\u0142ek. Kliknij "Dalej", aby potwierdzi\u0107 wyb\xF3r i kontynuowa\u0107.' }, ru: { "boolean.yes": "\u0414\u0430", "boolean.no": "\u041D\u0435\u0442", "priority.selectUpTo": "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043E", "priority.options": "\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432", "priority.thenOrder": "\u0430 \u0437\u0430\u0442\u0435\u043C \u0443\u043F\u043E\u0440\u044F\u0434\u043E\u0447\u044C\u0442\u0435 \u0438\u0445", "priority.selectOptions": "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B", "priority.cancel": "\u041E\u0442\u043C\u0435\u043D\u0430", "priority.confirm": "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", "priority.selectOptionNumber": "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 #", "priority.prioritized": "\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u044B", "priority.of": "\u0438\u0437", "priority.instruction": '\u0412\u0430\u0448 \u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u043E\u0432 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u043D\u0438\u0436\u0435. \u0415\u0441\u043B\u0438 \u0445\u043E\u0442\u0438\u0442\u0435, \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0440\u044F\u0434\u043E\u043A \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0441\u0442\u0440\u0435\u043B\u043E\u043A. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 "\u0414\u0430\u043B\u0435\u0435", \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0432\u044B\u0431\u043E\u0440 \u0438 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C.' }, ja: { "boolean.yes": "\u306F\u3044", "boolean.no": "\u3044\u3044\u3048", "priority.selectUpTo": "\u6700\u5927", "priority.options": "\u500B\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", "priority.thenOrder": "\u305D\u306E\u5F8C\u4E26\u3079\u66FF\u3048\u3066\u304F\u3060\u3055\u3044", "priority.selectOptions": "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", "priority.cancel": "\u30AD\u30E3\u30F3\u30BB\u30EB", "priority.confirm": "\u78BA\u8A8D", "priority.selectOptionNumber": "\u30AA\u30D7\u30B7\u30E7\u30F3 # \u3092\u9078\u629E", "priority.prioritized": "\u512A\u5148\u9806\u4F4D", "priority.of": "\u306E\u3046\u3061", "priority.instruction": "\u512A\u5148\u9806\u4F4D\u30EA\u30B9\u30C8\u306F\u4EE5\u4E0B\u306B\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u3001\u77E2\u5370\u3092\u4F7F\u3063\u3066\u9078\u629E\u80A2\u3092\u4E26\u3079\u66FF\u3048\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u300C\u6B21\u3078\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u9078\u629E\u3092\u78BA\u5B9A\u3057\u3001\u7D9A\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002" }, zh: { "boolean.yes": "\u662F", "boolean.no": "\u4E0D", "priority.selectUpTo": "\u6700\u591A\u9009\u62E9", "priority.options": "\u4E2A\u9009\u9879", "priority.thenOrder": "\u7136\u540E\u6392\u5E8F\u5B83\u4EEC", "priority.selectOptions": "\u9009\u62E9\u9009\u9879", "priority.cancel": "\u53D6\u6D88", "priority.confirm": "\u786E\u8BA4", "priority.selectOptionNumber": "\u9009\u62E9\u9009\u9879 #", "priority.prioritized": "\u5DF2\u4F18\u5148", "priority.of": "\u5171", "priority.instruction": "\u4F60\u7684\u4F18\u5148\u5217\u8868\u5982\u4E0B\u6240\u793A\u3002\u5982\u6709\u9700\u8981\uFF0C\u53EF\u4EE5\u4F7F\u7528\u7BAD\u5934\u91CD\u65B0\u6392\u5E8F\u9009\u9879\u3002\u70B9\u51FB\u201C\u4E0B\u4E00\u6B65\u201D\u786E\u8BA4\u9009\u62E9\u5E76\u7EE7\u7EED\u3002" }, ko: { "boolean.yes": "\uC608", "boolean.no": "\uC544\uB2C8", "priority.selectUpTo": "\uCD5C\uB300", "priority.options": "\uAC1C\uC758 \uC635\uC158 \uC120\uD0DD", "priority.thenOrder": "\uADF8\uB7F0 \uB2E4\uC74C \uC815\uB82C\uD558\uC138\uC694", "priority.selectOptions": "\uC635\uC158 \uC120\uD0DD", "priority.cancel": "\uCDE8\uC18C", "priority.confirm": "\uD655\uC778", "priority.selectOptionNumber": "\uC635\uC158 # \uC120\uD0DD", "priority.prioritized": "\uC6B0\uC120\uC21C\uC704", "priority.of": "\uC911", "priority.instruction": '\uC6B0\uC120\uC21C\uC704 \uBAA9\uB85D\uC740 \uC544\uB798\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC6D0\uD55C\uB2E4\uBA74 \uD654\uC0B4\uD45C\uB97C \uC0AC\uC6A9\uD574 \uC120\uD0DD \uD56D\uBAA9\uC744 \uC7AC\uC815\uB82C\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. "\uB2E4\uC74C"\uC744 \uD074\uB9AD\uD558\uC5EC \uC120\uD0DD\uC744 \uD655\uC778\uD558\uACE0 \uACC4\uC18D\uD558\uC138\uC694.' } };
2429
- t2.SUPPORTED_LANGUAGES = ["en", "da", "fi", "no", "es", "sv", "ar", "bn", "de", "pt", "fr"], t2.AVAILABLE_LANGUAGES = Object.keys(n), t2.RTL_LANGUAGES = ["ar"];
2430
- const r = { nb: "no", nn: "no", nob: "no", nno: "no", iw: "he", in: "id", cmn: "zh" };
2431
- function o(e3) {
2432
- if (!e3) return null;
2433
- const t3 = e3.trim().toLowerCase().replace(/_/g, "-");
2434
- if (!t3) return null;
2435
- if (n[t3]) return t3;
2436
- const i2 = t3.split("-")[0], o2 = r[i2] || i2;
2437
- return n[o2] ? o2 : null;
2438
- }
2439
- function a(e3) {
2440
- return o(e3) || "en";
2441
- }
2442
- t2.normalizeLanguage = a, t2.TRANSLATION_KEYS = Object.keys(i), t2.hasOwnTranslation = function(e3, t3) {
2443
- const i2 = o(e3);
2444
- return !!i2 && void 0 !== n[i2][t3];
2445
- }, t2.isRtlLanguage = function(e3) {
2446
- return -1 !== t2.RTL_LANGUAGES.indexOf(a(e3));
2447
- }, t2.isLanguageSupported = function(e3) {
2448
- const i2 = o(e3);
2449
- return !!i2 && -1 !== t2.SUPPORTED_LANGUAGES.indexOf(i2);
2450
- }, t2.t = function(e3, t3, r2) {
2451
- const o2 = n[a(e3)] || i, s = void 0 !== o2[t3] ? o2[t3] : i[t3];
2452
- return r2 ? (function(e4, t4) {
2453
- return Object.keys(t4).reduce(((e5, i2) => e5.replace(new RegExp("\\{" + i2 + "\\}", "g"), String(t4[i2]))), e4);
2454
- })(s, r2) : s;
2455
- };
2456
- }, 5407: (e2, t2) => {
2457
- "use strict";
2458
- Object.defineProperty(t2, "__esModule", { value: true }), t2.endpoints = void 0, t2.endpoints = { sdk: { app: (e3, t3) => `sdk/app/${e3}/${t3}`, app_info: (e3, t3) => `sdk/app/${e3}/${t3}/info`, session: (e3) => `sdk/app/session/${e3}/info`, feedback: "sdk/feedback", followUpQuestion: "sdk/followUpQuestion", agentSurveyStart: "sdk/agentSurvey/start", agentSurveyNext: "sdk/agentSurvey/next" } };
2459
- }, 3262: (e2, t2, i) => {
2460
- "use strict";
2461
- Object.defineProperty(t2, "__esModule", { value: true }), t2.placeholder = void 0;
2462
- const n = i(7627);
2463
- t2.placeholder = { answer: (e3) => (0, n.t)(e3, "placeholder.answer"), number: (e3) => (0, n.t)(e3, "placeholder.number"), email: (e3) => (0, n.t)(e3, "placeholder.email"), date: (e3) => (0, n.t)(e3, "placeholder.date"), password: (e3) => (0, n.t)(e3, "placeholder.password"), pointsystemerror: (e3) => (0, n.t)(e3, "pointSystem.error"), upload: { cta: (e3) => (0, n.t)(e3, "upload.cta"), formats: (e3, t3) => (0, n.t)(e3, "image" === t3 ? "upload.imagesOnly" : "upload.anyFileType"), maxFiles: (e3, t3) => (0, n.t)(e3, "upload.maxFiles", { n: t3 }), maxSize: (e3, t3) => (0, n.t)(e3, "upload.maxSize", { mb: t3 }), tooLarge: (e3, t3) => (0, n.t)(e3, "upload.tooLarge", { mb: t3 }), remove: (e3) => (0, n.t)(e3, "upload.remove") } };
2464
- }, 7643: (e2, t2, i) => {
2465
- "use strict";
2466
- Object.defineProperty(t2, "__esModule", { value: true }), t2.renderStartMessage = t2.renderSuccess = t2.renderError = t2.renderActions = t2.renderQuestions = void 0;
2467
- const n = i(4760), r = i(368), o = i(1366), a = i(3433), s = i(9039), l = { small: "1rem", medium: "1.2rem", large: "1.5rem" };
2468
- t2.renderQuestions = function e3(t3, i2 = "standard", d = "en", c = { customIcons: false }, u) {
2469
- if (!t3) throw new Error("[MagicFeedback] No questions provided");
2470
- const p = [], { customIcons: m, id: h } = c;
2471
- return t3.forEach(((f) => {
2472
- var g, y;
2473
- if ((null === (y = null === (g = null == f ? void 0 : f.questionType) || void 0 === g ? void 0 : g.conf) || void 0 === y ? void 0 : y.length) > 0) {
2474
- let t4 = document.createElement("div");
2475
- t4.classList.add("magicfeedback-div");
2476
- const n2 = document.createElement("label");
2477
- n2.setAttribute("for", `magicfeedback-${f.id}`), n2.textContent = (0, o.parseTitle)(f.title, d), n2.classList.add("magicfeedback-label"), t4.appendChild(n2), f.questionType.conf.forEach(((e4) => {
2478
- e4.ref = f.ref, f.assets[e4.id] && (e4.assets = { placeholder: f.assets[e4.id] });
2479
- })), e3(f.questionType.conf, i2, d, c, u).forEach(((e4) => {
2480
- t4.appendChild(e4);
2481
- })), p.push(t4);
2482
- } else {
2483
- const e4 = (function(e5, t4, i3, d2, c2, u2) {
2484
- var p2, m2, h2;
2485
- let f2, g2, { id: y2, title: v, type: b, ref: E, require: A, defaultValue: k, assets: T } = e5, C = document.createElement("div");
2486
- C.classList.add("magicfeedback-div");
2487
- const P = window.innerWidth < 600, w = "slim" === t4 ? (0, o.parseTitle)(v, i3) : null == T ? void 0 : T.placeholder, x = (0, a.shownValueFor)(e5, (0, o.getUrlParam)(E)), S = (null == T ? void 0 : T.maxCharacters) || 0, O = false === (null == T ? void 0 : T.autoAdvance) ? void 0 : c2, L = void 0 !== (null == T ? void 0 : T.randomPosition) && (null == T ? void 0 : T.randomPosition), N = (null == T ? void 0 : T.direction) || "row", I = (null == T ? void 0 : T.order) || "ltr", D = (0, r.getQuestionRenderer)(b);
2488
- if (!D) return C;
2489
- {
2490
- const r2 = D({ question: e5, format: t4, language: i3, url: d2, send: b === n.FEEDBACKAPPANSWERTYPE.TEXT ? c2 : O, isPhone: P, urlParamValue: x, placeholderText: w, maxCharacters: S, randomPosition: L, direction: N, order: I, productId: u2 });
2491
- f2 = r2.element, g2 = r2.elementTypeClass;
2492
- }
2493
- f2.id = `magicfeedback-${y2}`, f2.setAttribute("name", E), f2.classList.add(g2), (void 0 !== k || null !== x) && (f2.value = x || k), ["RADIO", "MULTIPLECHOICE", "UPLOAD_IMAGE", "UPLOAD_FILE"].includes(b) || (f2.classList.add("magicfeedback-input"), f2.required = A);
2494
- const R = document.createElement("label");
2495
- R.setAttribute("for", `magicfeedback-${y2}`), R.textContent = (0, o.parseTitle)(v, i3), R.classList.add("magicfeedback-label"), (function(e6, t5) {
2496
- if ("INFO_PAGE" !== t5.type) return;
2497
- const { assets: i4 } = t5, n2 = (function(e7) {
2498
- if (e7) return l[e7] || e7;
2499
- })(null == i4 ? void 0 : i4.titleSize), r2 = (o2 = null == i4 ? void 0 : i4.titleStyle, Array.isArray(o2) ? o2 : o2 ? [o2] : []);
2500
- var o2;
2501
- n2 && e6.style.setProperty("font-size", n2, "important"), (null == i4 ? void 0 : i4.titleAlign) && (e6.style.setProperty("width", "100%", "important"), e6.style.setProperty("align-self", "stretch", "important"), e6.style.setProperty("text-align", i4.titleAlign, "important")), r2.includes("italic") && e6.style.setProperty("font-style", "italic", "important"), r2.includes("bold") && e6.style.setProperty("font-weight", "bold", "important"), r2.includes("underline") && e6.style.setProperty("text-decoration", "underline", "important");
2502
- })(R, e5);
2503
- const M = document.createElement("label");
2504
- if (M.textContent = (0, o.parseTitle)(null == T ? void 0 : T.subtitle, i3), M.classList.add("magicfeedback-sublabel"), (null === (p2 = null == T ? void 0 : T.subtitleStyle) || void 0 === p2 ? void 0 : p2.includes("italic")) && (M.style.fontStyle = "italic"), (null === (m2 = null == T ? void 0 : T.subtitleStyle) || void 0 === m2 ? void 0 : m2.includes("bold")) && (M.style.fontWeight = "bold"), (null === (h2 = null == T ? void 0 : T.subtitleStyle) || void 0 === h2 ? void 0 : h2.includes("underline")) && (M.style.textDecoration = "underline"), ["CONSENT"].includes(b)) C.classList.add("magicfeedback-consent-container"), C.appendChild(f2), C.appendChild(R), (null == T ? void 0 : T.subtitle) && C.appendChild(M);
2505
- else {
2506
- if ("slim" !== t4 && (C.appendChild(R), (null == T ? void 0 : T.subtitle) && C.appendChild(M), void 0 !== (null == T ? void 0 : T.general) && "" !== (null == T ? void 0 : T.general))) {
2507
- const e6 = document.createElement("img");
2508
- e6.src = null == T ? void 0 : T.general, e6.classList.add("magicfeedback-image"), e6.style.maxWidth = "auto", e6.style.height = "400px", e6.style.margin = "10px 0", C.appendChild(e6);
2509
- }
2510
- if ("LONGTEXT" === b && S > 0) {
2511
- const e6 = document.createElement("div");
2512
- if (e6.classList.add("magicfeedback-counter"), e6.textContent = `${f2.value.length}/${S}`, e6.style.textAlign = "end", e6.style.fontSize = "15px", e6.style.marginTop = "5px", f2.addEventListener("input", (() => {
2513
- e6.textContent = `${f2.value.length}/${S}`;
2514
- })), C.appendChild(f2), C.appendChild(e6), (null == T ? void 0 : T.extraOption) && (null == T ? void 0 : T.extraOptionText)) {
2515
- const e7 = document.createElement("div");
2516
- e7.classList.add("magicfeedback-skip-container"), e7.classList.add("magicfeedback-checkbox-container"), e7.style.display = "flex", e7.style.justifyContent = "flex-start";
2517
- const t5 = document.createElement("input");
2518
- t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${E}`, t5.name = E, t5.value = "-", t5.style.cursor = "pointer";
2519
- const i4 = document.createElement("label");
2520
- i4.htmlFor = `skip-${E}`, i4.textContent = null == T ? void 0 : T.extraOptionText, i4.style.fontSize = "15px", i4.style.cursor = "pointer", i4.style.margin = "0 5px", t5.addEventListener("click", (() => {
2521
- f2.value = "-";
2522
- })), (0, s.autoAdvanceOn)(t5, O, "click"), e7.appendChild(t5), e7.appendChild(i4), C.appendChild(e7);
2523
- }
2524
- } else C.appendChild(f2);
2525
- }
2526
- return C;
2527
- })(f, i2, d, "https://survey-dev.magicfeedback.io/assets/emojis" + (m ? `/${h}` : ""), 1 === t3.length ? u : void 0, h);
2528
- p.push(e4);
2529
- }
2530
- })), p;
2531
- }, t2.renderActions = function(e3 = "", t3, i2 = "Submit", n2 = "Back", r2 = "Next") {
2532
- const o2 = document.createElement("div");
2533
- o2.classList.add("magicfeedback-action-container");
2534
- const a2 = document.createElement("button");
2535
- a2.id = "magicfeedback-submit", a2.type = "submit", a2.classList.add("magicfeedback-submit"), a2.textContent = "MAGICSURVEY" === e3 ? r2 || "Next" : i2 || "Submit";
2536
- const s2 = document.createElement("button");
2537
- return s2.id = "magicfeedback-back", s2.type = "button", s2.classList.add("magicfeedback-back"), s2.textContent = n2 || "Back", s2.addEventListener("click", t3), s2.addEventListener("click", (() => {
2538
- a2.removeAttribute("disabled");
2539
- })), "MAGICSURVEY" === e3 && o2.appendChild(s2), o2.appendChild(a2), o2;
2540
- }, t2.renderError = function(e3) {
2541
- const t3 = document.createElement("div");
2542
- return t3.classList.add("magicfeedback-error"), t3.textContent = e3, t3;
2543
- }, t2.renderSuccess = function(e3) {
2544
- const t3 = document.createElement("div");
2545
- return t3.classList.add("magicfeedback-success"), t3.textContent = e3, t3;
2546
- }, t2.renderStartMessage = function(e3, t3 = false, i2 = "Go!", n2 = () => {
2547
- }) {
2548
- const r2 = document.createElement("div");
2549
- r2.classList.add("magicfeedback-start-message-container");
2550
- const o2 = document.createElement("div");
2551
- if (o2.classList.add("magicfeedback-start-message"), o2.innerHTML = e3, r2.appendChild(o2), t3) {
2552
- const e4 = document.createElement("button");
2553
- e4.id = "magicfeedback-start-message-button", e4.classList.add("magicfeedback-start-message-button"), e4.textContent = i2, e4.addEventListener("click", (() => n2())), r2.appendChild(e4);
2554
- }
2555
- return r2;
2556
- };
2557
- }, 9071: function(e2, t2, i) {
2558
- "use strict";
2559
- var n = this && this.__awaiter || function(e3, t3, i2, n2) {
2560
- return new (i2 || (i2 = Promise))((function(r2, o2) {
2561
- function a2(e4) {
2562
- try {
2563
- l2(n2.next(e4));
2564
- } catch (e5) {
2565
- o2(e5);
2566
- }
2567
- }
2568
- function s2(e4) {
2569
- try {
2570
- l2(n2.throw(e4));
2571
- } catch (e5) {
2572
- o2(e5);
2573
- }
2574
- }
2575
- function l2(e4) {
2576
- var t4;
2577
- e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
2578
- e5(t4);
2579
- }))).then(a2, s2);
2580
- }
2581
- l2((n2 = n2.apply(e3, t3 || [])).next());
2582
- }));
2583
- }, r = this && this.__importDefault || function(e3) {
2584
- return e3 && e3.__esModule ? e3 : { default: e3 };
2585
- };
2586
- Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = t2.header = void 0;
2587
- const o = r(i(6539)), a = r(i(8330)), s = i(5407), l = i(3433);
2588
- t2.header = { Accept: "application/json", "Magicfeedback-Sdk-Version": a.default.version, "x-magicfeedback-parameters": window.location.search || "" }, t2.validateEmail = function(e3) {
2589
- return /\S+@\S+\.\S+/.test(e3);
2590
- }, t2.getForm = function(e3, i2, r2, a2, d) {
2591
- return n(this, void 0, void 0, (function* () {
2592
- try {
2593
- const n2 = yield (0, o.default)((0, l.withLangParam)(e3 + s.endpoints.sdk.app_info(i2, r2), d), { method: "GET", headers: t2.header });
2594
- return yield n2.json();
2595
- } catch (e4) {
2596
- a2.err(e4);
2597
- }
2598
- }));
2599
- }, t2.getSessionForm = function(e3, i2, r2, a2) {
2600
- return n(this, void 0, void 0, (function* () {
2601
- try {
2602
- const n2 = yield (0, o.default)((0, l.withLangParam)(e3 + s.endpoints.sdk.session(i2), a2), { method: "GET", headers: t2.header });
2603
- return yield n2.json();
2604
- } catch (e4) {
2605
- r2.err(e4);
2606
- }
2607
- }));
2608
- }, t2.getQuestions = function(e3, i2, r2, a2, d) {
2609
- return n(this, void 0, void 0, (function* () {
2610
- try {
2611
- const n2 = yield (0, o.default)((0, l.withLangParam)(e3 + s.endpoints.sdk.app(i2, r2), d), { method: "GET", headers: t2.header });
2612
- if (n2.ok) {
2613
- const e4 = yield n2.json();
2614
- return a2.log(`Received questions for app ${i2}`, e4), e4;
2615
- }
2616
- throw a2.err(`Failed to get questions for app ${i2}:`, n2.status, n2.statusText), new Error("[MagicFeedback] Bad response from server");
2617
- } catch (e4) {
2618
- return a2.err(e4), [];
2619
- }
2620
- }));
2621
- }, t2.sendFeedback = function(e3, i2, r2) {
2622
- return n(this, void 0, void 0, (function* () {
2623
- try {
2624
- const n2 = yield (0, o.default)(e3 + s.endpoints.sdk.feedback, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
2625
- if (n2.ok) return r2.log(`Form ${i2.integration} submitted successfully!`), (yield n2.json()).sessionId;
2626
- throw r2.err(`Failed to submit form ${i2.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
2627
- } catch (e4) {
2628
- return r2.err(e4), "";
2629
- }
2630
- }));
2631
- }, t2.getFollowUpQuestion = function(e3, i2, r2) {
2632
- return n(this, void 0, void 0, (function* () {
2633
- try {
2634
- const n2 = yield (0, o.default)(e3 + s.endpoints.sdk.followUpQuestion, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
2635
- if (n2.ok) return r2.log(`Received follow up question for form ${i2.integration}`), (yield n2.json()) || "";
2636
- throw r2.err(`Failed to get follow up question for form ${i2.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
2637
- } catch (e4) {
2638
- return r2.err(e4), "";
2639
- }
2640
- }));
2641
- };
2642
- }, 3433: (e2, t2, i) => {
2643
- "use strict";
2644
- Object.defineProperty(t2, "__esModule", { value: true }), t2.toBaseAnswers = t2.shownValueFor = t2.baseValueMap = t2.withLangParam = t2.detectSurveyLang = t2.normalizeSurveyLang = void 0;
2645
- const n = i(4760), r = { nb: "no", nn: "no", nob: "no", nno: "no" };
2646
- function o(e3) {
2647
- if (!e3 || "string" != typeof e3) return null;
2648
- const t3 = e3.trim().toLowerCase().replace(/_/g, "-").split("-")[0];
2649
- return /^[a-z]{2,3}$/.test(t3) ? r[t3] || t3 : null;
2650
- }
2651
- function a(e3) {
2652
- if (null == e3) return null;
2653
- if ("string" == typeof e3 && e3.trim().startsWith("{")) try {
2654
- e3 = JSON.parse(e3);
2655
- } catch (t3) {
2656
- return e3;
2657
- }
2658
- return "object" == typeof e3 ? void 0 !== e3.value ? String(e3.value) : null : String(e3);
2659
- }
2660
- function s(e3) {
2661
- const t3 = /* @__PURE__ */ new Map(), i2 = null == e3 ? void 0 : e3.value, n2 = null == e3 ? void 0 : e3.baseValue;
2662
- return Array.isArray(i2) && Array.isArray(n2) ? (i2.forEach(((e4, i3) => {
2663
- const r2 = a(e4), o2 = a(n2[i3]);
2664
- null === r2 || null === o2 || t3.has(r2) || t3.set(r2, o2);
2665
- })), t3) : t3;
2666
- }
2667
- t2.normalizeSurveyLang = o, t2.detectSurveyLang = function(e3) {
2668
- return o(e3) || (function() {
2669
- if ("undefined" == typeof navigator) return null;
2670
- const e4 = [...Array.isArray(navigator.languages) ? navigator.languages : [], navigator.language];
2671
- for (const t3 of e4) {
2672
- const e5 = o(t3);
2673
- if (e5) return e5;
2674
- }
2675
- return null;
2676
- })();
2677
- }, t2.withLangParam = function(e3, t3) {
2678
- return t3 ? `${e3}${e3.includes("?") ? "&" : "?"}lang=${encodeURIComponent(t3)}` : e3;
2679
- }, t2.baseValueMap = s, t2.shownValueFor = function(e3, t3) {
2680
- var i2, n2;
2681
- if (null === t3 || !Array.isArray(null == e3 ? void 0 : e3.baseValue)) return t3;
2682
- const r2 = e3.baseValue.findIndex(((e4) => a(e4) === t3));
2683
- return -1 === r2 ? t3 : null !== (n2 = a(null === (i2 = e3.value) || void 0 === i2 ? void 0 : i2[r2])) && void 0 !== n2 ? n2 : t3;
2684
- };
2685
- const l = [n.FEEDBACKAPPANSWERTYPE.RADIO, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, n.FEEDBACKAPPANSWERTYPE.SELECT];
2686
- t2.toBaseAnswers = function(e3, t3) {
2687
- return e3.map(((e4) => {
2688
- if (e4.key.startsWith("extra-option-")) return e4;
2689
- const i2 = t3.find(((t4) => t4.ref === e4.key)) || t3.find(((t4) => e4.key.includes(t4.ref)));
2690
- if (!i2) return e4;
2691
- const r2 = s(i2);
2692
- if (0 === r2.size) return e4;
2693
- let o2;
2694
- if (l.includes(i2.type)) o2 = (e5) => {
2695
- var t4;
2696
- return "string" == typeof e5 && null !== (t4 = r2.get(e5)) && void 0 !== t4 ? t4 : e5;
2697
- };
2698
- else if (i2.type === n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST) o2 = (e5) => "string" == typeof e5 ? (function(e6, t4) {
2699
- var i3, n2;
2700
- const r3 = /^(\d+)\.\s?(.*)$/.exec(e6);
2701
- if (!r3) return null !== (i3 = t4.get(e6)) && void 0 !== i3 ? i3 : e6;
2702
- const o3 = r3[2];
2703
- return `${r3[1]}. ${null !== (n2 = t4.get(o3)) && void 0 !== n2 ? n2 : o3}`;
2704
- })(e5, r2) : e5;
2705
- else if (i2.type === n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM) o2 = (e5) => "string" == typeof e5 ? (function(e6, t4) {
2706
- var i3;
2707
- const n2 = e6.lastIndexOf(":");
2708
- if (-1 === n2) return e6;
2709
- const r3 = e6.substring(0, n2);
2710
- return `${null !== (i3 = t4.get(r3)) && void 0 !== i3 ? i3 : r3}${e6.substring(n2)}`;
2711
- })(e5, r2) : e5;
2712
- else if (i2.type === n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) o2 = (e5) => "string" == typeof e5 ? (function(e6, t4) {
2713
- try {
2714
- const i3 = JSON.parse(e6);
2715
- return Array.isArray(i3) ? JSON.stringify(i3.map(((e7) => Object.assign(Object.assign({}, e7), { value: Array.isArray(null == e7 ? void 0 : e7.value) ? e7.value.map(((e8) => {
2716
- var i4;
2717
- return null !== (i4 = t4.get(e8)) && void 0 !== i4 ? i4 : e8;
2718
- })) : null == e7 ? void 0 : e7.value })))) : e6;
2719
- } catch (t5) {
2720
- return e6;
2721
- }
2722
- })(e5, r2) : e5;
2723
- else {
2724
- if (i2.type !== n.FEEDBACKAPPANSWERTYPE.MAX_DIFF) return e4;
2725
- o2 = (e5) => "string" == typeof e5 ? (function(e6, t4) {
2726
- try {
2727
- const i3 = JSON.parse(e6);
2728
- if (!Array.isArray(i3)) return e6;
2729
- const n2 = (e7) => {
2730
- var i4;
2731
- return "string" == typeof e7 && null !== (i4 = t4.get(e7)) && void 0 !== i4 ? i4 : e7;
2732
- };
2733
- return JSON.stringify(i3.map(((e7) => Object.assign(Object.assign({}, e7), { shown: Array.isArray(null == e7 ? void 0 : e7.shown) ? e7.shown.map(n2) : null == e7 ? void 0 : e7.shown, best: n2(null == e7 ? void 0 : e7.best), worst: n2(null == e7 ? void 0 : e7.worst) }))));
2734
- } catch (t5) {
2735
- return e6;
2736
- }
2737
- })(e5, r2) : e5;
2738
- }
2739
- return Object.assign(Object.assign({}, e4), { value: e4.value.map(o2) });
2740
- }));
2741
- };
2742
- }, 9039: (e2, t2) => {
2743
- "use strict";
2744
- Object.defineProperty(t2, "__esModule", { value: true }), t2.answeredInput = t2.autoAdvanceRequested = t2.AUTO_ADVANCE_PARAM = t2.cancelAutoAdvance = t2.autoAdvanceOn = t2.scheduleAutoAdvance = t2.AUTO_ADVANCE_DELAY_MS = void 0, t2.AUTO_ADVANCE_DELAY_MS = 300;
2745
- const i = /* @__PURE__ */ new Map();
2746
- function n(e3, n2) {
2747
- const r = i.get(n2);
2748
- r && clearTimeout(r.timer);
2749
- const o = setTimeout((() => {
2750
- i.delete(n2), e3.isConnected && n2();
2751
- }), t2.AUTO_ADVANCE_DELAY_MS);
2752
- i.set(n2, { timer: o, source: e3 });
2753
- }
2754
- t2.scheduleAutoAdvance = n, t2.autoAdvanceOn = function(e3, t3, i2 = "change") {
2755
- t3 && e3.addEventListener(i2, (() => n(e3, t3)));
2756
- }, t2.cancelAutoAdvance = function(e3) {
2757
- e3 && i.forEach((({ timer: t3, source: n2 }, r) => {
2758
- e3.contains(n2) && (clearTimeout(t3), i.delete(r));
2759
- }));
2760
- }, t2.AUTO_ADVANCE_PARAM = "autoadvance", t2.autoAdvanceRequested = function(e3 = window.location.search) {
2761
- const i2 = new URLSearchParams(e3).get(t2.AUTO_ADVANCE_PARAM);
2762
- return "true" === i2 || "1" === i2;
2763
- }, t2.answeredInput = function(e3, t3) {
2764
- return Array.from(e3.querySelectorAll(".magicfeedback-input")).filter(((e4) => e4.name === t3)).find(((e4) => "radio" === e4.type || "checkbox" === e4.type ? e4.checked : "" !== e4.value)) || null;
2765
- };
2766
- }, 4069: (e2, t2) => {
2767
- "use strict";
2768
- function i(e3) {
2769
- if (!e3) return null;
2770
- const i2 = e3.querySelector(".magicfeedback-div");
2771
- if (!i2) return null;
2772
- const n = i2.querySelector('input:not([type="hidden"]), textarea, select, button');
2773
- if (!n) return null;
2774
- const r = n;
2775
- return r.disabled || r.readOnly ? null : "TEXTAREA" === n.tagName || "INPUT" === n.tagName && t2.AUTOFOCUS_INPUT_TYPES.includes(n.type) ? r : null;
2776
- }
2777
- Object.defineProperty(t2, "__esModule", { value: true }), t2.focusFirstTextQuestion = t2.findAutofocusTarget = t2.AUTOFOCUS_INPUT_TYPES = void 0, t2.AUTOFOCUS_INPUT_TYPES = ["text", "email", "number", "tel", "url", "search"], t2.findAutofocusTarget = i, t2.focusFirstTextQuestion = function(e3) {
2778
- var t3, n;
2779
- if (!e3) return false;
2780
- const r = i(e3);
2781
- if (!r) return false;
2782
- const o = null === (t3 = e3.ownerDocument) || void 0 === t3 ? void 0 : t3.activeElement;
2783
- if (o && !e3.contains(o) && (function(e4) {
2784
- const t4 = e4.tagName;
2785
- return "INPUT" === t4 || "TEXTAREA" === t4 || "SELECT" === t4 || true === e4.isContentEditable;
2786
- })(o)) return false;
2787
- try {
2788
- r.focus({ preventScroll: true });
2789
- } catch (e4) {
2790
- r.focus();
2791
- }
2792
- return (null === (n = e3.ownerDocument) || void 0 === n ? void 0 : n.activeElement) === r;
2793
- };
2794
- }, 9089: (e2, t2) => {
2795
- "use strict";
2796
- Object.defineProperty(t2, "__esModule", { value: true }), t2.armGhostTapGuard = t2.GHOST_TAP_GUARD_MS = void 0, t2.GHOST_TAP_GUARD_MS = 400;
2797
- const i = /* @__PURE__ */ new WeakMap();
2798
- t2.armGhostTapGuard = function(e3) {
2799
- e3 && (i.has(e3) || e3.addEventListener("click", ((r) => {
2800
- var o;
2801
- 0 !== r.detail && (n() - (null !== (o = i.get(e3)) && void 0 !== o ? o : -1 / 0) >= t2.GHOST_TAP_GUARD_MS || (r.preventDefault(), r.stopPropagation()));
2802
- }), true), i.set(e3, n()));
2803
- };
2804
- const n = () => "undefined" != typeof performance ? performance.now() : Date.now();
2805
- }, 4070: (e2, t2) => {
2806
- "use strict";
2807
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Log = void 0, t2.Log = class {
2808
- constructor(e3) {
2809
- this.config = e3;
2810
- }
2811
- log(...e3) {
2812
- this.config.get("debug") && console.log("[MagicFeedback]:", ...e3);
2813
- }
2814
- err(...e3) {
2815
- console.error("[MagicFeedback]:", ...e3);
2816
- }
2817
- };
2818
- }, 8330: (e2) => {
2819
- "use strict";
2820
- e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.33","main":"./dist/magicfeedback-sdk.node.js","browser":"./dist/magicfeedback-sdk.browser.js","types":"./dist/types/src/index.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/MagicFeedback/magicfeedback-sdk.git"},"author":"farias@magicfeedback.io","license":"MIT","private":false,"scripts":{"dev":"vite","build":"webpack","build:watch":"webpack --watch --mode development","release":"npm publish --access public","release:beta":"npm publish --access public --tag beta","release:alpha":"npm publish --access public --tag alpha","test":"jest","test:watch":"jest --watchAll","coverage":"jest --coverage","publish:sdk":"bash publish.sh","publish:sdk:dry-run":"NPM_DRY_RUN=1 bash publish.sh"},"files":["dist"],"devDependencies":{"@babel/preset-typescript":"^7.22.5","@types/node":"^17.0.21","@types/webpack":"^5.28.0","@types/webpack-node-externals":"^2.5.3","c8":"^7.11.0","copy-webpack-plugin":"^11.0.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","nock":"^13.2.4","ts-jest":"^29.1.0","ts-loader":"^9.2.7","ts-node":"^10.7.0","typescript":"^4.6.2","vite":"^2.8.0","vite-plugin-dts":"^0.9.9","webpack":"^5.70.0","webpack-cli":"^4.9.2","webpack-node-externals":"^3.0.0"},"dependencies":{"cross-fetch":"^3.1.5","is-bundling-for-browser-or-node":"^1.1.1"},"description":"MagicFeedbackAI JavaScript Library for [MagicFeedback.io](https://magicfeedback.io/)","bugs":{"url":"https://github.com/MagicFeedback/magicfeedback-sdk/issues"},"homepage":"https://github.com/MagicFeedback/magicfeedback-sdk#readme","directories":{"example":"examples","test":"test"},"style":"./dist/styles/magicfeedback-default.css"}');
2821
- } }, t = {}, (function i(n) {
2822
- var r = t[n];
2823
- if (void 0 !== r) return r.exports;
2824
- var o = t[n] = { exports: {} };
2825
- return e[n].call(o.exports, o, o.exports, i), o.exports;
2826
- })(1422).default;
2827
- var e, t;
2828
- }));
2829
- }
2830
- });
2831
-
2832
- // src/ui/logo.ts
2833
- var BASE_CSS = "max-height:40px; max-width:100%; object-fit:contain; display:block; margin:12px 0 0 0;";
2834
- var MAX_HEIGHT = {
2835
- small: "30px",
2836
- medium: "50px",
2837
- large: "70px"
2838
- };
2839
- function insertPopupLogo(parent, anchor, style, id) {
2840
- if (!style?.logo) return null;
2841
- if (parent.ownerDocument.getElementById(id)) return null;
2842
- const img = parent.ownerDocument.createElement("img");
2843
- img.id = id;
2844
- img.src = style.logo;
2845
- img.alt = "Logo";
2846
- img.style.cssText = BASE_CSS;
2847
- if (style.logoSize && MAX_HEIGHT[style.logoSize]) {
2848
- img.style.maxHeight = MAX_HEIGHT[style.logoSize];
2849
- }
2850
- switch (style.logoPosition) {
2851
- case "left":
2852
- img.style.margin = "12px 0 0 0";
2853
- img.style.setProperty("margin-inline-start", "0");
2854
- img.style.setProperty("margin-inline-end", "16px");
2855
- break;
2856
- case "right":
2857
- img.style.margin = "12px 0 0 0";
2858
- img.style.setProperty("margin-inline-start", "auto");
2859
- img.style.setProperty("margin-inline-end", "0");
2860
- break;
2861
- case "center":
2862
- img.style.margin = "12px auto 0 auto";
2863
- break;
2864
- }
2865
- parent.insertBefore(img, anchor);
2866
- return img;
2867
- }
2868
-
2869
- // src/ui/renderPopup.ts
2870
- var import_native = __toESM(require_magicfeedback_sdk_browser());
2871
- function ensureStyle(id, css, nonce) {
2872
- let el = document.getElementById(id);
2873
- if (el && nonce && el.getAttribute("nonce") !== nonce) {
2874
- el.remove();
2875
- el = null;
2876
- }
2877
- if (!el) {
2878
- el = document.createElement("style");
2879
- el.id = id;
2880
- if (nonce) el.setAttribute("nonce", nonce);
2881
- el.textContent = css;
2882
- document.head.appendChild(el);
2883
- } else if (el.textContent !== css) {
2884
- el.textContent = css;
2885
- }
2886
- return el;
2887
- }
2888
- function ensureMagicFeedbackStyles(nonce) {
2889
- ensureStyle("magicfeedback-sdk-styles", style_default, nonce);
2890
- }
2891
- var SURVEY_ALIGNMENT_STYLE_ID = "deepdots-survey-alignment";
2892
- function ensureSurveyAlignmentStyles(nonce) {
2893
- ensureStyle(SURVEY_ALIGNMENT_STYLE_ID, `
2894
- .deepdots-popup .magicfeedback-container,
2895
- .deepdots-popup .magicfeedback-form,
2896
- .deepdots-popup .magicfeedback-div { padding-left: 0; padding-right: 0; }
2897
- `, nonce);
2898
- }
2899
- function ensureSpinnerStyles(nonce) {
2900
- ensureStyle("deepdots-spinner-styles", `
2901
- /* El enunciado trae margin-top:20px del CSS de surveys, que sumaba al hueco de la barra
2902
- de progreso y descompensaba la simetr\xEDa. Solo se anula en el primero: entre preguntas
2903
- de la misma p\xE1gina sigue separando. */
2904
- .deepdots-popup .magicfeedback-questions .magicfeedback-div:first-child .magicfeedback-label { margin-top: 0; }
2905
- @keyframes ddspin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
2906
- .mf-spinner { display:flex; justify-content:center; align-items:center; padding:8px 0; }
2907
- .mf-spinner-circle { width:28px; height:28px; border:3px solid #e0e6ed; border-top-color:#1E293B; border-radius:50%; animation: ddspin 0.9s linear infinite; }
2908
- `, nonce);
2909
- }
2910
- function ensureResponsiveStyles(nonce) {
2911
- ensureStyle("deepdots-responsive-styles", `
2912
- /* Responsive adjustments */
2913
- @media (max-width: 640px) {
2914
- .deepdots-popup {
2915
- width: calc(100% - 24px) !important;
2916
- max-width: calc(100% - 24px) !important;
2917
- height: auto !important;
2918
- max-height: 90vh !important;
2919
- border-radius: 12px !important;
2920
- padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
2921
- box-sizing: border-box;
2922
- }
2923
- .deepdots-popup .mf-spinner-circle { width: 32px; height: 32px; border-width: 4px; }
2924
- .deepdots-popup button { font-size: 16px !important; }
2925
- .deepdots-popup-header button { width:48px; height:48px; }
2926
- .deepdots-popup-header button svg { width:26px; height:26px; }
2927
- /* Apilados en el orden del DOM: la acci\xF3n principal (Send/Start/Complete) arriba y
2928
- Back debajo. */
2929
- .deepdots-popup-footer { flex-direction: column !important; gap: 4px !important; }
2930
- .deepdots-popup-footer button { width: 100%; }
2931
- }
2932
- @media (max-width: 400px) {
2933
- .deepdots-popup { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) 12px !important; }
2934
- .deepdots-popup-header button { width:48px; height:48px; }
2935
- .deepdots-popup-header button svg { width:26px; height:26px; }
2936
- }
2937
- @media (orientation: landscape) and (max-height: 480px) {
2938
- .deepdots-popup {
2939
- height: 100vh !important;
2940
- max-height: 100vh !important;
2941
- overflow-y: auto !important;
2942
- }
2943
- }
2944
- `, nonce);
2945
- }
2946
- function ensureCustomCss(css, nonce) {
2947
- const STYLE_ID = "deepdots-custom-css";
2948
- if (!css) {
2949
- document.getElementById(STYLE_ID)?.remove();
2950
- return;
2951
- }
2952
- document.head.appendChild(ensureStyle(STYLE_ID, css, nonce));
2953
- }
2954
- function ensureFontFace(family, url, nonce) {
2955
- const css = buildFontFaceCss(family, url);
2956
- if (!css) return;
2957
- ensureStyle("deepdots-font-face", css, nonce);
2958
- }
2959
- function hasFinePointer() {
2960
- return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(pointer: fine)").matches;
2961
- }
2962
- async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId, options) {
2963
- let surveyCompletedEmitted = false;
2964
- let stylesInjected = false;
2965
- let pageDepth = 0;
2966
- let onStartPage = false;
2967
- const cspNonce = options?.cspNonce?.trim() || void 0;
2968
- let labels = getLabels(options?.language);
2969
- let actionLabels = resolveActionLabels(actions, options?.language);
2970
- let direction = directionFor(options?.language);
2971
- const isDark = style?.theme === "dark";
2972
- const theme = {
2973
- popupBg: isDark ? "#1e1e1e" : "#fff",
2974
- // El popup fija su propio fondo, así que debe fijar también el esquema de color.
2975
- // Sin esto los controles de formulario (input/textarea/select) caen al estilo por
2976
- // defecto del navegador: en un host con `prefers-color-scheme: dark` se pintan
2977
- // oscuros con texto blanco sobre el fondo claro del popup.
2978
- colorScheme: isDark ? "dark" : "light",
2979
- textPrimary: isDark ? "#f0f0f0" : "#111",
2980
- closeBtnHoverColor: isDark ? "#fff" : "#000000",
2981
- textMuted: isDark ? "#9ca3af" : "#6b7280",
2982
- progressTrack: isDark ? "#3f3f46" : "#e5e7eb"
2983
- };
2984
- const positionMap = {
2985
- "center": { justifyContent: "center", alignItems: "center", background: "rgba(0,0,0,0.5)" },
2986
- "bottom": { justifyContent: "center", alignItems: "flex-end", padding: "16px", background: "transparent" },
2987
- "bottom-right": { justifyContent: "flex-end", alignItems: "flex-end", padding: "16px", background: "transparent" },
2988
- "bottom-left": { justifyContent: "flex-start", alignItems: "flex-end", padding: "16px", background: "transparent" },
2989
- "top": { justifyContent: "center", alignItems: "flex-start", padding: "16px", background: "transparent" },
2990
- "top-right": { justifyContent: "flex-end", alignItems: "flex-start", padding: "16px", background: "transparent" },
2991
- "top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
2992
- };
2993
- const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
2994
- const passThrough = pos.background === "transparent";
2995
- const popup = document.createElement("div");
2996
- popup.id = "dd-popup";
2997
- popup.className = "deepdots-popup";
2998
- popup.setAttribute("dir", direction);
2999
- popup.style.cssText = `
3000
- position: relative;
3001
- pointer-events: auto;
3002
- display: flex;
3003
- flex-direction: column;
3004
- justify-content: flex-start;
3005
- background: ${theme.popupBg};
3006
- color-scheme: ${theme.colorScheme};
3007
- border-radius: 8px;
3008
- padding: 24px;
3009
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
3010
- max-width: 600px;
3011
- width: 90%;
3012
- max-height: 90vh;
3013
- min-height: 200px;
3014
- `;
3015
- const font = style?.font;
3016
- if (font?.family) {
3017
- const familyValue = buildFontFamilyValue(font.family);
3018
- popup.style.fontFamily = familyValue;
3019
- popup.style.setProperty("--deepdots-font", familyValue);
3020
- popup.classList.add("deepdots-has-font");
3021
- if (font.url) ensureFontFace(font.family, font.url, cspNonce);
3022
- }
3023
- const header = document.createElement("div");
3024
- header.className = "deepdots-popup-header";
3025
- header.style.cssText = "display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; flex:0 0 auto;";
3026
- const titleEl = document.createElement("h2");
3027
- titleEl.id = "dd-title";
3028
- titleEl.className = "deepdots-popup-title";
3029
- titleEl.style.cssText = `margin:0; font-size:17px; font-weight:600; line-height:1.3; color:${theme.textPrimary}; text-transform:none; text-align:start; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;`;
3030
- titleEl.hidden = true;
3031
- const setTitle = (value) => {
3032
- if (!value) return;
3033
- titleEl.textContent = value;
3034
- titleEl.hidden = false;
3035
- };
3036
- setTitle(options?.title);
3037
- header.appendChild(titleEl);
3038
- const closeBtn = document.createElement("button");
3039
- closeBtn.id = "dd-close";
3040
- closeBtn.type = "button";
3041
- closeBtn.setAttribute("aria-label", labels.closeAria);
3042
- closeBtn.innerHTML = `
3043
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3044
- <path d="M5 5L19 19M5 19L19 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="butt"/>
3045
- </svg>
3046
- `;
3047
- closeBtn.style.cssText = `
3048
- background:transparent;
3049
- border:none;
3050
- width:32px;
3051
- height:32px;
3052
- display:flex;
3053
- align-items:center;
3054
- justify-content:center;
3055
- border-radius: 8px;
3056
- cursor:pointer;
3057
- color:${theme.textPrimary};
3058
- padding:4px;
3059
- transition: color .15s ease, transform .15s ease;
3060
- box-shadow: none !important;
3061
- `;
3062
- closeBtn.onmouseenter = () => {
3063
- closeBtn.style.color = theme.closeBtnHoverColor;
3064
- closeBtn.style.transform = "scale(1.06)";
3065
- };
3066
- closeBtn.onmouseleave = () => {
3067
- closeBtn.style.color = theme.textPrimary;
3068
- closeBtn.style.transform = "scale(1)";
3069
- };
3070
- const closeFromChrome = () => {
3071
- emit("popup_clicked", surveyId, { action: "close_icon" });
3072
- onClose();
3073
- };
3074
- closeBtn.onclick = closeFromChrome;
3075
- closeBtn.style.flex = "0 0 auto";
3076
- closeBtn.style.marginLeft = "auto";
3077
- header.appendChild(closeBtn);
3078
- let progressEnabled = options?.showProgressBar === true;
3079
- let progressShowUnit = true;
3080
- let progressUnit = "fraction";
3081
- const progressEl = document.createElement("div");
3082
- progressEl.id = "dd-progress";
3083
- progressEl.className = "deepdots-progress";
3084
- progressEl.style.cssText = "display:none; flex-direction:column; gap:8px; width:100%; flex:0 0 auto; padding:16px 0; box-sizing:border-box;";
3085
- const progressHead = document.createElement("div");
3086
- progressHead.className = "deepdots-progress-head";
3087
- progressHead.style.cssText = "display:flex; flex-direction:row; justify-content:space-between; align-items:center; width:100%; gap:8px;";
3088
- const progressLabel = document.createElement("span");
3089
- progressLabel.id = "dd-progress-label";
3090
- progressLabel.style.cssText = "font-size:13px; line-height:1.2;";
3091
- const progressCurrent = document.createElement("span");
3092
- progressCurrent.id = "dd-progress-current";
3093
- progressCurrent.style.cssText = `font-weight:700; color:${theme.textPrimary};`;
3094
- const progressTotal = document.createElement("span");
3095
- progressTotal.id = "dd-progress-total";
3096
- progressTotal.style.cssText = `font-weight:400; color:${theme.textMuted};`;
3097
- progressLabel.appendChild(progressCurrent);
3098
- progressLabel.appendChild(progressTotal);
3099
- const progressFollowUp = document.createElement("span");
3100
- progressFollowUp.id = "dd-progress-followup";
3101
- progressFollowUp.textContent = labels.followUp;
3102
- progressFollowUp.style.cssText = "display:none; font-size:12px; font-weight:600; color:#fff; background:rgba(59,130,246,0.44); border-radius:999px; padding:2px 10px;";
3103
- progressHead.appendChild(progressLabel);
3104
- progressHead.appendChild(progressFollowUp);
3105
- const progressTrack = document.createElement("div");
3106
- progressTrack.className = "deepdots-progress-track";
3107
- progressTrack.style.cssText = `width:100%; height:4px; border-radius:999px; background:${theme.progressTrack}; overflow:hidden;`;
3108
- const progressBar = document.createElement("div");
3109
- progressBar.id = "dd-progress-bar";
3110
- progressBar.style.cssText = "height:100%; width:0%; background:#22C55E; border-radius:999px; transition:width 450ms ease;";
3111
- progressTrack.appendChild(progressBar);
3112
- progressEl.appendChild(progressHead);
3113
- progressEl.appendChild(progressTrack);
3114
- function updateProgress(p) {
3115
- const total = typeof p.total === "number" ? p.total : 0;
3116
- const progress = typeof p.progress === "number" ? p.progress : 0;
3117
- if (!progressEnabled || onStartPage || p.completed || total <= 1) {
3118
- progressEl.style.display = "none";
3119
- containerContent.style.paddingTop = "16px";
3120
- return;
3121
- }
3122
- progressEl.style.display = "flex";
3123
- containerContent.style.paddingTop = "0";
3124
- const current = Math.min(total, Math.max(1, progress + 1));
3125
- const pct = Math.min(100, Math.max(0, current / total * 100));
3126
- progressBar.style.width = `${pct}%`;
3127
- const label = Math.min(total, Math.max(1, Math.floor(progress) + 1));
3128
- progressLabel.style.display = progressShowUnit ? "block" : "none";
3129
- if (progressUnit === "percentage") {
3130
- progressCurrent.textContent = `${Math.round(pct)}%`;
3131
- progressTotal.textContent = "";
3132
- } else {
3133
- progressCurrent.textContent = `${labels.question} ${label}`;
3134
- progressTotal.textContent = ` ${labels.of} ${total}`;
3135
- }
3136
- progressFollowUp.style.display = p.followup ? "inline-block" : "none";
3137
- }
3138
- ensureMagicFeedbackStyles(cspNonce);
3139
- ensureSurveyAlignmentStyles(cspNonce);
3140
- ensureSpinnerStyles(cspNonce);
3141
- ensureResponsiveStyles(cspNonce);
3142
- ensureCustomCss(options?.surveyCss, cspNonce);
3143
- const containerContent = document.createElement("div");
3144
- containerContent.id = "dd-content";
3145
- containerContent.className = "deepdots-popup-container-content";
3146
- containerContent.style.cssText = "display:flex; flex-direction:column; flex:1 1 auto; min-height:0; padding:16px 0 0 0; overflow:hidden;";
3147
- const main = document.createElement("div");
3148
- main.id = "dd-main";
3149
- main.className = "deepdots-popup-main";
3150
- main.style.cssText = "display:flex; flex-direction:column; width:100%; flex:1 1 auto; min-height:0; overflow-y:auto;";
3151
- const formWrapper = document.createElement("div");
3152
- formWrapper.id = "dd-form-wrapper";
3153
- formWrapper.style.cssText = "width:100%; flex: 1 1 auto;";
3154
- const errorHint = document.createElement("div");
3155
- errorHint.id = "dd-error";
3156
- errorHint.className = "deepdots-error-hint";
3157
- errorHint.style.cssText = `
3158
- display: none;
3159
- margin: 12px 0 0 0;
3160
- padding: 10px 12px;
3161
- border-radius: 6px;
3162
- background: #FEF3C7; /* amber-100 */
3163
- color: #92400E; /* amber-700 */
3164
- border: 1px solid #FCD34D; /* amber-300 */
3165
- font-size: 13px;
3166
- `;
3167
- errorHint.setAttribute("role", "alert");
3168
- errorHint.setAttribute("aria-live", "polite");
3169
- const spinnerEl = document.createElement("div");
3170
- spinnerEl.className = "mf-spinner";
3171
- spinnerEl.setAttribute("role", "status");
3172
- spinnerEl.setAttribute("aria-label", labels.loadingAria);
3173
- spinnerEl.innerHTML = '<div class="mf-spinner-circle"></div>';
3174
- spinnerEl.style.cssText = "position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);";
3175
- const formDivId = `magicfeedback-form-${surveyId}`;
3176
- const formHost = document.createElement("div");
3177
- formHost.id = formDivId;
3178
- formHost.style.cssText = "width:100%; visibility:hidden;";
3179
- formWrapper.appendChild(spinnerEl);
3180
- formWrapper.appendChild(formHost);
3181
- main.appendChild(formWrapper);
3182
- const loadErrorEl = document.createElement("div");
3183
- loadErrorEl.id = "dd-load-error";
3184
- loadErrorEl.className = "deepdots-load-error";
3185
- loadErrorEl.setAttribute("role", "alert");
3186
- loadErrorEl.style.cssText = `display:none; width:100%; text-align:center; padding:24px 0; font-size:15px; color:${theme.textPrimary};`;
3187
- main.appendChild(loadErrorEl);
3188
- main.appendChild(errorHint);
3189
- const footer = document.createElement("div");
3190
- footer.id = "dd-footer";
3191
- footer.className = "deepdots-popup-footer";
3192
- footer.setAttribute("data-actions-wrapper", "true");
3193
- footer.style.cssText = "display:flex; flex-direction: row-reverse ;justify-content:space-between; align-items:center; gap:4px; margin-top:auto; width:100%; padding-top:12px;";
3194
- const backButton = document.createElement("button");
3195
- backButton.id = "dd-back";
3196
- backButton.className = "dd-nav-btn";
3197
- backButton.textContent = actionLabels.back;
3198
- backButton.style.cssText = `
3199
- background: transparent;
3200
- color: ${theme.textMuted};
3201
- border: none;
3202
- min-height: 44px;
3203
- padding: 12px 24px;
3204
- border-radius: 999px; /* p\xEDldora, como el Button de Material3 en KMP */
3205
- cursor: pointer;
3206
- font-size: 15px;
3207
- font-weight: 600;
3208
- transition: filter .15s ease;
3209
- display: inline-flex;
3210
- align-items: center;
3211
- justify-content: center;
3212
- text-align: center;
3213
- `;
3214
- backButton.onmouseenter = () => {
3215
- backButton.style.filter = "brightness(0.9)";
3216
- };
3217
- backButton.onmouseleave = () => {
3218
- backButton.style.filter = "brightness(1)";
3219
- };
3220
- backButton.onclick = () => {
3221
- emit("popup_clicked", surveyId, { action: "back" });
3222
- formInstance?.back?.();
3223
- };
3224
- const startButton = document.createElement("button");
3225
- startButton.id = "dd-start";
3226
- startButton.className = "dd-nav-btn";
3227
- startButton.textContent = actionLabels.start;
3228
- startButton.style.cssText = `
3229
- background: #1E293B;
3230
- color: #fff;
3231
- border: none;
3232
- min-height: 44px;
3233
- padding: 12px 24px;
3234
- border-radius: 999px; /* p\xEDldora, como el Button de Material3 en KMP */
3235
- cursor: pointer;
3236
- font-size: 15px;
3237
- font-weight: 600;
3238
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3239
- transition: filter .15s ease;
3240
- display: inline-flex;
3241
- align-items: center;
3242
- justify-content: center;
3243
- text-align: center;
3244
- `;
3245
- startButton.onclick = () => {
3246
- emit("popup_clicked", surveyId, { action: "start_survey" });
3247
- formInstance?.startForm?.();
3248
- onStartPage = false;
3249
- updateProgress({ progress: formInstance?.progress, total: formInstance?.total });
3250
- };
3251
- const closeButton = document.createElement("button");
3252
- closeButton.id = "dd-complete";
3253
- closeButton.className = "dd-nav-btn";
3254
- closeButton.textContent = actionLabels.complete;
3255
- closeButton.style.cssText = `
3256
- background: #1E293B;
3257
- color: #fff;
3258
- border: none;
3259
- min-height: 44px;
3260
- padding: 12px 24px;
3261
- border-radius: 999px; /* p\xEDldora, como el Button de Material3 en KMP */
3262
- cursor: pointer;
3263
- font-size: 15px;
3264
- font-weight: 600;
3265
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3266
- transition: filter .15s ease;
3267
- display: inline-flex;
3268
- align-items: center;
3269
- justify-content: center;
3270
- text-align: center;
3271
- `;
3272
- closeButton.onmouseenter = () => {
3273
- closeButton.style.filter = "brightness(0.9)";
3274
- };
3275
- closeButton.onmouseleave = () => {
3276
- closeButton.style.filter = "brightness(1)";
3277
- };
3278
- closeButton.onclick = () => {
3279
- emit("popup_clicked", surveyId, { action: "complete" });
3280
- onClose();
3281
- };
3282
- const submitButton = document.createElement("button");
3283
- submitButton.id = "dd-submit";
3284
- submitButton.className = "dd-nav-btn";
3285
- submitButton.textContent = actionLabels.accept;
3286
- submitButton.style.cssText = `
3287
- background: #1E293B;
3288
- color: #fff;
3289
- border: none;
3290
- min-height: 44px;
3291
- padding: 12px 24px;
3292
- border-radius: 999px; /* p\xEDldora, como el Button de Material3 en KMP */
3293
- cursor: pointer;
3294
- font-size: 15px;
3295
- font-weight: 600;
3296
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3297
- transition: filter .15s ease;
3298
- display: inline-flex;
3299
- align-items: center;
3300
- justify-content: center;
3301
- text-align: center;
3302
- `;
3303
- const cancelButton = document.createElement("button");
3304
- cancelButton.id = "dd-cancel";
3305
- cancelButton.type = "button";
3306
- cancelButton.className = "dd-nav-btn";
3307
- cancelButton.textContent = actionLabels.decline;
3308
- cancelButton.style.cssText = submitButton.style.cssText;
3309
- cancelButton.onclick = closeFromChrome;
3310
- submitButton.onclick = () => {
3311
- if (!surveyCompletedEmitted) {
3312
- emit("popup_clicked", surveyId, { action: "manual_send" });
3313
- formInstance?.send?.();
3314
- }
3315
- };
3316
- function applyLabels(lang) {
3317
- labels = getLabels(lang);
3318
- actionLabels = resolveActionLabels(actions, lang);
3319
- backButton.textContent = actionLabels.back;
3320
- startButton.textContent = actionLabels.start;
3321
- closeButton.textContent = actionLabels.complete;
3322
- submitButton.textContent = actionLabels.accept;
3323
- cancelButton.textContent = actionLabels.decline;
3324
- loadErrorEl.textContent = labels.errorLoad;
3325
- closeBtn.setAttribute("aria-label", labels.closeAria);
3326
- spinnerEl.setAttribute("aria-label", labels.loadingAria);
3327
- progressFollowUp.textContent = labels.followUp;
3328
- direction = directionFor(lang);
3329
- popup.setAttribute("dir", direction);
3330
- }
3331
- backButton.style.display = "none";
3332
- startButton.style.display = "none";
3333
- submitButton.style.display = "none";
3334
- closeButton.style.display = "none";
3335
- cancelButton.style.display = "none";
3336
- footer.appendChild(submitButton);
3337
- footer.appendChild(backButton);
3338
- footer.appendChild(closeButton);
3339
- footer.appendChild(startButton);
3340
- footer.appendChild(cancelButton);
3341
- containerContent.appendChild(main);
3342
- footer.style.flex = "0 0 auto";
3343
- containerContent.appendChild(footer);
3344
- function updateButtons(state) {
3345
- backButton.style.display = "none";
3346
- startButton.style.display = "none";
3347
- submitButton.style.display = "none";
3348
- closeButton.style.display = "none";
3349
- cancelButton.style.display = "none";
3350
- backButton.style.width = "";
3351
- startButton.style.width = "";
3352
- submitButton.style.width = "";
3353
- closeButton.style.width = "";
3354
- switch (state) {
3355
- case "loading":
3356
- break;
3357
- case "start":
3358
- startButton.style.display = "inline-flex";
3359
- startButton.style.width = "100%";
3360
- break;
3361
- case "in_progress_first":
3362
- submitButton.style.display = "inline-flex";
3363
- submitButton.style.width = "";
3364
- setLoading(false);
3365
- break;
3366
- case "in_progress_next":
3367
- backButton.style.display = "inline-flex";
3368
- submitButton.style.display = "inline-flex";
3369
- setLoading(false);
3370
- break;
3371
- case "completed":
3372
- closeButton.style.display = "inline-flex";
3373
- closeButton.style.width = "100%";
3374
- setLoading(false);
3375
- break;
3376
- case "error":
3377
- setLoading(false);
3378
- break;
3379
- case "load_error":
3380
- cancelButton.style.display = "inline-flex";
3381
- break;
3382
- }
3383
- }
3384
- function updateNavButtons() {
3385
- updateButtons(pageDepth > 0 ? "in_progress_next" : "in_progress_first");
3386
- }
3387
- let successMessageHtml = "";
3388
- function showSuccessScreen() {
3389
- progressEl.style.display = "none";
3390
- formWrapper.style.display = "none";
3391
- let done = main.querySelector(".deepdots-success");
3392
- if (!done) {
3393
- done = document.createElement("div");
3394
- done.className = "deepdots-success";
3395
- done.style.cssText = `width:100%; text-align:center; padding:24px 0; color:${theme.textPrimary};`;
3396
- main.insertBefore(done, errorHint);
3397
- }
3398
- done.innerHTML = successMessageHtml || "<p>Thank you for your feedback!</p>";
3399
- done.querySelectorAll("img").forEach((img) => {
3400
- img.style.cssText = "max-width:100%; height:auto; margin:0 auto 16px auto; display:block;";
3401
- });
3402
- }
3403
- let loadFailed = false;
3404
- function showLoadError(reason) {
3405
- sdkWarn("[Deepdots] survey failed to load:", reason);
3406
- if (loadFailed) return;
3407
- loadFailed = true;
3408
- progressEl.style.display = "none";
3409
- formWrapper.style.display = "none";
3410
- errorHint.style.display = "none";
3411
- loadErrorEl.textContent = labels.errorLoad;
3412
- loadErrorEl.style.display = "block";
3413
- setLoading(false);
3414
- updateButtons("load_error");
3415
- reveal();
3416
- }
3417
- popup.appendChild(header);
3418
- popup.appendChild(progressEl);
3419
- popup.appendChild(containerContent);
3420
- container.innerHTML = "";
3421
- container.appendChild(popup);
3422
- container.style.display = "flex";
3423
- container.style.visibility = "hidden";
3424
- container.style.pointerEvents = "none";
3425
- container.style.justifyContent = pos.justifyContent;
3426
- container.style.alignItems = pos.alignItems;
3427
- container.style.background = pos.background;
3428
- if (pos.padding) container.style.padding = pos.padding;
3429
- let revealed = false;
3430
- let revealTimer = null;
3431
- let surveyLoaded = false;
3432
- let openFocusDone = false;
3433
- function autofocusOnOpen() {
3434
- if (openFocusDone || !revealed || !surveyLoaded) return;
3435
- openFocusDone = true;
3436
- if (hasFinePointer()) formInstance?.focusFirstQuestion?.();
3437
- }
3438
- function reveal() {
3439
- if (revealed) return;
3440
- revealed = true;
3441
- if (revealTimer !== null) {
3442
- clearTimeout(revealTimer);
3443
- revealTimer = null;
3444
- }
3445
- if (!container.contains(popup)) return;
3446
- container.style.visibility = "visible";
3447
- container.style.pointerEvents = passThrough ? "none" : "";
3448
- autofocusOnOpen();
3449
- }
3450
- function revealWhenPainted2() {
3451
- if (revealed) return;
3452
- revealWhenPainted(popup, reveal);
3453
- }
3454
- revealTimer = setTimeout(reveal, REVEAL_TIMEOUT_MS);
3455
- function setLoading(isLoading) {
3456
- spinnerEl.style.display = isLoading ? "flex" : "none";
3457
- setSurveyBusy(formWrapper, isLoading);
3458
- if (!isLoading) {
3459
- formHost.style.visibility = "visible";
3460
- revealWhenPainted2();
3461
- }
3462
- footer.style.display = isLoading ? "none" : "flex";
3463
- backButton.disabled = isLoading;
3464
- startButton.disabled = isLoading;
3465
- closeButton.disabled = isLoading;
3466
- submitButton.disabled = isLoading;
3467
- submitButton.style.opacity = isLoading ? "0.6" : "1";
3468
- submitButton.style.cursor = isLoading ? "not-allowed" : "pointer";
3469
- if (isLoading) {
3470
- updateButtons("loading");
3471
- }
3472
- }
3473
- setLoading(true);
3474
- if (typeof window === "undefined" || typeof document === "undefined") {
3475
- return;
3476
- }
3477
- let formInstance = null;
3478
- try {
3479
- if (!import_native.default || typeof import_native.default.form !== "function") {
3480
- sdkWarn("[MagicFeedback] form() no disponible. Fallback manual.");
3481
- showLoadError("form() not available");
3482
- return;
3483
- }
3484
- import_native.default.init(
3485
- {
3486
- debug: true,
3487
- env: env === "production" ? "prod" : "dev"
3488
- }
3489
- );
3490
- const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null, analyticsFeedbackSessionId ?? null);
3491
- formInstance = import_native.default.form(surveyId, productId, profile, metadata);
3492
- const generateOptions = {
3493
- addButton: false,
3494
- getMetaData: true,
3495
- // La pantalla final la pinta el popup: `renderSuccess` de @magicfeedback/native usa
3496
- // textContent, así que el mensaje de la plataforma (HTML con imagen) no se vería, y
3497
- // su fallback es un literal genérico que ignora `style.successMessage`.
3498
- addSuccessScreen: false,
3499
- // Surveys multi-idioma: native pide a la API este idioma (el del init o el del
3500
- // dispositivo) y, si el survey no lo tiene, la API sirve el idioma por defecto.
3501
- lang: options?.language,
3502
- // Foco en la primera pregunta de escribir tras Start, Siguiente o Atrás. Native lo
3503
- // aplica después de afterSubmitEvent/onBackEvent, cuando `setLoading(false)` ya ha
3504
- // quitado el `inert`. La apertura va aparte (ver autofocusOnOpen).
3505
- autofocus: "navigation"
3506
- };
3507
- generateOptions.onLoadedEvent = ({ formData, lang, error }) => {
3508
- if (error) {
3509
- showLoadError(error);
3510
- return;
3511
- }
3512
- const shownLang = typeof lang === "string" && lang.trim().length > 0 ? lang : void 0;
3513
- const surveyLang = shownLang ?? (Array.isArray(formData?.lang) ? formData.lang.find((l) => typeof l === "string" && l.trim().length > 0) : void 0);
3514
- if (surveyLang) applyLabels(surveyLang);
3515
- try {
3516
- } catch {
3517
- }
3518
- const s = formData?.style;
3519
- if (s && !stylesInjected) {
3520
- stylesInjected = true;
3521
- if (s.successMessage) successMessageHtml = s.successMessage;
3522
- if (options?.showProgressBar === void 0) progressEnabled = s.showProgressBar === true;
3523
- if (s.showProgressUnit !== void 0) progressShowUnit = s.showProgressUnit !== false;
3524
- if (s.progressUnit) progressUnit = s.progressUnit;
3525
- if (s.loadingBarColor) {
3526
- progressBar.style.background = s.loadingBarColor;
3527
- progressFollowUp.style.background = s.loadingBarColor;
3528
- }
3529
- if (s.boxBackgroundColor) {
3530
- popup.style.background = s.boxBackgroundColor;
3531
- }
3532
- if (s.contentAlign) {
3533
- main.style.justifyContent = s.contentAlign === "center" ? "center" : "flex-start";
3534
- }
3535
- applySurveyPrimaryColor(popup, s);
3536
- if (s.buttonPrimaryColor) {
3537
- submitButton.style.background = s.buttonPrimaryColor;
3538
- submitButton.style.border = "none";
3539
- submitButton.style.color = "#fff";
3540
- startButton.style.background = s.buttonPrimaryColor;
3541
- startButton.style.border = "none";
3542
- startButton.style.color = "#fff";
3543
- closeButton.style.background = s.buttonPrimaryColor;
3544
- closeButton.style.border = "none";
3545
- closeButton.style.color = "#fff";
3546
- }
3547
- if (s.buttonSecondaryColor) {
3548
- backButton.style.background = "transparent";
3549
- backButton.style.color = s.buttonSecondaryColor;
3550
- backButton.style.border = "none";
3551
- }
3552
- insertPopupLogo(popup, progressEl, s, "deepdots-popup-logo");
3553
- if (s.startMessage && s.startMessage !== "") {
3554
- sdkLog(s.startMessage);
3555
- onStartPage = true;
3556
- updateButtons("start");
3557
- } else {
3558
- updateButtons("in_progress_first");
3559
- }
3560
- } else {
3561
- updateButtons("in_progress_first");
3562
- }
3563
- updateProgress({ progress: formInstance.progress, total: formInstance.total });
3564
- setLoading(false);
3565
- if (!surveyLoaded) {
3566
- surveyLoaded = true;
3567
- autofocusOnOpen();
3568
- }
3569
- };
3570
- generateOptions.beforeSubmitEvent = () => {
3571
- setLoading(true);
3572
- };
3573
- generateOptions.afterSubmitEvent = ({ error, completed, total, progress, followup }) => {
3574
- const errText = error ? typeof error === "string" ? error : error.message ?? String(error) : "";
3575
- if (errText) {
3576
- setLoading(false);
3577
- if (errText.toLowerCase().includes("no response")) {
3578
- errorHint.textContent = labels.errorRequired;
3579
- errorHint.style.display = "block";
3580
- updateNavButtons();
3581
- return;
3582
- }
3583
- errorHint.textContent = labels.errorSubmit;
3584
- errorHint.style.display = "block";
3585
- sdkWarn("[Deepdots] survey submit error:", errText);
3586
- return;
3587
- }
3588
- errorHint.style.display = "none";
3589
- setLoading(false);
3590
- if (completed) {
3591
- emit("survey_completed", surveyId, { action: "completed" });
3592
- surveyCompletedEmitted = true;
3593
- showSuccessScreen();
3594
- updateButtons("completed");
3595
- updateProgress({ progress, total, completed: true });
3596
- return;
3597
- }
3598
- emit("popup_clicked", surveyId, { action: "partial" });
3599
- pageDepth++;
3600
- updateNavButtons();
3601
- updateProgress({ progress, total, followup });
3602
- };
3603
- generateOptions.onBackEvent = ({ progress, error, followup }) => {
3604
- if (!error) pageDepth = Math.max(0, pageDepth - 1);
3605
- updateNavButtons();
3606
- updateProgress({ progress, total: formInstance.total, followup });
3607
- };
3608
- formInstance.generate(formDivId, generateOptions).catch((err) => {
3609
- sdkError("[MagicFeedback] Error generating form:", err);
3610
- showLoadError(err);
3611
- });
3612
- } catch (e) {
3613
- sdkError("[MagicFeedback] Exception initializing form:", e);
3614
- showLoadError(e);
3615
- }
3616
- }
3617
- export {
3618
- REVEAL_TIMEOUT_MS,
3619
- SURVEY_ALIGNMENT_STYLE_ID,
3620
- renderPopup
3621
- };
3622
- //# sourceMappingURL=renderPopup-PQWJSBOY.mjs.map