hocmai-feedback-widget 0.1.14 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +42 -32
  2. package/dist/components/FeedbackWidget.d.ts +2 -1
  3. package/dist/context/FeedbackContext.d.ts +1 -1
  4. package/dist/support-feedback-lib.es.js +2059 -1230
  5. package/dist/support-feedback-lib.umd.js +23 -3
  6. package/dist/utils/screenshot/background-renderer.d.ts +3 -0
  7. package/dist/utils/screenshot/canvas-renderer.d.ts +9 -0
  8. package/dist/utils/screenshot/cleanup.d.ts +3 -0
  9. package/dist/utils/screenshot/device-detection.d.ts +2 -0
  10. package/dist/utils/screenshot/element-collector.d.ts +10 -0
  11. package/dist/utils/screenshot/image-renderer.d.ts +21 -0
  12. package/dist/utils/screenshot/performance.d.ts +3 -0
  13. package/dist/utils/screenshot/svg-renderer.d.ts +24 -0
  14. package/dist/utils/screenshot/text-renderer.d.ts +23 -0
  15. package/dist/utils/screenshot/types.d.ts +35 -0
  16. package/dist/utils/screenshot.d.ts +9 -7
  17. package/package.json +7 -4
  18. package/src/App.css +42 -0
  19. package/src/App.tsx +75 -0
  20. package/src/assets/react.svg +1 -0
  21. package/src/components/CropOverlay.tsx +174 -0
  22. package/src/components/FeedbackWidget.tsx +854 -0
  23. package/src/context/FeedbackContext.tsx +66 -0
  24. package/src/index.css +68 -0
  25. package/src/index.ts +3 -0
  26. package/src/main.tsx +10 -0
  27. package/src/utils/device.ts +22 -0
  28. package/src/utils/screenshot/background-renderer.ts +54 -0
  29. package/src/utils/screenshot/canvas-renderer.ts +217 -0
  30. package/src/utils/screenshot/cleanup.ts +32 -0
  31. package/src/utils/screenshot/device-detection.ts +38 -0
  32. package/src/utils/screenshot/element-collector.ts +83 -0
  33. package/src/utils/screenshot/image-renderer.ts +148 -0
  34. package/src/utils/screenshot/performance.ts +57 -0
  35. package/src/utils/screenshot/svg-renderer.ts +126 -0
  36. package/src/utils/screenshot/text-renderer.ts +212 -0
  37. package/src/utils/screenshot/types.ts +40 -0
  38. package/src/utils/screenshot.ts +68 -0
@@ -1,84 +1,84 @@
1
- import { jsxs as x, jsx as g, Fragment as nt } from "react/jsx-runtime";
2
- import St, { forwardRef as Yt, createElement as rt, useState as T, useEffect as xi, createContext as vi, useContext as ki } from "react";
3
- var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1
+ import { jsxs as A, jsx as C, Fragment as Ae } from "react/jsx-runtime";
2
+ import Mt, { forwardRef as rn, createElement as gt, useState as F, useEffect as Ot, createContext as Un, useContext as zn } from "react";
3
+ var Bn = "2.0.7", Pn = 500, Dt = "user-agent", we = "", Ft = "?", O = {
4
4
  FUNCTION: "function",
5
5
  OBJECT: "object",
6
6
  STRING: "string",
7
7
  UNDEFINED: "undefined"
8
- }, F = "browser", X = "cpu", j = "device", W = "engine", U = "os", ge = "result", c = "name", a = "type", d = "vendor", u = "version", P = "architecture", Ie = "major", l = "model", _e = "console", w = "mobile", v = "tablet", I = "smarttv", V = "wearable", Pe = "xr", Ee = "embedded", ce = "inapp", dt = "brands", oe = "formFactors", ut = "fullVersionList", be = "platform", ht = "platformVersion", We = "bitness", te = "sec-ch-ua", Ei = te + "-full-version-list", Ii = te + "-arch", Ti = te + "-" + We, Ri = te + "-form-factors", Mi = te + "-" + w, Oi = te + "-" + l, Qt = te + "-" + be, Ai = Qt + "-version", Zt = [dt, ut, w, l, be, ht, P, oe, We], Le = "Amazon", de = "Apple", It = "ASUS", Tt = "BlackBerry", re = "Google", Rt = "Huawei", Xe = "Lenovo", Mt = "Honor", De = "LG", Ye = "Microsoft", Qe = "Motorola", Ot = "Nvidia", At = "OnePlus", Ze = "OPPO", ye = "Samsung", Pt = "Sharp", xe = "Sony", Ke = "Xiaomi", Je = "Zebra", Lt = "Chrome", Dt = "Chromium", Z = "Chromecast", ze = "Edge", ve = "Firefox", ke = "Opera", et = "Facebook", Ft = "Sogou", ue = "Mobile ", Se = " Browser", ot = "Windows", Pi = typeof window !== E.UNDEFINED, D = Pi && window.navigator ? window.navigator : void 0, se = D && D.userAgentData ? D.userAgentData : void 0, Li = function(e, t) {
9
- var i = {}, n = t;
10
- if (!He(t)) {
11
- n = {};
12
- for (var o in t)
13
- for (var s in t[o])
14
- n[s] = t[o][s].concat(n[s] ? n[s] : []);
8
+ }, P = "browser", Z = "cpu", G = "device", V = "engine", $ = "os", be = "result", f = "name", c = "type", h = "vendor", g = "version", U = "architecture", Ne = "major", u = "model", Ve = "console", E = "mobile", R = "tablet", D = "smarttv", j = "wearable", Pe = "xr", Re = "embedded", he = "inapp", xt = "brands", ce = "formFactors", vt = "fullVersionList", ye = "platform", St = "platformVersion", Je = "bitness", se = "sec-ch-ua", Hn = se + "-full-version-list", $n = se + "-arch", Wn = se + "-" + Je, qn = se + "-form-factors", Vn = se + "-" + E, jn = se + "-" + u, on = se + "-" + ye, Gn = on + "-version", sn = [xt, vt, E, u, ye, St, U, ce, Je], He = "Amazon", ge = "Apple", _t = "ASUS", Lt = "BlackBerry", le = "Google", Ut = "Huawei", ot = "Lenovo", zt = "Honor", $e = "LG", st = "Microsoft", at = "Motorola", Bt = "Nvidia", Pt = "OnePlus", lt = "OPPO", Se = "Samsung", Ht = "Sharp", Ce = "Sony", ct = "Xiaomi", dt = "Zebra", $t = "Chrome", Wt = "Chromium", ne = "Chromecast", je = "Edge", ke = "Firefox", Ee = "Opera", ut = "Facebook", qt = "Sogou", pe = "Mobile ", Te = " Browser", pt = "Windows", Xn = typeof window !== O.UNDEFINED, B = Xn && window.navigator ? window.navigator : void 0, de = B && B.userAgentData ? B.userAgentData : void 0, Yn = function(e, t) {
9
+ var n = {}, i = t;
10
+ if (!Ge(t)) {
11
+ i = {};
12
+ for (var a in t)
13
+ for (var o in t[a])
14
+ i[o] = t[a][o].concat(i[o] ? i[o] : []);
15
15
  }
16
16
  for (var r in e)
17
- i[r] = n[r] && n[r].length % 2 === 0 ? n[r].concat(e[r]) : e[r];
18
- return i;
19
- }, Ve = function(e) {
20
- for (var t = {}, i = 0; i < e.length; i++)
21
- t[e[i].toUpperCase()] = e[i];
17
+ n[r] = i[r] && i[r].length % 2 === 0 ? i[r].concat(e[r]) : e[r];
18
+ return n;
19
+ }, Qe = function(e) {
20
+ for (var t = {}, n = 0; n < e.length; n++)
21
+ t[e[n].toUpperCase()] = e[n];
22
22
  return t;
23
- }, st = function(e, t) {
24
- if (typeof e === E.OBJECT && e.length > 0) {
25
- for (var i in e)
26
- if (K(t) == K(e[i])) return !0;
23
+ }, mt = function(e, t) {
24
+ if (typeof e === O.OBJECT && e.length > 0) {
25
+ for (var n in e)
26
+ if (ie(t) == ie(e[n])) return !0;
27
27
  return !1;
28
28
  }
29
- return Te(e) ? K(t) == K(e) : !1;
30
- }, He = function(e, t) {
31
- for (var i in e)
32
- return /^(browser|cpu|device|engine|os)$/.test(i) || (t ? He(e[i]) : !1);
33
- }, Te = function(e) {
34
- return typeof e === E.STRING;
35
- }, tt = function(e) {
29
+ return Fe(e) ? ie(t) == ie(e) : !1;
30
+ }, Ge = function(e, t) {
31
+ for (var n in e)
32
+ return /^(browser|cpu|device|engine|os)$/.test(n) || (t ? Ge(e[n]) : !1);
33
+ }, Fe = function(e) {
34
+ return typeof e === O.STRING;
35
+ }, ft = function(e) {
36
36
  if (e) {
37
- for (var t = [], i = we(/\\?\"/g, e).split(","), n = 0; n < i.length; n++)
38
- if (i[n].indexOf(";") > -1) {
39
- var o = Ue(i[n]).split(";v=");
40
- t[n] = { brand: o[0], version: o[1] };
37
+ for (var t = [], n = xe(/\\?\"/g, e).split(","), i = 0; i < n.length; i++)
38
+ if (n[i].indexOf(";") > -1) {
39
+ var a = Xe(n[i]).split(";v=");
40
+ t[i] = { brand: a[0], version: a[1] };
41
41
  } else
42
- t[n] = Ue(i[n]);
42
+ t[i] = Xe(n[i]);
43
43
  return t;
44
44
  }
45
+ }, ie = function(e) {
46
+ return Fe(e) ? e.toLowerCase() : e;
47
+ }, wt = function(e) {
48
+ return Fe(e) ? xe(/[^\d\.]/g, e).split(".")[0] : void 0;
45
49
  }, K = function(e) {
46
- return Te(e) ? e.toLowerCase() : e;
47
- }, at = function(e) {
48
- return Te(e) ? we(/[^\d\.]/g, e).split(".")[0] : void 0;
49
- }, G = function(e) {
50
50
  for (var t in e)
51
51
  if (e.hasOwnProperty(t)) {
52
- var i = e[t];
53
- typeof i == E.OBJECT && i.length == 2 ? this[i[0]] = i[1] : this[i] = void 0;
52
+ var n = e[t];
53
+ typeof n == O.OBJECT && n.length == 2 ? this[n[0]] = n[1] : this[n] = void 0;
54
54
  }
55
55
  return this;
56
- }, we = function(e, t) {
57
- return Te(t) ? t.replace(e, pe) : t;
58
- }, Ce = function(e) {
59
- return we(/\\?\"/g, e);
60
- }, Ue = function(e, t) {
61
- return e = we(/^\s\s*/, String(e)), typeof t === E.UNDEFINED ? e : e.substring(0, t);
62
- }, lt = function(e, t) {
56
+ }, xe = function(e, t) {
57
+ return Fe(t) ? t.replace(e, we) : t;
58
+ }, Ie = function(e) {
59
+ return xe(/\\?\"/g, e);
60
+ }, Xe = function(e, t) {
61
+ return e = xe(/^\s\s*/, String(e)), typeof t === O.UNDEFINED ? e : e.substring(0, t);
62
+ }, bt = function(e, t) {
63
63
  if (!(!e || !t))
64
- for (var i = 0, n, o, s, r, h, f; i < t.length && !h; ) {
65
- var b = t[i], m = t[i + 1];
66
- for (n = o = 0; n < b.length && !h && b[n]; )
67
- if (h = b[n++].exec(e), h)
68
- for (s = 0; s < m.length; s++)
69
- f = h[++o], r = m[s], typeof r === E.OBJECT && r.length > 0 ? r.length === 2 ? typeof r[1] == E.FUNCTION ? this[r[0]] = r[1].call(this, f) : this[r[0]] = r[1] : r.length >= 3 && (typeof r[1] === E.FUNCTION && !(r[1].exec && r[1].test) ? r.length > 3 ? this[r[0]] = f ? r[1].apply(this, r.slice(2)) : void 0 : this[r[0]] = f ? r[1].call(this, f, r[2]) : void 0 : r.length == 3 ? this[r[0]] = f ? f.replace(r[1], r[2]) : void 0 : r.length == 4 ? this[r[0]] = f ? r[3].call(this, f.replace(r[1], r[2])) : void 0 : r.length > 4 && (this[r[0]] = f ? r[3].apply(this, [f.replace(r[1], r[2])].concat(r.slice(4))) : void 0)) : this[r] = f || void 0;
70
- i += 2;
64
+ for (var n = 0, i, a, o, r, s, d; n < t.length && !s; ) {
65
+ var p = t[n], l = t[n + 1];
66
+ for (i = a = 0; i < p.length && !s && p[i]; )
67
+ if (s = p[i++].exec(e), s)
68
+ for (o = 0; o < l.length; o++)
69
+ d = s[++a], r = l[o], typeof r === O.OBJECT && r.length > 0 ? r.length === 2 ? typeof r[1] == O.FUNCTION ? this[r[0]] = r[1].call(this, d) : this[r[0]] = r[1] : r.length >= 3 && (typeof r[1] === O.FUNCTION && !(r[1].exec && r[1].test) ? r.length > 3 ? this[r[0]] = d ? r[1].apply(this, r.slice(2)) : void 0 : this[r[0]] = d ? r[1].call(this, d, r[2]) : void 0 : r.length == 3 ? this[r[0]] = d ? d.replace(r[1], r[2]) : void 0 : r.length == 4 ? this[r[0]] = d ? r[3].call(this, d.replace(r[1], r[2])) : void 0 : r.length > 4 && (this[r[0]] = d ? r[3].apply(this, [d.replace(r[1], r[2])].concat(r.slice(4))) : void 0)) : this[r] = d || void 0;
70
+ n += 2;
71
71
  }
72
- }, B = function(e, t) {
73
- for (var i in t)
74
- if (typeof t[i] === E.OBJECT && t[i].length > 0) {
75
- for (var n = 0; n < t[i].length; n++)
76
- if (st(t[i][n], e))
77
- return i === Et ? void 0 : i;
78
- } else if (st(t[i], e))
79
- return i === Et ? void 0 : i;
72
+ }, q = function(e, t) {
73
+ for (var n in t)
74
+ if (typeof t[n] === O.OBJECT && t[n].length > 0) {
75
+ for (var i = 0; i < t[n].length; i++)
76
+ if (mt(t[n][i], e))
77
+ return n === Ft ? void 0 : n;
78
+ } else if (mt(t[n], e))
79
+ return n === Ft ? void 0 : n;
80
80
  return t.hasOwnProperty("*") ? t["*"] : e;
81
- }, _t = {
81
+ }, Vt = {
82
82
  ME: "4.90",
83
83
  "NT 3.51": "3.51",
84
84
  "NT 4.0": "4.0",
@@ -90,7 +90,7 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
90
90
  "8.1": "6.3",
91
91
  10: ["6.4", "10.0"],
92
92
  NT: ""
93
- }, zt = {
93
+ }, jt = {
94
94
  embedded: "Automotive",
95
95
  mobile: "Mobile",
96
96
  tablet: ["Tablet", "EInk"],
@@ -99,7 +99,7 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
99
99
  xr: ["VR", "XR"],
100
100
  "?": ["Desktop", "Unknown"],
101
101
  "*": void 0
102
- }, Di = {
102
+ }, Jn = {
103
103
  Chrome: "Google Chrome",
104
104
  Edge: "Microsoft Edge",
105
105
  "Edge WebView2": "Microsoft Edge WebView2",
@@ -109,23 +109,23 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
109
109
  "MIUI Browser": "Miui Browser",
110
110
  "Opera Mobi": "OperaMobile",
111
111
  Yandex: "YaBrowser"
112
- }, Ht = {
112
+ }, Gt = {
113
113
  browser: [
114
114
  [
115
115
  // Most common regardless engine
116
116
  /\b(?:crmo|crios)\/([\w\.]+)/i
117
117
  // Chrome for Android/iOS
118
118
  ],
119
- [u, [c, ue + "Chrome"]],
119
+ [g, [f, pe + "Chrome"]],
120
120
  [
121
121
  /webview.+edge\/([\w\.]+)/i
122
122
  // Microsoft Edge
123
123
  ],
124
- [u, [c, ze + " WebView"]],
124
+ [g, [f, je + " WebView"]],
125
125
  [
126
126
  /edg(?:e|ios|a)?\/([\w\.]+)/i
127
127
  ],
128
- [u, [c, "Edge"]],
128
+ [g, [f, "Edge"]],
129
129
  [
130
130
  // Presto based
131
131
  /(opera mini)\/([-\w\.]+)/i,
@@ -135,33 +135,33 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
135
135
  /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i
136
136
  // Opera
137
137
  ],
138
- [c, u],
138
+ [f, g],
139
139
  [
140
140
  /opios[\/ ]+([\w\.]+)/i
141
141
  // Opera mini on iphone >= 8.0
142
142
  ],
143
- [u, [c, ke + " Mini"]],
143
+ [g, [f, Ee + " Mini"]],
144
144
  [
145
145
  /\bop(?:rg)?x\/([\w\.]+)/i
146
146
  // Opera GX
147
147
  ],
148
- [u, [c, ke + " GX"]],
148
+ [g, [f, Ee + " GX"]],
149
149
  [
150
150
  /\bopr\/([\w\.]+)/i
151
151
  // Opera Webkit
152
152
  ],
153
- [u, [c, ke]],
153
+ [g, [f, Ee]],
154
154
  [
155
155
  // Mixed
156
156
  /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i
157
157
  // Baidu
158
158
  ],
159
- [u, [c, "Baidu"]],
159
+ [g, [f, "Baidu"]],
160
160
  [
161
161
  /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i
162
162
  // Maxthon
163
163
  ],
164
- [u, [c, "Maxthon"]],
164
+ [g, [f, "Maxthon"]],
165
165
  [
166
166
  /(kindle)\/([\w\.]+)/i,
167
167
  // Kindle
@@ -182,22 +182,22 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
182
182
  /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i
183
183
  // Ecosia/Weibo
184
184
  ],
185
- [c, u],
185
+ [f, g],
186
186
  [
187
187
  /quark(?:pc)?\/([-\w\.]+)/i
188
188
  // Quark
189
189
  ],
190
- [u, [c, "Quark"]],
190
+ [g, [f, "Quark"]],
191
191
  [
192
192
  /\bddg\/([\w\.]+)/i
193
193
  // DuckDuckGo
194
194
  ],
195
- [u, [c, "DuckDuckGo"]],
195
+ [g, [f, "DuckDuckGo"]],
196
196
  [
197
197
  /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
198
198
  // UCBrowser
199
199
  ],
200
- [u, [c, "UCBrowser"]],
200
+ [g, [f, "UCBrowser"]],
201
201
  [
202
202
  /microm.+\bqbcore\/([\w\.]+)/i,
203
203
  // WeChat Desktop for Windows Built-in Browser
@@ -205,97 +205,97 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
205
205
  /micromessenger\/([\w\.]+)/i
206
206
  // WeChat
207
207
  ],
208
- [u, [c, "WeChat"]],
208
+ [g, [f, "WeChat"]],
209
209
  [
210
210
  /konqueror\/([\w\.]+)/i
211
211
  // Konqueror
212
212
  ],
213
- [u, [c, "Konqueror"]],
213
+ [g, [f, "Konqueror"]],
214
214
  [
215
215
  /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
216
216
  // IE11
217
217
  ],
218
- [u, [c, "IE"]],
218
+ [g, [f, "IE"]],
219
219
  [
220
220
  /ya(?:search)?browser\/([\w\.]+)/i
221
221
  // Yandex
222
222
  ],
223
- [u, [c, "Yandex"]],
223
+ [g, [f, "Yandex"]],
224
224
  [
225
225
  /slbrowser\/([\w\.]+)/i
226
226
  // Smart Lenovo Browser
227
227
  ],
228
- [u, [c, "Smart " + Xe + Se]],
228
+ [g, [f, "Smart " + ot + Te]],
229
229
  [
230
230
  /(avast|avg)\/([\w\.]+)/i
231
231
  // Avast/AVG Secure Browser
232
232
  ],
233
- [[c, /(.+)/, "$1 Secure" + Se], u],
233
+ [[f, /(.+)/, "$1 Secure" + Te], g],
234
234
  [
235
235
  /\bfocus\/([\w\.]+)/i
236
236
  // Firefox Focus
237
237
  ],
238
- [u, [c, ve + " Focus"]],
238
+ [g, [f, ke + " Focus"]],
239
239
  [
240
240
  /\bopt\/([\w\.]+)/i
241
241
  // Opera Touch
242
242
  ],
243
- [u, [c, ke + " Touch"]],
243
+ [g, [f, Ee + " Touch"]],
244
244
  [
245
245
  /coc_coc\w+\/([\w\.]+)/i
246
246
  // Coc Coc Browser
247
247
  ],
248
- [u, [c, "Coc Coc"]],
248
+ [g, [f, "Coc Coc"]],
249
249
  [
250
250
  /dolfin\/([\w\.]+)/i
251
251
  // Dolphin
252
252
  ],
253
- [u, [c, "Dolphin"]],
253
+ [g, [f, "Dolphin"]],
254
254
  [
255
255
  /coast\/([\w\.]+)/i
256
256
  // Opera Coast
257
257
  ],
258
- [u, [c, ke + " Coast"]],
258
+ [g, [f, Ee + " Coast"]],
259
259
  [
260
260
  /miuibrowser\/([\w\.]+)/i
261
261
  // MIUI Browser
262
262
  ],
263
- [u, [c, "MIUI" + Se]],
263
+ [g, [f, "MIUI" + Te]],
264
264
  [
265
265
  /fxios\/([\w\.-]+)/i
266
266
  // Firefox for iOS
267
267
  ],
268
- [u, [c, ue + ve]],
268
+ [g, [f, pe + ke]],
269
269
  [
270
270
  /\bqihoobrowser\/?([\w\.]*)/i
271
271
  // 360
272
272
  ],
273
- [u, [c, "360"]],
273
+ [g, [f, "360"]],
274
274
  [
275
275
  /\b(qq)\/([\w\.]+)/i
276
276
  // QQ
277
277
  ],
278
- [[c, /(.+)/, "$1Browser"], u],
278
+ [[f, /(.+)/, "$1Browser"], g],
279
279
  [
280
280
  /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
281
281
  ],
282
- [[c, /(.+)/, "$1" + Se], u],
282
+ [[f, /(.+)/, "$1" + Te], g],
283
283
  [
284
284
  // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
285
285
  /samsungbrowser\/([\w\.]+)/i
286
286
  // Samsung Internet
287
287
  ],
288
- [u, [c, ye + " Internet"]],
288
+ [g, [f, Se + " Internet"]],
289
289
  [
290
290
  /metasr[\/ ]?([\d\.]+)/i
291
291
  // Sogou Explorer
292
292
  ],
293
- [u, [c, Ft + " Explorer"]],
293
+ [g, [f, qt + " Explorer"]],
294
294
  [
295
295
  /(sogou)mo\w+\/([\d\.]+)/i
296
296
  // Sogou Mobile
297
297
  ],
298
- [[c, Ft + " Mobile"], u],
298
+ [[f, qt + " Mobile"], g],
299
299
  [
300
300
  /(electron)\/([\w\.]+) safari/i,
301
301
  // Electron-based App
@@ -304,25 +304,25 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
304
304
  /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i
305
305
  // QQ/2345
306
306
  ],
307
- [c, u],
307
+ [f, g],
308
308
  [
309
309
  /(lbbrowser|rekonq|steam(?= (clie|tenf|gameo)))/i
310
310
  // LieBao Browser/Rekonq/Steam
311
311
  ],
312
- [c],
312
+ [f],
313
313
  [
314
314
  /ome\/([\w\.]+) \w* ?(iron) saf/i,
315
315
  // Iron
316
316
  /ome\/([\w\.]+).+qihu (360)[es]e/i
317
317
  // 360
318
318
  ],
319
- [u, c],
319
+ [g, f],
320
320
  [
321
321
  // WebView
322
322
  /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
323
323
  // Facebook App for iOS & Android
324
324
  ],
325
- [[c, et], u, [a, ce]],
325
+ [[f, ut], g, [c, he]],
326
326
  [
327
327
  /(kakao(?:talk|story))[\/ ]([\w\.]+)/i,
328
328
  // Kakao App
@@ -343,106 +343,106 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
343
343
  /(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i
344
344
  // Instagram/Snapchat/Klarna
345
345
  ],
346
- [c, u, [a, ce]],
346
+ [f, g, [c, he]],
347
347
  [
348
348
  /\bgsa\/([\w\.]+) .*safari\//i
349
349
  // Google Search Appliance on iOS
350
350
  ],
351
- [u, [c, "GSA"], [a, ce]],
351
+ [g, [f, "GSA"], [c, he]],
352
352
  [
353
353
  /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i
354
354
  // TikTok
355
355
  ],
356
- [u, [c, "TikTok"], [a, ce]],
356
+ [g, [f, "TikTok"], [c, he]],
357
357
  [
358
358
  /\[(linkedin)app\]/i
359
359
  // LinkedIn App for iOS & Android
360
360
  ],
361
- [c, [a, ce]],
361
+ [f, [c, he]],
362
362
  [
363
363
  /(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i
364
364
  // Zalo
365
365
  ],
366
- [[c, /(.+)/, "Zalo"], u, [a, ce]],
366
+ [[f, /(.+)/, "Zalo"], g, [c, he]],
367
367
  [
368
368
  /(chromium)[\/ ]([-\w\.]+)/i
369
369
  // Chromium
370
370
  ],
371
- [c, u],
371
+ [f, g],
372
372
  [
373
373
  /headlesschrome(?:\/([\w\.]+)| )/i
374
374
  // Chrome Headless
375
375
  ],
376
- [u, [c, Lt + " Headless"]],
376
+ [g, [f, $t + " Headless"]],
377
377
  [
378
378
  /wv\).+chrome\/([\w\.]+).+edgw\//i
379
379
  // Edge WebView2
380
380
  ],
381
- [u, [c, ze + " WebView2"]],
381
+ [g, [f, je + " WebView2"]],
382
382
  [
383
383
  / wv\).+(chrome)\/([\w\.]+)/i
384
384
  // Chrome WebView
385
385
  ],
386
- [[c, Lt + " WebView"], u],
386
+ [[f, $t + " WebView"], g],
387
387
  [
388
388
  /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
389
389
  // Android Browser
390
390
  ],
391
- [u, [c, "Android" + Se]],
391
+ [g, [f, "Android" + Te]],
392
392
  [
393
393
  /chrome\/([\w\.]+) mobile/i
394
394
  // Chrome Mobile
395
395
  ],
396
- [u, [c, ue + "Chrome"]],
396
+ [g, [f, pe + "Chrome"]],
397
397
  [
398
398
  /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
399
399
  // Chrome/OmniWeb/Arora/Tizen/Nokia
400
400
  ],
401
- [c, u],
401
+ [f, g],
402
402
  [
403
403
  /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i
404
404
  // Safari Mobile
405
405
  ],
406
- [u, [c, ue + "Safari"]],
406
+ [g, [f, pe + "Safari"]],
407
407
  [
408
408
  /iphone .*mobile(?:\/\w+ | ?)safari/i
409
409
  ],
410
- [[c, ue + "Safari"]],
410
+ [[f, pe + "Safari"]],
411
411
  [
412
412
  /version\/([\w\.\,]+) .*(safari)/i
413
413
  // Safari
414
414
  ],
415
- [u, c],
415
+ [g, f],
416
416
  [
417
417
  /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
418
418
  // Safari < 3.0
419
419
  ],
420
- [c, [u, "1"]],
420
+ [f, [g, "1"]],
421
421
  [
422
422
  /(webkit|khtml)\/([\w\.]+)/i
423
423
  ],
424
- [c, u],
424
+ [f, g],
425
425
  [
426
426
  // Gecko based
427
427
  /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i
428
428
  // Firefox Mobile
429
429
  ],
430
- [[c, ue + ve], u],
430
+ [[f, pe + ke], g],
431
431
  [
432
432
  /(navigator|netscape\d?)\/([-\w\.]+)/i
433
433
  // Netscape
434
434
  ],
435
- [[c, "Netscape"], u],
435
+ [[f, "Netscape"], g],
436
436
  [
437
437
  /(wolvic|librewolf)\/([\w\.]+)/i
438
438
  // Wolvic/LibreWolf
439
439
  ],
440
- [c, u],
440
+ [f, g],
441
441
  [
442
442
  /mobile vr; rv:([\w\.]+)\).+firefox/i
443
443
  // Firefox Reality
444
444
  ],
445
- [u, [c, ve + " Reality"]],
445
+ [g, [f, ke + " Reality"]],
446
446
  [
447
447
  /ekiohf.+(flow)\/([\w\.]+)/i,
448
448
  // Flow
@@ -462,46 +462,46 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
462
462
  /\b(links) \(([\w\.]+)/i
463
463
  // Links
464
464
  ],
465
- [c, [u, /_/g, "."]],
465
+ [f, [g, /_/g, "."]],
466
466
  [
467
467
  /(cobalt)\/([\w\.]+)/i
468
468
  // Cobalt
469
469
  ],
470
- [c, [u, /[^\d\.]+./, pe]]
470
+ [f, [g, /[^\d\.]+./, we]]
471
471
  ],
472
472
  cpu: [
473
473
  [
474
474
  /\b((amd|x|x86[-_]?|wow|win)64)\b/i
475
475
  // AMD64 (x64)
476
476
  ],
477
- [[P, "amd64"]],
477
+ [[U, "amd64"]],
478
478
  [
479
479
  /(ia32(?=;))/i,
480
480
  // IA32 (quicktime)
481
481
  /\b((i[346]|x)86)(pc)?\b/i
482
482
  // IA32 (x86)
483
483
  ],
484
- [[P, "ia32"]],
484
+ [[U, "ia32"]],
485
485
  [
486
486
  /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i
487
487
  // ARM64
488
488
  ],
489
- [[P, "arm64"]],
489
+ [[U, "arm64"]],
490
490
  [
491
491
  /\b(arm(v[67])?ht?n?[fl]p?)\b/i
492
492
  // ARMHF
493
493
  ],
494
- [[P, "armhf"]],
494
+ [[U, "armhf"]],
495
495
  [
496
496
  // PocketPC mistakenly identified as PowerPC
497
497
  /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i
498
498
  ],
499
- [[P, "arm"]],
499
+ [[U, "arm"]],
500
500
  [
501
501
  / sun4\w[;\)]/i
502
502
  // SPARC
503
503
  ],
504
- [[P, "sparc"]],
504
+ [[U, "sparc"]],
505
505
  [
506
506
  // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
507
507
  /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,
@@ -510,15 +510,15 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
510
510
  /(?:osf1|[freopnt]{3,4}bsd) (alpha)/i
511
511
  // Alpha
512
512
  ],
513
- [[P, /ower/, pe, K]],
513
+ [[U, /ower/, we, ie]],
514
514
  [
515
515
  /mc680.0/i
516
516
  ],
517
- [[P, "68k"]],
517
+ [[U, "68k"]],
518
518
  [
519
519
  /winnt.+\[axp/i
520
520
  ],
521
- [[P, "alpha"]]
521
+ [[U, "alpha"]]
522
522
  ],
523
523
  device: [
524
524
  [
@@ -528,60 +528,60 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
528
528
  // Samsung
529
529
  /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
530
530
  ],
531
- [l, [d, ye], [a, v]],
531
+ [u, [h, Se], [c, R]],
532
532
  [
533
533
  /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
534
534
  /samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,
535
535
  /sec-(sgh\w+)/i
536
536
  ],
537
- [l, [d, ye], [a, w]],
537
+ [u, [h, Se], [c, E]],
538
538
  [
539
539
  // Apple
540
540
  /(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i
541
541
  // iPod/iPhone
542
542
  ],
543
- [l, [d, de], [a, w]],
543
+ [u, [h, ge], [c, E]],
544
544
  [
545
545
  /\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,
546
546
  // iPad
547
547
  /\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i
548
548
  ],
549
- [l, [d, de], [a, v]],
549
+ [u, [h, ge], [c, R]],
550
550
  [
551
551
  /(macintosh);/i
552
552
  ],
553
- [l, [d, de]],
553
+ [u, [h, ge]],
554
554
  [
555
555
  // Sharp
556
556
  /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
557
557
  ],
558
- [l, [d, Pt], [a, w]],
558
+ [u, [h, Ht], [c, E]],
559
559
  [
560
560
  // Honor
561
561
  /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i
562
562
  ],
563
- [l, [d, Mt], [a, v]],
563
+ [u, [h, zt], [c, R]],
564
564
  [
565
565
  /honor([-\w ]+)[;\)]/i
566
566
  ],
567
- [l, [d, Mt], [a, w]],
567
+ [u, [h, zt], [c, E]],
568
568
  [
569
569
  // Huawei
570
570
  /\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i
571
571
  ],
572
- [l, [d, Rt], [a, v]],
572
+ [u, [h, Ut], [c, R]],
573
573
  [
574
574
  /(?:huawei) ?([-\w ]+)[;\)]/i,
575
575
  /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i
576
576
  ],
577
- [l, [d, Rt], [a, w]],
577
+ [u, [h, Ut], [c, E]],
578
578
  [
579
579
  // Xiaomi
580
580
  /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,
581
581
  /\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i
582
582
  // Mi Pad tablets
583
583
  ],
584
- [[l, /_/g, " "], [d, Ke], [a, v]],
584
+ [[u, /_/g, " "], [h, ct], [c, R]],
585
585
  [
586
586
  /\b; (\w+) build\/hm\1/i,
587
587
  // Xiaomi Hongmi 'numeric' models
@@ -593,107 +593,107 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
593
593
  /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,
594
594
  / ([\w ]+) miui\/v?\d/i
595
595
  ],
596
- [[l, /_/g, " "], [d, Ke], [a, w]],
596
+ [[u, /_/g, " "], [h, ct], [c, E]],
597
597
  [
598
598
  // OnePlus
599
599
  /droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,
600
600
  /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
601
601
  ],
602
- [l, [d, At], [a, w]],
602
+ [u, [h, Pt], [c, E]],
603
603
  [
604
604
  // OPPO
605
605
  /; (\w+) bui.+ oppo/i,
606
606
  /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
607
607
  ],
608
- [l, [d, Ze], [a, w]],
608
+ [u, [h, lt], [c, E]],
609
609
  [
610
610
  /\b(opd2(\d{3}a?))(?: bui|\))/i
611
611
  ],
612
- [l, [d, B, { OnePlus: ["203", "304", "403", "404", "413", "415"], "*": Ze }], [a, v]],
612
+ [u, [h, q, { OnePlus: ["203", "304", "403", "404", "413", "415"], "*": lt }], [c, R]],
613
613
  [
614
614
  // BLU
615
615
  /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i
616
616
  // Vivo series
617
617
  ],
618
- [l, [d, "BLU"], [a, w]],
618
+ [u, [h, "BLU"], [c, E]],
619
619
  [
620
620
  // Vivo
621
621
  /; vivo (\w+)(?: bui|\))/i,
622
622
  /\b(v[12]\d{3}\w?[at])(?: bui|;)/i
623
623
  ],
624
- [l, [d, "Vivo"], [a, w]],
624
+ [u, [h, "Vivo"], [c, E]],
625
625
  [
626
626
  // Realme
627
627
  /\b(rmx[1-3]\d{3})(?: bui|;|\))/i
628
628
  ],
629
- [l, [d, "Realme"], [a, w]],
629
+ [u, [h, "Realme"], [c, E]],
630
630
  [
631
631
  // Lenovo
632
632
  /(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,
633
633
  /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i
634
634
  ],
635
- [l, [d, Xe], [a, v]],
635
+ [u, [h, ot], [c, R]],
636
636
  [
637
637
  /lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i
638
638
  ],
639
- [l, [d, Xe], [a, w]],
639
+ [u, [h, ot], [c, E]],
640
640
  [
641
641
  // Motorola
642
642
  /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
643
643
  /\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,
644
644
  /((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i
645
645
  ],
646
- [l, [d, Qe], [a, w]],
646
+ [u, [h, at], [c, E]],
647
647
  [
648
648
  /\b(mz60\d|xoom[2 ]{0,2}) build\//i
649
649
  ],
650
- [l, [d, Qe], [a, v]],
650
+ [u, [h, at], [c, R]],
651
651
  [
652
652
  // LG
653
653
  /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
654
654
  ],
655
- [l, [d, De], [a, v]],
655
+ [u, [h, $e], [c, R]],
656
656
  [
657
657
  /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
658
658
  /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,
659
659
  /\blg-?([\d\w]+) bui/i
660
660
  ],
661
- [l, [d, De], [a, w]],
661
+ [u, [h, $e], [c, E]],
662
662
  [
663
663
  // Nokia
664
664
  /(nokia) (t[12][01])/i
665
665
  ],
666
- [d, l, [a, v]],
666
+ [h, u, [c, R]],
667
667
  [
668
668
  /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,
669
669
  /nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i
670
670
  ],
671
- [[l, /_/g, " "], [a, w], [d, "Nokia"]],
671
+ [[u, /_/g, " "], [c, E], [h, "Nokia"]],
672
672
  [
673
673
  // Google
674
674
  /(pixel (c|tablet))\b/i
675
675
  // Google Pixel C/Tablet
676
676
  ],
677
- [l, [d, re], [a, v]],
677
+ [u, [h, le], [c, R]],
678
678
  [
679
679
  // Google Pixel
680
680
  /droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i
681
681
  ],
682
- [l, [d, re], [a, w]],
682
+ [u, [h, le], [c, E]],
683
683
  [
684
684
  /(google) (pixelbook( go)?)/i
685
685
  ],
686
- [d, l],
686
+ [h, u],
687
687
  [
688
688
  // Sony
689
689
  /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
690
690
  ],
691
- [l, [d, xe], [a, w]],
691
+ [u, [h, Ce], [c, E]],
692
692
  [
693
693
  /sony tablet [ps]/i,
694
694
  /\b(?:sony)?sgp\w+(?: bui|\))/i
695
695
  ],
696
- [[l, "Xperia Tablet"], [d, xe], [a, v]],
696
+ [[u, "Xperia Tablet"], [h, Ce], [c, R]],
697
697
  [
698
698
  // Amazon
699
699
  /(alexa)webm/i,
@@ -702,38 +702,38 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
702
702
  /(kf[a-z]+)( bui|\)).+silk\//i
703
703
  // Kindle Fire HD
704
704
  ],
705
- [l, [d, Le], [a, v]],
705
+ [u, [h, He], [c, R]],
706
706
  [
707
707
  /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
708
708
  // Fire Phone
709
709
  ],
710
- [[l, /(.+)/g, "Fire Phone $1"], [d, Le], [a, w]],
710
+ [[u, /(.+)/g, "Fire Phone $1"], [h, He], [c, E]],
711
711
  [
712
712
  // BlackBerry
713
713
  /(playbook);[-\w\),; ]+(rim)/i
714
714
  // BlackBerry PlayBook
715
715
  ],
716
- [l, d, [a, v]],
716
+ [u, h, [c, R]],
717
717
  [
718
718
  /\b((?:bb[a-f]|st[hv])100-\d)/i,
719
719
  /(?:blackberry|\(bb10;) (\w+)/i
720
720
  ],
721
- [l, [d, Tt], [a, w]],
721
+ [u, [h, Lt], [c, E]],
722
722
  [
723
723
  // Asus
724
724
  /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
725
725
  ],
726
- [l, [d, It], [a, v]],
726
+ [u, [h, _t], [c, R]],
727
727
  [
728
728
  / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
729
729
  ],
730
- [l, [d, It], [a, w]],
730
+ [u, [h, _t], [c, E]],
731
731
  [
732
732
  // HTC
733
733
  /(nexus 9)/i
734
734
  // HTC Nexus 9
735
735
  ],
736
- [l, [d, "HTC"], [a, v]],
736
+ [u, [h, "HTC"], [c, R]],
737
737
  [
738
738
  /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
739
739
  // HTC
@@ -742,76 +742,76 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
742
742
  /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i
743
743
  // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
744
744
  ],
745
- [d, [l, /_/g, " "], [a, w]],
745
+ [h, [u, /_/g, " "], [c, E]],
746
746
  [
747
747
  // TCL
748
748
  /tcl (xess p17aa)/i,
749
749
  /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i
750
750
  ],
751
- [l, [d, "TCL"], [a, v]],
751
+ [u, [h, "TCL"], [c, R]],
752
752
  [
753
753
  /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i
754
754
  ],
755
- [l, [d, "TCL"], [a, w]],
755
+ [u, [h, "TCL"], [c, E]],
756
756
  [
757
757
  // itel
758
758
  /(itel) ((\w+))/i
759
759
  ],
760
- [[d, K], l, [a, B, { tablet: ["p10001l", "w7001"], "*": "mobile" }]],
760
+ [[h, ie], u, [c, q, { tablet: ["p10001l", "w7001"], "*": "mobile" }]],
761
761
  [
762
762
  // Acer
763
763
  /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
764
764
  ],
765
- [l, [d, "Acer"], [a, v]],
765
+ [u, [h, "Acer"], [c, R]],
766
766
  [
767
767
  // Meizu
768
768
  /droid.+; (m[1-5] note) bui/i,
769
769
  /\bmz-([-\w]{2,})/i
770
770
  ],
771
- [l, [d, "Meizu"], [a, w]],
771
+ [u, [h, "Meizu"], [c, E]],
772
772
  [
773
773
  // Ulefone
774
774
  /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
775
775
  ],
776
- [l, [d, "Ulefone"], [a, w]],
776
+ [u, [h, "Ulefone"], [c, E]],
777
777
  [
778
778
  // Energizer
779
779
  /; (energy ?\w+)(?: bui|\))/i,
780
780
  /; energizer ([\w ]+)(?: bui|\))/i
781
781
  ],
782
- [l, [d, "Energizer"], [a, w]],
782
+ [u, [h, "Energizer"], [c, E]],
783
783
  [
784
784
  // Cat
785
785
  /; cat (b35);/i,
786
786
  /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
787
787
  ],
788
- [l, [d, "Cat"], [a, w]],
788
+ [u, [h, "Cat"], [c, E]],
789
789
  [
790
790
  // Smartfren
791
791
  /((?:new )?andromax[\w- ]+)(?: bui|\))/i
792
792
  ],
793
- [l, [d, "Smartfren"], [a, w]],
793
+ [u, [h, "Smartfren"], [c, E]],
794
794
  [
795
795
  // Nothing
796
796
  /droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i
797
797
  ],
798
- [l, [d, "Nothing"], [a, w]],
798
+ [u, [h, "Nothing"], [c, E]],
799
799
  [
800
800
  // Archos
801
801
  /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,
802
802
  /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i
803
803
  ],
804
- [l, [d, "Archos"], [a, v]],
804
+ [u, [h, "Archos"], [c, R]],
805
805
  [
806
806
  /archos ([\w ]+)( b|\))/i,
807
807
  /; (ac[3-6]\d\w{2,8})( b|\))/i
808
808
  ],
809
- [l, [d, "Archos"], [a, w]],
809
+ [u, [h, "Archos"], [c, E]],
810
810
  [
811
811
  // HMD
812
812
  /; (n159v)/i
813
813
  ],
814
- [l, [d, "HMD"], [a, w]],
814
+ [u, [h, "HMD"], [c, E]],
815
815
  [
816
816
  // MIXED
817
817
  /(imo) (tab \w+)/i,
@@ -819,7 +819,7 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
819
819
  /(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i
820
820
  // Infinix XPad / Tecno
821
821
  ],
822
- [d, l, [a, v]],
822
+ [h, u, [c, R]],
823
823
  [
824
824
  /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
825
825
  // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Tecno/Micromax/Advan
@@ -836,7 +836,7 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
836
836
  /droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i
837
837
  // Philips
838
838
  ],
839
- [d, l, [a, w]],
839
+ [h, u, [c, E]],
840
840
  [
841
841
  /(kobo)\s(ereader|touch)/i,
842
842
  // Kobo
@@ -845,41 +845,41 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
845
845
  /(kindle)\/([\w\.]+)/i
846
846
  // Kindle
847
847
  ],
848
- [d, l, [a, v]],
848
+ [h, u, [c, R]],
849
849
  [
850
850
  /(surface duo)/i
851
851
  // Surface Duo
852
852
  ],
853
- [l, [d, Ye], [a, v]],
853
+ [u, [h, st], [c, R]],
854
854
  [
855
855
  /droid [\d\.]+; (fp\du?)(?: b|\))/i
856
856
  // Fairphone
857
857
  ],
858
- [l, [d, "Fairphone"], [a, w]],
858
+ [u, [h, "Fairphone"], [c, E]],
859
859
  [
860
860
  /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i
861
861
  // Nvidia Tablets
862
862
  ],
863
- [l, [d, Ot], [a, v]],
863
+ [u, [h, Bt], [c, R]],
864
864
  [
865
865
  /(sprint) (\w+)/i
866
866
  // Sprint Phones
867
867
  ],
868
- [d, l, [a, w]],
868
+ [h, u, [c, E]],
869
869
  [
870
870
  /(kin\.[onetw]{3})/i
871
871
  // Microsoft Kin
872
872
  ],
873
- [[l, /\./g, " "], [d, Ye], [a, w]],
873
+ [[u, /\./g, " "], [h, st], [c, E]],
874
874
  [
875
875
  /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
876
876
  // Zebra
877
877
  ],
878
- [l, [d, Je], [a, v]],
878
+ [u, [h, dt], [c, R]],
879
879
  [
880
880
  /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
881
881
  ],
882
- [l, [d, Je], [a, w]],
882
+ [u, [h, dt], [c, E]],
883
883
  [
884
884
  ///////////////////
885
885
  // SMARTTVS
@@ -889,90 +889,90 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
889
889
  /smart-tv.+(samsung)/i
890
890
  // Samsung
891
891
  ],
892
- [d, [a, I]],
892
+ [h, [c, D]],
893
893
  [
894
894
  /hbbtv.+maple;(\d+)/i
895
895
  ],
896
- [[l, /^/, "SmartTV"], [d, ye], [a, I]],
896
+ [[u, /^/, "SmartTV"], [h, Se], [c, D]],
897
897
  [
898
898
  /(vizio)(?: |.+model\/)(\w+-\w+)/i,
899
899
  // Vizio
900
900
  /tcast.+(lg)e?. ([-\w]+)/i
901
901
  // LG SmartTV
902
902
  ],
903
- [d, l, [a, I]],
903
+ [h, u, [c, D]],
904
904
  [
905
905
  /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
906
906
  ],
907
- [[d, De], [a, I]],
907
+ [[h, $e], [c, D]],
908
908
  [
909
909
  /(apple) ?tv/i
910
910
  // Apple TV
911
911
  ],
912
- [d, [l, de + " TV"], [a, I]],
912
+ [h, [u, ge + " TV"], [c, D]],
913
913
  [
914
914
  /crkey.*devicetype\/chromecast/i
915
915
  // Google Chromecast Third Generation
916
916
  ],
917
- [[l, Z + " Third Generation"], [d, re], [a, I]],
917
+ [[u, ne + " Third Generation"], [h, le], [c, D]],
918
918
  [
919
919
  /crkey.*devicetype\/([^/]*)/i
920
920
  // Google Chromecast with specific device type
921
921
  ],
922
- [[l, /^/, "Chromecast "], [d, re], [a, I]],
922
+ [[u, /^/, "Chromecast "], [h, le], [c, D]],
923
923
  [
924
924
  /fuchsia.*crkey/i
925
925
  // Google Chromecast Nest Hub
926
926
  ],
927
- [[l, Z + " Nest Hub"], [d, re], [a, I]],
927
+ [[u, ne + " Nest Hub"], [h, le], [c, D]],
928
928
  [
929
929
  /crkey/i
930
930
  // Google Chromecast, Linux-based or unknown
931
931
  ],
932
- [[l, Z], [d, re], [a, I]],
932
+ [[u, ne], [h, le], [c, D]],
933
933
  [
934
934
  /(portaltv)/i
935
935
  // Facebook Portal TV
936
936
  ],
937
- [l, [d, et], [a, I]],
937
+ [u, [h, ut], [c, D]],
938
938
  [
939
939
  /droid.+aft(\w+)( bui|\))/i
940
940
  // Fire TV
941
941
  ],
942
- [l, [d, Le], [a, I]],
942
+ [u, [h, He], [c, D]],
943
943
  [
944
944
  /(shield \w+ tv)/i
945
945
  // Nvidia Shield TV
946
946
  ],
947
- [l, [d, Ot], [a, I]],
947
+ [u, [h, Bt], [c, D]],
948
948
  [
949
949
  /\(dtv[\);].+(aquos)/i,
950
950
  /(aquos-tv[\w ]+)\)/i
951
951
  // Sharp
952
952
  ],
953
- [l, [d, Pt], [a, I]],
953
+ [u, [h, Ht], [c, D]],
954
954
  [
955
955
  /(bravia[\w ]+)( bui|\))/i
956
956
  // Sony
957
957
  ],
958
- [l, [d, xe], [a, I]],
958
+ [u, [h, Ce], [c, D]],
959
959
  [
960
960
  /(mi(tv|box)-?\w+) bui/i
961
961
  // Xiaomi
962
962
  ],
963
- [l, [d, Ke], [a, I]],
963
+ [u, [h, ct], [c, D]],
964
964
  [
965
965
  /Hbbtv.*(technisat) (.*);/i
966
966
  // TechniSAT
967
967
  ],
968
- [d, l, [a, I]],
968
+ [h, u, [c, D]],
969
969
  [
970
970
  /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
971
971
  // Roku
972
972
  /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i
973
973
  // HbbTV devices
974
974
  ],
975
- [[d, /.+\/(\w+)/, "$1", B, { LG: "lge" }], [l, Ue], [a, I]],
975
+ [[h, /.+\/(\w+)/, "$1", q, { LG: "lge" }], [u, Xe], [c, D]],
976
976
  [
977
977
  ///////////////////
978
978
  // CONSOLES
@@ -980,12 +980,12 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
980
980
  /(playstation \w+)/i
981
981
  // Playstation
982
982
  ],
983
- [l, [d, xe], [a, _e]],
983
+ [u, [h, Ce], [c, Ve]],
984
984
  [
985
985
  /\b(xbox(?: one)?(?!; xbox))[\); ]/i
986
986
  // Microsoft Xbox
987
987
  ],
