forked from nettleweb/nettleweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
508 lines (505 loc) · 256 KB
/
main.js
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
/*! For license information please see out.js.LICENSE.txt */
https://nettleweb.com/
/*! Copyright (C) 2024 nettleweb.com; All rights reserved. !*/
"use strict";
(()=>{function e(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function t(){return new TransformStream({transform(t,n){!function(t,n){Vt&&t.data instanceof Blob?t.data.arrayBuffer().then(e).then(n):Wt&&(t.data instanceof ArrayBuffer||Gt(t.data))?n(e(t.data)):Qt(t,!1,(e=>{Kt||(Kt=new TextEncoder),n(Kt.encode(e))}))}(t,(e=>{const r=e.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))}t.data&&"string"!=typeof t.data&&(o[0]|=128),n.enqueue(o),n.enqueue(e)}))}})}function n(e){return e.reduce(((e,t)=>e+t.length),0)}function r(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 o(e){if(e)return function(e){for(var t in o.prototype)e[t]=o.prototype[t];return e}(e)}function i(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}function a(e,t){t.useNativeTimers?(e.setTimeoutFn=an.bind(on),e.clearTimeoutFn=sn.bind(on)):(e.setTimeoutFn=on.setTimeout.bind(on),e.clearTimeoutFn=on.clearTimeout.bind(on))}function s(){
return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function c(){}function l(){for(let e in fn.requests)fn.requests.hasOwnProperty(e)&&fn.requests[e].abort()}function d(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||un))return new XMLHttpRequest}catch(e){}if(!t)try{return new(on[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function h(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=wn.exec(e||""),i={},a=14;for(;a--;)i[kn[a]]=o[a]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.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,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}function u(e){return Ln&&(e instanceof ArrayBuffer||Sn(e))||jn&&e instanceof Blob||_n&&e instanceof File}function p(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(p(e[t]))return!0;return!1}if(u(e))return!0
;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return p(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&p(e[t]))return!0;return!1}function f(e){const t=[],n=e.data,r=e;return r.data=m(n,t),r.attachments=t.length,{packet:r,buffers:t}}function m(e,t){if(!e)return e;if(u(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=m(e[r],t);return n}
if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=m(e[r],t));return n}return e}function g(e,t){return e.data=b(e.data,t),delete e.attachments,e}function b(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw Error("illegal attachments")}
if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=b(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=b(e[n],t));return e}function y(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e,t,n){return e.on(t,n),function(){e.off(t,n)}}function w(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}function k(e,t){"object"==typeof e&&(t=e,
e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=h(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host
;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,a=Hn[o]&&i in Hn[o].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new Un(r,t):(Hn[o]||(Hn[o]=new Un(r,t)),s=Hn[o]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}function C(){try{return"object"==typeof indexedDB}catch(e){return!1}}function E(){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 A(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const o of n){if(!r.includes(o))return!1;const n=e[o],i=t[o];if(x(n)&&x(i)){if(!A(n,i))return!1}else if(n!==i)return!1}
for(const e of r)if(!n.includes(e))return!1;return!0}function x(e){return null!==e&&"object"==typeof e}function T(e,t=er,n=tr){const r=t*Math.pow(n,e),o=Math.round(rr*r*(Math.random()-.5)*2);return Math.min(nr,r+o)}function L(e){return e&&e._delegate?e._delegate:e}function S(e){
return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(br||(br=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ar(this),t),j(yr.get(this))}:function(...t){return j(e.apply(Ar(this),t))}:function(t,...n){const r=e.call(Ar(this),t,...n);return wr.set(r,t.sort?t.sort():[t]),j(r)}}function I(e){return"function"==typeof e?S(e):(e instanceof IDBTransaction&&function(e){
if(vr.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)}));vr.set(e,t)}(e),mr(e,gr||(gr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,Er):e)}function j(e){
if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{t(j(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",i)}));return t.then((t=>{t instanceof IDBCursor&&yr.set(t,e)})).catch((()=>{})),Cr.set(t,e),t}(e);if(kr.has(e))return kr.get(e);const t=I(e);return t!==e&&(kr.set(e,t),Cr.set(t,e)),t}
function _(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const a=indexedDB.open(e,t),s=j(a);return r&&a.addEventListener("upgradeneeded",(e=>{r(j(a.result),e.oldVersion,e.newVersion,j(a.transaction),e)})),n&&a.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{i&&e.addEventListener("close",(()=>i())),o&&e.addEventListener("versionchange",(e=>o(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}function O(e,t){
if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Lr.get(t))return Lr.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=Tr.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!xr.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,o?"readwrite":"readonly");let a=i.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),o&&i.done]))[0]};return Lr.set(t,i),i}function M(e,t){try{e.container.addComponent(t)}catch(n){
Or.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function P(e){const t=e.name;if(lo.has(t))return Or.debug(`There were multiple attempts to register component ${t}.`),!1;lo.set(t,e);for(const t of so.values())M(t,e);for(const t of co.values())M(t,e);return!0}function D(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function B(e,t={}){let n=e;"object"!=typeof t&&(t={name:t})
;const r=Object.assign({name:io,automaticDataCollectionEnabled:!1},t),o=r.name;if("string"!=typeof o||!o)throw ho.create("bad-app-name",{appName:o+""});if(n||(n=Kn()),!n)throw ho.create("no-options");const i=so.get(o);if(i){if(A(n,i.options)&&A(r,i.config))return i;throw ho.create("duplicate-app",{appName:o})}const a=new sr(o);for(const e of lo.values())a.addComponent(e);const s=new uo(n,r,a);return so.set(o,s),s}function N(e,t,n){var r;let o=null!==(r=ao[e])&&void 0!==r?r:e;n&&(o+="-"+n)
;const i=o.match(/\s|\//),a=t.match(/\s|\//);if(i||a){const e=[`Unable to register library "${o}" with version "${t}":`];return i&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),i&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Or.warn(e.join(" "))}P(new or(o+"-version",(()=>({library:o,version:t})),"VERSION"))}function R(){return go||(go=_(po,fo,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(mo)}catch(e){}
}}).catch((e=>{throw ho.create("idb-open",{originalErrorMessage:e.message})}))),go}async function F(e,t){try{const n=(await R()).transaction(mo,"readwrite"),r=n.objectStore(mo);await r.put(t,U(e)),await n.done}catch(e){if(e instanceof Zn)Or.warn(e.message);else{const t=ho.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Or.warn(t.message)}}}function U(e){return`${e.name}!${e.options.appId}`}function H(){return(new Date).toISOString().substring(0,10)}function z(e){
return Wn(JSON.stringify({version:2,heartbeats:e})).length}function q(e){return e instanceof Zn&&e.code.includes("request-failed")}function V({projectId:e}){return`${xo}/projects/${e}/installations`}function W(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function G(e,t){const n=(await t.json()).error;return Lo.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,
serverStatus:n.status})}function Q({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function X(e,{refreshToken:t}){const n=Q(e);return n.append("Authorization",function(e){return`${Ao} ${e}`}(t)),n}async function K(e){const t=await e();return t.status>=500&&t.status<600?e():t}function J(e){return new Promise((t=>{setTimeout(t,e)}))}function Z(){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 So.test(t)?t:Io}catch(e){return Io}}function Y(e){return`${e.appName}!${e.appId}`}function $(e,t){const n=Y(e);ee(n,t),function(e,t){const n=te();n&&n.postMessage({key:e,fid:t}),ne()}(n,t)}function ee(e,t){const n=jo.get(e);if(n)for(const e of n)e(t)}function te(){
return!_o&&"BroadcastChannel"in self&&(_o=new BroadcastChannel("[Firebase] FID Change"),_o.onmessage=e=>{ee(e.data.key,e.data.fid)}),_o}function ne(){0===jo.size&&_o&&(_o.close(),_o=null)}function re(){return Do||(Do=_(Oo,Mo,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Po)}})),Do}async function oe(e,t){const n=Y(e),r=(await re()).transaction(Po,"readwrite"),o=r.objectStore(Po),i=await o.get(n);return await o.put(t,n),await r.done,i&&i.fid===t.fid||$(e,t.fid),t}async function ie(e){
const t=Y(e),n=(await re()).transaction(Po,"readwrite");await n.objectStore(Po).delete(t),await n.done}async function ae(e,t){const n=Y(e),r=(await re()).transaction(Po,"readwrite"),o=r.objectStore(Po),i=await o.get(n),a=t(i);return void 0===a?await o.delete(n):await o.put(a,n),await r.done,!a||i&&i.fid===a.fid||$(e,a.fid),a}async function se(e){let t;const n=await ae(e.appConfig,(n=>{const r=function(e){const t=e||{fid:Z(),registrationStatus:0};return de(t)}(n),o=function(e,t){
if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(Lo.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=V(e),o=Q(e),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const a={fid:n,authVersion:Ao,appId:e.appId,
sdkVersion:Eo},s={method:"POST",headers:o,body:JSON.stringify(a)},c=await K((()=>fetch(r,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:W(e.authToken)}}throw await G("Create Installation",c)}(e,t);return oe(e.appConfig,n)}catch(n){throw q(n)&&409===n.customData.serverCode?await ie(e.appConfig):await oe(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}
return 1===t.registrationStatus?{installationEntry:t,registrationPromise:ce(e)}:{installationEntry:t}}(e,r);return t=o.registrationPromise,o.installationEntry}));return n.fid===Io?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function ce(e){let t=await le(e.appConfig);for(;1===t.registrationStatus;)await J(100),t=await le(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await se(e);return n||t}return t}function le(e){
return ae(e,(e=>{if(!e)throw Lo.create("installation-not-found");return de(e)}))}function de(e){return 1===(t=e).registrationStatus&&t.registrationTime+Co<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function he({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${V(e)}/${t}/authTokens:generate`}(e,n),o=X(e,n),i=t.getImmediate({optional:!0});if(i){const e=await i.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const a={installation:{
sdkVersion:Eo,appId:e.appId}},s={method:"POST",headers:o,body:JSON.stringify(a)},c=await K((()=>fetch(r,s)));if(c.ok)return W(await c.json());throw await G("Generate Auth Token",c)}async function ue(e,t=!1){let n;const r=await ae(e.appConfig,(r=>{if(!fe(r))throw Lo.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+To}(e)}(o))return r
;if(1===o.requestStatus)return n=async function(e,t){let n=await pe(e.appConfig);for(;1===n.authToken.requestStatus;)await J(100),n=await pe(e.appConfig);const r=n.authToken;return 0===r.requestStatus?ue(e,t):r}(e,t),r;{if(!navigator.onLine)throw Lo.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 he(e,t),r=Object.assign(Object.assign({},t),{
authToken:n});return await oe(e.appConfig,r),n}catch(n){if(!q(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await oe(e.appConfig,n)}else await ie(e.appConfig);throw n}}(e,t),t}}));return n?await n:r.authToken}function pe(e){return ae(e,(e=>{if(!fe(e))throw Lo.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+Co<Date.now()?Object.assign(Object.assign({},e),{
authToken:{requestStatus:0}}):e;var n}))}function fe(e){return void 0!==e&&2===e.registrationStatus}async function me(e,t=!1){const n=e;return await async function(e){const{registrationPromise:t}=await se(e);t&&await t}(n),(await ue(n,t)).token}function ge(e){return Lo.create("missing-app-config-values",{valueName:e})}function be(e){if(!e.startsWith(qo)){const t=Wo.create("invalid-gtag-resource",{gtagURL:e});return Vo.warn(t.message),""}return e}function ye(e){
return Promise.all(e.map((e=>e.catch((e=>e)))))}function ve(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:be}),r=document.createElement("script"),o=`${qo}?l=${e}&id=${t}`;r.src=n?null==n?void 0:n.createScriptURL(o):o,r.async=!0,document.head.appendChild(r)}function we(e,t,n,r){return async function(o,...i){try{if("event"===o){const[r,o]=i;await async function(e,t,n,r,o){try{let i=[]
;if(o&&o.send_to){let e=o.send_to;Array.isArray(e)||(e=[e]);const r=await ye(n);for(const n of e){const e=r.find((e=>e.measurementId===n)),o=e&&t[e.appId];if(!o){i=[];break}i.push(o)}}0===i.length&&(i=Object.values(t)),await Promise.all(i),e("event",r,o||{})}catch(e){Vo.error(e)}}(e,t,n,r,o)}else if("config"===o){const[o,a]=i;await async function(e,t,n,r,o,i){const a=r[o];try{if(a)await t[a];else{const e=(await ye(n)).find((e=>e.measurementId===o));e&&await t[e.appId]}}catch(e){Vo.error(e)}
e("config",o,i)}(e,t,n,r,o,a)}else if("consent"===o){const[t,n]=i;e("consent",t,n)}else if("get"===o){const[t,n,r]=i;e("get",t,n,r)}else if("set"===o){const[t]=i;e("set",t)}else e(o,...i)}catch(e){Vo.error(e)}}}function ke(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function Ce(e,t=Qo,n){const{appId:r,apiKey:o,measurementId:i}=e.options;if(!r)throw Wo.create("no-app-id");if(!o){if(i)return{measurementId:i,appId:r};throw Wo.create("no-api-key")}
const a=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()},s=new Xo;return setTimeout((async()=>{s.abort()}),void 0!==n?n:Ho),Ee({appId:r,apiKey:o,measurementId:i},a,s,t)}async function Ee(e,{throttleEndTimeMillis:t,backoffCount:n},r,o=Qo){var i;const{appId:a,measurementId:s}=e;try{await function(e,t){return new Promise(((n,r)=>{const o=Math.max(t-Date.now(),0),i=setTimeout(n,o);e.addEventListener((()=>{clearTimeout(i),r(Wo.create("fetch-throttle",{
throttleEndTimeMillis:t}))}))}))}(r,t)}catch(e){if(s)return Vo.warn("Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID "+s+` provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:a,measurementId:s};throw e}try{const t=await async function(e){var t;const{appId:n,apiKey:r}=e,o={method:"GET",headers:ke(r)},i=zo.replace("{app-id}",n),a=await fetch(i,o);if(200!==a.status&&304!==a.status){
let e="";try{const n=await a.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}throw Wo.create("config-fetch-failed",{httpStatus:a.status,responseMessage:e})}return a.json()}(e);return o.deleteThrottleMetadata(a),t}catch(t){const c=t;if(!function(e){if(!(e instanceof Zn&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(c)){if(o.deleteThrottleMetadata(a),
s)return Vo.warn("Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID "+s+` provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:a,measurementId:s};throw t}const l=503===Number(null===(i=null==c?void 0:c.customData)||void 0===i?void 0:i.httpStatus)?T(n,o.intervalMillis,Go):T(n,o.intervalMillis),d={throttleEndTimeMillis:Date.now()+l,backoffCount:n+1};return o.setThrottleMetadata(a,d),
Vo.debug(`Calling attemptFetch again in ${l} millis`),Ee(e,d,r,o)}}function Ae(e){Jo=e}function xe(e){Ko=e}async function Te(e,t,n,r,o,i,a){var s;const c=Ce(e);c.then((t=>{n[t.measurementId]=t.appId,
e.options.measurementId&&t.measurementId!==e.options.measurementId&&Vo.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.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=>Vo.error(e))),t.push(c);const l=async function(){
if(!C())return Vo.warn(Wo.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await E()}catch(e){return Vo.warn(Wo.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?r.getId():void 0)),[d,h]=await Promise.all([c,l]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(qo)&&n.src.includes(e))return n;return null
})(i)||ve(i,d.measurementId),Jo&&(o("consent","default",Jo),Ae(void 0)),o("js",new Date);const u=null!==(s=null==a?void 0:a.config)&&void 0!==s?s:{};return u[Uo]="firebase",u.update=!0,null!=h&&(u[Fo]=h),o("config",d.measurementId,u),Ko&&(o("set",Ko),xe(void 0)),d.measurementId}function Le(){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=Wo.create("invalid-analytics-context",{errorInfo:t});Vo.warn(n.message)}}function Se(e,t,n){Le();const r=e.options.appId;if(!r)throw Wo.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Wo.create("no-api-key")
;Vo.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!=Yo[r])throw Wo.create("already-exists",{id:r});if(!ii){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(ri);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,r,o){let i=function(){
window[r].push(arguments)};return window[o]&&"function"==typeof window[o]&&(i=window[o]),window[o]=we(i,e,t,n),{gtagCore:i,wrappedGtag:window[o]}}(Yo,$o,ei,ri,oi);ni=e,ti=t,ii=!0}return Yo[r]=Te(e,$o,ei,t,ti,ri,n),new Zo(e)}function Ie(e=function(e=io){const t=so.get(e);if(!t&&e===io&&Kn())return B();if(!t)throw ho.create("no-app",{appName:e});return t}()){const t=D(e=L(e),Ro);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=D(e,Ro);if(n.isInitialized()){
const e=n.getImmediate();if(A(t,n.getOptions()))return e;throw Wo.create("already-initialized")}const r=n.initialize({options:t});return r}(e)}function je(e,t,n,r){e=L(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}))}}(ni,Yo[e.app.options.appId],t,n,r).catch((e=>Vo.error(e)))}function _e(e){if("string"!=typeof e||!e)throw Error("expected a non-empty string, got: "+e)}function Oe(e){
if("number"!=typeof e)throw Error("expected a number, got: "+e)}function Me(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 Pe(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function De(e){const t=await new Promise(((t,n)=>{const r=indexedDB.open(e,ci);Li[e]=r,r.onupgradeneeded=e=>{e.oldVersion<li&&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(hi),t(di,mi,{[fi]:[pi,!0],[vi]:[[bi,yi]],[xi]:[Ti,!0]}),t(ui,void 0,{[gi]:[""]})}(r.result)},Pe(t,n,r)}));return t.onclose=()=>Ne(e),t}function Be(e,t,n,r){return new Promise(((o,i)=>{const a=e.transaction(t,n,{durability:"relaxed"}),s="string"==typeof t?a.objectStore(t):t.map((e=>a.objectStore(e)));let c;r(s,a,(e=>{c=e})),
a.oncomplete=()=>o(c),a.onerror=()=>i(a.error)}))}function Ne(e){const t=Li[e],n=t&&t.result;if(n){n.close();const t=Ii[e];if(t)for(const e of t)e()}delete Li[e],delete Si[e],delete Ii[e]}function Re(e){return e.split(/[\s_]+/).map((e=>!e.match(/\w/)||ji.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/\u2019/g,"'").toLowerCase())).filter(Boolean)}function Fe(e){return e.filter(Boolean).map((e=>e.toLowerCase())).filter((e=>e.length>=_i))}function Ue(e,t,n,r){
e[t](n).onsuccess=e=>r&&r(e.target.result)}function He(e,t,n){Ue(e,"get",t,n)}function ze(e,t,n){Ue(e,"getAll",t,n)}function qe(e){e.commit&&e.commit()}function Ve(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 We(e,t,n,r){try{const o=function(e){
const t=e.map((({annotation:e,emoticon:t,group:n,order:r,shortcodes:o,skins:i,tags:a,emoji:s,version:c})=>{const l={annotation:e,group:n,order:r,tags:a,tokens:[...new Set(Fe([...(o||[]).map(Re).flat(),...(a||[]).map(Re).flat(),...Re(e),t]))].sort(),unicode:s,version:c};if(t&&(l.emoticon=t),o&&(l.shortcodes=o),i){l.skinTones=[],l.skinUnicodes=[],l.skinVersions=[];for(const{tone:e,emoji:t,version:n}of i)l.skinTones.push(e),l.skinUnicodes.push(t),l.skinVersions.push(n)}return l}));return t}(t)
;await Be(e,[di,hi],Ai,(([e,t],i)=>{function a(){2==++l&&function(){if(s!==r||c!==n){e.clear();for(const t of o)e.put(t);t.put(r,wi),t.put(n,ki),qe(i)}}()}let s,c,l=0;He(t,wi,(e=>{s=e,a()})),He(t,ki,(e=>{c=e,a()}))}))}finally{}}async function Ge(e,t){const n=Fe(Re(t));return n.length?Be(e,di,Ei,((e,t,r)=>{const o=[],i=()=>{const e=Ve(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],a=t===n.length-1?IDBKeyRange.bound(r,r+"\uffff",!1,!0):IDBKeyRange.only(r);ze(e.index(fi),a,(e=>{o.push(e),o.length===n.length&&i()}))}})):[]}async function Qe(e,t){const n=await Ge(e,t);if(!n.length){const n=e=>(e.shortcodes||[]).includes(t.toLowerCase());return await async function(e,t){return Be(e,di,Ei,((e,n,r)=>{let o;const i=()=>{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();i()}};i()}))}(e,n)||null}return n.filter((e=>{const n=(e.shortcodes||[]).map((e=>e.toLowerCase()));return n.includes(t.toLowerCase())}))[0]||null}function Xe(e,t,n){return Be(e,t,Ei,((e,t,r)=>He(e,n,r)))}function Ke(e){!function(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||Mi.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(Oi);o||(o=[],e.set(Oi,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(Oi)||[];const o=[],i=[r];for(;i.length;){const e=[...i.shift().entries()].sort(((e,t)=>e[0]<t[0]?-1:1));for(const[t,n]of e)t===Oi?o.push(...n):i.push(n)}return o}
}(e,(e=>{const t=new Set;if(e.shortcodes)for(const n of e.shortcodes)for(const e of Re(n))t.add(e);return t})),o=e=>r(e,!0),i=e=>r(e,!1),a=new Map,s=new Map;for(const t of e){s.set(t.name.toLowerCase(),t);for(const e of t.shortcodes||[])a.set(e.toLowerCase(),t)}return{all:n,search:e=>{const n=Re(e),r=n.map(((e,t)=>(t<n.length-1?o:i)(e)));return Ve(r,(e=>e.name)).sort(t)},byShortcode:e=>a.get(e.toLowerCase()),byName:e=>s.get(e.toLowerCase())}}function Je(e){if(!e)return e
;if(Pi&&(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 Ze(e,t){if(2!==Math.floor(e.status/100))throw Error("Failed to fetch: "+t+": "+e.status)}async function Ye(e){const t=await fetch(e);Ze(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]||Di.some((t=>!(t in e[0]))))throw Error("Emoji data is in the wrong format")}(r),[n,r]}async function $e(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 et(e,t){
let n,r=await async function(e){const t=await fetch(e,{method:"HEAD"});Ze(t,e);const n=t.headers.get("etag");return n}(t);if(!r){const e=await Ye(t);r=e[0],n=e[1],r||(r=await $e(n))}await async function(e,t,n){const[r,o]=await Promise.all([wi,ki].map((t=>Xe(e,hi,t))));return r===n&&o===t}(e,t,r)||(n||(n=(await Ye(t))[1]),await We(e,n,t,r))}function tt(e){return e.unicode.includes("\u200d")}function nt(e){const t=Vi(e,"#000"),n=Vi(e,"#fff");return t&&n&&Wi(t,n)}function rt(e){e.preventDefault(),
e.stopPropagation()}function ot(e,t,n){return(t+=e?-1:1)<0?t=n.length-1:t>=n.length&&(t=0),t}function it(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 at(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}function st(e,t,n){let r=e.get(t);return r||(r=n(),e.set(t,r)),r}function ct(e){return""+e}function lt(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){aa?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}(r,e)}function dt(e){let t="",n=!1,r=!1,o=-1;const i=new Map,a=[];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)?a.pop():(n=!0,a.push(++o));break;case">":n=!1,r=!1;break
;case"=":r=!0}const d=st(i,a[a.length-1],(()=>[]));let h,u,p;if(r){const t=/(\S+)="?([^"=]*)$/.exec(l);h=t[1],u=t[2],p=/^[^">]*/.exec(e[s+1])[0]}const f={attributeName:h,attributeValuePre:u,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:i}}function ht(e,t,n){for(let r=0;r<e.length;r++){const o=e[r],i={binding:o,targetNode:o.attributeName?t:t.firstChild,
targetParentNode:void 0,currentExpression:void 0};n.push(i)}}function ut(e){const{template:t,elementsToBindings:n}=st(ra,e,(()=>dt(e))),r=t.cloneNode(!0).content.firstElementChild,o=function(e,t){const n=[];let r;if(1===t.size&&(r=t.get(0)))ht(r,e,n);else{const r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,i=-1;do{const e=t.get(++i);e&&ht(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:i,attributeValuePre:a,attributeValuePost:s}}=n,c=e[o];if(r!==c)if(n.currentExpression=c,i)t.setAttribute(i,a+ct(c)+s);else{let e;Array.isArray(c)?lt(c,n):c instanceof Element?(e=c,t.replaceWith(e)):t.nodeValue=ct(c),e&&(n.targetNode=e)}}}(e,o),r}}function pt(e,t,n,r,o,i,a,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="${h(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?u(e,t.currentSkinTone):""}</button>`),(e=>`${r}-${e.id}`))}
const{labelWithSkin:d,titleForEmoji:h,unicodeWithSkin:u}=n,{html:p,map:f}=function(e){const t=st(oa,e,(()=>new Map));let n=ia;return{map:function(e,t,r){return e.map(((e,o)=>{const i=n;n=r(e);try{return t(e,o)}finally{n=i}}))},html:function(e,...r){const o=st(t,e,(()=>new Map));return st(o,n,(()=>ut(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)=>{i[t]=e})),a.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 ft(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 mt(e,t){function n(){const{customEmoji:e,database:t}=u,n=e||la;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=at(n(o));void 0===ta&&(ta=at(t));const i=e/1.8<ta;Xi.set(o.unicode,i),i||(r=!1)}return r}(e,l.baselineEmoji,g);t?L():u.currentEmojis=[...u.currentEmojis]}function o(e){return!e.unicode||!tt(e)||Xi.get(e.unicode)}async function i(e){const t=u.emojiVersion||await Qi()
;return e.filter((({version:e})=>!e||e<=t))}async function a(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:i,category:a,annotation:s})=>({unicode:e,name:i,shortcodes:r,url:o,category:a,annotation:s,id:e||i,skins:t&&n(t)})))}(e,u.emojiVersion||await Qi())}async function s(e){
const t=await u.database.getEmojiByUnicodeOrName(e),n=[...u.currentEmojis,...u.currentFavorites].find((t=>t.id===e)),r=n.unicode&&C(n,u.currentSkinTone);await u.database.incrementFavoriteEmojiCount(e),b("emoji-click",{emoji:t,skinTone:u.currentSkinTone,...r&&{unicode:r},...n.name&&{name:n.name}})}function c(e){u.currentSkinTone=e,u.skinTonePickerExpanded=!1,m("skintone-button"),b("skin-tone-change",{skinTone:e}),u.database.setPreferredSkinTone(e)}
const l={},d=new AbortController,h=d.signal,{state:u,createEffect:p}=function(e){let t,n=!1;const r=new Map,o=new Set;let i;const a=()=>{if(n)return;const e=[...o];o.clear();try{for(const t of e)t()}finally{i=!1,o.size&&(i=!0,sa(a))}},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);i||(i=!0,sa(a))}}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()}}}(h),f=new Map;da(u,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),da(u,t),da(u,{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:Ri,databaseLoaded:!1,activeSearchItemId:void 0}),p((()=>{u.currentGroup!==u.groups[u.currentGroupIndex]&&(u.currentGroup=u.groups[u.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:i}=t;return n===o&&ft(r,i,y)},w=e=>{ft(u.currentEmojis,e,y)||(u.currentEmojis=e)},k=e=>{u.searchMode!==e&&(u.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||la].filter(Boolean),it(n,(e=>e))).join(", ");var n},titleForEmoji:e=>e.annotation||(e.shortcodes||la).join(", "),unicodeWithSkin:C},A={onClickSkinToneButton:function(e){
u.skinTonePickerExpanded=!u.skinTonePickerExpanded,u.activeSkinTone=u.currentSkinTone,u.skinTonePickerExpanded&&(rt(e),ea((()=>m("skintone-list"))))},onEmojiClick:async function(e){const{target:t}=e;t.classList.contains("emoji")&&(rt(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="",u.rawSearchText="",u.searchText="",u.activeSearchItem=-1,
u.currentGroupIndex=u.groups.findIndex((e=>e.id===r))},onNavKeydown:function(e){const{target:t,key:n}=e,r=t=>{t&&(rt(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(!u.searchMode||!u.currentEmojis.length)return;const t=t=>{rt(e),
u.activeSearchItem=ot(t,u.activeSearchItem,u.currentEmojis)};switch(e.key){case"ArrowDown":return t(!1);case"ArrowUp":return t(!0);case"Enter":if(-1!==u.activeSearchItem)return rt(e),s(u.currentEmojis[u.activeSearchItem].id);u.activeSearchItem=0}},onSkinToneOptionsClick:function(e){const{target:{id:t}}=e,n=t&&t.match(/^skintone-(\d)/);n&&(rt(e),c(parseInt(n[1],10)))},onSkinToneOptionsFocusOut:async function(e){const{relatedTarget:t}=e;t&&"skintone-list"===t.id||(u.skinTonePickerExpanded=!1)},
onSkinToneOptionsKeydown:function(e){if(!u.skinTonePickerExpanded)return;const t=async t=>{rt(e),u.activeSkinTone=t};switch(e.key){case"ArrowUp":return t(ot(!0,u.activeSkinTone,u.skinTones));case"ArrowDown":return t(ot(!1,u.activeSkinTone,u.skinTones));case"Home":return t(0);case"End":return t(u.skinTones.length-1);case"Enter":return rt(e),c(u.activeSkinTone);case"Escape":return rt(e),u.skinTonePickerExpanded=!1,m("skintone-button")}},onSkinToneOptionsKeyup:function(e){
if(u.skinTonePickerExpanded)return" "===e.key?(rt(e),c(u.activeSkinTone)):void 0},onSearchInput:function(e){u.rawSearchText=e.target.value}},x={calculateEmojiGridStyle:function(e){!function(e,t,n){let r;na?(r=new ResizeObserver(n),r.observe(e)):ea(n),t.addEventListener("abort",(()=>{r&&r.disconnect()}))}(e,h,(()=>{{const e=getComputedStyle(l.rootElement),t=parseInt(e.getPropertyValue("--num-columns"),10),n="rtl"===e.getPropertyValue("direction");u.numColumns=t,u.isRtl=n}}))},
updateOnIntersection:function(e){!function(e,t,n){{const r=e.closest(".tabpanel");let o=ca.get(r);o||(o=new IntersectionObserver(n,{root:r,rootMargin:"50% 0px 50% 0px",threshold:0}),ca.set(r,o),t.addEventListener("abort",(()=>{o.disconnect()}))),o.observe(e)}}(e,h,(e=>{for(const{target:t,isIntersecting:n}of e)t.classList.toggle("onscreen",n)}))}};let T=!0;p((()=>{pt(e,u,E,A,x,l,h,f,T),T=!1})),u.emojiVersion||Qi().then((e=>{e||(u.message=u.i18n.emojiUnsupportedMessage)})),p((()=>{
u.database&&async function(){let e=!1;const t=setTimeout((()=>{e=!0,u.message=u.i18n.loadingMessage}),1e3);try{await u.database.ready(),u.databaseLoaded=!0}catch(e){u.message=u.i18n.networkErrorMessage}finally{clearTimeout(t),e&&(e=!1,u.message="")}}()})),p((()=>{u.pickerStyle=`\n --num-groups: ${u.groups.length}; \n --indicator-opacity: ${u.searchMode?0:1}; \n --num-skintones: 6;`})),p((()=>{u.customEmoji&&u.database&&n()})),p((()=>{
u.customEmoji&&u.customEmoji.length?u.groups!==Ni&&(u.groups=Ni):u.groups!==Ri&&(u.currentGroupIndex&&u.currentGroupIndex--,u.groups=Ri)})),p((()=>{!async function(){u.databaseLoaded&&(u.currentSkinTone=await u.database.getPreferredSkinTone())}()})),p((()=>{u.skinTones=[,,,,,,].fill().map(((e,t)=>function(e,t){if(0===t)return e;const n=e.indexOf(Zi);return-1!==n?e.substring(0,n)+String.fromCodePoint(Yi+t-1)+e.substring(n):(e.endsWith(Ki)&&(e=e.substring(0,e.length-1)),
e+Ji+String.fromCodePoint($i+t-1))}(u.skinToneEmoji,t)))})),p((()=>{u.skinToneButtonText=u.skinTones[u.currentSkinTone]})),p((()=>{u.skinToneButtonLabel=u.i18n.skinToneLabel.replace("{skinTone}",u.i18n.skinTones[u.currentSkinTone])})),p((()=>{u.databaseLoaded&&async function(){const{database:e}=u,t=(await Promise.all(Hi.map((t=>e.getEmojiByUnicodeOrName(t))))).filter(Boolean);u.defaultFavoriteEmojis=t}()})),p((()=>{u.databaseLoaded&&u.defaultFavoriteEmojis&&async function(){n()
;const{database:e,defaultFavoriteEmojis:t,numColumns:r}=u,o=await e.getTopFavoriteEmoji(r),i=await a(it([...o,...t],(e=>e.unicode||e.name)).slice(0,r));u.currentFavorites=i}()})),p((()=>{!async function(){const{searchText:e,currentGroup:t,databaseLoaded:n,customEmoji:r}=u;if(n)if(e.length>=2){const t=await async function(e){return a(await i(await u.database.getEmojiBySearchQuery(e)))}(e);u.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?u.customEmoji:await u.database.getEmojiByGroup(e);return a(await i(t))}(e);u.currentGroup.id===e&&(w(t),k(!1))}}else u.currentEmojis=[],u.searchMode=!1}()}));const L=()=>{ea((()=>{var e;(e=l.tabpanelElement)&&(e.scrollTop=0)}))};return p((()=>{const{currentEmojis:e,emojiVersion:t}=u,n=e.filter((e=>e.unicode)).filter((e=>tt(e)&&!Xi.has(e.unicode)));if(!t&&n.length)w(e),ea((()=>r(n)));else{const n=t?e:e.filter(o);w(n),L()}})),p((()=>{})),p((()=>{const e=function(){
const{searchMode:e,currentEmojis:t}=u;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)=>u.customCategorySorting(e.category,t.category)))}();(e=>{ft(u.currentEmojisWithCategories,e,v)||(u.currentEmojisWithCategories=e)})(e)})),p((()=>{u.activeSearchItemId=-1!==u.activeSearchItem&&u.currentEmojis[u.activeSearchItem].id})),p((()=>{
const{rawSearchText:e}=u;Fi((()=>{u.searchText=(e||"").trim(),u.activeSearchItem=-1}))})),p((()=>{u.skinTonePickerExpanded?l.skinToneDropdown.addEventListener("transitionend",(()=>{u.skinTonePickerExpandedAfterAnimation=!0}),{once:!0}):u.skinTonePickerExpandedAfterAnimation=!1})),{$set(e){da(u,e)},$destroy(){d.abort()}}}function gt(e){let t=0,n="";for(;t<e.byteLength;){const r=e[t];if(128&r)if(192==(224&r)){const o=e[t+1];n+=String.fromCharCode((31&r)<<6|63&o),t+=2}else if(224==(240&r)){
const o=e[t+1],i=e[t+2];n+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&i),t+=3}else if(240==(248&r)){const o=(7&r)<<18|(63&e[t+1])<<12|(63&e[t+2])<<6|63&e[t+3];n+=o<=1114111?String.fromCodePoint(o):"\ufffd",t+=4}else n+="\ufffd",t+=1;else n+=String.fromCharCode(r),t+=1}return n}function bt(e){try{return new DataView(e,0,0),!0}catch(e){return!1}}function yt(e,t){const n=function(e){const t=[];for(const n of Array.from(e,(e=>e.codePointAt(0)||0)))n<=127?t.push(n):n<=2047?(t.push(n>>6|192),
t.push(63&n|128)):n<=65535?(t.push(n>>12|224),t.push(n>>6&63|128),t.push(63&n|128)):n<=1114111&&(t.push(n>>18|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128));return Uint8Array.from(t)}(t),r=new DataView(new ArrayBuffer(4),0,4);r.setUint32(0,n.byteLength,!0),e.write(r),e.write(n)}function vt(e,t){const n=new DataView(new ArrayBuffer(5),0,5);n.setUint8(0,102),n.setUint32(1,t.byteLength,!0),e.write(n),e.write(t)}function wt(e,t){switch(typeof t){case"string":e.write(101),yt(e,t)
;break;case"boolean":e.write([10,t?1:0]);break;case"undefined":e.write(0);break;case"number":{if(Number.isSafeInteger(t))if(t>=0){if(t<=255){const n=new DataView(new ArrayBuffer(2),0,2);return n.setUint8(0,10),n.setUint8(1,t),void e.write(n)}if(t<=65535){const n=new DataView(new ArrayBuffer(3),0,3);return n.setUint8(0,11),n.setUint16(1,t,!0),void e.write(n)}if(t<=4294967295){const n=new DataView(new ArrayBuffer(5),0,5);return n.setUint8(0,12),n.setUint32(1,t,!0),void e.write(n)}}else{
if(t>=-128&&t<128){const n=new DataView(new ArrayBuffer(2),0,2);return n.setUint8(0,20),n.setInt8(1,t),void e.write(n)}if(t>=-32768&&t<32768){const n=new DataView(new ArrayBuffer(3),0,3);return n.setUint8(0,21),n.setInt16(1,t,!0),void e.write(n)}if(t>=-2147483648&&t<2147483648){const n=new DataView(new ArrayBuffer(5),0,5);return n.setUint8(0,22),n.setInt32(1,t,!0),void e.write(n)}}const n=new DataView(new ArrayBuffer(9),0,9);n.setUint8(0,33),n.setFloat64(1,t,!0),e.write(n)}break;case"bigint":{
const n=new DataView(new ArrayBuffer(9),0,9);t>=0n?(n.setUint8(0,13),n.setBigUint64(1,t,!0)):(n.setUint8(0,23),n.setBigUint64(1,t,!0)),e.write(n)}break;case"object":null===t?e.write(255):Array.isArray(t)?function(e,t){const n=new DataView(new ArrayBuffer(5),0,5);n.setUint8(0,99),n.setUint32(1,t.length,!0),e.write(n);for(const n of t)wt(e,n)}(e,t):bt(t)?vt(e,new Uint8Array(t)):ArrayBuffer.isView(t)?vt(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength)):function(e,t){
if("function"==typeof t.toJSON)return void wt(e,t.toJSON());const n=Object.keys(t);{const t=new DataView(new ArrayBuffer(5),0,5);t.setUint8(0,100),t.setUint32(1,n.length,!0),e.write(t)}for(const r of n){const n=t[r];switch(typeof n){case"bigint":case"number":case"object":case"string":case"boolean":case"undefined":yt(e,r),wt(e,n)}}}(e,t)}}function kt(e){const t=e.read();switch(t){case 0:return;case 255:return null;case 10:return e.read();case 11:return e.readNBytesDV(2).getUint16(0,!0);case 12:
return e.readNBytesDV(4).getUint32(0,!0);case 13:return e.readNBytesDV(8).getBigUint64(0,!0);case 20:return e.read()<<8>>8;case 21:return e.readNBytesDV(2).getInt16(0,!0);case 22:return e.readNBytesDV(4).getInt32(0,!0);case 23:return e.readNBytesDV(8).getBigInt64(0,!0);case 32:return e.readNBytesDV(4).getFloat32(0,!0);case 33:return e.readNBytesDV(8).getFloat64(0,!0);case 99:return function(e){const t=e.readNBytesDV(4).getUint32(0,!0),n=Array(t);for(let r=0;r<t;r++)n[r]=kt(e);return n}(e)
;case 100:return function(e){const t=e.readNBytesDV(4).getUint32(0,!0),n=Object.create(null);for(let r=0;r<t;r++)n[gt(e.readNBytes(e.readNBytesDV(4).getUint32(0,!0)))]=kt(e);return n}(e);case 101:return gt(e.readNBytes(e.readNBytesDV(4).getUint32(0,!0)));case 102:return e.readNBytes(e.readNBytesDV(4).getUint32(0,!0));default:throw Error("Parse Error: Invalid data ID: "+t)}}function Ct(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw Error(`Invalid version=${e}. Expected number [1..40]`)}
function Et(e,t){return e.toString(2).padStart(t,"0")}function At(e,t){const n=e%t;return n>=0?n:t+n}function xt(e,t){return Array(e).fill(t)}function Tt(...e){let t=0;for(const n of e)t=Math.max(t,n.length);const n=[];for(let r=0;r<t;r++)for(const t of e)r>=t.length||n.push(t[r]);return new Uint8Array(n)}function Lt(e,t,n){if(n<0||n+t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[n+r])return!1;return!0}function St(){let e,t=1/0;return{add(n,r){n>=t||(e=r,t=n)},get:()=>e,
score:()=>t}}function It(e){return{has:t=>e.includes(t),decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw Error("alphabet.decode: not string element="+t);const n=e.indexOf(t);if(-1===n)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))},encode:t=>{
if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(function(e){if(!Number.isSafeInteger(e))throw Error("Wrong integer: "+e)}(t),t<0||t>=e.length)throw Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))}}}function jt(e,t){const{words:n,shortBlocks:r,numBlocks:o,blockLen:i,total:a}=Da.capacity(e,t),s=(c=n,{encode(e){const t=Na.divisorPoly(c),n=Array.from(e)
;return n.push(...t.slice(0,-1).fill(0)),Uint8Array.from(Na.remainderPoly(n,t))},decode(e){const t=e.slice(),n=Na.polynomial(Array.from(e));let r=xt(c,0),o=!1;for(let e=0;e<c;e++){const t=Na.evalPoly(n,Na.exp(e));r[r.length-1-e]=t,0!==t&&(o=!0)}if(!o)return t;r=Na.polynomial(r);const i=Na.monomial(c,1),[a,s]=Na.euclidian(i,r,c),l=xt(Na.degree(a),0);let d=0;for(let e=1;e<256&&d<l.length;e++)0===Na.evalPoly(a,e)&&(l[d++]=Na.inv(e));if(d!==l.length)throw Error("RS.decode: wrong errors number")
;for(let e=0;e<l.length;e++){const n=t.length-1-Na.log(l[e]);if(n<0)throw Error("RS.decode: wrong error location");const r=Na.inv(l[e]);let o=1;for(let t=0;t<l.length;t++)e!==t&&(o=Na.mul(o,Na.add(1,Na.mul(l[t],r))));t[n]=Na.add(t[n],Na.mul(Na.evalPoly(s,r),Na.inv(o)))}return t}});var c;return{encode(e){const t=[],n=[];for(let a=0;a<o;a++){const o=i+(a<r?0:1);t.push(e.subarray(0,o)),n.push(s.encode(e.subarray(0,o))),e=e.subarray(o)}const a=Tt(...t),c=Tt(...n),l=new Uint8Array(a.length+c.length)
;return l.set(a),l.set(c,a.length),l},decode(e){if(e.length!==a)throw Error(`interleave.decode: len(data)=${e.length}, total=${a}`);const t=[];for(let e=0;e<o;e++){const o=e<r;t.push(new Uint8Array(n+i+(o?0:1)))}let c=0;for(let n=0;n<i;n++)for(let r=0;r<o;r++)t[r][n]=e[c++];for(let n=r;n<o;n++)t[n][i]=e[c++];for(let a=i;a<i+n;a++)for(let n=0;n<o;n++){const o=n<r;t[n][a+(o?0:1)]=e[c++]}const l=[];for(const e of t)l.push(...Array.from(s.decode(e)).slice(0,-n));return Uint8Array.from(l)}}}
function _t(e,t,n,r=!1){const o=Da.size.encode(e);let i=new Ia(o+2);const a=new Ia(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);i=i.embed(0,a).embed({x:-a.width,y:0},a).embed({x:0,y:-a.height},a),i=i.rectSlice(1,o);const s=new Ia(1).rect(0,1,!0).border(1,!1).border(1,!0),c=Da.alignmentPatterns(e);for(const e of c)for(const t of c)void 0===i.data[e][t]&&i.embed({x:t-2,y:e-2},s);i=i.hLine({x:0,y:6},1/0,(({x:e},t)=>void 0===t?e%2==0:t)).vLine({x:6,y:0
},1/0,(({y:e},t)=>void 0===t?e%2==0:t));{const e=Da.formatBits(t,n),a=t=>!r&&1==(e>>t&1);for(let e=0;e<6;e++)i.data[e][8]=a(e);for(let e=6;e<8;e++)i.data[e+1][8]=a(e);for(let e=8;e<15;e++)i.data[o-15+e][8]=a(e);for(let e=0;e<8;e++)i.data[8][o-e-1]=a(e);for(let e=8;e<9;e++)i.data[8][15-e-1+1]=a(e);for(let e=9;e<15;e++)i.data[8][15-e-1]=a(e);i.data[o-8][8]=!r}if(e>=7){const t=Da.versionBits(e);for(let e=0;e<18;e+=1){const n=!r&&1==(t>>e&1),a=Math.floor(e/3),s=e%3+o-8-3;i.data[a][s]=n,
i.data[s][a]=n}}return i}function Ot(e,t,n){const r=e.height,o=Ba[t];let i=-1,a=r-1;for(let t=r-1;t>0;t-=2){for(6==t&&(t=5);;a+=i){for(let r=0;r<2;r+=1){const i=t-r;void 0===e.data[a][i]&&n(i,a,o(i,a))}if(a+i<0||a+i>=r)break}i=-i}}function Mt(e){let t="numeric";for(let n of e)if(!Da.alphabet.numeric.has(n)&&(t="alphanumeric",!Da.alphabet.alphanumerc.has(n)))return"byte";return t}function Pt(e,t,n,r){let o="",i=n.length;if("numeric"===r){const e=Da.alphabet.numeric.decode(n.split("")),t=e.length
;for(let n=0;n<t-2;n+=3)o+=Et(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?o+=Et(e[t-1],4):t%3==2&&(o+=Et(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){const e=Da.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)o+=Et(45*e[n]+e[n+1],11);t%2==1&&(o+=Et(e[t-1],6))}else{if("byte"!==r)throw Error("encode: unsupported type");{const e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(n)
;i=e.length,o=Array.from(e).map((e=>Et(e,8))).join("")}}const{capacity:a}=Da.capacity(e,t),s=Et(i,Da.lengthBits(e,r));let c=Da.modeBits[r]+s+o;if(c.length>a)throw Error("Capacity overflow");c+="0".repeat(Math.min(4,Math.max(0,a-c.length))),c.length%8&&(c+="0".repeat(8-c.length%8));const l="1110110000010001";for(let e=0;c.length!==a;e++)c+=l[e%16];const d=Uint8Array.from(c.match(/(.{8})/g).map((e=>Number("0b"+e))));return jt(e,t).encode(d)}function Dt(e,t,n,r,o=!1){const i=_t(e,t,r,o);let a=0
;const s=8*n.length;if(Ot(i,r,((e,t,r)=>{let o=!1;a<s&&(o=!!(n[a>>>3]>>(7-a&7)&1),a++),i.data[t][e]=o!==r})),a!==s)throw Error("QR: bytes left after draw");return i}function Bt(e){const t=e.inverse(),n=e=>{let t=0;for(let n,r=0,o=1;r<e.length;r++)n===e[r]&&(o++,r!==e.length-1)||(o>=5&&(t+=o-5+3),n=e[r],o=1);return t};let r=0;e.data.forEach((e=>r+=n(e))),t.data.forEach((e=>r+=n(e)));let o=0,i=e.data;const a=e.width-1,s=e.height-1;for(let e=0;e<a;e++)for(let t=0;t<s;t++){const n=e+1,r=t+1
;i[e][t]===i[n][t]&&i[n][t]===i[e][r]&&i[n][t]===i[n][r]&&(o+=3)}const c=e=>{const t=[!0,!1,!0,!0,!0,!1,!0],n=[!1,!1,!1,!1],r=[...t,...n],o=[...n,...t];let i=0;for(let t=0;t<e.length;t++)Lt(e,r,t)&&(i+=40),Lt(e,o,t)&&(i+=40);return i};let l=0;for(const t of e.data)l+=c(t);for(const e of t.data)l+=c(e);let d=0;e.rectRead(0,1/0,((e,t)=>d+=t?1:0));const h=d/(e.height*e.width)*100;return r+o+l+10*Math.floor(Math.abs(h-50)/5)}function Nt(e,t="raw",n={}){const r=void 0!==n.ecc?n.ecc:"medium"
;!function(e){if(!ja.includes(e))throw Error(`Invalid error correction mode=${e}. Expected: ${ja}`)}(r);const o=void 0!==n.encoding?n.encoding:Mt(e);!function(e){if(!_a.includes(e))throw Error(`Encoding: invalid mode=${e}. Expected: ${_a}`);if("kanji"===e||"eci"===e)throw Error(`Encoding: ${e} is not supported (yet?).`)}(o),void 0!==n.mask&&function(e){if(![0,1,2,3,4,5,6,7].includes(e)||!Ba[e])throw Error(`Invalid mask=${e}. Expected number [0..7]`)}(n.mask)
;let i,a=n.version,s=Error("Unknown error");if(void 0!==a)Ct(a),i=Pt(a,r,e,o);else for(let t=1;t<=40;t++)try{i=Pt(t,r,e,o),a=t;break}catch(e){s=e}if(!a||!i)throw s;let c=function(e,t,n,r){if(void 0===r){const o=St();for(let r=0;r<Ba.length;r++)o.add(Bt(Dt(e,t,n,r,!0)),r);r=o.get()}if(void 0===r)throw Error("Cannot find mask");return Dt(e,t,n,r)}(a,r,i,n.mask);c.assertDrawn();const l=void 0===n.border?2:n.border;if(!Number.isSafeInteger(l))throw Error("Wrong border type="+typeof l)
;if(c=c.border(l,!1),void 0!==n.scale&&(c=c.scale(n.scale)),"raw"===t)return c.data;if("ascii"===t)return c.toASCII();if("svg"===t)return c.toSVG();if("gif"===t)return c.toGIF();if("term"===t)return c.toTerm();throw Error("Unknown output: "+t)}function Rt(e,t){return Ns(e,{i:2},t&&t.out,t&&t.dictionary)}var Ft={d:(e,t)=>{for(var n in t)Ft.o(t,n)&&!Ft.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}};Ft.g=function(){if("object"==typeof globalThis)return globalThis;try{
return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),Ft.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ft.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var Ut={};Ft.r(Ut),Ft.d(Ut,{Decoder:()=>Bn,Encoder:()=>Dn,PacketType:()=>Pn,protocol:()=>Mn});const Ht=Object.create(null);Ht.open="0",Ht.close="1",Ht.ping="2",Ht.pong="3",
Ht.message="4",Ht.upgrade="5",Ht.noop="6";const zt=Object.create(null);Object.keys(Ht).forEach((e=>{zt[Ht[e]]=e}));const qt={type:"error",data:"parser error"
},Vt="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Wt="function"==typeof ArrayBuffer,Gt=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Qt=({type:e,data:t},n,r)=>Vt&&t instanceof Blob?n?r(t):Xt(t,r):Wt&&(t instanceof ArrayBuffer||Gt(t))?n?r(t):Xt(new Blob([t]),r):r(Ht[e]+(t||"")),Xt=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1]
;t("b"+(e||""))},n.readAsDataURL(e)};let Kt;const Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zt="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Zt[Jt.charCodeAt(e)]=e;const Yt="function"==typeof ArrayBuffer,$t=(e,t)=>{if("string"!=typeof e)return{type:"message",data:tn(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:en(e.substring(1),t)}:zt[n]?e.length>1?{type:zt[n],data:e.substring(1)}:{type:zt[n]}:qt},en=(e,t)=>{if(Yt){
const n=(e=>{let t,n,r,o,i,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const l=new ArrayBuffer(a),d=new Uint8Array(l);for(t=0;t<s;t+=4)n=Zt[e.charCodeAt(t)],r=Zt[e.charCodeAt(t+1)],o=Zt[e.charCodeAt(t+2)],i=Zt[e.charCodeAt(t+3)],d[c++]=n<<2|r>>4,d[c++]=(15&r)<<4|o>>2,d[c++]=(3&o)<<6|63&i;return l})(e);return tn(n,t)}return{base64:!0,data:e}},tn=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;let nn
;o.prototype.on=o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.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},o.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
},o.prototype.emitReserved=o.prototype.emit,o.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},o.prototype.hasListeners=function(e){return!!this.listeners(e).length};const rn="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),on="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")(),an=on.setTimeout,sn=on.clearTimeout;class cn extends Error{
constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ln extends o{constructor(e){super(),this.writable=!1,a(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 cn(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=$t(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 dn extends ln{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=$t(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,i)=>{Qt(e,!1,(e=>{
r[i]=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]=s()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let hn=!1;try{hn="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Bs){}const un=hn;class pn extends dn{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 fn extends o{
constructor(e,t,n){super(),this.createRequest=e,a(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=i(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=fn.requestsCount++,fn.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=c,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete fn.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()}}fn.requestsCount=0,fn.requests={},
"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",l):"function"==typeof addEventListener&&addEventListener("onpagehide"in on?"pagehide":"unload",l,!1));const mn=function(){const e=d({xdomain:!1});return e&&null!==e.responseType}(),gn="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class bn extends ln{get name(){return"websocket"}doOpen(){
const e=this.uri(),t=this.opts.protocols,n=gn?{}:i(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;Qt(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}r&&rn((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){
void 0!==this.ws&&(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]=s()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const yn=on.WebSocket||on.MozWebSocket,vn={websocket:class extends bn{createSocket(e,t,n){return gn?new yn(e,t,n):t?new yn(e,t):new yn(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ln{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 o=function(e,t){nn||(nn=new TextDecoder);const o=[];let i=0,a=-1,s=!1;return new TransformStream({transform(c,l){for(o.push(c);;){if(0===i){if(n(o)<1)break
;const e=r(o,1);s=!(128&~e[0]),a=127&e[0],i=a<126?3:126===a?1:2}else if(1===i){if(n(o)<2)break;const e=r(o,2);a=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(n(o)<8)break;const e=r(o,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>2097151){l.enqueue(qt);break}a=4294967296*s+t.getUint32(4),i=3}else{if(n(o)<a)break;const e=r(o,a);l.enqueue($t(s?e:nn.decode(e),t)),i=0}if(0===a||a>e){l.enqueue(qt);break}}}})
}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(o).getReader(),a=t();a.readable.pipeTo(e.writable),this._writer=a.writable.getWriter();const s=()=>{i.read().then((({done:e,value:t})=>{e||(this.onPacket(t),s())})).catch((()=>{}))};s();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).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&&rn((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends pn{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=mn&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new fn(d,this.uri(),e)}}
},wn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Cn="function"==typeof addEventListener&&"function"==typeof removeEventListener,En=[]
;Cn&&addEventListener("offline",(()=>{En.forEach((e=>e()))}),!1);class An extends o{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=h(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=h(t.host).host);a(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)),Cn&&(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"})},En.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&&An.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",An.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,rn((()=>{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(An.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(),Cn&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=En.indexOf(this._offlineEventListener);-1!==e&&En.splice(e,1)}this.readyState="closed",this.id=null,
this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}An.protocol=4;class xn extends An{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(){a||(a=!0,l(),i.close(),i=null)}function n(){c("transport closed")}function r(){c("socket closed")}function o(e){i&&e.name!==i.name&&t()}let i=this.createTransport(e),a=!1
;An.priorWebsocketSuccess=!1;const s=()=>{a||(i.send([{type:"ping",data:"probe"}]),i.once("packet",(e=>{if(!a)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;An.priorWebsocketSuccess="websocket"===i.name,this.transport.pause((()=>{a||"closed"!==this.readyState&&(l(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())}))}else{const e=Error("probe error");e.transport=i.name,
this.emitReserved("upgradeError",e)}})))},c=e=>{const n=Error("probe error: "+e);n.transport=i.name,t(),this.emitReserved("upgradeError",n)},l=()=>{i.removeListener("open",s),i.removeListener("error",c),i.removeListener("close",n),this.off("close",r),this.off("upgrading",o)};i.once("open",s),i.once("error",c),i.once("close",n),this.once("close",r),this.once("upgrading",o),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{a||i.open()}),200):i.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 Tn extends xn{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=>vn[e])).filter((e=>!!e))),super(e,n)}}
const Ln="function"==typeof ArrayBuffer,Sn=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,In=Object.prototype.toString,jn="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===In.call(Blob),_n="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===In.call(File),On=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Mn=5;var Pn;!function(e){
e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Pn||(Pn={}));class Dn{constructor(e){this.replacer=e}encode(e){return e.type!==Pn.EVENT&&e.type!==Pn.ACK||!p(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Pn.EVENT?Pn.BINARY_EVENT:Pn.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type
;return e.type!==Pn.BINARY_EVENT&&e.type!==Pn.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=f(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}}class Bn extends o{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");t=this.decodeString(e)
;const n=t.type===Pn.BINARY_EVENT;n||t.type===Pn.BINARY_ACK?(t.type=n?Pn.EVENT:Pn.ACK,this.reconstructor=new Nn(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!u(e)&&!e.base64)throw Error("Unknown type: "+e);if(!this.reconstructor)throw Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={
type:Number(e.charAt(0))};if(void 0===Pn[n.type])throw Error("unknown packet type "+n.type);if(n.type===Pn.BINARY_EVENT||n.type===Pn.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1
;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Bn.isPayloadValid(n.type,r))throw Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Pn.CONNECT:return y(t);case Pn.DISCONNECT:return void 0===t;case Pn.CONNECT_ERROR:return"string"==typeof t||y(t);case Pn.EVENT:
case Pn.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===On.indexOf(t[0]));case Pn.ACK:case Pn.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Nn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=g(this.reconPack,this.buffers)
;return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Rn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Fn extends o{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),
this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[v(e,"open",this.onopen.bind(this)),v(e,"packet",this.onpacket.bind(this)),v(e,"error",this.onerror.bind(this)),v(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){
return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,o;if(Rn.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const i={type:Pn.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}
const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t)
;const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))}),r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise(((n,r)=>{const o=(e,t)=>e?r(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={
id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,
this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Pn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){
Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>t.id+""===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Pn.CONNECT:
e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Pn.EVENT:case Pn.BINARY_EVENT:this.onevent(e);break;case Pn.ACK:case Pn.BINARY_ACK:this.onack(e);break;case Pn.DISCONNECT:this.ondisconnect();break;case Pn.CONNECT_ERROR:this.destroy()
;const t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1
;return function(...r){n||(n=!0,t.packet({type:Pn.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{
this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Pn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}
timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){
return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){
return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}w.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},w.prototype.reset=function(){this.attempts=0},
w.prototype.setMin=function(e){this.ms=e},w.prototype.setMax=function(e){this.max=e},w.prototype.setJitter=function(e){this.jitter=e};class Un extends o{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,a(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),
this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new w({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ut;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){
return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,
null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Tn(this.uri,this.opts)
;const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=v(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=v(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),o(Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(i),this}
connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(v(e,"ping",this.onping.bind(this)),v(e,"data",this.ondata.bind(this)),v(e,"error",this.onerror.bind(this)),v(e,"close",this.onclose.bind(this)),v(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){rn((()=>{this.emitReserved("packet",e)
}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Fn(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,
this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),
this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),
this.emitReserved("reconnect",e)}}const Hn={};Object.assign(k,{Manager:Un,Socket:Fn,io:k,connect:k});const zn=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
},qn={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],i=t+1<e.length,a=i?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,l=o>>2,d=(3&o)<<4|a>>4;let h=(15&a)<<2|c>>6,u=63&c;s||(u=64,i||(h=64)),r.push(n[l],n[d],n[h],n[u])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(zn(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 i=e[n++];t[r++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}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++)],i=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const s=t<e.length?n[e.charAt(t)]:64;if(++t,null==o||null==i||null==a||null==s)throw new Vn;const c=o<<2|i>>4;if(r.push(c),64!==a){const e=i<<4&240|a>>2;if(r.push(e),64!==s){const e=a<<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 Vn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Wn=function(e){return function(e){const t=zn(e);return qn.encodeByteArray(t,!0)}(e).replace(/\./g,"")},Gn=function(e){try{return qn.decodeString(e,!0)}catch(e){}return null},Qn=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==Ft.g)return Ft.g;throw Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Xn=()=>{try{
return Qn()||(()=>{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&&Gn(e[1]);return t&&JSON.parse(t)})()}catch(e){return}},Kn=()=>{var e;return null===(e=Xn())||void 0===e?void 0:e.config};class Jn{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 Zn extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Zn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Yn.prototype.create)}}class Yn{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],i=o?function(e,t){return e.replace($n,((e,n)=>{const r=t[n];return null!=r?r+"":`<${n}?>`}))}(o,n):"Error",a=`${this.serviceName}: ${i} (${r}).`;return new Zn(r,a,n)}}const $n=/\{\$([^}]+)}/g,er=1e3,tr=2,nr=144e5,rr=.5;class or{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 ir="[DEFAULT]";class ar{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 Jn;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:ir})}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=ir){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=ir){return this.instances.has(e)}getOptions(e=ir){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 i=this.instances.get(r);return i&&e(i,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===ir?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=ir){return this.component?this.component.multipleInstances?e:ir:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class sr{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 ar(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const cr=[];var lr;!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"}(lr||(lr={}))
;const dr={debug:lr.DEBUG,verbose:lr.VERBOSE,info:lr.INFO,warn:lr.WARN,error:lr.ERROR,silent:lr.SILENT},hr=lr.INFO,ur={[lr.DEBUG]:"log",[lr.VERBOSE]:"log",[lr.INFO]:"info",[lr.WARN]:"warn",[lr.ERROR]:"error"},pr=(e,t)=>{if(!(t<e.logLevel||((new Date).toISOString(),ur[t])))throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class fr{constructor(e){this.name=e,this._logLevel=hr,this._logHandler=pr,this._userLogHandler=null,cr.push(this)}get logLevel(){
return this._logLevel}set logLevel(e){if(!(e in lr))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?dr[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,lr.DEBUG,...e),this._logHandler(this,lr.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,lr.VERBOSE,...e),this._logHandler(this,lr.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,lr.INFO,...e),this._logHandler(this,lr.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,lr.WARN,...e),this._logHandler(this,lr.WARN,...e)}error(...e){
this._userLogHandler&&this._userLogHandler(this,lr.ERROR,...e),this._logHandler(this,lr.ERROR,...e)}}const mr=(e,t)=>t.some((t=>e instanceof t));let gr,br;const yr=new WeakMap,vr=new WeakMap,wr=new WeakMap,kr=new WeakMap,Cr=new WeakMap;let Er={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return vr.get(e);if("objectStoreNames"===t)return e.objectStoreNames||wr.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return j(e[t])},
set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};const Ar=e=>Cr.get(e),xr=["get","getKey","getAll","getAllKeys","count"],Tr=["put","add","delete","clear"],Lr=new Map;var Sr;Sr=Er,Er={...Sr,get:(e,t,n)=>O(e,t)||Sr.get(e,t,n),has:(e,t)=>!!O(e,t)||Sr.has(e,t)};class Ir{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 jr="@firebase/app",_r="0.10.15",Or=new fr("@firebase/app"),Mr="@firebase/app-compat",Pr="@firebase/analytics-compat",Dr="@firebase/analytics",Br="@firebase/app-check-compat",Nr="@firebase/app-check",Rr="@firebase/auth",Fr="@firebase/auth-compat",Ur="@firebase/database",Hr="@firebase/data-connect",zr="@firebase/database-compat",qr="@firebase/functions",Vr="@firebase/functions-compat",Wr="@firebase/installations",Gr="@firebase/installations-compat",Qr="@firebase/messaging",Xr="@firebase/messaging-compat",Kr="@firebase/performance",Jr="@firebase/performance-compat",Zr="@firebase/remote-config",Yr="@firebase/remote-config-compat",$r="@firebase/storage",eo="@firebase/storage-compat",to="@firebase/firestore",no="@firebase/vertexai",ro="@firebase/firestore-compat",oo="firebase",io="[DEFAULT]",ao={
[jr]:"fire-core",[Mr]:"fire-core-compat",[Dr]:"fire-analytics",[Pr]:"fire-analytics-compat",[Nr]:"fire-app-check",[Br]:"fire-app-check-compat",[Rr]:"fire-auth",[Fr]:"fire-auth-compat",[Ur]:"fire-rtdb",[Hr]:"fire-data-connect",[zr]:"fire-rtdb-compat",[qr]:"fire-fn",[Vr]:"fire-fn-compat",[Wr]:"fire-iid",[Gr]:"fire-iid-compat",[Qr]:"fire-fcm",[Xr]:"fire-fcm-compat",[Kr]:"fire-perf",[Jr]:"fire-perf-compat",[Zr]:"fire-rc",[Yr]:"fire-rc-compat",[$r]:"fire-gcs",[eo]:"fire-gcs-compat",[to]:"fire-fst",
[ro]:"fire-fst-compat",[no]:"fire-vertex","fire-js":"fire-js",[oo]:"fire-js-all"},so=new Map,co=new Map,lo=new Map,ho=new Yn("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 uo{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 or("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 ho.create("app-deleted",{appName:this._name})}}const po="firebase-heartbeat-database",fo=1,mo="firebase-heartbeat-store";let go=null;class bo{constructor(e){this.container=e,this._heartbeatsCache=null
;const t=this.container.getProvider("app").getImmediate();this._storage=new yo(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=H();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;return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(e){Or.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=H(),{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),z(n)>t){e.dates.pop();break}}else if(n.push({agent:o.agent,dates:[o.date]}),z(n)>t){n.pop();break}r=r.slice(1)}
return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),o=Wn(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 Or.warn(e),""}}}class yo{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}
async runIndexedDBEnvironmentCheck(){return!!C()&&E().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await R()).transaction(mo),n=await t.objectStore(mo).get(U(e));return await t.done,n}catch(e){if(e instanceof Zn)Or.warn(e.message);else{const t=ho.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Or.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 F(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 F(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}var vo
;vo="",P(new or("platform-logger",(e=>new Ir(e)),"PRIVATE")),P(new or("heartbeat",(e=>new bo(e)),"PRIVATE")),N(jr,_r,vo),N(jr,_r,"esm2017"),N("fire-js",""),N("firebase","11.0.1","app");const wo="@firebase/installations",ko="0.6.10",Co=1e4,Eo="w:"+ko,Ao="FIS_v2",xo="https://firebaseinstallations.googleapis.com/v1",To=36e5,Lo=new Yn("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."}),So=/^[cdef][\w-]{21}$/,Io="",jo=new Map;let _o=null
;const Oo="firebase-installations-database",Mo=1,Po="firebase-installations-store";let Do=null;const Bo="installations",No=e=>{const t=D(e.getProvider("app").getImmediate(),Bo).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:r}=await se(t);return r?r.catch(console.error):ue(t).catch(console.error),n.fid}(t),getToken:e=>me(t,e)}};P(new or(Bo,(e=>{const t=e.getProvider("app").getImmediate(),n=function(e){
if(!e||!e.options)throw ge("App Configuration");if(!e.name)throw ge("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ge(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:D(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),P(new or("installations-internal",No,"PRIVATE")),N(wo,ko),N(wo,ko,"esm2017")
;const Ro="analytics",Fo="firebase_id",Uo="origin",Ho=6e4,zo="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",qo="https://www.googletagmanager.com/gtag/js",Vo=new fr("@firebase/analytics"),Wo=new Yn("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}."}),Go=30,Qo=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 Xo{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let Ko,Jo;class Zo{constructor(e){this.app=e}_delete(){return delete Yo[this.app.options.appId],Promise.resolve()}}let Yo={},$o=[];const ei={};let ti,ni,ri="dataLayer",oi="gtag",ii=!1
;const ai="@firebase/analytics",si="0.10.9";P(new or(Ro,((e,{options:t})=>Se(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),P(new or("analytics-internal",(function(e){try{const t=e.getProvider(Ro).getImmediate();return{logEvent:(e,n,r)=>je(t,e,n,r)}}catch(e){throw Wo.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),N(ai,si),N(ai,si,"esm2017")
;const ci=1,li=1,di="emoji",hi="keyvalue",ui="favorites",pi="tokens",fi="tokens",mi="unicode",gi="count",bi="group",yi="order",vi="group-order",wi="eTag",ki="url",Ci="skinTone",Ei="readonly",Ai="readwrite",xi="skinUnicodes",Ti="skinUnicodes",Li={},Si={},Ii={},ji=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#"]),_i=2,Oi="",Mi=["name","url"],Pi="undefined"!=typeof wrappedJSObject,Di=["annotation","emoji","group","order","version"]
;class Bi{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=Ke(n),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const e=this._db=await(t=this._dbName,Si[t]||(Si[t]=De(t)),Si[t]);var t;!function(e,t){let n=Ii[e];n||(n=Ii[e]=[]),n.push(t)
}(this._dbName,this._clear);const n=this.dataSource,r=await async function(e){return!await Xe(e,hi,ki)}(e);r?await async function(e,t){let[n,r]=await Ye(t);n||(n=await $e(r)),await We(e,r,t,n)}(e,n):this._lazyUpdate=et(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 Oe(e),await this.ready(),Me(await async function(e,t){return Be(e,di,Ei,((e,n,r)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0)
;ze(e.index(vi),o,r)}))}(this._db,e)).map(Je)}async getEmojiBySearchQuery(e){return _e(e),await this.ready(),[...this._custom.search(e),...Me(await Ge(this._db,e)).map(Je)]}async getEmojiByShortcode(e){_e(e),await this.ready();const t=this._custom.byShortcode(e);return t||Je(await Qe(this._db,e))}async getEmojiByUnicodeOrName(e){_e(e),await this.ready();const t=this._custom.byName(e);return t||Je(await async function(e,t){return Be(e,di,Ei,((e,n,r)=>He(e,t,(n=>{if(n)return r(n)
;He(e.index(xi),t,(e=>r(e||null)))}))))}(this._db,e))}async getPreferredSkinTone(){return await this.ready(),await Xe(this._db,hi,Ci)||0}async setPreferredSkinTone(e){return Oe(e),await this.ready(),function(e,t,n,r){return Be(e,t,Ai,((e,t)=>{e.put(r,n),qe(t)}))}(this._db,hi,Ci,e)}async incrementFavoriteEmojiCount(e){return _e(e),await this.ready(),t=this._db,n=e,Be(t,ui,Ai,((e,t)=>He(e,n,(r=>{e.put((r||0)+1,n),qe(t)}))));var t,n}async getTopFavoriteEmoji(e){return Oe(e),await this.ready(),
(await function(e,t,n){return 0===n?[]:Be(e,[ui,di],Ei,(([e,r],o,i)=>{const a=[];e.index(gi).openCursor(void 0,"prev").onsuccess=e=>{function o(e){if(a.push(e),a.length===n)return i(a);s.continue()}const s=e.target.result;if(!s)return i(a);const c=s.primaryKey,l=t.byName(c);if(l)return o(l);He(r,c,(e=>{if(e)return o(e);s.continue()}))}}))}(this._db,this._custom,e)).map(Je)}set customEmoji(e){this._custom=Ke(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 Ne(this._dbName)}async delete(){var e;await this._shutdown(),await(e=this._dbName,new Promise(((t,n)=>{Ne(e),Pe(t,n,indexedDB.deleteDatabase(e))})))}}
const Ni=[[-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}))),Ri=Ni.slice(1),Fi="function"==typeof requestIdleCallback?requestIdleCallback:setTimeout,Ui={"\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
},Hi=["\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}"],zi='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',qi=(e,t)=>e<t?-1:e>t?1:0,Vi=(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 "+zi,r.fillStyle=t,r.scale(.01,.01),r.fillText(e,0,0),r.getImageData(0,0,1,1).data},Wi=(e,t)=>{const n=[...e].join(",");return n===[...t].join(",")&&!n.startsWith("0,0,0,")};let Gi;const Qi=()=>(Gi||(Gi=new Promise((e=>Fi((()=>e(function(){const e=Object.entries(Ui);try{for(const[t,n]of e)if(nt(t))return n}catch(e){}return e[0][1]}())))))),Gi),Xi=new Map,Ki="\ufe0f",Ji="\ud83c",Zi="\u200d",Yi=127995,$i=57339,ea=requestAnimationFrame
;let ta,na="function"==typeof ResizeObserver;const ra=new WeakMap,oa=new WeakMap,ia=Symbol("un-keyed"),aa="replaceChildren"in Element.prototype,sa="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e),ca=new WeakMap,la=[],{assign:da}=Object;var ha={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 ua=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],pa=`:host{--emoji-font-family:${zi}}`;class fa 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)}'+pa,
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:qi,customEmoji:null,i18n:ha,emojiVersion:null,...e};for(const e of ua)"database"!==e&&Object.prototype.hasOwnProperty.call(this,e)&&(this._ctx[e]=this[e],delete this[e]);this._dbFlush()}connectedCallback(){this._cmp||(this._cmp=mt(this.shadowRoot,this._ctx))}disconnectedCallback(){sa((()=>{
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 Bi({locale:e,dataSource:t}))}_dbFlush(){sa((()=>this._dbCreate()))}}const ma={};for(const e of ua)ma[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(fa.prototype,ma),customElements.get("emoji-picker")||customElements.define("emoji-picker",fa)
;var ga,ba,ya=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},va=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};ga=new WeakMap,ba=new WeakMap;const wa=class{constructor(e,t){ga.set(this,void 0),ba.set(this,void 0),ya(this,ga,ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),"f"),ya(this,ba,t||0,"f")}read(){var e,t;return va(this,ga,"f")[(ya(this,ba,(t=va(this,ba,"f"),e=t++,
t),"f"),e)]}readNBytes(e){return va(this,ga,"f").subarray(va(this,ba,"f"),ya(this,ba,va(this,ba,"f")+e,"f"))}readNBytesDV(e){const t=va(this,ga,"f").subarray(va(this,ba,"f"),ya(this,ba,va(this,ba,"f")+e,"f"));return new DataView(t.buffer,t.byteOffset,t.byteLength)}};var ka,Ca,Ea=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},Aa=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter")
;if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};ka=new WeakMap,Ca=new WeakMap;const xa=class{constructor(){ka.set(this,[]),Ca.set(this,0)}write(e){if("number"==typeof e)Ea(this,ka,"f").push(e),Aa(this,Ca,Ea(this,Ca,"f")+1,"f");else if(Array.isArray(e)){const t=Uint8Array.from(e);Ea(this,ka,"f").push(t),Aa(this,Ca,Ea(this,Ca,"f")+t.byteLength,"f")
}else if(ArrayBuffer.isView(e)){const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);Ea(this,ka,"f").push(t),Aa(this,Ca,Ea(this,Ca,"f")+t.byteLength,"f")}else{const t=new Uint8Array(e);Ea(this,ka,"f").push(t),Aa(this,Ca,Ea(this,Ca,"f")+t.byteLength,"f")}}toBuffer(){const e=new Uint8Array(Ea(this,Ca,"f"));let t=0;for(const n of Ea(this,ka,"f"))"number"!=typeof n?(e.set(n,t),t+=n.byteLength):e[t++]=n;return e}},Ta=Object.freeze(Object.create(null,{encode:{value:function(e){
if("object"!=typeof e||null==e)throw Error("Data must be a non-null object or array.");const t=new xa;return t.write(Uint8Array.of(128,99,98,106,102,2)),wt(t,e),t.toBuffer().buffer},writable:!1,enumerable:!1,configurable:!1},decode:{value:function(e){if(Array.isArray(e)||"function"==typeof e[Symbol.iterator])e=Uint8Array.from(e);else if(bt(e))e=new Uint8Array(e);else{if(!ArrayBuffer.isView(e))throw Error("Data must be a Uint8Array or ArrayBuffer object.")
;e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}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");return kt(new wa(e,6))},writable:!1,enumerable:!1,configurable:!1},[Symbol.toStringTag]:{value:"NettleDB",writable:!1,enumerable:!1,configurable:!1}
})),La="object"==typeof globalThis&&null!=globalThis?globalThis:"object"==typeof window&&null!=window?window:"object"==typeof global&&null!=global?global:"object"==typeof self&&null!=self?self:Function("return this;")();"object"==typeof La&&null!=La&&Object.defineProperty(La,"NettleDB",{value:Ta,writable:!1,enumerable:!1,configurable:!1});const Sa=Ta;class Ia{static size(e,t){if("number"==typeof e&&(e={height:e,width:e}),
!Number.isSafeInteger(e.height)&&e.height!==1/0)throw Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return void 0!==t&&(e={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}),e}static fromString(e){const t=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split("\n"),n=t.length,r=Array(n);let o;for(const e of t){const t=e.split("").map((e=>{
if("X"===e)return!0;if(" "===e)return!1;if("?"!==e)throw Error("Bitmap.fromString: unknown symbol="+e)}));if(o&&t.length!==o)throw Error(`Bitmap.fromString different row sizes: width=${o} cur=${t.length}`);o=t.length,r.push(t)}return o||(o=0),new Ia({height:n,width:o},r)}constructor(e,t){const{height:n,width:r}=Ia.size(e);this.data=t||Array.from({length:n},(()=>xt(r,void 0))),this.height=n,this.width=r}point(e){return this.data[e.y][e.x]}isInside(e){
return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:t,y:n}=this.xy(e);return{height:this.height-n,width:this.width-t}}xy(e){if("number"==typeof e&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw Error("Bitmap: wrong x="+e.x);if(!Number.isSafeInteger(e.y))throw Error("Bitmap: wrong y="+e.y);return e.x=At(e.x,this.width),e.y=At(e.y,this.height),e}rect(e,t,n){const{x:r,y:o}=this.xy(e),{height:i,width:a}=Ia.size(t,this.size({x:r,y:o
}));for(let e=0;e<i;e++)for(let t=0;t<a;t++)this.data[o+e][r+t]="function"==typeof n?n({x:t,y:e},this.data[o+e][r+t]):n;return this}rectRead(e,t,n){return this.rect(e,t,((e,t)=>(n(e,t),t)))}hLine(e,t,n){return this.rect(e,{width:t,height:1},n)}vLine(e,t,n){return this.rect(e,{width:1,height:t},n)}border(e=2,t){const n=this.height+2*e,r=this.width+2*e,o=xt(e,t),i=Array.from({length:e},(()=>xt(r,t)));return new Ia({height:n,width:r},[...i,...this.data.map((e=>[...o,...e,...o])),...i])}embed(e,t){
return this.rect(e,t.size(),(({x:e,y:n})=>t.data[n][e]))}rectSlice(e,t=this.size()){const n=new Ia(Ia.size(t,this.size(this.xy(e))));return this.rect(e,t,(({x:e,y:t},r)=>n.data[t][e]=r)),n}inverse(){const{height:e,width:t}=this;return new Ia({height:t,width:e}).rect({x:0,y:0},1/0,(({x:e,y:t})=>this.data[e][t]))}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw Error("Wrong scale factor: "+e);const{height:t,width:n}=this;return new Ia({height:e*t,width:e*n}).rect({x:0,y:0
},1/0,(({x:t,y:n})=>this.data[Math.floor(n/e)][Math.floor(t/e)]))}clone(){return new Ia(this.size()).rect({x:0,y:0},this.size(),(({x:e,y:t})=>this.data[t][e]))}assertDrawn(){this.rectRead(0,1/0,((e,t)=>{if("boolean"!=typeof t)throw Error("Invalid color type="+typeof t)}))}toString(){return this.data.map((e=>e.map((e=>void 0===e?"?":e?"X":" ")).join(""))).join("\n")}toASCII(){const{height:e,width:t,data:n}=this;let r="";for(let o=0;o<e;o+=2){for(let i=0;i<t;i++){
const t=n[o][i],a=o+1>=e||n[o+1][i];t||a?!t&&a?r+="\u2580":t&&!a?r+="\u2584":t&&a&&(r+=" "):r+="\u2588"}r+="\n"}return r}toTerm(){const e="\x1b[0m",t="\x1b[1;47m "+e,n="\x1b[40m "+e;return this.data.map((e=>e.map((e=>e?n:t)).join(""))).join("\n")}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,(({x:t,y:n},r)=>{
r&&(e+=`<rect x="${t}" y="${n}" width="1" height="1" />`)})),e+="</svg>",e}toGIF(){const e=e=>[255&e,e>>>8&255],t=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,((e,t)=>n.push(+(!0===t))));const r=126,o=[71,73,70,56,55,97,...t,246,0,0,255,255,255,...xt(381,0),44,0,0,0,0,...t,0,7],i=Math.floor(n.length/r);for(let e=0;e<i;e++)o.push(127,128,...n.slice(r*e,r*(e+1)).map((e=>+e)));return o.push(n.length%r+1,128,...n.slice(i*r).map((e=>+e))),o.push(1,129,0,59),new Uint8Array(o)}
toImage(e=!1){const{height:t,width:n}=this.size(),r=new Uint8Array(t*n*(e?3:4));let o=0;for(let i=0;i<t;i++)for(let t=0;t<n;t++){const n=this.data[i][t]?0:255;r[o++]=n,r[o++]=n,r[o++]=n,e||(r[o++]=255)}return{height:t,width:n,data:r}}}
const ja=["low","medium","quartile","high"],_a=["numeric","alphanumeric","byte","kanji","eci"],Oa=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Ma={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],
medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Pa={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],
medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},Da={size:{encode:e=>21+4*(e-1),decode:e=>(e-17)/4},sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(1===e)return[]
;const t=Da.size.encode(e)-6-1,n=t-6,r=Math.ceil(n/28);let o=Math.floor(n/r);o%2?o+=1:n%r*2>=r&&(o+=2);const i=[6];for(let e=1;e<r;e++)i.push(t-(r-e)*o);return i.push(t),i},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(e,t){const n=Da.ECCode[e]<<3|t;let r=n;for(let e=0;e<10;e++)r=r<<1^1335*(r>>9);return(n<<10|r)^Da.formatMask},versionBits(e){let t=e;for(let e=0;e<12;e++)t=t<<1^7973*(t>>11);return e<<12|t},alphabet:{numeric:It("0123456789"),
alphanumerc:It("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(e,t)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[t][Da.sizeType(e)]),modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){const n=Oa[e-1],r=Ma[t][e-1],o=Pa[t][e-1],i=Math.floor(n/o)-r,a=o-n%o;return{words:r,numBlocks:o,shortBlocks:a,blockLen:i,capacity:8*(n-r*o),total:(r+i)*o+o-a}}
},Ba=[(e,t)=>(e+t)%2==0,(e,t)=>t%2==0,e=>e%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(t/2)+Math.floor(e/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0],Na={tables:(()=>{const e=xt(256,0),t=xt(256,0);for(let n=0,r=1;n<256;n++)e[n]=r,t[r]=n,r<<=1,256&r&&(r^=285);return{exp:e,log:t}})(),exp:e=>Na.tables.exp[e],log(e){if(0===e)throw Error("GF.log: wrong arg="+e);return Na.tables.log[e]%255},
mul:(e,t)=>0===e||0===t?0:Na.tables.exp[(Na.tables.log[e]+Na.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>Na.tables.exp[Na.tables.log[e]*t%255],inv(e){if(0===e)throw Error("GF.inverse: wrong arg="+e);return Na.tables.exp[255-Na.tables.log[e]]},polynomial(e){if(0==e.length)throw Error("GF.polymomial: wrong length");if(0!==e[0])return e;let t=0;for(;t<e.length-1&&0==e[t];t++);return e.slice(t)},monomial(e,t){if(e<0)throw Error("GF.monomial: wrong degree="+e);if(0==t)return[0];let n=xt(e+1,0)
;return n[0]=t,Na.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[Na.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];const n=xt(e.length+t.length-1,0);for(let r=0;r<e.length;r++)for(let o=0;o<t.length;o++)n[r+o]=Na.add(n[r+o],Na.mul(e[r],t[o]));return Na.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;const n=xt(e.length,0);for(let r=0;r<e.length;r++)n[r]=Na.mul(e[r],t);return Na.polynomial(n)},mulPolyMonomial(e,t,n){
if(t<0)throw Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];const r=xt(e.length+t,0);for(let t=0;t<e.length;t++)r[t]=Na.mul(e[t],n);return Na.polynomial(r)},addPoly(e,t){if(0===e[0])return t;if(0===t[0])return e;let n=e,r=t;n.length>r.length&&([n,r]=[r,n]);let o=xt(r.length,0),i=r.length-n.length,a=r.slice(0,i);for(let e=0;e<a.length;e++)o[e]=a[e];for(let e=i;e<r.length;e++)o[e]=Na.add(n[e-i],r[e]);return Na.polynomial(o)},remainderPoly(e,t){const n=Array.from(e)
;for(let r=0;r<e.length-t.length+1;r++){const e=n[r];if(0!==e)for(let o=1;o<t.length;o++)0!==t[o]&&(n[r+o]=Na.add(n[r+o],Na.mul(t[o],e)))}return n.slice(e.length-t.length+1,n.length)},divisorPoly(e){let t=[1];for(let n=0;n<e;n++)t=Na.mulPoly(t,[1,Na.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return Na.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=Na.add(Na.mul(t,n),e[r]);return n},euclidian(e,t,n){Na.degree(e)<Na.degree(t)&&([e,t]=[t,e]);let r=e,o=t,i=[0],a=[1]
;for(;2*Na.degree(o)>=n;){let e=r,t=i;if(r=o,i=a,0===r[0])throw Error("rLast[0] === 0");o=e;let n=[0];const s=Na.inv(r[0]);for(;Na.degree(o)>=Na.degree(r)&&0!==o[0];){const e=Na.degree(o)-Na.degree(r),t=Na.mul(o[0],s);n=Na.addPoly(n,Na.monomial(e,t)),o=Na.addPoly(o,Na.mulPolyMonomial(r,e,t))}if(n=Na.mulPoly(n,i),a=Na.addPoly(n,t),Na.degree(o)>=Na.degree(r))throw Error(`Division failed r: ${o}, rLast: ${r}`)}const s=Na.coefficient(a,0);if(0==s)throw Error("sigmaTilde(0) was zero")
;const c=Na.inv(s);return[Na.mulPolyScalar(a,c),Na.mulPolyScalar(o,c)]}},Ra=function(){for(let e=Object.getPrototypeOf(this);null!=e;e=Object.getPrototypeOf(e))try{delete e.constructor}catch(e){}},Fa=Object.freeze(Object.create(null));Object.defineProperty(Ra,"prototype",{value:Fa,writable:!1,enumerable:!1,configurable:!1}),Object.setPrototypeOf(Ra,null),Object.freeze(Ra);const Ua=Ra;var Ha,za=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Ha=new WeakMap;const qa=class extends Ua{constructor(){super(...arguments),Ha.set(this,Object.create(null))}get size(){return Object.keys(za(this,Ha,"f")).length}has(e){return e in za(this,Ha,"f")}get(e){return za(this,Ha,"f")[e]||null}set(e,t){za(this,Ha,"f")[e]=t}delete(e){
return delete za(this,Ha,"f")[e]}clear(){const e=za(this,Ha,"f");for(const t of Object.keys(e))delete e[t]}keys(){return Object.keys(za(this,Ha,"f"))}values(){const e=za(this,Ha,"f"),t=[];for(const n of Object.keys(e))t.push(e[n]);return t}entries(){const e=za(this,Ha,"f"),t=[];for(const n of Object.keys(e))t.push([n,e[n]]);return t}};var Va,Wa=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},Ga=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter")
;if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};Va=new WeakMap;const Qa=class extends Ua{get size(){return Wa(this,Va,"f").length}constructor(e){super(),Va.set(this,void 0),Ga(this,Va,e,"f")}has(e){return null!=Wa(this,Va,"f").getItem(e)}get(e){return Wa(this,Va,"f").getItem(e)}set(e,t){Wa(this,Va,"f").setItem(e,t)}delete(e){
return Wa(this,Va,"f").removeItem(e),!0}clear(){Wa(this,Va,"f").clear()}keys(){const e=Wa(this,Va,"f"),t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e.key(r);return n}values(){const e=Wa(this,Va,"f"),t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e.getItem(e.key(r));return n}entries(){const e=Wa(this,Va,"f"),t=e.length,n=Array(t);for(let r=0;r<t;r++){const t=e.key(r);n[r]=[t,e.getItem(t)]}return n}};var Xa,Ka,Ja,Za,Ya=function(e,t,n,r){
if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},$a=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter")
;if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};Xa=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,Za=new WeakMap;const es=class extends Ua{get message(){return Ya(this,Ja,"f")}get persistent(){return Ya(this,Za,"f")}get localStorage(){return Ya(this,Xa,"f")}get sessionStorage(){return Ya(this,Ka,"f")}constructor(e){super(),Xa.set(this,void 0),
Ka.set(this,void 0),Ja.set(this,void 0),Za.set(this,void 0);try{const{localStorage:t,sessionStorage:n}=e;if(null==t||null==n)throw Error("Required storage interfaces not available.");const r="___whitespider___",o=Date.now().toString(24);if(t.setItem(r,o),t.getItem(r)!==o)throw Error("Local storage test failed: value mismatch");if(n.setItem(r,o),n.getItem(r)!==o)throw Error("Session storage test failed: value mismatch");$a(this,Xa,new Qa(t),"f"),$a(this,Ka,new Qa(n),"f"),$a(this,Ja,null,"f"),
$a(this,Za,!0,"f")}catch(e){$a(this,Xa,new qa,"f"),$a(this,Ka,new qa,"f"),$a(this,Ja,e+"","f"),$a(this,Za,!1,"f")}}},ts="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",ns={encode:function(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+=ts[n>>r-5&31],r-=5;for(r>0&&(t+=ts[n<<5-r&31]);t.length%8!=0;)t+="=";return t},decode:function(e){e=e.replace(/=+$/,"");const t=[];let n=0,r=0;for(let o=0;o<e.length;o++){const i=ts.indexOf(e[o].toUpperCase())
;if(i<0)throw Error("Invalid character found in Base32 string.");n=n<<5|i,r+=5,r>=8&&(t.push(n>>r-8&255),r-=8)}return Uint8Array.from(t)}};Object.setPrototypeOf(ns,null);const rs=Object.freeze(ns),os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",is=new Uint8Array(new ArrayBuffer(256),0,256);for(let e=0;e<64;e++)is[os.charCodeAt(e)]=e;const as={encode:function(e){const t=e.byteLength;let n="",r="";for(let r=0;r<t;r+=3){const t=e[r]<<16|e[r+1]<<8|e[r+2]
;n+=os[t>>18&63]+os[t>>12&63]+os[t>>6&63]+os[63&t]}const o=t%3;return 1===o?(r="==",n=n.slice(0,-2)):2===o&&(r="=",n=n.slice(0,-1)),n+r},decode:function(e){const t=.75*e.length-(e.endsWith("==")?2:e.endsWith("=")?1:0),n=new Uint8Array(new ArrayBuffer(t),0,t);let r=0;for(let t=0;t<e.length;t+=4){const o=is[e.charCodeAt(t)]<<18|is[e.charCodeAt(t+1)]<<12|is[e.charCodeAt(t+2)]<<6|is[e.charCodeAt(t+3)];n[r++]=o>>16&255,n[r++]=o>>8&255,n[r++]=255&o}return n}};Object.setPrototypeOf(as,null)
;const ss=Object.freeze(as),cs={encode:function(e){const t=[];for(const n of Array.from(e,(e=>e.codePointAt(0)||0)))n<=127?t.push(n):n<=2047?(t.push(n>>6|192),t.push(63&n|128)):n<=65535?(t.push(n>>12|224),t.push(n>>6&63|128),t.push(63&n|128)):n<=1114111&&(t.push(n>>18|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128));return Uint8Array.from(t)},decode:function(e){let t=0,n="";for(;t<e.byteLength;){const r=e[t];if(128&r)if(192==(224&r)){const o=e[t+1]
;n+=String.fromCharCode((31&r)<<6|63&o),t+=2}else if(224==(240&r)){const o=e[t+1],i=e[t+2];n+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&i),t+=3}else if(240==(248&r)){const o=(7&r)<<18|(63&e[t+1])<<12|(63&e[t+2])<<6|63&e[t+3];n+=o<=1114111?String.fromCodePoint(o):"\ufffd",t+=4}else n+="\ufffd",t+=1;else n+=String.fromCharCode(r),t+=1}return n}};Object.setPrototypeOf(cs,null);const ls=Object.freeze(cs)
;var ds=Uint8Array,hs=Uint16Array,us=Int32Array,ps=new ds([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]),fs=new ds([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]),ms=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gs=function(e,t){for(var n=new hs(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new us(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return{b:n,r:o}},bs=gs(ps,2),ys=bs.b,vs=bs.r;ys[28]=258,vs[258]=28
;for(var ws=gs(fs,0),ks=ws.b,Cs=(ws.r,new hs(32768)),Es=0;Es<32768;++Es){var As=(43690&Es)>>1|(21845&Es)<<1;As=(61680&(As=(52428&As)>>2|(13107&As)<<2))>>4|(3855&As)<<4,Cs[Es]=((65280&As)>>8|(255&As)<<8)>>1}var xs=function(e,t,n){for(var r=e.length,o=0,i=new hs(t);o<r;++o)e[o]&&++i[e[o]-1];var a,s=new hs(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;if(n){a=new hs(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],h=s[e[o]-1]++<<d,u=h|(1<<d)-1;h<=u;++h)a[Cs[h]>>c]=l
}else for(a=new hs(r),o=0;o<r;++o)e[o]&&(a[o]=Cs[s[e[o]-1]++]>>15-e[o]);return a},Ts=new ds(288);for(Es=0;Es<144;++Es)Ts[Es]=8;for(Es=144;Es<256;++Es)Ts[Es]=9;for(Es=256;Es<280;++Es)Ts[Es]=7;for(Es=280;Es<288;++Es)Ts[Es]=8;var Ls=new ds(32);for(Es=0;Es<32;++Es)Ls[Es]=5;var Ss=xs(Ts,9,1),Is=xs(Ls,5,1),js=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},_s=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Os=function(e,t){var n=t/8|0
;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Ms=function(e){return(e+7)/8|0},Ps=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new ds(e.subarray(t,n))},Ds=["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"],Bs=function(e,t,n){var r=Error(t||Ds[e])
;if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Bs),!n)throw r;return r},Ns=function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new ds(0);var a=!n,s=a||2!=t.i,c=t.i;a&&(n=new ds(3*o));var l=function(e){var t=n.length;if(e>t){var r=new ds(Math.max(2*t,e));r.set(n),n=r}},d=t.f||0,h=t.p||0,u=t.b||0,p=t.l,f=t.d,m=t.m,g=t.n,b=8*o;do{if(!p){d=_s(e,h,1);var y=_s(e,h+1,3);if(h+=3,!y){var v=e[(j=Ms(h)+4)-4]|e[j-3]<<8,w=j+v;if(w>o){c&&Bs(0);break}s&&l(u+v),
n.set(e.subarray(j,w),u),t.b=u+=v,t.p=h=8*w,t.f=d;continue}if(1==y)p=Ss,f=Is,m=9,g=5;else if(2==y){var k=_s(e,h,31)+257,C=_s(e,h+10,15)+4,E=k+_s(e,h+5,31)+1;h+=14;for(var A=new ds(E),x=new ds(19),T=0;T<C;++T)x[ms[T]]=_s(e,h+3*T,7);h+=3*C;var L=js(x),S=(1<<L)-1,I=xs(x,L,1);for(T=0;T<E;){var j,_=I[_s(e,h,S)];if(h+=15&_,(j=_>>4)<16)A[T++]=j;else{var O=0,M=0;for(16==j?(M=3+_s(e,h,3),h+=2,O=A[T-1]):17==j?(M=3+_s(e,h,7),h+=3):18==j&&(M=11+_s(e,h,127),h+=7);M--;)A[T++]=O}}
var P=A.subarray(0,k),D=A.subarray(k);m=js(P),g=js(D),p=xs(P,m,1),f=xs(D,g,1)}else Bs(1);if(h>b){c&&Bs(0);break}}s&&l(u+131072);for(var B=(1<<m)-1,N=(1<<g)-1,R=h;;R=h){var F=(O=p[Os(e,h)&B])>>4;if((h+=15&O)>b){c&&Bs(0);break}if(O||Bs(2),F<256)n[u++]=F;else{if(256==F){R=h,p=null;break}var U=F-254;if(F>264){var H=ps[T=F-257];U=_s(e,h,(1<<H)-1)+ys[T],h+=H}var z=f[Os(e,h)&N],q=z>>4;if(z||Bs(3),h+=15&z,D=ks[q],q>3&&(H=fs[q],D+=Os(e,h)&(1<<H)-1,h+=H),h>b){c&&Bs(0);break}s&&l(u+131072);var V=u+U
;if(u<D){var W=i-D,G=Math.min(D,V);for(W+u<0&&Bs(3);u<G;++u)n[u]=r[W+u]}for(;u<V;++u)n[u]=n[u-D]}}t.l=p,t.p=R,t.b=u,t.f=d,p&&(d=1,t.m=m,t.d=f,t.n=g)}while(!d);return u!=n.length&&a?Ps(n,0,u):n.subarray(0,u)},Rs=new ds(0),Fs="undefined"!=typeof TextDecoder&&new TextDecoder;try{Fs.decode(Rs,{stream:!0})}catch(e){}"function"==typeof queueMicrotask&&queueMicrotask
;const Us=Object.freeze(Sa.decode(Rt(ss.decode("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"))))
;let Hs="whitespider";const{p:zs,s:qs,y:Vs,e:Ws}=Us.x;zs&&qs&&Vs&&(Hs=qs+Ws+"2_."+Vs+zs+"/",Hs.length<10&&(Hs=""));const Gs=Hs;let Qs;const Xs=Object.freeze(Object.create(null,{_:{value:({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");Qs=(...e)=>(Reflect.apply(t,null,e),!0)},writable:!1,enumerable:!1,configurable:!1},$:{get:()=>Qs,enumerable:!1,configurable:!1}}))
;(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?(T.textContent=e,T.style.display="block"):T.style.display="none"}function i(e){try{return new URL(e)}catch(e){return null}}function a(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 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 c(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 l(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)}const o=r.naturalWidth,i=r.naturalHeight;if((t=Math.min(t,o))<10||(n=Math.min(n,i))<10)throw Error("Image is too small");const a=new OffscreenCanvas(t,n),s=a.getContext("2d",{alpha:!1});if(null==s)throw Error("Failed to get canvas context");return s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high",s.drawImage(r,0,0,o,i,0,0,t,n),await a.convertToBlob({type:"image/jpeg",quality:100})}catch(e){return null}}function d(e){L.appendChild(h(e)),
S.style.display="block"}function h(e){if(e.startsWith("https://")){const n=t.createElement("iframe");return n.setAttribute("name","Frame"),n.setAttribute("width","1024"),n.setAttribute("height","768"),n.setAttribute("loading","lazy"),n.setAttribute("sandbox","allow-forms allow-popups allow-scripts allow-same-origin allow-pointer-lock"),n.setAttribute("scrolling","no"),n.setAttribute("frameborder","0"),n.setAttribute("credentialless","true"),n.setAttribute("referrerpolicy","no-referrer"),
n.setAttribute("allowfullscreen","true"),n.setAttribute("allowpaymentrequest","true"),
n.setAttribute("src","data:application/xhtml+xml;base64,"+ss.encode(ls.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="${e.replace(/\&/g,"&")}" />\n\t</body>\n</html>`))),
n}{const n=t.createElement("embed");return n.setAttribute("type","text/plain"),n.setAttribute("width","1024"),n.setAttribute("height","768"),n.setAttribute("src",e),n}}function u({id:e,msg:n,uid:r,vip:i,user:a,icon:s,files:c}){const l=t.createElement("div");l.setAttribute("id",e);const d=t.createElement("div");switch(d.className="user",d.textContent=a,i){case 3:d.setAttribute("data-vip","gold");break;case 4:d.setAttribute("data-vip","diamond")}{const e=t.createElement("img");if(e.alt="Avatar",
e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1,"string"!=typeof s){const t=URL.createObjectURL(new Blob([s],{type:"image/jpeg",endings:"native"}));e.addEventListener("load",(()=>URL.revokeObjectURL(t)),{once:!0,passive:!0}),e.src=t}else e.src=s;null!=r&&(e.style.cursor=d.style.cursor="pointer",e.onclick=d.onclick=()=>{Y(r).catch((e=>{o("Failed to open user profile. Message: "+e)}))}),l.appendChild(e)}{const e=t.createElement("div");if(e.appendChild(d),n.length>0){
const r=t.createElement("span");r.textContent=n,e.appendChild(r)}for(const{name:n,type:r,url:o}of c){{const r=t.createElement("a");r.rel="noopener nofollow",r.href=o,r.target="_blank",r.download="",r.textContent=n||"file",e.appendChild(r)}switch(r.split("/",2)[0]){case"image":{const n=t.createElement("img");n.src=o,n.alt="Attachment",n.width=500,n.height=500,n.loading="lazy",n.decoding="async",n.draggable=!1,e.appendChild(n)}break;case"audio":{const n=t.createElement("audio");n.src=o,n.muted=!1,
n.preload="metadata",n.controls=!0,e.appendChild(n)}break;case"video":{const n=t.createElement("video");n.src=o,n.muted=!0,n.width=500,n.height=500,n.autoplay=!0,n.controls=!0,e.appendChild(n)}}}l.appendChild(e)}return l}function p(){ee=null,W||(t.title="NettleWeb"),w.replaceState(void 0,"","/")}function f(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 m(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 g(e,t){return new Promise(((n,r)=>{const o=performance.now().toString(36),i=(e,t,s)=>{e===o&&(z.off("res",i),z.off("disconnect",a),null!=s?r(s):n(t))},a=()=>{z.off("res",i),z.off("disconnect",a),r("Error: Server connection interrupted.")};z.on("res",i),z.on("disconnect",a),z.emit("fetch",o,e,t)}))}var b,y;"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",Xs._(e),e.focus(),e.onkeydown=e=>{if(e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey)switch(e.key){case"h":case"q":e.preventDefault(),e.stopPropagation(),v.replace("https://www.google.com/webhp?igu=1");break;case"b":e.preventDefault(),e.stopPropagation(),A.hasAttribute("style")?A.removeAttribute("style"):A.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(),j.style.display="none"},e.onbeforeinstallprompt=e=>{e.preventDefault(),e.stopPropagation(),j.style.display="block",j.onclick=()=>{e.prompt()}}
;const v=e.location,w=e.history,C=v.pathname,E=t.head,A=t.body,x=Xs.$,T=n("error"),L=n("frame"),S=n("frame-view"),I=n("status"),j=n("install"),_=n("content"),O=n("accn-btn"),M=n("strm-btn"),P=n("comm-btn"),D=n("side-menu");{const{_a:ie,_b:ae,_c:se,_d:ce,_e:le,_f:de,_g:he,_h:ue,_i:pe,_j:fe,_k:me,_l:ge,_m:be,_n:ye,_o:ve,_v:we,_w:ke,_p:Ce,_q:Ee,_r:Ae}=Us;if((()=>{x(ie,ae);const e=new URL(v.href),n=e.hostname,o=e.origin;switch(e.protocol){case"http:":if("localhost"!==n)return e.protocol="https:",
e.pathname="/",e.host=n,v.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.pathname="/",v.replace(e.href),!1}{const e=t[ve](ue);if(null==e||e[fe](pe)!==ge)return!0}for(const e of t[be](ye)){switch(e[fe]("type")||""){case"":case"text/javascript":case"application/javascript":break;default:
return e.remove(),!0}const t=e[fe]("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"]')[fe]("href").slice(0,se)!==de||null==t[ve](Ce)||null==t[ve](Ee)||t[Ae]!==ie.slice(2,11)})()){x(le,me)
;const xe=(new DOMParser).parseFromString(we,"application/xhtml+xml");xe.title=he;const Te=xe.body;Te.innerHTML=ce;{const Le=xe.createElement("button");Le.innerHTML=ke,Le.setAttribute("type","button"),Le.addEventListener("click",(()=>{v.replace(de)}),{passive:!0}),Te.appendChild(Le)}return void t.documentElement.replaceWith(xe.documentElement)}for(const Se of Object.getOwnPropertyNames(Us))2===Se.length&&delete Us[Se]}if(e!==e.top){
if("null"===(null===(b=v.ancestorOrigins)||void 0===b?void 0:b.item(0))){const je=t.createElement("div");return je.style.padding="15px",je.textContent="Click here to continue",je.onclick=()=>{const e=t.createElement("embed");e.type="text/plain",e.width="1280",e.height="720",e.src="https://nettleweb.com/embed.html",m(e)},A.innerHTML="",void A.appendChild(je)}if("https://nettleweb.com"!==v.origin)return void v.replace("https://nettleweb.com/embed.html")}Ie(B({
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 N=A.clientWidth<800,R=new es(e),{localStorage:F}=R;let U,H,z,q,V,W,G,Q,X,K,J,Z,Y,$=[],ee=null
;if(null!==(y=e.isSecureContext)&&void 0!==y?y:"https:"===v.protocol){if(R.persistent)try{const _e=await c("/manifest.json","no-cache");if(null!=_e){const Oe=JSON.parse(_e).version;if(Oe!==F.get("__mf_version")){A.innerHTML="Updating contents...";const Me=e.caches;for(const Pe of await Me.keys())await Me.delete(Pe);return F.set("__mf_version",Oe),void v.reload()}n("version").textContent="v"+Oe}U=F.get("__secrets_")||void 0
}catch(De){}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 Be=e.navigator.serviceWorker;null!=Be&&(await Be.register("/sw.js",{type:"classic",scope:"/",updateViaCache:"none"}),await Be.ready)}catch(Ne){}}try{const Re=await e.fetch("/d/index.json",{mode:"same-origin",cache:"no-cache",method:"GET"});if(!Re.ok)throw Error("Remote returned error status code: "+Re.status)
;G=Sa.decode(Rt(new Uint8Array(await Re.arrayBuffer())))}catch(Fe){return void o("Failed to initialize local game list. Message: "+Fe)}try{const Ue=e.top;null!=Ue&&(V=Ue===e?e:Ue.origin===e.origin?Ue:null)}catch(He){}T.onclick=()=>{T.innerHTML="",T.style.display="none"},n("frame-close").onclick=()=>{L.innerHTML="",S.style.display="none"},n("frame-newtab").onclick=()=>{const e=L.firstElementChild;null!=e&&(L.innerHTML="",S.style.display="none",m(e))},n("content-page").outerHTML=Us.pages;{
const ze=r("link[rel*='icon']"),qe=n("backend-url"),Ve=n("overlay"),We=n("notice"),Ge=n("theme"),Qe=n("tab-cloaking"),Xe=n("stealth-mode");let Ke;function Je(e){if(null!=z&&(z.disconnect(),z.close()),null==q){const{q:e,r:t}=Us;null!=e&&null!=t&&(q=e+t+Gs)}z=k(e||q||"https://service.nettleweb.com/",{path:"/webapi/",secure:!0,upgrade:!0,timeout:1e4,forceNew:!0,multiplex:!1,protocols:[],transports:["polling","websocket"],autoConnect:!0,reconnection:!0,rememberUpgrade:!0,reconnectionDelay:5e3,
closeOnBeforeunload:!0}),I.innerHTML="Connecting...",I.style.color="#808000",z.on("an",(e=>{"string"==typeof e&&e.length>0&&(We.textContent=e,We.style.display="block")})),"string"!=typeof H&&z.once("lr",(e=>{H=e})),z.io.on("open",(()=>{I.innerHTML="\u2713Connected",I.style.color="#008000"})),z.io.on("close",(()=>{I.innerHTML="\u2715Disconnected",I.style.color="#ff0000"})),z.io.on("reconnect_attempt",(()=>{I.innerHTML="Connecting...",I.style.color="#808000"})),z.io.on("reconnect_error",(()=>{
I.innerHTML="\u2715Disconnected",I.style.color="#ff0000"})),z.io.on("reconnect",(()=>{I.innerHTML="\u2713Connected",I.style.color="#008000",null!=U&&z.emit("login",U)}))}function Ze(e){switch(null==Ke&&(Ke=t.createElement("link"),Ke.rel="stylesheet",Ke.type="text/css",Ke.href="index.dark.css",E.appendChild(Ke)),e){case"light":Ke.disabled=!0,Ke.removeAttribute("media");break;case"dark":Ke.disabled=!1,Ke.removeAttribute("media");break;default:Ke.media="all and (prefers-color-scheme: dark)",
Ke.disabled=!1}}function Ye(e){switch(e){case"empty":W=!0,t.title="\u2060",ze.type="image/x-icon",ze.href="/res/empty.ico";break;case"google":W=!0,t.title="Google",ze.type="image/x-icon",ze.href="/res/google.ico";break;case"classroom":W=!0,t.title="Home",ze.type="image/png",ze.href="/res/classroom.png";break;default:W=!1,t.title="NettleWeb",ze.type="image/x-icon",ze.href="/favicon.ico"}}function $e(e){switch(e){case"blank":t.onblur=t.onmouseleave=e=>{
Ve.hasAttribute("data-x")||(e.preventDefault(),e.stopPropagation(),Ve.setAttribute("data-x","1"))},t.onmousedown=t.ontouchstart=e=>{Ve.hasAttribute("data-x")&&(e.preventDefault(),e.stopPropagation(),Ve.removeAttribute("data-x"))},Ve.innerHTML="",Ve.removeAttribute("data-x");break;case"google":t.onblur=t.onmouseleave=e=>{Ve.hasAttribute("data-x")||(e.preventDefault(),e.stopPropagation(),Ve.setAttribute("data-x","1"))},t.onmousedown=t.ontouchstart=e=>{
Ve.hasAttribute("data-x")&&(e.preventDefault(),e.stopPropagation(),Ve.removeAttribute("data-x"))},Ve.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>',Ve.removeAttribute("data-x");break;default:Ve.innerHTML="",Ve.removeAttribute("data-x"),
t.onblur=t.onmouseleave=t.onmousedown=t.ontouchstart=null}}qe.onblur=()=>{const e=i(qe.value.trim());if(null!=e){const t=e.href;F.set("__backendURL_",t),Je(qe.value=t)}else F.delete("__backendURL_"),Je(qe.value="")},Ge.onchange=()=>{const e=Ge.value;Ze(e),F.set("__set_theme",e)},Qe.onchange=()=>{const e=Qe.value;Ye(e),F.set("__set_tabc",e)},Xe.onchange=()=>{const e=Xe.value;$e(e),F.set("__set_sm",e)};{const et=F.get("__backendURL_")||"";Je(et),qe.value=et}{
const tt=F.get("__set_theme")||"default";Ze(tt),Ge.value=tt}{const nt=F.get("__set_tabc")||"disabled";Ye(nt),Qe.value=nt}{const rt=F.get("__set_sm")||"disabled";$e(rt),Xe.value=rt}}{const ot=n("headlines");g(47).then((e=>{if(Array.isArray(e)&&0!==e.length){ot.innerHTML="";for(const n of e){const e=t.createElement("div");{const r=t.createElement("img");r.src=n.urlToImage||"/res/preview.svg",r.alt="Preview",r.width=160,r.height=90,r.loading="lazy",r.decoding="async",r.draggable=!1,e.appendChild(r)
}{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 "+s(n.publishedAt),r.appendChild(e)}e.appendChild(r)}e.onclick=()=>{f(n.url)
},ot.appendChild(e)}}else ot.innerHTML="Sorry, no articles are available at this moment."})).catch((e=>{ot.textContent="Failed to fetch articles. Message: "+e}))}{
const it=n("game-container"),at=n("comments"),st=n("player"),ct=n("n-like"),lt=n("like"),dt=n("game-page"),ht=n("ecode"),ut=n("edit"),pt=n("name"),ft=n("type"),mt=n("tags"),gt=n("date"),bt=n("user"),yt=n("desc"),vt=n("code"),wt=n("lock"),kt=n("comm"),Ct=n("post"),Et=n("e-name"),At=n("e-tags"),xt=n("e-desc"),Tt=n("e-subm"),Lt=n("editor"),St=n("s-games"),It=n("loadmore"),jt=n("controller"),_t=n("gnav-back"),Ot=n("gnav-forward"),Mt=n("gnav-page-no"),Pt=n("gnav-page-count"),Dt=[]
;let Bt="p",Ft="all",Ut="",Ht=0;{const Wt=n("game-search"),Gt=r("#game-search>input");let Qt=0;Wt.onsubmit=e=>{e.preventDefault(),e.stopPropagation(),Ut=Gt.value.trim().toLowerCase(),clearTimeout(Qt),qt()},Gt.onblur=()=>{Ut=Gt.value.trim().toLowerCase(),clearTimeout(Qt),qt()},Gt.oninput=()=>{clearTimeout(Qt),Qt=setTimeout((()=>{Ut=Gt.value.trim().toLowerCase(),qt()}),1e3)}}{const Xt=t.querySelectorAll("#game-category>button");for(const Kt of Xt)Kt.onclick=()=>{
for(const e of Xt)e.removeAttribute("data-current");Ft=Kt.getAttribute("data-match")||"all",Kt.setAttribute("data-current",""),qt()}}{const Jt=n("game-sort");Jt.value=Bt=F.get("__gamesortorder")||"p",Jt.onchange=()=>{F.set("__gamesortorder",Bt=Jt.value),qt()}}function zt(){switch(Ft){case"all":return Ut.length>0?G.filter((e=>e.name.toLowerCase().indexOf(Ut)>=0||e.tags.indexOf(Ut)>=0)):[...G];case"html5":
return G.filter((e=>"html5"===e.type&&(0===Ut.length||e.name.toLowerCase().indexOf(Ut)>=0||e.tags.indexOf(Ut)>=0)));case"flash":return G.filter((e=>"flash"===e.type&&(0===Ut.length||e.name.toLowerCase().indexOf(Ut)>=0||e.tags.indexOf(Ut)>=0)));case"dos":return G.filter((e=>"dos"===e.type&&(0===Ut.length||e.name.toLowerCase().indexOf(Ut)>=0||e.tags.indexOf(Ut)>=0)));default:return G.filter((e=>e.tags.split(",").indexOf(Ft)>=0&&(0===Ut.length||e.name.toLowerCase().indexOf(Ut)>=0)))}}function qt(){
Ht=0,Dt.length=0;const e=zt();if(0===e.length)return _t.disabled=!0,Ot.disabled=!0,void(it.innerHTML="No results found :(");switch(Bt){case"r":a(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)Dt.push(e.slice(t,t+100));Vt()}function Vt(){Mt.min="1",Mt.max=Pt.innerHTML=Dt.length+"",Mt.value=Ht+1+"",it.innerHTML="",_t.disabled=Ht<1,Ht>=Dt.length-1?Ot.disabled=!0:Ot.disabled=!1;for(const e of Dt[Ht]){
const{name:n,prev:r,date:i}=e,a=t.createElement("a");a.href=i>0?"/"+i.toString(36):"#",a.title="Play "+n,a.target="_self",a.className="game",a.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),Z(e).catch((e=>{o("Failed to launch game. Message: "+e)})))},a.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,a.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,a.appendChild(e)}switch(e.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",a.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",a.appendChild(e)}break;case"dos":
{const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",a.appendChild(e)}break;default:a.style.backgroundImage='url("/res/preview.svg")'}it.appendChild(a)}}Z=async({name:e,type:n,tags:r,date:i,path:c,desc:l})=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,dt.setAttribute("data-current",""),
st.appendChild(h("html5"===n?c:"/player.html?name="+encodeURIComponent(e)+"&type="+n+"&url="+encodeURIComponent(c))),ee=()=>{ee=null,wt.title="Enable scroll lock",wt.style.backgroundImage='url("res/lock-open-w.svg")',W||(t.title="NettleWeb"),st.innerHTML="",_.style.overflow="",z.removeAllListeners("comm"),w.replaceState(void 0,"","/")},kt.value="",Et.value="",At.value="",xt.value="",St.innerHTML="",bt.innerHTML="",ct.innerHTML="",at.innerHTML="",Lt.style.display="none",ut.style.display="block",
jt.style.display="block",pt.textContent=e,ft.textContent=n.toUpperCase(),mt.textContent=r.replace(/\,/g,", ")||"None",gt.textContent=s(i),yt.textContent=l||"No information provided by the uploader.";{const n=i.toString(36),r="/"+n;W||(t.title=e+" - NettleWeb"),w.replaceState(void 0,"",r),vt.textContent=n,ht.textContent='<embed type="text/plain" width="1280" height="720" src="https://nettleweb.com'+r+'" />'}ut.innerHTML="Edit Game Info",ut.disabled=!1,ut.onclick=()=>{null!=U?(Et.value=e,
At.value=r,xt.value=l,Lt.style.display="block",ut.style.display="none"):O.click()},Tt.onclick=()=>{if(null==U)return void o("Invalid session. Please refresh this page and try again.");const e=Et.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=xt.value.replace(/\s+/g," ").trim(),n=At.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."):(Tt.disabled=!0,g(23,[U,i,e,n,t]).then((()=>{Tt.disabled=!1,ut.disabled=!0,ut.innerHTML="Requested. Pending review...",Lt.style.display="none",ut.style.display="block"})).catch((e=>{
o("Failed to submit request. Message: "+e),Tt.disabled=!1})))},Ct.onclick=()=>{if(null==U)return void O.click();const e=kt.value.trim();e.length>1e3?o("Comment must not have more than 1000 characters in length."):(Ct.disabled=!0,g(59,[U,i,e]).then((()=>{kt.value="",Ct.disabled=!1,at.prepend})).catch((e=>{o("Failed to post comment. Message: "+e),Ct.disabled=!1})))};for(const e of a(G.filter((e=>!e.path.startsWith("https://")))).slice(3,9)){const{name:n,prev:r,date:a}=e
;if(i!==a&&St.childElementCount<5){const 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(),Z(e).catch((e=>{o("Failed to launch game. Message: "+e)})))},i.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,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")'}St.appendChild(i)}}{const e=await g(56,i);{let t=e.likes;ct.textContent=t.toString(10),
lt.onclick=()=>{lt.disabled=!0,g(57,i).then((()=>{ct.textContent=(++t).toString(10),lt.disabled=!1})).catch((e=>{o("Failed to give a like. Message: "+e)}))}}{const n=t.createElement("img");n.alt="Avatar",n.width=40,n.height=40,n.loading="eager",n.decoding="sync",n.draggable=!1;{const t=URL.createObjectURL(new Blob([e.avatar],{type:"image/jpeg",endings:"native"}));n.src=t,await n.decode(),URL.revokeObjectURL(t)}bt.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")}bt.appendChild(n)}bt.onclick=()=>{Y(e.uid).catch((e=>{o("Failed to open user profile. Message: "+e)}))}}{const e=await g(58,[i]);if(20===e.length){let t=e[e.length-1].id;It.style.display="block",It.onclick=()=>{It.style.display="none",g(58,[i,t]).then((e=>{20===e.length&&(t=e[e.length-1].id,It.style.display="block");for(const t of e)at.appendChild(u(t))})).catch((e=>{
o("Failed to fetch comments. Message: "+e)}))}}for(const t of e)at.appendChild(u(t))}z.on("comm",((e,t)=>{i===e&&at.prepend(u(t))}))},_t.onclick=()=>{Ht--,Vt(),it.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},Ot.onclick=()=>{Ht++,Vt(),it.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},Mt.onblur=()=>{const e=parseInt(Mt.value.trim(),10)||0;Ht+1!==e&&(e<1||e>Dt.length?(Mt.value="1",Ht=0):Ht=e-1,Vt(),it.scrollIntoView({behavior:"instant",inline:"start",
block:"start"}))},Mt.onchange=()=>{Mt.blur()},wt.onclick=()=>{"Disable scroll lock"===wt.title?(wt.style.backgroundImage='url("res/lock-open-w.svg")',wt.title="Enable scroll lock",_.style.overflow=""):(wt.style.backgroundImage='url("res/lock-w.svg")',wt.title="Disable scroll lock",_.style.overflow="hidden",st.scrollIntoView({block:"start",inline:"start",behavior:"instant"}))},kt.onfocus=()=>{null==U&&O.click()},n("hide").onclick=()=>{jt.style.display="none"},n("newtab").onclick=()=>{
const e=st.firstElementChild;null!=e&&(m(e),st.textContent="Notice: This frame has been closed automatically for saving memory. Please refresh this page to re-open the frame.")},n("fullscreen").onclick=()=>{if(t.fullscreenEnabled){const e=st.firstElementChild;null!=e&&e.requestFullscreen({navigationUI:"hide"})}else o("Fullscreen mode is not supported in the current browsing context.")},n("e-canc").onclick=()=>{Lt.style.display="none",ut.style.display="block"},qt()}{
const Zt=n("item-container"),Yt=n("item-category"),$t=n("previews"),en=n("seller"),tn=n("price"),nn=n("stock"),rn=n("item-page"),on=n("iname"),an=n("itags"),sn=n("idate"),cn=n("idesc"),ln=n("icode"),dn=[],hn=n("iadd"),un=n("ibuy"),pn=n("checkout"),fn=n("nav-back"),mn=n("nav-forward"),gn=n("nav-page-no"),bn=n("nav-page-count"),yn=n("purchase-page"),vn=[];let wn="p",kn="all",Cn="",En=0;Q=g(48).then((e=>{
if(null==e||"object"!=typeof e)return void(Zt.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=Yt.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");kn="all",xn(),e.setAttribute("data-current","")},Yt.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");kn=e,xn(),n.setAttribute("data-current","")},Yt.appendChild(n)}}$=n,xn()}else Zt.innerHTML="Sorry, no items are available at this moment."})).catch((e=>{Zt.textContent="Failed to load contents. Message: "+e}));{const Sn=n("item-search"),In=r("#item-search>input");let jn=0;Sn.onsubmit=e=>{e.preventDefault(),e.stopPropagation(),Cn=In.value.trim().toLowerCase(),
clearTimeout(jn),xn()},In.onblur=()=>{Cn=In.value.trim().toLowerCase(),clearTimeout(jn),xn()},In.oninput=()=>{clearTimeout(jn),jn=setTimeout((()=>{Cn=In.value.trim().toLowerCase(),xn()}),1e3)}}{const _n=n("item-sort");_n.value=wn=F.get("_$so")||"n",_n.onchange=()=>{F.set("_$so",wn=_n.value),xn()}}function An(e,t){return e>t?1:e<t?-1:0}function xn(){En=0,vn.length=0
;const e="all"===kn?Cn.length>0?$.filter((e=>e.name.toLowerCase().indexOf(Cn)>=0||e.desc.toLowerCase().indexOf(Cn)>=0||e.cats.indexOf(Cn)>=0)):[...$]:$.filter((e=>e.cats.split(",").indexOf(kn)>=0&&(0===Cn.length||e.name.toLowerCase().indexOf(Cn)>=0||e.desc.toLowerCase().indexOf(Cn)>=0)));if(0===e.length)return fn.disabled=!0,mn.disabled=!0,void(Zt.innerHTML="Sorry, no matching results found :(");switch(wn){case"r":a(e);break;case"d":e.sort(((e,t)=>t.date-e.date));break;default:
e.sort(((e,t)=>An(e.name,t.name)))}for(let t=0;t<e.length;t+=100)vn.push(e.slice(t,t+100));Tn()}function Tn(){gn.min="1",gn.max=bn.innerHTML=vn.length+"",gn.value=En+1+"",Zt.innerHTML="",fn.disabled=En<1,En>=vn.length-1?mn.disabled=!0:mn.disabled=!1;for(const e of vn[En])if(e.stock>=1){const n=t.createElement("div");n.className="item",n.onclick=()=>{J(e).catch((e=>{o("Failed to open the item. Message: "+e)}))},n.style.backgroundImage='url("'+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)}Zt.appendChild(n)}}function Ln(){null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,yn.innerHTML="",yn.setAttribute("data-current","");{const e=t.createElement("h2");e.textContent="Confirm Purchase",yn.appendChild(e)}let e=0;const n=[];for(const o of dn){
const i=t.createElement("div"),a=o.price,s=o.date.toString(36);{const e=t.createElement("img");e.src=o.prev[0],e.alt="Preview",e.width=50,e.height=50,e.loading="lazy",e.decoding="async",e.draggable=!1,i.appendChild(e)}{const e=t.createElement("div");e.textContent=o.name,i.appendChild(e)}{const e=t.createElement("span");e.textContent="$"+a.toFixed(2),i.appendChild(e)}{const c=t.createElement("button");c.type="button",c.title="Remove item",c.onclick=()=>{const t=dn.indexOf(o,0);if(t>=0){
i.remove(),dn.splice(t,1),r.textContent="Total: $"+(e-a).toFixed(2);{const e=n.indexOf(s,0);e>=0&&n.splice(e,1)}0===dn.length&&(P.click(),pn.style.display="none")}},i.appendChild(c)}e+=a,n.push(s),yn.appendChild(i)}const r=t.createElement("span");r.textContent="Total: $"+e.toFixed(2),yn.appendChild(r);const o=t.createElement("button");o.type="button",o.className="pri-button",o.textContent="Continue",o.onclick=()=>{if(null==U)return void O.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">${Us.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=U,e.appendChild(n)}yn.innerHTML="",yn.appendChild(e)},yn.appendChild(o)}J=async e=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,rn.setAttribute("data-current",""),en.innerHTML="",$t.innerHTML="",ln.textContent=e.date.toString(36),
on.textContent=e.name,an.textContent=e.cats.replace(/\,/g,", ")||"None",sn.textContent=s(e.date),cn.textContent=e.desc||"No information provided by the provider.",nn.textContent=e.stock.toString(10),tn.textContent="$"+e.price.toFixed(2);for(const n of e.prev){const e=t.createElement("img");e.src=n,e.alt="Preview",e.width=400,e.height=300,e.loading="lazy",e.decoding="async",e.draggable=!1,$t.appendChild(e)}e.stock>=1?dn.indexOf(e,0)<0?(hn.disabled=!1,un.disabled=!1,hn.onclick=()=>{dn.push(e),
un.onclick=Ln,hn.disabled=!0,pn.style.display="block"},un.onclick=()=>{dn.push(e),Ln(),pn.style.display="block"}):(hn.disabled=!0,un.disabled=!1,un.onclick=Ln):(hn.disabled=!0,un.disabled=!0);{const n=await g(1,e.user||"anonymous");{const e=t.createElement("img");e.alt="Avatar",e.width=40,e.height=40,e.loading="eager",e.decoding="sync",e.draggable=!1;{const t=URL.createObjectURL(new Blob([n.avatar],{type:"image/jpeg",endings:"native"}));e.src=t,await e.decode(),URL.revokeObjectURL(t)}
en.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")}en.appendChild(e)}en.onclick=()=>{Y(n.uid).catch((e=>{o("Failed to open user profile. Message: "+e)}))}}},fn.onclick=()=>{En--,Tn(),Zt.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},mn.onclick=()=>{En++,Tn(),Zt.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},
gn.onblur=()=>{const e=parseInt(gn.value.trim(),10)||0;En+1!==e&&(e<1||e>vn.length?(gn.value="1",En=0):En=e-1,Tn(),Zt.scrollIntoView({behavior:"instant",inline:"start",block:"start"}))},gn.onchange=()=>{gn.blur()},pn.onclick=Ln}{const On=n("addr"),Mn=n("ub-mode");function Pn(t){switch(Mn.value){case"raw-embed":d(t);break;case"prq-embed":!function(t){const n=(V||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":g(41,[t,20]).then((e=>{d(e)})).catch((e=>{o("Failed to create new session. Message: "+e)}));break;default:g(41,[t,10]).then((e=>{d(e)})).catch((e=>{o("Failed to create new session. Message: "+e)}))}}function Dn(e,t){const n=i(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(Bn(e.substring(0,r)))return"https://"+e}else if(Bn(e)&&e.includes("."))return"https://"+e;return t+encodeURIComponent(e)}function Bn(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}Mn.value=F.get("__unbl_mode_")||"raw-embed-v2",Mn.onchange=()=>{F.set("__unbl_mode_",Mn.value)},
On.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=On.value.trim();t.length>0&&Pn(Dn(t,"https://www.google.com/search?igu=1&q="))}},n("ub-google").onclick=()=>{Pn("https://www.google.com/webhp?igu=1")},n("ub-discord").onclick=()=>{Pn("https://discord.com/")},n("ub-facebook").onclick=()=>{Pn("https://www.facebook.com/")},n("ub-instagram").onclick=()=>{Pn("https://www.instagram.com/")}}{
const Nn=r("#yt-search>input"),Rn=r("#yt-search>button"),Fn=n("yt-load-more"),Un=n("yt-results"),Hn=n("yt-server");Hn.value=F.get("__yt_ssvr")||"official";let zn=null;function qn(e){switch(e.protocol){case"http:":case"https:":break;default:return null}switch(e.host){case"piped.video":case"youtube.com":case"youtube-nocookie.com":case"www.youtube.com":case"www.youtube-nocookie.com":const t=e.pathname;return"/watch"===t?e.searchParams.get("v")||null:t.startsWith("/embed/")&&t.substring(7)||null
;case"youtu.be":return e.pathname.substring(1)||null;default:return null}}function Vn(e){const t=Hn.value;if("official"===t)return void d("https://www.youtube-nocookie.com/embed/"+e);const n=new URL("piped"===t?"https://cf.piped.video/watch":"https://piped-material.xn--17b.net/watch");{const t=n.searchParams;t.set("v",e),t.set("hl","en"),t.set("theme","light"),t.set("region","us"),t.set("quality","1080"),t.set("autoplay","false"),t.set("watchHistory","false"),t.set("sponsorblock","false"),
t.set("playerAutoPlay","true")}d(n.href)}async function Wn(){o(null),Rn.disabled=!0,Nn.disabled=!0,Fn.style.display="none";const e=await g(40,[Nn.value.trim(),zn]);if(null==e||"object"!=typeof e)return void o("Error: API server returned invalid response.");const n=e.items;if(!Array.isArray(n)||0===n.length)return void o("No results match your search.");for(const e of n){const n=t.createElement("div");{const r=t.createElement("img");r.src=e.thumbnail,r.alt="Preview",r.width=160,r.height=90,
r.loading="lazy",r.decoding="async",r.draggable=!1,n.appendChild(r)}{const r=t.createElement("div");{const n=t.createElement("div");n.className="title",n.textContent=e.title,r.appendChild(n)}{const n=t.createElement("div");n.className="desc",n.textContent=e.shortDescription,r.appendChild(n)}{const n=t.createElement("div");n.className="time",n.textContent=e.uploadedDate+"; Views: "+e.views,r.appendChild(n)}n.appendChild(r)}n.onclick=t=>{t.preventDefault(),t.stopPropagation(),Vn(e.url.slice(9))},
Un.appendChild(n)}const r=e.nextpage;null!=r&&(Fn.style.display="block",Fn.onclick=()=>{zn=r,Wn().then((()=>{Rn.disabled=!1,Nn.disabled=!1}))})}n("yt-search").onsubmit=e=>{e.preventDefault(),e.stopPropagation(),zn=null,Un.innerHTML="";const t=i(Nn.value);if(null==t)return void Wn().then((()=>{Rn.disabled=!1,Nn.disabled=!1}));o(null),Fn.style.display="none";const n=qn(t);null!=n?Vn(n):o("Error: Failed to parse YouTube video ID from the provided URL.")},Hn.onchange=()=>{F.set("__yt_ssvr",Hn.value)
}}{const Gn=n("emulator"),Qn=n("core"),Xn=n("bios"),Kn=n("game-rom");Gn.onchange=()=>{switch(Gn.value){case"flash":Qn.disabled=!0,Xn.disabled=!0,Kn.accept=".swf";break;case"dos":Qn.disabled=!0,Xn.disabled=!0,Kn.accept=".jsdos, .zip";break;default:Gn.value="emu",Qn.disabled=!1,Xn.disabled=!1,Kn.accept="*/*"}},n("startemu").onclick=()=>{var e,t;const n=null===(e=Kn.files)||void 0===e?void 0:e.item(0);if(null==n)return void o("Please choose a valid game ROM file.")
;const r=Gn.value,i=new URLSearchParams("");if(i.set("name",n.name),i.set("type",r),i.set("url",URL.createObjectURL(n)),"emu"===r){i.set("core",Qn.value);const e=null===(t=Xn.files)||void 0===t?void 0:t.item(0);null!=e&&i.set("bios",URL.createObjectURL(e))}d("/player.html?"+i.toString())}}{const Jn=n("upload-message"),Zn=n("game-name"),Yn=n("game-type"),$n=n("game-file"),er=n("game-tags"),tr=n("game-desc"),nr=n("upload");Yn.onchange=()=>{switch(Yn.value){case"html5":$n.accept=".zip";break
;case"flash":$n.accept=".swf";break;case"dos":$n.accept=".jsdos";break;default:$n.accept="*/*"}},Jn.onclick=()=>{Jn.innerHTML="",Jn.style.display="none"},nr.onclick=async()=>{var e;const t=Zn.value.replace(/\s+/g," ").trim();if(0===t.length)return void o("Game name must not be empty.");if(t.length>256)return void o("Game name must be less than 256 characters in length.");const n=null===(e=$n.files)||void 0===e?void 0:e.item(0);if(null==n)return void o("Please choose a valid game file.")
;if(0===n.size)return void o("Uploading empty game files is not allowed.");if(n.size>25e6)return void o("Uploading files larger than 25MB is not supported currently.");if(null==U)return void o("Invalid session. Please refresh this page and try again.");const r=tr.value.replace(/\s+/g," ").trim(),i=er.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(r.length>5e3)o("Game description text must be less than 5000 characters in length.");else{nr.disabled=!0,Jn.innerHTML="Processing...",Jn.style.color="#808080",Jn.style.display="block";try{await g(13,[U,t,Yn.value,i,r,await n.arrayBuffer()]),Jn.innerHTML="\u2713Success!",Jn.style.color="#008000",Jn.style.display="block"}catch(e){Jn.innerHTML="\u2715Error",Jn.style.color="#ff0000",Jn.style.display="block",
o("Failed to upload the game. Message: "+e)}Zn.value="",$n.value="",er.value="",tr.value="",nr.disabled=!1}}}{const rr=n("item-id"),or=n("item-add"),ir=n("item-name"),ar=n("item-tags"),sr=n("item-prev"),cr=n("item-del1"),lr=n("item-del2"),dr=n("item-desc"),hr=n("item-stock"),ur=n("item-price"),pr=n("s-orders"),fr=n("store-manager-page");or.onclick=async()=>{const e=ir.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=ar.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=dr.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(cr.value)||0,i=parseFloat(lr.value)||0;if(r<0||r>99.99||i<0||i>99.99)return void o("Item delivery price must be between the range: 0-99.99");const a=parseInt(hr.value,10)||0;if(a<1||a>99999)return void o("Item stock must be between the range: 1-99999");const s=parseFloat(ur.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(sr.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{or.disabled=!0;for(let e=0;e<c.length;e++){const t=await l(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 g(49,[U,rr.value.trim(),e,t,n,c,a,s,r,i])}catch(e){o("Failed to add this item. Message: "+e)}rr.value="",
ir.value="",ar.value="",sr.value="",dr.value="",hr.value="",ur.value="",or.disabled=!1}},n("sm").onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");_.scrollTo({top:0,left:0,behavior:"instant"}),pr.innerHTML="Loading...",D.checked=!1,fr.setAttribute("data-current",""),g(51,U).then((e=>{if(!Array.isArray(e)||e.length<1)return void(pr.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=s(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 $)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=()=>{g(53,[U,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=()=>{g(52,[U,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)}pr.innerHTML="<div>* including additional delivery fee</div>",pr.prepend(n)})).catch((e=>{o("Failed to fetch order list. Message: "+e)}))}}{const mr=n("payu");mr.onclick=()=>{const e=ne.value.trim();e.length>1e3?o("Payment description must have more than 1000 characters in length."):(mr.disabled=!0,g(54,[U,e,te.value]).then((()=>{mr.disabled=!1})).catch((e=>{o("Failed to update payment description. Message: "+e)})))}}{
const gr=n("picker"),br=n("global"),yr=n("friends"),vr=n("chatgpt"),wr=n("msglist"),kr=n("history"),Cr=n("channels"),Er=n("ufile"),Ar=n("messages"),xr=Ar.children,Tr=n("channel-name"),Lr=n("sendmsg"),Sr=n("chat-btn"),Ir=n("community-page"),jr=n("discord");{const _r=n("chat"),Or=n("sidemenu"),Mr=n("toggle");Mr.onclick=()=>{"Close"===Mr.title?(Mr.title="Menu",_r.style.width="100%",Or.style.display="none"):(Mr.title="Close",_r.removeAttribute("style"),Or.removeAttribute("style"))},
N&&(Mr.title="Menu",_r.style.width="100%",Or.style.display="none")}{const Pr=Cr.children,Dr=wr.children;let Br,Nr,Rr,Fr,Ur,Hr=!1;function zr(e,n,r){const i=t.createElement("div");i.setAttribute("id",e),i.setAttribute("data-mode",r);{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=()=>{Hr||(Hr=!0,
Ar.innerHTML="<div>Loading...</div>",g(28,[U,Fr=e]).then((e=>{var t;Ur=null===(t=e[e.length-1])||void 0===t?void 0:t.id,Ar.innerHTML="";for(const t of e)Ar.prepend(u(t));Ar.scrollTo({behavior:"instant",left:0,top:Ar.scrollHeight});for(const e of Dr)e.removeAttribute("data-current");i.setAttribute("data-current",""),Tr.textContent=n,Hr=!1})).catch((e=>{o("Failed to initialize channel. Message: "+e),Hr=!1})))},i}function qr(e,n,r,i,a,s){const c=t.createElement("div");c.setAttribute("id",e),
c.setAttribute("data-user",n),c.setAttribute("data-mode",a);{const e=t.createElement("img");e.src="/res/group.svg",e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1;{const t=URL.createObjectURL(new Blob([s],{type:"image/jpeg",endings:"native"}));e.addEventListener("load",(()=>URL.revokeObjectURL(t)),{once:!0,passive:!0}),e.src=t}c.appendChild(e)}{const e=t.createElement("div");switch(e.className="user",e.textContent=i,r){case 3:
e.setAttribute("data-vip","gold");break;case 4:e.setAttribute("data-vip","diamond")}c.appendChild(e)}return c.onclick=()=>{Hr||(Hr=!0,Ar.innerHTML="<div>Loading...</div>",g(28,[U,Fr=e]).then((e=>{var t;Ur=null===(t=e[e.length-1])||void 0===t?void 0:t.id,Ar.innerHTML="";for(const t of e)Ar.prepend(u(t));Ar.scrollTo({behavior:"instant",left:0,top:Ar.scrollHeight});for(const e of Dr)e.removeAttribute("data-current");c.setAttribute("data-current",""),Tr.textContent=i,Hr=!1})).catch((e=>{
o("Failed to initialize channel. Message: "+e),Hr=!1})))},c}function Vr(e,t){if(Fr===e){const e=Ar.scrollHeight-Ar.clientHeight;Ar.appendChild(u(t)),e===Ar.scrollTop&&Ar.scrollTo({behavior:"instant",left:0,top:Ar.scrollHeight})}}function Wr(e,t){if(Fr===e)for(const e of xr)if(e.getAttribute("id")===t){e.remove();break}}function Gr(e,t,n){if(Fr===e)for(const e of xr)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 Qr(){if(0===Pr.length){Er.disabled=!0,Lr.disabled=!0;try{const e=await g(22);for(const n of e)if("#"===n[0]){const e=t.createElement("span");e.textContent=n.slice(1),Cr.appendChild(e)}else{const[e,r,i]=n.split(":",3),a=t.createElement("div");a.textContent=e,a.onclick=()=>{Hr||(Hr=!0,Ar.innerHTML="<div>Loading...</div>",g(7,[Fr=r]).then((t=>{var n;Ur=null===(n=t[t.length-1])||void 0===n?void 0:n.id,Ar.innerHTML="";for(const e of t)Ar.prepend(u(e));Ar.scrollTo({behavior:"instant",
left:0,top:Ar.scrollHeight});for(const e of Pr)e.removeAttribute("data-current");Er.style.display="f"===i?"block":"none",a.setAttribute("data-current",""),Tr.textContent=e,Hr=!1})).catch((e=>{o("Failed to initialize channel. Message: "+e),Hr=!1})))},Cr.appendChild(a)}}catch(e){return void o("Failed to load channel list. Message: "+e)}}Ar.innerHTML="",Tr.innerHTML="Global",jr.style.display="block",z.removeAllListeners("msg"),z.removeAllListeners("msgdel"),z.removeAllListeners("msgupd"),
z.on("msg",Vr),z.on("msgdel",Wr),z.on("msgupd",Gr);{const e=Cr.querySelector("div");null!=e?(Ar.onscrollend=()=>{Hr||0!==Ar.scrollTop||(Hr=!0,g(7,[Fr,Ur]).then((e=>{if(e.length>0){const t=Ar.scrollHeight;Ur=e[e.length-1].id;for(const t of e)Ar.prepend(u(t));Ar.scrollTo({behavior:"instant",left:0,top:Ar.scrollHeight-t})}Hr=!1})).catch((e=>{o("Failed to fetch messages. Reason: "+e),Hr=!1})))},Lr.onkeydown=e=>{if("Enter"===e.key){if(e.preventDefault(),e.stopPropagation(),
null==U)return void O.click();const t=Lr.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.");Lr.value="",Lr.disabled=!0,g(8,[U,Fr,t]).then((()=>{Lr.disabled=!1})).catch((e=>{o("Failed to post text message. Message: "+e),Lr.disabled=!1}))}},e.click()):(Cr.innerHTML="No public channels are available at this moment.",Ar.onscrollend=null,Lr.onkeydown=null)}Lr.onfocus=e=>{e.preventDefault(),
e.stopPropagation(),null==U&&O.click()},yr.removeAttribute("data-current"),vr.removeAttribute("data-current"),wr.removeAttribute("style"),kr.removeAttribute("style"),br.setAttribute("data-current",""),Cr.style.display="block",Er.disabled=!1,Lr.disabled=!1}async function Xr(){if(null!=U&&null!=H){Fr=void 0,Er.disabled=!0,Lr.disabled=!0,wr.innerHTML="",Ar.innerHTML="",Tr.innerHTML="Messages",jr.style.display="none";try{for(const{id:e,name:t,mode:n,users:r}of await g(27,U))if(1===r.length){
const{id:t,uid:o,vip:i,avatar:a}=await g(1,r[0]);wr.appendChild(qr(e,o,i,t,n,a))}else wr.appendChild(zr(e,t,n))}catch(e){return void o("Failed to load friends list. Message: "+e)}z.removeAllListeners("msg"),z.removeAllListeners("msgdel"),z.removeAllListeners("msgupd"),z.on("msg",Vr),z.on("msgdel",Wr),z.on("msgupd",Gr),Ar.onscrollend=()=>{Hr||null==Fr||0!==Ar.scrollTop||(Hr=!0,g(28,[U,Fr,Ur]).then((e=>{if(e.length>0){const t=Ar.scrollHeight;Ur=e[e.length-1].id;for(const t of e)Ar.prepend(u(t))
;Ar.scrollTo({behavior:"instant",left:0,top:Ar.scrollHeight-t})}Hr=!1})).catch((e=>{o("Failed to fetch messages. Reason: "+e),Hr=!1})))},Lr.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=Lr.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.");null!=Fr&&(Lr.value="",Lr.disabled=!0,(async()=>{if(Fr.startsWith("tmp$")){const e=Fr.slice(4);try{
Fr=await g(30,[U,[H,e],"dm_channel",0]);const t=qr(Fr,e,Rr,Nr,"",Br);t.setAttribute("data-current",""),wr.appendChild(t)}catch(e){return void o("Failed to create new channel. Message: "+e)}Ar.innerHTML=""}try{await g(8,[U,Fr,t])}catch(e){o("Failed to post text message. Reason: "+e)}})().then((()=>{Lr.disabled=!1})))}},br.removeAttribute("data-current"),vr.removeAttribute("data-current"),kr.removeAttribute("style"),Cr.removeAttribute("style"),yr.setAttribute("data-current","1"),
wr.style.display="block",Er.style.display="none",Er.disabled=!0,Lr.disabled=!1}else O.click()}jr.onclick=()=>{f("https://discord.gg/djdH3kVd4v")},Er.onclick=()=>{const e=t.createElement("input");e.type="file",e.accept="*/*",e.multiple=!0,e.onchange=async()=>{const t=e.files;if(null!=t&&t.length>0){if(t.length>10)return void o("Uploading more than 10 files at once is not supported.");Er.disabled=!0,Lr.disabled=!0;try{const e=[];for(const n of t){
if(n.size<1)throw Error("Empty files are not allowed.");if(n.size>1e7)throw Error("Files larger than 10MB are not supported.");e.push({name:n.name,attachment:await n.arrayBuffer()})}await g(12,[U,Fr,e])}catch(e){o("Failed to upload file. Message: "+e)}Er.disabled=!1,Lr.disabled=!1}},e.click()},yr.onclick=e=>{e.preventDefault(),e.stopPropagation(),Xr()},br.onclick=e=>{e.preventDefault(),e.stopPropagation(),Qr()},n("goto-chat").onclick=Sr.onclick=()=>{null!=ee&&ee()
;for(const e of oe)e.removeAttribute("data-current");Qr().then((()=>{D.checked=!1,Ir.setAttribute("data-current",""),Sr.setAttribute("data-current",""),_.scrollTo({top:0,left:0,behavior:"instant"})}))},K=async e=>{await Xr(),null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");D.checked=!1,Ir.setAttribute("data-current",""),Sr.setAttribute("data-current",""),_.scrollTo({top:0,left:0,behavior:"instant"});for(const t of Dr)if(t.getAttribute("data-user")===e)return void t.click()
;const{id:t,vip:n,avatar:r}=await g(1,e);Fr="tmp$"+e,Rr=n,Br=r,Tr.innerHTML=Nr=t,Ar.innerHTML="<div>Send a message to start a new chat with "+t+".</div>";for(const e of Dr)e.removeAttribute("data-current")}}{const Kr=kr.children;let Jr=null;const Zr=JSON.parse(F.get("__chats")||"[]");function Yr({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 Ar.appendChild(r),r}function $r(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 Kr)e.removeAttribute("data-current");r.setAttribute("data-current","1"),Ar.innerHTML="",Tr.textContent=n;for(const t of Jr=e.msgs)Yr(t);Ar.scrollTo({behavior:"instant",left:0,
top:Ar.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=Zr.indexOf(e,0);n>=0&&(Jr=null,r.remove(),Zr.splice(n,1),Ar.innerHTML="",F.set("__chats",JSON.stringify(Zr,void 0,0)))},r.appendChild(n)}kr.appendChild(r)}function eo(){Lr.disabled=!1,z.removeAllListeners("gptres"),z.removeAllListeners("gptend"),z.removeAllListeners("gpterr")}
n("newchat").onclick=()=>{for(const e of Kr)e.removeAttribute("data-current");Jr=null,Ar.innerHTML="",Tr.innerHTML="New chat"},vr.onclick=()=>{for(const e of Kr)e.removeAttribute("data-current");if(Jr=null,Ar.innerHTML="",Tr.innerHTML="New chat",jr.style.display="none",z.removeAllListeners("msg"),z.removeAllListeners("msgdel"),z.removeAllListeners("msgupd"),Kr.length<2)for(const e of Zr)$r(e);Ar.onscrollend=null,Lr.onfocus=null,Lr.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),
e.stopPropagation();const t=Lr.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(Lr.value="",Lr.disabled=!0,null==Jr){const e={title:t.slice(0,100),msgs:Jr=[]};$r(e),Zr.push(e)}const n={role:"u",text:t};Yr(n),Jr.push(n);const r={role:"a",text:"Processing..."},i=Yr(r),a=i.lastElementChild;z.on("gptres",(e=>{a.textContent=r.text=e,a.scrollIntoView({block:"end",inline:"end",behavior:"instant"})
})),z.on("gptend",(()=>{eo(),Jr.push(r),F.set("__chats",JSON.stringify(Zr,void 0,0))})),z.on("gpterr",(e=>{eo(),Jr.pop(),i.remove(),o("Failed to process the request. Message: "+e)})),z.emit("gptreq",Jr)}},br.removeAttribute("data-current"),yr.removeAttribute("data-current"),wr.removeAttribute("style"),Cr.removeAttribute("style"),vr.setAttribute("data-current","1"),kr.style.display="block",Er.style.display="none",Er.disabled=!0,Lr.disabled=!1}}n("emoji").onclick=()=>{
if("block"!==gr.style.display){if(null==gr.firstElementChild){const e=new fa({locale:"POSIX",emojiVersion:1e3});e.addEventListener("emoji-click",(e=>{e.preventDefault(),e.stopPropagation();const t=e.detail.unicode;null!=t&&Lr.setRangeText(t,Lr.selectionStart||0,Lr.selectionEnd||0,"end")})),gr.appendChild(e)}gr.style.display="block"}else gr.style.display="none"}}const te=n("paycc"),ne=n("paydesc"),re=n("chat-profile"),oe=t.querySelectorAll("#nav-bar>button, #content>div");{
const to=n("ff"),no=n("accountinfo-page"),ro=n("ac-friends"),oo=n("ac-orders");function io(e,n){const r=n.uid;if("string"!=typeof r)throw Error("Internal Error");const i=t.createElement("img");i.alt="Avatar",i.width=48,i.height=48,i.loading="lazy",i.decoding="async",i.draggable=!1;{const e=URL.createObjectURL(new Blob([n.avatar],{type:"image/jpeg",endings:"native"}));i.addEventListener("load",(()=>URL.revokeObjectURL(e)),{once:!0,passive:!0}),i.src=e}e.appendChild(i);{
const a=t.createElement("div");switch(a.className="user",a.textContent=n.id,n.vip){case 3:a.setAttribute("data-vip","gold");break;case 4:a.setAttribute("data-vip","diamond")}i.onclick=a.onclick=()=>{Y(r).catch((e=>{o("Failed to open user profile. Message: "+e)}))},e.appendChild(a)}switch(n.state){case 1:{const n=t.createElement("button");n.type="button",n.title="Cancel request",n.className="cross",n.onclick=()=>{g(25,[U,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 i=t.createElement("button");i.type="button",i.title="Accept",i.className="tick",i.onclick=()=>{g(24,[U,r]).then((()=>{n.state=0,e.innerHTML="",io(e,n)})).catch((e=>{o("Failed to accept friend request. Message: "+e)}))},e.appendChild(i)}{const n=t.createElement("button");n.type="button",n.title="Reject",n.className="cross",
n.onclick=()=>{g(25,[U,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=()=>{g(25,[U,r]).then((()=>{e.remove()})).catch((e=>{o("Failed to remove friend. Message: "+e)}))},e.appendChild(n)}{const n=t.createElement("button")
;n.type="button",n.title="Message",n.className="message",n.onclick=()=>{K(r).catch((e=>{o("Failed to open chat channel. Message: "+e)}))},e.appendChild(n)}}}X=()=>{g(50,U).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=s(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 $)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=()=>{g(52,[U,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)}
oo.innerHTML="<div>* including additional delivery fee</div>",oo.prepend(n)}else oo.style.overflow="unset",oo.innerHTML="You don't have any orders yet."})).catch((e=>{oo.innerHTML="Failed to fetch the list. Message: "+e})),g(26,[U,0]).then((e=>{if(ro.innerHTML="",Array.isArray(e)&&e.length>0){let n=0;for(const n of e){const e=t.createElement("div");io(e,n),ro.appendChild(e)}ro.onscrollend=()=>{ro.scrollTop>=ro.scrollHeight-ro.clientHeight&&n>=0&&g(26,[U,n+=10]).then((e=>{e.length<10&&(n=-1)
;for(const n of e){const e=t.createElement("div");io(e,n),ro.appendChild(e)}}))}}})).catch((e=>{o("Failed to fetch the list. Message: "+e)}))},n("chat-login").onclick=re.onclick=O.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");oo.innerHTML=ro.innerHTML="Loading...",_.scrollTo({top:0,left:0,behavior:"instant"}),O.setAttribute("data-current","1"),no.setAttribute("data-current","1"),D.checked=!1,"string"==typeof U&&X()},to.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 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 r=n.value.trim().toLowerCase();r.length<4||r.length>20||!/^[\-a-z0-9]+$/.test(r)?o("Please provide a valid username."):g(1,"@"+r).then((n=>{g(24,[U,n.uid]).then((()=>{const r=t.createElement("div");n.state=1,io(r,n),ro.appendChild(r),e.replaceWith(to)})).catch((e=>{o("Failed to send friend request. Message: "+e)}))})).catch((e=>{o("Failed to retrieve user information. Message: "+e)}))},i.onclick=()=>{e.replaceWith(to)},to.replaceWith(e)}}{
const ao=n("home-btn"),so=n("game-btn"),co=n("unbl-btn"),lo=n("apps-btn"),ho=n("settings"),uo=n("home-page"),po=n("games-page"),fo=n("video-page"),mo=n("store-page"),go=n("services-page"),bo=n("site-blocked-page"),yo=n("uploadgames-page"),vo=n("profile-page"),wo=n("settings-page");n("logo").onclick=ao.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");D.checked=!1,uo.setAttribute("data-current",""),ao.setAttribute("data-current",""),_.scrollTo({top:0,left:0,
behavior:"instant"})},n("goto-games").onclick=so.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");W||(t.title="Games - NettleWeb"),_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,ee=p,w.replaceState(void 0,"","/games"),so.setAttribute("data-current",""),po.setAttribute("data-current","")},n("goto-video").onclick=M.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");W||(t.title="Video - NettleWeb"),_.scrollTo({top:0,left:0,
behavior:"instant"}),D.checked=!1,ee=p,w.replaceState(void 0,"","/video"),M.setAttribute("data-current",""),fo.setAttribute("data-current","")},P.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");W||(t.title="Store - NettleWeb"),_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,ee=p,w.replaceState(void 0,"","/store"),P.setAttribute("data-current",""),mo.setAttribute("data-current","")},n("goto-apps").onclick=lo.onclick=()=>{null!=ee&&ee()
;for(const e of oe)e.removeAttribute("data-current");W||(t.title="Apps - NettleWeb"),_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,ee=p,w.replaceState(void 0,"","/apps"),lo.setAttribute("data-current",""),go.setAttribute("data-current","")},co.onclick=()=>{null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,co.setAttribute("data-current",""),bo.setAttribute("data-current","")},n("ug").onclick=()=>{
null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");D.checked=!1,yo.setAttribute("data-current",""),_.scrollTo({top:0,left:0,behavior:"instant"})},ho.onclick=()=>{const e=wo.hasAttribute("data-current");null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");e?(ao.setAttribute("data-current","1"),uo.setAttribute("data-current","1")):wo.setAttribute("data-current","1"),D.checked=!1,_.scrollTo({top:0,left:0,behavior:"instant"})};{
const ko=n("id"),Co=n("bio"),Eo=n("af"),Ao=n("dm"),xo=n("pf-games"),To=n("pf-items"),Lo=n("avatar");Y=async e=>{const n=(e=await g(1,e)).uid;if("string"!=typeof n||n.length<4)throw Error("Failed to parser server response.");null!=ee&&ee();for(const e of oe)e.removeAttribute("data-current");switch(_.scrollTo({top:0,left:0,behavior:"instant"}),D.checked=!1,vo.setAttribute("data-current","1"),ee=p,xo.innerHTML="",To.innerHTML="",xo.removeAttribute("style"),To.removeAttribute("style"),
Co.textContent=e.bio||"NettleWeb User",w.replaceState(void 0,"","/@"+(ko.textContent=e.id)),e.vip){case 3:ko.setAttribute("data-vip","gold");break;case 4:ko.setAttribute("data-vip","diamond");break;default:ko.removeAttribute("data-vip")}Eo.onclick=()=>{null!=U?g(24,[U,n]).then((()=>{Eo.disabled=!0,Eo.textContent="Requested"})).catch((e=>{o("Failed to send friend request. Message: "+e)})):O.click()},Ao.onclick=()=>{null!=U?K(n).catch((e=>{o("Failed to open chat channel. Message: "+e)})):O.click()
};for(const e of G)if(e.user===n){const{name:n,prev:r,date:i}=e,a=t.createElement("a");a.href=i>0?"/"+i.toString(36):"#",a.title="Play "+n,a.target="_self",a.className="game",a.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),Z(e).catch((e=>{o("Failed to launch game. Message: "+e)})))},a.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,
a.appendChild(e)}switch(e.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",a.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",a.appendChild(e)}break;case"dos":{const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",a.appendChild(e)}break;default:a.style.backgroundImage='url("/res/preview.svg")'}xo.appendChild(a)}
null==xo.firstElementChild&&(xo.style.overflow="unset",xo.innerHTML="This user has not uploaded any games yet.");for(const e of $)if(e.user===n){const n=t.createElement("div");n.className="item",n.onclick=()=>{J(e).catch((e=>{o("Failed to open the item. Message: "+e)}))},n.style.backgroundImage='url("'+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)
}To.appendChild(n)}null==To.firstElementChild&&(To.style.overflow="unset",To.innerHTML="This user does not have a store yet.");{const t=URL.createObjectURL(new Blob([e.avatar],{type:"image/jpeg",endings:"native"}));Lo.src=t,await Lo.decode(),URL.revokeObjectURL(t)}}}("/"===C||C.indexOf(".",0)>=0||await(async()=>{switch(C){case"/g":case"/g/":case"/game":case"/game/":case"/games":case"/games/":return so.click(),!1;case"/v":case"/v/":case"/video":case"/video/":case"/videos":case"/videos/":
return M.click(),!1;case"/s":case"/s/":case"/shop":case"/shop/":case"/store":case"/store/":return P.click(),!1;case"/a":case"/a/":case"/apps":case"/apps/":return lo.click(),!1;default:if("/@"===C.slice(0,2)){const e=C.slice(1);if(e.length<=20)try{return await Y(e),!1}catch(e){o("Failed to open user profile. Message: "+e)}return!0}if("/u/"===C.slice(0,3)){const e=C.slice(3);if(e.length<50)try{return await Y(e),!1}catch(e){o("Failed to open user profile. Message: "+e)}return!0}
if(C.length>4&&C.length<20){const e=parseInt(C.slice(1),36);if(Number.isSafeInteger(e)&&e>0)for(const t of G)if(t.date===e)return await Z(t),!1}return o("Error: Page does not exist: "+C),!0}})())&&w.replaceState(void 0,"","/"),n("loading").remove(),_.style.display="block"}{const So=t.createElement.bind(t);Object.defineProperty(t,"createElement",{value:(e,t)=>{const n=So(e,t);return"iframe"===n.tagName.toLowerCase()&&n.setAttribute("credentialless","true"),n},writable:!1,enumerable:!1,
configurable:!1})}{const Io=t.createElementNS.bind(t);Object.defineProperty(t,"createElementNS",{value:(e,t,n)=>{const r=Io(e,t,n);return"iframe"===r.tagName.toLowerCase()&&r.setAttribute("credentialless","true"),r},writable:!1,enumerable:!1,configurable:!1})}{const jo=await c("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7505521340110301");if(null!=jo&&jo.length>0)try{
Function("arguments","globalThis","window","frames","self","document",jo).call(e,void 0,e,e,e,e,t)}catch(Oo){}else o("You are using an ad blocker. Please disable it to support this website's development.");const _o=window.adsbygoogle||(window.adsbygoogle=[]);for(const Mo of t.querySelectorAll("ins.adsbygoogle")){Mo.setAttribute("data-ad-client","ca-pub-7505521340110301"),Mo.setAttribute("data-ad-format","auto"),Mo.setAttribute("data-full-width-responsive","true");try{_o.push(1)}catch(Po){}}}{
async function Do(){await Q,X(),te.innerHTML=Us.cc,O.innerHTML="My Account",n("ac-prof").style.display="block",n("chat-login").remove(),n("login-dialog").remove();const e=n("ac-bio"),r=n("ac-name"),i=n("ac-email"),a=n("ac-un"),s=n("ac-edit"),c=n("ac-link"),d=n("ac-bio-edit"),h=n("ac-name-edit"),u=n("ac-email-edit"),p=n("cp"),f=n("rs"),m=n("tf");"1"===F.get("__?2fa")&&(m.setAttribute("data-enabled",""),m.textContent="Disable Two-Factor")
;const b=n("ch-avatar"),y=b.firstElementChild,w=t.createElement("img");w.alt="Avatar",w.width=40,w.height=40,w.loading="eager",w.decoding="sync",w.draggable=!1,re.appendChild(w);const k=t.createElement("div");k.className="user",re.appendChild(k),re.style.display="block";const C=await g(2,U),E=C.id,A=C.uid;if("string"!=typeof E||E.length<4||"string"!=typeof A||A.length<2)o("Error: Server response parse error.");else{switch(e.textContent=C.bio||"NettleWeb User",r.textContent=C.name||"Not set",
i.textContent=C.email||"Not set",a.textContent=E,k.textContent=E,n("ac-uid").textContent=A,te.value=C.paycc||"US",ne.value=C.paydesc||"",C.vip){case 3:n("ac-membership").textContent="Gold \u{1f451}",a.setAttribute("data-vip","gold"),k.setAttribute("data-vip","gold");break;case 4:n("ac-membership").textContent="Diamond \u{1f48e}",a.setAttribute("data-vip","diamond"),k.setAttribute("data-vip","diamond");break;default:n("ac-membership").textContent="None"}{
const e=URL.createObjectURL(new Blob([C.avatar],{type:"image/jpeg",endings:"native"}));y.src=w.src=e,await y.decode(),await w.decode(),URL.revokeObjectURL(e)}{const e=n("ac-games");for(const n of G)if(n.user===A){const{name:r,prev:i,date:a}=n,s=t.createElement("a");s.href=a>0?"/"+a.toString(36):"#",s.title="Play "+r,s.target="_self",s.className="game",s.onclick=e=>{e.ctrlKey||(e.preventDefault(),e.stopPropagation(),Z(n).catch((e=>{o("Failed to launch game. Message: "+e)})))},
s.style.backgroundImage=null!=i?'url("'+i+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(r)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=r,s.appendChild(e)}switch(n.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",s.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",s.appendChild(e)}break;case"dos":{const e=t.createElement("span")
;e.textContent="Dos",e.style.background="#0000ff",s.appendChild(e)}break;default:s.style.backgroundImage='url("/res/preview.svg")'}e.appendChild(s)}}{const e=n("s-products");for(const n of $)if(n.user===A){const r=t.createElement("div");r.className="item",r.onclick=()=>{J(n).catch((e=>{o("Failed to open the item. Message: "+e)}))},r.style.backgroundImage='url("'+n.prev[0]+'"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n.name,r.appendChild(e)}{
const e=t.createElement("span");e.textContent="$"+n.price.toFixed(2),r.appendChild(e)}e.appendChild(r)}null==e.firstElementChild&&(e.style.overflow="unset",e.innerHTML="You have not published any products yet.")}b.onclick=()=>{const e=t.createElement("input");e.type="file",e.accept="image/*",e.onchange=async()=>{var t;const n=null===(t=e.files)||void 0===t?void 0:t.item(0);if(null!=n){const e=await l(n,512,512);if(null==e)return void o("Error: Failed to resize image.");try{
await g(4,[U,await e.arrayBuffer()])}catch(e){return void o("Failed to upload the image file. Message: "+e)}const t=URL.createObjectURL(e);y.src=w.src=t,await y.decode(),await w.decode(),URL.revokeObjectURL(t)}},e.click()},s.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.value=a.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 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 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)?g(3,[U,t]).then((()=>{e.replaceWith(a),a.textContent=t,k.textContent=t,s.removeAttribute("style")})).catch((e=>{
o("Failed to change username. Message: "+e)})):o("Username must contain only hyphens, 0-9, lowercase a-z")},i.onclick=()=>{e.replaceWith(a),s.removeAttribute("style")},s.style.display="none",a.replaceWith(e),n.select()},c.onclick=()=>{const e="https://nettleweb.com/@"+E,n=t.createElement("span");n.textContent=e,c.replaceWith(n),navigator.clipboard.writeText(e)},d.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 i=t.createElement("button");i.type="button",i.title="Save",i.className="tick",n.appendChild(i);const a=t.createElement("button");a.type="button",a.title="Cancel",a.className="cross",n.appendChild(a),r.onblur=()=>{const e=r.value.trim();e.length>0&&(r.value=e)},i.onclick=()=>{const t=r.value.trim();t.length>500?o("Bio cannot have more than 500 characters in length."):g(55,[U,t]).then((()=>{
n.replaceWith(e),d.removeAttribute("style"),e.textContent=t||"NettleWeb User"})).catch((e=>{o("Failed to update bio. Message: "+e)}))},a.onclick=()=>{n.replaceWith(e),d.removeAttribute("style")},d.style.display="none",e.replaceWith(n),r.select()},h.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 i=t.createElement("button")
;i.type="button",i.title="Save",i.className="tick",e.appendChild(i);const a=t.createElement("button");a.type="button",a.title="Cancel",a.className="cross",e.appendChild(a),n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},i.onclick=()=>{const t=n.value.trim();t.length>30?o("Name cannot have more than 30 characters in length."):g(20,[U,t]).then((()=>{e.replaceWith(r),r.textContent=t,h.removeAttribute("style")})).catch((e=>{o("Failed to update name. Message: "+e)}))},a.onclick=()=>{
e.replaceWith(r),h.removeAttribute("style")},h.style.display="none",r.replaceWith(e),n.select()},u.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="email",n.value=i.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 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 a=n.value.trim().toLowerCase();a.length<6||a.length>320||a.indexOf("@",1)<0?o("Please provide a valid email address."):g(19,[U,a]).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)?g(18,[U,t]).then((()=>{e.replaceWith(i),i.textContent=a,u.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)}))},a.onclick=()=>{e.replaceWith(i),u.removeAttribute("style")
},u.style.display="none",i.replaceWith(e),n.select()},p.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 i=t.createElement("input");i.type="password",i.minLength=8,i.maxLength=30,i.spellcheck=!1,i.placeholder="Confirm password",i.autocomplete="off",e.appendChild(i);const a=t.createElement("button");a.type="button",a.title="Change",a.className="tick",e.appendChild(a);const s=t.createElement("button");s.type="button",
s.title="Cancel",s.className="cross",e.appendChild(s),a.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 a=r.value;a.length<8||a.length>30?o("The new password must have 8 to 30 characters."):t!==a?a===i.value?g(9,[U,t,a]).then((()=>{e.replaceWith(p)})).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(p)},p.replaceWith(e)},f.onclick=()=>{g(43,U).then((e=>{"string"==typeof e&&2048===e.length?(F.set("__secrets_",U=e),f.disabled=!0,z.emit("login",U)):o("Error: Remote returned invalid token.")})).catch((e=>{o("Failed to revoke login tokens. Message: "+e)}))},m.onclick=()=>{const e=t.createElement("div");if(m.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)?g(46,[U,t]).then((()=>{F.set("__?2fa","0"),e.replaceWith(m),m.removeAttribute("data-enabled"),m.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=rs.encode(crypto.getRandomValues(new Uint8Array(new ArrayBuffer(32),0,32)));{const r=t.createElement("img");r.src="data:image/gif;base64,"+ss.encode(Nt("otpauth://totp/NettleWeb:"+E+"?secret="+n+"&issuer=NettleWeb&algorithm=SHA1","gif",{ecc:"low",mask:1,scale:4,border:1})),r.alt="QR Code",r.width=172,r.height=172,r.loading="eager",r.decoding="sync",r.draggable=!1,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 i=t.createElement("button");i.type="button",i.title="Change",i.className="tick",e.appendChild(i),i.onclick=()=>{const t=r.value.trim()
;6===t.length&&/^\d+$/.test(t)?g(44,[U,n,t]).then((()=>{F.set("__?2fa","1"),e.replaceWith(m),m.setAttribute("data-enabled",""),m.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(m)},m.replaceWith(e)},n("so").onclick=()=>{F.delete("__secrets_"),
setTimeout((()=>v.reload()),200)},n("da").onclick=()=>{o("Error: Operation not permitted.")},n("account-settings").style.display="block"}}if(null!=U){const Wo=await new Promise((e=>{const t=r=>{z.off("lr",t),z.off("le",n),e(null),H=r},n=r=>{z.off("lr",t),z.off("le",n),e(r)};z.on("lr",t),z.on("le",n),z.emit("login",U)}));if(null==Wo)return void await Do();o("Failed to validate login token. Please login again. Message: "+Wo),U=null}const Bo=n("login-dialog");let No,Ro,Fo;function Uo(){
Bo.style.display="none",Bo.innerHTML="";{const e=t.createElement("h3");e.textContent="Login",Bo.appendChild(e)}const e=t.createElement("input");e.type="text",e.value=Ro||"",e.required=!0,e.minLength=4,e.maxLength=320,e.spellcheck=!1,e.placeholder="Username/Email",e.autocomplete="off",Bo.appendChild(e);const n=t.createElement("input");n.type="password",n.value=Fo||"",n.required=!0,n.minLength=8,n.maxLength=30,n.spellcheck=!1,n.placeholder="Password",n.autocomplete="off",Bo.appendChild(n)
;const r=t.createElement("button");r.type="button",r.className="pri-button",r.textContent="Login",Bo.appendChild(r);const i=t.createElement("div");i.tabIndex=0,i.textContent="Register",Bo.appendChild(i);const a=t.createElement("div");a.tabIndex=0,a.textContent="Forgot password",Bo.appendChild(a);const s=t.createElement("div");s.tabIndex=0,s.textContent="Sign in with Google",Bo.appendChild(s),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(Ro=e.value=t)},n.onblur=()=>{
const e=n.value;e.length>0&&(Fo=e)},r.onclick=()=>{const t=Ro=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=Fo=n.value
;r.length<8||r.length>30?o("Password must be between 8 and 30 characters long."):g(10,[t,r]).then((e=>{"string"==typeof e?qo(e):o("Error: Remote returned invalid token data.")})).catch((e=>{o("Failed to retrieve login token. Message: "+e)}))},i.onclick=Ho,a.onclick=zo,s.onclick=Vo,Bo.style.display="block"}function Ho(){Bo.style.display="none",Bo.innerHTML="";{const e=t.createElement("h3");e.textContent="Register",Bo.appendChild(e)}const e=t.createElement("input");e.type="text",e.value=Ro||"",
e.required=!0,e.minLength=4,e.maxLength=20,e.spellcheck=!1,e.placeholder="Username",e.autocomplete="off",Bo.appendChild(e);const n=t.createElement("input");n.type="email",n.value=No||"",n.required=!0,n.minLength=6,n.maxLength=320,n.spellcheck=!1,n.placeholder="Email",n.autocomplete="off",Bo.appendChild(n);const r=t.createElement("input");r.type="password",r.value=Fo||"",r.required=!0,r.minLength=8,r.maxLength=30,r.spellcheck=!1,r.placeholder="Password",r.autocomplete="off",Bo.appendChild(r)
;const i=t.createElement("input");i.type="password",i.value="",i.required=!0,i.minLength=8,i.maxLength=30,i.spellcheck=!1,i.placeholder="Confirm password",i.autocomplete="off",Bo.appendChild(i);const a=t.createElement("button");a.type="button",a.className="pri-button",a.textContent="Register",Bo.appendChild(a);const s=t.createElement("div");s.tabIndex=0,s.textContent="Login",Bo.appendChild(s);const c=t.createElement("div");c.tabIndex=0,c.textContent="Sign in with Google",Bo.appendChild(c),
e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(Ro=e.value=t)},n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(No=n.value=e)},r.onblur=()=>{const e=r.value;e.length>0&&(Fo=e)},a.onclick=()=>{const a=Ro=e.value.trim().toLowerCase();if(a.length<4||a.length>20)return void o("The username must be between 4 and 20 characters long.");if(!/^[\-a-z0-9]+$/.test(a))return void o("The username must contain only hyphens, lowercase a-z and 0-9.")
;const s=No=n.value.trim().toLowerCase();if(s.length<6||s.length>320||s.indexOf("@",1)<0)return void o("Please provide a valid email.");const l=Fo=r.value;l.length<8||l.length>30?o("The password must be between 8 and 30 characters long."):l===i.value?g(11,[a,l,s]).then((()=>{Bo.style.display="none",Bo.innerHTML="";{const e=t.createElement("h3");e.textContent="Verify Email",Bo.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.",Bo.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",Bo.appendChild(e);const n=t.createElement("button");n.type="button",n.className="pri-button",n.textContent="Verify",Bo.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.",Bo.appendChild(e)}Bo.appendChild(c),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)?g(17,[a,t]).then((e=>{
"string"==typeof e&&2048===e.length?(F.set("__secrets_",U=e),z.emit("login",U),Do()):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.")},Bo.style.display="block"})).catch((e=>{o("Failed to send request. Message: "+e)})):o("The confirm password does not match.")},s.onclick=Uo,c.onclick=Vo,Bo.style.display="block"}function zo(){Bo.style.display="none",Bo.innerHTML="";{
const e=t.createElement("h3");e.textContent="Reset Password",Bo.appendChild(e)}const e=t.createElement("input");e.type="email",e.value=No||"",e.required=!0,e.minLength=6,e.maxLength=320,e.spellcheck=!1,e.placeholder="Email",e.autocomplete="off",Bo.appendChild(e);const n=t.createElement("button");n.type="button",n.className="pri-button",n.textContent="Continue",Bo.appendChild(n);const r=t.createElement("div");r.tabIndex=0,r.textContent="Login",Bo.appendChild(r);const i=t.createElement("div")
;i.tabIndex=0,i.textContent="Register",Bo.appendChild(i);const a=t.createElement("div");a.tabIndex=0,a.textContent="Sign in with Google",Bo.appendChild(a),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(No=e.value=t)},n.onclick=()=>{const n=No=e.value.trim().toLowerCase();n.length<6||n.length>320||n.indexOf("@",1)<0?o("Please provide a valid email."):g(21,n).then((()=>{Bo.style.display="none",Bo.innerHTML="";{const e=t.createElement("h3");e.textContent="Reset Password",
Bo.appendChild(e)}{const e=t.createElement("span");e.textContent="Please check your inbox and follow the instructions on the email.",Bo.appendChild(e)}Bo.appendChild(r),Bo.appendChild(i),Bo.appendChild(a),Bo.style.display="block"})).catch((e=>{o("Failed to send request. Message: "+e)}))},r.onclick=Uo,i.onclick=Ho,a.onclick=Vo,Bo.style.display="block"}function qo(e){if(2048===e.length)return F.set("__secrets_",U=e),F.set("__?2fa","0"),z.emit("login",U),void Do();Bo.style.display="none",
Bo.innerHTML="";{const e=t.createElement("h3");e.textContent="Two-Factor Authentication",Bo.appendChild(e)}{const e=t.createElement("span");e.textContent="Please open your authenticator app and fill in the generated 6-digit verification code below.",Bo.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",Bo.appendChild(n);const r=t.createElement("button")
;r.type="button",r.className="pri-button",r.textContent="Verify",Bo.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)?g(45,[e,t]).then((e=>{"string"==typeof e&&2048===e.length?(F.set("__secrets_",U=e),F.set("__?2fa","1"),z.emit("login",U),Do()):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.")},
Bo.style.display="block"}function Vo(){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")}v.replace(t)}{const Go=F.get("_cre_")||"";if(Go.length>0){try{
const Qo=await g(0,Go);if("string"!=typeof Qo)return void o("Error: Remote returned invalid token data.");O.click(),qo(Qo)}catch(Xo){o("Failed to retrieve login token. Message: "+Xo)}F.delete("_cre_")}else Uo()}}})(window)})();