@magicfeedback/popup-sdk 1.1.0 → 1.1.2

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.
@@ -0,0 +1,3303 @@
1
+ import {
2
+ __commonJS,
3
+ __toESM,
4
+ buildSurveyIdentity
5
+ } from "./chunk-6WTOQGET.mjs";
6
+
7
+ // node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
8
+ var require_magicfeedback_sdk_browser = __commonJS({
9
+ "node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js"(exports, module) {
10
+ "use strict";
11
+ !(function(e, t) {
12
+ "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();
13
+ })(self, (() => {
14
+ return e = { 945: function(e2, t2) {
15
+ var i = "undefined" != typeof self ? self : this, n = (function() {
16
+ function e3() {
17
+ this.fetch = false, this.DOMException = i.DOMException;
18
+ }
19
+ return e3.prototype = i, new e3();
20
+ })();
21
+ !(function(e3) {
22
+ !(function(t3) {
23
+ var i2 = "URLSearchParams" in e3, n2 = "Symbol" in e3 && "iterator" in Symbol, r2 = "FileReader" in e3 && "Blob" in e3 && (function() {
24
+ try {
25
+ return new Blob(), true;
26
+ } catch (e4) {
27
+ return false;
28
+ }
29
+ })(), s = "FormData" in e3, a = "ArrayBuffer" in e3;
30
+ if (a) var o = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
31
+ return e4 && o.indexOf(Object.prototype.toString.call(e4)) > -1;
32
+ };
33
+ function d(e4) {
34
+ if ("string" != typeof e4 && (e4 = String(e4)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e4)) throw new TypeError("Invalid character in header field name");
35
+ return e4.toLowerCase();
36
+ }
37
+ function c(e4) {
38
+ return "string" != typeof e4 && (e4 = String(e4)), e4;
39
+ }
40
+ function u(e4) {
41
+ var t4 = { next: function() {
42
+ var t5 = e4.shift();
43
+ return { done: void 0 === t5, value: t5 };
44
+ } };
45
+ return n2 && (t4[Symbol.iterator] = function() {
46
+ return t4;
47
+ }), t4;
48
+ }
49
+ function p(e4) {
50
+ this.map = {}, e4 instanceof p ? e4.forEach((function(e5, t4) {
51
+ this.append(t4, e5);
52
+ }), this) : Array.isArray(e4) ? e4.forEach((function(e5) {
53
+ this.append(e5[0], e5[1]);
54
+ }), this) : e4 && Object.getOwnPropertyNames(e4).forEach((function(t4) {
55
+ this.append(t4, e4[t4]);
56
+ }), this);
57
+ }
58
+ function m(e4) {
59
+ if (e4.bodyUsed) return Promise.reject(new TypeError("Already read"));
60
+ e4.bodyUsed = true;
61
+ }
62
+ function h(e4) {
63
+ return new Promise((function(t4, i3) {
64
+ e4.onload = function() {
65
+ t4(e4.result);
66
+ }, e4.onerror = function() {
67
+ i3(e4.error);
68
+ };
69
+ }));
70
+ }
71
+ function f(e4) {
72
+ var t4 = new FileReader(), i3 = h(t4);
73
+ return t4.readAsArrayBuffer(e4), i3;
74
+ }
75
+ function v(e4) {
76
+ if (e4.slice) return e4.slice(0);
77
+ var t4 = new Uint8Array(e4.byteLength);
78
+ return t4.set(new Uint8Array(e4)), t4.buffer;
79
+ }
80
+ function g() {
81
+ return this.bodyUsed = false, this._initBody = function(e4) {
82
+ var t4;
83
+ this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : r2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : s && 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 = v(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a && (ArrayBuffer.prototype.isPrototypeOf(e4) || l(e4)) ? this._bodyArrayBuffer = v(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"));
84
+ }, r2 && (this.blob = function() {
85
+ var e4 = m(this);
86
+ if (e4) return e4;
87
+ if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
88
+ if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
89
+ if (this._bodyFormData) throw new Error("could not read FormData body as blob");
90
+ return Promise.resolve(new Blob([this._bodyText]));
91
+ }, this.arrayBuffer = function() {
92
+ return this._bodyArrayBuffer ? m(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
93
+ }), this.text = function() {
94
+ var e4, t4, i3, n3 = m(this);
95
+ if (n3) return n3;
96
+ if (this._bodyBlob) return e4 = this._bodyBlob, i3 = h(t4 = new FileReader()), t4.readAsText(e4), i3;
97
+ if (this._bodyArrayBuffer) return Promise.resolve((function(e5) {
98
+ for (var t5 = new Uint8Array(e5), i4 = new Array(t5.length), n4 = 0; n4 < t5.length; n4++) i4[n4] = String.fromCharCode(t5[n4]);
99
+ return i4.join("");
100
+ })(this._bodyArrayBuffer));
101
+ if (this._bodyFormData) throw new Error("could not read FormData body as text");
102
+ return Promise.resolve(this._bodyText);
103
+ }, s && (this.formData = function() {
104
+ return this.text().then(E);
105
+ }), this.json = function() {
106
+ return this.text().then(JSON.parse);
107
+ }, this;
108
+ }
109
+ p.prototype.append = function(e4, t4) {
110
+ e4 = d(e4), t4 = c(t4);
111
+ var i3 = this.map[e4];
112
+ this.map[e4] = i3 ? i3 + ", " + t4 : t4;
113
+ }, p.prototype.delete = function(e4) {
114
+ delete this.map[d(e4)];
115
+ }, p.prototype.get = function(e4) {
116
+ return e4 = d(e4), this.has(e4) ? this.map[e4] : null;
117
+ }, p.prototype.has = function(e4) {
118
+ return this.map.hasOwnProperty(d(e4));
119
+ }, p.prototype.set = function(e4, t4) {
120
+ this.map[d(e4)] = c(t4);
121
+ }, p.prototype.forEach = function(e4, t4) {
122
+ for (var i3 in this.map) this.map.hasOwnProperty(i3) && e4.call(t4, this.map[i3], i3, this);
123
+ }, p.prototype.keys = function() {
124
+ var e4 = [];
125
+ return this.forEach((function(t4, i3) {
126
+ e4.push(i3);
127
+ })), u(e4);
128
+ }, p.prototype.values = function() {
129
+ var e4 = [];
130
+ return this.forEach((function(t4) {
131
+ e4.push(t4);
132
+ })), u(e4);
133
+ }, p.prototype.entries = function() {
134
+ var e4 = [];
135
+ return this.forEach((function(t4, i3) {
136
+ e4.push([i3, t4]);
137
+ })), u(e4);
138
+ }, n2 && (p.prototype[Symbol.iterator] = p.prototype.entries);
139
+ var y = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
140
+ function b(e4, t4) {
141
+ var i3, n3, r3 = (t4 = t4 || {}).body;
142
+ if (e4 instanceof b) {
143
+ if (e4.bodyUsed) throw new TypeError("Already read");
144
+ 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);
145
+ } else this.url = String(e4);
146
+ 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(), y.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");
147
+ this._initBody(r3);
148
+ }
149
+ function E(e4) {
150
+ var t4 = new FormData();
151
+ return e4.trim().split("&").forEach((function(e5) {
152
+ if (e5) {
153
+ var i3 = e5.split("="), n3 = i3.shift().replace(/\+/g, " "), r3 = i3.join("=").replace(/\+/g, " ");
154
+ t4.append(decodeURIComponent(n3), decodeURIComponent(r3));
155
+ }
156
+ })), t4;
157
+ }
158
+ function k(e4, t4) {
159
+ 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);
160
+ }
161
+ b.prototype.clone = function() {
162
+ return new b(this, { body: this._bodyInit });
163
+ }, g.call(b.prototype), g.call(k.prototype), k.prototype.clone = function() {
164
+ return new k(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
165
+ }, k.error = function() {
166
+ var e4 = new k(null, { status: 0, statusText: "" });
167
+ return e4.type = "error", e4;
168
+ };
169
+ var A = [301, 302, 303, 307, 308];
170
+ k.redirect = function(e4, t4) {
171
+ if (-1 === A.indexOf(t4)) throw new RangeError("Invalid status code");
172
+ return new k(null, { status: t4, headers: { location: e4 } });
173
+ }, t3.DOMException = e3.DOMException;
174
+ try {
175
+ new t3.DOMException();
176
+ } catch (e4) {
177
+ t3.DOMException = function(e5, t4) {
178
+ this.message = e5, this.name = t4;
179
+ var i3 = Error(e5);
180
+ this.stack = i3.stack;
181
+ }, t3.DOMException.prototype = Object.create(Error.prototype), t3.DOMException.prototype.constructor = t3.DOMException;
182
+ }
183
+ function C(e4, i3) {
184
+ return new Promise((function(n3, s2) {
185
+ var a2 = new b(e4, i3);
186
+ if (a2.signal && a2.signal.aborted) return s2(new t3.DOMException("Aborted", "AbortError"));
187
+ var o2 = new XMLHttpRequest();
188
+ function l2() {
189
+ o2.abort();
190
+ }
191
+ o2.onload = function() {
192
+ var e5, t4, i4 = { status: o2.status, statusText: o2.statusText, headers: (e5 = o2.getAllResponseHeaders() || "", t4 = new p(), e5.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(e6) {
193
+ var i5 = e6.split(":"), n4 = i5.shift().trim();
194
+ if (n4) {
195
+ var r4 = i5.join(":").trim();
196
+ t4.append(n4, r4);
197
+ }
198
+ })), t4) };
199
+ i4.url = "responseURL" in o2 ? o2.responseURL : i4.headers.get("X-Request-URL");
200
+ var r3 = "response" in o2 ? o2.response : o2.responseText;
201
+ n3(new k(r3, i4));
202
+ }, o2.onerror = function() {
203
+ s2(new TypeError("Network request failed"));
204
+ }, o2.ontimeout = function() {
205
+ s2(new TypeError("Network request failed"));
206
+ }, o2.onabort = function() {
207
+ s2(new t3.DOMException("Aborted", "AbortError"));
208
+ }, o2.open(a2.method, a2.url, true), "include" === a2.credentials ? o2.withCredentials = true : "omit" === a2.credentials && (o2.withCredentials = false), "responseType" in o2 && r2 && (o2.responseType = "blob"), a2.headers.forEach((function(e5, t4) {
209
+ o2.setRequestHeader(t4, e5);
210
+ })), a2.signal && (a2.signal.addEventListener("abort", l2), o2.onreadystatechange = function() {
211
+ 4 === o2.readyState && a2.signal.removeEventListener("abort", l2);
212
+ }), o2.send(void 0 === a2._bodyInit ? null : a2._bodyInit);
213
+ }));
214
+ }
215
+ C.polyfill = true, e3.fetch || (e3.fetch = C, e3.Headers = p, e3.Request = b, e3.Response = k), t3.Headers = p, t3.Request = b, t3.Response = k, t3.fetch = C, Object.defineProperty(t3, "__esModule", { value: true });
216
+ })({});
217
+ })(n), n.fetch.ponyfill = true, delete n.fetch.polyfill;
218
+ var r = n;
219
+ (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;
220
+ }, 317: (e2, t2) => {
221
+ "use strict";
222
+ 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/";
223
+ }, 156: function(e2, t2, i) {
224
+ "use strict";
225
+ var n = this && this.__importDefault || function(e3) {
226
+ return e3 && e3.__esModule ? e3 : { default: e3 };
227
+ };
228
+ Object.defineProperty(t2, "__esModule", { value: true });
229
+ const r = n(i(927));
230
+ let s = null;
231
+ s || (s = (0, r.default)()), t2.default = s;
232
+ }, 927: function(e2, t2, i) {
233
+ "use strict";
234
+ var n = this && this.__awaiter || function(e3, t3, i2, n2) {
235
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
236
+ function a2(e4) {
237
+ try {
238
+ l2(n2.next(e4));
239
+ } catch (e5) {
240
+ s2(e5);
241
+ }
242
+ }
243
+ function o2(e4) {
244
+ try {
245
+ l2(n2.throw(e4));
246
+ } catch (e5) {
247
+ s2(e5);
248
+ }
249
+ }
250
+ function l2(e4) {
251
+ var t4;
252
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
253
+ e5(t4);
254
+ }))).then(a2, o2);
255
+ }
256
+ l2((n2 = n2.apply(e3, t3 || [])).next());
257
+ }));
258
+ };
259
+ Object.defineProperty(t2, "__esModule", { value: true });
260
+ const r = i(57), s = i(665), a = i(256), o = i(313), l = i(317);
261
+ t2.default = function() {
262
+ const e3 = new s.Config();
263
+ let t3 = new a.Log(e3);
264
+ return { init: function(i2) {
265
+ "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), e3.set("url", (null == i2 ? void 0 : i2.env) && "dev" === (null == i2 ? void 0 : i2.env) ? l.HOST_API_URL_DEV : l.HOST_API_URL), e3.set("env", null == i2 ? void 0 : i2.env), t3.log("Initialized Magicfeedback", e3);
266
+ }, send: function(i2, r2, s2, a2 = true, l2, d) {
267
+ return n(this, void 0, void 0, (function* () {
268
+ i2 || t3.err("No appID provided"), r2 || t3.err("No publicKey provided"), s2 || t3.err("No feedback provided"), s2.answers || s2.profile || s2.metrics || s2.metadata || t3.err("No feedback data provided");
269
+ const n2 = e3.get("url"), c = { integration: i2, publicKey: r2, privateKey: d, completed: a2, id: l2, feedback: s2 };
270
+ try {
271
+ if (e3.get("dryRun")) return t3.log("Dry run enabled: skipping native feedback submit"), `dry-run-${Date.now()}`;
272
+ const i3 = yield (0, o.sendFeedback)(n2, c, t3);
273
+ return t3.log("sent native feedback"), i3;
274
+ } catch (e4) {
275
+ return t3.err("error native feedback", e4), false;
276
+ }
277
+ }));
278
+ }, form: function(i2, n2, s2, a2) {
279
+ return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new r.Form(e3, i2, n2, s2, a2);
280
+ }, session: function(i2) {
281
+ return i2 || t3.err("No sessionId provided"), new r.Form(e3, i2);
282
+ } };
283
+ };
284
+ }, 79: (e2, t2) => {
285
+ "use strict";
286
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.History = void 0, t2.History = class {
287
+ constructor() {
288
+ this.items = [];
289
+ }
290
+ enqueue(e3) {
291
+ this.items.push(e3);
292
+ }
293
+ dequeue() {
294
+ return this.items.shift();
295
+ }
296
+ rollback() {
297
+ return this.items.pop();
298
+ }
299
+ front() {
300
+ return this.items[0];
301
+ }
302
+ back() {
303
+ return this.items[this.items.length - 1];
304
+ }
305
+ isEmpty() {
306
+ return 0 === this.items.length;
307
+ }
308
+ size() {
309
+ return this.items.length;
310
+ }
311
+ get(e3) {
312
+ return this.items[e3];
313
+ }
314
+ };
315
+ }, 665: (e2, t2) => {
316
+ "use strict";
317
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.Config = void 0, t2.Config = class {
318
+ constructor() {
319
+ this.variables = {}, this.variables.env = "prod", this.variables.debug = false, this.variables.dryRun = false;
320
+ }
321
+ get(e3) {
322
+ return this.variables[e3];
323
+ }
324
+ set(e3, t3) {
325
+ this.variables[e3] = t3;
326
+ }
327
+ };
328
+ }, 57: function(e2, t2, i) {
329
+ "use strict";
330
+ var n = this && this.__awaiter || function(e3, t3, i2, n2) {
331
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
332
+ function a2(e4) {
333
+ try {
334
+ l2(n2.next(e4));
335
+ } catch (e5) {
336
+ s2(e5);
337
+ }
338
+ }
339
+ function o2(e4) {
340
+ try {
341
+ l2(n2.throw(e4));
342
+ } catch (e5) {
343
+ s2(e5);
344
+ }
345
+ }
346
+ function l2(e4) {
347
+ var t4;
348
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
349
+ e5(t4);
350
+ }))).then(a2, o2);
351
+ }
352
+ l2((n2 = n2.apply(e3, t3 || [])).next());
353
+ }));
354
+ };
355
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.Form = void 0;
356
+ const r = i(558), s = i(256), a = i(313), o = i(213), l = i(989), d = i(700), c = i(591), u = i(79), p = i(636);
357
+ t2.Form = class {
358
+ constructor(e3, t3, i2, n2, r2) {
359
+ this.config = e3, this.log = new s.Log(e3), this.formOptionsConfig = { addButton: true, sendButtonText: "Send", backButtonText: "Back", nextButtonText: "Next", 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.feedback = { text: "", answers: [], profile: null != n2 ? n2 : [], metrics: [], metadata: null != r2 ? r2 : [] }, this.history = new u.History(), this.graph = new l.PageGraph([]), this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
360
+ }
361
+ generate(e3, t3) {
362
+ var i2, r2, s2, o2, l2, d2, c2;
363
+ return n(this, void 0, void 0, (function* () {
364
+ try {
365
+ this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3;
366
+ let n2 = this.formData;
367
+ if (void 0 !== this.formData && this.formData || (n2 = "" !== this.publicKey ? yield (0, a.getForm)(this.url, this.appId, this.publicKey, this.log) : yield (0, a.getSessionForm)(this.url, this.appId, this.log)), void 0 === n2 || !n2) throw new Error(`No data for app ${this.appId}`);
368
+ if (null === (i2 = n2.error) || void 0 === i2 ? void 0 : i2.message) throw new Error(n2.error.message);
369
+ if (n2.questions = (null === (r2 = n2.questions) || void 0 === r2 ? void 0 : r2.filter(((e4) => "ACTIVE" === e4.status))) || [], n2.pages = (null === (s2 = n2.pages) || void 0 === s2 ? void 0 : s2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (o2 = n2.pages) || void 0 === o2 || o2.forEach(((e4) => {
370
+ var t4;
371
+ return e4.integrationQuestions = null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.filter(((e5) => "ACTIVE" === e5.status));
372
+ })), this.formData = n2, this.formData.savedAt || (this.formData.savedAt = /* @__PURE__ */ new Date(), localStorage.setItem(`magicfeedback-${this.appId}`, JSON.stringify(this.formData))), void 0 === this.formData.questions || !this.formData.questions) throw new Error(`No questions for app ${this.appId}`);
373
+ this.formData.pages && 0 !== (null === (l2 = this.formData.pages) || void 0 === l2 ? void 0 : l2.length) || this.formatPages(), null === (d2 = this.formData.questions) || void 0 === d2 || d2.sort(((e4, t4) => e4.position - t4.position)), this.formData.pages = this.formData.pages.filter(((e4) => {
374
+ var t4;
375
+ return (null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.length) > 0;
376
+ })), this.formOptionsConfig.getMetaData && this.getMetaData(), (null === (c2 = this.formData.style) || void 0 === c2 ? void 0 : c2.startMessage) ? yield this.generateWelcomeMessage(this.formData.style.startMessage) : this.startForm();
377
+ } catch (e4) {
378
+ return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
379
+ }
380
+ }));
381
+ }
382
+ formatPages() {
383
+ var e3;
384
+ if (this.formData) switch (this.formData.identity) {
385
+ case "MAGICSURVEY":
386
+ this.formData.pages = [], null === (e3 = this.formData.questions) || void 0 === e3 || e3.forEach(((e4) => {
387
+ var t4, i2;
388
+ const n2 = new c.PageRoute(e4.id, e4.ref, c.OperatorType.NOEQUAL, [], c.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), r2 = new d.Page(e4.position.toString(), e4.position, this.appId, [e4], [n2]);
389
+ null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(r2);
390
+ }));
391
+ break;
392
+ case "MAGICFORM":
393
+ const t3 = new d.Page("1", 1, this.appId, this.formData.questions, []);
394
+ this.formData.pages = [t3];
395
+ }
396
+ }
397
+ generateContainer() {
398
+ let e3 = document.getElementById(this.selector);
399
+ if (!e3 && (e3 = document.getElementById("magicfeedback-container-" + this.appId), !e3)) throw new Error(`Element with ID '${this.selector}' not found.`);
400
+ return e3.classList.add("magicfeedback-container"), e3.id = "magicfeedback-container-" + this.appId, e3.innerHTML = "", e3;
401
+ }
402
+ generateForm() {
403
+ var e3, t3, i2, r2;
404
+ return n(this, void 0, void 0, (function* () {
405
+ try {
406
+ if (!this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
407
+ this.graph = new l.PageGraph(this.formData.pages.sort(((e4, t4) => e4.position - t4.position)));
408
+ let n2 = this.generateContainer();
409
+ const s2 = document.createElement("form");
410
+ s2.classList.add("magicfeedback-form"), s2.id = "magicfeedback-" + this.appId, s2.addEventListener("submit", ((e4) => e4.preventDefault()));
411
+ const a2 = document.createElement("div");
412
+ a2.classList.add("magicfeedback-questions"), a2.id = "magicfeedback-questions-" + this.appId;
413
+ const d2 = this.graph.getFirstPage();
414
+ if (!d2) throw new Error("No page found");
415
+ if (this.total = this.graph.findMaxDepth(), d2.elements = (0, o.renderQuestions)(d2.questions, this.formOptionsConfig.questionFormat, null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang[0], null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.send())), null === (i2 = d2.elements) || void 0 === i2 || i2.forEach(((e4) => a2.appendChild(e4))), s2.appendChild(a2), this.history.enqueue(d2), n2.appendChild(s2), this.progress = this.total - this.graph.findMaxDepth(d2), this.formOptionsConfig.addButton) {
416
+ const e4 = (0, o.renderActions)(null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText, this.formOptionsConfig.backButtonText, this.formOptionsConfig.nextButtonText);
417
+ s2.appendChild(e4);
418
+ }
419
+ this.formOptionsConfig.addButton && s2.addEventListener("submit", ((e4) => {
420
+ e4.preventDefault(), this.send();
421
+ })), this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, formData: this.formData, formOptionsConfig: this.formOptionsConfig }));
422
+ } catch (e4) {
423
+ return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
424
+ }
425
+ }));
426
+ }
427
+ startForm() {
428
+ this.generateForm();
429
+ }
430
+ generateWelcomeMessage(e3) {
431
+ return n(this, void 0, void 0, (function* () {
432
+ try {
433
+ const t3 = this.generateContainer(), i2 = (0, o.renderStartMessage)(e3, this.formOptionsConfig.addButton, this.formOptionsConfig.startButtonText, (() => this.startForm()));
434
+ t3.appendChild(i2), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, formData: this.formData }));
435
+ } catch (e4) {
436
+ return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
437
+ }
438
+ }));
439
+ }
440
+ getMetaData() {
441
+ 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] });
442
+ const e3 = new URLSearchParams(window.location.search);
443
+ Array.from(new Set(e3.keys())).forEach(((t3) => {
444
+ const i2 = e3.getAll(t3);
445
+ i2.length > 0 && this.feedback.metadata.push({ key: `query-${t3}`, value: i2 });
446
+ })), 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] });
447
+ }
448
+ send(e3, t3, i2) {
449
+ return n(this, void 0, void 0, (function* () {
450
+ const n2 = document.getElementById("magicfeedback-questions-" + this.appId);
451
+ try {
452
+ i2 && (this.feedback.profile = [...this.feedback.profile, ...i2]), t3 && (this.feedback.metrics = [...this.feedback.metrics, ...t3]), e3 && (this.feedback.metadata = [...this.feedback.metadata, ...e3]), this.answer(), this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
453
+ const s2 = this.history.back();
454
+ if (!s2) throw new Error("No page found");
455
+ for (const e4 of s2.questions.filter(((e5) => e5.require && ![r.FEEDBACKAPPANSWERTYPE.CONSENT, r.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
456
+ const t4 = e4.assets, i3 = this.feedback.answers.filter(((t5) => t5.key.includes(e4.ref) && !t5.key.includes("extra-option")));
457
+ 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");
458
+ if (null == t4 ? void 0 : t4.minOptions) {
459
+ let n3 = [];
460
+ 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");
461
+ }
462
+ if (e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) {
463
+ const i4 = this.feedback.answers.find(((t5) => t5.key === e4.ref));
464
+ if (!i4) throw this.log.err(`The matrix question ${e4.ref} is required`), new Error("No response");
465
+ const n3 = this.parseMatrixAnswerPre(i4), r2 = Array.isArray(null == t4 ? void 0 : t4.options) ? t4.options : [];
466
+ if (r2.length > 0) {
467
+ if (r2.find(((e5) => {
468
+ const t5 = n3.find(((t6) => t6.key === e5));
469
+ return !t5 || !Array.isArray(t5.value) || 0 === t5.value.length;
470
+ }))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
471
+ } 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");
472
+ }
473
+ }
474
+ const a2 = yield this.pushAnswers(false);
475
+ if (!a2) throw new Error("No response");
476
+ this.id = a2, yield this.processNextQuestion(n2);
477
+ } catch (e4) {
478
+ 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 }));
479
+ }
480
+ }));
481
+ }
482
+ answer() {
483
+ const e3 = document.getElementById("magicfeedback-" + this.appId);
484
+ if (!e3) return this.log.err(`Form "${e3}" not found.`), this.feedback.answers = [], [];
485
+ const t3 = this.history.back();
486
+ if (!t3) {
487
+ const t4 = e3.querySelectorAll(".magicfeedback-input"), i3 = [], n3 = {};
488
+ return t4.forEach(((e4) => {
489
+ var t5;
490
+ const r2 = e4, s3 = r2.name;
491
+ if (!s3) return;
492
+ const a2 = r2.type;
493
+ if (("radio" === a2 || "checkbox" === a2) && !r2.checked) return;
494
+ const o3 = r2.value, l3 = r2.classList[0];
495
+ if ((null == l3 ? void 0 : l3.includes("magicfeedback-priority-list")) || (null === (t5 = r2.id) || void 0 === t5 ? void 0 : t5.startsWith("priority-list-"))) return n3[s3] || (n3[s3] = []), void n3[s3].push(o3);
496
+ const d3 = "magicfeedback-consent" === l3 ? r2.checked.toString() : o3;
497
+ if (null == d3) return;
498
+ const c2 = { key: s3, value: [d3] };
499
+ i3.push(c2);
500
+ })), Object.entries(n3).forEach((([e4, t5]) => {
501
+ const n4 = t5.slice().sort(((e5, t6) => Number(e5.split(".")[0]) - Number(t6.split(".")[0])));
502
+ i3.push({ key: e4, value: n4 });
503
+ })), this.feedback.answers = i3, i3;
504
+ }
505
+ const i2 = [];
506
+ let n2 = false;
507
+ const s2 = e3.querySelectorAll(".magicfeedback-input"), o2 = {}, l2 = {}, d2 = {};
508
+ if (s2.forEach(((e4) => {
509
+ const s3 = e4, c2 = t3.questions.find(((e5) => {
510
+ var t4;
511
+ return null === (t4 = s3.name) || void 0 === t4 ? void 0 : t4.includes(e5.ref);
512
+ })), u2 = s3.type, p2 = s3.classList[0], m = { key: s3.name, value: [] }, h = "magicfeedback-consent" === p2 ? s3.checked.toString() : s3.value;
513
+ if (m.key && "" !== m.key) if (m.key.startsWith("extra-option-")) "" !== h && (m.value.push(h), i2.push(m));
514
+ else switch (null == c2 ? void 0 : c2.type) {
515
+ case r.FEEDBACKAPPANSWERTYPE.EMAIL:
516
+ case r.FEEDBACKAPPANSWERTYPE.TEXT:
517
+ case r.FEEDBACKAPPANSWERTYPE.LONGTEXT:
518
+ case r.FEEDBACKAPPANSWERTYPE.NUMBER:
519
+ case r.FEEDBACKAPPANSWERTYPE.DATE:
520
+ case r.FEEDBACKAPPANSWERTYPE.CONTACT:
521
+ case r.FEEDBACKAPPANSWERTYPE.PASSWORD:
522
+ "" !== h && ("email" === u2 ? (0, a.validateEmail)(h) ? (this.feedback.profile.push({ key: "email", value: [h] }), m.value.push(h), i2.push(m)) : (this.log.err("Invalid email"), n2 = true) : (m.value.push(h), i2.push(m)));
523
+ break;
524
+ case r.FEEDBACKAPPANSWERTYPE.RADIO:
525
+ s3.checked && (m.value.push(h), i2.push(m));
526
+ break;
527
+ case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
528
+ case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
529
+ s3.checked && (l2[m.key] || (l2[m.key] = []), l2[m.key].push(h));
530
+ break;
531
+ case r.FEEDBACKAPPANSWERTYPE.BOOLEAN:
532
+ s3.checked && (m.value.push(h), i2.push(m));
533
+ break;
534
+ case r.FEEDBACKAPPANSWERTYPE.CONSENT:
535
+ m.value.push(s3.checked.toString()), i2.push(m);
536
+ break;
537
+ case r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
538
+ case r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
539
+ case r.FEEDBACKAPPANSWERTYPE.RATING_STAR:
540
+ s3.checked && (m.value.push(h), i2.push(m));
541
+ break;
542
+ case r.FEEDBACKAPPANSWERTYPE.SELECT:
543
+ "" !== h && (m.value.push(h), i2.push(m));
544
+ break;
545
+ case r.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
546
+ "number" === u2 && s3.id && (d2[m.key] || (d2[m.key] = []), "" !== h && d2[m.key].push(`${s3.id}:${h}%`));
547
+ break;
548
+ case r.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
549
+ "hidden" === u2 && (o2[m.key] || (o2[m.key] = []), o2[m.key].push(h));
550
+ break;
551
+ case r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
552
+ e4.checked && (m.value.push(h), i2.push(m));
553
+ case r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
554
+ case r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE:
555
+ }
556
+ })), n2) return [];
557
+ Object.entries(l2).forEach((([e4, t4]) => {
558
+ t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
559
+ })), Object.entries(d2).forEach((([e4, t4]) => {
560
+ t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
561
+ })), Object.entries(o2).forEach((([e4, t4]) => {
562
+ if (!t4 || 0 === t4.length) return;
563
+ const n3 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
564
+ i2.push({ key: e4, value: n3 });
565
+ }));
566
+ try {
567
+ t3.questions.filter(((e4) => e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)).forEach(((e4) => {
568
+ const t4 = e4.ref + "-", n3 = i2.filter(((e5) => e5.key.startsWith(t4)));
569
+ if (0 === n3.length) return;
570
+ const r2 = n3.map(((e5) => ({ key: e5.key.substring(t4.length), value: e5.value }))), s3 = { key: e4.ref, value: [JSON.stringify(r2)] };
571
+ for (const e5 of n3) {
572
+ const t5 = i2.findIndex(((t6) => t6.key === e5.key));
573
+ -1 !== t5 && i2.splice(t5, 1);
574
+ }
575
+ const a2 = i2.findIndex(((t5) => t5.key === e4.ref));
576
+ -1 !== a2 ? i2[a2] = s3 : i2.push(s3);
577
+ }));
578
+ } catch (e4) {
579
+ this.log.err("Error agrupando MULTI_QUESTION_MATRIX", e4);
580
+ }
581
+ return this.feedback.answers = i2, t3.setAnswer(i2), i2;
582
+ }
583
+ finish() {
584
+ return n(this, void 0, void 0, (function* () {
585
+ 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) {
586
+ const e3 = document.getElementById("magicfeedback-container-" + this.appId);
587
+ e3.childNodes.length > 0 && e3.removeChild(e3.childNodes[0]);
588
+ const t3 = (0, o.renderSuccess)(this.formOptionsConfig.successMessage || "Thank you for your feedback!");
589
+ e3.appendChild(t3);
590
+ }
591
+ this.answer();
592
+ try {
593
+ const e3 = yield this.pushAnswers(true);
594
+ 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}:");
595
+ 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 }));
596
+ } catch (e3) {
597
+ 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 }));
598
+ }
599
+ }));
600
+ }
601
+ pushAnswers(e3 = false) {
602
+ return n(this, void 0, void 0, (function* () {
603
+ try {
604
+ if (this.config.get("dryRun")) {
605
+ const e4 = this.id || `dry-run-${this.appId}-${Date.now()}`;
606
+ return this.log.log(`Dry run enabled: skipping feedback submit for form ${this.appId}`), e4;
607
+ }
608
+ const t3 = this.config.get("url"), i2 = { integration: this.appId, publicKey: this.publicKey, feedback: this.feedback, completed: e3 };
609
+ return yield (0, a.sendFeedback)(t3, this.id ? Object.assign(Object.assign({}, i2), { sessionId: this.id }) : i2, this.log);
610
+ } catch (e4) {
611
+ return this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), "";
612
+ }
613
+ }));
614
+ }
615
+ callFollowUpQuestion(e3) {
616
+ var t3;
617
+ return n(this, void 0, void 0, (function* () {
618
+ if (!(null == e3 ? void 0 : e3.followup)) return null;
619
+ try {
620
+ if (this.config.get("dryRun")) return this.log.log(`Dry run enabled: skipping follow up API for question ${e3.ref}`), null;
621
+ if (0 === this.feedback.answers.length) throw new Error("No answers provided");
622
+ const i2 = this.config.get("url"), n2 = Object.assign(Object.assign(Object.assign({ answer: null === (t3 = this.feedback.answers.find(((t4) => t4.key === e3.ref))) || void 0 === t3 ? void 0 : t3.value[0] }, "" !== this.publicKey && { publicKey: this.publicKey }), "" === this.publicKey && { campaignSessionId: this.appId }), { sessionId: this.id, question: e3 });
623
+ return yield (0, a.getFollowUpQuestion)(i2, n2, this.log);
624
+ } catch (e4) {
625
+ throw this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), e4;
626
+ }
627
+ }));
628
+ }
629
+ processNextQuestion(e3) {
630
+ var t3, i2, r2;
631
+ return n(this, void 0, void 0, (function* () {
632
+ const n2 = this.history.back();
633
+ if (!n2) throw new Error("No page found");
634
+ const s2 = n2.getFollowupQuestions();
635
+ if (0 === (null == s2 ? void 0 : s2.length)) return void (yield this.renderNextQuestion(e3, n2));
636
+ const a2 = [];
637
+ for (const e4 of s2) {
638
+ const t4 = n2.questions.find(((t5) => t5.ref === e4));
639
+ if (t4) {
640
+ const e5 = yield this.callFollowUpQuestion(t4);
641
+ e5 && a2.push(e5);
642
+ }
643
+ }
644
+ if (0 === a2.length) return void (yield this.renderNextQuestion(e3, n2));
645
+ const l2 = new d.Page(n2.id, n2.position, this.appId, a2, n2.edges), c2 = new p.PageNode(n2.id, n2.position, n2.edges, l2, a2, true);
646
+ c2.elements = (0, o.renderQuestions)(a2, this.formOptionsConfig.questionFormat, null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.lang[0], null === (i2 = this.formData) || void 0 === i2 ? void 0 : i2.product, (() => this.send())), this.history.enqueue(c2), this.progress += 0.5, e3.innerHTML = "", null === (r2 = c2.elements) || void 0 === r2 || r2.forEach(((t4) => e3.appendChild(t4))), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: c2.isFollowup, completed: this.completed, error: null }));
647
+ }));
648
+ }
649
+ renderNextQuestion(e3, t3) {
650
+ var i2, s2, a2, l2, d2;
651
+ return n(this, void 0, void 0, (function* () {
652
+ let n2 = this.graph.getNextPage(t3, this.feedback.answers);
653
+ if (!n2) return void this.finish();
654
+ const u2 = n2.edges.filter(((e4) => "PRECONDITIONAL" === e4.typeCondition)).sort(((e4, t4) => e4.position < t4.position ? -1 : e4.position > t4.position ? 1 : 0));
655
+ if ((null == u2 ? void 0 : u2.length) > 0) {
656
+ const t4 = u2.some(((e4) => e4.transition === c.TransitionType.ALLOW));
657
+ let a3 = t4;
658
+ for (const t5 of u2) {
659
+ let o2;
660
+ for (let e4 = this.history.size() - 1; e4 >= 0; e4--) {
661
+ const n3 = this.history.get(e4);
662
+ if (n3 && (o2 = null === (i2 = n3.answers) || void 0 === i2 ? void 0 : i2.find(((e5) => e5.key === t5.questionRef)), o2)) break;
663
+ }
664
+ let l3 = false;
665
+ if (o2) {
666
+ const e4 = null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.questions.find(((e5) => e5.ref === t5.questionRef)), i3 = Array.isArray(o2.value) ? o2.value : [o2.value], n3 = Array.isArray(t5.value) ? t5.value : [t5.value];
667
+ if ((null == e4 ? void 0 : e4.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) l3 = this.evaluateMatrixPreconditional(t5, o2);
668
+ else switch (t5.typeOperator) {
669
+ case "EQUAL":
670
+ case "INQ":
671
+ l3 = i3.some(((e5) => n3.includes(e5)));
672
+ break;
673
+ case "NOEQUAL":
674
+ case "NINQ":
675
+ l3 = i3.every(((e5) => !n3.includes(e5)));
676
+ break;
677
+ case "GREATER":
678
+ l3 = i3.some(((e5) => Number(e5) > Number(n3[0])));
679
+ break;
680
+ case "LESS":
681
+ l3 = i3.some(((e5) => Number(e5) < Number(n3[0])));
682
+ break;
683
+ case "GREATEREQUAL":
684
+ l3 = i3.some(((e5) => Number(e5) >= Number(n3[0])));
685
+ break;
686
+ case "LESSEQUAL":
687
+ l3 = i3.some(((e5) => Number(e5) <= Number(n3[0])));
688
+ }
689
+ }
690
+ if (t5.transition === c.TransitionType.ALLOW) l3 || (a3 = false);
691
+ else if (t5.transition === c.TransitionType.NEXT && l3) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
692
+ }
693
+ if (t4 && !a3) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
694
+ }
695
+ n2.elements = (0, o.renderQuestions)(n2.questions, this.formOptionsConfig.questionFormat, null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.lang[0], null === (l2 = this.formData) || void 0 === l2 ? void 0 : l2.product, (() => this.send())), e3.innerHTML = "", null === (d2 = n2.elements) || void 0 === d2 || d2.forEach(((t4) => e3.appendChild(t4))), this.history.enqueue(n2), this.progress = this.total - this.graph.findMaxDepth(n2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: n2.isFollowup, completed: this.completed, error: null }));
696
+ }));
697
+ }
698
+ back() {
699
+ var e3;
700
+ return n(this, void 0, void 0, (function* () {
701
+ if (0 === this.history.size()) return;
702
+ const t3 = document.getElementById("magicfeedback-questions-" + this.appId);
703
+ t3 && t3.childNodes.length > 0 && (t3.innerHTML = ""), this.history.rollback();
704
+ const i2 = this.history.back();
705
+ i2 ? (null === (e3 = i2.elements) || void 0 === e3 || e3.forEach(((e4) => t3.appendChild(e4))), 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" }));
706
+ }));
707
+ }
708
+ previewQuestion(e3, t3, i2) {
709
+ var n2, r2;
710
+ const s2 = Array.isArray(t3) ? t3 : [t3];
711
+ if (!s2 || 0 === s2.length) throw new Error("[MagicFeedback] No question provided for preview");
712
+ const a2 = document.getElementById(e3);
713
+ if (!a2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
714
+ const { format: l2 = this.formOptionsConfig.questionFormat || "standard", language: d2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.lang) && this.formData.lang[0] || "en", product: c2 = (null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.product) || { customIcons: false }, clearContainer: u2 = true, wrap: p2 = true } = i2 || {};
715
+ u2 && (a2.innerHTML = "");
716
+ let m = [];
717
+ try {
718
+ m = (0, o.renderQuestions)(s2, l2, d2, c2);
719
+ } catch (e4) {
720
+ throw this.log.err(e4), e4;
721
+ }
722
+ let h = a2;
723
+ if (p2) {
724
+ const e4 = document.createElement("div");
725
+ e4.classList.add("magicfeedback-preview-question"), h.appendChild(e4), h = e4;
726
+ }
727
+ return m.forEach(((e4) => h.appendChild(e4))), a2;
728
+ }
729
+ parseMatrixAnswerPre(e3) {
730
+ if (!e3 || !e3.value) return [];
731
+ if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
732
+ const t3 = JSON.parse(e3.value[0]);
733
+ if (Array.isArray(t3)) return t3;
734
+ } catch (e4) {
735
+ return [];
736
+ }
737
+ 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 : [];
738
+ }
739
+ evaluateMatrixPreconditional(e3, t3) {
740
+ const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = this.parseMatrixAnswerPre(t3);
741
+ if (!r2.length) return false;
742
+ const s2 = n2.size > 0 ? r2.filter(((e4) => n2.has(e4.key))) : r2;
743
+ if (!s2.length) return false;
744
+ switch (e3.typeOperator) {
745
+ case "EQUAL":
746
+ case "INQ":
747
+ return s2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
748
+ case "NOEQUAL":
749
+ case "NINQ":
750
+ return s2.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
751
+ case "GREATER":
752
+ return s2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
753
+ case "LESS":
754
+ return s2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
755
+ case "GREATEREQUAL":
756
+ return s2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
757
+ case "LESSEQUAL":
758
+ return s2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
759
+ default:
760
+ return false;
761
+ }
762
+ }
763
+ };
764
+ }, 700: (e2, t2) => {
765
+ "use strict";
766
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.Page = void 0, t2.Page = class {
767
+ constructor(e3, t3, i, n, r) {
768
+ 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;
769
+ }
770
+ };
771
+ }, 989: (e2, t2, i) => {
772
+ "use strict";
773
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.PageGraph = void 0;
774
+ const n = i(636), r = i(558), s = i(591);
775
+ t2.PageGraph = class {
776
+ constructor(e3) {
777
+ this.nodes = /* @__PURE__ */ new Map(), this.buildGraph(e3);
778
+ }
779
+ buildGraph(e3) {
780
+ e3.forEach(((e4) => {
781
+ var t3;
782
+ e4.integrationPageRoutes && (e4.integrationPageRoutes = (null === (t3 = e4.integrationPageRoutes) || void 0 === t3 ? void 0 : t3.sort(((e5, t4) => {
783
+ const i3 = new Date((null == e5 ? void 0 : e5.generatedAt) || 0).getTime(), n2 = new Date((null == t4 ? void 0 : t4.generatedAt) || 0).getTime();
784
+ return i3 !== n2 ? i3 - n2 : "DIRECT" === e5.typeCondition && "DIRECT" !== t4.typeCondition ? 1 : "DIRECT" !== e5.typeCondition && "DIRECT" === t4.typeCondition ? -1 : 0;
785
+ }))) || []);
786
+ const i2 = new n.PageNode(e4.id, e4.position, e4.integrationPageRoutes || [], e4, e4.integrationQuestions);
787
+ this.nodes.set(i2.id, i2);
788
+ }));
789
+ }
790
+ getNodeById(e3) {
791
+ return this.nodes.get(e3);
792
+ }
793
+ getNextEdgeByDefault(e3) {
794
+ if (!e3) return;
795
+ const t3 = e3.edges.find(((e4) => e4.typeCondition === s.ConditionType.DIRECT));
796
+ if (!t3 || ![s.TransitionType.FINISH, s.TransitionType.REDIRECT].includes(t3.transition)) {
797
+ if (t3 && t3.transitionDestiny) return t3.transitionDestiny;
798
+ for (const t4 of this.nodes.values()) if (t4.position === e3.position + 1) return t4.id;
799
+ }
800
+ }
801
+ getFirstPage() {
802
+ let e3, t3 = Number.MAX_VALUE;
803
+ for (const i2 of this.nodes.values()) i2.position < t3 && (t3 = i2.position, e3 = i2);
804
+ return e3;
805
+ }
806
+ getNextPage(e3, t3) {
807
+ var i2;
808
+ if (!e3) return;
809
+ e3.edges.sort(((e4, t4) => "DIRECT" === e4.typeCondition ? 1 : "DIRECT" === t4.typeCondition ? -1 : 0));
810
+ const n2 = e3.edges.find(((i3) => {
811
+ const n3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)), a = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i3.questionRef));
812
+ if ("DIRECT" === i3.typeCondition) return true;
813
+ if (!a || 0 === a.length) return false;
814
+ if ((null == n3 ? void 0 : n3.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3, a);
815
+ const o = Array.isArray(i3.value) ? i3.value : [i3.value];
816
+ switch (i3.typeOperator) {
817
+ case s.OperatorType.EQUAL:
818
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
819
+ case s.OperatorType.NOEQUAL:
820
+ return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
821
+ case s.OperatorType.GREATER:
822
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) > Number(t4)))))));
823
+ case s.OperatorType.LESS:
824
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) < Number(t4)))))));
825
+ case s.OperatorType.GREATEREQUAL:
826
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) >= Number(t4)))))));
827
+ case s.OperatorType.LESSEQUAL:
828
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) <= Number(t4)))))));
829
+ case s.OperatorType.INQ:
830
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
831
+ case s.OperatorType.NINQ:
832
+ return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
833
+ default:
834
+ return false;
835
+ }
836
+ }));
837
+ if (!n2) {
838
+ const t4 = this.getNextEdgeByDefault(e3);
839
+ if (!t4) return;
840
+ return this.getNodeById(t4);
841
+ }
842
+ switch (n2.transition) {
843
+ case s.TransitionType.PAGE:
844
+ if (!n2.transitionDestiny) return;
845
+ return this.getNodeById(n2.transitionDestiny);
846
+ case s.TransitionType.FINISH:
847
+ return;
848
+ case s.TransitionType.REDIRECT:
849
+ 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}`);
850
+ default:
851
+ return;
852
+ }
853
+ }
854
+ findDepth(e3) {
855
+ const t3 = this.getNodeById(e3);
856
+ if (!t3) return 0;
857
+ const i2 = /* @__PURE__ */ new Set();
858
+ return this.DFSUtil(t3, i2, 0);
859
+ }
860
+ findMaxDepth(e3) {
861
+ if (e3 || (e3 = this.getFirstPage()), !e3) return 0;
862
+ const t3 = /* @__PURE__ */ new Set();
863
+ let i2 = 1;
864
+ return i2 = Math.max(i2, this.DFSUtil(e3, t3, i2)), i2;
865
+ }
866
+ DFSUtil(e3, t3, i2) {
867
+ t3.add(e3);
868
+ let n2 = i2;
869
+ const r2 = [...e3.edges.filter(((e4) => e4.typeCondition !== s.ConditionType.PRECONDITIONAL)) || []], a = this.getNextEdgeByDefault(e3);
870
+ if (a) {
871
+ const i3 = this.getNodeById(a);
872
+ i3 && !t3.has(i3) && r2.push(new s.PageRoute(i3.id, "", s.OperatorType.DEFAULT, [""], s.TransitionType.PAGE, i3.id, e3.id));
873
+ }
874
+ for (const e4 of r2) {
875
+ if (!e4.transitionDestiny) continue;
876
+ const r3 = this.getNodeById(e4.transitionDestiny);
877
+ if (r3 && !t3.has(r3)) {
878
+ const e5 = i2 + 1, s2 = new Set(t3), a2 = this.DFSUtil(r3, s2, e5);
879
+ n2 = Math.max(n2, a2);
880
+ }
881
+ }
882
+ return n2;
883
+ }
884
+ parseMatrixAnswer(e3) {
885
+ if (!e3 || !e3.value) return [];
886
+ if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
887
+ const t3 = JSON.parse(e3.value[0]);
888
+ if (Array.isArray(t3)) return t3;
889
+ } catch (e4) {
890
+ return [];
891
+ }
892
+ 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 : [];
893
+ }
894
+ evaluateMatrixCondition(e3, t3) {
895
+ const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = t3[0], a = this.parseMatrixAnswer(r2);
896
+ if (!a.length) return false;
897
+ const o = n2.size > 0 ? a.filter(((e4) => n2.has(e4.key))) : a;
898
+ if (!o.length) return false;
899
+ switch (e3.typeOperator) {
900
+ case s.OperatorType.EQUAL:
901
+ case s.OperatorType.INQ:
902
+ return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
903
+ case s.OperatorType.NOEQUAL:
904
+ case s.OperatorType.NINQ:
905
+ return o.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
906
+ case s.OperatorType.GREATER:
907
+ return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
908
+ case s.OperatorType.LESS:
909
+ return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
910
+ case s.OperatorType.GREATEREQUAL:
911
+ return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
912
+ case s.OperatorType.LESSEQUAL:
913
+ return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
914
+ default:
915
+ return false;
916
+ }
917
+ }
918
+ };
919
+ }, 636: (e2, t2) => {
920
+ "use strict";
921
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.PageNode = void 0, t2.PageNode = class {
922
+ constructor(e3, t3, i, n, r, s = false) {
923
+ 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 = s;
924
+ }
925
+ getFollowupQuestions() {
926
+ return this.questions.filter(((e3) => e3.followup)).map(((e3) => e3.ref));
927
+ }
928
+ getRequiredQuestions() {
929
+ return this.questions.filter(((e3) => e3.require)).map(((e3) => e3.ref));
930
+ }
931
+ setAnswer(e3) {
932
+ this.answers = e3;
933
+ }
934
+ };
935
+ }, 591: (e2, t2) => {
936
+ "use strict";
937
+ var i, n, r, s;
938
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.PageRoute = t2.StatusType = t2.OperatorType = t2.ConditionType = t2.TransitionType = void 0, (s = t2.TransitionType || (t2.TransitionType = {})).PAGE = "PAGE", s.FINISH = "FINISH", s.REDIRECT = "REDIRECT", s.NEXT = "NEXT", s.ALLOW = "ALLOW", (function(e3) {
939
+ e3.LOGICAL = "LOGICAL", e3.DIRECT = "DIRECT", e3.PRECONDITIONAL = "PRECONDITIONAL";
940
+ })(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) {
941
+ e3.ACTIVE = "ACTIVE", e3.DEPRECATED = "DEPRECATED", e3.DELETE = "DELETE";
942
+ })(n = t2.StatusType || (t2.StatusType = {})), t2.PageRoute = class {
943
+ constructor(e3, t3, r2, s2, a, o, l, d, c, u) {
944
+ this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = r2, this.value = s2 || [], this.transition = a, this.transitionDestiny = o, this.status = n.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
945
+ }
946
+ };
947
+ }, 558: (e2, t2) => {
948
+ "use strict";
949
+ var i, n;
950
+ Object.defineProperty(t2, "__esModule", { value: true }), 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", t2.QuestionType = class {
951
+ }, (function(e3) {
952
+ e3.FORM = "form", e3.DIV = "div";
953
+ })(i || (i = {}));
954
+ }, 516: (e2, t2) => {
955
+ "use strict";
956
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.getUrlParam = t2.getBooleanOptions = t2.parseTitle = void 0, t2.parseTitle = function(e3, t3) {
957
+ return e3 ? "object" == typeof e3 ? e3[t3] || e3.en : e3 : "";
958
+ }, t2.getBooleanOptions = function(e3) {
959
+ switch (e3) {
960
+ case "es":
961
+ return ["S\xED", "No"];
962
+ case "fr":
963
+ return ["Oui", "Non"];
964
+ case "de":
965
+ return ["Ja", "Nein"];
966
+ case "it":
967
+ return ["S\xEC", "No"];
968
+ case "pt":
969
+ return ["Sim", "N\xE3o"];
970
+ case "nl":
971
+ return ["Ja", "Nee"];
972
+ case "pl":
973
+ return ["Tak", "Nie"];
974
+ case "ru":
975
+ return ["\u0414\u0430", "\u041D\u0435\u0442"];
976
+ case "ja":
977
+ return ["\u306F\u3044", "\u3044\u3044\u3048"];
978
+ case "zh":
979
+ return ["\u662F", "\u4E0D"];
980
+ case "ko":
981
+ return ["\uC608", "\uC544\uB2C8"];
982
+ case "da":
983
+ case "sv":
984
+ return ["Ja", "Nej"];
985
+ case "fi":
986
+ return ["Kyll\xE4", "Ei"];
987
+ case "no":
988
+ return ["Ja", "Nei"];
989
+ case "ar":
990
+ return ["\u0646\u0639\u0645", "\u0644\u0627"];
991
+ case "bn":
992
+ return ["\u09B9\u09CD\u09AF\u09BE\u0981", "\u09A8\u09BE"];
993
+ default:
994
+ return ["Yes", "No"];
995
+ }
996
+ }, t2.getUrlParam = function(e3) {
997
+ return new URLSearchParams(window.location.search).get(e3);
998
+ };
999
+ }, 559: (e2, t2) => {
1000
+ "use strict";
1001
+ function i(e3, t3, i2, n, r = false, s = true, a = "ltr", o = "row") {
1002
+ const l = document.createElement("div");
1003
+ l.classList.add("magicfeedback-rating-placeholder"), l.style.display = "flex", l.style.flexDirection = o, l.style.alignItems = "center", l.style.justifyContent = "space-between", l.style.width = r ? `calc(100% - (100% / ${t3 + 1}))` : "100%", l.style.marginRight = "auto", s && window.innerWidth < 600 && (l.style.flexDirection = "column");
1004
+ const d = document.createElement("span");
1005
+ d.textContent = null != i2 ? i2 : null, d.classList.add("magicfeedback-rating-placeholder-value"), d.style.fontSize = "15px", d.style.display = "block", d.style.minWidth = "0", d.style.overflowWrap = "anywhere", d.style.wordBreak = "break-word", d.style.textAlign = "ltr" === a ? "left" : "right", d.style.width = "50%", (s && window.innerWidth < 600 || "column" === o) && (d.textContent = `${e3} = ${i2}`, d.style.width = "100%", d.style.textAlign = "left", d.style.marginBottom = "5px");
1006
+ const c = document.createElement("span");
1007
+ return c.textContent = null != n ? n : null, c.classList.add("magicfeedback-rating-placeholder-value"), c.style.fontSize = "15px", c.style.display = "block", c.style.minWidth = "0", c.style.overflowWrap = "anywhere", c.style.wordBreak = "break-word", c.style.textAlign = "ltr" === a ? "right" : "left", c.style.width = "50%", (s && window.innerWidth < 600 || "column" === o) && (c.textContent = `${t3} = ${n}`, c.style.width = "100%", c.style.textAlign = "left", c.style.marginBottom = "5px"), "ltr" === a ? (i2 && l.appendChild(d), n && l.appendChild(c)) : (n && l.appendChild(c), i2 && l.appendChild(d)), l;
1008
+ }
1009
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.createRatingNumberElement = t2.createStarRating = t2.createRatingPlaceholder = void 0, t2.createRatingPlaceholder = i, t2.createStarRating = function(e3, t3, n, r = () => {
1010
+ }, s) {
1011
+ const a = "magicfeedback-rating-star-selected", o = document.createElement("div");
1012
+ o.classList.add("magicfeedback-rating-star-container"), o.style.maxWidth = "300px", o.style.margin = "auto", o.dataset.originalSelection = "0";
1013
+ for (let t4 = 1; t4 <= 5; t4++) {
1014
+ const i2 = document.createElement("label");
1015
+ i2.classList.add("magicfeedback-rating-star-option");
1016
+ const n2 = document.createElement("input");
1017
+ n2.id = `rating-${e3}-${t4}`, n2.type = "radio", n2.name = e3, n2.value = t4.toString(), n2.style.position = "absolute", n2.style.opacity = "0", n2.style.width = "0", n2.style.height = "0", n2.classList.add("magicfeedback-input"), s && s === n2.value && (n2.checked = true), n2.addEventListener("change", (() => {
1018
+ const e4 = o.querySelectorAll(".rating__star");
1019
+ for (let t5 = 0; t5 < e4.length; t5++) t5 + 1 <= Number(n2.value) ? e4[t5].classList.contains(a) || e4[t5].classList.add(a) : e4[t5].classList.contains(a) && e4[t5].classList.remove(a);
1020
+ o.dataset.originalSelection = n2.value, r && r();
1021
+ })), i2.appendChild(n2);
1022
+ const l2 = document.createElement("label");
1023
+ l2.htmlFor = `rating-${e3}-${t4}`, l2.classList.add("rating__star"), l2.textContent = "\u2605", l2.style.fontSize = "40px", l2.style.color = "#CCCCCC", l2.style.cursor = "pointer", l2.addEventListener("mouseenter", (() => {
1024
+ const e4 = o.querySelectorAll(".rating__star"), i3 = t4 - 1;
1025
+ e4.forEach(((e5, t5) => {
1026
+ t5 <= i3 ? e5.classList.contains(a) || e5.classList.add(a) : e5.classList.contains(a) && e5.classList.remove(a);
1027
+ }));
1028
+ })), l2.addEventListener("mouseleave", (() => {
1029
+ const e4 = Number(o.dataset.originalSelection || "0");
1030
+ o.querySelectorAll(".rating__star").forEach(((t5, i3) => {
1031
+ i3 < e4 ? t5.classList.contains(a) || t5.classList.add(a) : t5.classList.contains(a) && t5.classList.remove(a);
1032
+ }));
1033
+ })), i2.appendChild(l2), o.appendChild(i2);
1034
+ }
1035
+ const l = i(1, 5, t3, n, false, false);
1036
+ return l.childElementCount > 0 && (o.classList.add("magicfeedback-rating-container--with-placeholder"), o.insertBefore(l, o.firstChild)), o;
1037
+ }, t2.createRatingNumberElement = function(e3, t3, n, r, s, a, o, l) {
1038
+ var d;
1039
+ const c = document.createElement("div");
1040
+ c.classList.add("magicfeedback-rating-number");
1041
+ const u = "ltr" === n ? r : `${r}-reverse`, p = document.createElement("div");
1042
+ p.classList.add("magicfeedback-rating-number-container"), p.classList.add(`magicfeedback-rating-number-container-${n}`), p.classList.add(`magicfeedback-rating-number-container-${r}`), p.style.display = "flex", p.style.flexDirection = u, p.setAttribute("role", "radiogroup"), p.setAttribute("aria-label", (null == t3 ? void 0 : t3.ariaLabel) || "Rating");
1043
+ const m = (null == t3 ? void 0 : t3.max) ? Number(null == t3 ? void 0 : t3.max) : 10, h = (null == t3 ? void 0 : t3.min) ? Number(null == t3 ? void 0 : t3.min) : 0, f = (null == t3 ? void 0 : t3.numberPlaceholders) || null, v = !(s || "column" === r) && ((null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder));
1044
+ if (v) {
1045
+ const e4 = i(h, m, null == t3 ? void 0 : t3.minPlaceholder, null == t3 ? void 0 : t3.maxPlaceholder, null !== (d = null == t3 ? void 0 : t3.extraOption) && void 0 !== d && d, false, n, "row");
1046
+ e4.childElementCount > 0 && (p.classList.add("magicfeedback-rating-number-container--with-placeholder"), p.insertBefore(e4, p.firstChild));
1047
+ }
1048
+ for (let i2 = h; i2 <= m; i2++) {
1049
+ const n2 = document.createElement("div");
1050
+ n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add(`magicfeedback-rating-number-option-${r}`);
1051
+ const d2 = document.createElement("label");
1052
+ d2.htmlFor = `rating-${e3}-${i2}`, d2.classList.add("magicfeedback-rating-number-option-label-container");
1053
+ let c2 = i2.toString();
1054
+ v ? f && f[i2] && !s && (d2.title = f[i2]) : f && f[i2] ? c2 += ` = ${f[i2]}` : i2 === h && (null == t3 ? void 0 : t3.minPlaceholder) ? c2 += ` = ${null == t3 ? void 0 : t3.minPlaceholder}` : i2 === m && (null == t3 ? void 0 : t3.maxPlaceholder) && (c2 += ` = ${null == t3 ? void 0 : t3.maxPlaceholder}`);
1055
+ const u2 = document.createElement("input");
1056
+ u2.id = `rating-${e3}-${i2}`, u2.type = "radio", u2.name = e3, u2.value = i2.toString(), u2.classList.add(a), u2.classList.add("magicfeedback-input"), u2.setAttribute("aria-label", `${i2}`), o && u2.addEventListener("change", (() => o())), l && l === u2.value && (u2.checked = true);
1057
+ const g = document.createElement("label");
1058
+ g.htmlFor = `rating-${e3}-${i2}`, g.textContent = c2, g.classList.add("magicfeedback-rating-number-value"), d2.appendChild(u2), d2.appendChild(g), n2.appendChild(d2), p.appendChild(n2);
1059
+ }
1060
+ if ((null == t3 ? void 0 : t3.extraOption) && (null == t3 ? void 0 : t3.extraOptionText)) {
1061
+ const i2 = document.createElement("div");
1062
+ i2.classList.add("magicfeedback-rating-number-option");
1063
+ const r2 = document.createElement("label");
1064
+ r2.htmlFor = `rating-${e3}-extra`, r2.classList.add("magicfeedback-rating-number-option-label-container");
1065
+ const s2 = document.createElement("input");
1066
+ s2.id = `rating-${e3}-extra`, s2.type = "radio", s2.name = e3, s2.value = "-", s2.classList.add(a), s2.classList.add("magicfeedback-input"), s2.setAttribute("aria-label", null == t3 ? void 0 : t3.extraOptionText), o && s2.addEventListener("change", (() => o()));
1067
+ const l2 = document.createElement("label");
1068
+ l2.htmlFor = `rating-${e3}-extra`, l2.textContent = null == t3 ? void 0 : t3.extraOptionText, l2.classList.add("magicfeedback-rating-number-value"), r2.appendChild(s2), r2.appendChild(l2), i2.appendChild(r2), "ltr" === n ? p.appendChild(i2) : p.insertBefore(i2, p.firstChild);
1069
+ }
1070
+ return c.appendChild(p), c;
1071
+ };
1072
+ }, 42: (e2, t2, i) => {
1073
+ "use strict";
1074
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.getQuestionRenderer = void 0;
1075
+ const n = i(558), r = i(998), s = i(72), a = i(732), o = i(90), l = i(65), d = i(85), c = i(817), u = i(965), p = i(180), m = i(991), h = i(152), f = i(917), v = i(452), g = i(644), y = i(773), b = i(66), E = i(843), k = i(250), A = i(409), C = i(282), T = /* @__PURE__ */ new Map([[n.FEEDBACKAPPANSWERTYPE.TEXT, o.renderText], [n.FEEDBACKAPPANSWERTYPE.LONGTEXT, s.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, v.renderRatingStar], [n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX, g.renderMatrix], [n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST, y.renderPriorityList], [n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM, b.renderPointSystem], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, E.renderUploadImage], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, k.renderUploadFile], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, A.renderMultipleChoiceImage], [n.FEEDBACKAPPANSWERTYPE.INFO_PAGE, C.renderInfoPage]]);
1076
+ t2.getQuestionRenderer = function(e3) {
1077
+ return T.get(e3);
1078
+ };
1079
+ }, 65: (e2, t2, i) => {
1080
+ "use strict";
1081
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderBoolean = void 0;
1082
+ const n = i(516);
1083
+ t2.renderBoolean = ({ question: e3, language: t3, urlParamValue: i2, send: r }) => {
1084
+ const { ref: s, assets: a } = e3, o = document.createElement("div"), l = "magicfeedback-radio", d = document.createElement("div");
1085
+ return d.classList.add("magicfeedback-boolean-container"), d.style.display = "flex", d.style.flexDirection = "row", d.style.justifyContent = "space-between", d.style.width = "70%", d.style.margin = "auto", ((null == a ? void 0 : a.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (0, n.getBooleanOptions)(t3)).forEach(((e4, t4) => {
1086
+ const n2 = document.createElement("label");
1087
+ n2.classList.add("magicfeedback-boolean-option"), n2.htmlFor = `rating-${s}-${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";
1088
+ const a2 = document.createElement("label");
1089
+ a2.htmlFor = `rating-${s}-${t4}`, a2.textContent = e4, a2.style.margin = "0", a2.style.padding = "0";
1090
+ const o2 = document.createElement("input");
1091
+ o2.id = `rating-${s}-${t4}`, o2.type = "radio", o2.name = s, o2.value = ["Yes", "No"][t4], o2.classList.add(l), o2.classList.add("magicfeedback-input"), o2.style.position = "absolute", o2.style.opacity = "0", o2.style.width = "0", o2.style.height = "0", o2.style.margin = "0", o2.addEventListener("change", (() => {
1092
+ r && r();
1093
+ })), i2 && i2.toLowerCase() === o2.value.toLowerCase() && (o2.checked = true), n2.appendChild(o2), n2.appendChild(a2), d.appendChild(n2);
1094
+ })), o.appendChild(d), { element: o, elementTypeClass: l };
1095
+ };
1096
+ }, 998: (e2, t2, i) => {
1097
+ "use strict";
1098
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderChoice = void 0;
1099
+ const n = i(558), r = i(784);
1100
+ t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: s, send: a }) => {
1101
+ const { type: o, ref: l, value: d, defaultValue: c, assets: u } = e3, p = document.createElement("div"), m = "magicfeedback-" + ("MULTIPLECHOICE" === o ? "checkbox" : "radio");
1102
+ let h = d || [];
1103
+ s && (h = h.sort((() => Math.random() - 0.5)));
1104
+ let f = (null == u ? void 0 : u.exclusiveAnswers) || [];
1105
+ (null == u ? void 0 : u.extraOption) && (f = f.filter(((e4) => e4 !== u.extraOptionText))), f.length > 0 && (null == f || f.forEach(((e4) => {
1106
+ h.includes(e4) || h.push(e4);
1107
+ })));
1108
+ const v = null == u ? void 0 : u.extraOptionText;
1109
+ return (null == u ? void 0 : u.extraOption) && v && !h.includes(v) && h.push(v), h.forEach(((e4, s2) => {
1110
+ const d2 = document.createElement("div");
1111
+ d2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === o ? "checkbox" : "radio"}-container`);
1112
+ const v2 = document.createElement("label"), g = document.createElement("input");
1113
+ if (g.id = `rating-${l}-${s2}`, g.type = "MULTIPLECHOICE" === o ? "checkbox" : "radio", g.name = l, g.value = e4, g.classList.add(m), g.classList.add("magicfeedback-input"), o === n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == u ? void 0 : u.maxOptions) && (null == u ? void 0 : u.maxOptions) > 0 && g.addEventListener("change", (() => {
1114
+ document.querySelectorAll(`input[name="${l}"]:checked`).length > (null == u ? void 0 : u.maxOptions) && (g.checked = false);
1115
+ })), o === n.FEEDBACKAPPANSWERTYPE.RADIO && a && (!(null == u ? void 0 : u.extraOptionText) || (null == u ? void 0 : u.extraOptionText) && e4 !== (null == u ? void 0 : u.extraOptionText)) && g.addEventListener("change", (() => {
1116
+ a();
1117
+ })), e4 !== c && e4 !== i2 || (g.checked = true), v2.textContent = e4, v2.htmlFor = `rating-${l}-${s2}`, g.addEventListener("change", ((t4) => {
1118
+ const i3 = document.getElementById(`extra-option-${l}`);
1119
+ t4.target.checked && f.includes(e4) ? (h.forEach(((t5) => {
1120
+ t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1121
+ })), i3 && (i3.style.display = "none")) : f.forEach(((t5) => {
1122
+ t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1123
+ })), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText) && i3 && (i3.style.display = t4.target.checked ? "block" : "none");
1124
+ })), d2.appendChild(g), d2.appendChild(v2), p.appendChild(d2), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText)) {
1125
+ const e5 = document.createElement("input");
1126
+ e5.type = "text", e5.placeholder = (null == u ? void 0 : u.extraOptionPlaceholder) || r.placeholder.answer(t3 || "en"), e5.classList.add("magicfeedback-extra-option"), e5.classList.add("magicfeedback-input"), e5.id = `extra-option-${l}`, e5.name = `extra-option-${l}`, e5.style.display = "none", p.appendChild(e5);
1127
+ }
1128
+ })), { element: p, elementTypeClass: m };
1129
+ };
1130
+ }, 991: (e2, t2) => {
1131
+ "use strict";
1132
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderConsent = void 0, t2.renderConsent = ({ question: e3, urlParamValue: t3, send: i }) => {
1133
+ const { id: n, ref: r, value: s, require: a } = e3, o = document.createElement("input");
1134
+ return o.type = "checkbox", o.id = `magicfeedback-${n}`, o.name = r, o.value = "true", o.required = a, o.classList.add("magicfeedback-consent"), o.classList.add("magicfeedback-input"), t3 && s.includes(t3) && (o.checked = true), i && o.addEventListener("change", (() => {
1135
+ i();
1136
+ })), { element: o, elementTypeClass: "magicfeedback-consent" };
1137
+ };
1138
+ }, 817: (e2, t2, i) => {
1139
+ "use strict";
1140
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderDate = void 0;
1141
+ const n = i(784);
1142
+ t2.renderDate = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1143
+ const r = document.createElement("input");
1144
+ return r.type = "date", r.placeholder = t3 || n.placeholder.date(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-date" };
1145
+ };
1146
+ }, 965: (e2, t2) => {
1147
+ "use strict";
1148
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderEmail = void 0, t2.renderEmail = ({ placeholderText: e3, urlParamValue: t3 }) => {
1149
+ const i = document.createElement("input");
1150
+ return i.type = "email", i.placeholder = e3 || "you@example.com", t3 && (i.value = t3), { element: i, elementTypeClass: "magicfeedback-email" };
1151
+ };
1152
+ }, 282: (e2, t2) => {
1153
+ "use strict";
1154
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderInfoPage = void 0, t2.renderInfoPage = ({ question: e3, placeholderText: t3 }) => {
1155
+ var i, n;
1156
+ const r = document.createElement("div");
1157
+ 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)) {
1158
+ const e4 = document.createElement("div");
1159
+ e4.classList.add("magicfeedback-info-message"), e4.innerHTML = t3 || "", r.appendChild(e4);
1160
+ }
1161
+ return { element: r, elementTypeClass: "magicfeedback-info-page" };
1162
+ };
1163
+ }, 72: (e2, t2, i) => {
1164
+ "use strict";
1165
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderLongText = void 0;
1166
+ const n = i(784);
1167
+ t2.renderLongText = ({ language: e3, placeholderText: t3, urlParamValue: i2, maxCharacters: r }) => {
1168
+ const s = document.createElement("textarea");
1169
+ return s.rows = 3, r > 0 && (s.maxLength = r), s.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (s.value = i2), { element: s, elementTypeClass: "magicfeedback-longtext" };
1170
+ };
1171
+ }, 644: (e2, t2) => {
1172
+ "use strict";
1173
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMatrix = void 0, t2.renderMatrix = ({ question: e3, isPhone: t3, randomPosition: i }) => {
1174
+ const { ref: n, value: r, assets: s } = e3, a = document.createElement("div"), o = document.createElement("div");
1175
+ o.classList.add("magicfeedback-multi-question-matrix-container");
1176
+ let l = (null == s ? void 0 : s.options) || [], d = [...r], c = [];
1177
+ if (i && (l = null == l ? void 0 : l.sort((() => Math.random() - 0.5)), d = [...d].sort((() => Math.random() - 0.5))), (null == s ? void 0 : s.exclusiveAnswers) && (c = null == s ? void 0 : s.exclusiveAnswers, null == c || c.forEach(((e4) => {
1178
+ d.includes(e4) || d.push(e4);
1179
+ }))), t3) {
1180
+ const e4 = document.createElement("div");
1181
+ e4.classList.add("magicfeedback-multi-question-matrix-list"), null == l || l.forEach(((t4) => {
1182
+ const i2 = document.createElement("div");
1183
+ 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";
1184
+ const r2 = document.createElement("label");
1185
+ r2.classList.add("magicfeedback-multi-question-matrix-label"), r2.style.paddingBottom = "10px", r2.textContent = t4, i2.appendChild(r2), d.forEach(((e5) => {
1186
+ const r3 = document.createElement("div");
1187
+ 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";
1188
+ const s2 = document.createElement("label"), a2 = document.createElement("input");
1189
+ a2.id = `${n}-${t4}-${e5}`, a2.type = "radio", a2.name = `${n}-${t4}`, a2.value = e5, a2.classList.add("magicfeedback-input"), s2.textContent = e5, s2.htmlFor = `${n}-${t4}-${e5}`, r3.appendChild(a2), r3.appendChild(s2), i2.appendChild(r3);
1190
+ })), e4.appendChild(i2);
1191
+ })), o.appendChild(e4);
1192
+ } else {
1193
+ const e4 = document.createElement("table");
1194
+ e4.classList.add("magicfeedback-multi-question-matrix-table");
1195
+ const t4 = document.createElement("thead");
1196
+ t4.classList.add("magicfeedback-multi-question-matrix-header"), t4.style.paddingBottom = "15px";
1197
+ const i2 = document.createElement("tr"), r2 = document.createElement("th");
1198
+ i2.appendChild(r2), d.forEach(((e5) => {
1199
+ const t5 = document.createElement("th");
1200
+ t5.textContent = e5, i2.appendChild(t5);
1201
+ })), t4.appendChild(i2), e4.appendChild(t4);
1202
+ const s2 = document.createElement("tbody");
1203
+ null == l || l.forEach(((e5) => {
1204
+ const t5 = document.createElement("tr");
1205
+ t5.classList.add("magicfeedback-multi-question-matrix-row-tr");
1206
+ const i3 = document.createElement("td");
1207
+ i3.style.minWidth = "200px", i3.style.padding = "10px";
1208
+ const r3 = document.createElement("label");
1209
+ r3.classList.add("magicfeedback-multi-question-matrix-label"), r3.textContent = e5, i3.appendChild(r3), t5.appendChild(i3), d.forEach(((i4) => {
1210
+ const r4 = document.createElement("td"), s3 = document.createElement("input");
1211
+ s3.type = "radio", s3.name = `${n}-${e5}`, s3.value = i4, s3.id = `${n}-${e5}-${i4}`, s3.classList.add("magicfeedback-input"), r4.appendChild(s3), t5.appendChild(r4);
1212
+ })), s2.appendChild(t5);
1213
+ })), e4.appendChild(s2), o.appendChild(e4);
1214
+ }
1215
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-multi-question-matrix" };
1216
+ };
1217
+ }, 409: (e2, t2) => {
1218
+ "use strict";
1219
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMultipleChoiceImage = void 0, t2.renderMultipleChoiceImage = ({ question: e3, randomPosition: t3, urlParamValue: i, send: n }) => {
1220
+ const r = document.createElement("div"), { ref: s, assets: a } = e3;
1221
+ let o = [...e3.value];
1222
+ const l = document.createElement("div");
1223
+ l.classList.add("magicfeedback-multiple-choice-image-container"), l.style.display = "flex", l.style.flexDirection = "row", l.style.flexWrap = "wrap", l.style.justifyContent = "center";
1224
+ const d = o.length;
1225
+ let c = 1, u = 1;
1226
+ if (window.innerWidth < 600) c = 1, u = d;
1227
+ else switch (d) {
1228
+ case 1:
1229
+ case 2:
1230
+ case 3:
1231
+ c = d, u = 1;
1232
+ break;
1233
+ case 4:
1234
+ case 5:
1235
+ case 6:
1236
+ u = 2, c = Math.ceil(d / u);
1237
+ break;
1238
+ case 7:
1239
+ case 8:
1240
+ case 9:
1241
+ u = 3, c = Math.ceil(d / u);
1242
+ break;
1243
+ default:
1244
+ u = 4, c = Math.ceil(d / u);
1245
+ }
1246
+ const p = void 0 !== (null == a ? void 0 : a.addTitle) && (null == a ? void 0 : a.addTitle), m = void 0 !== (null == a ? void 0 : a.multiOption) && (null == a ? void 0 : a.multiOption), h = void 0 !== (null == a ? void 0 : a.extraOption) && (null == a ? void 0 : a.extraOption);
1247
+ function f(e4) {
1248
+ try {
1249
+ const { position: t4, url: r2, value: a2 } = e4, o2 = document.createElement("div");
1250
+ o2.classList.add("magicfeedback-multiple-choice-image-option"), o2.style.width = `calc(100% / ${c} - 2px)`, o2.style.height = `calc(100% / ${u} - 2px)`, o2.style.padding = "8px", o2.style.margin = "0";
1251
+ const d2 = document.createElement("label");
1252
+ d2.classList.add("magicfeedback-image-option-label-container"), d2.htmlFor = `rating-${s}-${t4}`, d2.style.cursor = "pointer", d2.addEventListener("click", (() => {
1253
+ d2.style.border = "2px solid #000";
1254
+ }));
1255
+ const h2 = document.createElement("label");
1256
+ h2.textContent = a2, h2.classList.add("magicfeedback-multiple-choice-image-label");
1257
+ const f2 = document.createElement("input");
1258
+ f2.id = `rating-${s}-${t4}`, f2.type = m ? "checkbox" : "radio", f2.name = s, f2.value = a2, f2.style.position = "absolute", f2.style.opacity = "0", f2.style.width = "0", f2.style.height = "0", f2.classList.add("magicfeedback-input"), i && i === f2.value && (f2.checked = true), !m && n && f2.addEventListener("change", (() => {
1259
+ n();
1260
+ }));
1261
+ const v = document.createElement("img");
1262
+ v.classList.add("magicfeedback-multiple-choice-image-image"), v.src = r2, v.style.cursor = "pointer", v.style.backgroundSize = "cover", v.style.backgroundPosition = "center", v.style.width = "100%", v.style.height = "100%", v.style.objectFit = "cover", v.style.margin = "auto", d2.appendChild(f2), d2.appendChild(v), p && d2.appendChild(h2), o2.appendChild(d2), l.appendChild(o2);
1263
+ } catch (e5) {
1264
+ console.error(e5);
1265
+ }
1266
+ }
1267
+ return t3 && (o = o.sort((() => Math.random() - 0.5))), o.forEach(((e4) => f(JSON.parse(e4)))), h && (null == a ? void 0 : a.extraOptionValue) && (null == a ? void 0 : a.extraOptionValue.length) > 0 && f(null == a ? void 0 : a.extraOptionValue[0]), r.appendChild(l), { element: r, elementTypeClass: "magicfeedback-multiple-choice-image" };
1268
+ };
1269
+ }, 732: (e2, t2, i) => {
1270
+ "use strict";
1271
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderNumber = void 0;
1272
+ const n = i(784), r = i(516);
1273
+ t2.renderNumber = ({ question: e3, format: t3, language: i2, urlParamValue: s }) => {
1274
+ const a = document.createElement("input");
1275
+ a.type = "number", a.placeholder = "slim" === t3 ? (0, r.parseTitle)(e3.title, i2) : n.placeholder.number(i2 || "en");
1276
+ const { value: o } = e3;
1277
+ return o.length && (o.sort(((e4, t4) => Number(e4) - Number(t4))), a.max = o[o.length - 1], a.min = o[0], a.value = o[0]), s && !isNaN(Number(s)) && (a.value = s), { element: a, elementTypeClass: "magicfeedback-number" };
1278
+ };
1279
+ }, 180: (e2, t2, i) => {
1280
+ "use strict";
1281
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPassword = void 0;
1282
+ const n = i(784);
1283
+ t2.renderPassword = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1284
+ const r = document.createElement("input");
1285
+ return r.type = "password", r.placeholder = t3 || n.placeholder.password(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-password" };
1286
+ };
1287
+ }, 66: (e2, t2, i) => {
1288
+ "use strict";
1289
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPointSystem = void 0;
1290
+ const n = i(784);
1291
+ t2.renderPointSystem = ({ question: e3, language: t3 }) => {
1292
+ const { ref: i2, value: r } = e3, s = document.createElement("div"), a = document.createElement("div");
1293
+ a.classList.add("magicfeedback-point-system-container");
1294
+ const o = document.createElement("ul");
1295
+ o.classList.add("magicfeedback-point-system-list"), o.style.padding = "0";
1296
+ const l = 100 / r.length, d = document.createElement("div");
1297
+ d.classList.add("magicfeedback-error"), d.textContent = n.placeholder.pointsystemerror(t3 || "en"), d.style.color = "#C70039", d.style.fontSize = "14px", d.style.textAlign = "right", d.style.width = "100%", d.style.display = "none";
1298
+ const c = document.createElement("div");
1299
+ return c.classList.add("magicfeedback-point-system-total"), c.textContent = "0 / 100 %", c.style.textAlign = "right", c.style.fontSize = "15px", c.style.marginTop = "5px", r.forEach(((e4, t4) => {
1300
+ const n2 = document.createElement("li");
1301
+ n2.classList.add("magicfeedback-point-system-item"), n2.style.display = "flex", n2.style.justifyContent = "space-between", n2.style.alignItems = "center", n2.style.margin = "5px";
1302
+ const r2 = document.createElement("label");
1303
+ r2.textContent = e4, r2.style.fontSize = "15px", n2.appendChild(r2);
1304
+ const s2 = document.createElement("span");
1305
+ s2.classList.add("magicfeedback-point-system-input-container");
1306
+ const a2 = document.createElement("input");
1307
+ 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;
1308
+ const u = document.createElement("span");
1309
+ u.textContent = "%", u.style.color = "#000", a2.addEventListener("input", (() => {
1310
+ const e5 = o.querySelectorAll("input");
1311
+ let t5 = 0;
1312
+ e5.forEach(((e6) => {
1313
+ t5 += Number(e6.value);
1314
+ })), t5 > 100 && (a2.value = `${l}%`, t5 -= Number(a2.value));
1315
+ const i3 = document.getElementById("magicfeedback-submit");
1316
+ i3 && (t5 < 100 ? (c.style.color = "orange", i3.setAttribute("disabled", "true")) : (d.style.display = "none", c.style.color = "green", i3.removeAttribute("disabled"))), c.textContent = `${t5} / 100 %`;
1317
+ })), a2.addEventListener("focus", (() => {
1318
+ const e5 = document.getElementById("magicfeedback-submit");
1319
+ e5 && (e5.setAttribute("disabled", "true"), e5.addEventListener("pointerover", (() => {
1320
+ const e6 = o.querySelectorAll("input");
1321
+ let t5 = 0;
1322
+ e6.forEach(((e7) => {
1323
+ t5 += Number(e7.value);
1324
+ })), t5 < 100 && (d.style.display = "block");
1325
+ })));
1326
+ })), s2.appendChild(a2), s2.appendChild(u), n2.appendChild(s2), o.appendChild(n2);
1327
+ })), a.appendChild(o), a.appendChild(c), a.appendChild(d), s.appendChild(a), { element: s, elementTypeClass: "magicfeedback-point-system" };
1328
+ };
1329
+ }, 773: (e2, t2) => {
1330
+ "use strict";
1331
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPriorityList = void 0, t2.renderPriorityList = ({ question: e3, randomPosition: t3, language: i }) => {
1332
+ var n, r, s;
1333
+ const a = document.createElement("div"), o = (function(e4) {
1334
+ const { value: t4, ref: i2, randomPosition: n2 = false, limitPriority: r2 = false, maxPriority: s2 = 0, language: a2 = "en", placeholder: o2 = "" } = e4, l = (e5) => {
1335
+ const t5 = { en: { selectUpTo: "Select up to", options: "options", thenOrder: "and then order them", selectOptions: "Select options", cancel: "Cancel", confirm: "Confirm", selectOptionNumber: "Select option #", prioritized: "Prioritized", of: "of", 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." }, es: { selectUpTo: "Selecciona hasta", options: "opciones", thenOrder: "y luego ord\xE9nalas", selectOptions: "Seleccionar opciones", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecciona la opci\xF3n #", prioritized: "Priorizadas", of: "de", instruction: 'Tu lista priorizada se muestra abajo. Si deseas, puedes reordenar las opciones con las flechas. Haz clic en "Siguiente" para confirmar y continuar.' }, pt: { selectUpTo: "Selecione at\xE9", options: "op\xE7\xF5es", thenOrder: "e depois ordene-as", selectOptions: "Selecionar op\xE7\xF5es", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecione a op\xE7\xE3o #", prioritized: "Priorizadas", of: "de", 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.' }, fr: { selectUpTo: "S\xE9lectionnez jusqu'\xE0", options: "options", thenOrder: "puis classez-les", selectOptions: "S\xE9lectionner des options", cancel: "Annuler", confirm: "Confirmer", selectOptionNumber: "S\xE9lectionnez l'option #", prioritized: "Prioris\xE9es", of: "sur", 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.` }, de: { selectUpTo: "W\xE4hlen Sie bis zu", options: "Optionen", thenOrder: "und ordnen Sie sie dann", selectOptions: "Optionen ausw\xE4hlen", cancel: "Abbrechen", confirm: "Best\xE4tigen", selectOptionNumber: "W\xE4hlen Sie Option #", prioritized: "Priorisiert", of: "von", 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.' }, it: { selectUpTo: "Seleziona fino a", options: "opzioni", thenOrder: "e poi ordinali", selectOptions: "Seleziona opzioni", cancel: "Annulla", confirm: "Conferma", selectOptionNumber: "Seleziona opzione #", prioritized: "Prioritizzate", of: "di", 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: { selectUpTo: "Selecteer tot", options: "opties", thenOrder: "en rangschik ze vervolgens", selectOptions: "Selecteer opties", cancel: "Annuleren", confirm: "Bevestigen", selectOptionNumber: "Selecteer optie #", prioritized: "Geprioriteerd", of: "van", 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: { selectUpTo: "Wybierz do", options: "opcje", thenOrder: "a nast\u0119pnie je uporz\u0105dkuj", selectOptions: "Wybierz opcje", cancel: "Anuluj", confirm: "Potwierd\u017A", selectOptionNumber: "Wybierz opcj\u0119 #", prioritized: "Priorytetowe", of: "z", 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: { selectUpTo: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043E", options: "\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432", thenOrder: "\u0430 \u0437\u0430\u0442\u0435\u043C \u0443\u043F\u043E\u0440\u044F\u0434\u043E\u0447\u044C\u0442\u0435 \u0438\u0445", selectOptions: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B", cancel: "\u041E\u0442\u043C\u0435\u043D\u0430", confirm: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", selectOptionNumber: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 #", prioritized: "\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u044B", of: "\u0438\u0437", 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: { selectUpTo: "\u6700\u5927", options: "\u500B\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", thenOrder: "\u305D\u306E\u5F8C\u4E26\u3079\u66FF\u3048\u3066\u304F\u3060\u3055\u3044", selectOptions: "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB", confirm: "\u78BA\u8A8D", selectOptionNumber: "\u30AA\u30D7\u30B7\u30E7\u30F3 # \u3092\u9078\u629E", prioritized: "\u512A\u5148\u9806\u4F4D", of: "\u306E\u3046\u3061", 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: { selectUpTo: "\u6700\u591A\u9009\u62E9", options: "\u4E2A\u9009\u9879", thenOrder: "\u7136\u540E\u6392\u5E8F\u5B83\u4EEC", selectOptions: "\u9009\u62E9\u9009\u9879", cancel: "\u53D6\u6D88", confirm: "\u786E\u8BA4", selectOptionNumber: "\u9009\u62E9\u9009\u9879 #", prioritized: "\u5DF2\u4F18\u5148", of: "\u5171", 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: { selectUpTo: "\uCD5C\uB300", options: "\uAC1C\uC758 \uC635\uC158 \uC120\uD0DD", thenOrder: "\uADF8\uB7F0 \uB2E4\uC74C \uC815\uB82C\uD558\uC138\uC694", selectOptions: "\uC635\uC158 \uC120\uD0DD", cancel: "\uCDE8\uC18C", confirm: "\uD655\uC778", selectOptionNumber: "\uC635\uC158 # \uC120\uD0DD", prioritized: "\uC6B0\uC120\uC21C\uC704", of: "\uC911", 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.' }, ar: { selectUpTo: "\u0627\u062E\u062A\u0631 \u062D\u062A\u0649", options: "\u062E\u064A\u0627\u0631\u0627\u062A", thenOrder: "\u062B\u0645 \u0631\u062A\u0628\u0647\u0627", selectOptions: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A", cancel: "\u0625\u0644\u063A\u0627\u0621", confirm: "\u062A\u0623\u0643\u064A\u062F", selectOptionNumber: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631 #", prioritized: "\u062A\u0645 \u0627\u0644\u062A\u0631\u062A\u064A\u0628", of: "\u0645\u0646", 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.' }, bn: { selectUpTo: "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", options: "\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA", thenOrder: "\u09A4\u09BE\u09B0\u09AA\u09B0 \u09B8\u09C7\u0997\u09C1\u09B2\u09CB \u09B8\u09BE\u099C\u09BE\u09A8", selectOptions: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", cancel: "\u09AC\u09BE\u09A4\u09BF\u09B2", confirm: "\u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8", selectOptionNumber: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA # \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", prioritized: "\u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0\u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4", of: "\u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7", 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 \u201C\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0\u201D \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" }, da: { selectUpTo: "V\xE6lg op til", options: "muligheder", thenOrder: "og sorter dem derefter", selectOptions: "V\xE6lg muligheder", cancel: "Annuller", confirm: "Bekr\xE6ft", selectOptionNumber: "V\xE6lg mulighed #", prioritized: "Prioriteret", of: "af", 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.' }, fi: { selectUpTo: "Valitse enint\xE4\xE4n", options: "vaihtoehtoa", thenOrder: "ja j\xE4rjest\xE4 ne sitten", selectOptions: "Valitse vaihtoehdot", cancel: "Peruuta", confirm: "Vahvista", selectOptionNumber: "Valitse vaihtoehto #", prioritized: "Priorisoitu", of: " / ", instruction: 'Prioriteettilistasi n\xE4kyy alla. Voit halutessasi j\xE4rjest\xE4\xE4 valinnat uudelleen nuolien avulla. Napsauta "Seuraava" vahvistaaksesi valinnan ja jatkaaksesi.' }, sv: { selectUpTo: "V\xE4lj upp till", options: "alternativ", thenOrder: "och ordna dem sedan", selectOptions: "V\xE4lj alternativ", cancel: "Avbryt", confirm: "Bekr\xE4fta", selectOptionNumber: "V\xE4lj alternativ #", prioritized: "Prioriterat", of: "av", 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.' }, no: { selectUpTo: "Velg opptil", options: "alternativer", thenOrder: "og ordne dem deretter", selectOptions: "Velg alternativer", cancel: "Avbryt", confirm: "Bekreft", selectOptionNumber: "Velg alternativ #", prioritized: "Prioritert", of: "av", 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.' } };
1336
+ return t5[t5[a2] ? a2 : "en"][e5];
1337
+ }, d = document.createElement("div");
1338
+ if (d.classList.add("magicfeedback-priority-list-container"), r2 && s2 && s2 > 0) {
1339
+ const e5 = [], r3 = document.createElement("div");
1340
+ r3.classList.add("magicfeedback-priority-list-header");
1341
+ const a3 = document.createElement("div");
1342
+ a3.classList.add("magicfeedback-priority-list-instruction"), a3.textContent = "" !== o2 ? o2 : `${l("instruction")}`, a3.style.display = "none";
1343
+ const c2 = document.createElement("button");
1344
+ c2.type = "button", c2.textContent = l("selectOptions"), c2.classList.add("magicfeedback-button"), c2.classList.add("magicfeedback-priority-list-open-btn"), r3.appendChild(c2), r3.appendChild(a3);
1345
+ const u2 = document.createElement("div");
1346
+ u2.classList.add("magicfeedback-priority-list-reorder");
1347
+ const p = document.createElement("ul");
1348
+ p.classList.add("magicfeedback-priority-list-list"), u2.appendChild(p);
1349
+ const m = () => {
1350
+ p.innerHTML = "", e5.forEach(((t5, n3) => {
1351
+ const r4 = document.createElement("li");
1352
+ r4.classList.add("magicfeedback-priority-list-item");
1353
+ const s3 = document.createElement("input");
1354
+ s3.classList.add("magicfeedback-input-magicfeedback-priority-list"), s3.classList.add("magicfeedback-input"), s3.type = "hidden", s3.id = `priority-list-${i2}`, s3.name = i2, s3.value = `${n3 + 1}. ${t5}`, r4.appendChild(s3);
1355
+ const a4 = document.createElement("label");
1356
+ a4.classList.add("magicfeedback-priority-list-item-label"), a4.textContent = `${n3 + 1}. ${t5}`, r4.appendChild(a4);
1357
+ const o3 = document.createElement("div");
1358
+ o3.classList.add("magicfeedback-priority-list-arrows");
1359
+ const l2 = document.createElement("img");
1360
+ l2.classList.add("magicfeedback-priority-list-arrow-up"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.visibility = 0 === n3 ? "hidden" : "visible";
1361
+ const d2 = document.createElement("img");
1362
+ 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 = n3 === e5.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
1363
+ var i3, n4, o4, c3;
1364
+ const u3 = r4.previousElementSibling;
1365
+ if (u3) {
1366
+ const m2 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) - 1;
1367
+ s3.value = `${m2}. ${t5}`, a4.textContent = `${m2}. ${t5}`, l2.style.visibility = 1 === m2 ? "hidden" : "visible", d2.style.visibility = m2 === e5.length ? "hidden" : "visible";
1368
+ const h2 = u3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f2 = u3.querySelector(".magicfeedback-priority-list-item-label"), v2 = u3.querySelector(".magicfeedback-priority-list-arrow-up"), g2 = u3.querySelector(".magicfeedback-priority-list-arrow-down");
1369
+ if (h2 && f2 && v2 && g2) {
1370
+ const t6 = Number(null === (n4 = h2.value) || void 0 === n4 ? void 0 : n4.split(".")[0]) + 1;
1371
+ h2.value = `${t6}.${null === (o4 = f2.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f2.textContent = `${t6}.${null === (c3 = f2.textContent) || void 0 === c3 ? void 0 : c3.split(".")[1]}`, v2.style.visibility = 1 === t6 ? "hidden" : "visible", g2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1372
+ }
1373
+ p.insertBefore(r4, u3);
1374
+ }
1375
+ })), d2.addEventListener("click", (() => {
1376
+ var i3, n4, o4;
1377
+ const c3 = r4.nextElementSibling;
1378
+ if (c3) {
1379
+ const u3 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
1380
+ s3.value = `${u3}. ${t5}`, a4.textContent = `${u3}. ${t5}`, l2.style.visibility = 1 === u3 ? "hidden" : "visible", d2.style.visibility = u3 === e5.length ? "hidden" : "visible";
1381
+ const m2 = c3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h2 = c3.querySelector(".magicfeedback-priority-list-item-label"), f2 = c3.querySelector(".magicfeedback-priority-list-arrow-up"), v2 = c3.querySelector(".magicfeedback-priority-list-arrow-down");
1382
+ if (m2 && h2 && f2 && v2) {
1383
+ const t6 = Number(m2.value.split(".")[0]) - 1;
1384
+ m2.value = `${t6}.${null === (n4 = h2.textContent) || void 0 === n4 ? void 0 : n4.split(".")[1]}`, h2.textContent = `${t6}.${null === (o4 = h2.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f2.style.visibility = 1 === t6 ? "hidden" : "visible", v2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1385
+ }
1386
+ p.insertBefore(c3, r4);
1387
+ }
1388
+ })), o3.appendChild(l2), o3.appendChild(d2), r4.appendChild(o3), p.appendChild(r4);
1389
+ }));
1390
+ }, h = document.createElement("div");
1391
+ h.classList.add("magicfeedback-modal-backdrop"), h.style.position = "fixed", h.style.top = "0", h.style.left = "0", h.style.width = "100vw", h.style.height = "100vh", h.style.background = "rgba(0,0,0,0.4)", h.style.display = "none", h.style.alignItems = "center", h.style.justifyContent = "center", h.style.zIndex = "9999";
1392
+ const f = document.createElement("div");
1393
+ f.classList.add("magicfeedback-modal"), f.style.background = "#fff", f.style.borderRadius = "8px", f.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", f.style.maxWidth = "520px", f.style.width = "90%", f.style.maxHeight = "80vh", f.style.overflow = "auto", f.style.padding = "16px", f.style.position = "relative";
1394
+ const v = document.createElement("h5");
1395
+ v.classList.add("magicfeedback-modal-title");
1396
+ const g = () => Math.min(e5.length + 1, s2), y = () => {
1397
+ v.textContent = `${l("selectOptionNumber")}${g()}`;
1398
+ };
1399
+ y();
1400
+ const b = document.createElement("div");
1401
+ b.classList.add("magicfeedback-modal-list"), (n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
1402
+ const n3 = document.createElement("label");
1403
+ n3.classList.add("magicfeedback-modal-row");
1404
+ const r4 = document.createElement("input");
1405
+ r4.type = "checkbox", r4.classList.add("magicfeedback-input"), r4.name = `${i2}-selection`, r4.value = t5;
1406
+ const a4 = document.createElement("span");
1407
+ a4.textContent = t5, r4.addEventListener("change", (() => {
1408
+ if (r4.checked) {
1409
+ if (e5.length >= s2) return r4.checked = false, n3.classList.add("magicfeedback-warning"), void setTimeout((() => {
1410
+ n3.classList.remove("magicfeedback-warning");
1411
+ }), 800);
1412
+ e5.push(t5);
1413
+ } else {
1414
+ const i3 = e5.indexOf(t5);
1415
+ -1 !== i3 && e5.splice(i3, 1);
1416
+ }
1417
+ y(), A();
1418
+ })), n3.appendChild(r4), n3.appendChild(a4), b.appendChild(n3);
1419
+ }));
1420
+ const E = document.createElement("div");
1421
+ E.classList.add("magicfeedback-modal-actions");
1422
+ const k = document.createElement("div");
1423
+ k.classList.add("magicfeedback-modal-counter");
1424
+ const A = () => {
1425
+ const t5 = l("of");
1426
+ k.textContent = `${l("prioritized")} ${e5.length} ${t5} ${s2}`, a3.style.display = e5.length > 0 ? "block" : "none";
1427
+ };
1428
+ A();
1429
+ const C = document.createElement("button");
1430
+ C.type = "button", C.classList.add("magicfeedback-modal-close"), C.setAttribute("aria-label", l("cancel")), C.title = l("cancel"), C.textContent = "\xD7", C.style.position = "absolute", C.style.top = "8px", C.style.right = "8px", C.style.border = "none", C.style.background = "transparent", C.style.fontSize = "24px", C.style.cursor = "pointer", C.addEventListener("click", (() => {
1431
+ h.style.display = "none";
1432
+ }));
1433
+ const T = document.createElement("button");
1434
+ return T.type = "button", T.textContent = l("confirm"), T.classList.add("magicfeedback-button"), T.classList.add("magicfeedback-button-primary"), T.addEventListener("click", (() => {
1435
+ h.style.display = "none", m();
1436
+ })), E.appendChild(k), E.appendChild(T), f.appendChild(C), f.appendChild(v), f.appendChild(b), f.appendChild(E), h.appendChild(f), c2.addEventListener("click", (() => {
1437
+ h.style.display = "flex", y(), A();
1438
+ })), h.addEventListener("click", ((e6) => {
1439
+ e6.target === h && (h.style.display = "none");
1440
+ })), d.appendChild(r3), d.appendChild(u2), d.appendChild(h), m(), d;
1441
+ }
1442
+ const c = document.createElement("ul");
1443
+ c.classList.add("magicfeedback-priority-list-list");
1444
+ const u = n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4];
1445
+ return u.forEach(((e5, t5) => {
1446
+ const n3 = document.createElement("li");
1447
+ n3.classList.add("magicfeedback-priority-list-item"), n3.style.display = "flex", n3.style.justifyContent = "space-between", n3.style.alignItems = "center", n3.style.margin = "5px";
1448
+ const r3 = document.createElement("input");
1449
+ r3.classList.add("magicfeedback-input-magicfeedback-priority-list"), r3.classList.add("magicfeedback-input"), r3.type = "hidden", r3.id = `priority-list-${i2}`, r3.name = i2, r3.value = `${t5 + 1}. ${e5}`, n3.appendChild(r3);
1450
+ const s3 = document.createElement("label");
1451
+ s3.classList.add("magicfeedback-priority-list-item-label"), s3.textContent = `${t5 + 1}. ${e5}`, n3.appendChild(s3);
1452
+ const a3 = document.createElement("div");
1453
+ a3.style.display = "flex", a3.style.alignItems = "center", a3.style.justifyContent = "space-between";
1454
+ const o3 = document.createElement("img");
1455
+ o3.classList.add("magicfeedback-priority-list-arrow-up"), o3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", o3.style.width = "20px", o3.style.height = "20px", o3.style.cursor = "pointer", o3.style.margin = "0 5px", o3.style.color = "#000", o3.style.visibility = 0 === t5 ? "hidden" : "visible", o3.addEventListener("click", (() => {
1456
+ var t6, i3, a4, d2;
1457
+ const p = n3.previousElementSibling;
1458
+ if (p) {
1459
+ const m = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
1460
+ r3.value = `${m}. ${e5}`, s3.textContent = `${m}. ${e5}`, o3.style.visibility = 1 === m ? "hidden" : "visible", l2.style.visibility = m === u.length ? "hidden" : "visible";
1461
+ const h = p.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f = p.querySelector(".magicfeedback-priority-list-item-label"), v = p.querySelector(".magicfeedback-priority-list-arrow-up"), g = p.querySelector(".magicfeedback-priority-list-arrow-down");
1462
+ if (h && f && v && g) {
1463
+ const e6 = Number(null === (i3 = h.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
1464
+ 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]}`, v.style.visibility = 1 === e6 ? "hidden" : "visible", g.style.visibility = e6 === u.length ? "hidden" : "visible";
1465
+ }
1466
+ c.insertBefore(n3, p);
1467
+ }
1468
+ }));
1469
+ const l2 = document.createElement("img");
1470
+ l2.classList.add("magicfeedback-priority-list-arrow-down"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.width = "20px", l2.style.height = "20px", l2.style.cursor = "pointer", l2.style.margin = "0 5px", l2.style.color = "#000", l2.style.transform = "rotate(180deg)", l2.style.visibility = t5 === u.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
1471
+ var t6, i3, a4;
1472
+ const d2 = n3.nextElementSibling;
1473
+ if (d2) {
1474
+ const p = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
1475
+ r3.value = `${p}. ${e5}`, s3.textContent = `${p}. ${e5}`, o3.style.visibility = 1 === p ? "hidden" : "visible", l2.style.visibility = p === u.length ? "hidden" : "visible";
1476
+ 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"), v = d2.querySelector(".magicfeedback-priority-list-arrow-down");
1477
+ if (m && h && f && v) {
1478
+ const e6 = Number(m.value.split(".")[0]) - 1;
1479
+ m.value = `${e6}.${null === (i3 = h.textContent) || void 0 === i3 ? void 0 : i3.split(".")[1]}`, h.textContent = `${e6}.${null === (a4 = h.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.style.visibility = 1 === e6 ? "hidden" : "visible", v.style.visibility = e6 === u.length ? "hidden" : "visible";
1480
+ }
1481
+ c.insertBefore(d2, n3);
1482
+ }
1483
+ })), a3.appendChild(o3), a3.appendChild(l2), n3.appendChild(a3), c.appendChild(n3);
1484
+ })), d.appendChild(c), d;
1485
+ })({ value: e3.value, ref: e3.ref, randomPosition: t3, limitPriority: (null === (n = e3.assets) || void 0 === n ? void 0 : n.limitPriority) || false, maxPriority: (null === (r = e3.assets) || void 0 === r ? void 0 : r.maxPriority) || 0, placeholder: (null === (s = e3.assets) || void 0 === s ? void 0 : s.placeholder) || "", language: i || "en" });
1486
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-priority-list" };
1487
+ };
1488
+ }, 152: (e2, t2, i) => {
1489
+ "use strict";
1490
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingEmoji = void 0;
1491
+ const n = i(559), r = "https://survey-dev.magicfeedback.io/assets/emojis";
1492
+ t2.renderRatingEmoji = ({ question: e3, url: t3, send: i2, urlParamValue: s }) => {
1493
+ var a;
1494
+ const { ref: o, assets: l } = e3, d = document.createElement("div"), c = "magicfeedback-rating", u = document.createElement("div");
1495
+ u.classList.add("magicfeedback-rating-container");
1496
+ 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)(m, p, null == l ? void 0 : l.minPlaceholder, null == l ? void 0 : l.maxPlaceholder, null !== (a = null == l ? void 0 : l.extraOption) && void 0 !== a && a);
1497
+ for (let e4 = m; e4 <= p; e4++) {
1498
+ const n2 = document.createElement("div");
1499
+ n2.classList.add("magicfeedback-rating-option");
1500
+ const a2 = document.createElement("label");
1501
+ a2.htmlFor = `rating-${o}-${e4}`, a2.classList.add("magicfeedback-rating-option-label-container");
1502
+ const l2 = document.createElement("label");
1503
+ l2.htmlFor = `rating-${o}-${e4}`, l2.textContent = e4.toString();
1504
+ const d2 = document.createElement("img");
1505
+ if (d2.alt = `face-${o}-${e4}`, d2.className = `rating-image${e4}`, 0 === m && 10 === p) d2.src = `${t3}/${e4}.svg`, d2.onerror = () => d2.src = `${r}/${e4}.svg`;
1506
+ else if (1 === m && 5 === p) switch (e4) {
1507
+ case 1:
1508
+ d2.src = `${t3}/1.svg`, d2.onerror = () => d2.src = `${r}/1.svg`;
1509
+ break;
1510
+ case 2:
1511
+ d2.src = `${t3}/2.svg`, d2.onerror = () => d2.src = `${r}/2.svg`;
1512
+ break;
1513
+ case 3:
1514
+ d2.src = `${t3}/6.svg`, d2.onerror = () => d2.src = `${r}/6.svg`;
1515
+ break;
1516
+ case 4:
1517
+ d2.src = `${t3}/9.svg`, d2.onerror = () => d2.src = `${r}/9.svg`;
1518
+ break;
1519
+ case 5:
1520
+ d2.src = `${t3}/10.svg`, d2.onerror = () => d2.src = `${r}/10.svg`;
1521
+ }
1522
+ else {
1523
+ const i3 = Math.round(10 / (p - m) * (e4 - m));
1524
+ d2.src = `${t3}/${i3}.svg`, d2.onerror = () => d2.src = `${r}/${i3}.svg`;
1525
+ }
1526
+ const h2 = document.createElement("input");
1527
+ h2.id = `rating-${o}-${e4}`, h2.type = "radio", h2.name = o, h2.value = e4.toString(), h2.classList.add(c), h2.classList.add("magicfeedback-input"), i2 && h2.addEventListener("change", (() => {
1528
+ i2();
1529
+ })), s && s === h2.value && (h2.checked = true), a2.appendChild(h2), a2.appendChild(d2), a2.appendChild(l2), n2.appendChild(a2), u.appendChild(n2);
1530
+ }
1531
+ if ((null == l ? void 0 : l.extraOption) && (null == l ? void 0 : l.extraOptionText)) {
1532
+ const e4 = document.createElement("div");
1533
+ e4.classList.add("magicfeedback-rating-option");
1534
+ const t4 = document.createElement("label");
1535
+ t4.htmlFor = `rating-${o}-extra`, t4.classList.add("magicfeedback-rating-option-label-container");
1536
+ const n2 = document.createElement("label");
1537
+ n2.htmlFor = `rating-${o}-extra`, n2.textContent = null == l ? void 0 : l.extraOptionText;
1538
+ const r2 = document.createElement("img");
1539
+ r2.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", r2.alt = `face-${o}-extra`, r2.className = "magicfeedback-rating-image-extra";
1540
+ const s2 = document.createElement("input");
1541
+ s2.id = `rating-${o}-extra`, s2.type = "radio", s2.name = o, s2.value = "-", s2.classList.add(c), s2.classList.add("magicfeedback-input"), i2 && s2.addEventListener("change", (() => {
1542
+ i2();
1543
+ })), t4.appendChild(s2), t4.appendChild(r2), t4.appendChild(n2), e4.appendChild(t4), u.appendChild(e4);
1544
+ }
1545
+ return h.childElementCount > 0 && (u.classList.add("magicfeedback-rating-container--with-placeholder"), u.insertBefore(h, u.firstChild)), d.appendChild(u), { element: d, elementTypeClass: c };
1546
+ };
1547
+ }, 917: (e2, t2, i) => {
1548
+ "use strict";
1549
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingNumber = void 0;
1550
+ const n = i(559);
1551
+ t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2, isPhone: r, send: s, urlParamValue: a }) => {
1552
+ const o = "magicfeedback-rating-number";
1553
+ return { element: (0, n.createRatingNumberElement)(e3.ref, e3.assets, t3, i2, r, o, s, a), elementTypeClass: o };
1554
+ };
1555
+ }, 452: (e2, t2, i) => {
1556
+ "use strict";
1557
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingStar = void 0;
1558
+ const n = i(559);
1559
+ t2.renderRatingStar = ({ question: e3, send: t3, urlParamValue: i2 }) => {
1560
+ var r, s;
1561
+ const a = document.createElement("div"), o = (0, n.createStarRating)(e3.ref, null === (r = e3.assets) || void 0 === r ? void 0 : r.minPlaceholder, null === (s = e3.assets) || void 0 === s ? void 0 : s.maxPlaceholder, t3, i2);
1562
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-rating-star" };
1563
+ };
1564
+ }, 85: (e2, t2, i) => {
1565
+ "use strict";
1566
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderSelect = void 0;
1567
+ const n = i(516);
1568
+ t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: r, send: s }) => {
1569
+ const { title: a, value: o, defaultValue: l } = e3, d = document.createElement("select"), c = document.createElement("option");
1570
+ return c.value = "", c.text = "slim" === t3 ? (0, n.parseTitle)(a, i2) : l || "Select an option", c.disabled = true, c.selected = true, d.appendChild(c), o.forEach(((e4) => {
1571
+ const t4 = document.createElement("option");
1572
+ t4.value = e4, t4.text = e4, d.appendChild(t4);
1573
+ })), r && o.includes(r) && (d.value = r), s && d.addEventListener("change", (() => {
1574
+ s();
1575
+ })), { element: d, elementTypeClass: "magicfeedback-select" };
1576
+ };
1577
+ }, 90: (e2, t2, i) => {
1578
+ "use strict";
1579
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderText = void 0;
1580
+ const n = i(784);
1581
+ t2.renderText = ({ language: e3, placeholderText: t3, urlParamValue: i2, send: r }) => {
1582
+ const s = document.createElement("input");
1583
+ return s.type = "text", s.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (s.value = i2), s.addEventListener("keyup", ((e4) => {
1584
+ e4.preventDefault(), "Enter" === e4.key && r && r();
1585
+ })), { element: s, elementTypeClass: "magicfeedback-text" };
1586
+ };
1587
+ }, 250: (e2, t2) => {
1588
+ "use strict";
1589
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadFile = void 0, t2.renderUploadFile = ({ question: e3 }) => {
1590
+ var t3, i;
1591
+ const n = document.createElement("input");
1592
+ return n.type = "file", n.required = e3.require, n.multiple = (null === (t3 = e3.assets) || void 0 === t3 ? void 0 : t3.multiple) || false, n.maxLength = (null === (i = e3.assets) || void 0 === i ? void 0 : i.maxFiles) || 1, { element: n, elementTypeClass: "magicfeedback-upload-file" };
1593
+ };
1594
+ }, 843: (e2, t2) => {
1595
+ "use strict";
1596
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadImage = void 0, t2.renderUploadImage = ({ question: e3 }) => {
1597
+ var t3, i;
1598
+ const n = document.createElement("input");
1599
+ return n.type = "file", n.accept = "image/*", n.required = e3.require, n.multiple = (null === (t3 = e3.assets) || void 0 === t3 ? void 0 : t3.multiple) || false, n.maxLength = (null === (i = e3.assets) || void 0 === i ? void 0 : i.maxFiles) || 1, { element: n, elementTypeClass: "magicfeedback-upload-image" };
1600
+ };
1601
+ }, 857: (e2, t2) => {
1602
+ "use strict";
1603
+ 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" } };
1604
+ }, 784: (e2, t2) => {
1605
+ "use strict";
1606
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.placeholder = void 0, t2.placeholder = { answer: (e3) => {
1607
+ switch (e3) {
1608
+ case "en":
1609
+ default:
1610
+ return "Write your answer here...";
1611
+ case "es":
1612
+ return "Escribe tu respuesta aqu\xED...";
1613
+ case "da":
1614
+ return "Skriv dit svar her...";
1615
+ case "fi":
1616
+ return "Kirjoita vastauksesi t\xE4h\xE4n...";
1617
+ case "sv":
1618
+ return "Skriv ditt svar h\xE4r...";
1619
+ case "no":
1620
+ return "Skriv svaret ditt her...";
1621
+ case "ar":
1622
+ return "\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627...";
1623
+ case "bn":
1624
+ return "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0";
1625
+ }
1626
+ }, number: (e3) => {
1627
+ switch (e3) {
1628
+ case "en":
1629
+ default:
1630
+ return "Write your number here...";
1631
+ case "es":
1632
+ return "Escribe tu n\xFAmero aqu\xED...";
1633
+ case "da":
1634
+ return "Skriv dit nummer her...";
1635
+ case "fi":
1636
+ return "Kirjoita numerosi t\xE4h\xE4n...";
1637
+ case "sv":
1638
+ return "Skriv ditt nummer h\xE4r...";
1639
+ case "no":
1640
+ return "Skriv nummeret ditt her...";
1641
+ case "ar":
1642
+ return "\u0627\u0643\u062A\u0628 \u0631\u0642\u0645\u0643 \u0647\u0646\u0627...";
1643
+ case "bn":
1644
+ return "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0";
1645
+ }
1646
+ }, email: (e3) => {
1647
+ switch (e3) {
1648
+ case "en":
1649
+ default:
1650
+ return "Write your email here...";
1651
+ case "es":
1652
+ return "Escribe tu correo electr\xF3nico aqu\xED...";
1653
+ case "da":
1654
+ return "Skriv din e-mail her...";
1655
+ case "fi":
1656
+ return "Kirjoita s\xE4hk\xF6postiosoitteesi t\xE4h\xE4n...";
1657
+ case "sv":
1658
+ return "Skriv din e-post h\xE4r...";
1659
+ case "no":
1660
+ return "Skriv e-posten din her...";
1661
+ case "ar":
1662
+ return "\u0627\u0643\u062A\u0628 \u0628\u0631\u064A\u062F\u0643 \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A \u0647\u0646\u0627...";
1663
+ case "bn":
1664
+ return "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0";
1665
+ }
1666
+ }, date: (e3) => {
1667
+ switch (e3) {
1668
+ case "en":
1669
+ default:
1670
+ return "Write your date here...";
1671
+ case "es":
1672
+ return "Escribe tu fecha aqu\xED...";
1673
+ case "da":
1674
+ return "Skriv din dato her...";
1675
+ case "fi":
1676
+ return "Kirjoita p\xE4iv\xE4m\xE4\xE4r\xE4si t\xE4h\xE4n...";
1677
+ case "sv":
1678
+ return "Skriv ditt datum h\xE4r...";
1679
+ case "no":
1680
+ return "Skriv datoen din her...";
1681
+ case "ar":
1682
+ return "\u0627\u0643\u062A\u0628 \u062A\u0627\u0631\u064A\u062E\u0643 \u0647\u0646\u0627...";
1683
+ case "bn":
1684
+ return "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0";
1685
+ }
1686
+ }, password: (e3) => {
1687
+ switch (e3) {
1688
+ case "en":
1689
+ default:
1690
+ return "Write your password here...";
1691
+ case "es":
1692
+ return "Escribe tu contrase\xF1a aqu\xED...";
1693
+ case "da":
1694
+ return "Skriv dit kodeord her...";
1695
+ case "fi":
1696
+ return "Kirjoita salasanasi t\xE4h\xE4n...";
1697
+ case "sv":
1698
+ return "Skriv ditt l\xF6senord h\xE4r...";
1699
+ case "no":
1700
+ return "Skriv passordet ditt her...";
1701
+ case "ar":
1702
+ return "\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...";
1703
+ case "bn":
1704
+ return "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0";
1705
+ }
1706
+ }, pointsystemerror: (e3) => {
1707
+ switch (e3) {
1708
+ case "en":
1709
+ default:
1710
+ return "The total points must be 100 %";
1711
+ case "es":
1712
+ return "El total de puntos debe ser 100 %";
1713
+ case "da":
1714
+ return "Samlet antal point skal v\xE6re 100 %";
1715
+ case "fi":
1716
+ return "Kokonaispisteiden on oltava 100 %";
1717
+ case "sv":
1718
+ return "Totala po\xE4ng m\xE5ste vara 100 %";
1719
+ case "no":
1720
+ return "Totalt antall poeng m\xE5 v\xE6re 100 %";
1721
+ case "ar":
1722
+ return "\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 %";
1723
+ case "bn":
1724
+ return "\u09AE\u09CB\u099F \u09AA\u09AF\u09BC\u09C7\u09A8\u09CD\u099F 100 % \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7";
1725
+ }
1726
+ } };
1727
+ }, 213: (e2, t2, i) => {
1728
+ "use strict";
1729
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderStartMessage = t2.renderSuccess = t2.renderError = t2.renderActions = t2.renderQuestions = void 0;
1730
+ const n = i(42), r = i(516), s = { small: "1rem", medium: "1.2rem", large: "1.5rem" };
1731
+ t2.renderQuestions = function e3(t3, i2 = "standard", a = "en", o = { customIcons: false }, l) {
1732
+ if (!t3) throw new Error("[MagicFeedback] No questions provided");
1733
+ const d = [], { customIcons: c, id: u } = o;
1734
+ return t3.forEach(((p) => {
1735
+ var m, h;
1736
+ if ((null === (h = null === (m = null == p ? void 0 : p.questionType) || void 0 === m ? void 0 : m.conf) || void 0 === h ? void 0 : h.length) > 0) {
1737
+ let t4 = document.createElement("div");
1738
+ t4.classList.add("magicfeedback-div");
1739
+ const n2 = document.createElement("label");
1740
+ n2.setAttribute("for", `magicfeedback-${p.id}`), n2.textContent = (0, r.parseTitle)(p.title, a), n2.classList.add("magicfeedback-label"), t4.appendChild(n2), p.questionType.conf.forEach(((e4) => {
1741
+ e4.ref = p.ref, p.assets[e4.id] && (e4.assets = { placeholder: p.assets[e4.id] });
1742
+ })), e3(p.questionType.conf, i2, a, o, l).forEach(((e4) => {
1743
+ t4.appendChild(e4);
1744
+ })), d.push(t4);
1745
+ } else {
1746
+ const e4 = (function(e5, t4, i3, a2, o2) {
1747
+ var l2, d2, c2;
1748
+ let u2, p2, { id: m2, title: h2, type: f, ref: v, require: g, defaultValue: y, assets: b } = e5, E = document.createElement("div");
1749
+ E.classList.add("magicfeedback-div");
1750
+ const k = window.innerWidth < 600, A = "slim" === t4 ? (0, r.parseTitle)(h2, i3) : null == b ? void 0 : b.placeholder, C = (0, r.getUrlParam)(v), T = (null == b ? void 0 : b.maxCharacters) || 0, P = void 0 !== (null == b ? void 0 : b.randomPosition) && (null == b ? void 0 : b.randomPosition), w = (null == b ? void 0 : b.direction) || "row", x = (null == b ? void 0 : b.order) || "ltr", O = (0, n.getQuestionRenderer)(f);
1751
+ if (!O) return E;
1752
+ {
1753
+ const n2 = O({ question: e5, format: t4, language: i3, url: a2, send: o2, isPhone: k, urlParamValue: C, placeholderText: A, maxCharacters: T, randomPosition: P, direction: w, order: x });
1754
+ u2 = n2.element, p2 = n2.elementTypeClass;
1755
+ }
1756
+ u2.id = `magicfeedback-${m2}`, u2.setAttribute("name", v), u2.classList.add(p2), (void 0 !== y || null !== C) && (u2.value = C || y), ["RADIO", "MULTIPLECHOICE"].includes(f) || (u2.classList.add("magicfeedback-input"), u2.required = g);
1757
+ const L = document.createElement("label");
1758
+ L.setAttribute("for", `magicfeedback-${m2}`), L.textContent = (0, r.parseTitle)(h2, i3), L.classList.add("magicfeedback-label"), (function(e6, t5) {
1759
+ if ("INFO_PAGE" !== t5.type) return;
1760
+ const { assets: i4 } = t5, n2 = (function(e7) {
1761
+ if (e7) return s[e7] || e7;
1762
+ })(null == i4 ? void 0 : i4.titleSize), r2 = (a3 = null == i4 ? void 0 : i4.titleStyle, Array.isArray(a3) ? a3 : a3 ? [a3] : []);
1763
+ var a3;
1764
+ 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");
1765
+ })(L, e5);
1766
+ const S = document.createElement("label");
1767
+ if (S.textContent = (0, r.parseTitle)(null == b ? void 0 : b.subtitle, i3), S.classList.add("magicfeedback-sublabel"), (null === (l2 = null == b ? void 0 : b.subtitleStyle) || void 0 === l2 ? void 0 : l2.includes("italic")) && (S.style.fontStyle = "italic"), (null === (d2 = null == b ? void 0 : b.subtitleStyle) || void 0 === d2 ? void 0 : d2.includes("bold")) && (S.style.fontWeight = "bold"), (null === (c2 = null == b ? void 0 : b.subtitleStyle) || void 0 === c2 ? void 0 : c2.includes("underline")) && (S.style.textDecoration = "underline"), ["CONSENT"].includes(f)) E.classList.add("magicfeedback-consent-container"), E.appendChild(u2), E.appendChild(L), (null == b ? void 0 : b.subtitle) && E.appendChild(S);
1768
+ else {
1769
+ if ("slim" !== t4 && (E.appendChild(L), (null == b ? void 0 : b.subtitle) && E.appendChild(S), void 0 !== (null == b ? void 0 : b.general) && "" !== (null == b ? void 0 : b.general))) {
1770
+ const e6 = document.createElement("img");
1771
+ e6.src = null == b ? void 0 : b.general, e6.classList.add("magicfeedback-image"), e6.style.maxWidth = "auto", e6.style.height = "400px", e6.style.margin = "10px 0", E.appendChild(e6);
1772
+ }
1773
+ if ("LONGTEXT" === f && T > 0) {
1774
+ const e6 = document.createElement("div");
1775
+ if (e6.classList.add("magicfeedback-counter"), e6.textContent = `${u2.value.length}/${T}`, e6.style.textAlign = "right", e6.style.fontSize = "15px", e6.style.marginTop = "5px", u2.addEventListener("input", (() => {
1776
+ e6.textContent = `${u2.value.length}/${T}`;
1777
+ })), E.appendChild(u2), E.appendChild(e6), (null == b ? void 0 : b.extraOption) && (null == b ? void 0 : b.extraOptionText)) {
1778
+ const e7 = document.createElement("div");
1779
+ e7.classList.add("magicfeedback-skip-container"), e7.classList.add("magicfeedback-checkbox-container"), e7.style.display = "flex", e7.style.justifyContent = "flex-start";
1780
+ const t5 = document.createElement("input");
1781
+ t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${v}`, t5.name = v, t5.value = "-", t5.style.cursor = "pointer";
1782
+ const i4 = document.createElement("label");
1783
+ i4.htmlFor = `skip-${v}`, i4.textContent = null == b ? void 0 : b.extraOptionText, i4.style.fontSize = "15px", i4.style.cursor = "pointer", i4.style.margin = "0 5px", t5.addEventListener("click", (() => {
1784
+ u2.value = "-", o2 && o2();
1785
+ })), e7.appendChild(t5), e7.appendChild(i4), E.appendChild(e7);
1786
+ }
1787
+ } else E.appendChild(u2);
1788
+ }
1789
+ return E;
1790
+ })(p, i2, a, "https://survey-dev.magicfeedback.io/assets/emojis" + (c ? `/${u}` : ""), 1 === t3.length ? l : void 0);
1791
+ d.push(e4);
1792
+ }
1793
+ })), d;
1794
+ }, t2.renderActions = function(e3 = "", t3, i2 = "Submit", n2 = "Back", r2 = "Next") {
1795
+ const s2 = document.createElement("div");
1796
+ s2.classList.add("magicfeedback-action-container");
1797
+ const a = document.createElement("button");
1798
+ a.id = "magicfeedback-submit", a.type = "submit", a.classList.add("magicfeedback-submit"), a.textContent = "MAGICSURVEY" === e3 ? r2 || "Next" : i2 || "Submit";
1799
+ const o = document.createElement("button");
1800
+ return o.id = "magicfeedback-back", o.type = "button", o.classList.add("magicfeedback-back"), o.textContent = n2 || "Back", o.addEventListener("click", t3), o.addEventListener("click", (() => {
1801
+ a.removeAttribute("disabled");
1802
+ })), "MAGICSURVEY" === e3 && s2.appendChild(o), s2.appendChild(a), s2;
1803
+ }, t2.renderError = function(e3) {
1804
+ const t3 = document.createElement("div");
1805
+ return t3.classList.add("magicfeedback-error"), t3.textContent = e3, t3;
1806
+ }, t2.renderSuccess = function(e3) {
1807
+ const t3 = document.createElement("div");
1808
+ return t3.classList.add("magicfeedback-success"), t3.textContent = e3, t3;
1809
+ }, t2.renderStartMessage = function(e3, t3 = false, i2 = "Go!", n2 = () => {
1810
+ }) {
1811
+ const r2 = document.createElement("div");
1812
+ r2.classList.add("magicfeedback-start-message-container");
1813
+ const s2 = document.createElement("div");
1814
+ if (s2.classList.add("magicfeedback-start-message"), s2.innerHTML = e3, r2.appendChild(s2), t3) {
1815
+ const e4 = document.createElement("button");
1816
+ e4.id = "magicfeedback-start-message-button", e4.classList.add("magicfeedback-start-message-button"), e4.textContent = i2, e4.addEventListener("click", (() => n2())), r2.appendChild(e4);
1817
+ }
1818
+ return r2;
1819
+ };
1820
+ }, 313: function(e2, t2, i) {
1821
+ "use strict";
1822
+ var n = this && this.__awaiter || function(e3, t3, i2, n2) {
1823
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
1824
+ function a2(e4) {
1825
+ try {
1826
+ l2(n2.next(e4));
1827
+ } catch (e5) {
1828
+ s2(e5);
1829
+ }
1830
+ }
1831
+ function o2(e4) {
1832
+ try {
1833
+ l2(n2.throw(e4));
1834
+ } catch (e5) {
1835
+ s2(e5);
1836
+ }
1837
+ }
1838
+ function l2(e4) {
1839
+ var t4;
1840
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
1841
+ e5(t4);
1842
+ }))).then(a2, o2);
1843
+ }
1844
+ l2((n2 = n2.apply(e3, t3 || [])).next());
1845
+ }));
1846
+ }, r = this && this.__importDefault || function(e3) {
1847
+ return e3 && e3.__esModule ? e3 : { default: e3 };
1848
+ };
1849
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = void 0;
1850
+ const s = r(i(945)), a = r(i(330)), o = i(857), l = { Accept: "application/json", "Magicfeedback-Sdk-Version": a.default.version, "x-magicfeedback-parameters": window.location.search || "" };
1851
+ t2.validateEmail = function(e3) {
1852
+ return /\S+@\S+\.\S+/.test(e3);
1853
+ }, t2.getForm = function(e3, t3, i2, r2) {
1854
+ return n(this, void 0, void 0, (function* () {
1855
+ try {
1856
+ const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.app_info(t3, i2), { method: "GET", headers: l });
1857
+ return yield n2.json();
1858
+ } catch (e4) {
1859
+ r2.err(e4);
1860
+ }
1861
+ }));
1862
+ }, t2.getSessionForm = function(e3, t3, i2) {
1863
+ return n(this, void 0, void 0, (function* () {
1864
+ try {
1865
+ const i3 = yield (0, s.default)(e3 + o.endpoints.sdk.session(t3), { method: "GET", headers: l });
1866
+ return yield i3.json();
1867
+ } catch (e4) {
1868
+ i2.err(e4);
1869
+ }
1870
+ }));
1871
+ }, t2.getQuestions = function(e3, t3, i2, r2) {
1872
+ return n(this, void 0, void 0, (function* () {
1873
+ try {
1874
+ const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.app(t3, i2), { method: "GET", headers: l });
1875
+ if (n2.ok) {
1876
+ const e4 = yield n2.json();
1877
+ return r2.log(`Received questions for app ${t3}`, e4), e4;
1878
+ }
1879
+ throw r2.err(`Failed to get questions for app ${t3}:`, n2.status, n2.statusText), new Error("[MagicFeedback] Bad response from server");
1880
+ } catch (e4) {
1881
+ return r2.err(e4), [];
1882
+ }
1883
+ }));
1884
+ }, t2.sendFeedback = function(e3, t3, i2) {
1885
+ return n(this, void 0, void 0, (function* () {
1886
+ try {
1887
+ const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.feedback, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, l), body: JSON.stringify(t3) });
1888
+ if (n2.ok) return i2.log(`Form ${t3.integration} submitted successfully!`), (yield n2.json()).sessionId;
1889
+ throw i2.err(`Failed to submit form ${t3.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
1890
+ } catch (e4) {
1891
+ return i2.err(e4), "";
1892
+ }
1893
+ }));
1894
+ }, t2.getFollowUpQuestion = function(e3, t3, i2) {
1895
+ return n(this, void 0, void 0, (function* () {
1896
+ try {
1897
+ const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.followUpQuestion, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, l), body: JSON.stringify(t3) });
1898
+ if (n2.ok) return i2.log(`Received follow up question for form ${t3.integration}`), (yield n2.json()) || "";
1899
+ throw i2.err(`Failed to get follow up question for form ${t3.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
1900
+ } catch (e4) {
1901
+ return i2.err(e4), "";
1902
+ }
1903
+ }));
1904
+ };
1905
+ }, 256: (e2, t2) => {
1906
+ "use strict";
1907
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.Log = void 0, t2.Log = class {
1908
+ constructor(e3) {
1909
+ this.config = e3;
1910
+ }
1911
+ log(...e3) {
1912
+ this.config.get("debug") && console.log("[MagicFeedback]:", ...e3);
1913
+ }
1914
+ err(...e3) {
1915
+ console.error("[MagicFeedback]:", ...e3);
1916
+ }
1917
+ };
1918
+ }, 330: (e2) => {
1919
+ "use strict";
1920
+ e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.1","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":"vitest run --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","vitest":"^0.5.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"}');
1921
+ } }, t = {}, (function i(n) {
1922
+ var r = t[n];
1923
+ if (void 0 !== r) return r.exports;
1924
+ var s = t[n] = { exports: {} };
1925
+ return e[n].call(s.exports, s, s.exports, i), s.exports;
1926
+ })(156).default;
1927
+ var e, t;
1928
+ }));
1929
+ }
1930
+ });
1931
+
1932
+ // src/ui/renderPopup.ts
1933
+ var import_native = __toESM(require_magicfeedback_sdk_browser());
1934
+
1935
+ // src/assets/style.css
1936
+ var style_default = `.magicfeedback-container {
1937
+ width: 100%;
1938
+ }
1939
+
1940
+
1941
+ .magicfeedback-success-message,
1942
+ .magicfeedback-info-message,
1943
+ .magicfeedback-start-message,
1944
+ .magicfeedback-container{
1945
+ animation-duration: 0.5s;
1946
+ animation-name: animate-fade;
1947
+ animation-delay: 0.25s;
1948
+ animation-fill-mode: backwards;
1949
+
1950
+ font-style: normal;
1951
+ text-align: justify;
1952
+ font-weight: 400;
1953
+ font-size: 1.2rem;
1954
+ color: #475569;
1955
+ line-height: 1.5;
1956
+ }
1957
+
1958
+ @keyframes animate-fade {
1959
+ 0% { opacity: 0; }
1960
+ 100% { opacity: 1; }
1961
+ }
1962
+
1963
+ .magicfeedback-form {
1964
+ display: flex;
1965
+ flex-direction: column;
1966
+ justify-content: flex-start;
1967
+ align-items: center;
1968
+ width: 100%;
1969
+ }
1970
+ .magicfeedback-questions {
1971
+ display: flex;
1972
+ flex-direction: column;
1973
+ justify-content: flex-start;
1974
+ align-items: flex-start;
1975
+ width: 100%;
1976
+ }
1977
+
1978
+ .magicfeedback-div {
1979
+ display: flex;
1980
+ flex-direction: column;
1981
+ justify-content: flex-start;
1982
+ align-items: flex-start;
1983
+ margin-bottom: 10px;
1984
+ width: 100%;
1985
+ }
1986
+
1987
+ .magicfeedback-label {
1988
+ margin-bottom: 25px;
1989
+ margin-top: 20px;
1990
+ font-weight: 400;
1991
+ font-family: inherit;
1992
+ font-size: 1.2rem;
1993
+ color: #212529;
1994
+ text-align: start;
1995
+ word-wrap: break-word;
1996
+ white-space: normal;
1997
+
1998
+ }
1999
+
2000
+ .magicfeedback-checkbox {
2001
+ display: flex;
2002
+ flex-direction: column;
2003
+ flex-wrap: wrap;
2004
+ width: 100%;
2005
+ }
2006
+
2007
+ .magicfeedback-checkbox-container {
2008
+ display: flex;
2009
+ flex-direction: row;
2010
+ justify-content: flex-start;
2011
+ align-items: center;
2012
+ margin-bottom: 5px;
2013
+ margin-top: 5px;
2014
+ }
2015
+
2016
+ .magicfeedback-radio {
2017
+ display: flex;
2018
+ flex-direction: column;
2019
+ justify-content: flex-start;
2020
+ flex-wrap: wrap;
2021
+ width: 100%;
2022
+ margin-right: 5px;
2023
+ padding: 5px;
2024
+ }
2025
+
2026
+ .magicfeedback-checkbox-container,
2027
+ .magicfeedback-radio-container {
2028
+ display: flex;
2029
+ flex-direction: row;
2030
+ justify-content: flex-start;
2031
+ align-items: center;
2032
+ margin: 5px;
2033
+ padding: 5px 0;
2034
+ background-color: #fff;
2035
+ border-radius: 5px;
2036
+ box-shadow: 0 0 3px #ccc;
2037
+ }
2038
+
2039
+ .deepdots-popup input::-webkit-outer-spin-button,
2040
+ .deepdots-popup input::-webkit-inner-spin-button {
2041
+ -webkit-appearance: none;
2042
+ -moz-appearance: textfield;
2043
+ }
2044
+
2045
+ .magicfeedback-checkbox input[type="checkbox"] {
2046
+ margin-right: 5px;
2047
+ margin-left: 5px;
2048
+ width: 20px;
2049
+ height: 20px;
2050
+ cursor: pointer;
2051
+ }
2052
+
2053
+
2054
+ .magicfeedback-checkbox label,
2055
+ .magicfeedback-radio-container label {
2056
+ margin-left: 5px;
2057
+ font-weight: 400;
2058
+ font-family: inherit;
2059
+ font-size: 16px;
2060
+ color: #212529;
2061
+ text-align: start;
2062
+ width: 100%;
2063
+ }
2064
+
2065
+ .deepdots-popup p {
2066
+ margin-bottom: 0px;
2067
+ font-size: 12px;
2068
+ }
2069
+
2070
+ .deepdots-popup h2 {
2071
+ line-height: 1.66;
2072
+ margin: 0;
2073
+ padding: 0;
2074
+ font-weight: 900;
2075
+ color: #222;
2076
+ font-family: 'Montserrat';
2077
+ font-size: 18px;
2078
+ text-transform: uppercase;
2079
+ text-align: center;
2080
+ margin-bottom: 40px;
2081
+ }
2082
+
2083
+ .deepdots-popup h6 {
2084
+ margin-bottom: 1rem;
2085
+ }
2086
+
2087
+ .deepdots-popup input[type="date"],
2088
+ .deepdots-popup input[type="text"],
2089
+ .deepdots-popup input[type="number"],
2090
+ .deepdots-popup input[type="email"],
2091
+ .deepdots-popup input[type="password"],
2092
+ .deepdots-popup textarea,
2093
+ .deepdots-popup select {
2094
+ box-sizing: border-box;
2095
+ padding: 10px;
2096
+ margin: 10px 0;
2097
+ width: 100%;
2098
+ border: 2px solid #ccc; /* Default border color - you can customize this */
2099
+ border-radius: 5px;
2100
+ font-size: 18px;
2101
+ outline: none;
2102
+ transition: border-color 0.3s ease;
2103
+ min-height: 50px;
2104
+ font-family: inherit;
2105
+ -webkit-appearance: none;
2106
+ }
2107
+
2108
+ .deepdots-popup select {
2109
+ background-image: linear-gradient(45deg, transparent 50%, gray 50%),
2110
+ linear-gradient(135deg, gray 50%, transparent 50%),
2111
+ linear-gradient(to right, #ccc, #ccc);
2112
+ background-position: calc(100% - 20px) calc(1em + 2px),
2113
+ calc(100% - 15px) calc(1em + 2px),
2114
+ calc(100% - 2.5em) 0.5em;
2115
+ background-size: 5px 5px,
2116
+ 5px 5px,
2117
+ 1px 1.5em;
2118
+ background-repeat: no-repeat;
2119
+ }
2120
+
2121
+ .magicfeedback-boolean-container {
2122
+ display: flex;
2123
+ flex-direction: row;
2124
+ justify-content: flex-start;
2125
+ align-items: center;
2126
+ margin: 10px 0;
2127
+ width: 100%;
2128
+ }
2129
+
2130
+ .magicfeedback-boolean-container label {
2131
+ margin-left: 10px;
2132
+ font-weight: 400;
2133
+ font-size: 16px;
2134
+ width: 100%;
2135
+ padding-top: 5px;
2136
+ }
2137
+
2138
+ .magicfeedback-boolean-option {
2139
+ margin-right: 10px;
2140
+ margin-left: 10px;
2141
+ width: 100%;
2142
+ height: 38px;
2143
+ border-radius: 8px;
2144
+ font-size: 16px;
2145
+ cursor: pointer;
2146
+ border: 1px solid #ced4da !important;
2147
+ }
2148
+
2149
+ .magicfeedback-boolean-option label {
2150
+ font-weight: 400;
2151
+ font-size: 16px;
2152
+ color: #475569;
2153
+ cursor: pointer;
2154
+ width: 100%;
2155
+ height: 100%;
2156
+ display: flex;
2157
+ justify-content: center;
2158
+ align-items: center;
2159
+ border-radius: inherit;
2160
+ }
2161
+
2162
+ .magicfeedback-boolean-option input[type=radio] + label:hover {
2163
+ color: #007bff;
2164
+ }
2165
+
2166
+ .magicfeedback-boolean-option input[type=radio]:checked + label {
2167
+ color: #007bff;
2168
+ background-color: #cadff8;
2169
+ }
2170
+
2171
+ .deepdots-popup input[type="radio"] {
2172
+ padding: 20px;
2173
+ margin: 10px 0 10px 15px;
2174
+ width: 40px;
2175
+ background-color: #fff;
2176
+ box-shadow: none;
2177
+ }
2178
+
2179
+ /* Style for focused input/select */
2180
+ .deepdots-popup input:focus, .deepdots-popup select:focus {
2181
+ border-color: #4CAF50; /* Highlight color when focused - you can customize this */
2182
+ }
2183
+
2184
+ /* Style for invalid input (example: validation error) */
2185
+ .deepdots-popup input.error, .deepdots-popup select.error {
2186
+ border-color: #ff3333; /* Red color for error state - you can customize this */
2187
+ }
2188
+
2189
+ .magicfeedback-action-container {
2190
+ display: flex;
2191
+ flex-direction: row;
2192
+ justify-content: space-between;
2193
+ align-items: center;
2194
+ margin-top: 10px;
2195
+ width: 100%;
2196
+ }
2197
+
2198
+ .magicfeedback-action-container .magicfeedback-submit {
2199
+ cursor: pointer;
2200
+ padding: 10px;
2201
+ margin: 10px 0;
2202
+ width: 100px;
2203
+ border-radius: 8px;
2204
+ font-size: 16px;
2205
+ outline: none;
2206
+ transition: border-color 0.3s ease;
2207
+ background-color: #1E293B;
2208
+ color: white;
2209
+ }
2210
+
2211
+ .magicfeedback-action-container .magicfeedback-back {
2212
+ cursor: pointer;
2213
+ padding: 10px;
2214
+ margin: 10px 0;
2215
+ width: 100px;
2216
+ border: 0;
2217
+ border-radius: 8px;
2218
+ font-size: 16px;
2219
+ outline: none;
2220
+ transition: border-color 0.3s ease;
2221
+ background-color: transparent;
2222
+ color: #212529;
2223
+ }
2224
+
2225
+
2226
+
2227
+ /* Rating styles */
2228
+ .magicfeedback-rating {
2229
+ width: 100%;
2230
+ }
2231
+
2232
+ .magicfeedback-rating-container {
2233
+ display: flex;
2234
+ flex-direction: row;
2235
+ justify-content: space-around;
2236
+ flex-wrap: wrap;
2237
+ align-items: center;
2238
+
2239
+ margin: 15px 5px;
2240
+ padding: 0;
2241
+
2242
+ list-style: none;
2243
+ font-size: 1.5rem;
2244
+ cursor: pointer;
2245
+ user-select: none;
2246
+ -webkit-user-select: none;
2247
+ -moz-user-select: none;
2248
+ -ms-user-select: none;
2249
+ }
2250
+
2251
+ .magicfeedback-rating-placeholder-value,
2252
+ .magicfeedback-rating-placeholder{
2253
+ text-align: center;
2254
+ align-content: center;
2255
+ justify-content: center;
2256
+ text-wrap: wrap;
2257
+ }
2258
+
2259
+ .magicfeedback-rating-option {
2260
+ margin: 0 0.5rem;
2261
+ padding: 0;
2262
+ }
2263
+
2264
+ @media (max-width: 1024px) {
2265
+ .magicfeedback-rating-option {
2266
+ margin: 10px 0;
2267
+ padding: 0;
2268
+ width: 20%;
2269
+ display: flex;
2270
+ justify-content: center;
2271
+ }
2272
+
2273
+ .magicfeedback-rating-placeholder-value {
2274
+ font-size: 0.75rem;
2275
+ margin-bottom: 1px;
2276
+ }
2277
+ .magicfeedback-rating-placeholder{
2278
+ justify-content: center;
2279
+ }
2280
+
2281
+ .magicfeedback-rating-container {
2282
+ flex-wrap: wrap;
2283
+ justify-content: flex-start;
2284
+ }
2285
+ }
2286
+
2287
+
2288
+ .magicfeedback-rating-option-label-container {
2289
+ display: flex;
2290
+ flex-direction: column;
2291
+ }
2292
+
2293
+
2294
+ .magicfeedback-rating-option-label-container label {
2295
+ display: inline-block;
2296
+ text-align: center;
2297
+ margin-bottom: 0;
2298
+ font-weight: 600;
2299
+ font-size: 18px;
2300
+ color: #475569;
2301
+ }
2302
+
2303
+ .magicfeedback-rating-option-label-container input[type=radio] {
2304
+ position: absolute;
2305
+ opacity: 0;
2306
+ width: 0;
2307
+ height: 0;
2308
+ }
2309
+
2310
+ /* IMAGE STYLES */
2311
+ .magicfeedback-rating-option-label-container input[type=radio] + img {
2312
+ cursor: pointer;
2313
+ height: 48px;
2314
+ width: 48px;
2315
+ }
2316
+
2317
+ /* LABEL STYLES */
2318
+ .magicfeedback-rating-option-label-container input[type=radio] + label {
2319
+ cursor: pointer;
2320
+ }
2321
+
2322
+ /* CHECKED STYLES */
2323
+ .magicfeedback-rating-option-label-container input[type=radio]:checked + img {
2324
+ box-shadow: #007bff 0px 1px 4px, #007BFFA0 0px 0px 0px 2px;
2325
+ border-radius: 50%;
2326
+ }
2327
+
2328
+ .magicfeedback-rating-number {
2329
+ width: 100%;
2330
+ }
2331
+ .magicfeedback-rating-container,
2332
+ .magicfeedback-rating-number-container {
2333
+ display: flex;
2334
+ flex-direction: row;
2335
+ justify-content: space-between;
2336
+ align-items: center;
2337
+
2338
+ margin: 15px 0;
2339
+ padding: 0;
2340
+
2341
+ list-style: none;
2342
+ font-size: 1.5rem;
2343
+ cursor: pointer;
2344
+ user-select: none;
2345
+ -webkit-user-select: none;
2346
+ -moz-user-select: none;
2347
+ -ms-user-select: none;
2348
+ }
2349
+
2350
+ /* Cuando hay placeholders (Very bad / Very good), el placeholder ocupa
2351
+ el 100% de la primera l\xEDnea y los boxes bajan a la siguiente */
2352
+ .magicfeedback-rating-number-container--with-placeholder {
2353
+ flex-wrap: wrap;
2354
+ align-items: flex-start;
2355
+ }
2356
+
2357
+ .magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-placeholder {
2358
+ width: 100%;
2359
+ margin-bottom: 8px;
2360
+ }
2361
+
2362
+ .magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-number-option {
2363
+ width: auto;
2364
+ flex: 1;
2365
+ }
2366
+
2367
+ .magicfeedback-rating-number-option {
2368
+ display: flex;
2369
+ flex-direction: row;
2370
+ justify-content: flex-start;
2371
+ align-items: center;
2372
+ margin: 5px;
2373
+ padding: 0;
2374
+ list-style: none;
2375
+ font-size: 1.5rem;
2376
+ cursor: pointer;
2377
+ user-select: none;
2378
+ -webkit-user-select: none;
2379
+ -moz-user-select: none;
2380
+ -ms-user-select: none;
2381
+ width: 100%;
2382
+ }
2383
+
2384
+ .magicfeedback-rating-number-option-row{
2385
+ max-width: 100% !important;
2386
+ }
2387
+
2388
+ .magicfeedback-rating-number-top-placeholder,
2389
+ .magicfeedback-rating-number-bottom-placeholder{
2390
+ text-align: center !important;
2391
+ align-content: center;
2392
+ justify-content: center;
2393
+ text-wrap: wrap;
2394
+
2395
+ font-size: 15px;
2396
+ color: #475569;
2397
+
2398
+ width: 100%;
2399
+ margin: auto;
2400
+ }
2401
+
2402
+ @media (min-width: 650px) {
2403
+ .magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-ltr:first-child,
2404
+ .magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-rtl:last-child {
2405
+ margin-left: 0;
2406
+ width: calc(100% - 10px);
2407
+ }
2408
+
2409
+ .magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-rtl:first-child,
2410
+ .magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-ltr:last-child {
2411
+ margin-right: 0;
2412
+ width: calc(100% - 10px);
2413
+ }
2414
+ }
2415
+
2416
+
2417
+ .magicfeedback-rating-number-option-label-container {
2418
+ display: flex;
2419
+ flex-direction: column;
2420
+ align-items: center;
2421
+ justify-content: center;
2422
+ width: 100%;
2423
+ height: 100%;
2424
+ }
2425
+
2426
+ .magicfeedback-rating-number-option-label-container label {
2427
+ display: flex;
2428
+ align-items: center;
2429
+ justify-content: center;
2430
+ white-space: nowrap;
2431
+ overflow: hidden;
2432
+ text-overflow: ellipsis;
2433
+ margin: 0 10px;
2434
+ font-weight: 600;
2435
+ font-size: 14px;
2436
+ color: #475569;
2437
+ cursor: pointer;
2438
+ width: 100%;
2439
+ height: 100%;
2440
+ min-height: 50px;
2441
+ text-align: center;
2442
+ padding: 0;
2443
+ border-radius: 4px;
2444
+ border: 1px solid #ced4da;
2445
+ background-color: rgba(246, 246, 246, 0.3);
2446
+ transition: background-color 0.15s ease-in-out;
2447
+ }
2448
+
2449
+ .magicfeedback-rating-number-option-label-container input[type=radio] {
2450
+ position: absolute;
2451
+ opacity: 0;
2452
+ width: 0;
2453
+ height: 0;
2454
+ }
2455
+
2456
+ .magicfeedback-rating-number-option-label-container input[type=radio] + label {
2457
+ cursor: pointer;
2458
+ }
2459
+
2460
+ .magicfeedback-rating-number-option-label-container input[type=radio] + label:hover,
2461
+ .magicfeedback-rating-number-option-label-container input[type=radio]:checked + label {
2462
+ color: #007bff;
2463
+ border: 1px solid #007bff;
2464
+ background-color: rgba(86, 168, 253, 0.29);
2465
+ }
2466
+
2467
+ .magicfeedback-rating-number-container-column{
2468
+ align-items: flex-start !important;
2469
+ }
2470
+
2471
+ @media (max-width: 650px) {
2472
+ .magicfeedback-rating-number-container-ltr {
2473
+ justify-content: center;
2474
+ flex-wrap: wrap;
2475
+ }
2476
+
2477
+ .magicfeedback-rating-number-container-rtl {
2478
+ justify-content: center;
2479
+ flex-wrap: wrap-reverse;
2480
+ }
2481
+
2482
+ .magicfeedback-rating-number-option {
2483
+ max-width: 100%;
2484
+ height: 55px;
2485
+ margin: 5px 0;
2486
+ }
2487
+ }
2488
+
2489
+ .magicfeedback-rating-star {
2490
+ width: 100%;
2491
+ }
2492
+
2493
+ .magicfeedback-rating-star-container {
2494
+ display: flex !important;
2495
+ flex-direction: row !important;
2496
+ justify-content: center !important;
2497
+ align-items: center !important;
2498
+ flex-wrap: wrap;
2499
+ margin: 15px 5px;
2500
+ padding: 0;
2501
+ list-style: none;
2502
+ font-size: 1.5rem;
2503
+ cursor: pointer;
2504
+ user-select: none;
2505
+ -webkit-user-select: none;
2506
+ -moz-user-select: none;
2507
+ -ms-user-select: none;
2508
+ }
2509
+
2510
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star {
2511
+ float: right;
2512
+ width: 1em;
2513
+ overflow: hidden;
2514
+ white-space: nowrap;
2515
+ cursor: pointer;
2516
+ font-size: 30px;
2517
+ color: #ccc;
2518
+ margin: 0 10px;
2519
+ }
2520
+
2521
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star:hover,
2522
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star:hover ~ span {
2523
+ color: #deb217 !important;
2524
+ }
2525
+
2526
+ .magicfeedback-rating-star-selected {
2527
+ color: #ffc700 !important;
2528
+ }
2529
+
2530
+
2531
+ /* Style for multiple choice image */
2532
+ .magicfeedback-image-option-label-container:hover {
2533
+ cursor: pointer;
2534
+ border: 0 !important;
2535
+ }
2536
+
2537
+ .magicfeedback-image-option-label-container input[type=radio]:checked + img,
2538
+ .magicfeedback-image-option-label-container input[type=checkbox]:checked + img {
2539
+ border: 1px solid #007bff !important;
2540
+ box-shadow: 0 0 3px #007bff !important;
2541
+ }
2542
+
2543
+ .magicfeedback-image-option-label-container input[type=radio] + img,
2544
+ .magicfeedback-image-option-label-container input[type=checkbox] + img {
2545
+ border: 1px solid transparent !important;
2546
+ }
2547
+
2548
+ .magicfeedback-image-option-label-container{
2549
+ margin: 10px !important;
2550
+ height: calc(100% - 20px) !important;
2551
+ width: calc(100% - 20px) !important;
2552
+ }
2553
+
2554
+ .magicfeedback-multiple-choice-image-option {
2555
+ display: flex;
2556
+ height: auto !important;
2557
+ box-shadow: 0 0 3px #ccc;
2558
+ }
2559
+
2560
+ .magicfeedback-multiple-choice-image-label {
2561
+ font-size: 1rem;
2562
+ }
2563
+
2564
+ .magicfeedback-consent-container {
2565
+ display: flex;
2566
+ flex-direction: row;
2567
+ justify-content: flex-start;
2568
+ align-items: center;
2569
+ margin: 10px 0;
2570
+ width: 100%;
2571
+ }
2572
+
2573
+ .magicfeedback-consent-container label {
2574
+ margin-left: 10px;
2575
+ }
2576
+
2577
+ .magicfeedback-start-message-container {
2578
+ /* ... add your start message container styles here ... */
2579
+ }
2580
+
2581
+ .magicfeedback-success-message,
2582
+ .magicfeedback-info-message,
2583
+ .magicfeedback-start-message {
2584
+ margin: 35px 5px;
2585
+ }
2586
+
2587
+ .magicfeedback-success-message p,
2588
+ .magicfeedback-info-message p,
2589
+ .magicfeedback-start-message p {
2590
+ font-style: normal;
2591
+ text-align: start;
2592
+ font-weight: 400;
2593
+ font-size: 16px;
2594
+ color: #475569;
2595
+ line-height: 1.5;
2596
+ }
2597
+
2598
+ .magicfeedback-success-message img,
2599
+ .magicfeedback-info-message img,
2600
+ .magicfeedback-start-message img {
2601
+ width: 400px;
2602
+ max-width: 80%;
2603
+ height: auto;
2604
+ margin: 10px auto;
2605
+ }
2606
+
2607
+ .magicfeedback-counter,
2608
+ .magicfeedback-point-system-total {
2609
+ margin: 10px 0 0 0 !important;
2610
+ display: flex !important;
2611
+ justify-content: right !important;
2612
+ align-items: center !important;
2613
+ width: 100%;
2614
+ }
2615
+
2616
+ .magicfeedback-skip-container {
2617
+ background-color: transparent !important;
2618
+ border: 0 !important;
2619
+ color: #999999FF !important;
2620
+ padding: 0 !important;
2621
+ margin: 0 !important;
2622
+ cursor: pointer !important;
2623
+ font-size: 0.5em !important;
2624
+ font-weight: 400 !important;
2625
+ box-shadow: 0 0 0 !important;
2626
+
2627
+ &:hover {
2628
+ color: #0066ff;
2629
+ }
2630
+ }
2631
+
2632
+ .magicfeedback-skip-container input[type=checkbox] {
2633
+ border-color: #999999FF !important;
2634
+ border: 0 !important;
2635
+ cursor: pointer !important;
2636
+
2637
+ }
2638
+
2639
+ .magicfeedback-multi-question-matrix,
2640
+ .magicfeedback-point-system,
2641
+ .magicfeedback-priority-list {
2642
+ width: 100% !important;
2643
+ }
2644
+
2645
+ .magicfeedback-multi-question-matrix-container,
2646
+ .magicfeedback-point-system-container,
2647
+ .magicfeedback-priority-list-container {
2648
+ width: 100% !important;
2649
+ overflow-x: auto;
2650
+ }
2651
+
2652
+ .magicfeedback-point-system-list,
2653
+ .magicfeedback-priority-list-list,
2654
+ .magicfeedback-multi-question-matrix-table {
2655
+ width: 100% !important;
2656
+ padding: 0 !important;
2657
+ overflow-x: auto;
2658
+ }
2659
+
2660
+ .magicfeedback-multi-question-matrix {
2661
+ position: relative !important;
2662
+ }
2663
+
2664
+ .magicfeedback-multi-question-matrix-container {
2665
+ overflow: auto !important;
2666
+ padding-bottom: 10px;
2667
+ }
2668
+
2669
+ .magicfeedback-multi-question-matrix-label{
2670
+ text-align: left !important;
2671
+ }
2672
+ .magicfeedback-priority-list-item {
2673
+ display: flex;
2674
+ flex-direction: row;
2675
+ justify-content: space-between;
2676
+ align-items: center;
2677
+ padding: 10px 0 10px 10px;
2678
+
2679
+ border: 1px solid #ced4da;
2680
+ border-radius: 5px;
2681
+ margin: 10px 0 !important;
2682
+ }
2683
+
2684
+ .magicfeedback-point-system-item {
2685
+ height: 45px;
2686
+ margin: 5px 0 !important;
2687
+ }
2688
+
2689
+ .magicfeedback-point-system-item label,
2690
+ .magicfeedback-priority-list-item-label {
2691
+ font-family: inherit;
2692
+ font-size: 18px !important;
2693
+ color: #212529;
2694
+ text-align: start;
2695
+ word-wrap: break-word;
2696
+ white-space: normal;
2697
+ padding: 0 10px 0 0;
2698
+ }
2699
+
2700
+ .magicfeedback-point-system-input-container {
2701
+ padding: 0 10px 0 0;
2702
+ border-radius: 5px;
2703
+ font-size: 14px;
2704
+ border: 1px solid #ced4da;
2705
+ height: 42px;
2706
+ margin: auto 0;
2707
+ }
2708
+
2709
+ .magicfeedback-multi-question-matrix-table thead {
2710
+ margin-bottom: 20px;
2711
+ }
2712
+
2713
+ .magicfeedback-multi-question-matrix-table th{
2714
+ text-align: center;
2715
+ font-weight: 400 !important;
2716
+ font-size: 1rem !important;
2717
+ padding: 0 10px !important;
2718
+ }
2719
+
2720
+ .magicfeedback-multi-question-matrix-table th,
2721
+ .magicfeedback-multi-question-matrix-table td label,
2722
+ .magicfeedback-priority-list-arrow-up,
2723
+ .magicfeedback-priority-list-arrow-down {
2724
+ font-style: normal !important;
2725
+ font-weight: 400 !important;
2726
+ font-size: 1rem !important;
2727
+ color: #475569 !important;
2728
+ cursor: pointer !important;
2729
+ margin: 0 !important;
2730
+ line-height: inherit;
2731
+ }
2732
+
2733
+ .magicfeedback-multi-question-matrix-table tr {
2734
+ align-items: center;
2735
+ margin: 5px 0;
2736
+ }
2737
+
2738
+ .magicfeedback-multi-question-matrix-row-tr{
2739
+ border-radius: 5px;
2740
+ margin: 10px 0 !important;
2741
+ }
2742
+
2743
+ .magicfeedback-multi-question-matrix-row-tr:nth-child(odd) {
2744
+ background-color: #f1f6f6; /* Light gray background for odd rows */
2745
+ }
2746
+
2747
+ .magicfeedback-multi-question-matrix-row-tr:nth-child(even) {
2748
+ background-color: #ffffff; /* White background for even rows */
2749
+ }
2750
+
2751
+ .magicfeedback-multi-question-matrix-row-label {
2752
+ text-align: left !important;
2753
+ }
2754
+
2755
+ .magicfeedback-point-system-item span {
2756
+ color: #475569 !important;
2757
+ }
2758
+
2759
+ .magicfeedback-point-system-item input {
2760
+ padding: 0;
2761
+ margin: 0 !important;
2762
+ width: auto !important;
2763
+ min-width: 100px !important;
2764
+ height: auto !important;
2765
+ min-height: 42px;
2766
+ cursor: pointer;
2767
+ font-size: 14px;
2768
+ text-align: center !important;
2769
+ }
2770
+
2771
+ .magicfeedback-multi-question-matrix-table input {
2772
+ margin: auto !important;
2773
+ padding: 20px !important;
2774
+ width: 100% !important;
2775
+ height: 15px;
2776
+ border: 1px solid #ced4da;
2777
+ cursor: pointer;
2778
+ }
2779
+
2780
+ .magicfeedback-image{
2781
+ max-height: 400px !important;
2782
+ height: auto !important;
2783
+ max-width: 100% !important;
2784
+ margin: 10px auto !important;
2785
+ }
2786
+
2787
+ .magicfeedback-error{
2788
+ margin-top: 5px;
2789
+ }`;
2790
+
2791
+ // src/ui/renderPopup.ts
2792
+ function ensureMagicFeedbackStyles(_popup) {
2793
+ const STYLE_ID = "magicfeedback-sdk-styles";
2794
+ if (document.getElementById(STYLE_ID)) return;
2795
+ const style = document.createElement("style");
2796
+ style.id = STYLE_ID;
2797
+ style.textContent = style_default;
2798
+ document.head.appendChild(style);
2799
+ }
2800
+ function ensureSpinnerStyles(_popup) {
2801
+ if (document.getElementById("deepdots-spinner-styles")) return;
2802
+ const style = document.createElement("style");
2803
+ style.id = "deepdots-spinner-styles";
2804
+ style.textContent = `
2805
+ @keyframes ddspin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
2806
+ .mf-spinner { display:flex; justify-content:center; align-items:center; padding:8px 0; }
2807
+ .mf-spinner-circle { width:28px; height:28px; border:3px solid #e0e6ed; border-top-color:#1E293B; border-radius:50%; animation: ddspin 0.9s linear infinite; }
2808
+ `;
2809
+ document.head.appendChild(style);
2810
+ }
2811
+ function ensureResponsiveStyles(_popup) {
2812
+ if (document.getElementById("deepdots-responsive-styles")) return;
2813
+ const style = document.createElement("style");
2814
+ style.id = "deepdots-responsive-styles";
2815
+ style.textContent = `
2816
+ /* Responsive adjustments */
2817
+ @media (max-width: 640px) {
2818
+ .deepdots-popup {
2819
+ width: calc(100% - 24px) !important;
2820
+ max-width: calc(100% - 24px) !important;
2821
+ height: auto !important;
2822
+ max-height: 90vh !important;
2823
+ border-radius: 12px !important;
2824
+ padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
2825
+ box-sizing: border-box;
2826
+ }
2827
+ .deepdots-popup .mf-spinner-circle { width: 32px; height: 32px; border-width: 4px; }
2828
+ .deepdots-popup button { font-size: 16px !important; }
2829
+ .deepdots-popup-header button { width:48px; height:48px; }
2830
+ .deepdots-popup-header button svg { width:26px; height:26px; }
2831
+ .deepdots-popup-footer { flex-direction: column-reverse !important; gap: 12px !important; }
2832
+ .deepdots-popup-footer button { width: 100%; }
2833
+ }
2834
+ @media (max-width: 400px) {
2835
+ .deepdots-popup { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) 12px !important; }
2836
+ .deepdots-popup-header button { width:48px; height:48px; }
2837
+ .deepdots-popup-header button svg { width:26px; height:26px; }
2838
+ }
2839
+ @media (orientation: landscape) and (max-height: 480px) {
2840
+ .deepdots-popup {
2841
+ height: 100vh !important;
2842
+ max-height: 100vh !important;
2843
+ overflow-y: auto !important;
2844
+ }
2845
+ }
2846
+ `;
2847
+ document.head.appendChild(style);
2848
+ }
2849
+ async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId) {
2850
+ let surveyCompletedEmitted = false;
2851
+ let stylesInjected = false;
2852
+ const isDark = style?.theme === "dark";
2853
+ const theme = {
2854
+ popupBg: isDark ? "#1e1e1e" : "#fff",
2855
+ textPrimary: isDark ? "#f0f0f0" : "#111",
2856
+ closeBtnHoverBg: isDark ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.06)",
2857
+ closeBtnHoverColor: isDark ? "#fff" : "#000000"
2858
+ };
2859
+ const positionMap = {
2860
+ "center": { justifyContent: "center", alignItems: "center", background: "rgba(0,0,0,0.5)" },
2861
+ "bottom": { justifyContent: "center", alignItems: "flex-end", padding: "16px", background: "transparent" },
2862
+ "bottom-right": { justifyContent: "flex-end", alignItems: "flex-end", padding: "16px", background: "transparent" },
2863
+ "bottom-left": { justifyContent: "flex-start", alignItems: "flex-end", padding: "16px", background: "transparent" },
2864
+ "top": { justifyContent: "center", alignItems: "flex-start", padding: "16px", background: "transparent" },
2865
+ "top-right": { justifyContent: "flex-end", alignItems: "flex-start", padding: "16px", background: "transparent" },
2866
+ "top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
2867
+ };
2868
+ const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
2869
+ const popup = document.createElement("div");
2870
+ popup.className = "deepdots-popup";
2871
+ popup.style.cssText = `
2872
+ position: relative;
2873
+ display: flex;
2874
+ flex-direction: column;
2875
+ justify-content: flex-start;
2876
+ background: ${theme.popupBg};
2877
+ border-radius: 8px;
2878
+ padding: 24px;
2879
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
2880
+ max-width: 600px;
2881
+ width: 90%;
2882
+ min-height: 200px;
2883
+ `;
2884
+ const header = document.createElement("div");
2885
+ header.className = "deepdots-popup-header";
2886
+ header.style.cssText = "display:flex; justify-content:flex-end; align-items:center; width:100%;";
2887
+ const closeBtn = document.createElement("button");
2888
+ closeBtn.type = "button";
2889
+ closeBtn.setAttribute("aria-label", "Close popup");
2890
+ closeBtn.innerHTML = `
2891
+ <svg width="28" height="28" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2892
+ <path d="M6 6L18 18M6 18L18 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
2893
+ </svg>
2894
+ `;
2895
+ closeBtn.style.cssText = `
2896
+ background:transparent;
2897
+ border:none;
2898
+ width:32px;
2899
+ height:32px;
2900
+ display:flex;
2901
+ align-items:center;
2902
+ justify-content:center;
2903
+ border-radius: 8px;
2904
+ cursor:pointer;
2905
+ color:${theme.textPrimary};
2906
+ padding:4px;
2907
+ transition: color .15s ease, transform .15s ease, background .15s ease;
2908
+ box-shadow: none !important;
2909
+ `;
2910
+ closeBtn.onmouseenter = () => {
2911
+ closeBtn.style.color = theme.closeBtnHoverColor;
2912
+ closeBtn.style.background = theme.closeBtnHoverBg;
2913
+ closeBtn.style.transform = "scale(1.06)";
2914
+ };
2915
+ closeBtn.onmouseleave = () => {
2916
+ closeBtn.style.color = theme.textPrimary;
2917
+ closeBtn.style.background = "transparent";
2918
+ closeBtn.style.transform = "scale(1)";
2919
+ };
2920
+ closeBtn.onclick = () => {
2921
+ emit("popup_clicked", surveyId, { action: "close_icon" });
2922
+ onClose();
2923
+ };
2924
+ header.appendChild(closeBtn);
2925
+ ensureMagicFeedbackStyles(popup);
2926
+ ensureSpinnerStyles(popup);
2927
+ ensureResponsiveStyles(popup);
2928
+ const containerContent = document.createElement("div");
2929
+ containerContent.className = "deepdots-popup-container-conetent";
2930
+ containerContent.style.cssText = `
2931
+ display:flex;
2932
+ flex-direction:column;
2933
+ padding: 0 20px 12px 20px;
2934
+ max-height: 80vh; /* l\xEDmite general del popup */
2935
+ overflow: hidden; /* quita scroll del contenedor principal */
2936
+ `;
2937
+ const main = document.createElement("div");
2938
+ main.className = "deepdots-popup-main";
2939
+ main.style.cssText = "display:flex; flex-direction:column; width:100%; max-height:80vh; overflow-y:auto;";
2940
+ const formWrapper = document.createElement("div");
2941
+ formWrapper.style.cssText = "width:100%; flex: 1 1 auto;";
2942
+ const errorHint = document.createElement("div");
2943
+ errorHint.className = "deepdots-error-hint";
2944
+ errorHint.style.cssText = `
2945
+ display: none;
2946
+ margin: 12px 0 0 0;
2947
+ padding: 10px 12px;
2948
+ border-radius: 6px;
2949
+ background: #FEF3C7; /* amber-100 */
2950
+ color: #92400E; /* amber-700 */
2951
+ border: 1px solid #FCD34D; /* amber-300 */
2952
+ font-size: 13px;
2953
+ `;
2954
+ errorHint.setAttribute("role", "alert");
2955
+ errorHint.setAttribute("aria-live", "polite");
2956
+ const spinnerEl = document.createElement("div");
2957
+ spinnerEl.className = "mf-spinner";
2958
+ spinnerEl.setAttribute("role", "status");
2959
+ spinnerEl.setAttribute("aria-label", "Loading survey");
2960
+ spinnerEl.innerHTML = '<div class="mf-spinner-circle"></div>';
2961
+ spinnerEl.style.cssText = "position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);";
2962
+ const formDivId = `magicfeedback-form-${surveyId}`;
2963
+ const formHost = document.createElement("div");
2964
+ formHost.id = formDivId;
2965
+ formHost.style.cssText = "width:100%; visibility:hidden;";
2966
+ formWrapper.appendChild(spinnerEl);
2967
+ formWrapper.appendChild(formHost);
2968
+ main.appendChild(formWrapper);
2969
+ main.appendChild(errorHint);
2970
+ const footer = document.createElement("div");
2971
+ footer.className = "deepdots-popup-footer";
2972
+ footer.setAttribute("data-actions-wrapper", "true");
2973
+ footer.style.cssText = "display:flex; flex-direction: row-reverse ;justify-content:space-between; align-items:center; gap:8px; margin-top:auto; width:100%; padding-top:16px;";
2974
+ const backButton = document.createElement("button");
2975
+ backButton.textContent = actions?.back ? actions.back.label : "Back";
2976
+ backButton.style.cssText = `
2977
+ background: transparent;
2978
+ color: #333;
2979
+ border: 1px solid #999;
2980
+ padding: 12px 24px;
2981
+ border-radius: 4px;
2982
+ cursor: pointer;
2983
+ font-size: 14px;
2984
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
2985
+ transition: filter .15s ease;
2986
+ display: inline-flex;
2987
+ align-items: center;
2988
+ justify-content: center;
2989
+ text-align: center;
2990
+ `;
2991
+ backButton.onmouseenter = () => {
2992
+ backButton.style.filter = "brightness(0.9)";
2993
+ };
2994
+ backButton.onmouseleave = () => {
2995
+ backButton.style.filter = "brightness(1)";
2996
+ };
2997
+ backButton.onclick = () => {
2998
+ emit("popup_clicked", surveyId, { action: "back" });
2999
+ formInstance?.back?.();
3000
+ };
3001
+ const startButton = document.createElement("button");
3002
+ startButton.textContent = actions?.start ? actions.start.label : "Start survey";
3003
+ startButton.style.cssText = `
3004
+ background: #1E293B;
3005
+ color: #fff;
3006
+ border: none;
3007
+ padding: 12px 24px;
3008
+ border-radius: 4px;
3009
+ cursor: pointer;
3010
+ font-size: 14px;
3011
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3012
+ transition: filter .15s ease;
3013
+ display: inline-flex;
3014
+ align-items: center;
3015
+ justify-content: center;
3016
+ text-align: center;
3017
+ `;
3018
+ startButton.onclick = () => {
3019
+ emit("popup_clicked", surveyId, { action: "start_survey" });
3020
+ formInstance?.startForm?.();
3021
+ };
3022
+ const closeButton = document.createElement("button");
3023
+ closeButton.textContent = actions?.complete ? actions.complete.label : "Complete survey";
3024
+ closeButton.style.cssText = `
3025
+ background: #1E293B;
3026
+ color: #fff;
3027
+ border: none;
3028
+ padding: 12px 24px;
3029
+ border-radius: 4px;
3030
+ cursor: pointer;
3031
+ font-size: 14px;
3032
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3033
+ transition: filter .15s ease;
3034
+ display: inline-flex;
3035
+ align-items: center;
3036
+ justify-content: center;
3037
+ text-align: center;
3038
+ `;
3039
+ closeButton.onmouseenter = () => {
3040
+ closeButton.style.filter = "brightness(0.9)";
3041
+ };
3042
+ closeButton.onmouseleave = () => {
3043
+ closeButton.style.filter = "brightness(1)";
3044
+ };
3045
+ closeButton.onclick = () => {
3046
+ emit("popup_clicked", surveyId, { action: "complete" });
3047
+ onClose();
3048
+ };
3049
+ const submitButton = document.createElement("button");
3050
+ submitButton.textContent = actions?.accept ? actions.accept.label : "Send";
3051
+ submitButton.style.cssText = `
3052
+ background: #1E293B;
3053
+ color: #fff;
3054
+ border: none;
3055
+ padding: 12px 24px;
3056
+ border-radius: 4px;
3057
+ cursor: pointer;
3058
+ font-size: 14px;
3059
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
3060
+ transition: filter .15s ease;
3061
+ display: inline-flex;
3062
+ align-items: center;
3063
+ justify-content: center;
3064
+ text-align: center;
3065
+ `;
3066
+ submitButton.onclick = () => {
3067
+ if (!surveyCompletedEmitted) {
3068
+ emit("popup_clicked", surveyId, { action: "manual_send" });
3069
+ formInstance?.send?.();
3070
+ }
3071
+ };
3072
+ backButton.style.display = "none";
3073
+ startButton.style.display = "none";
3074
+ submitButton.style.display = "none";
3075
+ closeButton.style.display = "none";
3076
+ footer.appendChild(submitButton);
3077
+ footer.appendChild(backButton);
3078
+ footer.appendChild(closeButton);
3079
+ footer.appendChild(startButton);
3080
+ main.appendChild(footer);
3081
+ containerContent.appendChild(main);
3082
+ function updateButtons(state) {
3083
+ backButton.style.display = "none";
3084
+ startButton.style.display = "none";
3085
+ submitButton.style.display = "none";
3086
+ closeButton.style.display = "none";
3087
+ backButton.style.width = "";
3088
+ startButton.style.width = "";
3089
+ submitButton.style.width = "";
3090
+ closeButton.style.width = "";
3091
+ switch (state) {
3092
+ case "loading":
3093
+ break;
3094
+ case "start":
3095
+ startButton.style.display = "inline-flex";
3096
+ startButton.style.width = "100%";
3097
+ break;
3098
+ case "in_progress_first":
3099
+ submitButton.style.display = "inline-flex";
3100
+ submitButton.style.width = "";
3101
+ setLoading(false);
3102
+ break;
3103
+ case "in_progress_next":
3104
+ backButton.style.display = "inline-flex";
3105
+ submitButton.style.display = "inline-flex";
3106
+ setLoading(false);
3107
+ break;
3108
+ case "completed":
3109
+ closeButton.style.display = "inline-flex";
3110
+ closeButton.style.width = "100%";
3111
+ setLoading(false);
3112
+ break;
3113
+ case "error":
3114
+ setLoading(false);
3115
+ break;
3116
+ }
3117
+ }
3118
+ popup.appendChild(header);
3119
+ popup.appendChild(containerContent);
3120
+ container.innerHTML = "";
3121
+ container.appendChild(popup);
3122
+ container.style.display = "flex";
3123
+ container.style.justifyContent = pos.justifyContent;
3124
+ container.style.alignItems = pos.alignItems;
3125
+ container.style.background = pos.background;
3126
+ if (pos.padding) container.style.padding = pos.padding;
3127
+ function setLoading(isLoading) {
3128
+ spinnerEl.style.display = isLoading ? "flex" : "none";
3129
+ if (!isLoading) {
3130
+ formHost.style.visibility = "visible";
3131
+ }
3132
+ footer.style.display = isLoading ? "none" : "flex";
3133
+ backButton.disabled = isLoading;
3134
+ startButton.disabled = isLoading;
3135
+ closeButton.disabled = isLoading;
3136
+ submitButton.disabled = isLoading;
3137
+ submitButton.style.opacity = isLoading ? "0.6" : "1";
3138
+ submitButton.style.cursor = isLoading ? "not-allowed" : "pointer";
3139
+ if (isLoading) {
3140
+ updateButtons("loading");
3141
+ }
3142
+ }
3143
+ setLoading(true);
3144
+ if (typeof window === "undefined" || typeof document === "undefined") {
3145
+ return;
3146
+ }
3147
+ let formInstance = null;
3148
+ try {
3149
+ if (!import_native.default || typeof import_native.default.form !== "function") {
3150
+ console.warn("[MagicFeedback] form() no disponible. Fallback manual.");
3151
+ setLoading(false);
3152
+ return;
3153
+ }
3154
+ import_native.default.init(
3155
+ {
3156
+ debug: true,
3157
+ env: env === "production" ? "prod" : "dev"
3158
+ }
3159
+ );
3160
+ const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null, analyticsFeedbackSessionId ?? null);
3161
+ formInstance = import_native.default.form(surveyId, productId, profile, metadata);
3162
+ const generateOptions = {
3163
+ addButton: false,
3164
+ getMetaData: true
3165
+ };
3166
+ generateOptions.onLoadedEvent = ({ formData }) => {
3167
+ try {
3168
+ } catch (e) {
3169
+ }
3170
+ const s = formData?.style;
3171
+ if (s && !stylesInjected) {
3172
+ stylesInjected = true;
3173
+ if (s.boxBackgroundColor) {
3174
+ popup.style.background = s.boxBackgroundColor;
3175
+ }
3176
+ if (s.contentAlign) {
3177
+ main.style.justifyContent = s.contentAlign === "center" ? "center" : "flex-start";
3178
+ }
3179
+ if (s.buttonPrimaryColor) {
3180
+ submitButton.style.background = s.buttonPrimaryColor;
3181
+ submitButton.style.border = "none";
3182
+ submitButton.style.color = "#fff";
3183
+ startButton.style.background = s.buttonPrimaryColor;
3184
+ startButton.style.border = "none";
3185
+ startButton.style.color = "#fff";
3186
+ closeButton.style.background = s.buttonPrimaryColor;
3187
+ closeButton.style.border = "none";
3188
+ closeButton.style.color = "#fff";
3189
+ }
3190
+ if (s.buttonSecondaryColor) {
3191
+ backButton.style.background = "#fff";
3192
+ backButton.style.color = s.buttonSecondaryColor;
3193
+ backButton.style.border = `1px solid ${s.buttonSecondaryColor}`;
3194
+ }
3195
+ if (s.logo) {
3196
+ if (!document.getElementById("deepdots-popup-logo")) {
3197
+ const logoImg = document.createElement("img");
3198
+ logoImg.id = "deepdots-popup-logo";
3199
+ logoImg.src = s.logo;
3200
+ logoImg.alt = "Logo";
3201
+ logoImg.style.cssText = "max-height:40px; max-width:100%; object-fit:contain;";
3202
+ if (s.logoSize) {
3203
+ switch (s.logoSize) {
3204
+ case "small":
3205
+ logoImg.style.maxHeight = "30px";
3206
+ break;
3207
+ case "medium":
3208
+ logoImg.style.maxHeight = "50px";
3209
+ break;
3210
+ case "large":
3211
+ logoImg.style.maxHeight = "70px";
3212
+ break;
3213
+ }
3214
+ }
3215
+ if (s.logoPosition) {
3216
+ switch (s.logoPosition) {
3217
+ case "left":
3218
+ logoImg.style.margin = "0 16px 42px 0";
3219
+ logoImg.style.display = "block";
3220
+ logoImg.style.marginLeft = "0";
3221
+ break;
3222
+ case "right":
3223
+ logoImg.style.margin = "0 0 42px 16px";
3224
+ logoImg.style.display = "block";
3225
+ logoImg.style.marginLeft = "auto";
3226
+ break;
3227
+ case "center":
3228
+ logoImg.style.margin = "0 auto 42px auto";
3229
+ logoImg.style.display = "block";
3230
+ break;
3231
+ }
3232
+ }
3233
+ containerContent.insertBefore(logoImg, main);
3234
+ }
3235
+ }
3236
+ if (s.startMessage && s.startMessage !== "") {
3237
+ console.log(s.startMessage);
3238
+ updateButtons("start");
3239
+ } else {
3240
+ updateButtons("in_progress_first");
3241
+ }
3242
+ } else {
3243
+ updateButtons("in_progress_first");
3244
+ }
3245
+ emit("popup_clicked", surveyId, { action: "loaded" });
3246
+ setLoading(false);
3247
+ };
3248
+ generateOptions.beforeSubmitEvent = () => {
3249
+ setLoading(true);
3250
+ emit("popup_clicked", surveyId, { action: "before_submit" });
3251
+ };
3252
+ generateOptions.afterSubmitEvent = ({ error, completed, total, progress }) => {
3253
+ const errText = error ? typeof error === "string" ? error : error.message ?? String(error) : "";
3254
+ if (errText) {
3255
+ setLoading(false);
3256
+ if (errText.toLowerCase().includes("no response")) {
3257
+ errorHint.textContent = "Please answer the required question to continue.";
3258
+ errorHint.style.display = "block";
3259
+ emit("popup_clicked", surveyId, { action: "validation_error_required" });
3260
+ updateButtons("in_progress_next");
3261
+ return;
3262
+ }
3263
+ errorHint.textContent = "An error occurred while submitting. Please try again or close the popup.";
3264
+ errorHint.style.display = "block";
3265
+ emit("popup_clicked", surveyId, { action: "submit_error", error: errText });
3266
+ return;
3267
+ }
3268
+ errorHint.style.display = "none";
3269
+ setLoading(false);
3270
+ if (completed) {
3271
+ emit("survey_completed", surveyId, { action: "completed" });
3272
+ surveyCompletedEmitted = true;
3273
+ updateButtons("completed");
3274
+ return;
3275
+ }
3276
+ emit("popup_clicked", surveyId, { action: "partial" });
3277
+ if (total > 1 && progress > 0 && progress < total) {
3278
+ updateButtons("in_progress_next");
3279
+ } else {
3280
+ updateButtons("in_progress_first");
3281
+ }
3282
+ };
3283
+ generateOptions.onBackEvent = ({ progress }) => {
3284
+ emit("popup_clicked", surveyId, { action: "back" });
3285
+ if (progress === 0) {
3286
+ updateButtons("in_progress_first");
3287
+ } else {
3288
+ updateButtons("in_progress_next");
3289
+ }
3290
+ };
3291
+ formInstance.generate(formDivId, generateOptions).catch((err) => {
3292
+ console.error("[MagicFeedback] Error generating form:", err);
3293
+ setLoading(false);
3294
+ });
3295
+ } catch (e) {
3296
+ console.error("[MagicFeedback] Exception initializing form:", e);
3297
+ setLoading(false);
3298
+ }
3299
+ }
3300
+ export {
3301
+ renderPopup
3302
+ };
3303
+ //# sourceMappingURL=renderPopup-YLFRGPQN.mjs.map