988
- [l, [d, Ye], [a, _e]],
988
+ [u, [h, st], [c, Ve]],
989
989
  [
990
990
  /(ouya)/i,
991
991
  // Ouya
@@ -997,7 +997,7 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
997
997
  /droid.+; ((shield|rgcube|gr0006))( bui|\))/i
998
998
  // Nvidia Portable/Anbernic/Logitech
999
999
  ],
1000
- [[d, B, { Nvidia: "Shield", Anbernic: "RGCUBE", Logitech: "GR0006" }], l, [a, _e]],
1000
+ [[h, q, { Nvidia: "Shield", Anbernic: "RGCUBE", Logitech: "GR0006" }], u, [c, Ve]],
1001
1001
  [
1002
1002
  ///////////////////
1003
1003
  // WEARABLES
@@ -1005,48 +1005,48 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1005
1005
  /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i
1006
1006
  // Samsung Galaxy Watch
1007
1007
  ],
1008
- [l, [d, ye], [a, V]],
1008
+ [u, [h, Se], [c, j]],
1009
1009
  [
1010
1010
  /((pebble))app/i,
1011
1011
  // Pebble
1012
1012
  /(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i
1013
1013
  // Asus ZenWatch / LG Watch / Pixel Watch / Xiaomi Watch
1014
1014
  ],
1015
- [d, l, [a, V]],
1015
+ [h, u, [c, j]],
1016
1016
  [
1017
1017
  /(ow(?:19|20)?we?[1-3]{1,3})/i
1018
1018
  // Oppo Watch
1019
1019
  ],
1020
- [l, [d, Ze], [a, V]],
1020
+ [u, [h, lt], [c, j]],
1021
1021
  [
1022
1022
  /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i
1023
1023
  // Apple Watch
1024
1024
  ],
1025
- [l, [d, de], [a, V]],
1025
+ [u, [h, ge], [c, j]],
1026
1026
  [
1027
1027
  /(opwwe\d{3})/i
1028
1028
  // OnePlus Watch
1029
1029
  ],
1030
- [l, [d, At], [a, V]],
1030
+ [u, [h, Pt], [c, j]],
1031
1031
  [
1032
1032
  /(moto 360)/i
1033
1033
  // Motorola 360
1034
1034
  ],
1035
- [l, [d, Qe], [a, V]],
1035
+ [u, [h, at], [c, j]],
1036
1036
  [
1037
1037
  /(smartwatch 3)/i
1038
1038
  // Sony SmartWatch
1039
1039
  ],
1040
- [l, [d, xe], [a, V]],
1040
+ [u, [h, Ce], [c, j]],
1041
1041
  [
1042
1042
  /(g watch r)/i
1043
1043
  // LG G Watch R
1044
1044
  ],
1045
- [l, [d, De], [a, V]],
1045
+ [u, [h, $e], [c, j]],
1046
1046
  [
1047
1047
  /droid.+; (wt63?0{2,3})\)/i
1048
1048
  ],
1049
- [l, [d, Je], [a, V]],
1049
+ [u, [h, dt], [c, j]],
1050
1050
  [
1051
1051
  ///////////////////
1052
1052
  // XR
@@ -1054,22 +1054,22 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1054
1054
  /droid.+; (glass) \d/i
1055
1055
  // Google Glass
1056
1056
  ],
1057
- [l, [d, re], [a, Pe]],
1057
+ [u, [h, le], [c, Pe]],
1058
1058
  [
1059
1059
  /(pico) ([\w ]+) os\d/i
1060
1060
  // Pico
1061
1061
  ],
1062
- [d, l, [a, Pe]],
1062
+ [h, u, [c, Pe]],
1063
1063
  [
1064
1064
  /(quest( \d| pro)?s?).+vr/i
1065
1065
  // Meta Quest
1066
1066
  ],
1067
- [l, [d, et], [a, Pe]],
1067
+ [u, [h, ut], [c, Pe]],
1068
1068
  [
1069
1069
  /mobile vr; rv.+firefox/i
1070
1070
  // Unidentifiable VR device using Firefox Reality / Wolvic
1071
1071
  ],
1072
- [[a, Pe]],
1072
+ [[c, Pe]],
1073
1073
  [
1074
1074
  ///////////////////
1075
1075
  // EMBEDDED
@@ -1077,22 +1077,22 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1077
1077
  /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
1078
1078
  // Tesla
1079
1079
  ],
1080
- [d, [a, Ee]],
1080
+ [h, [c, Re]],
1081
1081
  [
1082
1082
  /(aeobc)\b/i
1083
1083
  // Echo Dot
1084
1084
  ],
1085
- [l, [d, Le], [a, Ee]],
1085
+ [u, [h, He], [c, Re]],
1086
1086
  [
1087
1087
  /(homepod).+mac os/i
1088
1088
  // Apple HomePod
1089
1089
  ],
1090
- [l, [d, de], [a, Ee]],
1090
+ [u, [h, ge], [c, Re]],
1091
1091
  [
1092
1092
  /windows iot/i
1093
1093
  // Unidentifiable embedded device using Windows IoT
1094
1094
  ],
1095
- [[a, Ee]],
1095
+ [[c, Re]],
1096
1096
  [
1097
1097
  ////////////////////
1098
1098
  // MIXED (GENERIC)
@@ -1100,47 +1100,47 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1100
1100
  /droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i
1101
1101
  // Unidentifiable SmartTV
1102
1102
  ],
1103
- [l, [a, I]],
1103
+ [u, [c, D]],
1104
1104
  [
1105
1105
  /\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i
1106
1106
  ],
1107
- [[a, I]],
1107
+ [[c, D]],
1108
1108
  [
1109
1109
  /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i
1110
1110
  ],
1111
- [l, [a, B, { mobile: "Mobile", xr: "VR", "*": v }]],
1111
+ [u, [c, q, { mobile: "Mobile", xr: "VR", "*": R }]],
1112
1112
  [
1113
1113
  /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
1114
1114
  // Unidentifiable Tablet
1115
1115
  ],
1116
- [[a, v]],
1116
+ [[c, R]],
1117
1117
  [
1118
1118
  /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i
1119
1119
  // Unidentifiable Mobile
1120
1120
  ],
1121
- [[a, w]],
1121
+ [[c, E]],
1122
1122
  [
1123
1123
  /droid .+?; ([\w\. -]+)( bui|\))/i
1124
1124
  // Generic Android Device
1125
1125
  ],
1126
- [l, [d, "Generic"]]
1126
+ [u, [h, "Generic"]]
1127
1127
  ],
