forked from nettleweb/nettleweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
494 lines (491 loc) · 251 KB
/
main.js
File metadata and controls
494 lines (491 loc) · 251 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
/*! For license information please see out.js.LICENSE.txt */
https://nettleweb.com/
/*! Copyright (C) 2024 nettleweb.com; All rights reserved. !*/
"use strict";
(()=>{function e(){try{return"object"==typeof indexedDB}catch(e){return!1}}function t(){return new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(r);o.onsuccess=()=>{o.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},o.onupgradeneeded=()=>{n=!1},o.onerror=()=>{var e;t((null===(e=o.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}function n(e,t){if(e===t)return!0;const o=Object.keys(e),a=Object.keys(t)
;for(const i of o){if(!a.includes(i))return!1;const o=e[i],s=t[i];if(r(o)&&r(s)){if(!n(o,s))return!1}else if(o!==s)return!1}for(const e of a)if(!o.includes(e))return!1;return!0}function r(e){return null!==e&&"object"==typeof e}function o(e,t=1e3,n=2){const r=t*Math.pow(n,e),o=Math.round(.5*r*(Math.random()-.5)*2);return Math.min(144e5,r+o)}function a(e){return e&&e._delegate?e._delegate:e}function i(e){
return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Ft||(Ft=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(zt(this),t),c(Dt.get(this))}:function(...t){return c(e.apply(zt(this),t))}:function(t,...n){const r=e.call(zt(this),t,...n);return Ut.set(r,t.sort?t.sort():[t]),c(r)}}function s(e){return"function"==typeof e?i(e):(e instanceof IDBTransaction&&function(e){
if(Nt.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",a),e.removeEventListener("abort",a)},o=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",a),e.addEventListener("abort",a)}));Nt.set(e,t)}(e),t=e,(_t||(_t=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,Rt):e);var t}
function c(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",a)},o=()=>{t(c(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&Dt.set(t,e)})).catch((()=>{})),Ht.set(t,e),t}(e);if(Bt.has(e))return Bt.get(e);const t=s(e);return t!==e&&(Bt.set(e,t),Ht.set(t,e)),t}
function l(e,t,{blocked:n,upgrade:r,blocking:o,terminated:a}={}){const i=indexedDB.open(e,t),s=c(i);return r&&i.addEventListener("upgradeneeded",(e=>{r(c(i.result),e.oldVersion,e.newVersion,c(i.transaction),e)})),n&&i.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),o&&e.addEventListener("versionchange",(e=>o(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}function d(e,t){
if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Vt.get(t))return Vt.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=qt.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!Wt.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,o?"readwrite":"readonly");let i=a.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),o&&a.done]))[0]};return Vt.set(t,a),a}function u(e,t){try{e.container.addComponent(t)}catch(n){
Qt.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function h(e){const t=e.name;if(In.has(t))return Qt.debug(`There were multiple attempts to register component ${t}.`),!1;In.set(t,e);for(const t of Tn.values())u(t,e);for(const t of Ln.values())u(t,e);return!0}function p(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function f(e,t={}){let r=e;"object"!=typeof t&&(t={name:t})
;const o=Object.assign({name:xn,automaticDataCollectionEnabled:!1},t),a=o.name;if("string"!=typeof a||!a)throw Sn.create("bad-app-name",{appName:a+""});if(r||(r=yt()),!r)throw Sn.create("no-options");const i=Tn.get(a);if(i){if(n(r,i.options)&&n(o,i.config))return i;throw Sn.create("duplicate-app",{appName:a})}const s=new Tt(a);for(const e of In.values())s.addComponent(e);const c=new Mn(r,o,s);return Tn.set(a,c),c}function m(e,t,n){var r;let o=null!==(r=An[e])&&void 0!==r?r:e;n&&(o+="-"+n)
;const a=o.match(/\s|\//),i=t.match(/\s|\//);if(a||i){const e=[`Unable to register library "${o}" with version "${t}":`];return a&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Qt.warn(e.join(" "))}h(new Et(o+"-version",(()=>({library:o,version:t})),"VERSION"))}function g(){return On||(On=l("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{
e.createObjectStore(jn)}catch(e){}}}).catch((e=>{throw Sn.create("idb-open",{originalErrorMessage:e.message})}))),On}async function b(e,t){try{const n=(await g()).transaction(jn,"readwrite"),r=n.objectStore(jn);await r.put(t,y(e)),await n.done}catch(e){if(e instanceof wt)Qt.warn(e.message);else{const t=Sn.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Qt.warn(t.message)}}}function y(e){return`${e.name}!${e.options.appId}`}function v(){
return(new Date).toISOString().substring(0,10)}function w(e){return ft(JSON.stringify({version:2,heartbeats:e})).length}function k(e){return e instanceof wt&&e.code.includes("request-failed")}function C({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function E(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function x(e,t){const n=(await t.json()).error
;return Rn.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function A({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function T(e,{refreshToken:t}){const n=A(e);return n.append("Authorization",function(e){return`${Hn} ${e}`}(t)),n}async function L(e){const t=await e();return t.status>=500&&t.status<600?e():t}function I(e){return new Promise((t=>{setTimeout(t,e)}))}
function S(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return zn.test(t)?t:""}catch(e){return""}}function M(e){return`${e.appName}!${e.appId}`}function j(e,t){const n=M(e);O(n,t),function(e,t){const n=P();n&&n.postMessage({key:e,fid:t}),_()}(n,t)}function O(e,t){const n=Wn.get(e);if(n)for(const e of n)e(t)}
function P(){return!qn&&"BroadcastChannel"in self&&(qn=new BroadcastChannel("[Firebase] FID Change"),qn.onmessage=e=>{O(e.data.key,e.data.fid)}),qn}function _(){0===Wn.size&&qn&&(qn.close(),qn=null)}function F(){return Gn||(Gn=l("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Vn)}})),Gn}async function D(e,t){const n=M(e),r=(await F()).transaction(Vn,"readwrite"),o=r.objectStore(Vn),a=await o.get(n);return await o.put(t,n),await r.done,a&&a.fid===t.fid||j(e,t.fid),
t}async function N(e){const t=M(e),n=(await F()).transaction(Vn,"readwrite");await n.objectStore(Vn).delete(t),await n.done}async function U(e,t){const n=M(e),r=(await F()).transaction(Vn,"readwrite"),o=r.objectStore(Vn),a=await o.get(n),i=t(a);return void 0===i?await o.delete(n):await o.put(i,n),await r.done,!i||a&&a.fid===i.fid||j(e,i.fid),i}async function B(e){let t;const n=await U(e.appConfig,(n=>{const r=function(e){const t=e||{fid:S(),registrationStatus:0};return z(t)}(n),o=function(e,t){
if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(Rn.create("app-offline"))};const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=C(e),o=A(e),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const i={fid:n,authVersion:Hn,appId:e.appId,
sdkVersion:Bn},s={method:"POST",headers:o,body:JSON.stringify(i)},c=await L((()=>fetch(r,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:E(e.authToken)}}throw await x("Create Installation",c)}(e,t);return D(e.appConfig,n)}catch(n){throw k(n)&&409===n.customData.serverCode?await N(e.appConfig):await D(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}
return 1===t.registrationStatus?{installationEntry:t,registrationPromise:H(e)}:{installationEntry:t}}(e,r);return t=o.registrationPromise,o.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function H(e){let t=await R(e.appConfig);for(;1===t.registrationStatus;)await I(100),t=await R(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await B(e);return n||t}return t}function R(e){
return U(e,(e=>{if(!e)throw Rn.create("installation-not-found");return z(e)}))}function z(e){return 1===(t=e).registrationStatus&&t.registrationTime+Un<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function W({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${C(e)}/${t}/authTokens:generate`}(e,n),o=T(e,n),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const i={installation:{sdkVersion:Bn,
appId:e.appId}},s={method:"POST",headers:o,body:JSON.stringify(i)},c=await L((()=>fetch(r,s)));if(c.ok)return E(await c.json());throw await x("Generate Auth Token",c)}async function q(e,t=!1){let n;const r=await U(e.appConfig,(r=>{if(!G(r))throw Rn.create("not-registered");const o=r.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(o))return r
;if(1===o.requestStatus)return n=async function(e,t){let n=await V(e.appConfig);for(;1===n.authToken.requestStatus;)await I(100),n=await V(e.appConfig);const r=n.authToken;return 0===r.requestStatus?q(e,t):r}(e,t),r;{if(!navigator.onLine)throw Rn.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(r);return n=async function(e,t){try{const n=await W(e,t),r=Object.assign(Object.assign({},t),{authToken:n
});return await D(e.appConfig,r),n}catch(n){if(!k(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await D(e.appConfig,n)}else await N(e.appConfig);throw n}}(e,t),t}}));return n?await n:r.authToken}function V(e){return U(e,(e=>{if(!G(e))throw Rn.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+Un<Date.now()?Object.assign(Object.assign({},e),{authToken:{
requestStatus:0}}):e;var n}))}function G(e){return void 0!==e&&2===e.registrationStatus}async function K(e,t=!1){const n=e;return await async function(e){const{registrationPromise:t}=await B(e);t&&await t}(n),(await q(n,t)).token}function Y(e){return Rn.create("missing-app-config-values",{valueName:e})}function Z(e){if(!e.startsWith(Qn)){const t=Jn.create("invalid-gtag-resource",{gtagURL:e});return Xn.warn(t.message),""}return e}function Q(e){return Promise.all(e.map((e=>e.catch((e=>e)))))}
function X(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Z}),r=document.createElement("script"),o=`${Qn}?l=${e}&id=${t}`;r.src=n?null==n?void 0:n.createScriptURL(o):o,r.async=!0,document.head.appendChild(r)}function J(e,t,n,r){return async function(o,...a){try{if("event"===o){const[r,o]=a;await async function(e,t,n,r,o){try{let a=[];if(o&&o.send_to){let e=o.send_to;Array.isArray(e)||(e=[e])
;const r=await Q(n);for(const n of e){const e=r.find((e=>e.measurementId===n)),o=e&&t[e.appId];if(!o){a=[];break}a.push(o)}}0===a.length&&(a=Object.values(t)),await Promise.all(a),e("event",r,o||{})}catch(e){Xn.error(e)}}(e,t,n,r,o)}else if("config"===o){const[o,i]=a;await async function(e,t,n,r,o,a){const i=r[o];try{if(i)await t[i];else{const e=(await Q(n)).find((e=>e.measurementId===o));e&&await t[e.appId]}}catch(e){Xn.error(e)}e("config",o,a)}(e,t,n,r,o,i)}else if("consent"===o){const[t,n]=a
;e("consent",t,n)}else if("get"===o){const[t,n,r]=a;e("get",t,n,r)}else if("set"===o){const[t]=a;e("set",t)}else e(o,...a)}catch(e){Xn.error(e)}}}function $(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function ee(e,t=$n,n){const{appId:r,apiKey:o,measurementId:a}=e.options;if(!r)throw Jn.create("no-app-id");if(!o){if(a)return{measurementId:a,appId:r};throw Jn.create("no-api-key")}const i=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()
},s=new er;return setTimeout((async()=>{s.abort()}),void 0!==n?n:6e4),te({appId:r,apiKey:o,measurementId:a},i,s,t)}async function te(e,{throttleEndTimeMillis:t,backoffCount:n},r,a=$n){var i;const{appId:s,measurementId:c}=e;try{await function(e,t){return new Promise(((n,r)=>{const o=Math.max(t-Date.now(),0),a=setTimeout(n,o);e.addEventListener((()=>{clearTimeout(a),r(Jn.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(r,t)}catch(e){
if(c)return Xn.warn("Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID "+c+` provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:s,measurementId:c};throw e}try{const t=await async function(e){var t;const{appId:n,apiKey:r}=e,o={method:"GET",headers:$(r)},a="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig".replace("{app-id}",n),i=await fetch(a,o)
;if(200!==i.status&&304!==i.status){let e="";try{const n=await i.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}throw Jn.create("config-fetch-failed",{httpStatus:i.status,responseMessage:e})}return i.json()}(e);return a.deleteThrottleMetadata(s),t}catch(t){const l=t;if(!function(e){if(!(e instanceof wt&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(l)){if(a.deleteThrottleMetadata(s),
c)return Xn.warn("Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID "+c+` provided in the "measurementId" field in the local Firebase config. [${null==l?void 0:l.message}]`),{appId:s,measurementId:c};throw t}const d=503===Number(null===(i=null==l?void 0:l.customData)||void 0===i?void 0:i.httpStatus)?o(n,a.intervalMillis,30):o(n,a.intervalMillis),u={throttleEndTimeMillis:Date.now()+d,backoffCount:n+1};return a.setThrottleMetadata(s,u),
Xn.debug(`Calling attemptFetch again in ${d} millis`),te(e,u,r,a)}}function ne(e){nr=e}function re(e){tr=e}async function oe(n,r,o,a,i,s,c){var l;const d=ee(n);d.then((e=>{o[e.measurementId]=e.appId,
n.options.measurementId&&e.measurementId!==n.options.measurementId&&Xn.warn(`The measurement ID in the local Firebase config (${n.options.measurementId}) does not match the measurement ID fetched from the server (${e.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)})).catch((e=>Xn.error(e))),r.push(d);const u=async function(){
if(!e())return Xn.warn(Jn.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await t()}catch(e){return Xn.warn(Jn.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?a.getId():void 0)),[h,p]=await Promise.all([d,u]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(Qn)&&n.src.includes(e))return n;return null
})(s)||X(s,h.measurementId),nr&&(i("consent","default",nr),ne(void 0)),i("js",new Date);const f=null!==(l=null==c?void 0:c.config)&&void 0!==l?l:{};return f.origin="firebase",f.update=!0,null!=p&&(f.firebase_id=p),i("config",h.measurementId,f),tr&&(i("set",tr),re(void 0)),h.measurementId}function ae(){const e=[];if(function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id
}()&&e.push("This is a browser extension environment."),"undefined"!=typeof navigator&&navigator.cookieEnabled||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=Jn.create("invalid-analytics-context",{errorInfo:t});Xn.warn(n.message)}}function ie(e,t,n){ae();const r=e.options.appId;if(!r)throw Jn.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Jn.create("no-api-key")
;Xn.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+e.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}if(null!=or[r])throw Jn.create("already-exists",{id:r});if(!ur){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(lr);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,r,o){let a=function(){
window[r].push(arguments)};return window[o]&&"function"==typeof window[o]&&(a=window[o]),window[o]=J(a,e,t,n),{gtagCore:a,wrappedGtag:window[o]}}(or,ar,ir,lr,dr);cr=e,sr=t,ur=!0}return or[r]=oe(e,ar,ir,t,sr,lr,n),new rr(e)}function se(e=function(e=xn){const t=Tn.get(e);if(!t&&e===xn&&yt())return f();if(!t)throw Sn.create("no-app",{appName:e});return t}()){const t=p(e=a(e),Zn);return t.isInitialized()?t.getImmediate():function(e,t={}){const r=p(e,Zn);if(r.isInitialized()){const e=r.getImmediate()
;if(n(t,r.getOptions()))return e;throw Jn.create("already-initialized")}const o=r.initialize({options:t});return o}(e)}function ce(e,t,n,r){e=a(e),async function(e,t,n,r,o){if(o&&o.global)e("event",n,r);else{const o=await t;e("event",n,Object.assign(Object.assign({},r),{send_to:o}))}}(cr,or[e.app.options.appId],t,n,r).catch((e=>Xn.error(e)))}function le(e){if("string"!=typeof e||!e)throw Error("expected a non-empty string, got: "+e)}function de(e){
if("number"!=typeof e)throw Error("expected a number, got: "+e)}function ue(e){return function(e,t){const n=new Set,r=[];for(const o of e){const e=t(o);n.has(e)||(n.add(e),r.push(o))}return r}(e,(e=>e.unicode))}function he(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function pe(e){const t=await new Promise(((t,n)=>{const r=indexedDB.open(e,1);Tr[e]=r,r.onupgradeneeded=e=>{e.oldVersion<1&&function(e){function t(t,n,r){
const o=n?e.createObjectStore(t,{keyPath:n}):e.createObjectStore(t);if(r)for(const[e,[t,n]]of Object.entries(r))o.createIndex(e,t,{multiEntry:n});return o}t(mr),t(fr,"unicode",{[br]:["tokens",!0],[vr]:[["group","order"]],[Ar]:["skinUnicodes",!0]}),t(gr,void 0,{[yr]:[""]})}(r.result)},he(t,n,r)}));return t.onclose=()=>me(e),t}function fe(e,t,n,r){return new Promise(((o,a)=>{const i=e.transaction(t,n,{durability:"relaxed"}),s="string"==typeof t?i.objectStore(t):t.map((e=>i.objectStore(e)));let c
;r(s,i,(e=>{c=e})),i.oncomplete=()=>o(c),i.onerror=()=>a(i.error)}))}function me(e){const t=Tr[e],n=t&&t.result;if(n){n.close();const t=Ir[e];if(t)for(const e of t)e()}delete Tr[e],delete Lr[e],delete Ir[e]}function ge(e){return e.split(/[\s_]+/).map((e=>!e.match(/\w/)||Sr.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/\u2019/g,"'").toLowerCase())).filter(Boolean)}function be(e){return e.filter(Boolean).map((e=>e.toLowerCase())).filter((e=>e.length>=2))}function ye(e,t,n,r){
e[t](n).onsuccess=e=>r&&r(e.target.result)}function ve(e,t,n){ye(e,"get",t,n)}function we(e,t,n){ye(e,"getAll",t,n)}function ke(e){e.commit&&e.commit()}function Ce(e,t){const n=function(e,t){let n=e[0];for(let r=1;r<e.length;r++){const o=e[r];t(n)>t(o)&&(n=o)}return n}(e,(e=>e.length)),r=[];for(const o of n)e.some((e=>-1===e.findIndex((e=>t(e)===t(o)))))||r.push(o);return r}async function Ee(e,t,n,r){try{const o=function(e){
const t=e.map((({annotation:e,emoticon:t,group:n,order:r,shortcodes:o,skins:a,tags:i,emoji:s,version:c})=>{const l={annotation:e,group:n,order:r,tags:i,tokens:[...new Set(be([...(o||[]).map(ge).flat(),...(i||[]).map(ge).flat(),...ge(e),t]))].sort(),unicode:s,version:c};if(t&&(l.emoticon=t),o&&(l.shortcodes=o),a){l.skinTones=[],l.skinUnicodes=[],l.skinVersions=[];for(const{tone:e,emoji:t,version:n}of a)l.skinTones.push(e),l.skinUnicodes.push(t),l.skinVersions.push(n)}return l}));return t}(t)
;await fe(e,[fr,mr],xr,(([e,t],a)=>{function i(){2==++l&&function(){if(s!==r||c!==n){e.clear();for(const t of o)e.put(t);t.put(r,wr),t.put(n,kr),ke(a)}}()}let s,c,l=0;ve(t,wr,(e=>{s=e,i()})),ve(t,kr,(e=>{c=e,i()}))}))}finally{}}async function xe(e,t){const n=be(ge(t));return n.length?fe(e,fr,Er,((e,t,r)=>{const o=[],a=()=>{const e=Ce(o,(e=>e.unicode));r(e.sort(((e,t)=>e.order<t.order?-1:1)))};for(let t=0;t<n.length;t++){
const r=n[t],i=t===n.length-1?IDBKeyRange.bound(r,r+"\uffff",!1,!0):IDBKeyRange.only(r);we(e.index(br),i,(e=>{o.push(e),o.length===n.length&&a()}))}})):[]}async function Ae(e,t){const n=await xe(e,t);if(!n.length){const n=e=>(e.shortcodes||[]).includes(t.toLowerCase());return await async function(e,t){return fe(e,fr,Er,((e,n,r)=>{let o;const a=()=>{e.getAll(o&&IDBKeyRange.lowerBound(o,!0),50).onsuccess=e=>{const n=e.target.result;for(const e of n)if(o=e.unicode,t(e))return r(e)
;if(n.length<50)return r();a()}};a()}))}(e,n)||null}return n.filter((e=>{const n=(e.shortcodes||[]).map((e=>e.toLowerCase()));return n.includes(t.toLowerCase())}))[0]||null}function Te(e,t,n){return fe(e,t,Er,((e,t,r)=>ve(e,n,r)))}function Le(e){!function(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||Mr.some((t=>!(t in e[0]))));if(!t||n)throw Error("Custom emojis are in the wrong format")}(e);const t=(e,t)=>e.name.toLowerCase()<t.name.toLowerCase()?-1:1,n=e.sort(t),r=function(e,t){
const n=new Map;for(const r of e){const e=t(r);for(const t of e){let e=n;for(let n=0;n<t.length;n++){const r=t.charAt(n);let o=e.get(r);o||(o=new Map,e.set(r,o)),e=o}let o=e.get("");o||(o=[],e.set("",o)),o.push(r)}}return(e,t)=>{let r=n;for(let t=0;t<e.length;t++){const n=e.charAt(t),o=r.get(n);if(!o)return[];r=o}if(t)return r.get("")||[];const o=[],a=[r];for(;a.length;){const e=[...a.shift().entries()].sort(((e,t)=>e[0]<t[0]?-1:1));for(const[t,n]of e)""===t?o.push(...n):a.push(n)}return o}
}(e,(e=>{const t=new Set;if(e.shortcodes)for(const n of e.shortcodes)for(const e of ge(n))t.add(e);return t})),o=e=>r(e,!0),a=e=>r(e,!1),i=new Map,s=new Map;for(const t of e){s.set(t.name.toLowerCase(),t);for(const e of t.shortcodes||[])i.set(e.toLowerCase(),t)}return{all:n,search:e=>{const n=ge(e),r=n.map(((e,t)=>(t<n.length-1?o:a)(e)));return Ce(r,(e=>e.name)).sort(t)},byShortcode:e=>i.get(e.toLowerCase()),byName:e=>s.get(e.toLowerCase())}}function Ie(e){if(!e)return e
;if(jr&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function Se(e,t){if(2!==Math.floor(e.status/100))throw Error("Failed to fetch: "+t+": "+e.status)}async function Me(e){const t=await fetch(e);Se(t,e);const n=t.headers.get("etag"),r=await t.json();return function(e){
if(!e||!Array.isArray(e)||!e[0]||"object"!=typeof e[0]||Or.some((t=>!(t in e[0]))))throw Error("Emoji data is in the wrong format")}(r),[n,r]}async function je(e){let t=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=-1;++o<t;)r[o]=e.charCodeAt(o);return n}(JSON.stringify(e));const n=function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,o=-1;++o<r;)t+=String.fromCharCode(n[o]);return t}(await crypto.subtle.digest("SHA-1",t));return btoa(n)}async function Oe(e,t){
let n,r=await async function(e){const t=await fetch(e,{method:"HEAD"});Se(t,e);const n=t.headers.get("etag");return n}(t);if(!r){const e=await Me(t);r=e[0],n=e[1],r||(r=await je(n))}await async function(e,t,n){const[r,o]=await Promise.all([wr,kr].map((t=>Te(e,mr,t))));return r===n&&o===t}(e,t,r)||(n||(n=(await Me(t))[1]),await Ee(e,n,t,r))}function Pe(e){return e.unicode.includes("\u200d")}function _e(e){const t=Rr(e,"#000"),n=Rr(e,"#fff");return t&&n&&((e,t)=>{
const n=[...e].join(","),r=[...t].join(",");return n===r&&!n.startsWith("0,0,0,")})(t,n)}function Fe(e){e.preventDefault(),e.stopPropagation()}function De(e,t,n){return(t+=e?-1:1)<0?t=n.length-1:t>=n.length&&(t=0),t}function Ne(e,t){const n=new Set,r=[];for(const o of e){const e=t(o);n.has(e)||(n.add(e),r.push(o))}return r}function Ue(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}function Be(e,t,n){let r=e.get(t);return r||(r=n(),
e.set(t,r)),r}function He(e){return""+e}function Re(e,t){const{targetNode:n}=t;let{targetParentNode:r}=t,o=!1;r?o=function(e,t){let n=e.firstChild,r=0;for(;n;){if(t[r]!==n)return!0;n=n.nextSibling,r++}return r!==t.length}(r,e):(o=!0,t.targetNode=void 0,t.targetParentNode=r=n.parentNode),o&&function(e,t){Xr?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}(r,e)}function ze(e){let t="",n=!1,r=!1,o=-1;const a=new Map,i=[];for(let s=0,c=e.length;s<c;s++){const l=e[s];if(t+=l,s===c-1)break
;for(let e=0;e<l.length;e++)switch(l.charAt(e)){case"<":"/"===l.charAt(e+1)?i.pop():(n=!0,i.push(++o));break;case">":n=!1,r=!1;break;case"=":r=!0}const d=Be(a,i[i.length-1],(()=>[]));let u,h,p;if(r){const t=/(\S+)="?([^"=]*)$/.exec(l);u=t[1],h=t[2],p=/^[^">]*/.exec(e[s+1])[0]}const f={attributeName:u,attributeValuePre:h,attributeValuePost:p,expressionIndex:s};d.push(f),n||r||(t+=" ")}const s=function(e){const t=document.createElement("template");return t.innerHTML=e,t}(t);return{template:s,
elementsToBindings:a}}function We(e,t,n){for(let r=0;r<e.length;r++){const o=e[r],a={binding:o,targetNode:o.attributeName?t:t.firstChild,targetParentNode:void 0,currentExpression:void 0};n.push(a)}}function qe(e){const{template:t,elementsToBindings:n}=Be(Yr,e,(()=>ze(e))),r=t.cloneNode(!0).content.firstElementChild,o=function(e,t){const n=[];let r;if(1===t.size&&(r=t.get(0)))We(r,e,n);else{const r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,a=-1;do{const e=t.get(++a)
;e&&We(e,o,n)}while(o=r.nextNode())}return n}(r,n);return function(e){return function(e,t){for(const n of t){const{targetNode:t,currentExpression:r,binding:{expressionIndex:o,attributeName:a,attributeValuePre:i,attributeValuePost:s}}=n,c=e[o];if(r!==c)if(n.currentExpression=c,a)t.setAttribute(a,i+He(c)+s);else{let e;Array.isArray(c)?Re(c,n):c instanceof Element?(e=c,t.replaceWith(e)):t.nodeValue=He(c),e&&(n.targetNode=e)}}}(e,o),r}}function Ve(e,t,n,r,o,a,i,s,c){function l(e,n,r){
return f(e,((e,o)=>p`<button role="${n?"option":"menuitem"}" aria-selected="${n?o===t.activeSearchItem:""}" aria-label="${d(e,t.currentSkinTone)}" title="${u(e)}" class="${"emoji"+(n&&o===t.activeSearchItem?" active":"")+(e.unicode?"":" custom-emoji")}" id="${`${r}-${e.id}`}" style="${e.unicode?"":`--custom-emoji-background: url(${JSON.stringify(e.url)})`}">${e.unicode?h(e,t.currentSkinTone):""}</button>`),(e=>`${r}-${e.id}`))}
const{labelWithSkin:d,titleForEmoji:u,unicodeWithSkin:h}=n,{html:p,map:f}=function(e){const t=Be(Zr,e,(()=>new Map));let n=Qr;return{map:function(e,t,r){return e.map(((e,o)=>{const a=n;n=r(e);try{return t(e,o)}finally{n=a}}))},html:function(e,...r){const o=Be(t,e,(()=>new Map));return Be(o,n,(()=>qe(e)))(r)}}
}(t),m=p`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!(!t.searchMode||!t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?"emo-"+t.activeSearchItemId:""}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${f(t.skinTones,((e,n)=>p`<div id="skintone-${n}" class="emoji ${n===t.activeSkinTone?"active":""}" aria-selected="${n===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[n]}" aria-label="${t.i18n.skinTones[n]}">${e}</div>`),(e=>e))}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${f(t.groups,(e=>p`<button role="tab" class="nav-button" aria-controls="tab-${e.id}" aria-label="${t.i18n.categories[e.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===e.id}" title="${t.i18n.categories[e.name]}" data-group-id="${e.id}"><div class="nav-emoji emoji">${e.emoji}</div></button>`),(e=>e.id))}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?"":"tab-"+t.currentGroup.id}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${f(t.currentEmojisWithCategories,((e,n)=>p`<div><div id="menu-label-${n}" class="category ${1===t.currentEmojisWithCategories.length&&""===t.currentEmojisWithCategories[0].category?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:e.category?e.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${0===n||t.searchMode||-1!==t.currentGroup.id?"":"visibility-auto"}" style="${"--num-rows: "+Math.ceil(e.emojis.length/t.numColumns)}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${n}" id="${t.searchMode?"search-results":""}">${l(e.emojis,t.searchMode,"emo")}</div></div>`),(e=>e.category))}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${l(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,g=(t,n)=>{
for(const r of e.querySelectorAll(`[${t}]`))n(r,r.getAttribute(t))};if(c){e.appendChild(m);for(const e of["click","focusout","input","keydown","keyup"])g("data-on-"+e,((t,n)=>{t.addEventListener(e,r[n])}));g("data-ref",((e,t)=>{a[t]=e})),i.addEventListener("abort",(()=>{e.removeChild(m)}))}g("data-action",((e,t)=>{let n=s.get(t);n||s.set(t,n=new WeakSet),n.has(e)||(n.add(e),o[t](e))}))}function Ge(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1
;return!0}function Ke(e,t){function n(){const{customEmoji:e,database:t}=h,n=e||eo;t.customEmoji!==n&&(t.customEmoji=n)}function r(e){const t=function(e,t,n){let r=!0;for(const o of e){const e=Ue(n(o));void 0===Gr&&(Gr=Ue(t));const a=e/1.8<Gr;qr.set(o.unicode,a),a||(r=!1)}return r}(e,l.baselineEmoji,g);t?L():h.currentEmojis=[...h.currentEmojis]}function o(e){return!e.unicode||!Pe(e)||qr.get(e.unicode)}async function a(e){const t=h.emojiVersion||await Wr()
;return e.filter((({version:e})=>!e||e<=t))}async function i(e){return function(e,t){const n=e=>{const n={};for(const r of e)"number"==typeof r.tone&&r.version<=t&&(n[r.tone]=r.unicode);return n};return e.map((({unicode:e,skins:t,shortcodes:r,url:o,name:a,category:i,annotation:s})=>({unicode:e,name:a,shortcodes:r,url:o,category:i,annotation:s,id:e||a,skins:t&&n(t)})))}(e,h.emojiVersion||await Wr())}async function s(e){
const t=await h.database.getEmojiByUnicodeOrName(e),n=[...h.currentEmojis,...h.currentFavorites].find((t=>t.id===e)),r=n.unicode&&C(n,h.currentSkinTone);await h.database.incrementFavoriteEmojiCount(e),b("emoji-click",{emoji:t,skinTone:h.currentSkinTone,...r&&{unicode:r},...n.name&&{name:n.name}})}function c(e){h.currentSkinTone=e,h.skinTonePickerExpanded=!1,m("skintone-button"),b("skin-tone-change",{skinTone:e}),h.database.setPreferredSkinTone(e)}
const l={},d=new AbortController,u=d.signal,{state:h,createEffect:p}=function(e){let t,n=!1;const r=new Map,o=new Set;let a;const i=()=>{if(n)return;const e=[...o];o.clear();try{for(const t of e)t()}finally{a=!1,o.size&&(a=!0,Jr(i))}},s=new Proxy({},{get(e,n){if(t){let e=r.get(n);e||(e=new Set,r.set(n,e)),e.add(t)}return e[n]},set(e,t,n){if(e[t]!==n){e[t]=n;const s=r.get(t);if(s){for(const e of s)o.add(e);a||(a=!0,Jr(i))}}return!0}});return e.addEventListener("abort",(()=>{n=!0})),{state:s,
createEffect:e=>{const n=()=>{const r=t;t=n;try{return e()}finally{t=r}};return n()}}}(u),f=new Map;to(h,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),to(h,t),to(h,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,
skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:8,isRtl:!1,currentGroupIndex:0,groups:Fr,databaseLoaded:!1,activeSearchItemId:void 0}),p((()=>{h.currentGroup!==h.groups[h.currentGroupIndex]&&(h.currentGroup=h.groups[h.currentGroupIndex])}));const m=t=>{e.getElementById(t).focus()},g=t=>e.getElementById("emo-"+t.id),b=(e,t)=>{l.rootElement.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0
}))},y=(e,t)=>e.id===t.id,v=(e,t)=>{const{category:n,emojis:r}=e,{category:o,emojis:a}=t;return n===o&&Ge(r,a,y)},w=e=>{Ge(h.currentEmojis,e,y)||(h.currentEmojis=e)},k=e=>{h.searchMode!==e&&(h.searchMode=e)},C=(e,t)=>t&&e.skins&&e.skins[t]||e.unicode,E={labelWithSkin:(e,t)=>{return(n=[e.name||C(e,t),e.annotation,...e.shortcodes||eo].filter(Boolean),Ne(n,(e=>e))).join(", ");var n},titleForEmoji:e=>e.annotation||(e.shortcodes||eo).join(", "),unicodeWithSkin:C},x={onClickSkinToneButton:function(e){
h.skinTonePickerExpanded=!h.skinTonePickerExpanded,h.activeSkinTone=h.currentSkinTone,h.skinTonePickerExpanded&&(Fe(e),Vr((()=>m("skintone-list"))))},onEmojiClick:async function(e){const{target:t}=e;t.classList.contains("emoji")&&(Fe(e),s(t.id.substring(4)))},onNavClick:function(e){const{target:t}=e,n=t.closest(".nav-button");if(!n)return;const r=parseInt(n.dataset.groupId,10);l.searchElement.value="",h.rawSearchText="",h.searchText="",h.activeSearchItem=-1,
h.currentGroupIndex=h.groups.findIndex((e=>e.id===r))},onNavKeydown:function(e){const{target:t,key:n}=e,r=t=>{t&&(Fe(e),t.focus())};switch(n){case"ArrowLeft":return r(t.previousElementSibling);case"ArrowRight":return r(t.nextElementSibling);case"Home":return r(t.parentElement.firstElementChild);case"End":return r(t.parentElement.lastElementChild)}},onSearchKeydown:function(e){if(!h.searchMode||!h.currentEmojis.length)return;const t=t=>{Fe(e),
h.activeSearchItem=De(t,h.activeSearchItem,h.currentEmojis)};switch(e.key){case"ArrowDown":return t(!1);case"ArrowUp":return t(!0);case"Enter":if(-1!==h.activeSearchItem)return Fe(e),s(h.currentEmojis[h.activeSearchItem].id);h.activeSearchItem=0}},onSkinToneOptionsClick:function(e){const{target:{id:t}}=e,n=t&&t.match(/^skintone-(\d)/);n&&(Fe(e),c(parseInt(n[1],10)))},onSkinToneOptionsFocusOut:async function(e){const{relatedTarget:t}=e;t&&"skintone-list"===t.id||(h.skinTonePickerExpanded=!1)},
onSkinToneOptionsKeydown:function(e){if(!h.skinTonePickerExpanded)return;const t=async t=>{Fe(e),h.activeSkinTone=t};switch(e.key){case"ArrowUp":return t(De(!0,h.activeSkinTone,h.skinTones));case"ArrowDown":return t(De(!1,h.activeSkinTone,h.skinTones));case"Home":return t(0);case"End":return t(h.skinTones.length-1);case"Enter":return Fe(e),c(h.activeSkinTone);case"Escape":return Fe(e),h.skinTonePickerExpanded=!1,m("skintone-button")}},onSkinToneOptionsKeyup:function(e){
if(h.skinTonePickerExpanded)return" "===e.key?(Fe(e),c(h.activeSkinTone)):void 0},onSearchInput:function(e){h.rawSearchText=e.target.value}},A={calculateEmojiGridStyle:function(e){!function(e,t,n){let r;Kr?(r=new ResizeObserver(n),r.observe(e)):Vr(n),t.addEventListener("abort",(()=>{r&&r.disconnect()}))}(e,u,(()=>{{const e=getComputedStyle(l.rootElement),t=parseInt(e.getPropertyValue("--num-columns"),10),n="rtl"===e.getPropertyValue("direction");h.numColumns=t,h.isRtl=n}}))},
updateOnIntersection:function(e){!function(e,t,n){{const r=e.closest(".tabpanel");let o=$r.get(r);o||(o=new IntersectionObserver(n,{root:r,rootMargin:"50% 0px 50% 0px",threshold:0}),$r.set(r,o),t.addEventListener("abort",(()=>{o.disconnect()}))),o.observe(e)}}(e,u,(e=>{for(const{target:t,isIntersecting:n}of e)t.classList.toggle("onscreen",n)}))}};let T=!0;p((()=>{Ve(e,h,E,x,A,l,u,f,T),T=!1})),h.emojiVersion||Wr().then((e=>{e||(h.message=h.i18n.emojiUnsupportedMessage)})),p((()=>{
h.database&&async function(){let e=!1;const t=setTimeout((()=>{e=!0,h.message=h.i18n.loadingMessage}),1e3);try{await h.database.ready(),h.databaseLoaded=!0}catch(e){h.message=h.i18n.networkErrorMessage}finally{clearTimeout(t),e&&(e=!1,h.message="")}}()})),p((()=>{h.pickerStyle=`\n --num-groups: ${h.groups.length}; \n --indicator-opacity: ${h.searchMode?0:1}; \n --num-skintones: 6;`})),p((()=>{h.customEmoji&&h.database&&n()})),p((()=>{
h.customEmoji&&h.customEmoji.length?h.groups!==_r&&(h.groups=_r):h.groups!==Fr&&(h.currentGroupIndex&&h.currentGroupIndex--,h.groups=Fr)})),p((()=>{!async function(){h.databaseLoaded&&(h.currentSkinTone=await h.database.getPreferredSkinTone())}()})),p((()=>{h.skinTones=[,,,,,,].fill().map(((e,t)=>function(e,t){if(0===t)return e;const n=e.indexOf("\u200d");return-1!==n?e.substring(0,n)+String.fromCodePoint(127995+t-1)+e.substring(n):(e.endsWith("\ufe0f")&&(e=e.substring(0,e.length-1)),
e+"\ud83c"+String.fromCodePoint(57339+t-1))}(h.skinToneEmoji,t)))})),p((()=>{h.skinToneButtonText=h.skinTones[h.currentSkinTone]})),p((()=>{h.skinToneButtonLabel=h.i18n.skinToneLabel.replace("{skinTone}",h.i18n.skinTones[h.currentSkinTone])})),p((()=>{h.databaseLoaded&&async function(){const{database:e}=h,t=(await Promise.all(Ur.map((t=>e.getEmojiByUnicodeOrName(t))))).filter(Boolean);h.defaultFavoriteEmojis=t}()})),p((()=>{h.databaseLoaded&&h.defaultFavoriteEmojis&&async function(){n()
;const{database:e,defaultFavoriteEmojis:t,numColumns:r}=h,o=await e.getTopFavoriteEmoji(r),a=await i(Ne([...o,...t],(e=>e.unicode||e.name)).slice(0,r));h.currentFavorites=a}()})),p((()=>{!async function(){const{searchText:e,currentGroup:t,databaseLoaded:n,customEmoji:r}=h;if(n)if(e.length>=2){const t=await async function(e){return i(await a(await h.database.getEmojiBySearchQuery(e)))}(e);h.searchText===e&&(w(t),k(!0))}else{const{id:e}=t;if(-1!==e||r&&r.length){const t=await async function(e){
const t=-1===e?h.customEmoji:await h.database.getEmojiByGroup(e);return i(await a(t))}(e);h.currentGroup.id===e&&(w(t),k(!1))}}else h.currentEmojis=[],h.searchMode=!1}()}));const L=()=>{Vr((()=>{var e;(e=l.tabpanelElement)&&(e.scrollTop=0)}))};return p((()=>{const{currentEmojis:e,emojiVersion:t}=h,n=e.filter((e=>e.unicode)).filter((e=>Pe(e)&&!qr.has(e.unicode)));if(!t&&n.length)w(e),Vr((()=>r(n)));else{const n=t?e:e.filter(o);w(n),L()}})),p((()=>{})),p((()=>{const e=function(){
const{searchMode:e,currentEmojis:t}=h;if(e)return[{category:"",emojis:t}];const n=new Map;for(const e of t){const t=e.category||"";let r=n.get(t);r||(r=[],n.set(t,r)),r.push(e)}return[...n.entries()].map((([e,t])=>({category:e,emojis:t}))).sort(((e,t)=>h.customCategorySorting(e.category,t.category)))}();(e=>{Ge(h.currentEmojisWithCategories,e,v)||(h.currentEmojisWithCategories=e)})(e)})),p((()=>{h.activeSearchItemId=-1!==h.activeSearchItem&&h.currentEmojis[h.activeSearchItem].id})),p((()=>{
const{rawSearchText:e}=h;Dr((()=>{h.searchText=(e||"").trim(),h.activeSearchItem=-1}))})),p((()=>{h.skinTonePickerExpanded?l.skinToneDropdown.addEventListener("transitionend",(()=>{h.skinTonePickerExpandedAfterAnimation=!0}),{once:!0}):h.skinTonePickerExpandedAfterAnimation=!1})),{$set(e){to(h,e)},$destroy(){d.abort()}}}function Ye(e){try{return new DataView(e,0,0),!0}catch(e){return!1}}function Ze(e){return ArrayBuffer.isView(e)&&"Uint8Array"===e[Symbol.toStringTag]}function Qe(){
return Math.floor(4294967296*Math.random())}function Xe(e,t){return yi(e,{i:2},t&&t.out,t&&t.dictionary)}function Je(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function $e(){return new TransformStream({transform(e,t){!function(e,t){Fi&&e.data instanceof Blob?e.data.arrayBuffer().then(Je).then(t):Di&&(e.data instanceof ArrayBuffer||Ni(e.data))?t(Je(e.data)):Ui(e,!1,(e=>{Hi||(Hi=new TextEncoder),t(Hi.encode(e))
}))}(e,(n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}function et(e){return e.reduce(((e,t)=>e+t.length),0)}function tt(e,t){if(e[0].length===t)return e.shift()
;const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function nt(e){if(e)return function(e){for(var t in nt.prototype)e[t]=nt.prototype[t];return e}(e)}function rt(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}function ot(e,t){t.useNativeTimers?(e.setTimeoutFn=Qi.bind(Zi),e.clearTimeoutFn=Xi.bind(Zi)):(e.setTimeoutFn=Zi.setTimeout.bind(Zi),
e.clearTimeoutFn=Zi.clearTimeout.bind(Zi))}function at(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function it(){}function st(){for(let e in os.requests)os.requests.hasOwnProperty(e)&&os.requests[e].abort()}function ct(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ns))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Zi[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function lt(e){
if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=ds.exec(e||""),a={},i=14;for(;i--;)a[us[i]]=o[i]||"";return-1!=n&&-1!=r&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/")
;return"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,a.path),a.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,a.query),a}var dt={};dt.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}();const ut=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r)
;o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):55296==(64512&o)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++r)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t},ht={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const o=e[t],a=t+1<e.length,i=a?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,l=o>>2,d=(3&o)<<4|i>>4;let u=(15&i)<<2|c>>6,h=63&c;s||(h=64,
a||(u=64)),r.push(n[l],n[d],n[u],n[h])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(ut(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n++];if(o<128)t[r++]=String.fromCharCode(o);else if(o>191&&o<224){const a=e[n++];t[r++]=String.fromCharCode((31&o)<<6|63&a)}else if(o>239&&o<365){const a=((7&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536
;t[r++]=String.fromCharCode(55296+(a>>10)),t[r++]=String.fromCharCode(56320+(1023&a))}else{const a=e[n++],i=e[n++];t[r++]=String.fromCharCode((15&o)<<12|(63&a)<<6|63&i)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const o=n[e.charAt(t++)],a=t<e.length?n[e.charAt(t)]:0;++t;const i=t<e.length?n[e.charAt(t)]:64;++t;const s=t<e.length?n[e.charAt(t)]:64;if(++t,
null==o||null==a||null==i||null==s)throw new pt;const c=o<<2|a>>4;if(r.push(c),64!==i){const e=a<<4&240|i>>2;if(r.push(e),64!==s){const e=i<<6&192|s;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,
this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class pt extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ft=function(e){return function(e){const t=ut(e);return ht.encodeByteArray(t,!0)}(e).replace(/\./g,"")},mt=function(e){
try{return ht.decodeString(e,!0)}catch(e){}return null},gt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==dt.g)return dt.g;throw Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,bt=()=>{try{return gt()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{
e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&mt(e[1]);return t&&JSON.parse(t)})()}catch(e){return}},yt=()=>{var e;return null===(e=bt())||void 0===e?void 0:e.config};class vt{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}class wt extends Error{
constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,wt.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,kt.prototype.create)}}class kt{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,o=this.errors[e],a=o?function(e,t){return e.replace(Ct,((e,n)=>{const r=t[n];return null!=r?r+"":`<${n}?>`}))}(o,n):"Error",i=`${this.serviceName}: ${a} (${r}).`
;return new wt(r,i,n)}}const Ct=/\{\$([^}]+)}/g;class Et{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const xt="[DEFAULT]";class At{
constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new vt;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}
return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){
if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:xt})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({
instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=xt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=xt){return this.instances.has(e)}getOptions(e=xt){
return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}
onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),o=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;o.add(e),this.onInitCallbacks.set(r,o);const a=this.instances.get(r);return a&&e(a,r),()=>{o.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{
instanceIdentifier:(r=e,r===xt?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=xt){return this.component?this.component.multipleInstances?e:xt:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Tt{constructor(e){this.name=e,
this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new At(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
const Lt=[];var It;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(It||(It={}));const St={debug:It.DEBUG,verbose:It.VERBOSE,info:It.INFO,warn:It.WARN,error:It.ERROR,silent:It.SILENT},Mt=It.INFO,jt={[It.DEBUG]:"log",[It.VERBOSE]:"log",[It.INFO]:"info",[It.WARN]:"warn",[It.ERROR]:"error"},Ot=(e,t)=>{if(!(t<e.logLevel||((new Date).toISOString(),
jt[t])))throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class Pt{constructor(e){this.name=e,this._logLevel=Mt,this._logHandler=Ot,this._userLogHandler=null,Lt.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in It))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?St[e]:e}get logHandler(){return this._logHandler}set logHandler(e){
if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,It.DEBUG,...e),this._logHandler(this,It.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,It.VERBOSE,...e),this._logHandler(this,It.VERBOSE,...e)}info(...e){
this._userLogHandler&&this._userLogHandler(this,It.INFO,...e),this._logHandler(this,It.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,It.WARN,...e),this._logHandler(this,It.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,It.ERROR,...e),this._logHandler(this,It.ERROR,...e)}}let _t,Ft;const Dt=new WeakMap,Nt=new WeakMap,Ut=new WeakMap,Bt=new WeakMap,Ht=new WeakMap;let Rt={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Nt.get(e)
;if("objectStoreNames"===t)return e.objectStoreNames||Ut.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return c(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};const zt=e=>Ht.get(e),Wt=["get","getKey","getAll","getAllKeys","count"],qt=["put","add","delete","clear"],Vt=new Map;var Gt;Gt=Rt,Rt={...Gt,get:(e,t,n)=>d(e,t)||Gt.get(e,t,n),has:(e,t)=>!!d(e,t)||Gt.has(e,t)};class Kt{
constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}
const Yt="@firebase/app",Zt="0.11.0",Qt=new Pt("@firebase/app"),Xt="@firebase/app-compat",Jt="@firebase/analytics-compat",$t="@firebase/analytics",en="@firebase/app-check-compat",tn="@firebase/app-check",nn="@firebase/auth",rn="@firebase/auth-compat",on="@firebase/database",an="@firebase/data-connect",sn="@firebase/database-compat",cn="@firebase/functions",ln="@firebase/functions-compat",dn="@firebase/installations",un="@firebase/installations-compat",hn="@firebase/messaging",pn="@firebase/messaging-compat",fn="@firebase/performance",mn="@firebase/performance-compat",gn="@firebase/remote-config",bn="@firebase/remote-config-compat",yn="@firebase/storage",vn="@firebase/storage-compat",wn="@firebase/firestore",kn="@firebase/vertexai",Cn="@firebase/firestore-compat",En="firebase",xn="[DEFAULT]",An={
[Yt]:"fire-core",[Xt]:"fire-core-compat",[$t]:"fire-analytics",[Jt]:"fire-analytics-compat",[tn]:"fire-app-check",[en]:"fire-app-check-compat",[nn]:"fire-auth",[rn]:"fire-auth-compat",[on]:"fire-rtdb",[an]:"fire-data-connect",[sn]:"fire-rtdb-compat",[cn]:"fire-fn",[ln]:"fire-fn-compat",[dn]:"fire-iid",[un]:"fire-iid-compat",[hn]:"fire-fcm",[pn]:"fire-fcm-compat",[fn]:"fire-perf",[mn]:"fire-perf-compat",[gn]:"fire-rc",[bn]:"fire-rc-compat",[yn]:"fire-gcs",[vn]:"fire-gcs-compat",[wn]:"fire-fst",
[Cn]:"fire-fst-compat",[kn]:"fire-vertex","fire-js":"fire-js",[En]:"fire-js-all"},Tn=new Map,Ln=new Map,In=new Map,Sn=new kt("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted",
"no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
"idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class Mn{constructor(e,t,n){this._isDeleted=!1,
this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Et("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}
get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Sn.create("app-deleted",{appName:this._name})}}const jn="firebase-heartbeat-store";let On=null;class Pn{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate()
;this._storage=new _n(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=v();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return
;if(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some((e=>e.date===r)))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){
Qt.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=v(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const o of e){const e=n.find((e=>e.agent===o.agent));if(e){if(e.dates.push(o.date),w(n)>t){e.dates.pop();break}}else if(n.push({agent:o.agent,dates:[o.date]
}),w(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),o=ft(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(e){return Qt.warn(e),""}}}class _n{constructor(e){this.app=e,
this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!e()&&t().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await g()).transaction(jn),n=await t.objectStore(jn).get(y(e));return await t.done,n}catch(e){if(e instanceof wt)Qt.warn(e.message);else{const t=Sn.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Qt.warn(t.message)}}}(this.app)
;return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return b(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return b(this.app,{
lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}var Fn;Fn="",h(new Et("platform-logger",(e=>new Kt(e)),"PRIVATE")),h(new Et("heartbeat",(e=>new Pn(e)),"PRIVATE")),m(Yt,Zt,Fn),m(Yt,Zt,"esm2017"),m("fire-js",""),m("firebase","11.3.0","app");const Dn="@firebase/installations",Nn="0.6.12",Un=1e4,Bn="w:"+Nn,Hn="FIS_v2",Rn=new kt("installations","Installations",{
"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."
}),zn=/^[cdef][\w-]{21}$/,Wn=new Map;let qn=null;const Vn="firebase-installations-store";let Gn=null;const Kn="installations",Yn=e=>{const t=p(e.getProvider("app").getImmediate(),Kn).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:r}=await B(t);return r?r.catch(console.error):q(t).catch(console.error),n.fid}(t),getToken:e=>K(t,e)}};h(new Et(Kn,(e=>{const t=e.getProvider("app").getImmediate(),n=function(e){
if(!e||!e.options)throw Y("App Configuration");if(!e.name)throw Y("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw Y(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:p(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),h(new Et("installations-internal",Yn,"PRIVATE")),m(Dn,Nn),m(Dn,Nn,"esm2017")
;const Zn="analytics",Qn="https://www.googletagmanager.com/gtag/js",Xn=new Pt("@firebase/analytics"),Jn=new kt("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.",
"already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",
"interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",
"indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",
"no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."}),$n=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}
getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};class er{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let tr,nr;class rr{constructor(e){this.app=e}_delete(){return delete or[this.app.options.appId],Promise.resolve()}}let or={},ar=[];const ir={};let sr,cr,lr="dataLayer",dr="gtag",ur=!1
;const hr="@firebase/analytics",pr="0.10.11";h(new Et(Zn,((e,{options:t})=>ie(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),h(new Et("analytics-internal",(function(e){try{const t=e.getProvider(Zn).getImmediate();return{logEvent:(e,n,r)=>ce(t,e,n,r)}}catch(e){throw Jn.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),m(hr,pr),m(hr,pr,"esm2017")
;const fr="emoji",mr="keyvalue",gr="favorites",br="tokens",yr="count",vr="group-order",wr="eTag",kr="url",Cr="skinTone",Er="readonly",xr="readwrite",Ar="skinUnicodes",Tr={},Lr={},Ir={},Sr=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]),Mr=["name","url"],jr="undefined"!=typeof wrappedJSObject,Or=["annotation","emoji","group","order","version"];class Pr{
constructor({dataSource:e="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",locale:t="en",customEmoji:n=[]}={}){this.dataSource=e,this.locale=t,this._dbName="emoji-picker-element-"+this.locale,this._db=void 0,this._lazyUpdate=void 0,this._custom=Le(n),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const e=this._db=await(t=this._dbName,Lr[t]||(Lr[t]=pe(t)),Lr[t]);var t;!function(e,t){let n=Ir[e];n||(n=Ir[e]=[]),n.push(t)
}(this._dbName,this._clear);const n=this.dataSource,r=await async function(e){return!await Te(e,mr,kr)}(e);r?await async function(e,t){let[n,r]=await Me(t);n||(n=await je(r)),await Ee(e,r,t,n)}(e,n):this._lazyUpdate=Oe(e,n)}async ready(){const e=async()=>(this._ready||(this._ready=this._init()),this._ready);await e(),this._db||await e()}async getEmojiByGroup(e){return de(e),await this.ready(),ue(await async function(e,t){return fe(e,fr,Er,((e,n,r)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0)
;we(e.index(vr),o,r)}))}(this._db,e)).map(Ie)}async getEmojiBySearchQuery(e){return le(e),await this.ready(),[...this._custom.search(e),...ue(await xe(this._db,e)).map(Ie)]}async getEmojiByShortcode(e){le(e),await this.ready();const t=this._custom.byShortcode(e);return t||Ie(await Ae(this._db,e))}async getEmojiByUnicodeOrName(e){le(e),await this.ready();const t=this._custom.byName(e);return t||Ie(await async function(e,t){return fe(e,fr,Er,((e,n,r)=>ve(e,t,(n=>{if(n)return r(n)
;ve(e.index(Ar),t,(e=>r(e||null)))}))))}(this._db,e))}async getPreferredSkinTone(){return await this.ready(),await Te(this._db,mr,Cr)||0}async setPreferredSkinTone(e){return de(e),await this.ready(),function(e,t,n,r){return fe(e,t,xr,((e,t)=>{e.put(r,n),ke(t)}))}(this._db,mr,Cr,e)}async incrementFavoriteEmojiCount(e){return le(e),await this.ready(),t=this._db,n=e,fe(t,gr,xr,((e,t)=>ve(e,n,(r=>{e.put((r||0)+1,n),ke(t)}))));var t,n}async getTopFavoriteEmoji(e){return de(e),await this.ready(),
(await function(e,t,n){return 0===n?[]:fe(e,[gr,fr],Er,(([e,r],o,a)=>{const i=[];e.index(yr).openCursor(void 0,"prev").onsuccess=e=>{function o(e){if(i.push(e),i.length===n)return a(i);s.continue()}const s=e.target.result;if(!s)return a(i);const c=s.primaryKey,l=t.byName(c);if(l)return o(l);ve(r,c,(e=>{if(e)return o(e);s.continue()}))}}))}(this._db,this._custom,e)).map(Ie)}set customEmoji(e){this._custom=Le(e)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{
await this._lazyUpdate}catch(e){}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await me(this._dbName)}async delete(){var e;await this._shutdown(),await(e=this._dbName,new Promise(((t,n)=>{me(e),he(t,n,indexedDB.deleteDatabase(e))})))}}
const _r=[[-1,"\u2728","custom"],[0,"\u{1f600}","smileys-emotion"],[1,"\u{1f44b}","people-body"],[3,"\u{1f431}","animals-nature"],[4,"\u{1f34e}","food-drink"],[5,"\u{1f3e0}\ufe0f","travel-places"],[6,"\u26bd","activities"],[7,"\u{1f4dd}","objects"],[8,"\u26d4\ufe0f","symbols"],[9,"\u{1f3c1}","flags"]].map((([e,t,n])=>({id:e,emoji:t,name:n}))),Fr=_r.slice(1),Dr="function"==typeof requestIdleCallback?requestIdleCallback:setTimeout,Nr={"\u{1fae9}":16,"\u{1fae8}":15.1,"\u{1fae0}":14,
"\u{1f972}":13.1,"\u{1f97b}":12.1,"\u{1f970}":11,"\u{1f929}":5,"\u{1f471}\u200d\u2640\ufe0f":4,"\u{1f923}":3,"\u{1f441}\ufe0f\u200d\u{1f5e8}\ufe0f":2,"\u{1f600}":1,"\u{1f610}\ufe0f":.7,"\u{1f603}":.6
},Ur=["\u{1f60a}","\u{1f612}","\u2764\ufe0f","\u{1f44d}\ufe0f","\u{1f60d}","\u{1f602}","\u{1f62d}","\u263a\ufe0f","\u{1f614}","\u{1f629}","\u{1f60f}","\u{1f495}","\u{1f64c}","\u{1f618}"],Br='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Hr=(e,t)=>e<t?-1:e>t?1:0,Rr=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const r=n.getContext("2d",{willReadFrequently:!0})
;return r.textBaseline="top",r.font="100px "+Br,r.fillStyle=t,r.scale(.01,.01),r.fillText(e,0,0),r.getImageData(0,0,1,1).data};let zr;const Wr=()=>(zr||(zr=new Promise((e=>Dr((()=>e(function(){const e=Object.entries(Nr);try{for(const[t,n]of e)if(_e(t))return n}catch(e){}return e[0][1]}())))))),zr),qr=new Map,Vr=requestAnimationFrame;let Gr,Kr="function"==typeof ResizeObserver
;const Yr=new WeakMap,Zr=new WeakMap,Qr=Symbol("un-keyed"),Xr="replaceChildren"in Element.prototype,Jr="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e),$r=new WeakMap,eo=[],{assign:to}=Object;var no={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading\u2026",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",
searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons",
"people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}};const ro=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],oo=`:host{--emoji-font-family:${Br}}`;class ao extends HTMLElement{constructor(e){super(),this.attachShadow({mode:"open"});const t=document.createElement("style")
;t.textContent=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}'+oo,
this.shadowRoot.appendChild(t),this._ctx={locale:"en",dataSource:"https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",skinToneEmoji:"\u{1f590}\ufe0f",customCategorySorting:Hr,customEmoji:null,i18n:no,emojiVersion:null,...e};for(const e of ro)"database"!==e&&Object.prototype.hasOwnProperty.call(this,e)&&(this._ctx[e]=this[e],delete this[e]);this._dbFlush()}connectedCallback(){this._cmp||(this._cmp=Ke(this.shadowRoot,this._ctx))}disconnectedCallback(){Jr((()=>{
if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:e}=this._ctx;e.close().catch((()=>{}))}}))}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(e,t,n){this._set(e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),"emoji-version"===e?parseFloat(n):n)}_set(e,t){this._ctx[e]=t,this._cmp&&this._cmp.$set({[e]:t}),["locale","dataSource"].includes(e)&&this._dbFlush()}_dbCreate(){
const{locale:e,dataSource:t,database:n}=this._ctx;n&&n.locale===e&&n.dataSource===t||this._set("database",new Pr({locale:e,dataSource:t}))}_dbFlush(){Jr((()=>this._dbCreate()))}}const io={};for(const e of ro)io[e]={get(){return"database"===e&&this._dbCreate(),this._ctx[e]},set(t){if("database"===e)throw Error("database is read-only");this._set(e,t)}};Object.defineProperties(ao.prototype,io),customElements.get("emoji-picker")||customElements.define("emoji-picker",ao)
;const so=Object.freeze(Object.setPrototypeOf((()=>{throw so}),null)),co=new Uint8Array(new ArrayBuffer(0),0,0),lo=Object.setPrototypeOf((function(){return Reflect.construct(Uint8Array,arguments,lo)}),null),uo=Object.freeze(Object.create(null,{[Symbol.toStringTag]:{value:"Buffer",writable:!1,enumerable:!1,configurable:!1}}));Object.defineProperty(lo,"from",{value:e=>{if(null==e||"object"!=typeof e)throw Error("Invalid buffer source")
;return Ze(e)?e:Ye(e)?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Uint8Array.from(e)},writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(lo,"concat",{value:(e,t)=>{if(null==e||"object"!=typeof e)throw Error("Invalid sources");if(Array.isArray(e)||(e=Array.from(e)),"number"!=typeof t){t=0;for(const{byteLength:n}of e){if(!Number.isSafeInteger(n)||n<0)throw Error("Invalid buffer object");t+=n}}const n=new Uint8Array(t);let r=0
;for(const t of e){const e=t.byteLength;n.set("length"in t?t:new Uint8Array("buffer"in t?t.buffer:t,0,e),r+=e)}return n}}),Object.defineProperty(lo,"prototype",{value:uo,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(lo,"emptyBuffer",{value:co,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(lo,"isArrayBuffer",{value:Ye,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(lo,Symbol.hasInstance,{value:Ze,writable:!1,enumerable:!1,configurable:!1})
;const ho=Object.freeze(lo),po=Object.setPrototypeOf((function(){if("function"!=typeof new.target)return Object.create(fo);for(let e=Object.getPrototypeOf(this);null!=e;e=Object.getPrototypeOf(e))try{delete e.constructor}catch(e){}}),null),fo=Object.freeze(Object.create(null));Object.defineProperty(po,"prototype",{value:fo,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(po,Symbol.hasInstance,{value:()=>!1,writable:!1,enumerable:!1,configurable:!1});const mo=Object.freeze(po)
;class go extends mo{#e;#t;#n;get closed(){return this.#n}get canRead(){return this.#e}get canWrite(){return this.#t}constructor(e,t){super(),this.#e=e??!1,this.#t=t??!1,this.#n=!1}close(){this.#n=!0}}class bo extends go{constructor(){super(!0,!1)}read(){return-1}readBuf(e){const t=e.byteLength;for(let n=0;n<t;n++){const t=this.read();if(!(t>=0))return n;e[n]=t}return t}readNBytes(e){const t=new Uint8Array(e),n=this.readBuf(t);return n<e?t.slice(0,n):t}}class yo extends go{constructor(){
super(!1,!0)}write(e){}flush(){}}const vo="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",wo={encode:e=>{let t="",n=0,r=0;for(let o=0;o<e.length;o++)for(n=n<<8|e[o],r+=8;r>=5;)t+=vo[n>>r-5&31],r-=5;for(r>0&&(t+=vo[n<<5-r&31]);t.length%8!=0;)t+="=";return t},decode:e=>{e=e.replace(/=+$/,"");const t=[];let n=0,r=0;for(let o=0;o<e.length;o++){const a=vo.indexOf(e[o].toUpperCase());if(a<0)throw Error("Invalid character found in Base32 string.");n=n<<5|a,r+=5,r>=8&&(t.push(n>>r-8&255),r-=8)}
return Uint8Array.from(t)}},ko=Object.freeze(Object.setPrototypeOf(wo,null)),Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Eo=new Uint8Array(new ArrayBuffer(256),0,256);for(let e=0;e<64;e++)Eo[Co.charCodeAt(e)]=e;const xo={encode:e=>{const t=e.byteLength;let n="";for(let r=0;r<t;r+=3){const t=e[r]<<16|e[r+1]<<8|e[r+2];n+=Co[t>>18&63]+Co[t>>12&63]+Co[t>>6&63]+Co[63&t]}switch(t%3){case 1:return n.slice(0,-2)+"==";case 2:return n.slice(0,-1)+"=";default:return n}},
decode:e=>{const t=e.length,n=new Uint8Array(.75*t-("=="===e.slice(t-2)?2:"="===e[t-1]?1:0));let r=0;for(let o=0;o<t;o+=4){const t=Eo[e.charCodeAt(o)]<<18|Eo[e.charCodeAt(o+1)]<<12|Eo[e.charCodeAt(o+2)]<<6|Eo[e.charCodeAt(o+3)];n[r++]=t>>16&255,n[r++]=t>>8&255,n[r++]=255&t}return n}},Ao=Object.freeze(Object.setPrototypeOf(xo,null)),To="0123456789abcdef",Lo=e=>{let t="";for(let n=0;n<=3;n++)t+=To.charAt(e>>8*n+4&15)+To.charAt(e>>8*n&15);return t},Io=(e,t)=>{let n=(65535&e)+(65535&t)
;return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},So=(e,t,n,r,o,a)=>Io(((e,t)=>e<<t|e>>>32-t)(Io(Io(t,e),Io(r,a)),o),n),Mo=(e,t,n,r,o,a,i)=>So(t&n|~t&r,e,t,o,a,i),jo=(e,t,n,r,o,a,i)=>So(t&r|n&~r,e,t,o,a,i),Oo=(e,t,n,r,o,a,i)=>So(t^n^r,e,t,o,a,i),Po=(e,t,n,r,o,a,i)=>So(n^(t|~r),e,t,o,a,i),_o={encode:e=>{const t=[]
;for(const n of Array.from(e,(e=>e.codePointAt(0)||65533)))n<128?t.push(n):n<2048?t.push(n>>6|192,63&n|128):n<65536?t.push(n>>12|224,n>>6&63|128,63&n|128):t.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128);return Uint8Array.from(t)},decode:e=>{const t=e.byteLength;let n="";for(let r=0;r<t;){const t=e[r++];if(128&t)if(192==(224&t))n+=String.fromCharCode((31&t)<<6|63&e[r++]);else if(224==(240&t))n+=String.fromCharCode((15&t)<<12|(63&e[r++])<<6|63&e[r++]);else if(240==(248&t)){
const o=(7&t)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++];n+=o>1114111?"\ufffd":String.fromCodePoint(o)}else n+="\ufffd";else n+=String.fromCharCode(t)}return n}},Fo=Object.freeze(Object.setPrototypeOf(_o,null)),Do={encode:e=>Uint8Array.from(e,(e=>e.charCodeAt(0))),decode:e=>Array.from(e,(e=>String.fromCharCode(e))).join("")},No=Object.freeze(Object.setPrototypeOf(Do,null)),Uo={encode:e=>{const t=2*e.length,n=new ArrayBuffer(t),r=new DataView(n,0,t);for(let n=0,o=0;n<t;n+=2,
o++)r.setUint16(n,e.charCodeAt(o)||65533,!1);return new Uint8Array(n,0,t)},decode:e=>{const t=Math.floor(e.byteLength/2),n=Array(t),r=new DataView(e.buffer,e.byteOffset,2*t);for(let e=0,o=0;o<t;e+=2,o++)n[o]=String.fromCharCode(r.getUint16(e,!1));return n.join("")}},Bo=Object.freeze(Object.setPrototypeOf(Uo,null)),Ho={encode:e=>{const t=2*e.length,n=new ArrayBuffer(t),r=new DataView(n,0,t);for(let n=0,o=0;n<t;n+=2,o++)r.setUint16(n,e.charCodeAt(o)||65533,!0);return new Uint8Array(n,0,t)},
decode:e=>{const t=Math.floor(e.byteLength/2),n=Array(t),r=new DataView(e.buffer,e.byteOffset,2*t);for(let e=0,o=0;o<t;e+=2,o++)n[o]=String.fromCharCode(r.getUint16(e,!0));return n.join("")}},Ro=Object.freeze(Object.setPrototypeOf(Ho,null)),zo={encode:e=>{const t=Array.from(e,(e=>e.codePointAt(0)||65533)),n=4*t.length,r=new ArrayBuffer(n),o=new DataView(r,0,n);for(let e=0,r=0;e<n;e+=4,r++)o.setUint32(e,t[r],!1);return new Uint8Array(r,0,n)},decode:e=>{
const t=Math.floor(e.byteLength/4),n=Array(t),r=new DataView(e.buffer,e.byteOffset,4*t);for(let e=0,o=0;o<t;e+=4,o++){const t=r.getUint32(e,!1);n[o]=t>1114111?"\ufffd":String.fromCodePoint(t)}return n.join("")}},Wo=Object.freeze(Object.setPrototypeOf(zo,null)),qo={encode:e=>Array.from(e,(e=>{const t=(255&e).toString(16);return 1===t.length?"0"+t:t})).join(""),decode:e=>{const t=Math.floor(e.length/2),n=new Uint8Array(new ArrayBuffer(t),0,t)
;for(let r=0,o=0;r<t;r++)n[r]=parseInt(e.slice(o,o+=2),16);return n}},Vo=Object.freeze(Object.setPrototypeOf(qo,null));class Go extends bo{#r;constructor(e){super(),this.#r=e}read(){return 255&Math.floor(256*this.#r.rand())}readBuf(e){return this.#r.randbuf(e),e.byteLength}readNBytes(e){return this.#r.randbuf(new Uint8Array(new ArrayBuffer(e),0,e))}get closed(){return!1}close(){}}class Ko extends mo{#o;get seed(){return this.#o}static[Symbol.hasInstance](e){try{return e.#o,!0}catch(e){return!1}}
constructor(e){super(),this.#o=e||null}rand(){throw Error("Function not implemented")}randbuf(e){const t=e.byteLength;for(let n=0;n<t;n++)e[n]=255&Math.floor(256*this.rand());return e}randint(e,t){return(t||=0)+Math.floor(this.rand()*((e||4294967295)-t))}setSeed(e){this.#o=e||null}createStream(){return new Go(this)}}class Yo extends Ko{#a;#i;#s;#c;constructor(e){if(super(e||=[Qe(),Qe(),Qe(),Qe()]),!Array.isArray(e)||4!==e.length)throw Error("Invalid seed value");this.#a=e[0],this.#i=e[1],
this.#s=e[2],this.#c=e[3]}rand(){let e=this.#a|=0,t=this.#i|=0,n=this.#s|=0,r=this.#c|=0,o=(e+t|0)+r|0;return r=r+1|0,e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,n=n+o|0,this.#a=e,this.#i=t,this.#s=n,this.#c=r,(o>>>0)/4294967296}setSeed(e){if(!Array.isArray(e)||4!==e.length)throw Error("Invalid seed value");this.#a=e[0],this.#i=e[1],this.#s=e[2],this.#c=e[3],super.setSeed(e)}}class Zo extends Ko{#l;constructor(e){super(e||=Qe()),this.#l=e}rand(){const e=this.#l=2654435769+(0|this.#l)|0;let t=e^e>>>16
;return t=Math.imul(t,569420461),t^=t>>>15,t=Math.imul(t,1935289751),((t^=t>>>15)>>>0)/4294967296}setSeed(e){this.#l=e,super.setSeed(e)}}class Qo extends Ko{#l;constructor(e){super(e||=Qe()),this.#l=e}rand(){let e=this.#l=1831565813+(0|this.#l);return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}setSeed(e){this.#l=e,super.setSeed(e)}}class Xo extends Ko{#a;#i;#s;#c;constructor(e){if(super(e||=[Qe(),Qe(),Qe(),Qe()]),
!Array.isArray(e)||4!==e.length)throw Error("Invalid seed value");this.#a=e[0],this.#i=e[1],this.#s=e[2],this.#c=e[3]}rand(){let e=this.#a|=0,t=this.#i|=0,n=this.#s|=0,r=this.#c|=0,o=t<<9,a=5*t;return a=9*(a<<7|a>>>25),n^=e,r^=t,t^=n,e^=r,n^=o,r=r<<11|r>>>21,this.#a=e,this.#i=t,this.#s=n,this.#c=r,(a>>>0)/4294967296}setSeed(e){if(!Array.isArray(e)||4!==e.length)throw Error("Invalid seed value");this.#a=e[0],this.#i=e[1],this.#s=e[2],this.#c=e[3],super.setSeed(e)}}class Jo extends Ko{
static[Symbol.hasInstance](e){return Ko[Symbol.hasInstance](e)}constructor(e,t){switch(super(t),e||"mulberry32"){case"sfc32":return new Yo(t);case"splitmix32":return new Zo(t);case"mulberry32":return new Qo(t);case"xoshiro128":return new Xo(t);default:if(new.target===Jo)throw Error("Unsupported algorithm: "+e)}}}const $o={encode:e=>{const t=[Uint8Array.of(128,99,98,106,102,2)];let n=6;const r=e=>{switch(typeof e){case"undefined":t.push(0),n++;break;case"boolean":t.push(e?1:2),n++;break
;case"string":{const r=Fo.encode(e),o=r.byteLength;t.push(Uint8Array.of(101,255&o,o>>8&255,o>>16&255,o>>24&255),r),n+=o+5}break;case"number":{if(Number.isSafeInteger(e))if(e>=0){if(e<256)return t.push(Uint8Array.of(10,e)),void(n+=2);if(e<65536)return t.push(Uint8Array.of(11,255&e,e>>8&255)),void(n+=3);if(e<4294967296)return t.push(Uint8Array.of(12,255&e,e>>8&255,e>>16&255,e>>24&255)),void(n+=5)}else{if(e>=-128&&e<128)return t.push(Uint8Array.of(20,e)),void(n+=2)
;if(e>=-32768&&e<32768)return t.push(Uint8Array.of(21,255&e,e>>8&255)),void(n+=3);if(e>=-2147483648&&e<2147483648)return t.push(Uint8Array.of(22,255&e,e>>8&255,e>>16&255,e>>24&255)),void(n+=5)}const r=new ArrayBuffer(9);{const t=new DataView(r,0,9);t.setUint8(0,33),t.setFloat64(1,e,!0)}t.push(new Uint8Array(r,0,9)),n+=9}break;case"bigint":{const r=new ArrayBuffer(9);{const t=new DataView(r,0,9);e>=0n?(t.setUint8(0,13),t.setBigUint64(1,e,!0)):(t.setUint8(0,23),t.setBigInt64(1,e,!0))}
t.push(new Uint8Array(r,0,9)),n+=9}break;case"object":if(null===e)t.push(255),n++;else if(Array.isArray(e)){const o=e.length;t.push(Uint8Array.of(99,255&o,o>>8&255,o>>16&255,o>>24&255)),n+=5;for(const t of e)r(t)}else if(Ye(e)){const r=new Uint8Array(e,0,e.byteLength),o=r.byteLength;t.push(Uint8Array.of(102,255&o,o>>8&255,o>>16&255,o>>24&255),r),n+=o+5}else if(ArrayBuffer.isView(e)){const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o=r.byteLength
;t.push(Uint8Array.of(102,255&o,o>>8&255,o>>16&255,o>>24&255),r),n+=o+5}else{const o=Object.keys(e),a=o.length;t.push(Uint8Array.of(100,255&a,a>>8&255,a>>16&255,a>>24&255)),n+=5;for(const a of o){const o=e[a];switch(typeof o){case"bigint":case"number":case"object":case"string":case"boolean":case"undefined":{const e=Fo.encode(a),r=e.byteLength;t.push(Uint8Array.of(255&r,r>>8&255,r>>16&255,r>>24&255),e),n+=r+4}r(o)}}}}};r(e);const o=new Uint8Array(n);let a=0
;for(const e of t)"number"!=typeof e?(o.set(e,a),a+=e.byteLength):o[a++]=e;return o},decode:e=>{if(!ArrayBuffer.isView(e))throw Error("invalid input value");if(128!==e[0]||99!==e[1]||98!==e[2]||106!==e[3]||102!==e[4]||2!==e[5])throw Error("Parse Error: Invalid magic value");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let n=6;const r=()=>(255&e[n++]|(255&e[n++])<<8|(255&e[n++])<<16|(255&e[n++])<<24)>>>0,o=()=>{const a=e[n++];switch(a){case 0:return;case 255:return null;case 1:
return!0;case 2:return!1;case 10:return e[n++];case 11:return 255&e[n++]|(255&e[n++])<<8;case 12:return r();case 13:return t.getBigUint64((n+=8)-8,!0);case 20:return e[n++]<<24>>24;case 21:return(255&e[n++]|(255&e[n++])<<8)<<16>>16;case 22:return 255&e[n++]|(255&e[n++])<<8|(255&e[n++])<<16|(255&e[n++])<<24;case 23:return t.getBigInt64((n+=8)-8,!0);case 32:return t.getFloat32((n+=4)-4,!0);case 33:return t.getFloat64((n+=8)-8,!0);case 99:{const e=r(),t=Array(e);for(let n=0;n<e;n++)t[n]=o()
;return t}case 100:{const t=r(),a=Object.create(null);for(let i=0;i<t;i++){const t=r();a[Fo.decode(e.subarray(n,n+=t))]=o()}return a}case 102:{const t=r();return e.subarray(n,n+=t)}case 101:{const t=r();return Fo.decode(e.subarray(n,n+=t))}default:throw Error("Parse Error: Invalid data ID: "+a)}};return o()}},ea=Object.freeze(Object.setPrototypeOf($o,null)),ta={md5:function(e){let t,n,r,o,a,i=1732584193,s=-271733879,c=-1732584194,l=271733878;const d=16*(1+(e.length+8>>6)),u=Array(d).fill(0)
;for(t=0;t<e.length;t++)u[t>>2]|=e.charCodeAt(t)<<t%4*8;for(u[t>>2]|=128<<t%4*8,u[d-2]=8*e.length,t=0;t<d;t+=16)n=i,r=s,o=c,a=l,i=Mo(i,s,c,l,u[t+0],7,-680876936),l=Mo(l,i,s,c,u[t+1],12,-389564586),c=Mo(c,l,i,s,u[t+2],17,606105819),s=Mo(s,c,l,i,u[t+3],22,-1044525330),i=Mo(i,s,c,l,u[t+4],7,-176418897),l=Mo(l,i,s,c,u[t+5],12,1200080426),c=Mo(c,l,i,s,u[t+6],17,-1473231341),s=Mo(s,c,l,i,u[t+7],22,-45705983),i=Mo(i,s,c,l,u[t+8],7,1770035416),l=Mo(l,i,s,c,u[t+9],12,-1958414417),
c=Mo(c,l,i,s,u[t+10],17,-42063),s=Mo(s,c,l,i,u[t+11],22,-1990404162),i=Mo(i,s,c,l,u[t+12],7,1804603682),l=Mo(l,i,s,c,u[t+13],12,-40341101),c=Mo(c,l,i,s,u[t+14],17,-1502002290),s=Mo(s,c,l,i,u[t+15],22,1236535329),i=jo(i,s,c,l,u[t+1],5,-165796510),l=jo(l,i,s,c,u[t+6],9,-1069501632),c=jo(c,l,i,s,u[t+11],14,643717713),s=jo(s,c,l,i,u[t+0],20,-373897302),i=jo(i,s,c,l,u[t+5],5,-701558691),l=jo(l,i,s,c,u[t+10],9,38016083),c=jo(c,l,i,s,u[t+15],14,-660478335),s=jo(s,c,l,i,u[t+4],20,-405537848),
i=jo(i,s,c,l,u[t+9],5,568446438),l=jo(l,i,s,c,u[t+14],9,-1019803690),c=jo(c,l,i,s,u[t+3],14,-187363961),s=jo(s,c,l,i,u[t+8],20,1163531501),i=jo(i,s,c,l,u[t+13],5,-1444681467),l=jo(l,i,s,c,u[t+2],9,-51403784),c=jo(c,l,i,s,u[t+7],14,1735328473),s=jo(s,c,l,i,u[t+12],20,-1926607734),i=Oo(i,s,c,l,u[t+5],4,-378558),l=Oo(l,i,s,c,u[t+8],11,-2022574463),c=Oo(c,l,i,s,u[t+11],16,1839030562),s=Oo(s,c,l,i,u[t+14],23,-35309556),i=Oo(i,s,c,l,u[t+1],4,-1530992060),l=Oo(l,i,s,c,u[t+4],11,1272893353),
c=Oo(c,l,i,s,u[t+7],16,-155497632),s=Oo(s,c,l,i,u[t+10],23,-1094730640),i=Oo(i,s,c,l,u[t+13],4,681279174),l=Oo(l,i,s,c,u[t+0],11,-358537222),c=Oo(c,l,i,s,u[t+3],16,-722521979),s=Oo(s,c,l,i,u[t+6],23,76029189),i=Oo(i,s,c,l,u[t+9],4,-640364487),l=Oo(l,i,s,c,u[t+12],11,-421815835),c=Oo(c,l,i,s,u[t+15],16,530742520),s=Oo(s,c,l,i,u[t+2],23,-995338651),i=Po(i,s,c,l,u[t+0],6,-198630844),l=Po(l,i,s,c,u[t+7],10,1126891415),c=Po(c,l,i,s,u[t+14],15,-1416354905),s=Po(s,c,l,i,u[t+5],21,-57434055),
i=Po(i,s,c,l,u[t+12],6,1700485571),l=Po(l,i,s,c,u[t+3],10,-1894986606),c=Po(c,l,i,s,u[t+10],15,-1051523),s=Po(s,c,l,i,u[t+1],21,-2054922799),i=Po(i,s,c,l,u[t+8],6,1873313359),l=Po(l,i,s,c,u[t+15],10,-30611744),c=Po(c,l,i,s,u[t+6],15,-1560198380),s=Po(s,c,l,i,u[t+13],21,1309151649),i=Po(i,s,c,l,u[t+4],6,-145523070),l=Po(l,i,s,c,u[t+11],10,-1120210379),c=Po(c,l,i,s,u[t+2],15,718787259),s=Po(s,c,l,i,u[t+9],21,-343485551),i=Io(i,n),s=Io(s,r),c=Io(c,o),l=Io(l,a);return Lo(i)+Lo(s)+Lo(c)+Lo(l)},
Hex:Vo,Null:mo,NTON:ea,ASCII:No,UTF_8:Fo,Base32:ko,Base64:Ao,Buffer:ho,Random:Jo,Stream:go,UTF16BE:Bo,UTF16LE:Ro,UTF32BE:Wo,UTF32LE:Ro,cyrb128:function(e){let t=1779033703,n=3144134277,r=1013904242,o=2773480762;for(let a=0;a<e.length;a++){let i=e.charCodeAt(a);t=n^Math.imul(t^i,597399067),n=r^Math.imul(n^i,2869860233),r=o^Math.imul(r^i,951274213),o=t^Math.imul(o^i,2716044179)}return t=Math.imul(r^t>>>18,597399067),n=Math.imul(o^n>>>22,2869860233),r=Math.imul(t^r>>>17,951274213),
o=Math.imul(n^o>>>19,2716044179),t^=n^r^o,n^=t,r^=t,o^=t,[t>>>0,n>>>0,r>>>0,o>>>0]},AsyncLock:class extends mo{#d=!1;#u=[];get locked(){return this.#d}then(e){"function"==typeof e&&(this.#d?this.#u.push(e):e())}lock(){this.#d=!0}unlock(){const e=this.#u;for(const t of e)t();e.length=0,this.#d=!1}},ReadStream:bo,WriteStream:yo,EventEmitter:class extends mo{#h=Object.create(null);on(e,t){const n=this.#h[e]||=[];for(const e of n)if(e.$===t)return void(e.m=!1);n.push({$:t,m:!1})}once(e,t){
const n=this.#h[e]||=[];for(const e of n)if(e.$===t)return void(e.m=!0);n.push({$:t,m:!0})}off(e,t){const n=this.#h;if(null!=e){const r=n[e];if(null!=r&&r.length>0){if(null!=t){for(let e=0;e<r.length;e++)if(r[e].$===t)return r.splice(e,1),!0;return!1}return delete n[e]}return!1}if(null!=t){let e=!1;for(const r of Reflect.ownKeys(n)){const o=n[r];if(null!=o)e:for(let n=0;n<o.length;n++)if(o[n].$===t){o.splice(n,1),e=!0;break e}}return e}let r=!1;for(const e of Object.keys(n))delete n[e]&&(r=!0)
;return r}emit(e,...t){const n=this.#h[e];if(null!=n){let e=!1;for(let r=0;r<n.length;r++){const o=n[r];e=!0,o.m&&n.splice(r--,1),Reflect.apply(o.$,this,t)}return e}return!1}getListeners(e){if(null!=e)return this.#h[e]?.map((e=>e.$))||[];const t=this.#h,n=new Set;for(const e of Reflect.ownKeys(t)){const r=t[e];if(null!=r)for(const e of r)n.add(e.$)}return Array.from(n)}},SecureRandom:class extends Ko{constructor(e){super("number"==typeof(e||=Qe())?e=[e]:e),this.setSeed(e)}#p=Array(256)
;#f=Array(256);#m=0;#g=0;#b=0;#y=0;#v(e,t){const n=(65535&e)+(65535&t);return(e>>>16)+(t>>>16)+(n>>>16)<<16|65535&n}#w(e){let t,n;for(e="number"==typeof e?Math.abs(Math.floor(e)):1;e--;){this.#b=this.#v(this.#b,1),this.#g=this.#v(this.#g,this.#b);for(let e=0;e<256;e++){switch(3&e){case 0:this.#m^=this.#m<<13;break;case 1:this.#m^=this.#m>>>6;break;case 2:this.#m^=this.#m<<2;break;case 3:this.#m^=this.#m>>>16}this.#m=this.#v(this.#p[e+128&255],this.#m),t=this.#p[e],
this.#p[e]=n=this.#v(this.#p[t>>>2&255],this.#v(this.#m,this.#g)),this.#f[e]=this.#g=this.#v(this.#p[n>>>10&255],t)}}}rand(){return this.#y--||(this.#w(),this.#y=255),(this.#f[this.#y]>>>0)/4294967296}reset(){this.#m=this.#g=this.#b=this.#y=0,this.#p.fill(0,0,256),this.#f.fill(0,0,256)}setSeed(e){let t,n,r,o,a,i,s,c;t=n=r=o=a=i=s=c=2654435769,"number"==typeof e&&(e=[e]),Array.isArray(e)||(e=[0]),this.reset();const l=this.#f,d=this.#p
;for(let t=0;t<e.length;t++)l[255&t]+="number"==typeof e[t]?e[t]:0;const u=()=>{t^=n<<11,o=this.#v(o,t),n=this.#v(n,r),n^=r>>>2,a=this.#v(a,n),r=this.#v(r,o),r^=o<<8,i=this.#v(i,r),o=this.#v(o,a),o^=a>>>16,s=this.#v(s,o),a=this.#v(a,i),a^=i<<10,c=this.#v(c,a),i=this.#v(i,s),i^=s>>>4,t=this.#v(t,i),s=this.#v(s,c),s^=c<<8,n=this.#v(n,s),c=this.#v(c,t),c^=t>>>9,r=this.#v(r,c),t=this.#v(t,n)};for(let e=0;e<4;e++)u();for(let e=0;e<256;e+=8)t=this.#v(t,l[e+0]),n=this.#v(n,l[e+1]),r=this.#v(r,l[e+2]),
o=this.#v(o,l[e+3]),a=this.#v(a,l[e+4]),i=this.#v(i,l[e+5]),s=this.#v(s,l[e+6]),c=this.#v(c,l[e+7]),u(),d[e+0]=t,d[e+1]=n,d[e+2]=r,d[e+3]=o,d[e+4]=a,d[e+5]=i,d[e+6]=s,d[e+7]=c;for(let e=0;e<256;e+=8)t=this.#v(t,d[e+0]),n=this.#v(n,d[e+1]),r=this.#v(r,d[e+2]),o=this.#v(o,d[e+3]),a=this.#v(a,d[e+4]),i=this.#v(i,d[e+5]),s=this.#v(s,d[e+6]),c=this.#v(c,d[e+7]),u(),d[e+0]=t,d[e+1]=n,d[e+2]=r,d[e+3]=o,d[e+4]=a,d[e+5]=i,d[e+6]=s,d[e+7]=c;this.#w(),this.#y=256}},BufferReadStream:class extends bo{#k;#C
;constructor(e,t){super(),this.#k=t||0,this.#C=e}read(){return this.#C[this.#k++]}readBuf(e){const t=this.#C.subarray(this.#k,this.#k+=e.byteLength);return e.set(t,0),t.byteLength}readNBytes(e){return this.#C.subarray(this.#k,this.#k+=e)}setIndex(e){this.#k=e}setBuffer(e){this.#C=e}get closed(){return!1}close(){}},BufferWriteStream:class extends yo{#E=[];#x=0;write(e){"number"==typeof e?(this.#E.push(e),this.#x++):(this.#E.push(e),this.#x+=e.byteLength)}toBuffer(){const e=new Uint8Array(this.#x)
;let t=0;for(const n of this.#E)"number"!=typeof n?(e.set(n,t),t+=n.byteLength):e[t++]=n;return e}get closed(){return!1}flush(){}close(){}}};Object.setPrototypeOf(ta,null),Object.defineProperty(ta,"NettleWeb",{value:ta,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(ta,Symbol.toStringTag,{value:"NettleWeb",writable:!1,enumerable:!1,configurable:!1})
;const na=Object.freeze(ta),ra="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof global?global:"object"==typeof self?self:Function("return this;")();if(null==ra||"object"!=typeof ra)throw Error("Failed to resolve global object");"NettleWeb"in ra||Object.defineProperty(ra,"NettleWeb",{value:na,writable:!1,enumerable:!1,configurable:!1});const oa=na,aa=[.2,3/8,5/9,2/3],ia=(e,t)=>n=>{
const r=4*e+n-4,o="*-04-39?2$%%$%%'$%''%'''%')(%'))%(++'(++'(+.'+-.',/3',33)-/5)-43).36)058*18<+37<+4:<,4:E,5<A-7>C/8@F/:EH/<EK0=FM1?IP2@KS3BNV4DPY5FS\\6HV_6IXb7K[e8N^i9Pam;Rdp<Tgt".charCodeAt(r)-35,a=r>8?o:1,i=t/a|0,s=t%a,c=a-s,l=r>8?i*aa[n]+(e>5)&-2:o,d=i-l;return{t:8*(c*d+s*(d+1)),o:s?[[c,d],[s,d+1]]:[[c,d]],i:l}},sa=0,ca=3,la=e=>new Uint8Array(e),da=e=>{const t=Error("lean-qr error "+e);throw t.code=e,t
},ua=e=>"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".indexOf(e),ha=e=>e.charCodeAt(0),pa=(...e)=>(t,n)=>e.forEach((e=>e(t,n))),fa=e=>t=>{t.eci!==e&&(t.push(7,4),t.push(e,8),t.eci=e)},ma=e=>(t,n)=>{t.push(4,4),t.push(e.length,8+8*(n>9)),e.forEach((e=>t.push(e,8)))},ga=(e,t,n,r,o=(e,t)=>n(e.length,t),a=(r?t=>pa(fa(r),e(t)):e))=>(a.test=t,a.l=n,a.est=o,a.eci=r&&[r],a),ba=ga((e=>(t,n)=>{t.push(1,4),t.push(e.length,10+2*(n>26)+2*(n>9));let r=0;for(;r<e.length-2;r+=3)t.push(+e.slice(r,r+3),10)
;r<e.length-1?t.push(+e.slice(r,r+2),7):r<e.length&&t.push(+e[r],4)}),/./.test.bind(/[0-9]/),((e,t)=>14+2*(t>26)+2*(t>9)+10*e/3)),ya=ga((e=>(t,n)=>{t.push(2,4),t.push(e.length,9+2*(n>26)+2*(n>9));let r=0;for(;r<e.length-1;r+=2)t.push(45*ua(e[r])+ua(e[r+1]),11);r<e.length&&t.push(ua(e[r]),6)}),(e=>ua(e)>=0),((e,t)=>13+2*(t>26)+2*(t>9)+5.5*e)),va=ga((e=>ma([...e].map(ha))),(e=>ha(e)<128),((e,t)=>12+8*(t>9)+8*e));va.u=!0;const wa=ga(va,(e=>ha(e)<256),va.l,3);wa.u=!0
;const ka=new TextEncoder,Ca=ga((e=>ma(ka.encode(e))),(()=>1),0,26,((e,t)=>12+8*(t>9)+8*ka.encode(e).length));Ca.u=!0;let Ea=()=>{const e=new Map,t=new TextDecoder("sjis"),n=la(2);for(let r=0;r<7973;++r)n[0]=r/192+129+64*(r>5951),n[1]=r%192+64,e.set(t.decode(n),r);return e.delete("\ufffd"),Ea=()=>e,e};const xa=ga((e=>(t,n)=>{t.push(8,4),t.push(e.length,8+2*(n>26)+2*(n>9));for(const n of e)t.push(Ea().get(n),13)}),(e=>Ea().has(e)),((e,t)=>12+2*(t>26)+2*(t>9)+13*e));xa.u=!0
;const Aa=[ba,ya,va,wa,xa,Ca],Ta=(e,{modes:t=Aa}={})=>(n,r)=>{let o=1;for(const n of t){const t=new Map;n._=o<<=1,n.m=n.est("",r),n.h=n.l?(e,o)=>{const a=o-e,i=t.get(a)??n.l(a,r);return t.set(a,i),i}:(o,a)=>{const i=e.slice(o,a),s=t.get(i)??n.est(i,r);return t.set(i,s),s}}let a=[{S:0}],i=0,s=0,c=-1;for(const n of[...e,""]){let e=0;if(n)for(const r of t)r.test(n)&&(e|=r._);if(!n||e!==c){if(-1!==c){const e=new Set(a.map((e=>e.v))),n=[];for(const r of t.filter((e=>c&e._))){const t=r.h(i,s)
;for(const o of r.eci??e){if(r===va&&o)continue;let e;for(const n of a)if(n.v===o||r.eci){const a=n.C===r&&n.v===o,c=a?n.D:n,l=a?n.V:i;let d;d=r.u&&a?n.S+t-r.m:c.S+12*(c.v!==o)+(l===i?t:r.h(l,s)),(!e||d<e.S)&&(e={V:l,D:c,C:r,v:o,$:s,S:d})}e&&n.push(e)}}n.length||da(5),a=n}c=e,i=s}s+=n.length}const l=[];for(let t=a.reduce(((e,t)=>t.S<e.S?t:e));t.C;t=t.D)l.unshift(t.C(e.slice(t.V,t.$)));l.forEach((e=>e(n,r)))},La=()=>({A:la(2956),F:0,push(e,t){for(let n=t,r=8-(7&this.F);n>0;n-=r,
r=8)this.A[this.F>>3]|=e<<r>>n,this.F+=n<r?n:r}}),Ia=(e,t=e*e,n=la(t))=>({size:e,I:n,get:(t,r)=>t>=0&&t<e&&!!(1&n[r*e+t]),K(t,r,o){n[r*e+t]=o},toString({on:t="##",off:n=" ",lf:r="\n",padX:o=4,padY:a=4}={}){let i="";for(let s=-a;s<e+a;++s){for(let r=-o;r<e+o;++r)i+=this.get(r,s)?t:n;i+=r}return i},toImageData(t,{on:n=[0,0,0],off:r=[0,0,0,0],padX:o=4,padY:a=4}={}){const i=e+2*o,s=e+2*a,c=t.createImageData(i,s),l=new Uint32Array(c.data.buffer);c.data.set([...n,255]);const d=l[0]
;c.data.set([...r,255]);const u=l[0];for(let e=0;e<s;++e)for(let t=0;t<i;++t)l[e*i+t]=this.get(t-o,e-a)?d:u;return c},toCanvas(e,t){const n=e.getContext("2d"),r=this.toImageData(n,t);e.width=r.width,e.height=r.height,n.putImageData(r,0,0)},toDataURL({type:e="image/png",scale:t=1,...n}={}){const r=document.createElement("canvas"),o=r.getContext("2d"),a=this.toImageData(o,n);return r.width=a.width*t,r.height=a.height*t,o.putImageData(a,0,0),o.imageSmoothingEnabled=!1,
o.globalCompositeOperation="copy",o.drawImage(r,0,0,a.width,a.height,0,0,r.width,r.height),r.toDataURL(e,1)}}),Sa=[(e,t)=>!(1&(e^t)),(e,t)=>!(1&t),e=>!(e%3),(e,t)=>!((e+t)%3),(e,t)=>!(1&(e/3^t>>1)),(e,t)=>!((e&t&1)+e*t%3),(e,t)=>!((e&t&1)+e*t%3&1),(e,t)=>!((1&(e^t))+e*t%3&1)],Ma=la(512);Ma[0]=1;for(let e=0,t=1;e<255;Ma[++e]=t)Ma[t+256]=e,t*=2,256&t&&(t^=285);const ja=e=>Ma[e%255],Oa=e=>Ma[e+256],Pa=(e,t)=>{const n=la(e.length+t.length-1)
;for(let r=0;r<e.length;++r)for(let o=0;o<t.length;++o)n[r+o]^=ja(e[r]+t[o]);return n.map(Oa)},_a=(e,t)=>{const n=la(e.length+t.length-1);n.set(e,0);for(let r=0;r<e.length;++r)if(n[r]){const e=Oa(n[r]);for(let o=0;o<t.length;++o)n[r+o]^=ja(t[o]+e)}return n.slice(e.length)},Fa=[[0],[0,0]];for(let e=1,t=Fa[1];e<30;++e){const n=Pa(t,[0,e]);Fa.push(n),t=n}const Da=(e,t)=>{const n=[[],[]];let r=0,o=0;for(const[a,i]of t.o)for(let s=0;s<a;++s,r+=i){const a=e.slice(r,r+i);n[0].push(a),
n[1].push(_a(a,Fa[t.i])),o+=i+t.i}const a=la(o);let i=0;for(const e of n)for(let t,n=0;i!==t;++n){t=i;for(const t of e)n<t.length&&(a[i++]=t[n])}return a},Na=(e,t,n)=>{let r=e<<n-1;for(let e=134217728;e;e>>=1)r&e&&(r^=t*(e>>n-1));return r},Ua=({size:e,I:t,K:n},r)=>{const o=(n,r,o,a,i)=>{for(;a-- >0;){const s=(r+a)*e+n;t.fill(i,s,s+o)}},a=(e,t)=>{o(e-3,t-3,7,7,3),o(e-2,t-2,5,5,2),o(e-1,t-1,3,3,3)},i=(e,t)=>{o(e-2,t-2,5,5,3),o(e-1,t-1,3,3,2),n(e,t,3)};o(7,0,2,9,2),o(e-8,0,8,9,2)
;for(let t=0;t<e;++t)n(t,6,3^1&t);if(a(3,3),a(e-4,3),r>1){const t=1+(r/7|0),n=2*((e-13)/t/2+.75|0);for(let r=0;r<t;++r){const o=e-7-r*n;r&&i(o,6);for(let r=0;r<t;++r)i(o,e-7-r*n)}}if(r>6)for(let t=r<<12|Na(r,7973,13),o=0;o<6;++o)for(let r=12;r-- >9;t>>=1)n(e-r,o,2|1&t);for(let n=0;n<e;++n)for(let r=n;r<e;++r)t[r*e+n]=t[n*e+r];n(8,e-8,3)},Ba=({size:e,I:t})=>{const n=[];for(let r=e-2,o=e,a=-1;r>=0;r-=2){for(5===r&&(r=4);o+=a,-1!==o&&o!==e;){const a=o*e+r;t[a+1]<2&&n.push(a+1),t[a]<2&&n.push(a)}
a*=-1}return n},Ha=({I:e},t,n)=>t.forEach(((t,r)=>e[t]=n[r>>3]>>7-(7&r)&1)),Ra=({size:e,I:t,K:n},r,o,a)=>{for(let n=0;n<e;++n)for(let o=0;o<e;++o){const a=n*e+o;t[a]^=r(o,n)&(t[a]>>1^1)}const i=(1^a)<<3|o;let s=21522^(i<<10|Na(i,1335,11));for(let t=8;t-- >0;s>>=1)n(8,(t>1?7:8)-t,s),n(e-8+t,8,s);for(let t=7;t-- >0;s>>=1)n(t>5?7:t,8,s),n(8,e-t-1,s)},za=({size:e,I:t},n=0,r=0)=>{for(let o=0;o<e;++o){for(let a=0;a<2;++a)for(let i,s=0,c=0,l=0;s<e;++s){const d=1&t[a?o*e+s:s*e+o];r+=d,
c=(c>>1|2098176)&(3047517^d-1),2049&c&&(n+=40),d!==i?(l=1,i=d):++l>4&&(n+=l<6?3:1)}if(o)for(let r=1,a=1&t[o-1],i=(1&t[o])===a;r<e;++r){const s=1&t[r*e+o-1],c=(1&t[r*e+o])===s;n+=3*(i&&c&&a===s),a=s,i=c}}return n+10*(20*Math.abs(r/(e*e*2)-.5)|0)},Wa=[],qa=(e=da(1),{minCorrectionLevel:t=sa,maxCorrectionLevel:n=ca,minVersion:r=1,maxVersion:o=40,mask:a,trailer:i=60433,...s}={})=>{n<t&&da(3),o<r&&da(2),"string"==typeof e&&(e=Ta(e,s));for(let s=r,c=0;s<=o;++s){let r=Wa[s];r||(Wa[s]=r=Ia(4*s+17),
Ua(r,s),r.p=Ba(r));const o=ia(s,r.p.length>>3);if(o(t).t<c)continue;const l=La();e(l,s),c=l.F;for(let e=n;e>=t;--e){const t=o(e);if(t.t<c)continue;for(l.push(0,4),l.F=l.F+7&-8;l.F<t.t;)l.push(i,16);const n=Ia(r.size,r.I);return Ha(n,r.p,Da(l.A,t)),(Sa[a??-1]?[Sa[a]]:Sa).map(((t,r)=>{const o=Ia(n.size,n.I);return Ra(o,t,a??r,e),o.s=za(o),o})).reduce(((e,t)=>t.s<e.s?t:e))}}da(4)};qa.with=(...e)=>(t,n)=>qa(t,{modes:[...Aa,...e],...n})
;var Va=Uint8Array,Ga=Uint16Array,Ka=Int32Array,Ya=new Va([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Za=new Va([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qa=new Va([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xa=function(e,t){for(var n=new Ga(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Ka(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)o[a]=a-n[r]<<5|r;return{b:n,r:o}},Ja=Xa(Ya,2),$a=Ja.b,ei=Ja.r;$a[28]=258,ei[258]=28
;for(var ti=Xa(Za,0),ni=ti.b,ri=(ti.r,new Ga(32768)),oi=0;oi<32768;++oi){var ai=(43690&oi)>>1|(21845&oi)<<1;ai=(61680&(ai=(52428&ai)>>2|(13107&ai)<<2))>>4|(3855&ai)<<4,ri[oi]=((65280&ai)>>8|(255&ai)<<8)>>1}var ii=function(e,t,n){for(var r=e.length,o=0,a=new Ga(t);o<r;++o)e[o]&&++a[e[o]-1];var i,s=new Ga(t);for(o=1;o<t;++o)s[o]=s[o-1]+a[o-1]<<1;if(n){i=new Ga(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],d=t-e[o],u=s[e[o]-1]++<<d,h=u|(1<<d)-1;u<=h;++u)i[ri[u]>>c]=l
}else for(i=new Ga(r),o=0;o<r;++o)e[o]&&(i[o]=ri[s[e[o]-1]++]>>15-e[o]);return i},si=new Va(288);for(oi=0;oi<144;++oi)si[oi]=8;for(oi=144;oi<256;++oi)si[oi]=9;for(oi=256;oi<280;++oi)si[oi]=7;for(oi=280;oi<288;++oi)si[oi]=8;var ci=new Va(32);for(oi=0;oi<32;++oi)ci[oi]=5;var li=ii(si,9,1),di=ii(ci,5,1),ui=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},hi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},pi=function(e,t){var n=t/8|0
;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},fi=function(e){return(e+7)/8|0},mi=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new Va(e.subarray(t,n))},gi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],bi=function(e,t,n){var r=Error(t||gi[e])
;if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,bi),!n)throw r;return r},yi=function(e,t,n,r){var o=e.length,a=r?r.length:0;if(!o||t.f&&!t.l)return n||new Va(0);var i=!n,s=i||2!=t.i,c=t.i;i&&(n=new Va(3*o));var l=function(e){var t=n.length;if(e>t){var r=new Va(Math.max(2*t,e));r.set(n),n=r}},d=t.f||0,u=t.p||0,h=t.b||0,p=t.l,f=t.d,m=t.m,g=t.n,b=8*o;do{if(!p){d=hi(e,u,1);var y=hi(e,u+1,3);if(u+=3,!y){var v=e[(M=fi(u)+4)-4]|e[M-3]<<8,w=M+v;if(w>o){c&&bi(0);break}s&&l(h+v),
n.set(e.subarray(M,w),h),t.b=h+=v,t.p=u=8*w,t.f=d;continue}if(1==y)p=li,f=di,m=9,g=5;else if(2==y){var k=hi(e,u,31)+257,C=hi(e,u+10,15)+4,E=k+hi(e,u+5,31)+1;u+=14;for(var x=new Va(E),A=new Va(19),T=0;T<C;++T)A[Qa[T]]=hi(e,u+3*T,7);u+=3*C;var L=ui(A),I=(1<<L)-1,S=ii(A,L,1);for(T=0;T<E;){var M,j=S[hi(e,u,I)];if(u+=15&j,(M=j>>4)<16)x[T++]=M;else{var O=0,P=0;for(16==M?(P=3+hi(e,u,3),u+=2,O=x[T-1]):17==M?(P=3+hi(e,u,7),u+=3):18==M&&(P=11+hi(e,u,127),u+=7);P--;)x[T++]=O}}
var _=x.subarray(0,k),F=x.subarray(k);m=ui(_),g=ui(F),p=ii(_,m,1),f=ii(F,g,1)}else bi(1);if(u>b){c&&bi(0);break}}s&&l(h+131072);for(var D=(1<<m)-1,N=(1<<g)-1,U=u;;U=u){var B=(O=p[pi(e,u)&D])>>4;if((u+=15&O)>b){c&&bi(0);break}if(O||bi(2),B<256)n[h++]=B;else{if(256==B){U=u,p=null;break}var H=B-254;if(B>264){var R=Ya[T=B-257];H=hi(e,u,(1<<R)-1)+$a[T],u+=R}var z=f[pi(e,u)&N],W=z>>4;if(z||bi(3),u+=15&z,F=ni[W],W>3&&(R=Za[W],F+=pi(e,u)&(1<<R)-1,u+=R),u>b){c&&bi(0);break}s&&l(h+131072);var q=h+H
;if(h<F){var V=a-F,G=Math.min(F,q);for(V+h<0&&bi(3);h<G;++h)n[h]=r[V+h]}for(;h<q;++h)n[h]=n[h-F]}}t.l=p,t.p=U,t.b=h,t.f=d,p&&(d=1,t.m=m,t.d=f,t.n=g)}while(!d);return h!=n.length&&i?mi(n,0,h):n.subarray(0,h)},vi=new Va(0),wi="undefined"!=typeof TextDecoder&&new TextDecoder;try{wi.decode(vi,{stream:!0})}catch(e){}"function"==typeof queueMicrotask&&queueMicrotask
;const ki=Object.freeze(oa.NTON.decode(Xe(oa.Base64.decode("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"))))
;let Ci="whitespider";const{p:Ei,s:xi,y:Ai,e:Ti}=ki.x;Ei&&xi&&Ai&&(Ci=xi+Ti+"3.sha"+Ai+Ei+"/",Ci.length<10&&(Ci=""));const Li=Ci;let Ii;const Si=Object.freeze(Object.setPrototypeOf({_:({console:e})=>{if(null==e||"object"!=typeof e)throw Error("Invalid interface");const t=Reflect.get(e,"log",void 0);if("function"!=typeof t)throw Error("Invalid instance impl");Ii=(...e)=>(Reflect.apply(t,null,e),!0)},get $(){return Ii}},null)),Mi=Si,ji=Object.freeze(Object.setPrototypeOf({length:0,clear:()=>{},
setItem:()=>{},getItem:()=>null,removeItem:()=>{}},null)),Oi=Object.create(null);Oi.open="0",Oi.close="1",Oi.ping="2",Oi.pong="3",Oi.message="4",Oi.upgrade="5",Oi.noop="6";const Pi=Object.create(null);Object.keys(Oi).forEach((e=>{Pi[Oi[e]]=e}));const _i={type:"error",data:"parser error"
},Fi="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Di="function"==typeof ArrayBuffer,Ni=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Ui=({type:e,data:t},n,r)=>Fi&&t instanceof Blob?n?r(t):Bi(t,r):Di&&(t instanceof ArrayBuffer||Ni(t))?n?r(t):Bi(new Blob([t]),r):r(Oi[e]+(t||"")),Bi=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1]
;t("b"+(e||""))},n.readAsDataURL(e)};let Hi;const Ri="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zi="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)zi[Ri.charCodeAt(e)]=e;const Wi="function"==typeof ArrayBuffer,qi=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Gi(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:Vi(e.substring(1),t)}:Pi[n]?e.length>1?{type:Pi[n],data:e.substring(1)}:{type:Pi[n]}:_i},Vi=(e,t)=>{if(Wi){
const n=(e=>{let t,n,r,o,a,i=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const l=new ArrayBuffer(i),d=new Uint8Array(l);for(t=0;t<s;t+=4)n=zi[e.charCodeAt(t)],r=zi[e.charCodeAt(t+1)],o=zi[e.charCodeAt(t+2)],a=zi[e.charCodeAt(t+3)],d[c++]=n<<2|r>>4,d[c++]=(15&r)<<4|o>>2,d[c++]=(3&o)<<6|63&a;return l})(e);return Gi(n,t)}return{base64:!0,data:e}},Gi=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;let Ki
;nt.prototype.on=nt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},nt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},nt.prototype.off=nt.prototype.removeListener=nt.prototype.removeAllListeners=nt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this
;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},nt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this
},nt.prototype.emitReserved=nt.prototype.emit,nt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},nt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Yi="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Zi="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),Qi=Zi.setTimeout,Xi=Zi.clearTimeout;class Ji extends Error{
constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class $i extends nt{constructor(e){super(),this.writable=!1,ot(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Ji(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){
"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=qi(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){
return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class es extends $i{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{
this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split("\x1e"),r=[];for(let e=0;e<n.length;e++){const o=qi(n[e],t);if(r.push(o),"error"===o.type)break}return r})(e,this.socket.binaryType).forEach((e=>{
if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=Array(n);let o=0;e.forEach(((e,a)=>{Ui(e,!1,(e=>{
r[a]=e,++o===n&&t(r.join("\x1e"))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=at()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ts=!1;try{ts="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(bi){}const ns=ts;class rs extends es{constructor(e){if(super(e),
"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class os extends nt{
constructor(e,t,n){super(),this.createRequest=e,ot(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=rt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0)
;for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),
n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=os.requestsCount++,os.requests[this._index]=this)}_onError(e){
this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=it,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete os.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}os.requestsCount=0,os.requests={},
"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",st):"function"==typeof addEventListener&&addEventListener("onpagehide"in Zi?"pagehide":"unload",st,!1));const as=function(){const e=ct({xdomain:!1});return e&&null!==e.responseType}(),is="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ss extends $i{get name(){return"websocket"}doOpen(){
const e=this.uri(),t=this.opts.protocols,n=is?{}:rt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{
this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Ui(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}r&&Yi((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){
void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=at()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const cs=Zi.WebSocket||Zi.MozWebSocket,ls={websocket:class extends ss{createSocket(e,t,n){return is?new cs(e,t,n):t?new cs(e,t):new cs(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends $i{get name(){return"webtransport"}doOpen(){try{
this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){Ki||(Ki=new TextDecoder);const n=[];let r=0,o=-1,a=!1;return new TransformStream({transform(i,s){for(n.push(i);;){if(0===r){if(et(n)<1)break
;const e=tt(n,1);a=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(et(n)<2)break;const e=tt(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(et(n)<8)break;const e=tt(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2097151){s.enqueue(_i);break}o=4294967296*a+t.getUint32(4),r=3}else{if(et(n)<o)break;const e=tt(n,o);s.enqueue(qi(a?e:Ki.decode(e),t)),r=0}if(0===o||o>e){s.enqueue(_i);break}}}})
}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=$e();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((()=>{}))};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1
;this._writer.write(n).then((()=>{r&&Yi((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends rs{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=as&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new os(ct,this.uri(),e)}}
},ds=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,us=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],hs="function"==typeof addEventListener&&"function"==typeof removeEventListener,ps=[]
;hs&&addEventListener("offline",(()=>{ps.forEach((e=>e()))}),!1);class fs extends nt{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=lt(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=lt(t.host).host);ot(this,t),
this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),
this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=")
;t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),hs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ps.push(this._offlineEventListener))),
this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0)
;const e=this.opts.rememberUpgrade&&fs.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){
this.readyState="open",fs.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":
const t=Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer)
;const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){
const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n
}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this._maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Yi((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,
t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)}
;return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(fs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){
if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ps.indexOf(this._offlineEventListener);-1!==e&&ps.splice(e,1)}this.readyState="closed",this.id=null,
this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}fs.protocol=4;class ms extends fs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){function t(){i||(i=!0,l(),a.close(),a=null)}function n(){c("transport closed")}function r(){c("socket closed")}function o(e){a&&e.name!==a.name&&t()}let a=this.createTransport(e),i=!1
;fs.priorWebsocketSuccess=!1;const s=()=>{i||(a.send([{type:"ping",data:"probe"}]),a.once("packet",(e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",a),!a)return;fs.priorWebsocketSuccess="websocket"===a.name,this.transport.pause((()=>{i||"closed"!==this.readyState&&(l(),this.setTransport(a),a.send([{type:"upgrade"}]),this.emitReserved("upgrade",a),a=null,this.upgrading=!1,this.flush())}))}else{const e=Error("probe error");e.transport=a.name,
this.emitReserved("upgradeError",e)}})))},c=e=>{const n=Error("probe error: "+e);n.transport=a.name,t(),this.emitReserved("upgradeError",n)},l=()=>{a.removeListener("open",s),a.removeListener("error",c),a.removeListener("close",n),this.off("close",r),this.off("upgrading",o)};a.once("open",s),a.once("error",c),a.once("close",n),this.once("close",r),this.once("upgrading",o),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{i||a.open()}),200):a.open()}
onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}class gs extends ms{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map((e=>ls[e])).filter((e=>!!e))),super(e,n)}}(async({window:e,document:t})=>{function n(e){
const n=t.getElementById(e);if(null==n)throw Error("Element does not exist: "+e);return n}function r(e){const n=t.querySelector(e);if(n instanceof HTMLElement)return n;throw Error("Failed to query selector: "+e)}function o(e){null!=e?(M.textContent=e,M.style.display="block"):M.style.display="none"}function a(e){try{return new URL(e)}catch(e){return null}}function i(e){for(let t=e.length-1;t>=0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}function s(e){
return"https://"+ki.b+"/"+ki.c+"?OO0O0OO0="+encodeURIComponent(oa.Base64.encode(oa.UTF_8.encode(e)))}function c(e){return new Date(e).toLocaleString("POSIX",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}async function l(t,n){try{const r=await e.fetch(t,{cache:n||"force-cache",method:"GET"});return r.ok?await r.text():null}catch(e){return null}}async function d(e,t,n){try{const r=new Image(512,512);r.loading="eager",r.decoding="sync",
r.draggable=!1;{const t=URL.createObjectURL(e);r.src=t,await r.decode(),URL.revokeObjectURL(t)}let o=r.naturalWidth,a=r.naturalHeight;{const e=null==n?a/o:n/t;a>=o*e?a=Math.floor(o*e):o=Math.floor(a/e)}if((t=Math.min(t,o))<10||(n=null==n?a:Math.min(n,a))<10)throw Error("Image must have at least 100 pixels.");const i=new OffscreenCanvas(t,n),s=i.getContext("2d",{alpha:!1});if(null==s)throw Error("Failed to initialize canvas context.");return s.imageSmoothingEnabled=!0,
s.imageSmoothingQuality="high",s.drawImage(r,0,0,o,a,0,0,t,n),await i.convertToBlob({type:"image/jpeg",quality:100})}catch(e){return null}}async function u(t){let n=0,r=0;const o=[];for(const e of t.split(",")){const t=e.split(";",3);if(3!==t.length)throw Error("Invalid entry value");const n=parseInt(t[1],10),a=parseInt(t[2],10),i=a-n;if(n<0||a<0||i<=0)throw Error("Invalid entry data length");r+=i,o.push({id:t[0],s:n,e:a,l:i})}const a=new Uint8Array(new ArrayBuffer(r),0,r)
;for(const{id:t,s:r,e:i,l:s}of o){const o=await e.fetch("/r/"+t,{cache:"force-cache",method:"GET",headers:{Range:"bytes="+r+"-"+(i-1)}});if(!o.ok)throw Error("Failed to fetch resources: Remote returned error status code: "+o.status);206===o.status&&o.headers.has("content-range")?a.set(new Uint8Array(await o.arrayBuffer(),0,s),n):a.set(new Uint8Array(await o.arrayBuffer(),r,s),n),n+=s}return a.buffer}function h(e,t){return new Promise(((n,r)=>{
const o=new ArrayBuffer((t=oa.NTON.encode(t)).byteLength+10),a=performance.now();{const n=new Uint8Array(o);n[0]=3,n[9]=e,n.set(t,10)}new DataView(o,1,8).setFloat64(0,a,!0),K.send(o,{compress:!0}),W.set(a,[n,r])}))}function p(e){j.appendChild(y(e)),O.style.display="block"}function m(n,r){const o=performance.now().toString(36),a=t.createElement("embed");a.src="/player.html?s="+o,a.type="text/html",a.width="1024",a.height="768";const i=t=>{if(t.origin===e.origin&&t.data===o){const o=t.source
;null!=o&&o.postMessage({id:n,buf:r},{targetOrigin:origin,transfer:Array.isArray(r)?[]:[r]}),e.removeEventListener("message",i)}};return e.addEventListener("message",i,{passive:!0}),a}function g(e){const{name:n,prev:r,date:a}=e,i=t.createElement("a");i.href=a>0?"/"+a.toString(36):"#",i.title="Play "+n,i.target="_self",i.className="game",i.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),ne(e).catch((e=>{S(e),o("Failed to launch game. Message: "+e)})))},
i.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n.replace(/\//g,""))+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,i.appendChild(e)}if(e.path.startsWith("https://")){const e=t.createElement("img");e.src="/res/cloud.svg",e.alt="Cloud",e.title="Embedded from third-party servers",e.width=24,e.height=24,e.loading="lazy",e.decoding="async",e.draggable=!1,i.appendChild(e)}switch(e.type){case"html5":{
const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",i.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",i.appendChild(e)}break;case"dos":{const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",i.appendChild(e)}break;default:i.style.backgroundImage='url("/res/preview.svg")'}return i}function b(e){const n=t.createElement("div");n.className="item",n.onclick=()=>{
te(e).catch((e=>{o("Failed to open the item. Message: "+e)}))},n.style.backgroundImage='url("'+s(e.prev[0])+'"), url("/res/preview.svg")';{const r=t.createElement("div");r.textContent=e.name,n.appendChild(r)}{const r=t.createElement("span");r.textContent="$"+e.price.toFixed(2),n.appendChild(r)}return n}function y(e){if(e.startsWith("https://")){const r=t.createElement("iframe");r.setAttribute("name","Frame"),r.setAttribute("width","1024"),r.setAttribute("height","768"),
r.setAttribute("loading","lazy"),r.setAttribute("sandbox","allow-forms allow-popups allow-scripts allow-same-origin allow-pointer-lock"),r.setAttribute("scrolling","no"),r.setAttribute("frameborder","0"),r.setAttribute("credentialless","true"),r.setAttribute("referrerpolicy","no-referrer"),r.setAttribute("allowfullscreen","true"),r.setAttribute("allowpaymentrequest","true");{
const t="data:application/xhtml+xml;base64,"+oa.Base64.encode(oa.UTF_8.encode(`<?xml version="1.0" encoding="utf-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n\t<head>\n\t\t<meta charset="utf-8" />\n\t\t<meta name="referrer" content="no-referrer" />\n\t\t<meta name="viewport" content="width=device-width,initial-scale=1" />\n\t\t<base href="${origin}" target="_blank" />\n\t\t<link rel="icon" type="image/x-icon" href="res/google.ico" />\n\t\t<link rel="stylesheet" type="text/css" href="data:text/css;base64,Ym9keSxlbWJlZCxpZnJhbWV7cG9zaXRpb246YWJzb2x1dGU7ZGlzcGxheTpibG9jazt3aWR0aDoxMDAlO2hlaWdodDoxMDAlO21hcmdpbjowcHg7cGFkZGluZzowcHg7Ym9yZGVyOm5vbmU7b3ZlcmZsb3c6aGlkZGVuO30K" />\n\t\t<title>Google</title>\n\t</head>\n\t<body>\n\t\t<embed type="text/plain" width="1024" height="768" src="${n=e,
n.replace(/[&<"']/g,(e=>{switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return""}}))}" />\n\t</body>\n</html>`));r.addEventListener("load",(()=>{const e=r.contentWindow;null!=e?(e.stop(),e.focus(),e.location.replace(t)):r.setAttribute("src",t)}),{once:!0,passive:!0}),z.set(r,e)}return r}{const n=t.createElement("embed");return n.setAttribute("type","text/plain"),n.setAttribute("width","1024"),n.setAttribute("height","768"),
n.setAttribute("src",e),n}var n}function v(){ie=null,Q||(t.title="NettleWeb"),x.replaceState(void 0,"","/")}function w(t){const n=e.open(void 0,"_blank","");null!=n?(n.stop(),n.focus(),setTimeout((()=>{n.location.replace(t)}),100)):o("Please allow popups in your browser settings and try again.")}function k(t){const n=e.open(void 0,"_blank","");if(null==n)return void o("Please allow popups in your browser settings and try again.");n.focus();const r=n.document
;r.head.innerHTML='<meta charset="utf-8" /><meta name="referrer" content="no-referrer"/><meta name="viewport" content="width=device-width,initial-scale=1"/><base href="'+e.origin+'" target="_blank" /><link rel="icon" type="image/x-icon" href="res/google.ico" /><link rel="stylesheet" type="text/css" href="data:text/css;base64,Ym9keSxlbWJlZCxpZnJhbWV7cG9zaXRpb246YWJzb2x1dGU7ZGlzcGxheTpibG9jazt3aWR0aDoxMDAlO2hlaWdodDoxMDAlO21hcmdpbjowcHg7cGFkZGluZzowcHg7Ym9yZGVyOm5vbmU7b3ZlcmZsb3c6aGlkZGVuO30K"/>',
r.body.appendChild(t),r.title="Google"}function C(){const e=t.createElement("iframe");e.setAttribute("id","anchor"),e.setAttribute("name","API Anchor"),e.setAttribute("width","1024"),e.setAttribute("height","768"),e.setAttribute("loading","lazy"),e.setAttribute("scrolling","no"),e.setAttribute("frameborder","0"),e.setAttribute("credentialless","true"),e.setAttribute("referrerpolicy","no-referrer"),e.setAttribute("allowfullscreen","true"),e.setAttribute("allowpaymentrequest","true"),
e.addEventListener("load",(()=>{const t=e.contentWindow;null!=t?(t.stop(),t.focus(),t.location.replace("https://nettleweb.com/?m=1")):e.setAttribute("src","https://nettleweb.com/?m=1")}),{once:!0,passive:!0}),I.appendChild(e)}"complete"!==t.readyState&&await new Promise((e=>{const n=()=>{"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),setTimeout(e,100,null))};t.addEventListener("readystatechange",n,{passive:!0})})),t.title="NettleWeb",Mi._(e),e.focus(),
e.onerror=(e,t,n,r,o)=>{const a="Unhandled error at "+(t||"unknown source")+" "+(n||"X")+":"+(r||"X")+"\n\n Message: "+o;M.textContent=a,M.style.display="block"},e.onkeydown=e=>{if(e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey)switch(e.key){case"h":case"q":e.preventDefault(),e.stopPropagation(),E.replace("https://www.google.com/webhp?igu=1");break;case"b":e.preventDefault(),e.stopPropagation(),I.hasAttribute("style")?I.removeAttribute("style"):I.setAttribute("style","filter: blur(15px);")}},
e.onpopstate=e=>{e.preventDefault(),e.stopPropagation(),o("Notice: Please press ctrl+Q to leave this website.")},e.onappinstalled=e=>{e.preventDefault(),e.stopPropagation(),_.style.display="none"},e.onbeforeinstallprompt=e=>{e.preventDefault(),e.stopPropagation(),_.style.display="block",_.onclick=()=>{e.prompt().catch((e=>{o("Failed to show install prompt. Message: "+e)}))}}
;const E=e.location,x=e.history,A=E.pathname,T=new URLSearchParams(E.search),L=t.head,I=t.body,S=Mi.$,M=n("error"),j=n("frame"),O=n("frame-view"),P=n("status"),_=n("install"),F=n("content"),D=n("accn-btn"),N=n("strm-btn"),U=n("comm-btn"),B=n("nmsg-btn"),H=n("side-menu");{const{_a:ke,_b:Ce,_c:Ee,_d:xe,_e:Ae,_f:Te,_g:Le,_h:Ie,_i:Se,_j:Me,_k:je,_l:Oe,_m:Pe,_n:_e,_o:Fe,_v:De,_w:Ne,_p:Ue,_q:Be,_r:He}=ki;if((()=>{S(ke,Ce);const e=new URL(E.href),n=e.hostname,o=e.origin;switch(e.protocol){case"http:":
if("localhost"!==n)return e.protocol="https:",E.replace(e.href),!1;break;case"https:":break;default:return!0}switch(n){case"whitespider.cf":case"whitespider.tk":case"whitespider.dev":case"whitespider.web.app":case"whitespider.pages.dev":case"whitespider.firebaseapp.com":return e.host="nettleweb.com",e.hash="",e.search="",e.pathname="/",E.replace(e.href),!1}{const e=t[Fe](Ie);if(null==e||e[Me](Se)!==Oe)return!0}for(const e of t[Pe](_e)){switch(e[Me]("type")||""){case"":case"text/javascript":
case"application/javascript":break;default:return e.remove(),!0}const t=e[Me]("src");if(!t||e.textContent)return e.remove(),!0;const n=new URL(t.startsWith("//")?"https:"+t:t,o);if(n.origin!==o){if("https:"===n.protocol){const e=n.host.split("."),t=e.length;if("com"===e[t-1]){const n=e[t-2];if(n.indexOf("google")>=0||n.indexOf("firebase")>=0)continue}}return e.remove(),!0}}return r('link[rel="canonical"]')[Me]("href").slice(0,Ee)!==Te||null==t[Fe](Ue)||null==t[Fe](Be)||t[He]!==ke.slice(2,11)
})()){S(Ae,je);const Re=(new DOMParser).parseFromString(De,"application/xhtml+xml");Re.title=Le;const ze=Re.body;ze.innerHTML=xe;{const We=Re.createElement("button");We.innerHTML=Ne,We.setAttribute("type","button"),We.addEventListener("click",(()=>{E.replace(Te)}),{passive:!0}),ze.appendChild(We)}return void t.documentElement.replaceWith(Re.documentElement)}for(const qe of Object.getOwnPropertyNames(ki))2===qe.length&&delete ki[qe]}if(e!==e.top){if("null"===E.ancestorOrigins?.item(0)){
const Ve=t.createElement("div");return Ve.style.padding="15px",Ve.textContent="Click here to continue",Ve.onclick=()=>{const e=t.createElement("embed");e.type="text/plain",e.width="1280",e.height="720",e.src="https://nettleweb.com/embed.html",k(e)},I.innerHTML="",void I.appendChild(Ve)}if("https://nettleweb.com"!==E.origin)return void E.replace("https://nettleweb.com/embed.html")}se(f({appId:"1:176227430389:web:94270de43b7eb971c03abc",apiKey:"AIzaSyCPXTy7dt3fpcLd8kVTBtXy0xuBdeuhbFc",
projectId:"whitespider",authDomain:"whitespider.firebaseapp.com",databaseURL:"https://whitespider-default-rtdb.firebaseio.com",storageBucket:"whitespider.appspot.com",measurementId:"G-F72WBJT57S",messagingSenderId:"176227430389"},"NettleWeb"));const R="https://nettleweb.com"!==e.origin,z=new WeakMap,W=new Map,q=function(){try{const{localStorage:t}=e;if(null==t)throw Error("Storage interface not available.");const n="___whitespider___",r=Date.now().toString(36);if(t.setItem(n,r),
t.getItem(n)!==r)throw Error("Storage test failed: value mismatch");return t}catch(e){return ji}}();let V,G,K,Y,Z,Q,X,J,$,ee,te,ne,re,oe,ae=[],ie=null,ce=null,le=null,de=null,ue=null,he=null,pe=null,fe=null,me=null,ge=null;if(e.isSecureContext??"https:"===E.protocol){if(q!==ji)try{const Ge=await l("/manifest.json","no-cache");if(null!=Ge){const Ke=JSON.parse(Ge).version;if(Ke!==q.getItem("__mf_version")){I.innerHTML="Updating contents..."
;for(const Ye of await caches.keys())await caches.delete(Ye);return q.setItem("__mf_version",Ke),void E.reload()}n("version").textContent="v"+Ke}V=q.getItem("__secrets_")||void 0}catch(Ze){}else o("Warning: Cookies are blocked by your browser. Some features might not work properly, and your game data will NOT be saved.");try{const Qe=e.navigator.serviceWorker;null!=Qe&&(await Qe.register("/sw.js",{type:"classic",scope:"/",updateViaCache:"none"}),await Qe.ready)}catch(Je){}}try{
const $e=await e.fetch("/d/index.json",{mode:"same-origin",cache:"no-cache",method:"GET"});if(!$e.ok)throw Error("Remote returned error status code: "+$e.status);X=oa.NTON.decode(Xe(new Uint8Array(await $e.arrayBuffer())))}catch(et){return void o("Failed to initialize local game list. Message: "+et)}try{const tt=e.top;null!=tt&&(Z=tt===e?e:tt.origin===e.origin?tt:null)}catch(nt){}M.onclick=()=>{M.innerHTML="",M.style.display="none"},n("frame-close").onclick=()=>{j.innerHTML="",
O.style.display="none"},n("frame-expand").onclick=e=>{if(t.fullscreenEnabled&&!e.ctrlKey)j.requestFullscreen({navigationUI:"hide"}).catch((e=>{o("Failed to enter fullscreen mode. Message: "+e)}));else{const e=j.firstElementChild;if(null!=e){const t=z.get(e)||"";t.startsWith("https://")&&k(y(t))}j.innerHTML="",O.style.display="none"}},n("content-page").outerHTML=ki.pages;{
const rt=r("link[rel*='icon']"),ot=n("overlay"),at=n("notice"),it=n("theme"),st=n("image"),ct=n("font"),lt=n("backend-url"),dt=n("tab-cloaking"),ut=n("stealth-mode"),ht={path:"/K7e8UQ1JqnTj/",secure:!0,upgrade:!0,protocols:[],transports:["polling","websocket"],timestampParam:"x",timestampRequests:!0,rejectUnauthorized:!0,closeOnBeforeunload:!0};let pt;function ft(e){K=new gs(e,ht),P.innerHTML="Connecting...",P.style.color="#808000",K.on("open",(()=>{P.title="",P.innerHTML="\u2713Connected",
P.style.color="#008000"})),K.on("close",(t=>{P.title=t,P.innerHTML="\u2715Disconnected",P.style.color="#ff0000",setTimeout((()=>{ft(e)}),5e3)})),K.on("message",(e=>{const t=new Uint8Array(e,0,e.byteLength);switch(t[0]){case 1:"string"!=typeof G&&(G=oa.UTF_8.decode(t.subarray(1))),null!=ce&&ce();break;case 2:null!=le&&le(oa.UTF_8.decode(t.subarray(1)));break;case 3:t.byteLength>1&&(at.textContent=oa.UTF_8.decode(t.subarray(1)),at.style.display="block");break;case 4:
B.setAttribute("data-unread","");break;case 5:if(null!=he){const e=JSON.parse(oa.UTF_8.decode(t.subarray(1)));he(e[0],e[1])}break;case 6:if(null!=pe){const e=JSON.parse(oa.UTF_8.decode(t.subarray(1)));pe(e[0],e[1],e[2])}break;case 7:if(null!=fe){const e=JSON.parse(oa.UTF_8.decode(t.subarray(1)));fe(e[0],e[1])}break;case 8:if(null!=me){const e=JSON.parse(oa.UTF_8.decode(t.subarray(1)));me(e[0],e[1])}break;case 9:if(null!=ge){const e=JSON.parse(oa.UTF_8.decode(t.subarray(1)));ge(e[0],e[1],e[2])}
break;case 10:null!=de&&de(oa.UTF_8.decode(t.subarray(1)));break;case 11:null!=ue&&ue(oa.UTF_8.decode(t.subarray(1)));break;case 12:{const n=new DataView(e,1,8).getFloat64(0,!0),r=W.get(n);null!=r&&(r[0](oa.NTON.decode(t.subarray(9))),W.delete(n))}break;case 13:{const n=new DataView(e,1,8).getFloat64(0,!0),r=W.get(n);null!=r&&(r[1](oa.UTF_8.decode(t.subarray(9))),W.delete(n))}break;default:S("[WARN] Received invalid message ID: ",t[0])}})),null!=V&&K.send(oa.UTF_8.encode("\x01"+V))}
function mt(e){if(null==Y){const{q:e,r:t}=ki;null!=e&&null!=t&&(Y=e+t+Li)}null!=K&&K.close(),ft(e||Y||"https://service.nettleweb.com/")}function gt(e){"mono"===e?I.style.fontFamily='"Ubuntu Mono", monospace':I.style.removeProperty("font-family")}function bt(e){e.startsWith("data:image/jpeg;base64,")?I.style.background='url("'+e+'")':I.style.removeProperty("background")}function yt(e){switch(null==pt&&(pt=t.createElement("link"),pt.rel="stylesheet",pt.type="text/css",pt.href="index.dark.css",
L.appendChild(pt)),e){case"light":pt.href="data:text/css;base64,",pt.removeAttribute("media");break;case"dark":pt.href="index.dark.css",pt.removeAttribute("media");break;default:pt.href="index.dark.css",pt.media="all and (prefers-color-scheme: dark)"}}function vt(e){switch(e){case"empty":Q=!0,t.title="\u2060",rt.type="image/x-icon",rt.href="/res/empty.ico";break;case"google":Q=!0,t.title="Google",rt.type="image/x-icon",rt.href="/res/google.ico";break;case"classroom":Q=!0,t.title="Home",
rt.type="image/png",rt.href="/res/classroom.png";break;default:Q=!1,t.title="NettleWeb",rt.type="image/x-icon",rt.href="/favicon.ico"}}function wt(e){switch(e){case"blank":t.onblur=t.onmouseleave=e=>{ot.hasAttribute("data-x")||(e.preventDefault(),e.stopPropagation(),ot.setAttribute("data-x","1"))},t.onmousedown=t.ontouchstart=e=>{ot.hasAttribute("data-x")&&(e.preventDefault(),e.stopPropagation(),ot.removeAttribute("data-x"))},ot.innerHTML="",ot.removeAttribute("data-x");break;case"google":
t.onblur=t.onmouseleave=e=>{ot.hasAttribute("data-x")||(e.preventDefault(),e.stopPropagation(),ot.setAttribute("data-x","1"))},t.onmousedown=t.ontouchstart=e=>{ot.hasAttribute("data-x")&&(e.preventDefault(),e.stopPropagation(),ot.removeAttribute("data-x"))},
ot.innerHTML='<iframe width="1024" height="768" allowfullscreen="true" allowpaymentrequest="true" name="Frame" allow="fullscreen payment" loading="lazy" scrolling="no" frameborder="0" credentialless="true" referrerpolicy="no-referrer" src="https://www.google.com/webhp?igu=1"></iframe>',ot.removeAttribute("data-x");break;default:ot.innerHTML="",ot.removeAttribute("data-x"),t.onblur=t.onmouseleave=t.onmousedown=t.ontouchstart=null}}it.onchange=()=>{const e=it.value;yt(e),q.setItem("__set_theme",e)
},st.onchange=async()=>{const e=st.files?.item(0);if(null!=e){if(e.size>10485760)return void o("Error: Selected file is too large.");const t=await d(e,1280);if(null==t)return void o("Error: Failed to decode image file.");const n="data:image/jpeg;base64,"+oa.Base64.encode(new Uint8Array(await t.arrayBuffer()));bt(n),q.setItem("__set_image",n)}else bt(""),q.setItem("__set_image","")},ct.onchange=()=>{const e=ct.value;gt(e),q.setItem("__set_font",e)},lt.onblur=()=>{const e=a(lt.value.trim())
;if(null!=e){const t=e.href;q.setItem("__backendURL_",t),mt(lt.value=t)}else q.removeItem("__backendURL_"),mt(lt.value="")},dt.onchange=()=>{const e=dt.value;vt(e),q.setItem("__set_tabc",e)},ut.onchange=()=>{const e=ut.value;wt(e),q.setItem("__set_sm",e)},gt(ct.value=q.getItem("__set_font")||"normal"),bt(q.getItem("__set_image")||""),yt(it.value=q.getItem("__set_theme")||"default"),vt(dt.value=q.getItem("__set_tabc")||"disabled"),mt(lt.value=q.getItem("__backendURL_")||""),
wt(ut.value=q.getItem("__set_sm")||"disabled")}n("clear-data").onclick=async()=>{for(const e of await caches.keys())await caches.delete(e);q.clear(),E.reload()},n("clear-cache").onclick=async()=>{for(const e of await caches.keys())await caches.delete(e);E.reload()};{const kt=n("headlines");h(47).then((e=>{if(Array.isArray(e))if(0!==e.length){kt.innerHTML="";for(const n of e){const e=t.createElement("div"),r=n.urlToImage||null;{const n=t.createElement("img");n.src=null==r?"/res/preview.svg":s(r),
n.alt="Preview",n.width=160,n.height=90,n.loading="lazy",n.decoding="async",n.draggable=!1,e.appendChild(n)}{const r=t.createElement("div");{const e=t.createElement("div");e.className="title",e.textContent=n.title,r.appendChild(e)}{const e=t.createElement("div");e.className="desc",e.textContent=n.description||"Description is not available for this article.",r.appendChild(e)}{const e=t.createElement("div");e.className="time",
e.textContent="Source: "+(n.source.name||"unknown")+"; Author: "+(n.author||"unknown")+"; Published at "+c(n.publishedAt),r.appendChild(e)}e.appendChild(r)}e.onclick=()=>{w(n.url)},kt.appendChild(e)}}else kt.innerHTML="No articles are available at this moment.";else kt.innerHTML="Error: Failed to parse server response."})).catch((e=>{kt.textContent="Failed to fetch from the API server. Message: "+e}))}{
const Ct=n("game-container"),Et=n("comments"),xt=n("player"),At=n("share"),Tt=n("like"),Lt=n("game-page"),It=n("ecode"),St=n("edit"),Mt=n("name"),jt=n("type"),Ot=n("tags"),Pt=n("date"),_t=n("user"),Ft=n("desc"),Dt=n("code"),Nt=n("lock"),Ut=n("comm"),Bt=n("post"),Ht=n("e-name"),Rt=n("e-tags"),zt=n("e-desc"),Wt=n("e-subm"),qt=n("editor"),Vt=n("s-games"),Gt=n("loadmore"),Kt=n("controller"),Yt=n("gnav-back"),Zt=n("gnav-forward"),Qt=n("gnav-page-no"),Xt=n("gnav-page-count"),Jt=[]
;let $t="p",en="all",tn="",nn=0;{const cn=n("game-search"),ln=r("#game-search>input");let dn=0;cn.onsubmit=e=>{e.preventDefault(),e.stopPropagation(),tn=ln.value.trim().toLowerCase(),clearTimeout(dn),on()},ln.onblur=()=>{tn=ln.value.trim().toLowerCase(),clearTimeout(dn),on()},ln.oninput=()=>{clearTimeout(dn),dn=setTimeout((()=>{tn=ln.value.trim().toLowerCase(),on()}),1e3)}}{const un=t.querySelectorAll("#game-category>button");for(const hn of un)hn.onclick=()=>{
for(const e of un)e.removeAttribute("data-current");en=hn.getAttribute("data-match")||"all",hn.setAttribute("data-current",""),on()}}{const pn=n("game-sort");pn.value=$t=q.getItem("__gamesortorder")||"p",pn.onchange=()=>{q.setItem("__gamesortorder",$t=pn.value),on()}}function rn(){switch(en){case"all":return tn.length>0?X.filter((e=>e.name.toLowerCase().indexOf(tn)>=0||e.tags.indexOf(tn)>=0)):[...X];case"html5":
return X.filter((e=>"html5"===e.type&&(0===tn.length||e.name.toLowerCase().indexOf(tn)>=0||e.tags.indexOf(tn)>=0)));case"flash":return X.filter((e=>"flash"===e.type&&(0===tn.length||e.name.toLowerCase().indexOf(tn)>=0||e.tags.indexOf(tn)>=0)));case"dos":return X.filter((e=>"dos"===e.type&&(0===tn.length||e.name.toLowerCase().indexOf(tn)>=0||e.tags.indexOf(tn)>=0)));default:return X.filter((e=>e.tags.split(",").indexOf(en)>=0&&(0===tn.length||e.name.toLowerCase().indexOf(tn)>=0)))}}function on(){
nn=0,Jt.length=0;const e=rn();if(0===e.length)return Yt.disabled=!0,Zt.disabled=!0,void(Ct.innerHTML="No results found :(");switch($t){case"r":"Joey"===G||"anonymous"===G?e.sort(((e,t)=>e.desc.length-t.desc.length)):i(e);break;case"d":e.sort(((e,t)=>t.date-e.date));break;case"p":e.sort(((e,t)=>(t.count||0)-(e.count||0)))}for(let t=0;t<e.length;t+=100)Jt.push(e.slice(t,t+100));an()}function an(){Qt.min="1",Qt.max=Xt.innerHTML=Jt.length+"",Qt.value=nn+1+"",Ct.innerHTML="",Yt.disabled=nn<1,
nn>=Jt.length-1?Zt.disabled=!0:Zt.disabled=!1;for(const e of Jt[nn])Ct.appendChild(g(e))}function sn({id:e,msg:n,uid:r,vip:a,user:i,icon:c},l){const d=t.createElement("div");d.setAttribute("id",e);const u=t.createElement("div");switch(u.className="user",u.textContent=i,a){case 3:u.setAttribute("data-vip","gold");break;case 4:u.setAttribute("data-vip","diamond")}{const e=t.createElement("img");e.src=s(c),e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1,
null!=r&&(e.style.cursor=u.style.cursor="pointer",e.onclick=u.onclick=()=>{re(r).catch((e=>{o("Failed to open user profile. Message: "+e)}))}),d.appendChild(e)}const p=t.createElement("div");if(p.appendChild(u),n.length>0){const a=t.createElement("span");if(a.textContent=n,p.appendChild(a),null!=G&&r===G){{const r=t.createElement("button");r.type="button",r.title="Edit",r.className="edit",r.onclick=()=>{const i=t.createElement("div"),s=t.createElement("input");s.type="text",s.value=n,
s.required=!0,s.minLength=1,s.maxLength=1e3,s.placeholder="Message",s.autocomplete="off",i.appendChild(s);const c=t.createElement("button");c.type="button",c.title="Save",c.className="tick",i.appendChild(c);const d=t.createElement("button");d.type="button",d.title="Cancel",d.className="cross",i.appendChild(d),c.onclick=()=>{const t=s.value.trim();t.length<1?o("Comments cannot be empty."):t.length>1e3?o("Comments cannot be longer than 1000 characters."):h(61,[V,e,l,t]).then((()=>{n=t,i.remove(),
r.disabled=!1})).catch((e=>{o("Failed to update the comment. Message: "+e)}))},d.onclick=()=>{i.remove(),r.disabled=!1,a.innerHTML=n},r.disabled=!0,a.innerHTML="",a.appendChild(i)},d.appendChild(r)}{const n=t.createElement("button");n.type="button",n.title="Delete",n.className="delete",n.onclick=()=>{n.disabled=!0,h(61,[V,e,l,""]).catch((e=>{o("Failed to delete the comment. Message: "+e)}))},d.appendChild(n)}}}return d.appendChild(p),d}ne=async({name:e,type:n,tags:r,date:a,path:l,desc:d})=>{
null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,Lt.setAttribute("data-current",""),ie=()=>{ie=null,Nt.title="Enable scroll lock",Nt.style.backgroundImage='url("res/lock-open-w.svg")',R||(Q||(t.title="NettleWeb"),x.replaceState(void 0,"","/")),he=null,pe=null,xt.innerHTML="",F.style.overflow=""},Ut.value="",Ht.value="",Rt.value="",zt.value="",Vt.innerHTML="",_t.innerHTML="",Tt.innerHTML="Like",At.innerHTML="Share",
Et.innerHTML="",qt.style.display="none",St.style.display="block",Kt.style.display="block",Mt.textContent=e,jt.textContent=n.toUpperCase(),Ot.textContent=r.replace(/\,/g,", ")||"None",Pt.textContent=c(a),Ft.textContent=d||"No information provided by the uploader.";{const n=a.toString(36),r="/"+n,i="https://nettleweb.com"+r;R||(Q||(t.title=e+" - NettleWeb"),x.replaceState(void 0,"",r)),Dt.textContent=n,It.textContent='<embed type="text/plain" width="1280" height="720" src="'+i+'?hidegui=1" />',
At.onclick=()=>{navigator.clipboard.writeText(i).then((()=>{At.innerHTML="Link copied!"})).catch((e=>{o("Failed to copy link to clipboard. Message: "+e)}))}}St.innerHTML="Edit Game Info",St.disabled=!1,St.onclick=()=>{null!=V?(Ht.value=e,Rt.value=r,zt.value=d,qt.style.display="block",St.style.display="none"):D.click()},Wt.onclick=()=>{if(null==V)return void o("Invalid session. Please refresh this page and try again.");const e=Ht.value.replace(/\s+/g," ").trim()
;if(0===e.length)return void o("Game name must not be empty.");if(e.length>256)return void o("Game name must be less than 256 characters in length.");const t=zt.value.replace(/\s+/g," ").trim(),n=Rt.value.trim().toLowerCase().split(",").map((e=>e.replace(/\s+/g," ").trim())).join(",");n.length>300?o("Game tags list must be less than 300 characters long in total."):t.length>5e3?o("Game description text must be less than 5000 characters in length."):(Wt.disabled=!0,h(23,[V,a,e,n,t]).then((()=>{
Wt.disabled=!1,St.disabled=!0,St.innerHTML="Requested. Pending review...",qt.style.display="none",St.style.display="block"})).catch((e=>{o("Failed to submit request. Message: "+e),Wt.disabled=!1})))},Bt.onclick=()=>{if(null==V)return void D.click();const e=Ut.value.trim();e.length<1?o("Comments cannot be empty."):e.length>1e3?o("Comments cannot be longer than 1000 characters."):(Bt.disabled=!0,h(59,[V,a,e]).then((()=>{Ut.value="",Bt.disabled=!1})).catch((e=>{
o("Failed to post comment. Message: "+e),Bt.disabled=!1})))};for(const e of i(X.filter((e=>!e.path.startsWith("https://")))).slice(3,9))e.date!==a&&Vt.childElementCount<5&&Vt.appendChild(g(e));l.startsWith("!content!")?xt.appendChild(m(n,await u(l.slice(9)))):xt.appendChild(y(l));{const e=await h(56,a);{let t=e.likes;Tt.textContent=t.toString(10),Tt.onclick=()=>{Tt.disabled=!0,h(57,a).then((()=>{Tt.textContent=(++t).toString(10),Tt.disabled=!1})).catch((e=>{
o("Failed to give a like. Message: "+e)}))}}{const n=t.createElement("img");n.src=s(e.icon),n.alt="Avatar",n.width=40,n.height=40,n.loading="eager",n.decoding="sync",n.draggable=!1,_t.appendChild(n)}{const n=t.createElement("div");switch(n.className="user",n.textContent=e.id,e.vip){case 3:n.setAttribute("data-vip","gold");break;case 4:n.setAttribute("data-vip","diamond")}_t.appendChild(n)}_t.onclick=()=>{re(e.uid).catch((e=>{o("Failed to open user profile. Message: "+e)}))}}{
const e=await h(58,[a]);if(20===e.length){let t=e[e.length-1].id;Gt.style.display="block",Gt.onclick=()=>{Gt.style.display="none",h(58,[a,t]).then((e=>{20===e.length&&(t=e[e.length-1].id,Gt.style.display="block");for(const t of e)Et.appendChild(sn(t,a))})).catch((e=>{o("Failed to fetch comments. Message: "+e)}))}}for(const t of e)Et.appendChild(sn(t,a))}he=(e,t)=>{a===e&&Et.prepend(sn(t,a))},pe=(e,t,n)=>{if(a===e)for(const e of Et.children)if(e.getAttribute("id")===t){
const r=e.querySelector("div>span");null!=r?r.textContent=n:o("Failed to update comment: "+t);break}}},Yt.onclick=()=>{nn--,an(),Ct.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},Zt.onclick=()=>{nn++,an(),Ct.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},Qt.onblur=()=>{const e=parseInt(Qt.value.trim(),10)||0;nn+1!==e&&(e<1||e>Jt.length?(Qt.value="1",nn=0):nn=e-1,an(),Ct.scrollIntoView({behavior:"instant",inline:"start",block:"start"}))},Qt.onchange=()=>{
Qt.blur()},Nt.onclick=()=>{"Disable scroll lock"===Nt.title?(Nt.style.backgroundImage='url("res/lock-open-w.svg")',Nt.title="Enable scroll lock",F.style.overflow=""):(Nt.style.backgroundImage='url("res/lock-w.svg")',Nt.title="Disable scroll lock",F.style.overflow="hidden",xt.scrollIntoView({block:"start",inline:"start",behavior:"instant"}))},Ut.onfocus=()=>{null==V&&D.click()},n("hide").onclick=()=>{Kt.style.display="none"},n("e-canc").onclick=()=>{qt.style.display="none",
St.style.display="block"},n("newtab").onclick=()=>{o("This feature has been temporarily disabled.")},n("fullscreen").onclick=()=>{if(t.fullscreenEnabled){const e=xt.firstElementChild;null!=e&&e.requestFullscreen({navigationUI:"hide"}).catch((e=>{o("Failed to enter fullscreen mode. Message: "+e)}))}else o("Fullscreen mode is not supported in the current browsing context.")},on()}{
const fn=r("#yt-search>input"),mn=r("#yt-search>button"),gn=n("p-load-more"),bn=n("yt-load-more"),yn=n("goto-video"),vn=n("videos-page"),wn=n("yt-results"),kn=n("sserver"),Cn=n("service"),En=n("video"),xn=n("s-videos"),An=n("p-videos"),Tn=n("video-page"),Ln=n("playlist-page"),In=n("vcode"),Sn=n("vname"),Mn=n("vtags"),jn=n("vdate"),On=n("vdesc"),Pn=n("vlike"),_n=n("vview"),Fn=n("origin"),Dn=n("source"),Nn=n("stream"),Un=n("privacy"),Bn=n("license"),Hn=n("category"),Rn=n("uploader"),zn=n("pname"),Wn=n("pdesc"),qn=n("porigin"),Vn=n("psource"),Gn=n("streams"),Kn=n("puploader")
;let Yn="0";function Zn(e){switch(e.protocol){case"http:":case"https:":break;default:return null}const t=e.pathname;if(t.length<4)return null;switch(e.hostname){case"piped.video":case"youtube.com":case"www.youtube.com":case"youtube-nocookie.com":case"www.youtube-nocookie.com":return"/watch"===t?e.searchParams.get("v")||null:"/embed/"===t.slice(0,7)&&t.slice(7)||null;case"youtu.be":return t.slice(1)||null;default:return null}}function Qn(e){
const n=e.thumbnails[0]?.url||null,r=t.createElement("div"),{url:a,type:i}=e;{const e=t.createElement("img");e.src=null==n?"/res/preview.svg":s(n),e.alt="Preview",e.width=160,e.height=90,e.loading="lazy",e.decoding="async",e.draggable=!1,r.appendChild(e)}{const n=t.createElement("div");{const r=t.createElement("div");r.className="title",r.textContent=e.name,n.appendChild(r)}{const r=t.createElement("div");r.className="desc",r.textContent=e.description||"",n.appendChild(r)}{let r="";switch(i){
case"stream":{const{uploadDate:t,uploader:n}=e;null!=t&&t.length>0&&(r+=t+"; "),r+="Views: "+e.viewCount+"; Uploader: "+(n.name||"Unknown")+(n.verified?" \u2713":"")}break;case"channel":r="Streams: "+e.streams+"; Subscribers: "+e.subscribers+(e.verified?" \u2713":"");break;case"playlist":r="Streams: "+e.streams+"; Type: "+e.playlist;break;default:r="No information available for this item."}"0"===Yn&&(r+="; Source: YouTube");const o=t.createElement("div");o.className="time",o.textContent=r,
n.appendChild(o)}r.appendChild(n)}return r.onclick=()=>{switch(i){case"stream":$n(a);break;case"playlist":er(a);break;default:S(i),o("Function not implemented!")}},r}async function Xn(e){Cn.disabled=!0,mn.disabled=!0,fn.disabled=!0,bn.style.display="none";const t=await h(65,[e,Yn]);if(null==t||"object"!=typeof t)return void o("Error: API server returned invalid response.");const n=t.results;if(""===e){if(0===n.length)return void(wn.innerHTML="No suggestions are available at this moment.")
;wn.innerHTML=""}for(const e of n)wn.appendChild(Qn(e));null!=(e=t.nextPageToken)&&(bn.style.display="block",bn.onclick=()=>{Xn(e).then((()=>{Cn.disabled=!1,mn.disabled=!1,fn.disabled=!1}))})}async function Jn(e){Cn.disabled=!0,mn.disabled=!0,fn.disabled=!0,bn.style.display="none";const t=await h(40,[fn.value.trim(),e,"relevance","videos",Yn]);if(null==t||"object"!=typeof t)return void o("Error: API server returned invalid response.");const n=t.results;if(0!==e.length||0!==n.length){
for(const e of n)wn.appendChild(Qn(e));null!=(e=t.nextPageToken)&&(bn.style.display="block",bn.onclick=()=>{Jn(e).then((()=>{Cn.disabled=!1,mn.disabled=!1,fn.disabled=!1}))})}else wn.innerHTML="No matching results found :("}function $n(e){h(63,[e,Yn]).then((n=>{if(null==n||"object"!=typeof n)return void o("Error: API server returned invalid response.");null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),xn.innerHTML="",H.checked=!1,
Tn.setAttribute("data-current",""),ie=()=>{ie=null,En.innerHTML=""};const r=In.textContent=n.id;"0"!==Yn?(kn.value="nettle",kn.disabled=!0,Dn.textContent="Unknown"):(kn.disabled=!1,Dn.textContent="YouTube"),Sn.textContent=n.name,Mn.textContent=n.tags.join(", ").trim()||"None",jn.textContent=c(Date.parse(n.uploadDate)),On.textContent=n.description.replace(/\<br\>/g,"\n").replace(/<[^>]*>/g,"").trim()||"No information provided by the uploader.",Pn.textContent=n.likeCount,
_n.textContent=n.viewCount,Fn.textContent=e,Nn.textContent=n.stream,Un.textContent=n.privacy,Bn.textContent=n.license||"Unknown",Hn.textContent=n.category||"Unknown";{const{name:e,verified:t,subscribers:r}=n.uploader;Rn.textContent=e+" ("+r+" subscribers)"+(t?" \u2713":"")}{const e=n.relatedItems;if(e.length>0)for(const t of e)xn.appendChild(Qn(t));else xn.innerHTML="No suggestions are available for this video."}(kn.onchange=()=>{switch(kn.value){case"none":En.innerHTML="",
En.appendChild(y("https://www.youtube-nocookie.com/embed/"+r));break;case"piped":En.innerHTML="",En.appendChild(y("https://cf.piped.video/watch?v="+r));break;default:if((e=n.videoStreams[0]?.url||"").length>4){const a=t.createElement("video");a.src=s(e),a.width=800,a.height=600,a.volume=.8,a.autoplay=!0,a.controls=!0,a.preservesPitch=!1,(e=n.thumbnails.pop().url||"").length>4&&(a.poster=s(e)),a.onerror=()=>{o("Video stream failed to load. Falling back to official server."),
a.replaceWith(y("https://www.youtube-nocookie.com/embed/"+r))},a.oncanplay=()=>{a.onerror=null,a.oncanplay=null},En.innerHTML="",En.appendChild(a)}else if((e=n.audioStreams[0]?.url||"").length>4){const n=t.createElement("audio");n.src=s(e),n.volume=.8,n.autoplay=!0,n.controls=!0,n.preservesPitch=!1,n.onerror=()=>{o("Error: Failed to load the audio stream.")},n.oncanplay=()=>{n.onerror=null,n.oncanplay=null},En.innerHTML="",En.appendChild(n)
}else En.innerHTML="Failed to retrieve the video stream. Try switching to a different stream proxy server below."}})()})).catch((t=>{o("Failed to fetch video stream information. Message: "+t),p("https://www.youtube-nocookie.com/embed/"+Zn(new URL(e)))}))}function er(e){h(66,[e,"",Yn]).then((t=>{if(null!=t&&"object"==typeof t){null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),An.innerHTML="",H.checked=!1,gn.style.display="none",
Ln.setAttribute("data-current",""),zn.textContent=t.name,Wn.textContent=t.description.replace(/\<br\>/g,"\n").replace(/<[^>]*>/g,"").trim()||"No information provided by the uploader.",qn.textContent=e,Vn.textContent="0"===Yn?"YouTube":"Unknown",Gn.textContent=t.streams,Kn.textContent=t.uploader.name;{const n=t.results;if(n.length>0){for(const e of n)An.appendChild(Qn(e));let r=t.nextPageToken;null!=r&&(gn.style.display="block",gn.onclick=()=>{gn.style.display="none",h(66,[e,r,Yn]).then((e=>{
if(null!=e&&"object"==typeof e){for(const t of e.results)An.appendChild(Qn(t));null!=(r=e.nextPageToken)&&(gn.style.display="block")}else o("Error: API server returned invalid response.")}))})}else xn.innerHTML="No streams are found within this playlist."}}else o("Error: API server returned invalid response.")})).catch((e=>{o("Failed to fetch playlist information. Message: "+e)}))}Cn.value=q.getItem("__yt_service")||"0",Cn.onchange=()=>{o(null),wn.innerHTML="",Yn=Cn.value,
q.setItem("__yt_service",Cn.value),fn.value.length>0?Jn("").then((()=>{Cn.disabled=!1,mn.disabled=!1,fn.disabled=!1})):Xn("").then((()=>{Cn.disabled=!1,mn.disabled=!1,fn.disabled=!1}))},n("yt-search").onsubmit=e=>{e.preventDefault(),e.stopPropagation(),o(null),wn.innerHTML="",Yn=Cn.value;const t=a(fn.value);if(null!=t){const e=Zn(t);null!=e?$n("https://www.youtube.com/watch?v="+e):o("Error: Failed to parse video ID from the provided URL.")}else Jn("").then((()=>{Cn.disabled=!1,mn.disabled=!1,
fn.disabled=!1}))},N.onclick=yn.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,N.setAttribute("data-current",""),vn.setAttribute("data-current",""),R||(Q||(t.title="NettleWeb Videos"),ie=v,x.replaceState(void 0,"","/videos")),0===wn.childElementCount&&(N.disabled=!0,yn.disabled=!0,Yn=Cn.value,Xn("").then((()=>{Cn.disabled=N.disabled=yn.disabled=mn.disabled=fn.disabled=!1})))}}{
const tr=n("item-container"),nr=n("item-category"),rr=n("previews"),or=n("seller"),ar=n("price"),ir=n("stock"),sr=n("item-page"),cr=n("iname"),lr=n("itags"),dr=n("idate"),ur=n("idesc"),hr=n("icode"),pr=[],fr=n("iadd"),mr=n("ibuy"),gr=n("checkout"),br=n("nav-back"),yr=n("nav-forward"),vr=n("nav-page-no"),wr=n("nav-page-count"),kr=n("purchase-page"),Cr=[];let Er="p",xr="all",Ar="",Tr=0;J=h(48).then((e=>{
if(null==e||"object"!=typeof e)return void(tr.innerHTML="Error: Failed to load contents. Message: Failed to parse server response.");const n=e.pros;if(Array.isArray(n)&&0!==n.length){{const n=e.cats,r=nr.children;{const e=t.createElement("button");e.type="button",e.innerHTML="All",e.setAttribute("data-current",""),e.onclick=()=>{for(const e of r)e.removeAttribute("data-current");xr="all",Ir(),e.setAttribute("data-current","")},nr.appendChild(e)}if(Array.isArray(n)&&n.length>0)for(const e of n){
const n=t.createElement("button");n.type="button",n.textContent=e,n.onclick=()=>{for(const e of r)e.removeAttribute("data-current");xr=e,Ir(),n.setAttribute("data-current","")},nr.appendChild(n)}}ae=n,Ir()}else tr.innerHTML="Sorry, no items are available at this moment."})).catch((e=>{tr.textContent="Failed to load contents. Message: "+e}));{const jr=n("item-search"),Or=r("#item-search>input");let Pr=0;jr.onsubmit=e=>{e.preventDefault(),e.stopPropagation(),Ar=Or.value.trim().toLowerCase(),
clearTimeout(Pr),Ir()},Or.onblur=()=>{Ar=Or.value.trim().toLowerCase(),clearTimeout(Pr),Ir()},Or.oninput=()=>{clearTimeout(Pr),Pr=setTimeout((()=>{Ar=Or.value.trim().toLowerCase(),Ir()}),1e3)}}{const _r=n("item-sort");_r.value=Er=q.getItem("_$so")||"n",_r.onchange=()=>{q.setItem("_$so",Er=_r.value),Ir()}}function Lr(e,t){return e>t?1:e<t?-1:0}function Ir(){Tr=0,Cr.length=0
;const e="all"===xr?Ar.length>0?ae.filter((e=>e.name.toLowerCase().indexOf(Ar)>=0||e.desc.toLowerCase().indexOf(Ar)>=0||e.cats.indexOf(Ar)>=0)):[...ae]:ae.filter((e=>e.cats.split(",").indexOf(xr)>=0&&(0===Ar.length||e.name.toLowerCase().indexOf(Ar)>=0||e.desc.toLowerCase().indexOf(Ar)>=0)));if(0===e.length)return br.disabled=!0,yr.disabled=!0,void(tr.innerHTML="Sorry, no matching results found :(");switch(Er){case"r":i(e);break;case"d":e.sort(((e,t)=>t.date-e.date));break;default:
e.sort(((e,t)=>Lr(e.name,t.name)))}for(let t=0;t<e.length;t+=100)Cr.push(e.slice(t,t+100));Sr()}function Sr(){vr.min="1",vr.max=wr.innerHTML=Cr.length+"",vr.value=Tr+1+"",tr.innerHTML="",br.disabled=Tr<1,Tr>=Cr.length-1?yr.disabled=!0:yr.disabled=!1;for(const e of Cr[Tr])e.stock>=1&&tr.appendChild(b(e))}function Mr(){null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,kr.innerHTML="",kr.setAttribute("data-current","");{
const e=t.createElement("h2");e.textContent="Confirm Purchase",kr.appendChild(e)}let e=0;const n=[];for(const o of pr){const a=t.createElement("div"),i=o.price,c=o.date.toString(36);{const e=t.createElement("img");e.src=s(o.prev[0]),e.alt="Preview",e.width=50,e.height=50,e.loading="lazy",e.decoding="async",e.draggable=!1,a.appendChild(e)}{const e=t.createElement("div");e.textContent=o.name,a.appendChild(e)}{const e=t.createElement("span");e.textContent="$"+i.toFixed(2),a.appendChild(e)}{
const s=t.createElement("button");s.type="button",s.title="Remove item",s.onclick=()=>{const t=pr.indexOf(o,0);if(t>=0){a.remove(),pr.splice(t,1),r.textContent="Total: $"+(e-i).toFixed(2);{const e=n.indexOf(c,0);e>=0&&n.splice(e,1)}0===pr.length&&(U.click(),gr.style.display="none")}},a.appendChild(s)}e+=i,n.push(c),kr.appendChild(a)}const r=t.createElement("span");r.textContent="Total: $"+e.toFixed(2),kr.appendChild(r);const o=t.createElement("button");o.type="button",o.className="pri-button",
o.textContent="Continue",o.onclick=()=>{if(null==V)return void D.click();const e=t.createElement("form");e.action="https://secure.nettleweb.com/pay.xml",e.method="GET",e.target="_self",
e.innerHTML=`<div>Please fill in the additional information below. It is required for continuing your purchase.</div>\n\t<fieldset>\n\t\t<legend>Delivery Address</legend>\n\t\t<div>\n\t\t\t<label for="addr1">Address Line 1:</label>\n\t\t\t<input id="addr1" name="a1" type="text" required="" minlength="1" maxlength="200" autocomplete="off" />\n\t\t</div>\n\t\t<div>\n\t\t\t<label for="addr2">Address Line 2:</label>\n\t\t\t<input id="addr1" name="a2" type="text" maxlength="200" autocomplete="off" />\n\t\t</div>\n\t\t<div>\n\t\t\t<label for="city">City:</label>\n\t\t\t<input id="city" name="c" type="text" required="" minlength="1" maxlength="100" autocomplete="off" />\n\t\t</div>\n\t\t<div>\n\t\t\t<label for="region">State/Region:</label>\n\t\t\t<input id="region" name="r" type="text" required="" minlength="1" maxlength="100" autocomplete="off" />\n\t\t</div>\n\t\t<div>\n\t\t\t<label for="country">Country:</label>\n\t\t\t<select id="country" name="n">${ki.cc}</select>\n\t\t</div>\n\t\t<div>\n\t\t\t<label for="postcode">Post Code:</label>\n\t\t\t<input id="postcode" name="p" type="text" required="" minlength="3" maxlength="20" autocomplete="off" />\n\t\t</div>\n\t</fieldset>\n\t<div>Notice: Depending on your geolocation, additional delivery and processing fees may apply.</div>\n\t<button type="submit" class="pri-button">Continue</button>`
;{const r=t.createElement("input");r.type="hidden",r.name="i",r.value=n.join(";"),e.appendChild(r)}{const n=t.createElement("input");n.type="hidden",n.name="u",n.value=V,e.appendChild(n)}kr.innerHTML="",kr.appendChild(e)},kr.appendChild(o)}te=async e=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,sr.setAttribute("data-current",""),or.innerHTML="",rr.innerHTML="",hr.textContent=e.date.toString(36),
cr.textContent=e.name,lr.textContent=e.cats.replace(/\,/g,", ")||"None",dr.textContent=c(e.date),ur.textContent=e.desc||"No information provided by the provider.",ir.textContent=e.stock.toString(10),ar.textContent="$"+e.price.toFixed(2);for(const n of e.prev){const e=t.createElement("img");e.src=s(n),e.alt="Preview",e.width=400,e.height=300,e.loading="lazy",e.decoding="async",e.draggable=!1,rr.appendChild(e)}e.stock>=1?pr.indexOf(e,0)<0?(fr.disabled=!1,mr.disabled=!1,fr.onclick=()=>{pr.push(e),
mr.onclick=Mr,fr.disabled=!0,gr.style.display="block"},mr.onclick=()=>{pr.push(e),Mr(),gr.style.display="block"}):(fr.disabled=!0,mr.disabled=!1,mr.onclick=Mr):(fr.disabled=!0,mr.disabled=!0);{const n=await h(1,e.user||"anonymous");{const e=t.createElement("img");e.src=s(n.icon),e.alt="Avatar",e.width=40,e.height=40,e.loading="eager",e.decoding="sync",e.draggable=!1,or.appendChild(e)}{const e=t.createElement("div");switch(e.className="user",e.textContent=n.id,n.vip){case 3:
e.setAttribute("data-vip","gold");break;case 4:e.setAttribute("data-vip","diamond")}or.appendChild(e)}or.onclick=()=>{re(n.uid).catch((e=>{o("Failed to open user profile. Message: "+e)}))}}},br.onclick=()=>{Tr--,Sr(),tr.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},yr.onclick=()=>{Tr++,Sr(),tr.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},vr.onblur=()=>{const e=parseInt(vr.value.trim(),10)||0;Tr+1!==e&&(e<1||e>Cr.length?(vr.value="1",Tr=0):Tr=e-1,Sr(),
tr.scrollIntoView({behavior:"instant",inline:"start",block:"start"}))},vr.onchange=()=>{vr.blur()},gr.onclick=Mr}{const Fr=n("addr"),Dr=n("ub-mode");function Nr(t){switch(Dr.value){case"raw-embed":p(t);break;case"prq-embed":!function(t){const n=(Z||e).PaymentRequest;"function"==typeof n?new n([{data:[t],supportedMethods:"https://nettleweb.com/res/pay.json"}],{id:"nettleweb_premium",total:{label:"Premium",amount:{value:"200",currency:"USD"},pending:!0},modifiers:[],displayItems:[]
}).show():o("Error: Your browser does not support this feature.")}(t);break;case"puppeteer":h(41,[t,20]).then((e=>{p(e)})).catch((e=>{o("Failed to create new session. Message: "+e)}));break;default:h(41,[t,10]).then((e=>{p(e)})).catch((e=>{o("Failed to create new session. Message: "+e)}))}}function Ur(e,t){const n=a(e=e.replace(/\s+/g," ").trim());if(null!=n)return n.href;if(e.includes(" "))return t+encodeURIComponent(e);const r=e.indexOf("/");if(0===r)return t+encodeURIComponent(e);if(r>0){
if(Br(e.substring(0,r)))return"https://"+e}else if(Br(e)&&e.includes("."))return"https://"+e;return t+encodeURIComponent(e)}function Br(e){e=e.toLowerCase();for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if((n<48||n>57)&&(n<97||n>122)&&45!==n&&46!==n)return!1}return!0}Dr.value=q.getItem("__unbl_mode_")||"raw-embed-v2",Dr.onchange=()=>{q.setItem("__unbl_mode_",Dr.value)},Fr.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=Fr.value.trim()
;t.length>0&&Nr(Ur(t,"https://www.google.com/search?igu=1&q="))}},n("ub-google").onclick=()=>{Nr("https://www.google.com/webhp?igu=1")},n("ub-discord").onclick=()=>{Nr("https://discord.com/")},n("ub-facebook").onclick=()=>{Nr("https://www.facebook.com/")},n("ub-instagram").onclick=()=>{Nr("https://www.instagram.com/")}}{const Hr=n("emulator"),Rr=n("core"),zr=n("bios"),Wr=n("game-rom");Hr.onchange=()=>{switch(Hr.value){case"ps2":Rr.value="ps2",Rr.disabled=!0,zr.disabled=!0,
Wr.accept=".bin, .iso, application/octet-stream";break;case"swf":Rr.value="swf",Rr.disabled=!0,zr.disabled=!0,Wr.accept=".swf";break;case"dos":Rr.value="dos",Rr.disabled=!0,zr.disabled=!0,Wr.accept=".jsdos, .zip";break;default:Rr.value="nes",Rr.disabled=!1,zr.disabled=!1,Wr.removeAttribute("accept")}},n("startemu").onclick=()=>{const e=Wr.files?.item(0);if(null==e)return void o("Please choose a valid game ROM file.");const t=Hr.value;if("emu"===t){const n=zr.files?.item(0)
;return j.appendChild(m(t,[URL.createObjectURL(e),null==n?"":n,Rr.value])),void(O.style.display="block")}e.arrayBuffer().then((e=>{j.appendChild(m(t,e)),O.style.display="block"})).catch((e=>{o("Failed to read game file. Message: "+e)}))}}{const qr=n("upload-message"),Vr=n("game-name"),Gr=n("game-type"),Kr=n("game-file"),Yr=n("game-tags"),Zr=n("game-desc"),Qr=n("upload-test"),Xr=n("test-frame"),Jr=n("upload");let $r=!1;async function eo(e,t,n){if(null==V)throw Error("Invalid user context");let r
;for(let o=0;o<10;o++)try{return void await h(64,[V,e,t,n])}catch(e){r=e}throw Error("Too many unsuccessful attempts. Message from the last attempt: "+r)}qr.onclick=()=>{qr.innerHTML="",qr.style.display="none"},Kr.onchange=()=>{$r=!1,Xr.innerHTML="",Qr.style.display="none"},Gr.onchange=()=>{switch(Gr.value){case"html5":Kr.accept=".zip";break;case"flash":Kr.accept=".swf";break;case"dos":Kr.accept=".jsdos";break;default:Kr.removeAttribute("accept")}},Jr.onclick=()=>{
if(null==V)return void o("Invalid session. Please refresh this page and try again.");const e=Vr.value.replace(/\s+/g," ").trim();if(0===e.length)return void o("Game name must not be empty.");if(e.length>256)return void o("Game name must be less than 256 characters in length.");const t=Kr.files?.item(0);if(null==t)return void o("Please choose a valid game file.");const n=t.size;if(0===n)return void o("Uploading empty game files is not allowed.")
;if(n>125829120)return void o("Uploading files larger than 120MB is not supported currently.");const r=Gr.value,a=Zr.value.replace(/\s+/g," ").trim(),i=Yr.value.trim().toLowerCase().split(",").map((e=>e.replace(/\s+/g," ").trim())).join(",");if(i.length>300)o("Game tags list must be less than 300 characters long in total.");else if(a.length>5e3)o("Game description text must be less than 5000 characters in length.");else{switch(r){case"dos":case"flash":
if(!$r)return void t.arrayBuffer().then((e=>{Xr.appendChild(m(r,e)),Qr.style.display="block",$r=!0})).catch((e=>{o("Failed to read game file. Message: "+e)}));break;case"html5":break;default:return void o("Please select a valid game type.")}Jr.disabled=!0,qr.innerHTML="Processing...",qr.style.color="#808080",qr.style.display="block",(async()=>{const o=await h(13,[V,e,r,i,a]);for(let e=0;e<n;){const r=e,a=e+=10485760;if(a>=n){const e=t.slice(r,n,"application/octet-stream")
;await eo(o,await e.arrayBuffer(),!0)}else{const e=t.slice(r,a,"application/octet-stream");await eo(o,await e.arrayBuffer(),!1)}}})().then((()=>{qr.innerHTML="\u2713Success!",qr.style.color="#008000",qr.style.display="block",$r=!1,Xr.innerHTML="",Qr.style.display="none",Vr.value="",Kr.value="",Yr.value="",Zr.value="",Jr.disabled=!1})).catch((e=>{o("Failed to upload the selected game file. Message: "+e),qr.innerHTML="\u2715Error",qr.style.color="#ff0000",qr.style.display="block",Jr.disabled=!1}))
}}}{const to=n("item-id"),no=n("item-add"),ro=n("item-name"),oo=n("item-tags"),io=n("item-prev"),so=n("item-del1"),co=n("item-del2"),lo=n("item-desc"),uo=n("item-stock"),ho=n("item-price"),po=n("s-orders"),fo=n("store-manager-page");no.onclick=async()=>{const e=ro.value.replace(/\s+/g," ").trim();if(0===e.length)return void o("Item name must not be empty.");if(e.length>256)return void o("Item name must be less than 256 characters in length.")
;const t=oo.value.trim().toLowerCase().split(",").map((e=>e.replace(/\s+/g," ").trim())).join(",");if(0===t.length)return void o("Item must have at least one tag.");if(t.length>300)return void o("Item tags list must be less than 300 characters long in total.");const n=lo.value.replace(/\s+/g," ").trim();if(n.length<10)return void o("Item description must have at least 10 characters.");if(n.length>5e3)return void o("Item description text must be less than 5000 characters in length.")
;const r=parseFloat(so.value)||0,a=parseFloat(co.value)||0;if(r<0||r>99.99||a<0||a>99.99)return void o("Item delivery price must be between the range: 0-99.99");const i=parseInt(uo.value,10)||0;if(i<1||i>99999)return void o("Item stock must be between the range: 1-99999");const s=parseFloat(ho.value)||0;if(s<.01||s>999.99)return void o("Item price must be between the range: 0.01-999.99");const c=Array.from(io.files||[])
;if(c.length<1)o("Please provide at least one preview image for this item.");else if(c.length>10)o("The maximum number of preview images allowed for this item is 10.");else{no.disabled=!0;for(let e=0;e<c.length;e++){const t=await d(c[e],400,300);if(null==t)return void o("Error: Failed to decode and resize preview images.");c[e]=await t.arrayBuffer()}try{await h(49,[V,to.value.trim(),e,t,n,c,i,s,r,a])}catch(e){o("Failed to add this item. Message: "+e)}to.value="",ro.value="",oo.value="",
io.value="",lo.value="",uo.value="",ho.value="",no.disabled=!1}},n("sm").onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),po.innerHTML="Loading...",H.checked=!1,fo.setAttribute("data-current",""),h(51,V).then((e=>{if(!Array.isArray(e)||e.length<1)return void(po.innerHTML="You don't have any orders yet.");const n=t.createElement("table")
;n.innerHTML='<thead><tr><th scope="col">ID</th><th scope="col">Date</th><th scope="col">Items</th><th scope="col">Price*</th><th scope="col">Contact</th><th scope="col">Address</th><th scope="col">Confirm Payment & Delivery</th></tr></thead>';{const r=t.createElement("tbody");for(const n of e){const e=t.createElement("tr");{const r=t.createElement("td");r.textContent=n.id,e.appendChild(r)}{const r=t.createElement("td");r.textContent=c(n.date),e.appendChild(r)}{const r=t.createElement("td")
;for(const e of n.pros){const n=t.createElement("div");for(const t of ae)if(t.date.toString(36)===e){n.textContent=t.name;break}r.appendChild(n)}e.appendChild(r)}{const r=t.createElement("td");r.textContent="$"+n.price.toFixed(2),e.appendChild(r)}{const r=t.createElement("td");r.textContent=n.buyerEmail,e.appendChild(r)}{const r=t.createElement("td");r.textContent=n.address,e.appendChild(r)}{const r=t.createElement("td");switch(n.state){case 0:{const e=t.createElement("button");e.type="button",
e.textContent="Confirm",e.onclick=()=>{h(53,[V,n.id]).then((()=>{r.innerHTML="Confirmed"})).catch((e=>{o("Failed to confirm payment. Message: "+e)}))},r.appendChild(e)}{const e=t.createElement("button");e.type="button",e.textContent="Reject",e.onclick=()=>{h(52,[V,n.id,!0]).then((()=>{r.innerHTML="Rejected"})).catch((e=>{o("Failed to reject payment. Message: "+e)}))},r.appendChild(e)}break;case 1:r.innerHTML="Aborted";break;case 2:r.innerHTML="Confirmed";break;default:r.innerHTML="Not Allowed"}
e.appendChild(r)}r.appendChild(e)}n.appendChild(r)}po.innerHTML="<div>* including additional delivery fee</div>",po.prepend(n)})).catch((e=>{o("Failed to fetch order list. Message: "+e)}))}}{const mo=n("payu");mo.onclick=()=>{const e=ye.value.trim();e.length>1e3?o("Payment description must have more than 1000 characters in length."):(mo.disabled=!0,h(54,[V,e,be.value]).then((()=>{mo.disabled=!1})).catch((e=>{o("Failed to update payment description. Message: "+e)})))}}{
const go=n("picker"),bo=n("msglist"),yo=n("history"),vo=n("channels"),wo=n("ufile"),ko=n("messages"),Co=ko.children,Eo=n("chname"),xo=n("chinfo"),Ao=n("sendmsg"),To=n("global"),Lo=n("friends"),Io=n("chatgpt"),So=n("starter");{const Mo=n("chat"),jo=n("sidemenu"),Oo=n("toggle");Oo.onclick=()=>{"Close"===Oo.title?(Oo.title="Menu",Mo.style.width="100%",jo.style.display="none"):(Oo.title="Close",Mo.removeAttribute("style"),jo.removeAttribute("style"))},I.clientWidth<800&&(Oo.title="Menu",
Mo.style.width="100%",jo.style.display="none")}{const Po=n("dm-un"),_o=n("dm-btn");_o.onclick=async()=>{const e=Po.value.trim().toLowerCase();if(e.length<4||e.length>20||!/^[\-a-z0-9]+$/.test(e))o("Please provide a valid username.");else{_o.disabled=!0;try{await ee(await h(1,"@"+e))}catch(e){o("Failed to started new chat. Message: "+e)}Po.value="",_o.disabled=!1}}}{
const Fo=n("chat-btn"),Do=n("goto-chat"),No=n("community-page"),Uo=vo.children,Bo=bo.children,Ho=n("grid"),Ro=n("group-page"),zo=n("grname"),Wo=n("grcode"),qo=n("grusers");let Vo,Go,Ko,Yo,Zo,Qo=!1,Xo=!1;function Jo({id:e,uid:n,vip:r,icon:a}){const i=t.createElement("div"),c=t.createElement("img");c.src=s(a),c.alt="Avatar",c.width=48,c.height=48,c.loading="lazy",c.decoding="async",c.draggable=!1,i.appendChild(c);{const a=t.createElement("div");switch(a.className="user",a.textContent=e,r){case 3:
a.setAttribute("data-vip","gold");break;case 4:a.setAttribute("data-vip","diamond")}c.onclick=a.onclick=()=>{re(n).catch((e=>{o("Failed to open user profile. Message: "+e)}))},i.appendChild(a)}return i}function $o({id:e,msg:n,uid:r,vip:a,user:i,icon:c,files:l}){const d=t.createElement("div");d.setAttribute("id",e);const u=t.createElement("div");switch(u.className="user",u.textContent=i,a){case 3:u.setAttribute("data-vip","gold");break;case 4:u.setAttribute("data-vip","diamond")}{
const e=t.createElement("img");e.src=s(c),e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1,null!=r&&(e.style.cursor=u.style.cursor="pointer",e.onclick=u.onclick=()=>{re(r).catch((e=>{o("Failed to open user profile. Message: "+e)}))}),d.appendChild(e)}const p=t.createElement("div");if(p.appendChild(u),n.length>0){const a=t.createElement("span");if(a.textContent=n,p.appendChild(a),null!=G&&(Xo||r===G)){{const r=t.createElement("button");r.type="button",
r.title="Edit",r.className="edit",r.onclick=()=>{const i=t.createElement("div"),s=t.createElement("input");s.type="text",s.value=n,s.required=!0,s.minLength=1,s.maxLength=1e3,s.placeholder="Message",s.autocomplete="off",i.appendChild(s);const c=t.createElement("button");c.type="button",c.title="Save",c.className="tick",i.appendChild(c);const l=t.createElement("button");l.type="button",l.title="Cancel",l.className="cross",i.appendChild(l),c.onclick=()=>{const t=s.value.trim()
;t.length<1?o("Messages cannot be empty."):t.length>1e3?o("Messages cannot be longer than 1000 characters."):null!=V&&null!=Yo?h(62,[V,e,Yo,t]).then((()=>{n=t,i.remove(),r.disabled=!1})).catch((e=>{o("Failed to update message. Reason: "+e)})):o("Invalid context. Please refresh this page.")},l.onclick=()=>{i.remove(),r.disabled=!1,a.innerHTML=n},r.disabled=!0,a.innerHTML="",a.appendChild(i)},d.appendChild(r)}{const n=t.createElement("button");n.type="button",n.title="Delete",n.className="delete",
n.onclick=()=>{null!=V&&null!=Yo?(n.disabled=!0,h(62,[V,e,Yo,""]).catch((e=>{o("Failed to delete message. Reason: "+e)}))):o("Invalid context. Please refresh this page.")},d.appendChild(n)}}}for(const{name:e,type:n,url:r}of l){const o=s(r);{const n=t.createElement("a");n.rel="noopener nofollow",n.href=o,n.target="_blank",n.download="",n.textContent=e||"file",p.appendChild(n)}switch(n.split("/",2)[0]){case"image":{const e=t.createElement("img");e.src=o,e.alt="Attachment",e.width=500,e.height=500,
e.loading="lazy",e.decoding="async",e.draggable=!1,p.appendChild(e)}break;case"audio":{const e=t.createElement("audio");e.src=o,e.volume=.8,e.preload="metadata",e.controls=!0,p.appendChild(e)}break;case"video":{const e=t.createElement("video");e.src=o,e.muted=!0,e.width=500,e.height=500,e.volume=.8,e.autoplay=!0,e.controls=!0,p.appendChild(e)}}}return d.appendChild(p),d}function ea(e,n,r,a){const i=t.createElement("div");i.setAttribute("id",e);{const e=t.createElement("img")
;e.src="/res/group.svg",e.alt="Group",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1,i.appendChild(e)}{const e=t.createElement("div");e.textContent=n,i.appendChild(e)}return i.onclick=()=>{Qo||(Qo=!0,ko.innerHTML="<div>Loading...</div>",Xo=null!=G&&a[0]===G,h(28,[V,Yo=e]).then((t=>{Zo=t[t.length-1]?.id,ko.innerHTML="";for(const e of t)ko.prepend($o(e));ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight});for(const e of Bo)e.removeAttribute("data-current")
;xo.setAttribute("data-op","grinfo"),xo.title="View channel info",xo.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");Ro.setAttribute("data-current",""),H.checked=!1,F.scrollTo({top:0,left:0,behavior:"instant"}),Ho.textContent=e,zo.textContent=n,Wo.textContent=r,h(72,[V,e,0]).then((t=>{if(qo.innerHTML="",t.length>0){let n=0;for(const e of t)qo.appendChild(Jo(e));qo.onscrollend=()=>{qo.scrollTop>=qo.scrollHeight-qo.clientHeight&&n>=0&&h(72,[V,e,n+=10]).then((e=>{
e.length<10&&(n=-1);for(const t of e)qo.appendChild(Jo(t))}))}}})).catch((e=>{o("Failed to fetch the list. Message: "+e)}))},i.setAttribute("data-current",""),So.style.display="none",Eo.textContent=n,Qo=!1})).catch((e=>{o("Failed to initialize channel. Message: "+e),Qo=!1})))},i}function ta(e,n,r,a,i){const c=t.createElement("div");c.setAttribute("id",e),c.setAttribute("data-user",n);{const e=t.createElement("img");e.src=s(i),e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",
e.decoding="async",e.draggable=!1,c.appendChild(e)}{const e=t.createElement("div");switch(e.className="user",e.textContent=a,r){case 3:e.setAttribute("data-vip","gold");break;case 4:e.setAttribute("data-vip","diamond")}c.appendChild(e)}return c.onclick=()=>{Qo||(Qo=!0,ko.innerHTML="<div>Loading...</div>",h(28,[V,Yo=e]).then((e=>{Zo=e[e.length-1]?.id,ko.innerHTML="";for(const t of e)ko.prepend($o(t));ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight})
;for(const e of Bo)e.removeAttribute("data-current");xo.setAttribute("data-op","profile"),xo.title="View user profile",xo.onclick=()=>{re(n).catch((e=>{o("Failed to open user profile. Message: "+e)}))},c.setAttribute("data-current",""),So.style.display="none",Eo.textContent=a,Qo=!1})).catch((e=>{o("Failed to initialize channel. Message: "+e),Qo=!1})))},c}function na(e,t){if(Yo===e){const e=ko.scrollHeight-ko.clientHeight;ko.appendChild($o(t)),e===ko.scrollTop&&ko.scrollTo({behavior:"instant",
left:0,top:ko.scrollHeight})}}function ra(e,t){if(Yo===e)for(const e of Co)if(e.getAttribute("id")===t){e.remove();break}}function aa(e,t,n){if(Yo===e)for(const e of Co)if(e.getAttribute("id")===t){const r=e.querySelector("div>span");null!=r?r.textContent=n:o("Failed to update message: "+t);break}}async function ia(){if(To.disabled=!0,Lo.disabled=!0,Io.disabled=!0,Fo.disabled=!0,Do.disabled=!0,wo.disabled=!0,Ao.disabled=!0,0===Uo.length)try{const e=await h(22);for(const n of e)if("#"===n[0]){
const e=t.createElement("span");e.textContent=n.slice(1),vo.appendChild(e)}else{const[e,r,a]=n.split(":",3),i=t.createElement("div");i.setAttribute("id",r),i.textContent=e,i.onclick=()=>{Qo||(Qo=!0,Xo=!1,ko.innerHTML="<div>Loading...</div>",h(7,[Yo=r]).then((t=>{Zo=t[t.length-1]?.id,ko.innerHTML="";for(const e of t)ko.prepend($o(e));ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight});for(const e of Uo)e.removeAttribute("data-current");wo.style.display="f"===a?"block":"none",
i.setAttribute("data-current",""),Eo.textContent=e,Qo=!1})).catch((e=>{o("Failed to initialize channel. Message: "+e),Qo=!1})))},vo.appendChild(i)}}catch(e){return void o("Failed to load channel list. Message: "+e)}Yo=void 0,ko.innerHTML="",Eo.innerHTML="Server",So.style.display="none",xo.setAttribute("data-op","discord"),xo.title="Open chat in Discord",xo.onclick=()=>{w("https://discord.gg/djdH3kVd4v")},fe=na,me=ra,ge=aa;{const e=vo.querySelector("div");null!=e?(ko.onscrollend=()=>{
!Qo&&null!=Yo&&ko.scrollTop<100&&(Qo=!0,h(7,[Yo,Zo]).then((e=>{if(e.length>0){const t=ko.scrollHeight;Zo=e[e.length-1].id;for(const t of e)ko.prepend($o(t));ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight-t})}Qo=!1})).catch((e=>{o("Failed to fetch messages. Reason: "+e),Qo=!1})))},Ao.onkeydown=e=>{if("Enter"===e.key){if(e.preventDefault(),e.stopPropagation(),null==V)return void D.click();const t=Ao.value.trim();if(t.length<1)return void o("Messages cannot be empty.")
;if(t.length>1e3)return void o("Messages cannot be longer than 1000 characters.");if(null==Yo)return void o("Please select a valid channel for posting messages.");Ao.value="",Ao.disabled=!0,h(8,[V,Yo,t]).then((()=>{Ao.disabled=!1})).catch((e=>{o("Failed to post text message. Message: "+e),Ao.disabled=!1}))}},e.click()):(vo.innerHTML="No public channels are available at this moment.",Ao.onkeydown=ko.onscrollend=null)}Ao.onfocus=e=>{e.preventDefault(),e.stopPropagation(),null==V&&D.click()},
Lo.removeAttribute("data-current"),Io.removeAttribute("data-current"),To.setAttribute("data-current",""),bo.removeAttribute("style"),yo.removeAttribute("style"),vo.style.display="block",To.disabled=!1,Lo.disabled=!1,Io.disabled=!1,Fo.disabled=!1,Do.disabled=!1,wo.disabled=!1,Ao.disabled=!1}async function sa(){if(null!=V&&null!=G){To.disabled=!0,Lo.disabled=!0,Io.disabled=!0,Fo.disabled=!0,Do.disabled=!0,wo.disabled=!0,Ao.disabled=!0,Yo=void 0,bo.innerHTML="",ko.innerHTML="",
Eo.innerHTML="Messages",So.style.display="block",xo.removeAttribute("data-op");try{for(const{id:e,name:t,mode:n,code:r,users:o}of await h(27,V))if("0"===n){const{id:t,uid:n,vip:r,icon:a}=await h(1,o[0]);bo.appendChild(ta(e,n,r,t,a))}else bo.appendChild(ea(e,t,r,o))}catch(e){return void o("Failed to load friends list. Message: "+e)}fe=na,me=ra,ge=aa,ko.onscrollend=()=>{!Qo&&null!=Yo&&ko.scrollTop<100&&(Qo=!0,h(28,[V,Yo,Zo]).then((e=>{if(e.length>0){const t=ko.scrollHeight;Zo=e[e.length-1].id
;for(const t of e)ko.prepend($o(t));ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight-t})}Qo=!1})).catch((e=>{o("Failed to fetch messages. Reason: "+e),Qo=!1})))},Ao.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=Ao.value.trim();if(t.length<1)return void o("Messages cannot be empty.");if(t.length>1e3)return void o("Messages cannot be longer than 1000 characters.");if(null==Yo)return void o("Please select a valid channel before posting messages.")
;Ao.value="",Ao.disabled=!0,(async()=>{if(Yo.startsWith("tmp$")){const e=Yo.slice(4);try{const t=ta(Yo=await h(69,[V,e]),e,Ko,Go||"",Vo||"/res/user.svg");t.setAttribute("data-current",""),bo.appendChild(t)}catch(e){return void o("Failed to create new channel. Message: "+e)}ko.innerHTML=""}try{await h(8,[V,Yo,t])}catch(e){o("Failed to post text message. Reason: "+e)}})().then((()=>{Ao.disabled=!1}))}},To.removeAttribute("data-current"),Io.removeAttribute("data-current"),
Lo.setAttribute("data-current","1"),yo.removeAttribute("style"),vo.removeAttribute("style"),bo.style.display="block",wo.style.display="block",To.disabled=!1,Lo.disabled=!1,Io.disabled=!1,Fo.disabled=!1,Do.disabled=!1,wo.disabled=!1,Ao.disabled=!1}else D.click()}{const ca=n("gr-name"),la=n("gr-code"),da=n("gr-join"),ua=n("gr-create");ca.onblur=()=>{const e=ca.value.trim();e.length>0&&(ca.value=e)},la.onblur=()=>{const e=la.value.trim();e.length>0&&(la.value=e)},da.onclick=()=>{
const e=la.value.trim();12===e.length?(da.disabled=!1,h(70,[V,e]).then((({id:t,name:n,users:r})=>{{const o=ea(Yo=t,n,e,r);o.setAttribute("data-current",""),bo.appendChild(o),o.click()}So.style.display="none"}))):o("The invite code must have exactly 12 characters.")},ua.onclick=()=>{const e=ca.value.trim()
;e.length<2?o("Group name must contain at least 2 characters."):e.length>30?o("Group name cannot be longer than 30 characters."):e.indexOf(",",0)>=0||e.indexOf(";",0)>=0?o("Group names are not allowed to include commas and semicolons."):(ua.disabled=!0,h(68,[V,e]).then((({id:e,name:t,code:n,users:r})=>{{const o=ea(Yo=e,t,n,r);o.setAttribute("data-current",""),bo.appendChild(o),o.click()}So.style.display="none",ua.disabled=!1})).catch((e=>{o("Failed to create new group. Message: "+e),
ua.disabled=!1})))}}{const ha=t.createElement("input");ha.type="file",ha.multiple=!0,ha.onchange=async()=>{if(null==Yo)return void o("Please select a valid channel before uploading files.");const e=ha.files;if(null!=e&&e.length>0){if(e.length>10)return void o("Uploading more than 10 files at once is not supported.");wo.disabled=!0,Ao.disabled=!0;try{const t=[];let n=0;for(const r of e){const e=r.size;if(e<1)throw Error("Empty files are not allowed.")
;if(e>1e7)throw Error("Files larger than 10MB are not supported.");if((n+=e)>12e6)throw Error("The total size of a single upload cannot exceed 12MB.");t.push({name:r.name,attachment:await r.arrayBuffer()})}await h(12,[V,Yo,t])}catch(e){o("Failed to upload file. Message: "+e)}ha.value="",wo.disabled=!1,Ao.disabled=!1}},wo.onclick=()=>{ha.click()}}n("grleave").onclick=()=>{null!=Yo&&"m"===Yo[0]?h(71,[V,Yo]).then((()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,
No.setAttribute("data-current",""),Fo.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"}),sa()})).catch((e=>{o("Failed to leave the group. Message: "+e)})):o("The selected channel is not valid.")},Fo.onclick=Do.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,No.setAttribute("data-current",""),Fo.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"}),null==Yo&&ia()},Lo.onclick=()=>{sa()},To.onclick=()=>{
ia()},ee=async({id:e,uid:t,vip:n,icon:r})=>{await sa(),So.style.display="none",null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,No.setAttribute("data-current",""),Fo.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"});for(const e of Bo)if(e.getAttribute("data-user")===t)return void e.click();Yo="tmp$"+t,Ko=n||void 0,Vo=r,Eo.innerHTML=Go=e,ko.innerHTML="<div>Send a message to start a new chat with "+e+".</div>"
;for(const e of Bo)e.removeAttribute("data-current")},oe=async e=>{if("m"===e[0]){await sa(),So.style.display="none";for(const t of Bo)if(t.getAttribute("id")===e){t.click();break}}else{await ia();for(const t of Uo)if(t.getAttribute("id")===e){t.click();break}}null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,No.setAttribute("data-current",""),Fo.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"})}}{const pa=yo.children;let fa=null
;const ma=JSON.parse(q.getItem("__chats")||"[]");function ga({role:e,text:n}){const r=t.createElement("div");{const n=t.createElement("img");n.width=32,n.height=32,n.loading="lazy",n.decoding="async",n.draggable=!1,"u"===e?(n.src="res/user.svg",n.alt="User"):(n.src="res/bot.svg",n.alt="Assistant"),r.appendChild(n)}{const e=t.createElement("div");e.textContent=n,r.appendChild(e)}return ko.appendChild(r),r}function ba(e){const n=e.title;if("string"!=typeof n)throw Error("Invalid chat object")
;const r=t.createElement("div");r.onclick=()=>{for(const e of pa)e.removeAttribute("data-current");r.setAttribute("data-current","1"),ko.innerHTML="",Eo.textContent=n;for(const t of fa=e.msgs)ga(t);ko.scrollTo({behavior:"instant",left:0,top:ko.scrollHeight})};{const e=t.createElement("div");e.textContent=n,r.appendChild(e)}{const n=t.createElement("button");n.type="button",n.title="Delete",n.onclick=t=>{t.preventDefault(),t.stopPropagation();const n=ma.indexOf(e,0);n>=0&&(fa=null,r.remove(),
ma.splice(n,1),ko.innerHTML="",q.setItem("__chats",JSON.stringify(ma,void 0,0)))},r.appendChild(n)}yo.appendChild(r)}n("newchat").onclick=()=>{for(const e of pa)e.removeAttribute("data-current");fa=null,ko.innerHTML="",Eo.innerHTML="New chat"},Io.onclick=()=>{for(const e of pa)e.removeAttribute("data-current");if(fa=null,ko.innerHTML="",Eo.innerHTML="New chat",So.style.display="none",xo.removeAttribute("data-op"),fe=null,me=null,ge=null,pa.length<2)for(const e of ma)ba(e)
;Ao.onfocus=ko.onscrollend=null,Ao.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=Ao.value.trim();if(t.length<1)return void o("Messages cannot be empty.");if(t.length>8e3)return void o("Messages cannot be longer than 8000 characters.");if(Ao.value="",Ao.disabled=!0,null==fa){const e={title:t.slice(0,100),msgs:fa=[]};ba(e),ma.push(e)}const n={role:"u",text:t};ga(n),fa.push(n);const r={role:"a",text:"Processing..."},a=ga(r),i=a.lastElementChild;de=e=>{
e.length>0?(i.textContent=r.text=e,i.scrollIntoView({block:"end",inline:"end",behavior:"instant"})):(fa.push(r),Ao.disabled=!1,de=ue=null,q.setItem("__chats",JSON.stringify(ma,void 0,0)))},ue=e=>{fa.pop(),a.remove(),Ao.disabled=!1,de=ue=null,o("Failed to process the request. Message: "+e)},K.send(oa.UTF_8.encode("\x02"+JSON.stringify(fa,void 0,0)),{compress:!0})}},To.removeAttribute("data-current"),Lo.removeAttribute("data-current"),Io.setAttribute("data-current","1"),
bo.removeAttribute("style"),vo.removeAttribute("style"),yo.style.display="block",wo.style.display="none",To.disabled=!1,Lo.disabled=!1,Io.disabled=!1,wo.disabled=!0,Ao.disabled=!1}}n("emoji").onclick=()=>{if("block"!==go.style.display){if(null==go.firstElementChild){const e=new ao({locale:"POSIX",emojiVersion:1e3});e.addEventListener("emoji-click",(e=>{e.preventDefault(),e.stopPropagation();const t=e.detail.unicode;null!=t&&Ao.setRangeText(t,Ao.selectionStart||0,Ao.selectionEnd||0,"end")})),
go.appendChild(e)}go.style.display="block"}else go.style.display="none"}}{const ya=n("nwidget");B.onclick=()=>{if(null!=V){if(ya.hasAttribute("data-current"))return ya.removeAttribute("data-current"),void B.removeAttribute("data-current");ya.innerHTML="",B.disabled=!0,h(60,V).then((e=>{if(Array.isArray(e)&&e.length>0)for(const n of e){const e=t.createElement("div");{const r=t.createElement("div");switch(n.type){case 0:r.textContent=n.text;break;case 1:
r.innerHTML="<b>"+n.user+"</b> sent a direct message to you.",e.onclick=()=>{h(1,n.fuid).then((e=>{ee(e).catch((e=>{o("Failed to open chat channel. Message: "+e)}))})).catch((e=>{o("Failed to load user info. Message: "+e)}))};break;case 2:r.innerHTML="<b>"+n.user+"</b> mentioned you in a chat channel.",e.onclick=()=>{oe(n.chId).catch((e=>{o("Failed to open chat channel. Message: "+e)}))};break;case 3:r.innerHTML="<b>"+n.user+"</b> mentioned you in a game comment.",e.onclick=()=>{const e=n.game
;for(const t of X)if(t.date===e){ne(t).catch((e=>{o("Failed to launch game. Message: "+e)}));break}};break;case 4:r.innerHTML="<b>"+n.user+"</b> requested to be friend with you.",e.onclick=()=>{D.click()};break;default:r.innerHTML="Error: Failed to parse message."}e.appendChild(r)}{const r=t.createElement("span");r.textContent=c(n.date),e.appendChild(r)}ya.appendChild(e)}else ya.innerHTML="<div>You don't have any notifications.</div>";B.disabled=!1,B.removeAttribute("data-unread"),
ya.setAttribute("data-current",""),B.setAttribute("data-current","")})).catch((e=>{o("Failed to fetch notifications. Message: "+e)}))}else D.click()}}{const va=n("id"),wa=n("bio"),ka=n("af"),Ca=n("dm"),Ea=n("pf-games"),xa=n("pf-items"),Aa=n("avatar"),Ta=n("profile-page");re=async e=>{const t=await h(1,e);null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,Ta.setAttribute("data-current","1"),ka.disabled=!1,
ka.innerHTML="Add Friend",Ea.removeAttribute("style"),xa.removeAttribute("style"),Aa.src=s(t.icon),Ea.innerHTML=xa.innerHTML="",Ea.onscrollend=xa.onscrollend=null,wa.textContent=t.bio||"NettleWeb User";{const e=va.textContent=t.id;R||(ie=v,x.replaceState(void 0,"","/@"+e))}switch(t.vip){case 3:va.setAttribute("data-vip","gold");break;case 4:va.setAttribute("data-vip","diamond");break;default:va.removeAttribute("data-vip")}ka.onclick=()=>{null!=V?h(24,[V,e]).then((()=>{ka.disabled=!0,
ka.innerHTML="Requested"})).catch((e=>{o("Failed to send friend request. Message: "+e)})):D.click()},Ca.onclick=()=>{null!=V?ee(t).catch((e=>{o("Failed to open chat channel. Message: "+e)})):D.click()};{const t=X.filter((t=>t.user===e));if(t.length>0){let e=25;for(const e of t.slice(0,25))Ea.appendChild(g(e));Ea.onscrollend=()=>{if(Ea.scrollTop>=Ea.scrollHeight-Ea.clientHeight){const n=e+25;n>=t.length&&(Ea.onscrollend=null);for(const r of t.slice(e,e=n))Ea.appendChild(g(r))}}
}else Ea.style.overflow="unset",Ea.innerHTML="This user has not uploaded any games yet."}{const t=ae.filter((t=>t.user===e));if(t.length>0){let e=25;for(const e of t.slice(0,25))xa.appendChild(b(e));xa.onscrollend=()=>{if(xa.scrollTop>=xa.scrollHeight-xa.clientHeight){const n=e+25;n>=t.length&&(xa.onscrollend=null);for(const r of t.slice(e,e=n))xa.appendChild(b(r))}}}else xa.style.overflow="unset",xa.innerHTML="This user does not have a store yet."}}}
const be=n("paycc"),ye=n("paydesc"),ve=n("chat-profile"),we=t.querySelectorAll("#nav-bar>button, #content>div, #nmsg-btn, #accn-btn, #nwidget");{const La=n("ff"),Ia=n("accountinfo-page"),Sa=n("ac-friends"),Ma=n("ac-orders");function ja(e,n){const r=n.uid;if("string"!=typeof r)throw Error("Internal Error");const a=t.createElement("img");a.src=s(n.icon),a.alt="Avatar",a.width=48,a.height=48,a.loading="lazy",a.decoding="async",a.draggable=!1,e.appendChild(a);{const i=t.createElement("div")
;switch(i.className="user",i.textContent=n.id,n.vip){case 3:i.setAttribute("data-vip","gold");break;case 4:i.setAttribute("data-vip","diamond")}a.onclick=i.onclick=()=>{re(r).catch((e=>{o("Failed to open user profile. Message: "+e)}))},e.appendChild(i)}switch(n.state){case 1:{const n=t.createElement("button");n.type="button",n.title="Cancel request",n.className="cross",n.onclick=()=>{h(25,[V,r]).then((()=>{e.remove()})).catch((e=>{o("Failed to cancel friend request. Message: "+e)}))},
e.appendChild(n)}{const n=t.createElement("span");n.innerHTML="Requested",e.appendChild(n)}break;case 2:{const a=t.createElement("button");a.type="button",a.title="Accept",a.className="tick",a.onclick=()=>{h(24,[V,r]).then((()=>{n.state=0,e.innerHTML="",ja(e,n)})).catch((e=>{o("Failed to accept friend request. Message: "+e)}))},e.appendChild(a)}{const n=t.createElement("button");n.type="button",n.title="Reject",n.className="cross",n.onclick=()=>{h(25,[V,r]).then((()=>{e.remove()})).catch((e=>{
o("Failed to reject friend request. Message: "+e)}))},e.appendChild(n)}{const n=t.createElement("span");n.innerHTML="Accept friend request?",e.appendChild(n)}break;default:{const n=t.createElement("button");n.type="button",n.title="Remove friend",n.className="cross",n.onclick=()=>{h(25,[V,r]).then((()=>{e.remove()})).catch((e=>{o("Failed to remove friend. Message: "+e)}))},e.appendChild(n)}{const r=t.createElement("button");r.type="button",r.title="Message",r.className="message",r.onclick=()=>{
ee(n).catch((e=>{o("Failed to open chat channel. Message: "+e)}))},e.appendChild(r)}}}$=()=>{h(50,V).then((e=>{if(Array.isArray(e)&&e.length>0){const n=t.createElement("table");n.innerHTML='<thead><tr><th scope="col">ID</th><th scope="col">Date</th><th scope="col">Items</th><th scope="col">Price*</th><th scope="col">State</th><th scope="col">Contact</th></tr></thead>';{const r=t.createElement("tbody");for(const n of e){const e=t.createElement("tr");{const r=t.createElement("td")
;r.textContent=n.id,e.appendChild(r)}{const r=t.createElement("td");r.textContent=c(n.date),e.appendChild(r)}{const r=t.createElement("td");for(const e of n.pros){const n=t.createElement("div");for(const t of ae)if(t.date.toString(36)===e){n.textContent=t.name;break}r.appendChild(n)}e.appendChild(r)}{const r=t.createElement("td");r.textContent="$"+n.price.toFixed(2),e.appendChild(r)}{const r=t.createElement("td");switch(n.state){case 0:r.textContent="Pending Payment";{
const e=t.createElement("button");e.type="button",e.textContent="Cancel",e.onclick=()=>{h(52,[V,n.id,!1]).then((()=>{r.innerHTML="Aborted"})).catch((e=>{o("Failed to cancel order. Message: "+e)}))},r.appendChild(e)}break;case 1:r.textContent="Aborted";break;case 2:r.textContent="Delivered";break;default:r.textContent="Unknown"}e.appendChild(r)}{const r=t.createElement("td");r.textContent=n.sellerEmail,e.appendChild(r)}r.appendChild(e)}n.appendChild(r)}
Ma.innerHTML="<div>* including additional delivery fee</div>",Ma.prepend(n)}else Ma.style.overflow="unset",Ma.innerHTML="You don't have any orders yet."})).catch((e=>{Ma.innerHTML="Failed to fetch the list. Message: "+e})),h(26,[V,0]).then((e=>{if(Sa.innerHTML="",Array.isArray(e)&&e.length>0){let n=0;for(const n of e){const e=t.createElement("div");ja(e,n),Sa.appendChild(e)}Sa.onscrollend=()=>{Sa.scrollTop>=Sa.scrollHeight-Sa.clientHeight&&n>=0&&h(26,[V,n+=10]).then((e=>{e.length<10&&(n=-1)
;for(const n of e){const e=t.createElement("div");ja(e,n),Sa.appendChild(e)}}))}}})).catch((e=>{o("Failed to fetch the list. Message: "+e)}))},n("chat-login").onclick=ve.onclick=D.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");Ma.innerHTML=Sa.innerHTML="Loading...",F.scrollTo({top:0,left:0,behavior:"instant"}),D.setAttribute("data-current","1"),Ia.setAttribute("data-current","1"),H.checked=!1,"string"==typeof V&&$()},La.onclick=()=>{
const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.minLength=2,n.maxLength=30,n.spellcheck=!1,n.placeholder="Username",n.autocomplete="off",e.appendChild(n);const r=t.createElement("button");r.type="button",r.title="Save",r.className="tick",e.appendChild(r);const a=t.createElement("button");a.type="button",a.title="Cancel",a.className="cross",e.appendChild(a),n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(n.value=e)},r.onclick=()=>{
const r=n.value.trim().toLowerCase();r.length<4||r.length>20||!/^[\-a-z0-9]+$/.test(r)?o("Please provide a valid username."):h(1,"@"+r).then((n=>{h(24,[V,n.uid]).then((()=>{const r=t.createElement("div");n.state=1,ja(r,n),Sa.appendChild(r),e.replaceWith(La)})).catch((e=>{o("Failed to send friend request. Message: "+e)}))})).catch((e=>{o("Failed to retrieve user information. Message: "+e)}))},a.onclick=()=>{e.replaceWith(La)},La.replaceWith(e)}}{
const Oa=n("home-btn"),Pa=n("game-btn"),_a=n("apps-btn"),Fa=n("home-page"),Da=n("games-page"),Na=n("store-page"),Ua=n("services-page"),Ba=n("uploadgames-page"),Ha=n("settings-page");switch(n("logo").onclick=Oa.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,Fa.setAttribute("data-current",""),Oa.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"})},n("goto-games").onclick=Pa.onclick=()=>{null!=ie&&ie()
;for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,Pa.setAttribute("data-current",""),Da.setAttribute("data-current",""),R||(Q||(t.title="NettleWeb Games"),ie=v,x.replaceState(void 0,"","/games"))},U.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,U.setAttribute("data-current",""),Na.setAttribute("data-current",""),
R||(Q||(t.title="NettleWeb Store"),ie=v,x.replaceState(void 0,"","/shop"))},n("goto-apps").onclick=_a.onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");F.scrollTo({top:0,left:0,behavior:"instant"}),H.checked=!1,_a.setAttribute("data-current",""),Ua.setAttribute("data-current",""),R||(Q||(t.title="NettleWeb Apps"),ie=v,x.replaceState(void 0,"","/apps"))},n("ug").onclick=()=>{null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");H.checked=!1,
Ba.setAttribute("data-current",""),F.scrollTo({top:0,left:0,behavior:"instant"})},n("settings").onclick=()=>{const e=Ha.hasAttribute("data-current");null!=ie&&ie();for(const e of we)e.removeAttribute("data-current");e?(Oa.setAttribute("data-current","1"),Fa.setAttribute("data-current","1")):Ha.setAttribute("data-current","1"),H.checked=!1,F.scrollTo({top:0,left:0,behavior:"instant"})},x.scrollRestoration="manual",x.replaceState(void 0,"","/"),A){case"/":break;case"/g":case"/g/":case"/game":
case"/game/":case"/games":case"/games/":Pa.click();break;case"/v":case"/v/":case"/video":case"/video/":case"/videos":case"/videos/":N.click();break;case"/s":case"/s/":case"/shop":case"/shop/":case"/store":case"/store/":U.click();break;case"/a":case"/a/":case"/apps":case"/apps/":_a.click();break;default:if("/@"===A.slice(0,2)){const Ra=A.slice(1);if(Ra.length<=50)try{await re(Ra)}catch(za){o("Failed to open user profile. Message: "+za)}}else if("/u/"===A.slice(0,3)){const Wa=A.slice(3)
;if(Wa.length<50)try{await re(Wa)}catch(Va){o("Failed to open user profile. Message: "+Va)}}else if(A.length>4&&A.length<20){const Ga=parseInt(A.slice(1),36);if(Number.isSafeInteger(Ga)&&Ga>0)for(const Ka of X)if(Ka.date===Ga){if("1"===T.get("hidegui")){const{type:Ya,path:Za}=Ka;return I.innerHTML="",Za.startsWith("!content!")?I.appendChild(m(Ya,await u(Za.slice(9)))):I.appendChild(y(Za)),void C()}try{await ne(Ka)}catch(Qa){o("Failed to launch game. Message: "+Qa)}break}
}else o("Error: Page does not exist: "+A)}n("loading").remove(),F.style.display="block"}if("1"===T.get("m")&&setTimeout((()=>{F.scrollTo({top:F.scrollHeight,left:0,behavior:"instant"})}),5e3,null),"https://nettleweb.com"===e.origin){{const $a=t.createElement.bind(t);Object.defineProperty(t,"createElement",{value:(e,t)=>{const n=$a(e,t);return"iframe"===n.tagName.toLowerCase()&&n.setAttribute("credentialless","true"),n},writable:!1,enumerable:!1,configurable:!1})}{
const ei=t.createElementNS.bind(t);Object.defineProperty(t,"createElementNS",{value:(e,t,n)=>{const r=ei(e,t,n);return"iframe"===r.tagName.toLowerCase()&&r.setAttribute("credentialless","true"),r},writable:!1,enumerable:!1,configurable:!1})}const Xa=await l("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7505521340110301");if(null!=Xa&&Xa.length>0)try{Function("arguments","globalThis","window","frames","self","document",Xa).call(e,void 0,e,e,e,e,t)
}catch(ti){}else o("You are using an ad blocker. Please disable it to support this website's development.");const Ja=e.adsbygoogle||=[];for(const ni of t.querySelectorAll("ins.adsbygoogle")){ni.setAttribute("data-ad-client","ca-pub-7505521340110301"),ni.setAttribute("data-ad-format","auto"),ni.setAttribute("data-full-width-responsive","true");try{Ja.push(1)}catch(ri){}}}else C();{async function oi(){await J,$(),be.innerHTML=ki.cc,D.title="My Account",D.setAttribute("data-ac",""),
n("ac-prof").style.display="block",n("chat-login").remove(),n("login-dialog").remove();const e=n("ac-bio"),r=n("ac-name"),a=n("ac-email"),i=n("ac-un"),c=n("ac-edit"),l=n("ac-link"),u=n("ac-bio-edit"),p=n("ac-name-edit"),f=n("ac-email-edit"),m=n("cp"),y=n("rs"),v=n("tf");"1"===q.getItem("__?2fa")&&(v.setAttribute("data-enabled",""),v.textContent="Disable Two-Factor");const w=n("ch-avatar"),k=w.firstElementChild,C=t.createElement("img");C.alt="Avatar",C.width=40,C.height=40,C.loading="eager",
C.decoding="sync",C.draggable=!1,ve.appendChild(C);const x=t.createElement("div");x.className="user",ve.appendChild(x),ve.style.display="block";const A=await h(2,V),T=A.id,L=A.uid;if("string"!=typeof T||T.length<4||"string"!=typeof L||L.length<2)o("Error: Server response parse error.");else{switch(e.textContent=A.bio||"NettleWeb User",r.textContent=A.name||"Not set",a.textContent=A.email||"Not set",k.src=C.src=s(A.icon),i.textContent=T,x.textContent=T,n("ac-uid").textContent=L,
be.value=A.paycc||"US",ye.value=A.paydesc||"",A.unread&&B.setAttribute("data-unread",""),A.vip){case 3:n("ac-membership").textContent="Gold \u{1f451}",i.setAttribute("data-vip","gold"),x.setAttribute("data-vip","gold");break;case 4:n("ac-membership").textContent="Diamond \u{1f48e}",i.setAttribute("data-vip","diamond"),x.setAttribute("data-vip","diamond");break;default:n("ac-membership").textContent="None"}{const e=n("ac-games"),t=X.filter((e=>e.user===L));let r=25
;for(const n of t.slice(0,25))e.appendChild(g(n));e.onscrollend=()=>{if(r<t.length&&e.scrollTop>=e.scrollHeight-e.clientHeight)for(const n of t.slice(r,r+=25))e.appendChild(g(n))}}{const e=n("s-products"),t=ae.filter((e=>e.user===L));if(t.length>0){let n=25;for(const n of t.slice(0,25))e.appendChild(b(n));e.onscrollend=()=>{if(n<t.length&&e.scrollTop>=e.scrollHeight-e.clientHeight)for(const r of t.slice(n,n+=25))e.appendChild(b(r))}}else e.style.overflow="unset",
e.innerHTML="You have not published any products yet."}w.onclick=()=>{const e=t.createElement("input");e.type="file",e.accept="image/*",e.onchange=async()=>{const t=e.files?.item(0);if(null!=t){const e=await d(t,512,512);if(null==e)return void o("Error: Failed to resize image.");try{await h(4,[V,await e.arrayBuffer()])}catch(e){return void o("Failed to upload the image file. Message: "+e)}const n=URL.createObjectURL(e);k.src=C.src=n,await k.decode(),await C.decode(),URL.revokeObjectURL(n)}},
e.click()},c.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.value=i.innerHTML,n.minLength=4,n.maxLength=20,n.spellcheck=!1,n.placeholder="Username",n.autocomplete="off",e.appendChild(n);const r=t.createElement("button");r.type="button",r.title="Save",r.className="tick",e.appendChild(r);const a=t.createElement("button");a.type="button",a.title="Cancel",a.className="cross",e.appendChild(a),n.onblur=()=>{const e=n.value.trim().toLowerCase()
;e.length>0&&(n.value=e)},r.onclick=()=>{const t=n.value.trim().toLowerCase();t.length<4||t.length>20?o("Username must be between 4 and 20 characters long."):/^[\-a-z0-9]+$/.test(t)?h(3,[V,t]).then((()=>{e.replaceWith(i),i.textContent=t,x.textContent=t,c.removeAttribute("style")})).catch((e=>{o("Failed to change username. Message: "+e)})):o("Username must contain only hyphens, 0-9, lowercase a-z")},a.onclick=()=>{e.replaceWith(i),c.removeAttribute("style")},c.style.display="none",
i.replaceWith(e),n.select()},l.onclick=()=>{const e="https://nettleweb.com/@"+T,n=t.createElement("span");n.textContent=e,l.replaceWith(n),navigator.clipboard.writeText(e).catch((e=>{o("Failed to copy link to clipboard. Message: "+e)}))},u.onclick=()=>{const n=t.createElement("div"),r=t.createElement("input");r.type="text",r.value=e.innerHTML,r.minLength=1,r.maxLength=500,r.spellcheck=!1,r.placeholder="Bio",r.autocomplete="off",n.appendChild(r);const a=t.createElement("button");a.type="button",
a.title="Save",a.className="tick",n.appendChild(a);const i=t.createElement("button");i.type="button",i.title="Cancel",i.className="cross",n.appendChild(i),r.onblur=()=>{const e=r.value.trim();e.length>0&&(r.value=e)},a.onclick=()=>{const t=r.value.trim();t.length>500?o("Bio cannot have more than 500 characters in length."):h(55,[V,t]).then((()=>{n.replaceWith(e),u.removeAttribute("style"),e.textContent=t||"NettleWeb User"})).catch((e=>{o("Failed to update bio. Message: "+e)}))},i.onclick=()=>{
n.replaceWith(e),u.removeAttribute("style")},u.style.display="none",e.replaceWith(n),r.select()},p.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.value=r.innerHTML,n.minLength=2,n.maxLength=30,n.spellcheck=!1,n.placeholder="Name",n.autocomplete="off",e.appendChild(n);const a=t.createElement("button");a.type="button",a.title="Save",a.className="tick",e.appendChild(a);const i=t.createElement("button");i.type="button",i.title="Cancel",i.className="cross",
e.appendChild(i),n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},a.onclick=()=>{const t=n.value.trim();t.length>30?o("Name cannot have more than 30 characters in length."):h(20,[V,t]).then((()=>{e.replaceWith(r),r.textContent=t,p.removeAttribute("style")})).catch((e=>{o("Failed to update name. Message: "+e)}))},i.onclick=()=>{e.replaceWith(r),p.removeAttribute("style")},p.style.display="none",r.replaceWith(e),n.select()},f.onclick=()=>{
const e=t.createElement("div"),n=t.createElement("input");n.type="email",n.value=a.innerHTML,n.minLength=6,n.maxLength=320,n.spellcheck=!1,n.placeholder="Email",n.autocomplete="off",e.appendChild(n);const r=t.createElement("button");r.type="button",r.title="Save",r.className="tick",e.appendChild(r);const i=t.createElement("button");i.type="button",i.title="Cancel",i.className="cross",e.appendChild(i),n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(n.value=e)},r.onclick=()=>{
const i=n.value.trim().toLowerCase();i.length<6||i.length>320||i.indexOf("@",1)<0?o("Please provide a valid email address."):h(19,[V,i]).then((()=>{{const n=t.createElement("div");n.textContent="Please check your inbox and fill in the 6-digit verification code below to verify your email address.",e.prepend(n)}n.type="text",n.value="",n.minLength=6,n.maxLength=6,n.placeholder="6-digit verification code",n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},r.onclick=()=>{
const t=n.value.trim();6===t.length&&/^\d+$/.test(t)?h(18,[V,t]).then((()=>{e.replaceWith(a),a.textContent=i,f.removeAttribute("style")})).catch((e=>{o("Failed to verify your email. Message: "+e)})):o("The code provided must have exactly 6 digits.")}})).catch((e=>{o("Failed to update your email address. Message: "+e)}))},i.onclick=()=>{e.replaceWith(a),f.removeAttribute("style")},f.style.display="none",a.replaceWith(e),n.select()},m.onclick=()=>{const e=t.createElement("div");{
const n=t.createElement("div");n.setAttribute("style","position:relative;display:block;width:fit-content;height:fit-content;margin:10px 0px;padding:5px;line-height:18px;"),n.innerHTML="Notice: If your account was created with your Google account and does not have a password, set the current password field to 'CHANGEME!'. After changing your password, previously logged-in sessions will still have access to your account. To revoke the access, click the 'logout all sessions' button down below.",
e.appendChild(n)}const n=t.createElement("input");n.type="password",n.minLength=8,n.maxLength=30,n.spellcheck=!1,n.placeholder="Current password",n.autocomplete="off",e.appendChild(n);const r=t.createElement("input");r.type="password",r.minLength=8,r.maxLength=30,r.spellcheck=!1,r.placeholder="New password",r.autocomplete="off",e.appendChild(r);const a=t.createElement("input");a.type="password",a.minLength=8,a.maxLength=30,a.spellcheck=!1,a.placeholder="Confirm password",a.autocomplete="off",
e.appendChild(a);const i=t.createElement("button");i.type="button",i.title="Change",i.className="tick",e.appendChild(i);const s=t.createElement("button");s.type="button",s.title="Cancel",s.className="cross",e.appendChild(s),i.onclick=()=>{const t=n.value;if(t.length<8||t.length>30)return void o("The current password must have 8 to 30 characters.");const i=r.value;i.length<8||i.length>30?o("The new password must have 8 to 30 characters."):t!==i?i===a.value?h(9,[V,t,i]).then((()=>{e.replaceWith(m)
})).catch((e=>{o("Failed to change password. Message: "+e)})):o("The confirm password does not match the new password."):o("The new password must be different from the current password.")},s.onclick=()=>{e.replaceWith(m)},m.replaceWith(e)},y.onclick=()=>{h(43,V).then((e=>{"string"==typeof e&&2048===e.length?(K.send(oa.UTF_8.encode("\x01"+(V=e))),q.setItem("__secrets_",e),y.disabled=!0):o("Error: Remote returned invalid token.")})).catch((e=>{o("Failed to revoke login tokens. Message: "+e)}))},
v.onclick=()=>{const e=t.createElement("div");if(v.hasAttribute("data-enabled")){const n=t.createElement("input");n.type="text",n.minLength=6,n.maxLength=6,n.spellcheck=!1,n.placeholder="6-digit verification code",n.autocomplete="off",e.appendChild(n);const r=t.createElement("button");r.type="button",r.title="Change",r.className="tick",e.appendChild(r),r.onclick=()=>{const t=n.value.trim();6===t.length&&/^\d+$/.test(t)?h(46,[V,t]).then((()=>{q.setItem("__?2fa","0"),e.replaceWith(v),
v.removeAttribute("data-enabled"),v.textContent="Enable Two-Factor"})).catch((e=>{o("Failed to enable two-factor authentication. Message: "+e)})):o("The code provided must have exactly 6 digits.")}}else{{const n=t.createElement("div");n.setAttribute("style","position:relative;display:block;width:fit-content;height:fit-content;margin:15px 0px;line-height:18px;white-space:pre-wrap;"),
n.innerHTML='In order to enable two-factor authentication (2FA), please follow the steps below:\n1. Install an <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank" rel="noopener">authenticator app</a> if you don\'t have one already.\n2. Scan the QR code below or manually input the secret to save your account onto the authenticator.\n3. Input the 6-digit verification code generated below to verify.\n\nAfter enabling 2FA, you will be required to input the generated 6-digit verification code everytime as you login for enhanced account security.\n\nTo avoid being locked out, save the secret or a screenshot of the QR code across multiple devices, so that it could be restored back into the authenticator in case you lost your data.',
e.appendChild(n)}const n=oa.Base32.encode(crypto.getRandomValues(new Uint8Array(new ArrayBuffer(32),0,32)));{const r=t.createElement("img");r.alt="QR Code",r.width=147,r.height=147,r.loading="eager",r.decoding="sync",r.draggable=!1,r.src=qa("otpauth://totp/NettleWeb:"+T+"?secret="+n+"&issuer=NettleWeb&algorithm=SHA1").toDataURL({type:"image/png",scale:3}),e.appendChild(r)}{const r=t.createElement("div")
;r.setAttribute("style","position:relative;display:block;width:fit-content;height:fit-content;margin:15px 0px;line-height:18px;"),r.textContent="Secret: "+n,e.appendChild(r)}const r=t.createElement("input");r.type="text",r.minLength=6,r.maxLength=6,r.spellcheck=!1,r.placeholder="6-digit verification code",r.autocomplete="off",e.appendChild(r);const a=t.createElement("button");a.type="button",a.title="Change",a.className="tick",e.appendChild(a),a.onclick=()=>{const t=r.value.trim()
;6===t.length&&/^\d+$/.test(t)?h(44,[V,n,t]).then((()=>{q.setItem("__?2fa","1"),e.replaceWith(v),v.setAttribute("data-enabled",""),v.textContent="Disable Two-Factor"})).catch((e=>{o("Failed to enable two-factor authentication. Message: "+e)})):o("The code provided must have exactly 6 digits.")}}const n=t.createElement("button");n.type="button",n.title="Cancel",n.className="cross",e.appendChild(n),n.onclick=()=>{e.replaceWith(v)},v.replaceWith(e)},n("so").onclick=()=>{q.removeItem("__secrets_"),
setTimeout((()=>E.reload()),200)},n("da").onclick=()=>{o("Error: Operation not permitted.")},n("account-settings").style.display="block"}}if(null!=V){const fi=await new Promise((e=>{ce=()=>{ce=le=null,e(null)},le=t=>{ce=le=null,e(t)},K.send(oa.UTF_8.encode("\x01"+V))}));if(null==fi)return void await oi();o("Failed to validate login token. Please login again. Message: "+fi),V=null}const ai=n("login-dialog");let ii,si,ci;function li(){ai.style.display="none",ai.innerHTML="";{
const e=t.createElement("h3");e.textContent="Login",ai.appendChild(e)}const e=t.createElement("input");e.type="text",e.value=si||"",e.required=!0,e.minLength=4,e.maxLength=320,e.spellcheck=!1,e.placeholder="Username/Email",e.autocomplete="off",ai.appendChild(e);const n=t.createElement("input");n.type="password",n.value=ci||"",n.required=!0,n.minLength=8,n.maxLength=30,n.spellcheck=!1,n.placeholder="Password",n.autocomplete="off",ai.appendChild(n);const r=t.createElement("button")
;r.type="button",r.className="pri-button",r.textContent="Login",ai.appendChild(r);const a=t.createElement("div");a.tabIndex=0,a.textContent="Register",ai.appendChild(a);const i=t.createElement("div");i.tabIndex=0,i.textContent="Forgot password",ai.appendChild(i);const s=t.createElement("div");s.tabIndex=0,s.textContent="Sign in with Google",ai.appendChild(s),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(si=e.value=t)},n.onblur=()=>{const e=n.value;e.length>0&&(ci=e)},
r.onclick=()=>{const t=si=e.value.trim().toLowerCase();if(t.indexOf("@",1)<0){if(t.length<4||t.length>20)return void o("Username must be between 4 and 20 characters long.");if(!/^[\-a-z0-9]+$/.test(t))return void o("Username must contain only hyphens, 0-9, lowercase a-z.")}else if(t.length<6||t.length>320)return void o("Invalid email address. (Usernames should not contain a '@' symbol)");const r=ci=n.value
;r.length<8||r.length>30?o("Password must be between 8 and 30 characters long."):h(10,[t,r]).then((e=>{"string"==typeof e?hi(e):o("Error: Remote returned invalid token data.")})).catch((e=>{o("Failed to retrieve login token. Message: "+e)}))},a.onclick=di,i.onclick=ui,s.onclick=pi,ai.style.display="block"}function di(){ai.style.display="none",ai.innerHTML="";{const e=t.createElement("h3");e.textContent="Register",ai.appendChild(e)}const e=t.createElement("input");e.type="text",e.value=si||"",
e.required=!0,e.minLength=4,e.maxLength=20,e.spellcheck=!1,e.placeholder="Username",e.autocomplete="off",ai.appendChild(e);const n=t.createElement("input");n.type="email",n.value=ii||"",n.required=!0,n.minLength=6,n.maxLength=320,n.spellcheck=!1,n.placeholder="Email",n.autocomplete="off",ai.appendChild(n);const r=t.createElement("input");r.type="password",r.value=ci||"",r.required=!0,r.minLength=8,r.maxLength=30,r.spellcheck=!1,r.placeholder="Password",r.autocomplete="off",ai.appendChild(r)
;const a=t.createElement("input");a.type="password",a.value="",a.required=!0,a.minLength=8,a.maxLength=30,a.spellcheck=!1,a.placeholder="Confirm password",a.autocomplete="off",ai.appendChild(a);const i=t.createElement("input");i.id="tos-check",i.type="checkbox",i.required=!0,ai.appendChild(i);{const e=t.createElement("label");e.htmlFor="tos-check",e.innerHTML='I have read and accepted NettleWeb\'s <a href="https://nettleweb.com/terms.html" target="blank" rel="noopener">Terms of Service</a>.',
ai.appendChild(e)}const s=t.createElement("button");s.type="button",s.className="pri-button",s.innerHTML="Register",ai.appendChild(s);const c=t.createElement("div");c.tabIndex=0,c.innerHTML="Login",ai.appendChild(c);const l=t.createElement("div");l.tabIndex=0,l.innerHTML="Sign in with Google",ai.appendChild(l),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(si=e.value=t)},n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(ii=n.value=e)},r.onblur=()=>{const e=r.value
;e.length>0&&(ci=e)},s.onclick=()=>{const s=si=e.value.trim().toLowerCase();if(s.length<4||s.length>20)return void o("The username must be between 4 and 20 characters long.");if(!/^[\-a-z0-9]+$/.test(s))return void o("The username must contain only hyphens, lowercase a-z and 0-9.");const c=ii=n.value.trim().toLowerCase();if(c.length<6||c.length>320||c.indexOf("@",1)<0)return void o("Please provide a valid email.");const d=ci=r.value
;d.length<8||d.length>30?o("The password must be between 8 and 30 characters long."):d===a.value?i.checked?h(11,[s,d,c]).then((()=>{ai.style.display="none",ai.innerHTML="";{const e=t.createElement("h3");e.textContent="Verify Email",ai.appendChild(e)}{const e=t.createElement("span");e.textContent="Please check your inbox and fill in the 6-digit verification code below to verify your email address.",ai.appendChild(e)}const e=t.createElement("input");e.type="text",e.value="",e.required=!0,
e.minLength=6,e.maxLength=6,e.spellcheck=!1,e.placeholder="6-digit verification code",e.autocomplete="off",ai.appendChild(e);const n=t.createElement("button");n.type="button",n.className="pri-button",n.textContent="Verify",ai.appendChild(n);{const e=t.createElement("span")
;e.textContent="Notice: If you are using a managed email address (ie. school or work) and did not receive a code in your inbox after several attempts, the code is likely to be blocked by your administrator. In this case, using a personal account could help.",ai.appendChild(e)}ai.appendChild(l),e.onblur=()=>{const t=e.value.trim();t.length>0&&(e.value=t)},n.onclick=()=>{const t=e.value.trim();6===t.length&&/^\d+$/.test(t)?h(17,[s,t]).then((e=>{
"string"==typeof e&&2048===e.length?(K.send(oa.UTF_8.encode("\x01"+(V=e))),q.setItem("__secrets_",e),oi()):o("Error: Remote returned invalid token data.")})).catch((e=>{o("Failed to verify your email address. Message: "+e)})):o("The code provided must have exactly 6 digits.")},ai.style.display="block"})).catch((e=>{o("Failed to send request. Message: "+e)})):o("Please check the checkbox above to accept the Terms of Service."):o("The confirm password does not match.")},c.onclick=li,l.onclick=pi,
ai.style.display="block"}function ui(){ai.style.display="none",ai.innerHTML="";{const e=t.createElement("h3");e.textContent="Reset Password",ai.appendChild(e)}const e=t.createElement("input");e.type="email",e.value=ii||"",e.required=!0,e.minLength=6,e.maxLength=320,e.spellcheck=!1,e.placeholder="Email",e.autocomplete="off",ai.appendChild(e);const n=t.createElement("button");n.type="button",n.className="pri-button",n.textContent="Continue",ai.appendChild(n);const r=t.createElement("div")
;r.tabIndex=0,r.textContent="Login",ai.appendChild(r);const a=t.createElement("div");a.tabIndex=0,a.textContent="Register",ai.appendChild(a);const i=t.createElement("div");i.tabIndex=0,i.textContent="Sign in with Google",ai.appendChild(i),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(ii=e.value=t)},n.onclick=()=>{const n=ii=e.value.trim().toLowerCase();n.length<6||n.length>320||n.indexOf("@",1)<0?o("Please provide a valid email."):h(21,n).then((()=>{ai.style.display="none",
ai.innerHTML="";{const e=t.createElement("h3");e.textContent="Reset Password",ai.appendChild(e)}{const e=t.createElement("span");e.textContent="Please check your inbox and follow the instructions on the email.",ai.appendChild(e)}ai.appendChild(r),ai.appendChild(a),ai.appendChild(i),ai.style.display="block"})).catch((e=>{o("Failed to send request. Message: "+e)}))},r.onclick=li,a.onclick=di,i.onclick=pi,ai.style.display="block"}function hi(e){
if(2048===e.length)return K.send(oa.UTF_8.encode("\x01"+(V=e))),q.setItem("__secrets_",e),q.setItem("__?2fa","0"),void oi();ai.style.display="none",ai.innerHTML="";{const e=t.createElement("h3");e.textContent="Two-Factor Authentication",ai.appendChild(e)}{const e=t.createElement("span");e.textContent="Please open your authenticator app and fill in the generated 6-digit verification code below.",ai.appendChild(e)}const n=t.createElement("input");n.type="text",n.value="",n.minLength=6,
n.maxLength=6,n.spellcheck=!1,n.placeholder="6-digit verification code",n.autocomplete="off",ai.appendChild(n);const r=t.createElement("button");r.type="button",r.className="pri-button",r.textContent="Verify",ai.appendChild(r),n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},r.onclick=()=>{const t=n.value.trim();6===t.length&&/^\d+$/.test(t)?h(45,[e,t]).then((e=>{"string"==typeof e&&2048===e.length?(K.send(oa.UTF_8.encode("\x01"+(V=e))),q.setItem("__secrets_",e),
q.setItem("__?2fa","1"),oi()):o("Error: Remote returned invalid token data.")})).catch((e=>{o("Failed to login with OTP. Message: "+e)})):o("The code provided must have exactly 6 digits.")},ai.style.display="block"}function pi(){const t=new URL("https://accounts.google.com/o/oauth2/v2/auth");{const n=t.searchParams;n.set("client_id","176227430389-qkdboctmfhe9jnvnk2vmarafc5p8amuf.apps.googleusercontent.com"),n.set("redirect_uri",e.origin+"/auth.html"),n.set("response_type","token"),
n.set("state","12"),n.set("scope","email profile"),n.set("include_granted_scopes","true"),n.set("enable_granular_consent","true")}E.replace(t)}{const mi=q.getItem("_cre_")||"";if(mi.length>0){try{const gi=await h(0,mi);if("string"!=typeof gi)return void o("Error: Remote returned invalid token data.");D.click(),hi(gi)}catch(bi){o("Failed to retrieve login token. Message: "+bi)}q.removeItem("_cre_")}else li()}}})(window)})();