1128
1128
  engine: [
1129
1129
  [
1130
1130
  /windows.+ edge\/([\w\.]+)/i
1131
1131
  // EdgeHTML
1132
1132
  ],
1133
- [u, [c, ze + "HTML"]],
1133
+ [g, [f, je + "HTML"]],
1134
1134
  [
1135
1135
  /(arkweb)\/([\w\.]+)/i
1136
1136
  // ArkWeb
1137
1137
  ],
1138
- [c, u],
1138
+ [f, g],
1139
1139
  [
1140
1140
  /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
1141
1141
  // Blink
1142
1142
  ],
1143
- [u, [c, "Blink"]],
1143
+ [g, [f, "Blink"]],
1144
1144
  [
1145
1145
  /(presto)\/([\w\.]+)/i,
1146
1146
  // Presto
@@ -1155,16 +1155,16 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1155
1155
  /\b(libweb)/i
1156
1156
  // LibWeb
1157
1157
  ],
1158
- [c, u],
1158
+ [f, g],
1159
1159
  [
1160
1160
  /ladybird\//i
1161
1161
  ],
1162
- [[c, "LibWeb"]],
1162
+ [[f, "LibWeb"]],
1163
1163
  [
1164
1164
  /rv\:([\w\.]{1,9})\b.+(gecko)/i
1165
1165
  // Gecko
1166
1166
  ],
1167
- [u, c]
1167
+ [g, f]
1168
1168
  ],
1169
1169
  os: [
1170
1170
  [
@@ -1172,24 +1172,24 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1172
1172
  /(windows nt) (6\.[23]); arm/i
1173
1173
  // Windows RT
1174
1174
  ],
1175
- [[c, /N/, "R"], [u, B, _t]],
1175
+ [[f, /N/, "R"], [g, q, Vt]],
1176
1176
  [
1177
1177
  /(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,
1178
1178
  // Windows IoT/Mobile/Phone
1179
1179
  // Windows NT/3.1/95/98/ME/2000/XP/Vista/7/8/8.1/10/11
1180
1180
  /(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i
1181
1181
  ],
1182
- [c, u],
1182
+ [f, g],
1183
1183
  [
1184
1184
  /windows nt ?([\d\.\)]*)(?!.+xbox)/i,
1185
1185
  /\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i
1186
1186
  ],
1187
- [[u, /(;|\))/g, "", B, _t], [c, ot]],
1187
+ [[g, /(;|\))/g, "", q, Vt], [f, pt]],
1188
1188
  [
1189
1189
  /(windows ce)\/?([\d\.]*)/i
1190
1190
  // Windows CE
1191
1191
  ],
1192
- [c, u],
1192
+ [f, g],
1193
1193
  [
1194
1194
  // iOS/macOS
1195
1195
  /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,
@@ -1198,94 +1198,94 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1198
1198
  /\btvos ?([\w\.]+)/i,
1199
1199
  /cfnetwork\/.+darwin/i
1200
1200
  ],
1201
- [[u, /_/g, "."], [c, "iOS"]],
1201
+ [[g, /_/g, "."], [f, "iOS"]],
1202
1202
  [
1203
1203
  /(mac os x) ?([\w\. ]*)/i,
1204
1204
  /(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i
1205
1205
  // Mac OS
1206
1206
  ],
1207
- [[c, "macOS"], [u, /_/g, "."]],
1207
+ [[f, "macOS"], [g, /_/g, "."]],
1208
1208
  [
1209
1209
  // Google Chromecast
1210
1210
  /android ([\d\.]+).*crkey/i
1211
1211
  // Google Chromecast, Android-based
1212
1212
  ],
1213
- [u, [c, Z + " Android"]],
1213
+ [g, [f, ne + " Android"]],
1214
1214
  [
1215
1215
  /fuchsia.*crkey\/([\d\.]+)/i
1216
1216
  // Google Chromecast, Fuchsia-based
1217
1217
  ],
1218
- [u, [c, Z + " Fuchsia"]],
1218
+ [g, [f, ne + " Fuchsia"]],
1219
1219
  [
1220
1220
  /crkey\/([\d\.]+).*devicetype\/smartspeaker/i
1221
1221
  // Google Chromecast, Linux-based Smart Speaker
1222
1222
  ],
1223
- [u, [c, Z + " SmartSpeaker"]],
1223
+ [g, [f, ne + " SmartSpeaker"]],
1224
1224
  [
1225
1225
  /linux.*crkey\/([\d\.]+)/i
1226
1226
  // Google Chromecast, Legacy Linux-based
1227
1227
  ],
1228
- [u, [c, Z + " Linux"]],
1228
+ [g, [f, ne + " Linux"]],
1229
1229
  [
1230
1230
  /crkey\/([\d\.]+)/i
1231
1231
  // Google Chromecast, unknown
1232
1232
  ],
1233
- [u, [c, Z]],
1233
+ [g, [f, ne]],
1234
1234
  [
1235
1235
  // Mobile OSes
1236
1236
  /droid ([\w\.]+)\b.+(android[- ]x86)/i
1237
1237
  // Android-x86
1238
1238
  ],
1239
- [u, c],
1239
+ [g, f],
1240
1240
  [
1241
1241
  /(ubuntu) ([\w\.]+) like android/i
1242
1242
  // Ubuntu Touch
1243
1243
  ],
1244
- [[c, /(.+)/, "$1 Touch"], u],
1244
+ [[f, /(.+)/, "$1 Touch"], g],
1245
1245
  [
1246
1246
  /(harmonyos)[\/ ]?([\d\.]*)/i,
1247
1247
  // HarmonyOS
1248
1248
  // Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen
1249
1249
  /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i
1250
1250
  ],
1251
- [c, u],
1251
+ [f, g],
1252
1252
  [
1253
1253
  /\(bb(10);/i
1254
1254
  // BlackBerry 10
1255
1255
  ],
1256
- [u, [c, Tt]],
1256
+ [g, [f, Lt]],
1257
1257
  [
1258
1258
  /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i
1259
1259
  // Symbian
1260
1260
  ],
1261
- [u, [c, "Symbian"]],
1261
+ [g, [f, "Symbian"]],
1262
1262
  [
1263
1263
  /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
1264
1264
  // Firefox OS
1265
1265
  ],
1266
- [u, [c, ve + " OS"]],
1266
+ [g, [f, ke + " OS"]],
1267
1267
  [
1268
1268
  /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,
1269
1269
  // WebOS
1270
1270
  /webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i
1271
1271
  ],
1272
- [u, [c, "webOS"]],
1272
+ [g, [f, "webOS"]],
1273
1273
  [
1274
1274
  /web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i
1275
1275
  // https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine
1276
1276
  ],
1277
- [[u, B, { 25: "120", 24: "108", 23: "94", 22: "87", 6: "79", 5: "68", 4: "53", 3: "38", 2: "538", 1: "537", "*": "TV" }], [c, "webOS"]],
1277
+ [[g, q, { 25: "120", 24: "108", 23: "94", 22: "87", 6: "79", 5: "68", 4: "53", 3: "38", 2: "538", 1: "537", "*": "TV" }], [f, "webOS"]],
1278
1278
  [
1279
1279
  /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i
1280
1280
  // watchOS
1281
1281
  ],
1282
- [u, [c, "watchOS"]],
1282
+ [g, [f, "watchOS"]],
1283
1283
  [
1284
1284
  // Google ChromeOS
1285
1285
  /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i
1286
1286
  // Chromium OS
1287
1287
  ],
1288
- [[c, "Chrome OS"], u],
1288
+ [[f, "Chrome OS"], g],
1289
1289
  [
1290
1290
  // Smart TVs
1291
1291
  /panasonic;(viera)/i,
@@ -1323,254 +1323,254 @@ var Si = "2.0.7", Ci = 500, Ct = "user-agent", pe = "", Et = "?", E = {
1323
1323
  /(haiku) ?(r\d)?/i
1324
1324
  // Haiku
1325
1325
  ],
1326
- [c, u],
1326
+ [f, g],
1327
1327
  [
1328
1328
  /(sunos) ?([\d\.]*)/i
1329
1329
  // Solaris
1330
1330
  ],
1331
- [[c, "Solaris"], u],
1331
+ [[f, "Solaris"], g],
1332
1332
  [
1333
1333
  /\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,
1334
1334
  // BeOS/OS2/AmigaOS/OpenVMS/HP-UX/SerenityOS
1335
1335
  /(unix) ?([\w\.]*)/i
1336
1336
  // UNIX
1337
1337
  ],
1338
- [c, u]
1338
+ [f, g]
1339
1339
  ]
1340
- }, Fe = (function() {
1340
+ }, We = (function() {
1341
1341
  var e = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} };
1342
- return G.call(e.init, [
1343
- [F, [c, u, Ie, a]],
1344
- [X, [P]],
1345
- [j, [a, l, d]],
1346
- [W, [c, u]],
1347
- [U, [c, u]]
1348
- ]), G.call(e.isIgnore, [
1349
- [F, [u, Ie]],
1350
- [W, [u]],
1351
- [U, [u]]
1352
- ]), G.call(e.isIgnoreRgx, [
1353
- [F, / ?browser$/i],
1354
- [U, / ?os$/i]
1355
- ]), G.call(e.toString, [
1356
- [F, [c, u]],
1357
- [X, [P]],
1358
- [j, [d, l]],
1359
- [W, [c, u]],
1360
- [U, [c, u]]
1342
+ return K.call(e.init, [
1343
+ [P, [f, g, Ne, c]],
1344
+ [Z, [U]],
1345
+ [G, [c, u, h]],
1346
+ [V, [f, g]],
1347
+ [$, [f, g]]
1348
+ ]), K.call(e.isIgnore, [
1349
+ [P, [g, Ne]],
1350
+ [V, [g]],
1351
+ [$, [g]]
1352
+ ]), K.call(e.isIgnoreRgx, [
1353
+ [P, / ?browser$/i],
1354
+ [$, / ?os$/i]
1355
+ ]), K.call(e.toString, [
1356
+ [P, [f, g]],
1357
+ [Z, [U]],
1358
+ [G, [h, u]],
1359
+ [V, [f, g]],
1360
+ [$, [f, g]]
1361
1361
  ]), e;
1362
- })(), Fi = function(e, t) {
1363
- var i = Fe.init[t], n = Fe.isIgnore[t] || 0, o = Fe.isIgnoreRgx[t] || 0, s = Fe.toString[t] || 0;
1362
+ })(), Qn = function(e, t) {
1363
+ var n = We.init[t], i = We.isIgnore[t] || 0, a = We.isIgnoreRgx[t] || 0, o = We.toString[t] || 0;
1364
1364
  function r() {
1365
- G.call(this, i);
1365
+ K.call(this, n);
1366
1366
  }
1367
1367
  return r.prototype.getItem = function() {
1368
1368
  return e;
1369
1369
  }, r.prototype.withClientHints = function() {
1370
- return se ? se.getHighEntropyValues(Zt).then(function(h) {
1371
- return e.setCH(new Kt(h, !1)).parseCH().get();
1370
+ return de ? de.getHighEntropyValues(sn).then(function(s) {
1371
+ return e.setCH(new an(s, !1)).parseCH().get();
1372
1372
  }) : e.parseCH().get();
1373
1373
  }, r.prototype.withFeatureCheck = function() {
1374
1374
  return e.detectFeature().get();
1375
- }, t != ge && (r.prototype.is = function(h) {
1376
- var f = !1;
1377
- for (var b in this)
1378
- if (this.hasOwnProperty(b) && !st(n, b) && K(o ? we(o, this[b]) : this[b]) == K(o ? we(o, h) : h)) {
1379
- if (f = !0, h != E.UNDEFINED) break;
1380
- } else if (h == E.UNDEFINED && f) {
1381
- f = !f;
1375
+ }, t != be && (r.prototype.is = function(s) {
1376
+ var d = !1;
1377
+ for (var p in this)
1378
+ if (this.hasOwnProperty(p) && !mt(i, p) && ie(a ? xe(a, this[p]) : this[p]) == ie(a ? xe(a, s) : s)) {
1379
+ if (d = !0, s != O.UNDEFINED) break;
1380
+ } else if (s == O.UNDEFINED && d) {
1381
+ d = !d;
1382
1382
  break;
1383
1383
  }
1384
- return f;
1384
+ return d;
1385
1385
  }, r.prototype.toString = function() {
1386
- var h = pe;
1387
- for (var f in s)
1388
- typeof this[s[f]] !== E.UNDEFINED && (h += (h ? " " : pe) + this[s[f]]);
1389
- return h || E.UNDEFINED;
1390
- }), r.prototype.then = function(h) {
1391
- var f = this, b = function() {
1392
- for (var k in f)
1393
- f.hasOwnProperty(k) && (this[k] = f[k]);
1386
+ var s = we;
1387
+ for (var d in o)
1388
+ typeof this[o[d]] !== O.UNDEFINED && (s += (s ? " " : we) + this[o[d]]);
1389
+ return s || O.UNDEFINED;
1390
+ }), r.prototype.then = function(s) {
1391
+ var d = this, p = function() {
1392
+ for (var m in d)
1393
+ d.hasOwnProperty(m) && (this[m] = d[m]);
1394
1394
  };
1395
- b.prototype = {
1395
+ p.prototype = {
1396
1396
  is: r.prototype.is,
1397
1397
  toString: r.prototype.toString,
1398
1398
  withClientHints: r.prototype.withClientHints,
1399
1399
  withFeatureCheck: r.prototype.withFeatureCheck
1400
1400
  };
1401
- var m = new b();
1402
- return h(m), m;
1401
+ var l = new p();
1402
+ return s(l), l;
1403
1403
  }, new r();
1404
1404
  };
1405
- function Kt(e, t) {
1406
- if (e = e || {}, G.call(this, Zt), t)
1407
- G.call(this, [
1408
- [dt, tt(e[te])],
1409
- [ut, tt(e[Ei])],
1410
- [w, /\?1/.test(e[Mi])],
1411
- [l, Ce(e[Oi])],
1412
- [be, Ce(e[Qt])],
1413
- [ht, Ce(e[Ai])],
1414
- [P, Ce(e[Ii])],
1415
- [oe, tt(e[Ri])],
1416
- [We, Ce(e[Ti])]
1405
+ function an(e, t) {
1406
+ if (e = e || {}, K.call(this, sn), t)
1407
+ K.call(this, [
1408
+ [xt, ft(e[se])],
1409
+ [vt, ft(e[Hn])],
1410
+ [E, /\?1/.test(e[Vn])],
1411
+ [u, Ie(e[jn])],
1412
+ [ye, Ie(e[on])],
1413
+ [St, Ie(e[Gn])],
1414
+ [U, Ie(e[$n])],
1415
+ [ce, ft(e[qn])],
1416
+ [Je, Ie(e[Wn])]
1417
1417
  ]);
1418
1418
  else
1419
- for (var i in e)
1420
- this.hasOwnProperty(i) && typeof e[i] !== E.UNDEFINED && (this[i] = e[i]);
1419
+ for (var n in e)
1420
+ this.hasOwnProperty(n) && typeof e[n] !== O.UNDEFINED && (this[n] = e[n]);
1421
1421
  }
1422
- function ee(e, t, i, n) {
1423
- return G.call(this, [
1422
+ function re(e, t, n, i) {
1423
+ return K.call(this, [
1424
1424
  ["itemType", e],
1425
1425
  ["ua", t],
1426
- ["uaCH", n],
1427
- ["rgxMap", i],
1428
- ["data", Fi(this, e)]
1426
+ ["uaCH", i],
1427
+ ["rgxMap", n],
1428
+ ["data", Qn(this, e)]
1429
1429
  ]), this;
1430
1430
  }
1431
- ee.prototype.get = function(e) {
1431
+ re.prototype.get = function(e) {
1432
1432
  return e ? this.data.hasOwnProperty(e) ? this.data[e] : void 0 : this.data;
1433
1433
  };
1434
- ee.prototype.set = function(e, t) {
1434
+ re.prototype.set = function(e, t) {
1435
1435
  return this.data[e] = t, this;
1436
1436
  };
1437
- ee.prototype.setCH = function(e) {
1437
+ re.prototype.setCH = function(e) {
1438
1438
  return this.uaCH = e, this;
1439
1439
  };
1440
- ee.prototype.detectFeature = function() {
1441
- if (D && D.userAgent == this.ua)
1440
+ re.prototype.detectFeature = function() {
1441
+ if (B && B.userAgent == this.ua)
1442
1442
  switch (this.itemType) {
1443
- case F:
1444
- D.brave && typeof D.brave.isBrave == E.FUNCTION && this.set(c, "Brave");
1443
+ case P:
1444
+ B.brave && typeof B.brave.isBrave == O.FUNCTION && this.set(f, "Brave");
1445
1445
  break;
1446
- case j:
1447
- !this.get(a) && se && se[w] && this.set(a, w), this.get(l) == "Macintosh" && D && typeof D.standalone !== E.UNDEFINED && D.maxTouchPoints && D.maxTouchPoints > 2 && this.set(l, "iPad").set(a, v);
1446
+ case G:
1447
+ !this.get(c) && de && de[E] && this.set(c, E), this.get(u) == "Macintosh" && B && typeof B.standalone !== O.UNDEFINED && B.maxTouchPoints && B.maxTouchPoints > 2 && this.set(u, "iPad").set(c, R);
1448
1448
  break;
1449
- case U:
1450
- !this.get(c) && se && se[be] && this.set(c, se[be]);
1449
+ case $:
1450
+ !this.get(f) && de && de[ye] && this.set(f, de[ye]);
1451
1451
  break;
1452
- case ge:
1453
- var e = this.data, t = function(i) {
1454
- return e[i].getItem().detectFeature().get();
1452
+ case be:
1453
+ var e = this.data, t = function(n) {
1454
+ return e[n].getItem().detectFeature().get();
1455
1455
  };
1456
- this.set(F, t(F)).set(X, t(X)).set(j, t(j)).set(W, t(W)).set(U, t(U));
1456
+ this.set(P, t(P)).set(Z, t(Z)).set(G, t(G)).set(V, t(V)).set($, t($));
1457
1457
  }
1458
1458
  return this;
1459
1459
  };
1460
- ee.prototype.parseUA = function() {
1461
- switch (this.itemType != ge && lt.call(this.data, this.ua, this.rgxMap), this.itemType) {
1462
- case F:
1463
- this.set(Ie, at(this.get(u)));
1460
+ re.prototype.parseUA = function() {
1461
+ switch (this.itemType != be && bt.call(this.data, this.ua, this.rgxMap), this.itemType) {
1462
+ case P:
1463
+ this.set(Ne, wt(this.get(g)));
1464
1464
  break;
1465
- case U:
1466
- if (this.get(c) == "iOS" && this.get(u) == "18.6") {
1465
+ case $:
1466
+ if (this.get(f) == "iOS" && this.get(g) == "18.6") {
1467
1467
  var e = /\) Version\/([\d\.]+)/.exec(this.ua);
1468
- e && parseInt(e[1].substring(0, 2), 10) >= 26 && this.set(u, e[1]);
1468
+ e && parseInt(e[1].substring(0, 2), 10) >= 26 && this.set(g, e[1]);
1469
1469
  }
1470
1470
  break;
1471
1471
  }
1472
1472
  return this;
1473
1473
  };
1474
- ee.prototype.parseCH = function() {
1474
+ re.prototype.parseCH = function() {
1475
1475
  var e = this.uaCH, t = this.rgxMap;
1476
1476
  switch (this.itemType) {
1477
- case F:
1478
- case W:
1479
- var i = e[ut] || e[dt], n;
1480
- if (i)
1481
- for (var o = 0; o < i.length; o++) {
1482
- var s = i[o].brand || i[o], r = i[o].version;
1483
- this.itemType == F && !/not.a.brand/i.test(s) && (!n || /Chrom/.test(n) && s != Dt || n == ze && /WebView2/.test(s)) && (s = B(s, Di), n = this.get(c), n && !/Chrom/.test(n) && /Chrom/.test(s) || this.set(c, s).set(u, r).set(Ie, at(r)), n = s), this.itemType == W && s == Dt && this.set(u, r);
1477
+ case P:
1478
+ case V:
1479
+ var n = e[vt] || e[xt], i;
1480
+ if (n)
1481
+ for (var a = 0; a < n.length; a++) {
1482
+ var o = n[a].brand || n[a], r = n[a].version;
1483
+ this.itemType == P && !/not.a.brand/i.test(o) && (!i || /Chrom/.test(i) && o != Wt || i == je && /WebView2/.test(o)) && (o = q(o, Jn), i = this.get(f), i && !/Chrom/.test(i) && /Chrom/.test(o) || this.set(f, o).set(g, r).set(Ne, wt(r)), i = o), this.itemType == V && o == Wt && this.set(g, r);
1484
1484
  }
1485
1485
  break;
1486
- case X:
1487
- var h = e[P];
1488
- h && (h && e[We] == "64" && (h += "64"), lt.call(this.data, h + ";", t));
1486
+ case Z:
1487
+ var s = e[U];
1488
+ s && (s && e[Je] == "64" && (s += "64"), bt.call(this.data, s + ";", t));
1489
1489
  break;
1490
- case j:
1491
- if (e[w] && this.set(a, w), e[l] && (this.set(l, e[l]), !this.get(a) || !this.get(d))) {
1492
- var f = {};
1493
- lt.call(f, "droid 9; " + e[l] + ")", t), !this.get(a) && f.type && this.set(a, f.type), !this.get(d) && f.vendor && this.set(d, f.vendor);
1490
+ case G:
1491
+ if (e[E] && this.set(c, E), e[u] && (this.set(u, e[u]), !this.get(c) || !this.get(h))) {
1492
+ var d = {};
1493
+ bt.call(d, "droid 9; " + e[u] + ")", t), !this.get(c) && d.type && this.set(c, d.type), !this.get(h) && d.vendor && this.set(h, d.vendor);
1494
1494
  }
1495
- if (e[oe]) {
1496
- var b;
1497
- if (typeof e[oe] != "string")
1498
- for (var m = 0; !b && m < e[oe].length; )
1499
- b = B(e[oe][m++], zt);
1495
+ if (e[ce]) {
1496
+ var p;
1497
+ if (typeof e[ce] != "string")
1498
+ for (var l = 0; !p && l < e[ce].length; )
1499
+ p = q(e[ce][l++], jt);
1500
1500
  else
1501
- b = B(e[oe], zt);
1502
- this.set(a, b);
1501
+ p = q(e[ce], jt);
1502
+ this.set(c, p);
1503
1503
  }
1504
1504
  break;
1505
- case U:
1506
- var k = e[be];
1507
- if (k) {
1508
- var R = e[ht];
1509
- k == ot && (R = parseInt(at(R), 10) >= 13 ? "11" : "10"), this.set(c, k).set(u, R);
1505
+ case $:
1506
+ var m = e[ye];
1507
+ if (m) {
1508
+ var b = e[St];
1509
+ m == pt && (b = parseInt(wt(b), 10) >= 13 ? "11" : "10"), this.set(f, m).set(g, b);
1510
1510
  }
1511
- this.get(c) == ot && e[l] == "Xbox" && this.set(c, "Xbox").set(u, void 0);
1511
+ this.get(f) == pt && e[u] == "Xbox" && this.set(f, "Xbox").set(g, void 0);
1512
1512
  break;
1513
- case ge:
1514
- var $ = this.data, O = function(y) {
1515
- return $[y].getItem().setCH(e).parseCH().get();
1513
+ case be:
1514
+ var v = this.data, S = function(w) {
1515
+ return v[w].getItem().setCH(e).parseCH().get();
1516
1516
  };
1517
- this.set(F, O(F)).set(X, O(X)).set(j, O(j)).set(W, O(W)).set(U, O(U));
1517
+ this.set(P, S(P)).set(Z, S(Z)).set(G, S(G)).set(V, S(V)).set($, S($));
1518
1518
  }
1519
1519
  return this;
1520
1520
  };
1521
- function Y(e, t, i) {
1522
- if (typeof e === E.OBJECT ? (He(e, !0) ? (typeof t === E.OBJECT && (i = t), t = e) : (i = e, t = void 0), e = void 0) : typeof e === E.STRING && !He(t, !0) && (i = t, t = void 0), i)
1523
- if (typeof i.append === E.FUNCTION) {
1524
- var n = {};
1525
- i.forEach(function(m, k) {
1526
- n[String(k).toLowerCase()] = m;
1527
- }), i = n;
1521
+ function ee(e, t, n) {
1522
+ if (typeof e === O.OBJECT ? (Ge(e, !0) ? (typeof t === O.OBJECT && (n = t), t = e) : (n = e, t = void 0), e = void 0) : typeof e === O.STRING && !Ge(t, !0) && (n = t, t = void 0), n)
1523
+ if (typeof n.append === O.FUNCTION) {
1524
+ var i = {};
1525
+ n.forEach(function(l, m) {
1526
+ i[String(m).toLowerCase()] = l;
1527
+ }), n = i;
1528
1528
  } else {
1529
- var o = {};
1530
- for (var s in i)
1531
- i.hasOwnProperty(s) && (o[String(s).toLowerCase()] = i[s]);
1532
- i = o;
1529
+ var a = {};
1530
+ for (var o in n)
1531
+ n.hasOwnProperty(o) && (a[String(o).toLowerCase()] = n[o]);
1532
+ n = a;
1533
1533
  }
1534
- if (!(this instanceof Y))
1535
- return new Y(e, t, i).getResult();
1536
- var r = typeof e === E.STRING ? e : (
1534
+ if (!(this instanceof ee))
1535
+ return new ee(e, t, n).getResult();
1536
+ var r = typeof e === O.STRING ? e : (
1537
1537
  // Passed user-agent string
1538
- i && i[Ct] ? i[Ct] : (
1538
+ n && n[Dt] ? n[Dt] : (
1539
1539
  // User-Agent from passed headers
1540
- D && D.userAgent ? D.userAgent : (
1540
+ B && B.userAgent ? B.userAgent : (
1541
1541
  // navigator.userAgent
1542
- pe
1542
+ we
1543
1543
  )
1544
1544
  )
1545
- ), h = new Kt(i, !0), f = t ? Li(Ht, t) : Ht, b = function(m) {
1546
- return m == ge ? function() {
1547
- return new ee(m, r, f, h).set("ua", r).set(F, this.getBrowser()).set(X, this.getCPU()).set(j, this.getDevice()).set(W, this.getEngine()).set(U, this.getOS()).get();
1545
+ ), s = new an(n, !0), d = t ? Yn(Gt, t) : Gt, p = function(l) {
1546
+ return l == be ? function() {
1547
+ return new re(l, r, d, s).set("ua", r).set(P, this.getBrowser()).set(Z, this.getCPU()).set(G, this.getDevice()).set(V, this.getEngine()).set($, this.getOS()).get();
1548
1548
  } : function() {
1549
- return new ee(m, r, f[m], h).parseUA().get();
1549
+ return new re(l, r, d[l], s).parseUA().get();
1550
1550
  };
1551
1551
  };
1552
- return G.call(this, [
1553
- ["getBrowser", b(F)],
1554
- ["getCPU", b(X)],
1555
- ["getDevice", b(j)],
1556
- ["getEngine", b(W)],
1557
- ["getOS", b(U)],
1558
- ["getResult", b(ge)],
1552
+ return K.call(this, [
1553
+ ["getBrowser", p(P)],
1554
+ ["getCPU", p(Z)],
1555
+ ["getDevice", p(G)],
1556
+ ["getEngine", p(V)],
1557
+ ["getOS", p($)],
1558
+ ["getResult", p(be)],
1559
1559
  ["getUA", function() {
1560
1560
  return r;
1561
1561
  }],
1562
- ["setUA", function(m) {
1563
- return Te(m) && (r = Ue(m, Ci)), this;
1562
+ ["setUA", function(l) {
1563
+ return Fe(l) && (r = Xe(l, Pn)), this;
1564
1564
  }]
1565
1565
  ]).setUA(r), this;
1566
1566
  }
1567
- Y.VERSION = Si;
1568
- Y.BROWSER = Ve([c, u, Ie, a]);
1569
- Y.CPU = Ve([P]);
1570
- Y.DEVICE = Ve([l, d, a, _e, w, I, v, V, Ee]);
1571
- Y.ENGINE = Y.OS = Ve([c, u]);
1572
- const Jt = () => {
1573
- const t = new Y().getResult();
1567
+ ee.VERSION = Bn;
1568
+ ee.BROWSER = Qe([f, g, Ne, c]);
1569
+ ee.CPU = Qe([U]);
1570
+ ee.DEVICE = Qe([u, h, c, Ve, E, D, R, j, Re]);
1571
+ ee.ENGINE = ee.OS = Qe([f, g]);
1572
+ const Kn = () => {
1573
+ const t = new ee().getResult();
1574
1574
  return {
1575
1575
  os: t.os.name || "unknown",
1576
1576
  osVersion: t.os.version || "unknown",
@@ -1580,572 +1580,1397 @@ const Jt = () => {
1580
1580
  // Default to desktop if empty (common for desktop browsers)
1581
1581
  };
1582
1582
  };
1583
- function _i(e, t) {
1584
- if (e.match(/^[a-z]+:\/\//i))
1585
- return e;
1586
- if (e.match(/^\/\//))
1587
- return window.location.protocol + e;
1588
- if (e.match(/^[a-z]+:/i))
1589
- return e;
1590
- const i = document.implementation.createHTMLDocument(), n = i.createElement("base"), o = i.createElement("a");
1591
- return i.head.appendChild(n), i.body.appendChild(o), t && (n.href = t), o.href = e, o.href;
1592
- }
1593
- const zi = /* @__PURE__ */ (() => {
1594
- let e = 0;
1595
- const t = () => (
1596
- // eslint-disable-next-line no-bitwise
1597
- `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
1598
- );
1599
- return () => (e += 1, `u${t()}${e}`);
1600
- })();
1601
- function J(e) {
1602
- const t = [];
1603
- for (let i = 0, n = e.length; i < n; i++)
1604
- t.push(e[i]);
1605
- return t;
1606
- }
1607
- let he = null;
1608
- function ei(e = {}) {
1609
- return he || (e.includeStyleProperties ? (he = e.includeStyleProperties, he) : (he = J(window.getComputedStyle(document.documentElement)), he));
1583
+ function Zn() {
1584
+ const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile/.test(e), n = /ipad|android(?!.*mobile)/.test(e), a = (navigator.deviceMemory || 4) < 4;
1585
+ return t ? {
1586
+ maxCanvasSize: 4096,
1587
+ recommendedScale: a ? 0.8 : 1,
1588
+ recommendedQuality: a ? 0.7 : 0.8,
1589
+ chunkSize: 30,
1590
+ yieldInterval: 16,
1591
+ // ~60fps
1592
+ maxTimeout: 5e3
1593
+ } : n ? {
1594
+ maxCanvasSize: 8192,
1595
+ recommendedScale: 1,
1596
+ recommendedQuality: 0.85,
1597
+ chunkSize: 50,
1598
+ yieldInterval: 16,
1599
+ maxTimeout: 4e3
1600
+ } : {
1601
+ maxCanvasSize: 16384,
1602
+ recommendedScale: 1,
1603
+ recommendedQuality: 0.9,
1604
+ chunkSize: 100,
1605
+ yieldInterval: 8,
1606
+ maxTimeout: 3e3
1607
+ };
1610
1608
  }
1611
- function $e(e, t) {
1612
- const n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
1613
- return n ? parseFloat(n.replace("px", "")) : 0;
1609
+ function ei() {
1610
+ return {
1611
+ objectUrls: [],
1612
+ tempCanvases: []
1613
+ };
1614
1614
  }
1615
- function Hi(e) {
1616
- const t = $e(e, "border-left-width"), i = $e(e, "border-right-width");
1617
- return e.clientWidth + t + i;
1615
+ function ti(e) {
1616
+ e.objectUrls.forEach((t) => {
1617
+ try {
1618
+ URL.revokeObjectURL(t);
1619
+ } catch {
1620
+ console.warn("[Screenshot] Failed to revoke URL:", t);
1621
+ }
1622
+ }), e.tempCanvases.forEach((t) => {
1623
+ const n = t.getContext("2d");
1624
+ n && n.clearRect(0, 0, t.width, t.height), t.width = 0, t.height = 0;
1625
+ }), e.objectUrls.length = 0, e.tempCanvases.length = 0;
1618
1626
  }
1619
- function Ui(e) {
1620
- const t = $e(e, "border-top-width"), i = $e(e, "border-bottom-width");
1621
- return e.clientHeight + t + i;
1627
+ function ni(e, t) {
1628
+ const n = e ? e.x : 0, i = e ? e.y : 0, a = e ? e.width : window.innerWidth, o = e ? e.height : window.innerHeight;
1629
+ return {
1630
+ left: n - t,
1631
+ top: i - t,
1632
+ right: n + a + t,
1633
+ bottom: i + o + t
1634
+ };
1622
1635
  }
1623
- function ti(e, t = {}) {
1624
- const i = t.width || Hi(e), n = t.height || Ui(e);
1625
- return { width: i, height: n };
1636
+ function ii(e, t) {
1637
+ const n = e.getBoundingClientRect();
1638
+ return !(n.bottom < t.top || n.top > t.bottom || n.right < t.left || n.left > t.right || n.width === 0 || n.height === 0);
1626
1639
  }
1627
- function $i() {
1628
- let e, t;
1629
- try {
1630
- t = process;
1631
- } catch {
1632
- }
1633
- const i = t && t.env ? t.env.devicePixelRatio : null;
1634
- return i && (e = parseInt(i, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
1635
- }
1636
- const H = 16384;
1637
- function Bi(e) {
1638
- (e.width > H || e.height > H) && (e.width > H && e.height > H ? e.width > e.height ? (e.height *= H / e.width, e.width = H) : (e.width *= H / e.height, e.height = H) : e.width > H ? (e.height *= H / e.width, e.width = H) : (e.width *= H / e.height, e.height = H));
1639
- }
1640
- function Be(e) {
1641
- return new Promise((t, i) => {
1642
- const n = new Image();
1643
- n.onload = () => {
1644
- n.decode().then(() => {
1645
- requestAnimationFrame(() => t(n));
1646
- });
1647
- }, n.onerror = i, n.crossOrigin = "anonymous", n.decoding = "async", n.src = e;
1640
+ function ri(e) {
1641
+ return Array.from(document.body.getElementsByTagName("*")).filter((n) => {
1642
+ if (!(n instanceof HTMLElement)) return !1;
1643
+ const i = n.tagName;
1644
+ return ["SCRIPT", "STYLE", "LINK", "IFRAME", "NOSCRIPT"].includes(i) ? !1 : i === "HTML" || i === "BODY" ? !0 : ii(n, e);
1648
1645
  });
1649
1646
  }
1650
- async function Wi(e) {
1651
- return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
1647
+ function oi(e) {
1648
+ const t = e.getElementsByTagName("*"), n = e.getElementsByTagName("img"), i = e.getElementsByTagName("svg"), a = t.length, o = n.length, r = i.length, s = a > 1e3 || o > 50 || r > 10;
1649
+ return { nodeCount: a, imageCount: o, svgCount: r, isComplex: s };
1652
1650
  }
1653
- async function Vi(e, t, i) {
1654
- const n = "http://www.w3.org/2000/svg", o = document.createElementNS(n, "svg"), s = document.createElementNS(n, "foreignObject");
1655
- return o.setAttribute("width", `${t}`), o.setAttribute("height", `${i}`), o.setAttribute("viewBox", `0 0 ${t} ${i}`), s.setAttribute("width", "100%"), s.setAttribute("height", "100%"), s.setAttribute("x", "0"), s.setAttribute("y", "0"), s.setAttribute("externalResourcesRequired", "true"), o.appendChild(s), s.appendChild(e), Wi(o);
1651
+ function qe() {
1652
+ return new Promise((e) => {
1653
+ "scheduler" in window && "yield" in window.scheduler ? window.scheduler.yield().then(e) : setTimeout(e, 0);
1654
+ });
1656
1655
  }
1657
- const _ = (e, t) => {
1658
- if (e instanceof t)
1659
- return !0;
1660
- const i = Object.getPrototypeOf(e);
1661
- return i === null ? !1 : i.constructor.name === t.name || _(i, t);
1662
- };
1663
- function ji(e) {
1664
- const t = e.getPropertyValue("content");
1665
- return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
1666
- }
1667
- function Ni(e, t) {
1668
- return ei(t).map((i) => {
1669
- const n = e.getPropertyValue(i), o = e.getPropertyPriority(i);
1670
- return `${i}: ${n}${o ? " !important" : ""};`;
1671
- }).join(" ");
1672
- }
1673
- function qi(e, t, i, n) {
1674
- const o = `.${e}:${t}`, s = i.cssText ? ji(i) : Ni(i, n);
1675
- return document.createTextNode(`${o}{${s}}`);
1676
- }
1677
- function Ut(e, t, i, n) {
1678
- const o = window.getComputedStyle(e, i), s = o.getPropertyValue("content");
1679
- if (s === "" || s === "none")
1680
- return;
1681
- const r = zi();
1682
- try {
1683
- t.className = `${t.className} ${r}`;
1684
- } catch {
1685
- return;
1686
- }
1687
- const h = document.createElement("style");
1688
- h.appendChild(qi(r, i, o, n)), t.appendChild(h);
1689
- }
1690
- function Gi(e, t, i) {
1691
- Ut(e, t, ":before", i), Ut(e, t, ":after", i);
1692
- }
1693
- const $t = "application/font-woff", Bt = "image/jpeg", Xi = {
1694
- woff: $t,
1695
- woff2: $t,
1696
- ttf: "application/font-truetype",
1697
- eot: "application/vnd.ms-fontobject",
1698
- png: "image/png",
1699
- jpg: Bt,
1700
- jpeg: Bt,
1701
- gif: "image/gif",
1702
- tiff: "image/tiff",
1703
- svg: "image/svg+xml",
1704
- webp: "image/webp"
1705
- };
1706
- function Yi(e) {
1707
- const t = /\.([^./]*?)$/g.exec(e);
1708
- return t ? t[1] : "";
1709
- }
1710
- function ft(e) {
1711
- const t = Yi(e).toLowerCase();
1712
- return Xi[t] || "";
1713
- }
1714
- function Qi(e) {
1715
- return e.split(/,/)[1];
1716
- }
1717
- function ct(e) {
1718
- return e.search(/^(data:)/) !== -1;
1719
- }
1720
- function Zi(e, t) {
1721
- return `data:${t};base64,${e}`;
1722
- }
1723
- async function ii(e, t, i) {
1724
- const n = await fetch(e, t);
1725
- if (n.status === 404)
1726
- throw new Error(`Resource "${n.url}" not found`);
1727
- const o = await n.blob();
1728
- return new Promise((s, r) => {
1729
- const h = new FileReader();
1730
- h.onerror = r, h.onloadend = () => {
1731
- try {
1732
- s(i({ res: n, result: h.result }));
1733
- } catch (f) {
1734
- r(f);
1735
- }
1736
- }, h.readAsDataURL(o);
1656
+ function si(e, t, n) {
1657
+ return new Promise((i, a) => {
1658
+ const o = setTimeout(() => {
1659
+ a(new Error("Image load timeout"));
1660
+ }, n);
1661
+ e.onload = () => {
1662
+ clearTimeout(o), i();
1663
+ }, e.onerror = () => {
1664
+ clearTimeout(o), a(new Error("Image load error"));
1665
+ }, e.src = t;
1737
1666
  });
1738
1667
  }
1739
- const it = {};
1740
- function Ki(e, t, i) {
1741
- let n = e.replace(/\?.*/, "");
1742
- return i && (n = e), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), t ? `[${t}]${n}` : n;
1743
- }
1744
- async function pt(e, t, i) {
1745
- const n = Ki(e, t, i.includeQueryParams);
1746
- if (it[n] != null)
1747
- return it[n];
1748
- i.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
1749
- let o;
1750
- try {
1751
- const s = await ii(e, i.fetchRequestInit, ({ res: r, result: h }) => (t || (t = r.headers.get("Content-Type") || ""), Qi(h)));
1752
- o = Zi(s, t);
1753
- } catch (s) {
1754
- o = i.imagePlaceholder || "";
1755
- let r = `Failed to fetch resource: ${e}`;
1756
- s && (r = typeof s == "string" ? s : s.message), r && console.warn(r);
1757
- }
1758
- return it[n] = o, o;
1759
- }
1760
- async function Ji(e) {
1761
- const t = e.toDataURL();
1762
- return t === "data:," ? e.cloneNode(!1) : Be(t);
1763
- }
1764
- async function en(e, t) {
1765
- if (e.currentSrc) {
1766
- const s = document.createElement("canvas"), r = s.getContext("2d");
1767
- s.width = e.clientWidth, s.height = e.clientHeight, r?.drawImage(e, 0, 0, s.width, s.height);
1768
- const h = s.toDataURL();
1769
- return Be(h);
1668
+ async function ai(e, t) {
1669
+ const n = e.getBoundingClientRect(), i = window.getComputedStyle(e), a = n.left, o = n.top, r = n.width, s = n.height, d = i.backgroundColor;
1670
+ d && d !== "transparent" && d !== "rgba(0, 0, 0, 0)" && (t.fillStyle = d, t.fillRect(a, o, r, s));
1671
+ const p = parseFloat(i.borderWidth) || 0;
1672
+ if (p > 0) {
1673
+ const l = i.borderColor;
1674
+ l && l !== "transparent" && (t.strokeStyle = l, t.lineWidth = p, t.strokeRect(a, o, r, s));
1770
1675
  }
1771
- const i = e.poster, n = ft(i), o = await pt(i, n, t);
1772
- return Be(o);
1773
1676
  }
1774
- async function tn(e, t) {
1775
- var i;
1677
+ async function li(e, t) {
1678
+ for (const n of e)
1679
+ n instanceof HTMLElement && await ai(n, t);
1680
+ }
1681
+ async function ci(e, t, n, i, a, o) {
1776
1682
  try {
1777
- if (!((i = e?.contentDocument) === null || i === void 0) && i.body)
1778
- return await je(e.contentDocument.body, t, !0);
1779
- } catch {
1683
+ const r = new Image();
1684
+ return r.crossOrigin = "anonymous", await si(r, e.src, 3e3), t.drawImage(r, n, i, a, o), { success: !0, method: "canvas" };
1685
+ } catch (r) {
1686
+ return {
1687
+ success: !1,
1688
+ error: r instanceof Error ? r.message : "Canvas render failed"
1689
+ };
1780
1690
  }
1781
- return e.cloneNode(!1);
1782
1691
  }
1783
- async function nn(e, t) {
1784
- return _(e, HTMLCanvasElement) ? Ji(e) : _(e, HTMLVideoElement) ? en(e, t) : _(e, HTMLIFrameElement) ? tn(e, t) : e.cloneNode(ni(e));
1692
+ function di(e, t, n, i, a) {
1693
+ return e.fillStyle = "#f0f0f0", e.fillRect(t, n, i, a), e.strokeStyle = "#ccc", e.lineWidth = 1, e.strokeRect(t, n, i, a), e.fillStyle = "#999", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Image", t + i / 2, n + a / 2), { success: !0, method: "placeholder" };
1785
1694
  }
1786
- const rn = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", ni = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
1787
- async function on(e, t, i) {
1788
- var n, o;
1789
- if (ni(t))
1790
- return t;
1791
- let s = [];
1792
- return rn(e) && e.assignedNodes ? s = J(e.assignedNodes()) : _(e, HTMLIFrameElement) && (!((n = e.contentDocument) === null || n === void 0) && n.body) ? s = J(e.contentDocument.body.childNodes) : s = J(((o = e.shadowRoot) !== null && o !== void 0 ? o : e).childNodes), s.length === 0 || _(e, HTMLVideoElement) || await s.reduce((r, h) => r.then(() => je(h, i)).then((f) => {
1793
- f && t.appendChild(f);
1794
- }), Promise.resolve()), t;
1795
- }
1796
- function sn(e, t, i) {
1797
- const n = t.style;
1798
- if (!n)
1799
- return;
1800
- const o = window.getComputedStyle(e);
1801
- o.cssText ? (n.cssText = o.cssText, n.transformOrigin = o.transformOrigin) : ei(i).forEach((s) => {
1802
- let r = o.getPropertyValue(s);
1803
- s === "font-size" && r.endsWith("px") && (r = `${Math.floor(parseFloat(r.substring(0, r.length - 2))) - 0.1}px`), _(e, HTMLIFrameElement) && s === "display" && r === "inline" && (r = "block"), s === "d" && t.getAttribute("d") && (r = `path(${t.getAttribute("d")})`), n.setProperty(s, r, o.getPropertyPriority(s));
1804
- });
1695
+ function ui(e, t) {
1696
+ return e < 5 || t < 5;
1805
1697
  }
1806
- function an(e, t) {
1807
- _(e, HTMLTextAreaElement) && (t.innerHTML = e.value), _(e, HTMLInputElement) && t.setAttribute("value", e.value);
1698
+ async function fi(e, t) {
1699
+ const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
1700
+ if (ui(o, r))
1701
+ return { success: !0, method: "skip" };
1702
+ const s = await ci(e, t, i, a, o, r);
1703
+ return s.success ? s : di(t, i, a, o, r);
1808
1704
  }
1809
- function ln(e, t) {
1810
- if (_(e, HTMLSelectElement)) {
1811
- const n = Array.from(t.children).find((o) => e.value === o.getAttribute("value"));
1812
- n && n.setAttribute("selected", "");
1813
- }
1705
+ async function hi(e, t, n) {
1706
+ for (let i = 0; i < e.length; i++)
1707
+ await fi(e[i], t), n && n(i + 1, e.length);
1814
1708
  }
1815
- function cn(e, t, i) {
1816
- return _(t, Element) && (sn(e, t, i), Gi(e, t, i), an(e, t), ln(e, t)), t;
1709
+ function gi(e) {
1710
+ const t = [];
1711
+ for (const n of e)
1712
+ n instanceof HTMLImageElement && n.src && t.push(n);
1713
+ return t;
1817
1714
  }
1818
- async function dn(e, t) {
1819
- const i = e.querySelectorAll ? e.querySelectorAll("use") : [];
1820
- if (i.length === 0)
1821
- return e;
1822
- const n = {};
1823
- for (let s = 0; s < i.length; s++) {
1824
- const h = i[s].getAttribute("xlink:href");
1825
- if (h) {
1826
- const f = e.querySelector(h), b = document.querySelector(h);
1827
- !f && b && !n[h] && (n[h] = await je(b, t, !0));
1715
+ function pi(e) {
1716
+ let n = new XMLSerializer().serializeToString(e);
1717
+ return n.includes("xmlns=") || (n = n.replace(
1718
+ "<svg",
1719
+ '<svg xmlns="http://www.w3.org/2000/svg"'
1720
+ )), n;
1721
+ }
1722
+ async function mi(e, t) {
1723
+ try {
1724
+ const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
1725
+ if (o < 1 || r < 1)
1726
+ return { success: !0 };
1727
+ const s = pi(e), d = new Blob([s], { type: "image/svg+xml;charset=utf-8" }), p = URL.createObjectURL(d);
1728
+ try {
1729
+ const l = new Image();
1730
+ return await new Promise((m, b) => {
1731
+ l.onload = () => m(), l.onerror = () => b(new Error("SVG image load failed")), l.src = p;
1732
+ }), t.drawImage(l, i, a, o, r), { success: !0 };
1733
+ } finally {
1734
+ URL.revokeObjectURL(p);
1828
1735
  }
1736
+ } catch (n) {
1737
+ return {
1738
+ success: !1,
1739
+ error: n instanceof Error ? n.message : "SVG render failed"
1740
+ };
1829
1741
  }
1830
- const o = Object.values(n);
1831
- if (o.length) {
1832
- const s = "http://www.w3.org/1999/xhtml", r = document.createElementNS(s, "svg");
1833
- r.setAttribute("xmlns", s), r.style.position = "absolute", r.style.width = "0", r.style.height = "0", r.style.overflow = "hidden", r.style.display = "none";
1834
- const h = document.createElementNS(s, "defs");
1835
- r.appendChild(h);
1836
- for (let f = 0; f < o.length; f++)
1837
- h.appendChild(o[f]);
1838
- e.appendChild(r);
1839
- }
1840
- return e;
1841
1742
  }
1842
- async function je(e, t, i) {
1843
- return !i && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((n) => nn(n, t)).then((n) => on(e, n, t)).then((n) => cn(e, n, t)).then((n) => dn(n, t));
1743
+ async function wi(e, t, n) {
1744
+ for (let i = 0; i < e.length; i++)
1745
+ await mi(e[i], t), n && n(i + 1, e.length);
1844
1746
  }
1845
- const ri = /url\((['"]?)([^'"]+?)\1\)/g, un = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, hn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
1846
- function fn(e) {
1847
- const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
1848
- return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
1747
+ function bi(e) {
1748
+ return e.classList.contains("MathJax") || e.classList.contains("MathJax_Display") || e.classList.contains("MJX-TeXAtom-ORD") || e.hasAttribute("data-mathml");
1849
1749
  }
1850
- function pn(e) {
1750
+ function yi(e) {
1851
1751
  const t = [];
1852
- return e.replace(ri, (i, n, o) => (t.push(o), i)), t.filter((i) => !ct(i));
1752
+ for (const n of e)
1753
+ n instanceof SVGElement && t.push(n);
1754
+ return t;
1853
1755
  }
1854
- async function gn(e, t, i, n, o) {
1756
+ function xi(e) {
1757
+ return e.filter((t) => bi(t));
1758
+ }
1759
+ async function vi(e, t) {
1855
1760
  try {
1856
- const s = i ? _i(t, i) : t, r = ft(t);
1857
- let h;
1858
- return o || (h = await pt(s, r, n)), e.replace(fn(t), `$1${h}$3`);
1859
- } catch {
1761
+ const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
1762
+ if (o < 1 || r < 1)
1763
+ return { success: !0 };
1764
+ const s = window.getComputedStyle(e), d = e.cloneNode(!0), p = [
1765
+ "color",
1766
+ "font-family",
1767
+ "font-size",
1768
+ "font-weight",
1769
+ "font-style",
1770
+ "line-height",
1771
+ "text-align",
1772
+ "text-decoration",
1773
+ "text-transform",
1774
+ "letter-spacing",
1775
+ "word-spacing",
1776
+ "white-space",
1777
+ "padding",
1778
+ "margin",
1779
+ "display",
1780
+ "flex-direction",
1781
+ "align-items",
1782
+ "justify-content"
1783
+ ];
1784
+ let l = "";
1785
+ p.forEach((S) => {
1786
+ const w = s.getPropertyValue(S);
1787
+ w && (l += `${S}: ${w}; `);
1788
+ }), d.setAttribute("style", l);
1789
+ const m = `
1790
+ <svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${r}">
1791
+ <foreignObject width="100%" height="100%">
1792
+ <div xmlns="http://www.w3.org/1999/xhtml" style="width: ${o}px; height: ${r}px; overflow: hidden;">
1793
+ ${d.outerHTML}
1794
+ </div>
1795
+ </foreignObject>
1796
+ </svg>
1797
+ `, b = new Blob([m], { type: "image/svg+xml;charset=utf-8" }), v = URL.createObjectURL(b);
1798
+ try {
1799
+ const S = new Image();
1800
+ return await new Promise((w, k) => {
1801
+ const y = setTimeout(() => {
1802
+ k(new Error("Text element render timeout"));
1803
+ }, 1e3);
1804
+ S.onload = () => {
1805
+ clearTimeout(y), w();
1806
+ }, S.onerror = () => {
1807
+ clearTimeout(y), k(new Error("Text element image load failed"));
1808
+ }, S.src = v;
1809
+ }), t.drawImage(S, i, a, o, r), { success: !0 };
1810
+ } finally {
1811
+ URL.revokeObjectURL(v);
1812
+ }
1813
+ } catch (n) {
1814
+ return console.warn("[TextRenderer] Failed to render text element:", n), {
1815
+ success: !1,
1816
+ error: n instanceof Error ? n.message : "Text render failed"
1817
+ };
1818
+ }
1819
+ }
1820
+ function Si(e) {
1821
+ const t = window.getComputedStyle(e);
1822
+ if (t.display === "none" || t.visibility === "hidden")
1823
+ return !1;
1824
+ const n = e.textContent?.trim();
1825
+ return !(!n || n.length === 0);
1826
+ }
1827
+ function Ci(e) {
1828
+ const t = [];
1829
+ for (const n of e) {
1830
+ if (!(n instanceof HTMLElement)) continue;
1831
+ const i = n.tagName;
1832
+ if (["IMG", "SVG", "CANVAS", "VIDEO", "IFRAME", "SCRIPT", "STYLE", "NOSCRIPT"].includes(i))
1833
+ continue;
1834
+ [
1835
+ "P",
1836
+ "SPAN",
1837
+ "DIV",
1838
+ "A",
1839
+ "BUTTON",
1840
+ "LABEL",
1841
+ "LI",
1842
+ "H1",
1843
+ "H2",
1844
+ "H3",
1845
+ "H4",
1846
+ "H5",
1847
+ "H6",
1848
+ "TD",
1849
+ "TH",
1850
+ "STRONG",
1851
+ "EM",
1852
+ "B",
1853
+ "I",
1854
+ "U",
1855
+ "CODE",
1856
+ "PRE",
1857
+ "BLOCKQUOTE"
1858
+ ].includes(i) && Si(n) && (Array.from(n.children).some((r) => {
1859
+ const s = r.tagName;
1860
+ return ["DIV", "P", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "TABLE"].includes(s);
1861
+ }) || t.push(n));
1862
+ }
1863
+ return t;
1864
+ }
1865
+ async function ki(e, t, n) {
1866
+ const i = Ci(e);
1867
+ console.log("[TextRenderer] Rendering", i.length, "text elements");
1868
+ for (let a = 0; a < i.length; a++) {
1869
+ const o = await vi(i[a], t);
1870
+ o.success || console.warn("[TextRenderer] Failed to render element:", i[a], o.error);
1871
+ }
1872
+ }
1873
+ async function Ei(e, t, n) {
1874
+ const i = ei();
1875
+ try {
1876
+ const a = Zn(), o = t.quality ?? a.recommendedQuality, r = t.scale ?? a.recommendedScale, s = t.includeMathJax ?? !0;
1877
+ n?.({
1878
+ phase: "analyzing",
1879
+ progress: 10,
1880
+ message: "Analyzing DOM structure..."
1881
+ });
1882
+ const d = document.documentElement, p = oi(d);
1883
+ console.log("[Canvas] DOM complexity:", p);
1884
+ let l = o;
1885
+ p.isComplex && (l = Math.max(0.6, o - 0.1), console.log("[Canvas] Complex DOM detected, reducing quality to", l));
1886
+ const m = e ? e.x : 0, b = e ? e.y : 0, v = e ? e.width : window.innerWidth, S = e ? e.height : window.innerHeight;
1887
+ let w = r;
1888
+ (v * w > a.maxCanvasSize || S * w > a.maxCanvasSize) && (console.warn("[Canvas] Size exceeds device limits, reducing scale"), w = Math.min(
1889
+ a.maxCanvasSize / v,
1890
+ a.maxCanvasSize / S,
1891
+ w
1892
+ ));
1893
+ const k = document.createElement("canvas");
1894
+ k.width = v * w, k.height = S * w, i.tempCanvases.push(k);
1895
+ const y = k.getContext("2d", {
1896
+ alpha: !1,
1897
+ willReadFrequently: !1
1898
+ });
1899
+ if (!y)
1900
+ throw new Error("Failed to get canvas context");
1901
+ y.scale(w, w), y.fillStyle = "#ffffff", y.fillRect(0, 0, v, S), n?.({
1902
+ phase: "analyzing",
1903
+ progress: 20,
1904
+ message: "Collecting visible elements..."
1905
+ });
1906
+ const I = ni(
1907
+ e,
1908
+ a.maxCanvasSize > 8192 ? 500 : 300
1909
+ // Buffer based on device
1910
+ ), T = ri(I);
1911
+ console.log("[Canvas] Visible elements:", T.length);
1912
+ const M = gi(T), L = yi(T), H = s ? xi(T) : [];
1913
+ console.log("[Canvas] Images:", M.length, "SVGs:", L.length, "MathJax:", H.length), n?.({
1914
+ phase: "rendering",
1915
+ progress: 30,
1916
+ message: "Rendering backgrounds..."
1917
+ }), y.translate(-m, -b), await li(T, y), await qe(), n?.({
1918
+ phase: "rendering",
1919
+ progress: 50,
1920
+ message: `Rendering ${M.length} images...`
1921
+ }), await hi(M, y, (_, W) => {
1922
+ const te = 50 + Math.round(_ / W * 30);
1923
+ n?.({
1924
+ phase: "rendering",
1925
+ progress: te,
1926
+ message: `Rendering images (${_}/${W})...`
1927
+ });
1928
+ }), await qe(), n?.({
1929
+ phase: "rendering",
1930
+ progress: 80,
1931
+ message: `Rendering ${L.length} SVG elements...`
1932
+ }), await wi(L, y, (_, W) => {
1933
+ const te = 80 + Math.round(_ / W * 10);
1934
+ n?.({
1935
+ phase: "rendering",
1936
+ progress: te,
1937
+ message: `Rendering SVG (${_}/${W})...`
1938
+ });
1939
+ }), await qe(), n?.({
1940
+ phase: "rendering",
1941
+ progress: 90,
1942
+ message: "Rendering text content..."
1943
+ }), await ki(T, y, (_, W) => {
1944
+ const te = 90 + Math.round(_ / W * 5);
1945
+ n?.({
1946
+ phase: "rendering",
1947
+ progress: te,
1948
+ message: `Rendering text (${_}/${W})...`
1949
+ });
1950
+ }), await qe(), n?.({
1951
+ phase: "exporting",
1952
+ progress: 95,
1953
+ message: "Exporting canvas to image..."
1954
+ });
1955
+ const Y = k.toDataURL("image/png", l);
1956
+ return n?.({
1957
+ phase: "exporting",
1958
+ progress: 100,
1959
+ message: "Capture complete"
1960
+ }), console.log("[Canvas] Capture successful"), Y;
1961
+ } catch (a) {
1962
+ return console.error("[Canvas] Capture failed:", a), null;
1963
+ } finally {
1964
+ ti(i);
1965
+ }
1966
+ }
1967
+ function Ti(e, t) {
1968
+ return e[13] = 1, e[14] = t >> 8, e[15] = t & 255, e[16] = t >> 8, e[17] = t & 255, e;
1969
+ }
1970
+ const ln = 112, cn = 72, dn = 89, un = 115;
1971
+ let ht;
1972
+ function Ii() {
1973
+ const e = new Int32Array(256);
1974
+ for (let t = 0; t < 256; t++) {
1975
+ let n = t;
1976
+ for (let i = 0; i < 8; i++)
1977
+ n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
1978
+ e[t] = n;
1860
1979
  }
1861
1980
  return e;
1862
1981
  }
1863
- function bn(e, { preferredFontFormat: t }) {
1864
- return t ? e.replace(hn, (i) => {
1865
- for (; ; ) {
1866
- const [n, , o] = un.exec(i) || [];
1867
- if (!o)
1868
- return "";
1869
- if (o === t)
1870
- return `src: ${n};`;
1871
- }
1872
- }) : e;
1982
+ function Ai(e) {
1983
+ let t = -1;
1984
+ ht || (ht = Ii());
1985
+ for (let n = 0; n < e.length; n++)
1986
+ t = ht[(t ^ e[n]) & 255] ^ t >>> 8;
1987
+ return t ^ -1;
1988
+ }
1989
+ function Ri(e) {
1990
+ const t = e.length - 1;
1991
+ for (let n = t; n >= 4; n--)
1992
+ if (e[n - 4] === 9 && e[n - 3] === ln && e[n - 2] === cn && e[n - 1] === dn && e[n] === un)
1993
+ return n - 3;
1994
+ return 0;
1995
+ }
1996
+ function Ni(e, t, n = !1) {
1997
+ const i = new Uint8Array(13);
1998
+ t *= 39.3701, i[0] = ln, i[1] = cn, i[2] = dn, i[3] = un, i[4] = t >>> 24, i[5] = t >>> 16, i[6] = t >>> 8, i[7] = t & 255, i[8] = i[4], i[9] = i[5], i[10] = i[6], i[11] = i[7], i[12] = 1;
1999
+ const a = Ai(i), o = new Uint8Array(4);
2000
+ if (o[0] = a >>> 24, o[1] = a >>> 16, o[2] = a >>> 8, o[3] = a & 255, n) {
2001
+ const r = Ri(e);
2002
+ return e.set(i, r), e.set(o, r + 13), e;
2003
+ } else {
2004
+ const r = new Uint8Array(4);
2005
+ r[0] = 0, r[1] = 0, r[2] = 0, r[3] = 9;
2006
+ const s = new Uint8Array(54);
2007
+ return s.set(e, 0), s.set(r, 33), s.set(i, 37), s.set(o, 50), s;
2008
+ }
1873
2009
  }
1874
- function oi(e) {
1875
- return e.search(ri) !== -1;
2010
+ const Mi = "AAlwSFlz", Oi = "AAAJcEhZ", Di = "AAAACXBI";
2011
+ function Fi(e) {
2012
+ let t = e.indexOf(Mi);
2013
+ return t === -1 && (t = e.indexOf(Oi)), t === -1 && (t = e.indexOf(Di)), t;
1876
2014
  }
1877
- async function si(e, t, i) {
1878
- if (!oi(e))
2015
+ const fn = "[modern-screenshot]", oe = typeof window < "u", _i = oe && "Worker" in window, Li = oe && "atob" in window, Ui = oe && "btoa" in window, Ct = oe ? window.navigator?.userAgent : "", hn = Ct.includes("Chrome"), Ye = Ct.includes("AppleWebKit") && !hn, kt = Ct.includes("Firefox"), zi = (e) => e && "__CONTEXT__" in e, Bi = (e) => e.constructor.name === "CSSFontFaceRule", Pi = (e) => e.constructor.name === "CSSImportRule", X = (e) => e.nodeType === 1, _e = (e) => typeof e.className == "object", gn = (e) => e.tagName === "image", Hi = (e) => e.tagName === "use", Me = (e) => X(e) && typeof e.style < "u" && !_e(e), $i = (e) => e.nodeType === 8, Wi = (e) => e.nodeType === 3, ve = (e) => e.tagName === "IMG", Ke = (e) => e.tagName === "VIDEO", qi = (e) => e.tagName === "CANVAS", Vi = (e) => e.tagName === "TEXTAREA", ji = (e) => e.tagName === "INPUT", Gi = (e) => e.tagName === "STYLE", Xi = (e) => e.tagName === "SCRIPT", Yi = (e) => e.tagName === "SELECT", Ji = (e) => e.tagName === "SLOT", Qi = (e) => e.tagName === "IFRAME", Ki = (...e) => console.warn(fn, ...e);
2016
+ function Zi(e) {
2017
+ const t = e?.createElement?.("canvas");
2018
+ return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
2019
+ }
2020
+ const yt = (e) => e.startsWith("data:");
2021
+ function pn(e, t) {
2022
+ if (e.match(/^[a-z]+:\/\//i))
1879
2023
  return e;
1880
- const n = bn(e, i);
1881
- return pn(n).reduce((s, r) => s.then((h) => gn(h, r, t, i)), Promise.resolve(n));
1882
- }
1883
- async function fe(e, t, i) {
1884
- var n;
1885
- const o = (n = t.style) === null || n === void 0 ? void 0 : n.getPropertyValue(e);
1886
- if (o) {
1887
- const s = await si(o, null, i);
1888
- return t.style.setProperty(e, s, t.style.getPropertyPriority(e)), !0;
1889
- }
1890
- return !1;
2024
+ if (oe && e.match(/^\/\//))
2025
+ return window.location.protocol + e;
2026
+ if (e.match(/^[a-z]+:/i) || !oe)
2027
+ return e;
2028
+ const n = Ze().implementation.createHTMLDocument(), i = n.createElement("base"), a = n.createElement("a");
2029
+ return n.head.appendChild(i), n.body.appendChild(a), t && (i.href = t), a.href = e, a.href;
1891
2030
  }
1892
- async function wn(e, t) {
1893
- await fe("background", e, t) || await fe("background-image", e, t), await fe("mask", e, t) || await fe("-webkit-mask", e, t) || await fe("mask-image", e, t) || await fe("-webkit-mask-image", e, t);
2031
+ function Ze(e) {
2032
+ return (e && X(e) ? e?.ownerDocument : e) ?? window.document;
1894
2033
  }
1895
- async function mn(e, t) {
1896
- const i = _(e, HTMLImageElement);
1897
- if (!(i && !ct(e.src)) && !(_(e, SVGImageElement) && !ct(e.href.baseVal)))
1898
- return;
1899
- const n = i ? e.src : e.href.baseVal, o = await pt(n, ft(n), t);
1900
- await new Promise((s, r) => {
1901
- const f = [new Promise((m) => {
1902
- e.onload = m;
1903
- })];
1904
- e.onerror = t.onImageErrorHandler ? (...m) => {
1905
- try {
1906
- s(t.onImageErrorHandler(...m));
1907
- } catch (k) {
1908
- r(k);
1909
- }
1910
- } : r;
1911
- const b = e;
1912
- b.loading === "lazy" && (b.loading = "eager"), i ? (e.srcset = "", e.src = o) : e.href.baseVal = o, b.decode && f.push(b.decode().catch()), Promise.all(f).then(s);
1913
- });
2034
+ const et = "http://www.w3.org/2000/svg";
2035
+ function er(e, t, n) {
2036
+ const i = Ze(n).createElementNS(et, "svg");
2037
+ return i.setAttributeNS(null, "width", e.toString()), i.setAttributeNS(null, "height", t.toString()), i.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), i;
1914
2038
  }
1915
- async function yn(e, t) {
1916
- const n = J(e.childNodes).map((o) => ai(o, t));
1917
- await Promise.all(n).then(() => e);
2039
+ function tr(e, t) {
2040
+ let n = new XMLSerializer().serializeToString(e);
2041
+ return t && (n = n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
1918
2042
  }
1919
- async function ai(e, t) {
1920
- _(e, Element) && (await wn(e, t), await mn(e, t), await yn(e, t));
1921
- }
1922
- function xn(e, t) {
1923
- const { style: i } = e;
1924
- t.backgroundColor && (i.backgroundColor = t.backgroundColor), t.width && (i.width = `${t.width}px`), t.height && (i.height = `${t.height}px`);
1925
- const n = t.style;
1926
- return n != null && Object.keys(n).forEach((o) => {
1927
- i[o] = n[o];
1928
- }), e;
1929
- }
1930
- const Wt = {};
1931
- async function Vt(e) {
1932
- let t = Wt[e];
1933
- if (t != null)
1934
- return t;
1935
- const n = await (await fetch(e)).text();
1936
- return t = { url: e, cssText: n }, Wt[e] = t, t;
1937
- }
1938
- async function jt(e, t) {
1939
- let i = e.cssText;
1940
- const n = /url\(["']?([^"')]+)["']?\)/g, s = (i.match(/url\([^)]+\)/g) || []).map(async (r) => {
1941
- let h = r.replace(n, "$1");
1942
- return h.startsWith("https://") || (h = new URL(h, e.url).href), ii(h, t.fetchRequestInit, ({ result: f }) => (i = i.replace(r, `url(${f})`), [r, f]));
2043
+ function nr(e, t) {
2044
+ return new Promise((n, i) => {
2045
+ const a = new FileReader();
2046
+ a.onload = () => n(a.result), a.onerror = () => i(a.error), a.onabort = () => i(new Error(`Failed read blob to ${t}`)), a.readAsDataURL(e);
1943
2047
  });
1944
- return Promise.all(s).then(() => i);
1945
- }
1946
- function Nt(e) {
1947
- if (e == null)
1948
- return [];
1949
- const t = [], i = /(\/\*[\s\S]*?\*\/)/gi;
1950
- let n = e.replace(i, "");
1951
- const o = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
1952
- for (; ; ) {
1953
- const f = o.exec(n);
1954
- if (f === null)
1955
- break;
1956
- t.push(f[0]);
1957
- }
1958
- n = n.replace(o, "");
1959
- const s = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, r = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", h = new RegExp(r, "gi");
1960
- for (; ; ) {
1961
- let f = s.exec(n);
1962
- if (f === null) {
1963
- if (f = h.exec(n), f === null)
1964
- break;
1965
- s.lastIndex = h.lastIndex;
1966
- } else
1967
- h.lastIndex = s.lastIndex;
1968
- t.push(f[0]);
1969
- }
1970
- return t;
1971
2048
  }
1972
- async function vn(e, t) {
1973
- const i = [], n = [];
1974
- return e.forEach((o) => {
1975
- if ("cssRules" in o)
1976
- try {
1977
- J(o.cssRules || []).forEach((s, r) => {
1978
- if (s.type === CSSRule.IMPORT_RULE) {
1979
- let h = r + 1;
1980
- const f = s.href, b = Vt(f).then((m) => jt(m, t)).then((m) => Nt(m).forEach((k) => {
1981
- try {
1982
- o.insertRule(k, k.startsWith("@import") ? h += 1 : o.cssRules.length);
1983
- } catch (R) {
1984
- console.error("Error inserting rule from remote css", {
1985
- rule: k,
1986
- error: R
1987
- });
1988
- }
1989
- })).catch((m) => {
1990
- console.error("Error loading remote css", m.toString());
1991
- });
1992
- n.push(b);
2049
+ const ir = (e) => nr(e, "dataUrl");
2050
+ function me(e, t) {
2051
+ const n = Ze(t).createElement("img");
2052
+ return n.decoding = "sync", n.loading = "eager", n.src = e, n;
2053
+ }
2054
+ function Oe(e, t) {
2055
+ return new Promise((n) => {
2056
+ const { timeout: i, ownerDocument: a, onError: o, onWarn: r } = t ?? {}, s = typeof e == "string" ? me(e, Ze(a)) : e;
2057
+ let d = null, p = null;
2058
+ function l() {
2059
+ n(s), d && clearTimeout(d), p?.();
2060
+ }
2061
+ if (i && (d = setTimeout(l, i)), Ke(s)) {
2062
+ const m = s.currentSrc || s.src;
2063
+ if (!m)
2064
+ return s.poster ? Oe(s.poster, t).then(n) : l();
2065
+ if (s.readyState >= 2)
2066
+ return l();
2067
+ const b = l, v = (S) => {
2068
+ r?.(
2069
+ "Failed video load",
2070
+ m,
2071
+ S
2072
+ ), o?.(S), l();
2073
+ };
2074
+ p = () => {
2075
+ s.removeEventListener("loadeddata", b), s.removeEventListener("error", v);
2076
+ }, s.addEventListener("loadeddata", b, { once: !0 }), s.addEventListener("error", v, { once: !0 });
2077
+ } else {
2078
+ const m = gn(s) ? s.href.baseVal : s.currentSrc || s.src;
2079
+ if (!m)
2080
+ return l();
2081
+ const b = async () => {
2082
+ if (ve(s) && "decode" in s)
2083
+ try {
2084
+ await s.decode();
2085
+ } catch (S) {
2086
+ r?.(
2087
+ "Failed to decode image, trying to render anyway",
2088
+ s.dataset.originalSrc || m,
2089
+ S
2090
+ );
1993
2091
  }
1994
- });
1995
- } catch (s) {
1996
- const r = e.find((h) => h.href == null) || document.styleSheets[0];
1997
- o.href != null && n.push(Vt(o.href).then((h) => jt(h, t)).then((h) => Nt(h).forEach((f) => {
1998
- r.insertRule(f, r.cssRules.length);
1999
- })).catch((h) => {
2000
- console.error("Error loading remote stylesheet", h);
2001
- })), console.error("Error inlining remote css file", s);
2002
- }
2003
- }), Promise.all(n).then(() => (e.forEach((o) => {
2004
- if ("cssRules" in o)
2092
+ l();
2093
+ }, v = (S) => {
2094
+ r?.(
2095
+ "Failed image load",
2096
+ s.dataset.originalSrc || m,
2097
+ S
2098
+ ), l();
2099
+ };
2100
+ if (ve(s) && s.complete)
2101
+ return b();
2102
+ p = () => {
2103
+ s.removeEventListener("load", b), s.removeEventListener("error", v);
2104
+ }, s.addEventListener("load", b, { once: !0 }), s.addEventListener("error", v, { once: !0 });
2105
+ }
2106
+ });
2107
+ }
2108
+ async function rr(e, t) {
2109
+ Me(e) && (ve(e) || Ke(e) ? await Oe(e, t) : await Promise.all(
2110
+ ["img", "video"].flatMap((n) => Array.from(e.querySelectorAll(n)).map((i) => Oe(i, t)))
2111
+ ));
2112
+ }
2113
+ const mn = /* @__PURE__ */ (function() {
2114
+ let t = 0;
2115
+ const n = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
2116
+ return () => (t += 1, `u${n()}${t}`);
2117
+ })();
2118
+ function wn(e) {
2119
+ return e?.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
2120
+ }
2121
+ let Xt = 0;
2122
+ function or(e) {
2123
+ const t = `${fn}[#${Xt}]`;
2124
+ return Xt++, {
2125
+ // eslint-disable-next-line no-console
2126
+ time: (n) => e && console.time(`${t} ${n}`),
2127
+ // eslint-disable-next-line no-console
2128
+ timeEnd: (n) => e && console.timeEnd(`${t} ${n}`),
2129
+ warn: (...n) => e && Ki(...n)
2130
+ };
2131
+ }
2132
+ function sr(e) {
2133
+ return {
2134
+ cache: e ? "no-cache" : "force-cache"
2135
+ };
2136
+ }
2137
+ async function tt(e, t) {
2138
+ return zi(e) ? e : ar(e, { ...t, autoDestruct: !0 });
2139
+ }
2140
+ async function ar(e, t) {
2141
+ const { scale: n = 1, workerUrl: i, workerNumber: a = 1 } = t || {}, o = !!t?.debug, r = t?.features ?? !0, s = e.ownerDocument ?? (oe ? window.document : void 0), d = e.ownerDocument?.defaultView ?? (oe ? window : void 0), p = /* @__PURE__ */ new Map(), l = {
2142
+ // Options
2143
+ width: 0,
2144
+ height: 0,
2145
+ quality: 1,
2146
+ type: "image/png",
2147
+ scale: n,
2148
+ backgroundColor: null,
2149
+ style: null,
2150
+ filter: null,
2151
+ maximumCanvasSize: 0,
2152
+ timeout: 3e4,
2153
+ progress: null,
2154
+ debug: o,
2155
+ fetch: {
2156
+ requestInit: sr(t?.fetch?.bypassingCache),
2157
+ placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
2158
+ bypassingCache: !1,
2159
+ ...t?.fetch
2160
+ },
2161
+ fetchFn: null,
2162
+ font: {},
2163
+ drawImageInterval: 100,
2164
+ workerUrl: null,
2165
+ workerNumber: a,
2166
+ onCloneEachNode: null,
2167
+ onCloneNode: null,
2168
+ onEmbedNode: null,
2169
+ onCreateForeignObjectSvg: null,
2170
+ includeStyleProperties: null,
2171
+ autoDestruct: !1,
2172
+ ...t,
2173
+ // InternalContext
2174
+ __CONTEXT__: !0,
2175
+ log: or(o),
2176
+ node: e,
2177
+ ownerDocument: s,
2178
+ ownerWindow: d,
2179
+ dpi: n === 1 ? null : 96 * n,
2180
+ svgStyleElement: bn(s),
2181
+ svgDefsElement: s?.createElementNS(et, "defs"),
2182
+ svgStyles: /* @__PURE__ */ new Map(),
2183
+ defaultComputedStyles: /* @__PURE__ */ new Map(),
2184
+ workers: [
2185
+ ...Array.from({
2186
+ length: _i && i && a ? a : 0
2187
+ })
2188
+ ].map(() => {
2005
2189
  try {
2006
- J(o.cssRules || []).forEach((s) => {
2007
- i.push(s);
2008
- });
2009
- } catch (s) {
2010
- console.error(`Error while reading CSS rules from ${o.href}`, s);
2190
+ const v = new Worker(i);
2191
+ return v.onmessage = async (S) => {
2192
+ const { url: w, result: k } = S.data;
2193
+ k ? p.get(w)?.resolve?.(k) : p.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`));
2194
+ }, v.onmessageerror = (S) => {
2195
+ const { url: w } = S.data;
2196
+ p.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`));
2197
+ }, v;
2198
+ } catch (v) {
2199
+ return l.log.warn("Failed to new Worker", v), null;
2011
2200
  }
2012
- }), i));
2201
+ }).filter(Boolean),
2202
+ fontFamilies: /* @__PURE__ */ new Map(),
2203
+ fontCssTexts: /* @__PURE__ */ new Map(),
2204
+ acceptOfImage: `${[
2205
+ Zi(s) && "image/webp",
2206
+ "image/svg+xml",
2207
+ "image/*",
2208
+ "*/*"
2209
+ ].filter(Boolean).join(",")};q=0.8`,
2210
+ requests: p,
2211
+ drawImageCount: 0,
2212
+ tasks: [],
2213
+ features: r,
2214
+ isEnable: (v) => v === "restoreScrollPosition" ? typeof r == "boolean" ? !1 : r[v] ?? !1 : typeof r == "boolean" ? r : r[v] ?? !0,
2215
+ shadowRoots: []
2216
+ };
2217
+ l.log.time("wait until load"), await rr(e, { timeout: l.timeout, onWarn: l.log.warn }), l.log.timeEnd("wait until load");
2218
+ const { width: m, height: b } = lr(e, l);
2219
+ return l.width = m, l.height = b, l;
2220
+ }
2221
+ function bn(e) {
2222
+ if (!e)
2223
+ return;
2224
+ const t = e.createElement("style"), n = t.ownerDocument.createTextNode(`
2225
+ .______background-clip--text {
2226
+ background-clip: text;
2227
+ -webkit-background-clip: text;
2228
+ }
2229
+ `);
2230
+ return t.appendChild(n), t;
2013
2231
  }
2014
- function kn(e) {
2015
- return e.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => oi(t.style.getPropertyValue("src")));
2232
+ function lr(e, t) {
2233
+ let { width: n, height: i } = t;
2234
+ if (X(e) && (!n || !i)) {
2235
+ const a = e.getBoundingClientRect();
2236
+ n = n || a.width || Number(e.getAttribute("width")) || 0, i = i || a.height || Number(e.getAttribute("height")) || 0;
2237
+ }
2238
+ return { width: n, height: i };
2239
+ }
2240
+ async function cr(e, t) {
2241
+ const {
2242
+ log: n,
2243
+ timeout: i,
2244
+ drawImageCount: a,
2245
+ drawImageInterval: o
2246
+ } = t;
2247
+ n.time("image to canvas");
2248
+ const r = await Oe(e, { timeout: i, onWarn: t.log.warn }), { canvas: s, context2d: d } = dr(e.ownerDocument, t), p = () => {
2249
+ try {
2250
+ d?.drawImage(r, 0, 0, s.width, s.height);
2251
+ } catch (l) {
2252
+ t.log.warn("Failed to drawImage", l);
2253
+ }
2254
+ };
2255
+ if (p(), t.isEnable("fixSvgXmlDecode"))
2256
+ for (let l = 0; l < a; l++)
2257
+ await new Promise((m) => {
2258
+ setTimeout(() => {
2259
+ d?.clearRect(0, 0, s.width, s.height), p(), m();
2260
+ }, l + o);
2261
+ });
2262
+ return t.drawImageCount = 0, n.timeEnd("image to canvas"), s;
2016
2263
  }
2017
- async function Sn(e, t) {
2018
- if (e.ownerDocument == null)
2019
- throw new Error("Provided element is not within a Document");
2020
- const i = J(e.ownerDocument.styleSheets), n = await vn(i, t);
2021
- return kn(n);
2264
+ function dr(e, t) {
2265
+ const { width: n, height: i, scale: a, backgroundColor: o, maximumCanvasSize: r } = t, s = e.createElement("canvas");
2266
+ s.width = Math.floor(n * a), s.height = Math.floor(i * a), s.style.width = `${n}px`, s.style.height = `${i}px`, r && (s.width > r || s.height > r) && (s.width > r && s.height > r ? s.width > s.height ? (s.height *= r / s.width, s.width = r) : (s.width *= r / s.height, s.height = r) : s.width > r ? (s.height *= r / s.width, s.width = r) : (s.width *= r / s.height, s.height = r));
2267
+ const d = s.getContext("2d");
2268
+ return d && o && (d.fillStyle = o, d.fillRect(0, 0, s.width, s.height)), { canvas: s, context2d: d };
2022
2269
  }
2023
- function li(e) {
2024
- return e.trim().replace(/["']/g, "");
2270
+ function yn(e, t) {
2271
+ if (e.ownerDocument)
2272
+ try {
2273
+ const o = e.toDataURL();
2274
+ if (o !== "data:,")
2275
+ return me(o, e.ownerDocument);
2276
+ } catch (o) {
2277
+ t.log.warn("Failed to clone canvas", o);
2278
+ }
2279
+ const n = e.cloneNode(!1), i = e.getContext("2d"), a = n.getContext("2d");
2280
+ try {
2281
+ return i && a && a.putImageData(
2282
+ i.getImageData(0, 0, e.width, e.height),
2283
+ 0,
2284
+ 0
2285
+ ), n;
2286
+ } catch (o) {
2287
+ t.log.warn("Failed to clone canvas", o);
2288
+ }
2289
+ return n;
2025
2290
  }
2026
- function Cn(e) {
2027
- const t = /* @__PURE__ */ new Set();
2028
- function i(n) {
2029
- (n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((s) => {
2030
- t.add(li(s));
2031
- }), Array.from(n.children).forEach((s) => {
2032
- s instanceof HTMLElement && i(s);
2033
- });
2291
+ function ur(e, t) {
2292
+ try {
2293
+ if (e?.contentDocument?.body)
2294
+ return Et(e.contentDocument.body, t);
2295
+ } catch (n) {
2296
+ t.log.warn("Failed to clone iframe", n);
2034
2297
  }
2035
- return i(e), t;
2036
- }
2037
- async function En(e, t) {
2038
- const i = await Sn(e, t), n = Cn(e);
2039
- return (await Promise.all(i.filter((s) => n.has(li(s.style.fontFamily))).map((s) => {
2040
- const r = s.parentStyleSheet ? s.parentStyleSheet.href : null;
2041
- return si(s.cssText, r, t);
2042
- }))).join(`
2043
- `);
2298
+ return e.cloneNode(!1);
2299
+ }
2300
+ function fr(e) {
2301
+ const t = e.cloneNode(!1);
2302
+ return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
2044
2303
  }
2045
- async function In(e, t) {
2046
- const i = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await En(e, t);
2304
+ async function hr(e, t) {
2305
+ if (e.ownerDocument && !e.currentSrc && e.poster)
2306
+ return me(e.poster, e.ownerDocument);
2307
+ const n = e.cloneNode(!1);
2308
+ n.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (n.src = e.currentSrc);
2309
+ const i = n.ownerDocument;
2047
2310
  if (i) {
2048
- const n = document.createElement("style"), o = document.createTextNode(i);
2049
- n.appendChild(o), e.firstChild ? e.insertBefore(n, e.firstChild) : e.appendChild(n);
2311
+ let a = !0;
2312
+ if (await Oe(n, { onError: () => a = !1, onWarn: t.log.warn }), !a)
2313
+ return e.poster ? me(e.poster, e.ownerDocument) : n;
2314
+ n.currentTime = e.currentTime, await new Promise((r) => {
2315
+ n.addEventListener("seeked", r, { once: !0 });
2316
+ });
2317
+ const o = i.createElement("canvas");
2318
+ o.width = e.offsetWidth, o.height = e.offsetHeight;
2319
+ try {
2320
+ const r = o.getContext("2d");
2321
+ r && r.drawImage(n, 0, 0, o.width, o.height);
2322
+ } catch (r) {
2323
+ return t.log.warn("Failed to clone video", r), e.poster ? me(e.poster, e.ownerDocument) : n;
2324
+ }
2325
+ return yn(o, t);
2050
2326
  }
2327
+ return n;
2051
2328
  }
2052
- async function Tn(e, t = {}) {
2053
- const { width: i, height: n } = ti(e, t), o = await je(e, t, !0);
2054
- return await In(o, t), await ai(o, t), xn(o, t), await Vi(o, i, n);
2329
+ function gr(e, t) {
2330
+ return qi(e) ? yn(e, t) : Qi(e) ? ur(e, t) : ve(e) ? fr(e) : Ke(e) ? hr(e, t) : e.cloneNode(!1);
2055
2331
  }
2056
- async function Rn(e, t = {}) {
2057
- const { width: i, height: n } = ti(e, t), o = await Tn(e, t), s = await Be(o), r = document.createElement("canvas"), h = r.getContext("2d"), f = t.pixelRatio || $i(), b = t.canvasWidth || i, m = t.canvasHeight || n;
2058
- return r.width = b * f, r.height = m * f, t.skipAutoScale || Bi(r), r.style.width = `${b}`, r.style.height = `${m}`, t.backgroundColor && (h.fillStyle = t.backgroundColor, h.fillRect(0, 0, r.width, r.height)), h.drawImage(s, 0, 0, r.width, r.height), r;
2332
+ function pr(e) {
2333
+ let t = e.sandbox;
2334
+ if (!t) {
2335
+ const { ownerDocument: n } = e;
2336
+ try {
2337
+ n && (t = n.createElement("iframe"), t.id = `__SANDBOX__${mn()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", n.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
2338
+ } catch (i) {
2339
+ e.log.warn("Failed to getSandBox", i);
2340
+ }
2341
+ }
2342
+ return t;
2059
2343
  }
2060
- async function Mn(e, t = {}) {
2061
- return (await Rn(e, t)).toDataURL();
2344
+ const mr = [
2345
+ "width",
2346
+ "height",
2347
+ "-webkit-text-fill-color"
2348
+ ], wr = [
2349
+ "stroke",
2350
+ "fill"
2351
+ ];
2352
+ function xn(e, t, n) {
2353
+ const { defaultComputedStyles: i } = n, a = e.nodeName.toLowerCase(), o = _e(e) && a !== "svg", r = o ? wr.map((w) => [w, e.getAttribute(w)]).filter(([, w]) => w !== null) : [], s = [
2354
+ o && "svg",
2355
+ a,
2356
+ r.map((w, k) => `${w}=${k}`).join(","),
2357
+ t
2358
+ ].filter(Boolean).join(":");
2359
+ if (i.has(s))
2360
+ return i.get(s);
2361
+ const p = pr(n)?.contentWindow;
2362
+ if (!p)
2363
+ return /* @__PURE__ */ new Map();
2364
+ const l = p?.document;
2365
+ let m, b;
2366
+ o ? (m = l.createElementNS(et, "svg"), b = m.ownerDocument.createElementNS(m.namespaceURI, a), r.forEach(([w, k]) => {
2367
+ b.setAttributeNS(null, w, k);
2368
+ }), m.appendChild(b)) : m = b = l.createElement(a), b.textContent = " ", l.body.appendChild(m);
2369
+ const v = p.getComputedStyle(b, t), S = /* @__PURE__ */ new Map();
2370
+ for (let w = v.length, k = 0; k < w; k++) {
2371
+ const y = v.item(k);
2372
+ mr.includes(y) || S.set(y, v.getPropertyValue(y));
2373
+ }
2374
+ return l.body.removeChild(m), i.set(s, S), S;
2062
2375
  }
2063
- const On = async (e) => {
2064
- let i = 0;
2065
- const { os: n } = Jt(), o = n === "iOS";
2066
- for (; i < 1; )
2376
+ function vn(e, t, n) {
2377
+ const i = /* @__PURE__ */ new Map(), a = [], o = /* @__PURE__ */ new Map();
2378
+ if (n)
2379
+ for (const s of n)
2380
+ r(s);
2381
+ else
2382
+ for (let s = e.length, d = 0; d < s; d++) {
2383
+ const p = e.item(d);
2384
+ r(p);
2385
+ }
2386
+ for (let s = a.length, d = 0; d < s; d++)
2387
+ o.get(a[d])?.forEach((p, l) => i.set(l, p));
2388
+ function r(s) {
2389
+ const d = e.getPropertyValue(s), p = e.getPropertyPriority(s), l = s.lastIndexOf("-"), m = l > -1 ? s.substring(0, l) : void 0;
2390
+ if (m) {
2391
+ let b = o.get(m);
2392
+ b || (b = /* @__PURE__ */ new Map(), o.set(m, b)), b.set(s, [d, p]);
2393
+ }
2394
+ t.get(s) === d && !p || (m ? a.push(m) : i.set(s, [d, p]));
2395
+ }
2396
+ return i;
2397
+ }
2398
+ function br(e, t, n, i) {
2399
+ const { ownerWindow: a, includeStyleProperties: o, currentParentNodeStyle: r } = i, s = t.style, d = a.getComputedStyle(e), p = xn(e, null, i);
2400
+ r?.forEach((m, b) => {
2401
+ p.delete(b);
2402
+ });
2403
+ const l = vn(d, p, o);
2404
+ l.delete("transition-property"), l.delete("all"), l.delete("d"), l.delete("content"), n && (l.delete("margin-top"), l.delete("margin-right"), l.delete("margin-bottom"), l.delete("margin-left"), l.delete("margin-block-start"), l.delete("margin-block-end"), l.delete("margin-inline-start"), l.delete("margin-inline-end"), l.set("box-sizing", ["border-box", ""])), l.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text"), hn && (l.has("font-kerning") || l.set("font-kerning", ["normal", ""]), (l.get("overflow-x")?.[0] === "hidden" || l.get("overflow-y")?.[0] === "hidden") && l.get("text-overflow")?.[0] === "ellipsis" && e.scrollWidth === e.clientWidth && l.set("text-overflow", ["clip", ""]));
2405
+ for (let m = s.length, b = 0; b < m; b++)
2406
+ s.removeProperty(s.item(b));
2407
+ return l.forEach(([m, b], v) => {
2408
+ s.setProperty(v, m, b);
2409
+ }), l;
2410
+ }
2411
+ function yr(e, t) {
2412
+ (Vi(e) || ji(e) || Yi(e)) && t.setAttribute("value", e.value);
2413
+ }
2414
+ const xr = [
2415
+ "::before",
2416
+ "::after"
2417
+ // '::placeholder', TODO
2418
+ ], vr = [
2419
+ "::-webkit-scrollbar",
2420
+ "::-webkit-scrollbar-button",
2421
+ // '::-webkit-scrollbar:horizontal', TODO
2422
+ "::-webkit-scrollbar-thumb",
2423
+ "::-webkit-scrollbar-track",
2424
+ "::-webkit-scrollbar-track-piece",
2425
+ // '::-webkit-scrollbar:vertical', TODO
2426
+ "::-webkit-scrollbar-corner",
2427
+ "::-webkit-resizer"
2428
+ ];
2429
+ function Sr(e, t, n, i, a) {
2430
+ const { ownerWindow: o, svgStyleElement: r, svgStyles: s, currentNodeStyle: d } = i;
2431
+ if (!r || !o)
2432
+ return;
2433
+ function p(l) {
2434
+ const m = o.getComputedStyle(e, l);
2435
+ let b = m.getPropertyValue("content");
2436
+ if (!b || b === "none")
2437
+ return;
2438
+ a?.(b), b = b.replace(/(')|(")|(counter\(.+\))/g, "");
2439
+ const v = [mn()], S = xn(e, l, i);
2440
+ d?.forEach((T, M) => {
2441
+ S.delete(M);
2442
+ });
2443
+ const w = vn(m, S, i.includeStyleProperties);
2444
+ w.delete("content"), w.delete("-webkit-locale"), w.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text");
2445
+ const k = [
2446
+ `content: '${b}';`
2447
+ ];
2448
+ if (w.forEach(([T, M], L) => {
2449
+ k.push(`${L}: ${T}${M ? " !important" : ""};`);
2450
+ }), k.length === 1)
2451
+ return;
2067
2452
  try {
2068
- const s = document.documentElement, r = e ? e.x : 0, h = e ? e.y : 0, f = e ? e.width : window.innerWidth, b = e ? e.height : window.innerHeight, m = window.scrollX, k = window.scrollY, R = m + r, $ = k + h;
2069
- return i > 0 && await new Promise((S) => setTimeout(S, 500 * i)), await Mn(s, {
2070
- quality: 0.9,
2071
- pixelRatio: 1,
2072
- // Disable cacheBust always to prevent breaking signed URLs or static servers
2073
- cacheBust: !1,
2074
- skipAutoScale: !0,
2075
- width: f,
2076
- height: b,
2077
- canvasWidth: f,
2078
- canvasHeight: b,
2079
- // Disable font embedding on iOS to prevent Safari crashes
2080
- fontEmbedCSS: o || i > 0 ? "" : void 0,
2081
- style: {
2082
- // translate the content to bring the desired area into view (0,0) of the canvas
2083
- transform: `translate(${-R}px, ${-$}px)`
2084
- },
2085
- // Gray background with white user icon
2086
- imagePlaceholder: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjNmI3MjgwIi8+PHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTEyIDEyYzIuMjEgMCA0LTEuNzkgNC00cy0xLjc5LTQtNC00LTQgMS43OS00IDQgMS43OSA0IDQgNHptMCAyYy0yLjY3IDAtOCAxLjM0LTggNHYyaDE2di0yYzAtMi42Ni01LjMzLTQtOC00eiIvPjwvc3ZnPg==",
2087
- filter: (S) => {
2088
- if (S.nodeName === "IMG") {
2089
- const A = S;
2090
- if (!A.complete || A.naturalWidth === 0)
2091
- return !1;
2092
- try {
2093
- const M = window.getComputedStyle(A);
2094
- if (M.display === "none" || M.visibility === "hidden" || M.opacity === "0")
2095
- return !1;
2096
- } catch {
2097
- }
2098
- }
2099
- return !0;
2100
- },
2101
- fetchRequest: async (S, A) => {
2102
- const M = (z) => {
2103
- console.warn(`Screenshot: Failed to load/decode image ${S}, using placeholder.`, z);
2104
- const Q = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24"><rect width="24" height="24" fill="#6b7280"/><path fill="#ffffff" d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>', me = new Blob([Q], { type: "image/svg+xml" });
2105
- return new Response(me, {
2106
- status: 200,
2107
- statusText: "OK",
2108
- headers: new Headers({ "Content-Type": "image/svg+xml" })
2109
- });
2110
- };
2111
- try {
2112
- const z = await fetch(S, A);
2113
- if (!z.ok)
2114
- throw new Error(`Failed to fetch ${S}: ${z.status} ${z.statusText}`);
2115
- const Q = await z.blob();
2453
+ t.className = [t.className, ...v].join(" ");
2454
+ } catch (T) {
2455
+ i.log.warn("Failed to copyPseudoClass", T);
2456
+ return;
2457
+ }
2458
+ const y = k.join(`
2459
+ `);
2460
+ let I = s.get(y);
2461
+ I || (I = [], s.set(y, I)), I.push(`.${v[0]}${l}`);
2462
+ }
2463
+ xr.forEach(p), n && vr.forEach(p);
2464
+ }
2465
+ const Yt = /* @__PURE__ */ new Set([
2466
+ "symbol"
2467
+ // test/fixtures/svg.symbol.html
2468
+ ]);
2469
+ async function Jt(e, t, n, i, a) {
2470
+ if (X(n) && (Gi(n) || Xi(n)) || i.filter && !i.filter(n))
2471
+ return;
2472
+ Yt.has(t.nodeName) || Yt.has(n.nodeName) ? i.currentParentNodeStyle = void 0 : i.currentParentNodeStyle = i.currentNodeStyle;
2473
+ const o = await Et(n, i, !1, a);
2474
+ i.isEnable("restoreScrollPosition") && Cr(e, o), t.appendChild(o);
2475
+ }
2476
+ async function Qt(e, t, n, i) {
2477
+ let a = e.firstChild;
2478
+ X(e) && e.shadowRoot && (a = e.shadowRoot?.firstChild, n.shadowRoots.push(e.shadowRoot));
2479
+ for (let o = a; o; o = o.nextSibling)
2480
+ if (!$i(o))
2481
+ if (X(o) && Ji(o) && typeof o.assignedNodes == "function") {
2482
+ const r = o.assignedNodes();
2483
+ for (let s = 0; s < r.length; s++)
2484
+ await Jt(e, t, r[s], n, i);
2485
+ } else
2486
+ await Jt(e, t, o, n, i);
2487
+ }
2488
+ function Cr(e, t) {
2489
+ if (!Me(e) || !Me(t))
2490
+ return;
2491
+ const { scrollTop: n, scrollLeft: i } = e;
2492
+ if (!n && !i)
2493
+ return;
2494
+ const { transform: a } = t.style, o = new DOMMatrix(a), { a: r, b: s, c: d, d: p } = o;
2495
+ o.a = 1, o.b = 0, o.c = 0, o.d = 1, o.translateSelf(-i, -n), o.a = r, o.b = s, o.c = d, o.d = p, t.style.transform = o.toString();
2496
+ }
2497
+ function kr(e, t) {
2498
+ const { backgroundColor: n, width: i, height: a, style: o } = t, r = e.style;
2499
+ if (n && r.setProperty("background-color", n, "important"), i && r.setProperty("width", `${i}px`, "important"), a && r.setProperty("height", `${a}px`, "important"), o)
2500
+ for (const s in o) r[s] = o[s];
2501
+ }
2502
+ const Er = /^[\w-:]+$/;
2503
+ async function Et(e, t, n = !1, i) {
2504
+ const { ownerDocument: a, ownerWindow: o, fontFamilies: r, onCloneEachNode: s } = t;
2505
+ if (a && Wi(e))
2506
+ return i && /\S/.test(e.data) && i(e.data), a.createTextNode(e.data);
2507
+ if (a && o && X(e) && (Me(e) || _e(e))) {
2508
+ const p = await gr(e, t);
2509
+ if (t.isEnable("removeAbnormalAttributes")) {
2510
+ const w = p.getAttributeNames();
2511
+ for (let k = w.length, y = 0; y < k; y++) {
2512
+ const I = w[y];
2513
+ Er.test(I) || p.removeAttribute(I);
2514
+ }
2515
+ }
2516
+ const l = t.currentNodeStyle = br(e, p, n, t);
2517
+ n && kr(p, t);
2518
+ let m = !1;
2519
+ if (t.isEnable("copyScrollbar")) {
2520
+ const w = [
2521
+ l.get("overflow-x")?.[0],
2522
+ l.get("overflow-y")?.[0]
2523
+ ];
2524
+ m = w.includes("scroll") || (w.includes("auto") || w.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
2525
+ }
2526
+ const b = l.get("text-transform")?.[0], v = wn(l.get("font-family")?.[0]), S = v ? (w) => {
2527
+ b === "uppercase" ? w = w.toUpperCase() : b === "lowercase" ? w = w.toLowerCase() : b === "capitalize" && (w = w[0].toUpperCase() + w.substring(1)), v.forEach((k) => {
2528
+ let y = r.get(k);
2529
+ y || r.set(k, y = /* @__PURE__ */ new Set()), w.split("").forEach((I) => y.add(I));
2530
+ });
2531
+ } : void 0;
2532
+ return Sr(
2533
+ e,
2534
+ p,
2535
+ m,
2536
+ t,
2537
+ S
2538
+ ), yr(e, p), Ke(e) || await Qt(
2539
+ e,
2540
+ p,
2541
+ t,
2542
+ S
2543
+ ), await s?.(p), p;
2544
+ }
2545
+ const d = e.cloneNode(!1);
2546
+ return await Qt(e, d, t), await s?.(d), d;
2547
+ }
2548
+ function Tr(e) {
2549
+ if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
2550
+ try {
2551
+ e.sandbox.remove();
2552
+ } catch (t) {
2553
+ e.log.warn("Failed to destroyContext", t);
2554
+ }
2555
+ e.sandbox = void 0;
2556
+ }
2557
+ e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
2558
+ }
2559
+ function Ir(e) {
2560
+ const { url: t, timeout: n, responseType: i, ...a } = e, o = new AbortController(), r = n ? setTimeout(() => o.abort(), n) : void 0;
2561
+ return fetch(t, { signal: o.signal, ...a }).then((s) => {
2562
+ if (!s.ok)
2563
+ throw new Error("Failed fetch, not 2xx response", { cause: s });
2564
+ switch (i) {
2565
+ case "arrayBuffer":
2566
+ return s.arrayBuffer();
2567
+ case "dataUrl":
2568
+ return s.blob().then(ir);
2569
+ default:
2570
+ return s.text();
2571
+ }
2572
+ }).finally(() => clearTimeout(r));
2573
+ }
2574
+ function De(e, t) {
2575
+ const { url: n, requestType: i = "text", responseType: a = "text", imageDom: o } = t;
2576
+ let r = n;
2577
+ const {
2578
+ timeout: s,
2579
+ acceptOfImage: d,
2580
+ requests: p,
2581
+ fetchFn: l,
2582
+ fetch: {
2583
+ requestInit: m,
2584
+ bypassingCache: b,
2585
+ placeholderImage: v
2586
+ },
2587
+ font: S,
2588
+ workers: w,
2589
+ fontFamilies: k
2590
+ } = e;
2591
+ i === "image" && (Ye || kt) && e.drawImageCount++;
2592
+ let y = p.get(n);
2593
+ if (!y) {
2594
+ b && b instanceof RegExp && b.test(r) && (r += (/\?/.test(r) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
2595
+ const I = i.startsWith("font") && S && S.minify, T = /* @__PURE__ */ new Set();
2596
+ I && i.split(";")[1].split(",").forEach((Y) => {
2597
+ k.has(Y) && k.get(Y).forEach((_) => T.add(_));
2598
+ });
2599
+ const M = I && T.size, L = {
2600
+ url: r,
2601
+ timeout: s,
2602
+ responseType: M ? "arrayBuffer" : a,
2603
+ headers: i === "image" ? { accept: d } : void 0,
2604
+ ...m
2605
+ };
2606
+ y = {
2607
+ type: i,
2608
+ resolve: void 0,
2609
+ reject: void 0,
2610
+ response: null
2611
+ }, y.response = (async () => {
2612
+ if (l && i === "image") {
2613
+ const H = await l(n);
2614
+ if (H)
2615
+ return H;
2616
+ }
2617
+ return !Ye && n.startsWith("http") && w.length ? new Promise((H, Y) => {
2618
+ w[p.size & w.length - 1].postMessage({ rawUrl: n, ...L }), y.resolve = H, y.reject = Y;
2619
+ }) : Ir(L);
2620
+ })().catch((H) => {
2621
+ if (p.delete(n), i === "image" && v)
2622
+ return e.log.warn("Failed to fetch image base64, trying to use placeholder image", r), typeof v == "string" ? v : v(o);
2623
+ throw H;
2624
+ }), p.set(n, y);
2625
+ }
2626
+ return y.response;
2627
+ }
2628
+ async function Sn(e, t, n, i) {
2629
+ if (!Cn(e))
2630
+ return e;
2631
+ for (const [a, o] of Ar(e, t))
2632
+ try {
2633
+ const r = await De(
2634
+ n,
2635
+ {
2636
+ url: o,
2637
+ requestType: i ? "image" : "text",
2638
+ responseType: "dataUrl"
2639
+ }
2640
+ );
2641
+ e = e.replace(Rr(a), `$1${r}$3`);
2642
+ } catch (r) {
2643
+ n.log.warn("Failed to fetch css data url", a, r);
2644
+ }
2645
+ return e;
2646
+ }
2647
+ function Cn(e) {
2648
+ return /url\((['"]?)([^'"]+?)\1\)/.test(e);
2649
+ }
2650
+ const kn = /url\((['"]?)([^'"]+?)\1\)/g;
2651
+ function Ar(e, t) {
2652
+ const n = [];
2653
+ return e.replace(kn, (i, a, o) => (n.push([o, pn(o, t)]), i)), n.filter(([i]) => !yt(i));
2654
+ }
2655
+ function Rr(e) {
2656
+ const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
2657
+ return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
2658
+ }
2659
+ const Nr = [
2660
+ "background-image",
2661
+ "border-image-source",
2662
+ "-webkit-border-image",
2663
+ "-webkit-mask-image",
2664
+ "list-style-image"
2665
+ ];
2666
+ function Mr(e, t) {
2667
+ return Nr.map((n) => {
2668
+ const i = e.getPropertyValue(n);
2669
+ return !i || i === "none" ? null : ((Ye || kt) && t.drawImageCount++, Sn(i, null, t, !0).then((a) => {
2670
+ !a || i === a || e.setProperty(
2671
+ n,
2672
+ a,
2673
+ e.getPropertyPriority(n)
2674
+ );
2675
+ }));
2676
+ }).filter(Boolean);
2677
+ }
2678
+ function Or(e, t) {
2679
+ if (ve(e)) {
2680
+ const n = e.currentSrc || e.src;
2681
+ if (!yt(n))
2682
+ return [
2683
+ De(t, {
2684
+ url: n,
2685
+ imageDom: e,
2686
+ requestType: "image",
2687
+ responseType: "dataUrl"
2688
+ }).then((i) => {
2689
+ i && (e.srcset = "", e.dataset.originalSrc = n, e.src = i || "");
2690
+ })
2691
+ ];
2692
+ (Ye || kt) && t.drawImageCount++;
2693
+ } else if (_e(e) && !yt(e.href.baseVal)) {
2694
+ const n = e.href.baseVal;
2695
+ return [
2696
+ De(t, {
2697
+ url: n,
2698
+ imageDom: e,
2699
+ requestType: "image",
2700
+ responseType: "dataUrl"
2701
+ }).then((i) => {
2702
+ i && (e.dataset.originalSrc = n, e.href.baseVal = i || "");
2703
+ })
2704
+ ];
2705
+ }
2706
+ return [];
2707
+ }
2708
+ function Dr(e, t) {
2709
+ const { ownerDocument: n, svgDefsElement: i } = t, a = e.getAttribute("href") ?? e.getAttribute("xlink:href");
2710
+ if (!a)
2711
+ return [];
2712
+ const [o, r] = a.split("#");
2713
+ if (r) {
2714
+ const s = `#${r}`, d = t.shadowRoots.reduce(
2715
+ (p, l) => p ?? l.querySelector(`svg ${s}`),
2716
+ n?.querySelector(`svg ${s}`)
2717
+ );
2718
+ if (o && e.setAttribute("href", s), i?.querySelector(s))
2719
+ return [];
2720
+ if (d)
2721
+ return i?.appendChild(d.cloneNode(!0)), [];
2722
+ if (o)
2723
+ return [
2724
+ De(t, {
2725
+ url: o,
2726
+ responseType: "text"
2727
+ }).then((p) => {
2728
+ i?.insertAdjacentHTML("beforeend", p);
2729
+ })
2730
+ ];
2731
+ }
2732
+ return [];
2733
+ }
2734
+ function En(e, t) {
2735
+ const { tasks: n } = t;
2736
+ X(e) && ((ve(e) || gn(e)) && n.push(...Or(e, t)), Hi(e) && n.push(...Dr(e, t))), Me(e) && n.push(...Mr(e.style, t)), e.childNodes.forEach((i) => {
2737
+ En(i, t);
2738
+ });
2739
+ }
2740
+ async function Fr(e, t) {
2741
+ const {
2742
+ ownerDocument: n,
2743
+ svgStyleElement: i,
2744
+ fontFamilies: a,
2745
+ fontCssTexts: o,
2746
+ tasks: r,
2747
+ font: s
2748
+ } = t;
2749
+ if (!(!n || !i || !a.size))
2750
+ if (s && s.cssText) {
2751
+ const d = Zt(s.cssText, t);
2752
+ i.appendChild(n.createTextNode(`${d}
2753
+ `));
2754
+ } else {
2755
+ const d = Array.from(n.styleSheets).filter((l) => {
2756
+ try {
2757
+ return "cssRules" in l && !!l.cssRules.length;
2758
+ } catch (m) {
2759
+ return t.log.warn(`Error while reading CSS rules from ${l.href}`, m), !1;
2760
+ }
2761
+ });
2762
+ await Promise.all(
2763
+ d.flatMap((l) => Array.from(l.cssRules).map(async (m, b) => {
2764
+ if (Pi(m)) {
2765
+ let v = b + 1;
2766
+ const S = m.href;
2767
+ let w = "";
2116
2768
  try {
2117
- (await createImageBitmap(Q)).close();
2118
- } catch {
2119
- throw new Error("Image data is invalid or cannot be decoded");
2769
+ w = await De(t, {
2770
+ url: S,
2771
+ requestType: "text",
2772
+ responseType: "text"
2773
+ });
2774
+ } catch (y) {
2775
+ t.log.warn(`Error fetch remote css import from ${S}`, y);
2120
2776
  }
2121
- return new Response(Q, {
2122
- status: 200,
2123
- statusText: "OK",
2124
- headers: z.headers
2125
- });
2126
- } catch (z) {
2127
- return M(z);
2777
+ const k = w.replace(
2778
+ kn,
2779
+ (y, I, T) => y.replace(T, pn(T, S))
2780
+ );
2781
+ for (const y of Lr(k))
2782
+ try {
2783
+ l.insertRule(
2784
+ y,
2785
+ y.startsWith("@import") ? v += 1 : l.cssRules.length
2786
+ );
2787
+ } catch (I) {
2788
+ t.log.warn("Error inserting rule from remote css import", { rule: y, error: I });
2789
+ }
2128
2790
  }
2129
- }
2791
+ }))
2792
+ ), d.flatMap((l) => Array.from(l.cssRules)).filter((l) => Bi(l) && Cn(l.style.getPropertyValue("src")) && wn(l.style.getPropertyValue("font-family"))?.some((m) => a.has(m))).forEach((l) => {
2793
+ const m = l, b = o.get(m.cssText);
2794
+ b ? i.appendChild(n.createTextNode(`${b}
2795
+ `)) : r.push(
2796
+ Sn(
2797
+ m.cssText,
2798
+ m.parentStyleSheet ? m.parentStyleSheet.href : null,
2799
+ t
2800
+ ).then((v) => {
2801
+ v = Zt(v, t), o.set(m.cssText, v), i.appendChild(n.createTextNode(`${v}
2802
+ `));
2803
+ })
2804
+ );
2130
2805
  });
2131
- } catch (s) {
2132
- if (console.warn(`Screenshot attempt ${i + 1} failed:`, s), i++, i === 1)
2133
- return console.error("All screenshot attempts failed."), null;
2134
2806
  }
2135
- return null;
2807
+ }
2808
+ const _r = /(\/\*[\s\S]*?\*\/)/g, Kt = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
2809
+ function Lr(e) {
2810
+ if (e == null)
2811
+ return [];
2812
+ const t = [];
2813
+ let n = e.replace(_r, "");
2814
+ for (; ; ) {
2815
+ const o = Kt.exec(n);
2816
+ if (!o)
2817
+ break;
2818
+ t.push(o[0]);
2819
+ }
2820
+ n = n.replace(Kt, "");
2821
+ const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = new RegExp(
2822
+ // eslint-disable-next-line
2823
+ "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",
2824
+ "gi"
2825
+ );
2826
+ for (; ; ) {
2827
+ let o = i.exec(n);
2828
+ if (o)
2829
+ a.lastIndex = i.lastIndex;
2830
+ else if (o = a.exec(n), o)
2831
+ i.lastIndex = a.lastIndex;
2832
+ else
2833
+ break;
2834
+ t.push(o[0]);
2835
+ }
2836
+ return t;
2837
+ }
2838
+ const Ur = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, zr = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
2839
+ function Zt(e, t) {
2840
+ const { font: n } = t, i = n ? n?.preferredFormat : void 0;
2841
+ return i ? e.replace(zr, (a) => {
2842
+ for (; ; ) {
2843
+ const [o, , r] = Ur.exec(a) || [];
2844
+ if (!r)
2845
+ return "";
2846
+ if (r === i)
2847
+ return `src: ${o};`;
2848
+ }
2849
+ }) : e;
2850
+ }
2851
+ async function Br(e, t) {
2852
+ const n = await tt(e, t);
2853
+ if (X(n.node) && _e(n.node))
2854
+ return n.node;
2855
+ const {
2856
+ ownerDocument: i,
2857
+ log: a,
2858
+ tasks: o,
2859
+ svgStyleElement: r,
2860
+ svgDefsElement: s,
2861
+ svgStyles: d,
2862
+ font: p,
2863
+ progress: l,
2864
+ autoDestruct: m,
2865
+ onCloneNode: b,
2866
+ onEmbedNode: v,
2867
+ onCreateForeignObjectSvg: S
2868
+ } = n;
2869
+ a.time("clone node");
2870
+ const w = await Et(n.node, n, !0);
2871
+ if (r && i) {
2872
+ let M = "";
2873
+ d.forEach((L, H) => {
2874
+ M += `${L.join(`,
2875
+ `)} {
2876
+ ${H}
2877
+ }
2878
+ `;
2879
+ }), r.appendChild(i.createTextNode(M));
2880
+ }
2881
+ a.timeEnd("clone node"), await b?.(w), p !== !1 && X(w) && (a.time("embed web font"), await Fr(w, n), a.timeEnd("embed web font")), a.time("embed node"), En(w, n);
2882
+ const k = o.length;
2883
+ let y = 0;
2884
+ const I = async () => {
2885
+ for (; ; ) {
2886
+ const M = o.pop();
2887
+ if (!M)
2888
+ break;
2889
+ try {
2890
+ await M;
2891
+ } catch (L) {
2892
+ n.log.warn("Failed to run task", L);
2893
+ }
2894
+ l?.(++y, k);
2895
+ }
2896
+ };
2897
+ l?.(y, k), await Promise.all([...Array.from({ length: 4 })].map(I)), a.timeEnd("embed node"), await v?.(w);
2898
+ const T = Pr(w, n);
2899
+ return s && T.insertBefore(s, T.children[0]), r && T.insertBefore(r, T.children[0]), m && Tr(n), await S?.(T), T;
2900
+ }
2901
+ function Pr(e, t) {
2902
+ const { width: n, height: i } = t, a = er(n, i, e.ownerDocument), o = a.ownerDocument.createElementNS(a.namespaceURI, "foreignObject");
2903
+ return o.setAttributeNS(null, "x", "0%"), o.setAttributeNS(null, "y", "0%"), o.setAttributeNS(null, "width", "100%"), o.setAttributeNS(null, "height", "100%"), o.append(e), a.appendChild(o), a;
2904
+ }
2905
+ async function Hr(e, t) {
2906
+ const n = await tt(e, t), i = await Br(n), a = tr(i, n.isEnable("removeControlCharacter"));
2907
+ n.autoDestruct || (n.svgStyleElement = bn(n.ownerDocument), n.svgDefsElement = n.ownerDocument?.createElementNS(et, "defs"), n.svgStyles.clear());
2908
+ const o = me(a, i.ownerDocument);
2909
+ return await cr(o, n);
2910
+ }
2911
+ async function $r(e, t) {
2912
+ const n = await tt(e, t), { log: i, quality: a, type: o, dpi: r } = n, s = await Hr(n);
2913
+ i.time("canvas to data url");
2914
+ let d = s.toDataURL(o, a);
2915
+ if (["image/png", "image/jpeg"].includes(o) && r && Li && Ui) {
2916
+ const [p, l] = d.split(",");
2917
+ let m = 0, b = !1;
2918
+ if (o === "image/png") {
2919
+ const T = Fi(l);
2920
+ T >= 0 ? (m = Math.ceil((T + 28) / 3) * 4, b = !0) : m = 33 / 3 * 4;
2921
+ } else o === "image/jpeg" && (m = 18 / 3 * 4);
2922
+ const v = l.substring(0, m), S = l.substring(m), w = window.atob(v), k = new Uint8Array(w.length);
2923
+ for (let T = 0; T < k.length; T++)
2924
+ k[T] = w.charCodeAt(T);
2925
+ const y = o === "image/png" ? Ni(k, r, b) : Ti(k, r), I = window.btoa(String.fromCharCode(...y));
2926
+ d = [p, ",", I, S].join("");
2927
+ }
2928
+ return i.timeEnd("canvas to data url"), d;
2929
+ }
2930
+ async function Wr(e, t) {
2931
+ return $r(
2932
+ await tt(e, { ...t, type: "image/png" })
2933
+ );
2934
+ }
2935
+ const qr = async (e, t) => {
2936
+ console.log("[Screenshot] Starting capture with 3-tier fallback strategy");
2937
+ try {
2938
+ console.log("[Screenshot] Tier 1: Attempting canvas-based capture...");
2939
+ const n = await Ei(e, {}, t);
2940
+ if (n)
2941
+ return console.log("[Screenshot] Tier 1 successful - canvas-based capture"), n;
2942
+ console.warn("[Screenshot] Tier 1 failed, falling back to Tier 2");
2943
+ } catch (n) {
2944
+ console.warn("[Screenshot] Tier 1 error:", n);
2945
+ }
2946
+ try {
2947
+ console.log("[Screenshot] Tier 2: Attempting modern-screenshot...");
2948
+ const n = document.documentElement, i = e ? e.x : 0, a = e ? e.y : 0, o = e ? e.width : window.innerWidth, r = e ? e.height : window.innerHeight, s = window.scrollX, d = window.scrollY, p = s + i, l = d + a, m = await Wr(n, {
2949
+ quality: 0.9,
2950
+ width: o,
2951
+ height: r,
2952
+ style: {
2953
+ transform: `translate(${-p}px, ${-l}px)`
2954
+ }
2955
+ });
2956
+ return console.log("[Screenshot] Tier 2 successful - modern-screenshot"), m;
2957
+ } catch (n) {
2958
+ console.error("[Screenshot] Tier 2 failed:", n);
2959
+ }
2960
+ return console.error("[Screenshot] All capture methods failed"), null;
2136
2961
  };
2137
- const An = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Pn = (e) => e.replace(
2962
+ const Vr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), jr = (e) => e.replace(
2138
2963
  /^([A-Z])|[\s-_]+(\w)/g,
2139
- (t, i, n) => n ? n.toUpperCase() : i.toLowerCase()
2140
- ), qt = (e) => {
2141
- const t = Pn(e);
2964
+ (t, n, i) => i ? i.toUpperCase() : n.toLowerCase()
2965
+ ), en = (e) => {
2966
+ const t = jr(e);
2142
2967
  return t.charAt(0).toUpperCase() + t.slice(1);
2143
- }, ci = (...e) => e.filter((t, i, n) => !!t && t.trim() !== "" && n.indexOf(t) === i).join(" ").trim(), Ln = (e) => {
2968
+ }, Tn = (...e) => e.filter((t, n, i) => !!t && t.trim() !== "" && i.indexOf(t) === n).join(" ").trim(), Gr = (e) => {
2144
2969
  for (const t in e)
2145
2970
  if (t.startsWith("aria-") || t === "role" || t === "title")
2146
2971
  return !0;
2147
2972
  };
2148
- var Dn = {
2973
+ var Xr = {
2149
2974
  xmlns: "http://www.w3.org/2000/svg",
2150
2975
  width: 24,
2151
2976
  height: 24,
@@ -2156,67 +2981,67 @@ var Dn = {
2156
2981
  strokeLinecap: "round",
2157
2982
  strokeLinejoin: "round"
2158
2983
  };
2159
- const Fn = Yt(
2984
+ const Yr = rn(
2160
2985
  ({
2161
2986
  color: e = "currentColor",
2162
2987
  size: t = 24,
2163
- strokeWidth: i = 2,
2164
- absoluteStrokeWidth: n,
2165
- className: o = "",
2166
- children: s,
2988
+ strokeWidth: n = 2,
2989
+ absoluteStrokeWidth: i,
2990
+ className: a = "",
2991
+ children: o,
2167
2992
  iconNode: r,
2168
- ...h
2169
- }, f) => rt(
2993
+ ...s
2994
+ }, d) => gt(
2170
2995
  "svg",
2171
2996
  {
2172
- ref: f,
2173
- ...Dn,
2997
+ ref: d,
2998
+ ...Xr,
2174
2999
  width: t,
2175
3000
  height: t,
2176
3001
  stroke: e,
2177
- strokeWidth: n ? Number(i) * 24 / Number(t) : i,
2178
- className: ci("lucide", o),
2179
- ...!s && !Ln(h) && { "aria-hidden": "true" },
2180
- ...h
3002
+ strokeWidth: i ? Number(n) * 24 / Number(t) : n,
3003
+ className: Tn("lucide", a),
3004
+ ...!o && !Gr(s) && { "aria-hidden": "true" },
3005
+ ...s
2181
3006
  },
2182
3007
  [
2183
- ...r.map(([b, m]) => rt(b, m)),
2184
- ...Array.isArray(s) ? s : [s]
3008
+ ...r.map(([p, l]) => gt(p, l)),
3009
+ ...Array.isArray(o) ? o : [o]
2185
3010
  ]
2186
3011
  )
2187
3012
  );
2188
- const ie = (e, t) => {
2189
- const i = Yt(
2190
- ({ className: n, ...o }, s) => rt(Fn, {
2191
- ref: s,
3013
+ const ae = (e, t) => {
3014
+ const n = rn(
3015
+ ({ className: i, ...a }, o) => gt(Yr, {
3016
+ ref: o,
2192
3017
  iconNode: t,
2193
- className: ci(
2194
- `lucide-${An(qt(e))}`,
3018
+ className: Tn(
3019
+ `lucide-${Vr(en(e))}`,
2195
3020
  `lucide-${e}`,
2196
- n
3021
+ i
2197
3022
  ),
2198
- ...o
3023
+ ...a
2199
3024
  })
2200
3025
  );
2201
- return i.displayName = qt(e), i;
3026
+ return n.displayName = en(e), n;
2202
3027
  };
2203
- const _n = [
3028
+ const Jr = [
2204
3029
  ["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
2205
3030
  ["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
2206
- ], zn = ie("crop", _n);
2207
- const Hn = [
3031
+ ], Qr = ae("crop", Jr);
3032
+ const Kr = [
2208
3033
  ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
2209
3034
  ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
2210
3035
  ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
2211
3036
  ["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
2212
- ], Gt = ie("hash", Hn);
2213
- const Un = [
3037
+ ], tn = ae("hash", Kr);
3038
+ const Zr = [
2214
3039
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
2215
3040
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
2216
3041
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
2217
- ], $n = ie("image", Un);
2218
- const Bn = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Wn = ie("loader-circle", Bn);
2219
- const Vn = [
3042
+ ], eo = ae("image", Zr);
3043
+ const to = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], no = ae("loader-circle", to);
3044
+ const io = [
2220
3045
  [
2221
3046
  "path",
2222
3047
  {
@@ -2226,58 +3051,62 @@ const Vn = [
2226
3051
  ],
2227
3052
  ["path", { d: "M12 8v6", key: "1ib9pf" }],
2228
3053
  ["path", { d: "M9 11h6", key: "1fldmi" }]
2229
- ], jn = ie("message-square-plus", Vn);
2230
- const Nn = [
3054
+ ], ro = ae("message-square-plus", io);
3055
+ const oo = [
2231
3056
  ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
2232
3057
  ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
2233
3058
  ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
2234
- ], qn = ie("monitor", Nn);
2235
- const Gn = [
3059
+ ], so = ae("monitor", oo);
3060
+ const ao = [
2236
3061
  ["path", { d: "M21 5H3", key: "1fi0y6" }],
2237
3062
  ["path", { d: "M15 12H3", key: "6jk70r" }],
2238
3063
  ["path", { d: "M17 19H3", key: "z6ezky" }]
2239
- ], Xn = ie("text-align-start", Gn);
2240
- const Yn = [
3064
+ ], lo = ae("text-align-start", ao);
3065
+ const co = [
2241
3066
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
2242
3067
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
2243
- ], Xt = ie("x", Yn), Qn = ({ onConfirm: e, onCancel: t }) => {
2244
- const [i, n] = T(!1), [o, s] = T({ x: 0, y: 0 }), [r, h] = T({ x: 0, y: 0 }), f = (y) => {
2245
- n(!0), s({ x: y.clientX, y: y.clientY }), h({ x: y.clientX, y: y.clientY });
2246
- }, b = (y) => {
2247
- i && h({ x: y.clientX, y: y.clientY });
2248
- }, m = () => {
2249
- O();
2250
- }, k = (y) => {
3068
+ ], nn = ae("x", co), uo = ({ onConfirm: e, onCancel: t }) => {
3069
+ const [n, i] = F(!1), [a, o] = F({ x: 0, y: 0 }), [r, s] = F({ x: 0, y: 0 }), [d, p] = F(!1);
3070
+ Ot(() => (d ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
3071
+ document.body.style.overflow = "";
3072
+ }), [d]);
3073
+ const l = (y) => {
3074
+ i(!0), o({ x: y.clientX, y: y.clientY }), s({ x: y.clientX, y: y.clientY });
3075
+ }, m = (y) => {
3076
+ n && s({ x: y.clientX, y: y.clientY });
3077
+ }, b = () => {
3078
+ k();
3079
+ }, v = (y) => {
2251
3080
  if (y.touches.length === 1) {
2252
- n(!0);
2253
- const S = y.touches[0];
2254
- s({ x: S.clientX, y: S.clientY }), h({ x: S.clientX, y: S.clientY }), document.body.style.overflow = "hidden";
3081
+ i(!0);
3082
+ const I = y.touches[0];
3083
+ o({ x: I.clientX, y: I.clientY }), s({ x: I.clientX, y: I.clientY }), p(!0);
2255
3084
  }
2256
- }, R = (y) => {
2257
- if (i && y.touches.length === 1) {
2258
- const S = y.touches[0];
2259
- h({ x: S.clientX, y: S.clientY });
3085
+ }, S = (y) => {
3086
+ if (n && y.touches.length === 1) {
3087
+ const I = y.touches[0];
3088
+ s({ x: I.clientX, y: I.clientY });
2260
3089
  }
2261
- }, $ = () => {
2262
- O(), document.body.style.overflow = "";
2263
- }, O = () => {
2264
- if (i) {
2265
- n(!1);
2266
- const y = Math.min(o.x, r.x), S = Math.min(o.y, r.y), A = Math.abs(r.x - o.x), M = Math.abs(r.y - o.y);
2267
- A > 10 && M > 10 && e({
3090
+ }, w = () => {
3091
+ k(), p(!1);
3092
+ }, k = () => {
3093
+ if (n) {
3094
+ i(!1);
3095
+ const y = Math.min(a.x, r.x), I = Math.min(a.y, r.y), T = Math.abs(r.x - a.x), M = Math.abs(r.y - a.y);
3096
+ T > 10 && M > 10 && e({
2268
3097
  x: y,
2269
- y: S,
2270
- width: A,
3098
+ y: I,
3099
+ width: T,
2271
3100
  height: M
2272
3101
  });
2273
3102
  }
2274
3103
  };
2275
- return xi(() => {
2276
- const y = (S) => {
2277
- S.key === "Escape" && t();
3104
+ return Ot(() => {
3105
+ const y = (I) => {
3106
+ I.key === "Escape" && t();
2278
3107
  };
2279
3108
  return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
2280
- }, [t]), /* @__PURE__ */ x(
3109
+ }, [t]), /* @__PURE__ */ A(
2281
3110
  "div",
2282
3111
  {
2283
3112
  style: {
@@ -2288,19 +3117,19 @@ const Yn = [
2288
3117
  cursor: "crosshair",
2289
3118
  userSelect: "none"
2290
3119
  },
2291
- onMouseDown: f,
2292
- onMouseMove: b,
2293
- onMouseUp: m,
2294
- onTouchStart: k,
2295
- onTouchMove: R,
2296
- onTouchEnd: $,
3120
+ onMouseDown: l,
3121
+ onMouseMove: m,
3122
+ onMouseUp: b,
3123
+ onTouchStart: v,
3124
+ onTouchMove: S,
3125
+ onTouchEnd: w,
2297
3126
  children: [
2298
- /* @__PURE__ */ g("div", { style: {
3127
+ /* @__PURE__ */ C("div", { style: {
2299
3128
  position: "absolute",
2300
3129
  inset: 0,
2301
3130
  backgroundColor: "rgba(0, 0, 0, 0.4)"
2302
3131
  } }),
2303
- !i && /* @__PURE__ */ g("div", { style: {
3132
+ !n && /* @__PURE__ */ C("div", { style: {
2304
3133
  position: "absolute",
2305
3134
  top: "20px",
2306
3135
  left: "50%",
@@ -2312,15 +3141,15 @@ const Yn = [
2312
3141
  pointerEvents: "none",
2313
3142
  fontSize: "14px"
2314
3143
  }, children: "Kéo chuột hoặc chạm để chọn vùng chụp ảnh (ESC để hủy)" }),
2315
- i && /* @__PURE__ */ g(
3144
+ n && /* @__PURE__ */ C(
2316
3145
  "div",
2317
3146
  {
2318
3147
  style: {
2319
3148
  position: "absolute",
2320
- left: Math.min(o.x, r.x),
2321
- top: Math.min(o.y, r.y),
2322
- width: Math.abs(r.x - o.x),
2323
- height: Math.abs(r.y - o.y),
3149
+ left: Math.min(a.x, r.x),
3150
+ top: Math.min(a.y, r.y),
3151
+ width: Math.abs(r.x - a.x),
3152
+ height: Math.abs(r.y - a.y),
2324
3153
  border: "2px solid #fff",
2325
3154
  backgroundColor: "rgba(255, 255, 255, 0.1)",
2326
3155
  boxShadow: "0 0 0 9999px rgba(0, 0, 0, 0.5)"
@@ -2331,111 +3160,112 @@ const Yn = [
2331
3160
  ]
2332
3161
  }
2333
3162
  );
2334
- }, Zn = ({
3163
+ }, fo = ({
2335
3164
  questionId: e,
2336
- questionIdChild: t,
2337
- contextData: i,
3165
+ contextData: t,
2338
3166
  onSubmit: n,
2339
- themeColor: o = "#3b82f6",
2340
- triggerComponent: s,
2341
- isOpen: r,
2342
- onOpen: h,
2343
- onClose: f
3167
+ themeColor: i = "#3b82f6",
3168
+ triggerComponent: a,
3169
+ isOpen: o,
3170
+ onOpen: r,
3171
+ onClose: s,
3172
+ isEnableCaptureFull: d = !0,
3173
+ isEnableCaptureElement: p = !0
2344
3174
  }) => {
2345
- const [b, m] = T(!1), [k, R] = T(""), [$, O] = T(e), [y, S] = T(t || ""), [A, M] = T([]), [z, Q] = T(null), [me, gt] = T(!1), [ne, bt] = T(!1), [wt, Re] = T(!1), [N, ae] = T(null), [L, le] = T({}), [mt, Me] = T("incorrect_content"), [ui, Ne] = T(!1), yt = St.useRef(null), qe = r !== void 0 ? r : b, hi = qe && !ui;
2346
- St.useEffect(() => {
2347
- qe && (le({}), O(e), S(t || ""), M([]), R(""), Me("incorrect_content"));
2348
- }, [qe, e, t]);
2349
- const fi = () => {
2350
- if (A.length >= 3) {
3175
+ const [l, m] = F(!1), [b, v] = F(""), [S, w] = F(e), [k, y] = F(t?.questionIdChild || ""), [I, T] = F([]), [M, L] = F(null), [H, Y] = F(!1), [_, W] = F(!1), [te, Le] = F(!1), [J, ue] = F(null), [z, fe] = F({}), [Tt, Ue] = F("incorrect_content"), [An, nt] = F(!1), It = Mt.useRef(null), it = o !== void 0 ? o : l, Rn = it && !An;
3176
+ Mt.useEffect(() => {
3177
+ it && (fe({}), w(e), y(t?.questionIdChild || ""), T([]), v(""), Ue("incorrect_content"));
3178
+ }, [it, e, t]);
3179
+ const Nn = () => {
3180
+ if (I.length >= 3) {
2351
3181
  alert("Bạn chỉ có thể chụp tối đa 3 ảnh.");
2352
3182
  return;
2353
3183
  }
2354
- yt.current?.click();
2355
- }, pi = (p) => {
2356
- const C = p.target.files?.[0];
2357
- if (!C) return;
2358
- if (!C.type.startsWith("image/")) {
3184
+ It.current?.click();
3185
+ }, Mn = (x) => {
3186
+ const N = x.target.files?.[0];
3187
+ if (!N) return;
3188
+ if (!N.type.startsWith("image/")) {
2359
3189
  alert("Vui lòng chọn file ảnh.");
2360
3190
  return;
2361
3191
  }
2362
- if (C.size > 5 * 1024 * 1024) {
3192
+ if (N.size > 5 * 1024 * 1024) {
2363
3193
  alert("Ảnh quá lớn. Vui lòng chọn ảnh dưới 5MB.");
2364
3194
  return;
2365
3195
  }
2366
- const q = new FileReader();
2367
- q.onload = (Oe) => {
2368
- const Ae = Oe.target?.result;
2369
- Ae && M((kt) => [...kt, Ae]);
2370
- }, q.readAsDataURL(C), p.target.value = "";
2371
- }, gi = () => {
2372
- M([]), R(""), O(e), S(t || ""), Me("incorrect_content"), le({}), r === void 0 && m(!0);
2373
- }, xt = async (p) => {
2374
- if (A.length >= 3) {
3196
+ const Q = new FileReader();
3197
+ Q.onload = (ze) => {
3198
+ const Be = ze.target?.result;
3199
+ Be && T((Nt) => [...Nt, Be]);
3200
+ }, Q.readAsDataURL(N), x.target.value = "";
3201
+ }, On = () => {
3202
+ T([]), v(""), w(e), y(t?.questionIdChild || ""), Ue("incorrect_content"), fe({}), o === void 0 && m(!0);
3203
+ }, At = async (x) => {
3204
+ if (console.log("click capture", performance.now()), I.length >= 3) {
2375
3205
  alert("Bạn chỉ có thể chụp tối đa 3 ảnh.");
2376
3206
  return;
2377
3207
  }
2378
- if (Ne(!0), p === "crop") {
2379
- setTimeout(() => Re(!0), 150);
3208
+ if (nt(!0), x === "crop") {
3209
+ setTimeout(() => Le(!0), 150);
2380
3210
  return;
2381
3211
  }
2382
3212
  setTimeout(async () => {
2383
- await vt();
3213
+ await Rt();
2384
3214
  }, 150);
2385
- }, vt = async (p) => {
2386
- gt(!0);
3215
+ }, Rt = async (x) => {
3216
+ console.log("performCapture start", performance.now()), Y(!0);
2387
3217
  try {
2388
- const C = await On(p);
2389
- C ? M((q) => [...q, C]) : alert("Không thể chụp ảnh màn hình. Vui lòng thử lại.");
2390
- } catch (C) {
2391
- console.error(C);
3218
+ const N = await qr(x);
3219
+ console.log("performCapture end", performance.now()), N ? T((Q) => [...Q, N]) : alert("Không thể chụp ảnh màn hình. Vui lòng thử lại.");
3220
+ } catch (N) {
3221
+ console.error(N);
2392
3222
  } finally {
2393
- gt(!1), Ne(!1);
3223
+ Y(!1), nt(!1);
2394
3224
  }
2395
- }, bi = (p) => {
2396
- Re(!1), vt(p);
2397
- }, wi = () => {
2398
- Re(!1), Ne(!1);
2399
- }, mi = (p) => {
2400
- M((C) => C.filter((q, Oe) => Oe !== p));
2401
- }, Ge = () => {
2402
- f && f(), m(!1), M([]), Re(!1), Q(null), R(""), le({}), Me("incorrect_content");
2403
- }, yi = async () => {
2404
- const p = {};
2405
- if ($ ? isNaN(Number($)) && (p.questionId = "ID câu hỏi phải là số") : p.questionId = "Vui lòng nhập ID câu hỏi", y && isNaN(Number(y)) && (p.questionIdChild = "ID câu hỏi con phải là số"), k.trim() || (p.description = "Vui lòng nhập mô tả lỗi"), Object.keys(p).length > 0) {
2406
- le(p);
3225
+ }, Dn = (x) => {
3226
+ Le(!1), Rt(x);
3227
+ }, Fn = () => {
3228
+ Le(!1), nt(!1);
3229
+ }, _n = (x) => {
3230
+ T((N) => N.filter((Q, ze) => ze !== x));
3231
+ }, rt = () => {
3232
+ s && s(), m(!1), T([]), Le(!1), L(null), v(""), fe({}), Ue("incorrect_content");
3233
+ }, Ln = async () => {
3234
+ const x = {};
3235
+ if (S ? isNaN(Number(S)) && (x.questionId = "ID câu hỏi phải là số") : x.questionId = "Vui lòng nhập ID câu hỏi", k && isNaN(Number(k)) && (x.questionIdChild = "ID câu hỏi con phải là số"), b.trim() || (x.description = "Vui lòng nhập mô tả lỗi"), Object.keys(x).length > 0) {
3236
+ fe(x);
2407
3237
  return;
2408
3238
  }
2409
- bt(!0);
3239
+ W(!0);
2410
3240
  try {
2411
- const C = Jt(), q = await Promise.all(
2412
- A.map(async (Ae) => (await (await fetch("https://lcms.icanwork.vn/api/upload-to-s3/upload-image-error-to-s3", {
3241
+ const N = Kn(), Q = await Promise.all(
3242
+ I.map(async (Be) => (await (await fetch("https://lcms.icanwork.vn/api/upload-to-s3/upload-image-error-to-s3", {
2413
3243
  method: "POST",
2414
3244
  headers: {
2415
3245
  "Content-Type": "application/json"
2416
3246
  },
2417
3247
  body: JSON.stringify({
2418
- base64: Ae
3248
+ base64: Be
2419
3249
  })
2420
3250
  })).json()).file_url)
2421
3251
  );
2422
3252
  await n({
2423
- idQuestion: $,
2424
- idChildQuestion: y,
2425
- errorType: mt,
2426
- errorDescription: k,
2427
- listImage: q,
2428
- deviceInfo: C,
2429
- contextData: i
2430
- }), Ge();
2431
- } catch (C) {
2432
- console.error("Submit feedback failed", C);
3253
+ idQuestion: S,
3254
+ idChildQuestion: k,
3255
+ errorType: Tt,
3256
+ errorDescription: b,
3257
+ listImage: Q,
3258
+ deviceInfo: N,
3259
+ contextData: t
3260
+ }), rt();
3261
+ } catch (N) {
3262
+ console.error("Submit feedback failed", N);
2433
3263
  } finally {
2434
- bt(!1);
3264
+ W(!1);
2435
3265
  }
2436
3266
  };
2437
- return /* @__PURE__ */ x(nt, { children: [
2438
- /* @__PURE__ */ g("style", { id: "feedback-widget-styles", children: `
3267
+ return /* @__PURE__ */ A(Ae, { children: [
3268
+ /* @__PURE__ */ C("style", { id: "feedback-widget-styles", children: `
2439
3269
  @keyframes fb-fade-in {
2440
3270
  from { opacity: 0; transform: translateY(10px); }
2441
3271
  to { opacity: 1; transform: translateY(0); }
@@ -2498,8 +3328,8 @@ const Yn = [
2498
3328
  }
2499
3329
  }
2500
3330
  ` }),
2501
- wt && /* @__PURE__ */ g(Qn, { onConfirm: bi, onCancel: wi }),
2502
- z && /* @__PURE__ */ g(
3331
+ te && /* @__PURE__ */ C(uo, { onConfirm: Dn, onCancel: Fn }),
3332
+ M && /* @__PURE__ */ C(
2503
3333
  "div",
2504
3334
  {
2505
3335
  style: {
@@ -2514,14 +3344,14 @@ const Yn = [
2514
3344
  animation: "fb-fade-in 0.2s ease-out",
2515
3345
  backdropFilter: "blur(4px)"
2516
3346
  },
2517
- onClick: () => Q(null),
2518
- children: /* @__PURE__ */ g(
3347
+ onClick: () => L(null),
3348
+ children: /* @__PURE__ */ C(
2519
3349
  "img",
2520
3350
  {
2521
- src: z,
3351
+ src: M,
2522
3352
  alt: "Zoomed",
2523
3353
  draggable: !1,
2524
- onContextMenu: (p) => p.preventDefault(),
3354
+ onContextMenu: (x) => x.preventDefault(),
2525
3355
  style: {
2526
3356
  maxWidth: "90vw",
2527
3357
  maxHeight: "90vh",
@@ -2536,9 +3366,9 @@ const Yn = [
2536
3366
  )
2537
3367
  }
2538
3368
  ),
2539
- /* @__PURE__ */ g("div", { onClick: () => {
2540
- r === void 0 ? gi() : h && h();
2541
- }, style: { cursor: "pointer", display: "inline-block" }, children: s || /* @__PURE__ */ g(
3369
+ /* @__PURE__ */ C("div", { onClick: () => {
3370
+ o === void 0 ? On() : r && r();
3371
+ }, style: { cursor: "pointer", display: "inline-block" }, children: a || /* @__PURE__ */ C(
2542
3372
  "button",
2543
3373
  {
2544
3374
  className: "fb-widget-trigger",
@@ -2546,7 +3376,7 @@ const Yn = [
2546
3376
  position: "fixed",
2547
3377
  bottom: "24px",
2548
3378
  right: "24px",
2549
- backgroundColor: o,
3379
+ backgroundColor: i,
2550
3380
  color: "white",
2551
3381
  border: "none",
2552
3382
  borderRadius: "50%",
@@ -2561,19 +3391,19 @@ const Yn = [
2561
3391
  transition: "transform 0.2s"
2562
3392
  },
2563
3393
  title: "Báo lỗi",
2564
- onMouseEnter: (p) => p.currentTarget.style.transform = "scale(1.1)",
2565
- onMouseLeave: (p) => p.currentTarget.style.transform = "scale(1)",
2566
- children: /* @__PURE__ */ g(jn, { size: 24 })
3394
+ onMouseEnter: (x) => x.currentTarget.style.transform = "scale(1.1)",
3395
+ onMouseLeave: (x) => x.currentTarget.style.transform = "scale(1)",
3396
+ children: /* @__PURE__ */ C(ro, { size: 24 })
2567
3397
  }
2568
3398
  ) }),
2569
- me && /* @__PURE__ */ g("div", { style: { position: "fixed", top: 20, right: 20, background: "rgba(0,0,0,0.8)", color: "white", padding: "8px 12px", borderRadius: "8px", zIndex: 1e4, fontWeight: 500, backdropFilter: "blur(4px)", fontSize: "0.8rem" }, children: "Đang chụp..." }),
2570
- hi && !wt && !z && /* @__PURE__ */ x("div", { className: "fb-widget-modal", children: [
2571
- /* @__PURE__ */ x("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
2572
- /* @__PURE__ */ g("h2", { style: { margin: 0, fontSize: "1rem", fontWeight: 700, color: "#111827" }, children: "Báo lỗi" }),
2573
- /* @__PURE__ */ g(
3399
+ H && /* @__PURE__ */ C("div", { style: { position: "fixed", top: 20, right: 20, background: "rgba(0,0,0,0.8)", color: "white", padding: "8px 12px", borderRadius: "8px", zIndex: 1e4, fontWeight: 500, backdropFilter: "blur(4px)", fontSize: "0.8rem" }, children: "Đang chụp..." }),
3400
+ Rn && !te && !M && /* @__PURE__ */ A("div", { className: "fb-widget-modal", children: [
3401
+ /* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3402
+ /* @__PURE__ */ C("h2", { style: { margin: 0, fontSize: "1rem", fontWeight: 700, color: "#111827" }, children: "Báo lỗi" }),
3403
+ /* @__PURE__ */ C(
2574
3404
  "button",
2575
3405
  {
2576
- onClick: Ge,
3406
+ onClick: rt,
2577
3407
  style: {
2578
3408
  background: "transparent",
2579
3409
  border: "none",
@@ -2586,42 +3416,42 @@ const Yn = [
2586
3416
  borderRadius: "50%",
2587
3417
  transition: "background-color 0.2s"
2588
3418
  },
2589
- onMouseEnter: (p) => p.currentTarget.style.backgroundColor = "#f3f4f6",
2590
- onMouseLeave: (p) => p.currentTarget.style.backgroundColor = "transparent",
2591
- children: /* @__PURE__ */ g(Xt, { size: 18 })
3419
+ onMouseEnter: (x) => x.currentTarget.style.backgroundColor = "#f3f4f6",
3420
+ onMouseLeave: (x) => x.currentTarget.style.backgroundColor = "transparent",
3421
+ children: /* @__PURE__ */ C(nn, { size: 18 })
2592
3422
  }
2593
3423
  )
2594
3424
  ] }),
2595
- /* @__PURE__ */ x("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
2596
- /* @__PURE__ */ x("div", { children: [
2597
- /* @__PURE__ */ x("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
3425
+ /* @__PURE__ */ A("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
3426
+ /* @__PURE__ */ A("div", { children: [
3427
+ /* @__PURE__ */ A("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
2598
3428
  "ID Câu hỏi ",
2599
- t ? "bài đọc" : "",
3429
+ t?.questionIdChild ? "bài đọc" : "",
2600
3430
  " ",
2601
- /* @__PURE__ */ g("span", { style: { color: "#ef4444" }, children: "*" })
3431
+ /* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
2602
3432
  ] }),
2603
- /* @__PURE__ */ x("div", { style: {
3433
+ /* @__PURE__ */ A("div", { style: {
2604
3434
  position: "relative",
2605
3435
  display: "flex",
2606
3436
  alignItems: "center",
2607
3437
  transition: "all 0.2s"
2608
3438
  }, children: [
2609
- /* @__PURE__ */ g(Gt, { size: 12, style: {
3439
+ /* @__PURE__ */ C(tn, { size: 12, style: {
2610
3440
  position: "absolute",
2611
3441
  left: "10px",
2612
- color: N === "id" ? o : L.questionId ? "#ef4444" : "#9ca3af",
3442
+ color: J === "id" ? i : z.questionId ? "#ef4444" : "#9ca3af",
2613
3443
  transition: "color 0.2s",
2614
3444
  pointerEvents: "none"
2615
3445
  } }),
2616
- /* @__PURE__ */ g(
3446
+ /* @__PURE__ */ C(
2617
3447
  "input",
2618
3448
  {
2619
3449
  type: "text",
2620
- value: $,
2621
- onFocus: () => ae("id"),
2622
- onBlur: () => ae(null),
2623
- onChange: (p) => {
2624
- O(p.target.value), L.questionId && le((C) => ({ ...C, questionId: void 0 }));
3450
+ value: S,
3451
+ onFocus: () => ue("id"),
3452
+ onBlur: () => ue(null),
3453
+ onChange: (x) => {
3454
+ w(x.target.value), z.questionId && fe((N) => ({ ...N, questionId: void 0 }));
2625
3455
  },
2626
3456
  disabled: !!e,
2627
3457
  placeholder: "Nhập ID (ví dụ: 101)",
@@ -2629,8 +3459,8 @@ const Yn = [
2629
3459
  width: "100%",
2630
3460
  padding: "6px 10px 6px 28px",
2631
3461
  borderRadius: "6px",
2632
- border: `1px solid ${L.questionId ? "#ef4444" : N === "id" ? o : "#e5e7eb"}`,
2633
- boxShadow: N === "id" ? `0 0 0 2px ${o}20` : "none",
3462
+ border: `1px solid ${z.questionId ? "#ef4444" : J === "id" ? i : "#e5e7eb"}`,
3463
+ boxShadow: J === "id" ? `0 0 0 2px ${i}20` : "none",
2634
3464
  outline: "none",
2635
3465
  fontSize: "0.85rem",
2636
3466
  color: "#1f2937",
@@ -2640,41 +3470,41 @@ const Yn = [
2640
3470
  }
2641
3471
  )
2642
3472
  ] }),
2643
- L.questionId && /* @__PURE__ */ g("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: L.questionId })
3473
+ z.questionId && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.questionId })
2644
3474
  ] }),
2645
- t ? /* @__PURE__ */ x("div", { children: [
2646
- /* @__PURE__ */ g("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: "ID Câu hỏi" }),
2647
- /* @__PURE__ */ x("div", { style: {
3475
+ t?.questionIdChild ? /* @__PURE__ */ A("div", { children: [
3476
+ /* @__PURE__ */ C("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: "ID Câu hỏi" }),
3477
+ /* @__PURE__ */ A("div", { style: {
2648
3478
  position: "relative",
2649
3479
  display: "flex",
2650
3480
  alignItems: "center",
2651
3481
  transition: "all 0.2s"
2652
3482
  }, children: [
2653
- /* @__PURE__ */ g(Gt, { size: 12, style: {
3483
+ /* @__PURE__ */ C(tn, { size: 12, style: {
2654
3484
  position: "absolute",
2655
3485
  left: "10px",
2656
- color: N === "idChild" ? o : L.questionIdChild ? "#ef4444" : "#9ca3af",
3486
+ color: J === "idChild" ? i : z.questionIdChild ? "#ef4444" : "#9ca3af",
2657
3487
  transition: "color 0.2s",
2658
3488
  pointerEvents: "none"
2659
3489
  } }),
2660
- /* @__PURE__ */ g(
3490
+ /* @__PURE__ */ C(
2661
3491
  "input",
2662
3492
  {
2663
3493
  type: "text",
2664
- value: y,
2665
- onFocus: () => ae("idChild"),
2666
- onBlur: () => ae(null),
2667
- onChange: (p) => {
2668
- S(p.target.value);
3494
+ value: k,
3495
+ onFocus: () => ue("idChild"),
3496
+ onBlur: () => ue(null),
3497
+ onChange: (x) => {
3498
+ y(x.target.value);
2669
3499
  },
2670
3500
  placeholder: "Nhập ID (ví dụ: 101)",
2671
- disabled: !!t,
3501
+ disabled: !!t?.questionIdChild,
2672
3502
  style: {
2673
3503
  width: "100%",
2674
3504
  padding: "6px 10px 6px 28px",
2675
3505
  borderRadius: "6px",
2676
- border: `1px solid ${L.questionIdChild ? "#ef4444" : N === "idChild" ? o : "#e5e7eb"}`,
2677
- boxShadow: N === "idChild" ? `0 0 0 2px ${o}20` : "none",
3506
+ border: `1px solid ${z.questionIdChild ? "#ef4444" : J === "idChild" ? i : "#e5e7eb"}`,
3507
+ boxShadow: J === "idChild" ? `0 0 0 2px ${i}20` : "none",
2678
3508
  outline: "none",
2679
3509
  fontSize: "0.85rem",
2680
3510
  color: "#1f2937",
@@ -2684,18 +3514,18 @@ const Yn = [
2684
3514
  }
2685
3515
  )
2686
3516
  ] }),
2687
- L.questionIdChild && /* @__PURE__ */ g("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: L.questionIdChild })
2688
- ] }) : /* @__PURE__ */ g(nt, {}),
2689
- /* @__PURE__ */ x("div", { children: [
2690
- /* @__PURE__ */ x("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
3517
+ z.questionIdChild && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.questionIdChild })
3518
+ ] }) : /* @__PURE__ */ C(Ae, {}),
3519
+ /* @__PURE__ */ A("div", { children: [
3520
+ /* @__PURE__ */ A("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
2691
3521
  "Loại lỗi ",
2692
- /* @__PURE__ */ g("span", { style: { color: "#ef4444" }, children: "*" })
3522
+ /* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
2693
3523
  ] }),
2694
- /* @__PURE__ */ x(
3524
+ /* @__PURE__ */ A(
2695
3525
  "select",
2696
3526
  {
2697
- value: mt,
2698
- onChange: (p) => Me(p.target.value),
3527
+ value: Tt,
3528
+ onChange: (x) => Ue(x.target.value),
2699
3529
  style: {
2700
3530
  width: "100%",
2701
3531
  padding: "6px 10px",
@@ -2713,44 +3543,44 @@ const Yn = [
2713
3543
  backgroundSize: "14px"
2714
3544
  },
2715
3545
  children: [
2716
- /* @__PURE__ */ g("option", { value: "incorrect_content", children: "Lỗi nội dung" }),
2717
- /* @__PURE__ */ g("option", { value: "display_error", children: "Lỗi hiển thị" }),
2718
- /* @__PURE__ */ g("option", { value: "missing_data", children: "Thiếu thông tin" }),
2719
- /* @__PURE__ */ g("option", { value: "technical_issue", children: "Lỗi kỹ thuật" }),
2720
- /* @__PURE__ */ g("option", { value: "other", children: "Khác" })
3546
+ /* @__PURE__ */ C("option", { value: "incorrect_content", children: "Lỗi nội dung" }),
3547
+ /* @__PURE__ */ C("option", { value: "display_error", children: "Lỗi hiển thị" }),
3548
+ /* @__PURE__ */ C("option", { value: "missing_data", children: "Thiếu thông tin" }),
3549
+ /* @__PURE__ */ C("option", { value: "technical_issue", children: "Lỗi kỹ thuật" }),
3550
+ /* @__PURE__ */ C("option", { value: "other", children: "Khác" })
2721
3551
  ]
2722
3552
  }
2723
3553
  )
2724
3554
  ] }),
2725
- /* @__PURE__ */ x("div", { children: [
2726
- /* @__PURE__ */ x("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "2px" }, children: [
2727
- /* @__PURE__ */ x("label", { style: { fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
3555
+ /* @__PURE__ */ A("div", { children: [
3556
+ /* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "2px" }, children: [
3557
+ /* @__PURE__ */ A("label", { style: { fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
2728
3558
  "Mô tả lỗi ",
2729
- /* @__PURE__ */ g("span", { style: { color: "#ef4444" }, children: "*" })
3559
+ /* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
2730
3560
  ] }),
2731
- /* @__PURE__ */ x("span", { style: { fontSize: "0.7rem", color: "#9ca3af" }, children: [
2732
- k.length,
3561
+ /* @__PURE__ */ A("span", { style: { fontSize: "0.7rem", color: "#9ca3af" }, children: [
3562
+ b.length,
2733
3563
  "/1000"
2734
3564
  ] })
2735
3565
  ] }),
2736
- /* @__PURE__ */ x("div", { style: { position: "relative" }, children: [
2737
- /* @__PURE__ */ g("div", { style: {
3566
+ /* @__PURE__ */ A("div", { style: { position: "relative" }, children: [
3567
+ /* @__PURE__ */ C("div", { style: {
2738
3568
  position: "absolute",
2739
3569
  left: "10px",
2740
3570
  top: "8px",
2741
3571
  pointerEvents: "none"
2742
- }, children: /* @__PURE__ */ g(Xn, { size: 12, style: {
2743
- color: N === "desc" ? o : L.description ? "#ef4444" : "#9ca3af",
3572
+ }, children: /* @__PURE__ */ C(lo, { size: 12, style: {
3573
+ color: J === "desc" ? i : z.description ? "#ef4444" : "#9ca3af",
2744
3574
  transition: "color 0.2s"
2745
3575
  } }) }),
2746
- /* @__PURE__ */ g(
3576
+ /* @__PURE__ */ C(
2747
3577
  "textarea",
2748
3578
  {
2749
- value: k,
2750
- onFocus: () => ae("desc"),
2751
- onBlur: () => ae(null),
2752
- onChange: (p) => {
2753
- R(p.target.value), L.description && le((C) => ({ ...C, description: void 0 }));
3579
+ value: b,
3580
+ onFocus: () => ue("desc"),
3581
+ onBlur: () => ue(null),
3582
+ onChange: (x) => {
3583
+ v(x.target.value), z.description && fe((N) => ({ ...N, description: void 0 }));
2754
3584
  },
2755
3585
  maxLength: 1e3,
2756
3586
  placeholder: "Mô tả chi tiết...",
@@ -2759,8 +3589,8 @@ const Yn = [
2759
3589
  minHeight: "80px",
2760
3590
  padding: "6px 10px 6px 28px",
2761
3591
  borderRadius: "6px",
2762
- border: `1px solid ${L.description ? "#ef4444" : N === "desc" ? o : "#e5e7eb"}`,
2763
- boxShadow: N === "desc" ? `0 0 0 2px ${o}20` : "none",
3592
+ border: `1px solid ${z.description ? "#ef4444" : J === "desc" ? i : "#e5e7eb"}`,
3593
+ boxShadow: J === "desc" ? `0 0 0 2px ${i}20` : "none",
2764
3594
  outline: "none",
2765
3595
  fontSize: "0.85rem",
2766
3596
  color: "#1f2937",
@@ -2774,16 +3604,16 @@ const Yn = [
2774
3604
  }
2775
3605
  )
2776
3606
  ] }),
2777
- L.description && /* @__PURE__ */ g("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: L.description })
3607
+ z.description && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.description })
2778
3608
  ] })
2779
3609
  ] }),
2780
- /* @__PURE__ */ x("div", { style: { marginBottom: "2px" }, children: [
2781
- /* @__PURE__ */ g("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "6px" }, children: /* @__PURE__ */ x("label", { style: { fontWeight: 600, fontSize: "0.8rem", color: "#374151" }, children: [
3610
+ /* @__PURE__ */ A("div", { style: { marginBottom: "2px" }, children: [
3611
+ /* @__PURE__ */ C("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "6px" }, children: /* @__PURE__ */ A("label", { style: { fontWeight: 600, fontSize: "0.8rem", color: "#374151" }, children: [
2782
3612
  "Ảnh chụp (",
2783
- A.length,
3613
+ I.length,
2784
3614
  "/3)"
2785
3615
  ] }) }),
2786
- A.length > 0 && /* @__PURE__ */ g("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "6px", marginBottom: "8px" }, children: A.map((p, C) => /* @__PURE__ */ x("div", { style: {
3616
+ I.length > 0 && /* @__PURE__ */ C("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "6px", marginBottom: "8px" }, children: I.map((x, N) => /* @__PURE__ */ A("div", { style: {
2787
3617
  position: "relative",
2788
3618
  aspectRatio: "16/9",
2789
3619
  border: "1px solid #e5e7eb",
@@ -2791,13 +3621,13 @@ const Yn = [
2791
3621
  overflow: "hidden",
2792
3622
  boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
2793
3623
  }, children: [
2794
- /* @__PURE__ */ g(
3624
+ /* @__PURE__ */ C(
2795
3625
  "img",
2796
3626
  {
2797
- src: p,
2798
- alt: `Screenshot ${C + 1}`,
3627
+ src: x,
3628
+ alt: `Screenshot ${N + 1}`,
2799
3629
  draggable: !1,
2800
- onContextMenu: (q) => q.preventDefault(),
3630
+ onContextMenu: (Q) => Q.preventDefault(),
2801
3631
  style: {
2802
3632
  width: "100%",
2803
3633
  height: "100%",
@@ -2807,13 +3637,13 @@ const Yn = [
2807
3637
  userSelect: "none",
2808
3638
  WebkitUserSelect: "none"
2809
3639
  },
2810
- onClick: () => Q(p)
3640
+ onClick: () => L(x)
2811
3641
  }
2812
3642
  ),
2813
- /* @__PURE__ */ g(
3643
+ /* @__PURE__ */ C(
2814
3644
  "button",
2815
3645
  {
2816
- onClick: () => mi(C),
3646
+ onClick: () => _n(N),
2817
3647
  title: "Xóa ảnh",
2818
3648
  style: {
2819
3649
  position: "absolute",
@@ -2832,25 +3662,25 @@ const Yn = [
2832
3662
  padding: 0,
2833
3663
  boxShadow: "0 1px 2px rgba(0,0,0,0.2)"
2834
3664
  },
2835
- children: /* @__PURE__ */ g(Xt, { size: 10 })
3665
+ children: /* @__PURE__ */ C(nn, { size: 10 })
2836
3666
  }
2837
3667
  )
2838
- ] }, C)) }),
2839
- /* @__PURE__ */ x("div", { style: { display: "flex", gap: "8px" }, children: [
2840
- /* @__PURE__ */ g(
3668
+ ] }, N)) }),
3669
+ /* @__PURE__ */ A("div", { style: { display: "flex", gap: "8px" }, children: [
3670
+ /* @__PURE__ */ C(
2841
3671
  "input",
2842
3672
  {
2843
3673
  type: "file",
2844
- ref: yt,
3674
+ ref: It,
2845
3675
  style: { display: "none" },
2846
3676
  accept: "image/*",
2847
- onChange: pi
3677
+ onChange: Mn
2848
3678
  }
2849
3679
  ),
2850
- /* @__PURE__ */ x(
3680
+ d ? /* @__PURE__ */ A(
2851
3681
  "button",
2852
3682
  {
2853
- onClick: () => xt("full"),
3683
+ onClick: () => At("full"),
2854
3684
  style: {
2855
3685
  flex: 1,
2856
3686
  padding: "12px",
@@ -2868,22 +3698,22 @@ const Yn = [
2868
3698
  minWidth: "60px"
2869
3699
  // Prevent squishing
2870
3700
  },
2871
- onMouseOver: (p) => {
2872
- p.currentTarget.style.borderColor = o, p.currentTarget.style.color = o, p.currentTarget.style.backgroundColor = "#f9fafb";
3701
+ onMouseOver: (x) => {
3702
+ x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
2873
3703
  },
2874
- onMouseOut: (p) => {
2875
- p.currentTarget.style.borderColor = "#d1d5db", p.currentTarget.style.color = "#4b5563", p.currentTarget.style.backgroundColor = "white";
3704
+ onMouseOut: (x) => {
3705
+ x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
2876
3706
  },
2877
3707
  children: [
2878
- /* @__PURE__ */ g(qn, { size: 18 }),
2879
- /* @__PURE__ */ g("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Toàn màn hình" })
3708
+ /* @__PURE__ */ C(so, { size: 18 }),
3709
+ /* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Toàn màn hình" })
2880
3710
  ]
2881
3711
  }
2882
- ),
2883
- /* @__PURE__ */ x(
3712
+ ) : /* @__PURE__ */ C(Ae, {}),
3713
+ p ? /* @__PURE__ */ A(
2884
3714
  "button",
2885
3715
  {
2886
- onClick: () => xt("crop"),
3716
+ onClick: () => At("crop"),
2887
3717
  className: "fb-btn-crop",
2888
3718
  style: {
2889
3719
  flex: 1,
@@ -2901,22 +3731,22 @@ const Yn = [
2901
3731
  transition: "all 0.2s",
2902
3732
  minWidth: "60px"
2903
3733
  },
2904
- onMouseOver: (p) => {
2905
- p.currentTarget.style.borderColor = o, p.currentTarget.style.color = o, p.currentTarget.style.backgroundColor = "#f9fafb";
3734
+ onMouseOver: (x) => {
3735
+ x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
2906
3736
  },
2907
- onMouseOut: (p) => {
2908
- p.currentTarget.style.borderColor = "#d1d5db", p.currentTarget.style.color = "#4b5563", p.currentTarget.style.backgroundColor = "white";
3737
+ onMouseOut: (x) => {
3738
+ x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
2909
3739
  },
2910
3740
  children: [
2911
- /* @__PURE__ */ g(zn, { size: 18 }),
2912
- /* @__PURE__ */ g("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn vùng" })
3741
+ /* @__PURE__ */ C(Qr, { size: 18 }),
3742
+ /* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn vùng" })
2913
3743
  ]
2914
3744
  }
2915
- ),
2916
- /* @__PURE__ */ x(
3745
+ ) : /* @__PURE__ */ C(Ae, {}),
3746
+ /* @__PURE__ */ A(
2917
3747
  "button",
2918
3748
  {
2919
- onClick: fi,
3749
+ onClick: Nn,
2920
3750
  className: "fb-btn-upload",
2921
3751
  style: {
2922
3752
  flex: 1,
@@ -2934,26 +3764,26 @@ const Yn = [
2934
3764
  transition: "all 0.2s",
2935
3765
  minWidth: "60px"
2936
3766
  },
2937
- onMouseOver: (p) => {
2938
- p.currentTarget.style.borderColor = o, p.currentTarget.style.color = o, p.currentTarget.style.backgroundColor = "#f9fafb";
3767
+ onMouseOver: (x) => {
3768
+ x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
2939
3769
  },
2940
- onMouseOut: (p) => {
2941
- p.currentTarget.style.borderColor = "#d1d5db", p.currentTarget.style.color = "#4b5563", p.currentTarget.style.backgroundColor = "white";
3770
+ onMouseOut: (x) => {
3771
+ x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
2942
3772
  },
2943
3773
  children: [
2944
- /* @__PURE__ */ g($n, { size: 18 }),
2945
- /* @__PURE__ */ g("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn ảnh" })
3774
+ /* @__PURE__ */ C(eo, { size: 18 }),
3775
+ /* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn ảnh" })
2946
3776
  ]
2947
3777
  }
2948
3778
  )
2949
3779
  ] })
2950
3780
  ] }),
2951
- /* @__PURE__ */ x("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px", marginTop: "auto", paddingTop: "8px", borderTop: "1px solid #f3f4f6" }, children: [
2952
- /* @__PURE__ */ g(
3781
+ /* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px", marginTop: "auto", paddingTop: "8px", borderTop: "1px solid #f3f4f6" }, children: [
3782
+ /* @__PURE__ */ C(
2953
3783
  "button",
2954
3784
  {
2955
- onClick: Ge,
2956
- disabled: ne,
3785
+ onClick: rt,
3786
+ disabled: _,
2957
3787
  style: {
2958
3788
  padding: "8px 16px",
2959
3789
  borderRadius: "8px",
@@ -2965,74 +3795,73 @@ const Yn = [
2965
3795
  fontSize: "0.85rem",
2966
3796
  transition: "background-color 0.2s"
2967
3797
  },
2968
- onMouseEnter: (p) => p.currentTarget.style.background = "#f9fafb",
2969
- onMouseLeave: (p) => p.currentTarget.style.background = "white",
3798
+ onMouseEnter: (x) => x.currentTarget.style.background = "#f9fafb",
3799
+ onMouseLeave: (x) => x.currentTarget.style.background = "white",
2970
3800
  children: "Hủy bỏ"
2971
3801
  }
2972
3802
  ),
2973
- /* @__PURE__ */ g(
3803
+ /* @__PURE__ */ C(
2974
3804
  "button",
2975
3805
  {
2976
- onClick: yi,
2977
- disabled: ne,
3806
+ onClick: Ln,
3807
+ disabled: _,
2978
3808
  style: {
2979
3809
  padding: "8px 16px",
2980
3810
  borderRadius: "8px",
2981
3811
  border: "none",
2982
- background: o,
3812
+ background: i,
2983
3813
  color: "white",
2984
- cursor: ne ? "not-allowed" : "pointer",
3814
+ cursor: _ ? "not-allowed" : "pointer",
2985
3815
  fontWeight: 600,
2986
3816
  fontSize: "0.85rem",
2987
- opacity: ne ? 0.7 : 1,
3817
+ opacity: _ ? 0.7 : 1,
2988
3818
  boxShadow: "0 2px 4px -1px rgba(0, 0, 0, 0.1)",
2989
3819
  transition: "transform 0.1s, opacity 0.2s"
2990
3820
  },
2991
- onMouseDown: (p) => !ne && (p.currentTarget.style.transform = "scale(0.98)"),
2992
- onMouseUp: (p) => !ne && (p.currentTarget.style.transform = "scale(1)"),
2993
- children: ne ? /* @__PURE__ */ x("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
2994
- /* @__PURE__ */ g(Wn, { size: 16, style: { animation: "fb-spin 1s linear infinite" } }),
2995
- /* @__PURE__ */ g("span", { children: "Đang gửi..." })
3821
+ onMouseDown: (x) => !_ && (x.currentTarget.style.transform = "scale(0.98)"),
3822
+ onMouseUp: (x) => !_ && (x.currentTarget.style.transform = "scale(1)"),
3823
+ children: _ ? /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
3824
+ /* @__PURE__ */ C(no, { size: 16, style: { animation: "fb-spin 1s linear infinite" } }),
3825
+ /* @__PURE__ */ C("span", { children: "Đang gửi..." })
2996
3826
  ] }) : "Gửi báo lỗi"
2997
3827
  }
2998
3828
  )
2999
3829
  ] })
3000
3830
  ] })
3001
3831
  ] });
3002
- }, di = vi(void 0), ir = () => {
3003
- const e = ki(di);
3832
+ }, In = Un(void 0), wo = () => {
3833
+ const e = zn(In);
3004
3834
  if (!e)
3005
3835
  throw new Error("useFeedback must be used within a FeedbackProvider");
3006
3836
  return e;
3007
- }, nr = ({
3837
+ }, bo = ({
3008
3838
  children: e,
3009
3839
  onSubmit: t,
3010
- themeColor: i
3840
+ themeColor: n
3011
3841
  }) => {
3012
- const [n, o] = T(!1), [s, r] = T(null), [h, f] = T(""), [b, m] = T(void 0), k = ($, O, y) => {
3013
- r($), f(O || ""), m(y), o(!0);
3014
- }, R = () => {
3015
- o(!1);
3842
+ const [i, a] = F(!1), [o, r] = F(null), [s, d] = F(void 0), p = (m, b) => {
3843
+ r(m), d(b), a(!0);
3844
+ }, l = () => {
3845
+ a(!1);
3016
3846
  };
3017
- return /* @__PURE__ */ x(di.Provider, { value: { openFeedback: k, closeFeedback: R, isOpen: n, activeQuestionId: s }, children: [
3847
+ return /* @__PURE__ */ A(In.Provider, { value: { openFeedback: p, closeFeedback: l, isOpen: i, activeQuestionId: o }, children: [
3018
3848
  e,
3019
- s && /* @__PURE__ */ g(
3020
- Zn,
3849
+ o && /* @__PURE__ */ C(
3850
+ fo,
3021
3851
  {
3022
- questionId: s,
3023
- questionIdChild: h,
3024
- contextData: b,
3852
+ questionId: o,
3853
+ contextData: s,
3025
3854
  onSubmit: t,
3026
- themeColor: i,
3027
- isOpen: n,
3028
- onClose: R,
3029
- triggerComponent: /* @__PURE__ */ g(nt, {})
3855
+ themeColor: n,
3856
+ isOpen: i,
3857
+ onClose: l,
3858
+ triggerComponent: /* @__PURE__ */ C(Ae, {})
3030
3859
  }
3031
3860
  )
3032
3861
  ] });
3033
3862
  };
3034
3863
  export {
3035
- nr as FeedbackProvider,
3036
- Zn as FeedbackWidget,
3037
- ir as useFeedback
3864
+ bo as FeedbackProvider,
3865
+ fo as FeedbackWidget,
3866
+ wo as useFeedback
3038
3867
  };