tawuniya 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,733 @@
1
+ import { useState as N, useContext as k, createElement as Ce, createContext as ie, useCallback as J, useRef as L, useSyncExternalStore as Le, useId as Ne, useMemo as ge, useEffect as H } from "react";
2
+ const ye = 1, be = 10, pt = "a11y-widget-settings", mt = "data-a11y-orig-font-size", gt = [1, 1.15, 1.3, 1.45], yt = {
3
+ contrast: !1,
4
+ highlightLinks: !1,
5
+ bigTextLevel: 0,
6
+ hideImages: !1,
7
+ bigCursor: !1,
8
+ saturate: !1,
9
+ textAlign: "default",
10
+ lineHeight: !1,
11
+ dyslexiaFont: !1,
12
+ focusIndicator: !1
13
+ }, bt = [
14
+ "default",
15
+ "left",
16
+ "center",
17
+ "justify"
18
+ ], St = {
19
+ a11y: "acc-a11y",
20
+ close: "close-01-stc",
21
+ contrast: "acc-contrast",
22
+ link: "acc-link",
23
+ bigText: "acc-big-text",
24
+ hideImages: "acc-hide-images",
25
+ cursor: "acc-cursor",
26
+ saturate: "acc-saturate",
27
+ align: "acc-align",
28
+ lineHeight: "acc-line-height",
29
+ focusIndicator: "acc-focus-indicator",
30
+ dyslexiaFont: "acc-dyslexia-font",
31
+ reset: "rotate-ccw"
32
+ }, wt = {
33
+ default: "bottom-17 inset-e-0!",
34
+ "top-left": "top-17 rtl:inset-e-0!",
35
+ "top-right": "top-17 inset-e-0! rtl:inset-e-auto!",
36
+ "bottom-left": "bottom-17 rtl:inset-e-0!",
37
+ "bottom-right": "bottom-17 inset-e-0! rtl:inset-e-auto!"
38
+ }, w = [];
39
+ for (let e = 0; e < 256; ++e)
40
+ w.push((e + 256).toString(16).slice(1));
41
+ function Qe(e, t = 0) {
42
+ return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
43
+ }
44
+ let se;
45
+ const je = new Uint8Array(16);
46
+ function Re() {
47
+ if (!se) {
48
+ if (typeof crypto > "u" || !crypto.getRandomValues)
49
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
50
+ se = crypto.getRandomValues.bind(crypto);
51
+ }
52
+ return se(je);
53
+ }
54
+ const Fe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Se = { randomUUID: Fe };
55
+ function Ve(e, t, r) {
56
+ e = e || {};
57
+ const n = e.random ?? e.rng?.() ?? Re();
58
+ if (n.length < 16)
59
+ throw new Error("Random bytes length must be >= 16");
60
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Qe(n);
61
+ }
62
+ function De(e, t, r) {
63
+ return Se.randomUUID && !e ? Se.randomUUID() : Ve(e);
64
+ }
65
+ const vt = (e, t) => {
66
+ const [r, n] = N([]), [s, o] = N(), i = e * 1024 * 1024, l = (u) => new Promise((y, b) => {
67
+ const m = new FileReader();
68
+ m.readAsDataURL(u), m.onload = () => {
69
+ const M = m.result.split(",")[1];
70
+ y(M);
71
+ }, m.onerror = (v) => b(v);
72
+ });
73
+ return {
74
+ selectedFiles: r,
75
+ internalError: s,
76
+ maxSizeInBytes: i,
77
+ onFileChange: async (u, y) => {
78
+ o(void 0);
79
+ const b = u.target.files;
80
+ if (!b) return;
81
+ const m = [];
82
+ for (const M of Array.from(b)) {
83
+ if (r.length + m.length >= t) break;
84
+ if (M.size > i) {
85
+ o(`Maximum file size is ${e} MB`);
86
+ break;
87
+ }
88
+ try {
89
+ const S = await l(M);
90
+ m.push({
91
+ id: `${Date.now()}-${De()}`,
92
+ file: S,
93
+ fileName: M.name,
94
+ fileType: M.type,
95
+ size: M.size
96
+ });
97
+ } catch (S) {
98
+ o(
99
+ S instanceof Error ? S.message : String(S)
100
+ );
101
+ }
102
+ }
103
+ const v = [...r, ...m];
104
+ n(v), y(v), u.target.value = "";
105
+ },
106
+ removeFile: (u, y) => {
107
+ const b = r.filter((m) => m.id !== u);
108
+ n(b), y(b);
109
+ },
110
+ formatBytes: (u, y = 2) => {
111
+ if (u === 0) return "0 Bytes";
112
+ const b = 1024, m = y < 0 ? 0 : y, v = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], M = Math.floor(Math.log(u) / Math.log(b));
113
+ return Number.parseFloat((u / Math.pow(b, M)).toFixed(m)) + v[M];
114
+ },
115
+ formatFileSize: (u) => u < 1024 ? `${u} bytes` : u < 1024 * 1024 ? `${(u / 1024).toFixed(1)} KB` : `${(u / (1024 * 1024)).toFixed(1)} MB`,
116
+ getPreviewImage: (u) => {
117
+ const y = u.file;
118
+ return `data:${u.fileType};base64,${y}`;
119
+ }
120
+ };
121
+ };
122
+ function g(e, ...t) {
123
+ }
124
+ function we(e, ...t) {
125
+ }
126
+ const _e = {
127
+ 303: "Multiple adapter contexts detected. This might happen in monorepos.",
128
+ 404: "nuqs requires an adapter to work with your framework.",
129
+ 409: "Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",
130
+ 414: "Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",
131
+ 429: "URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",
132
+ 500: "Empty search params cache. Search params can't be accessed in Layouts.",
133
+ 501: "Search params cache already populated. Have you called `parse` twice?",
134
+ 502: "`processUrlSearchParams` threw while processing key(s) `%s`. %O"
135
+ };
136
+ function Q(e) {
137
+ return `[nuqs] ${_e[e]}
138
+ See https://nuqs.dev/NUQS-${e}`;
139
+ }
140
+ function Mt(e) {
141
+ if (e.size === 0) return "";
142
+ const t = [];
143
+ for (const [n, s] of e.entries()) {
144
+ const o = n.replace(/#/g, "%23").replace(/&/g, "%26").replace(/\+/g, "%2B").replace(/=/g, "%3D").replace(/\?/g, "%3F");
145
+ t.push(`${o}=${Be(s)}`);
146
+ }
147
+ const r = "?" + t.join("&");
148
+ return Ke(r), r;
149
+ }
150
+ function Be(e) {
151
+ return e.replace(/%/g, "%25").replace(/\+/g, "%2B").replace(/ /g, "+").replace(/#/g, "%23").replace(/&/g, "%26").replace(/"/g, "%22").replace(/'/g, "%27").replace(/`/g, "%60").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/[\x00-\x1F]/g, (t) => encodeURIComponent(t));
152
+ }
153
+ const ze = 2e3;
154
+ function Ke(e) {
155
+ if (typeof location > "u" || process.env.NODE_ENV === "production") return;
156
+ const t = new URL(location.href);
157
+ t.search = e, t.href.length > ze && console.warn(Q(414));
158
+ }
159
+ const $e = "2.10.1", Ge = {};
160
+ function W(e, t) {
161
+ const r = /* @__PURE__ */ Symbol.for(`nuqs.${$e}.${e}`), n = globalThis;
162
+ if (n[r] != null) return n[r];
163
+ const s = Object.isExtensible(n) ? n : Ge;
164
+ return s[r] ??= t();
165
+ }
166
+ function Ye(e, t, r) {
167
+ const n = W(e, () => /* @__PURE__ */ new WeakMap());
168
+ return n.has(t) || n.set(t, r()), n.get(t);
169
+ }
170
+ const j = Ye("adapter-context", ie, () => {
171
+ const e = ie({ useAdapter() {
172
+ throw new Error(Q(404));
173
+ } });
174
+ return e.displayName = "NuqsAdapterContext", e;
175
+ });
176
+ typeof window < "u" && (window.__NuqsAdapterContext && window.__NuqsAdapterContext !== j && console.error(Q(303)), window.__NuqsAdapterContext = j);
177
+ function Ot(e) {
178
+ return ({ children: t, defaultOptions: r, processUrlSearchParams: n, ...s }) => Ce(j.Provider, {
179
+ ...s,
180
+ value: {
181
+ useAdapter: e,
182
+ defaultOptions: r,
183
+ processUrlSearchParams: n
184
+ }
185
+ }, t);
186
+ }
187
+ function Je(e) {
188
+ const t = k(j);
189
+ if (!("useAdapter" in t)) throw new Error(Q(404));
190
+ return t.useAdapter(e);
191
+ }
192
+ const He = () => k(j).defaultOptions, Xe = () => k(j).processUrlSearchParams;
193
+ function ke() {
194
+ if (typeof window > "u" || !window.GestureEvent) return 50;
195
+ try {
196
+ const e = navigator.userAgent?.match(/version\/([\d\.]+) safari/i);
197
+ return parseFloat(e[1]) >= 17 ? 120 : 320;
198
+ } catch {
199
+ return 320;
200
+ }
201
+ }
202
+ function We(e) {
203
+ return {
204
+ method: "throttle",
205
+ timeMs: e
206
+ };
207
+ }
208
+ const D = We(ke());
209
+ function Ze(e) {
210
+ return e === null || Array.isArray(e) && e.length === 0;
211
+ }
212
+ function et(e, t, r) {
213
+ if (typeof r == "string") e.set(t, r);
214
+ else {
215
+ e.delete(t);
216
+ for (const n of r) e.append(t, n);
217
+ e.has(t) || e.set(t, "");
218
+ }
219
+ return e;
220
+ }
221
+ function Ee() {
222
+ const e = /* @__PURE__ */ new Map();
223
+ return {
224
+ on(t, r) {
225
+ const n = e.get(t) || [];
226
+ return n.push(r), e.set(t, n), () => this.off(t, r);
227
+ },
228
+ off(t, r) {
229
+ const n = e.get(t);
230
+ n && e.set(t, n.filter((s) => s !== r));
231
+ },
232
+ emit(t, r) {
233
+ e.get(t)?.forEach((n) => n(r));
234
+ }
235
+ };
236
+ }
237
+ function ue(e, t, r) {
238
+ function n() {
239
+ e(), r.removeEventListener("abort", o);
240
+ }
241
+ const s = setTimeout(n, t);
242
+ function o() {
243
+ clearTimeout(s), r.removeEventListener("abort", o);
244
+ }
245
+ r.addEventListener("abort", o);
246
+ }
247
+ function ae() {
248
+ const e = Promise;
249
+ if (Promise.hasOwnProperty("withResolvers")) return Promise.withResolvers();
250
+ let t = () => {
251
+ }, r = () => {
252
+ };
253
+ return {
254
+ promise: new e((n, s) => {
255
+ t = n, r = s;
256
+ }),
257
+ resolve: t,
258
+ reject: r
259
+ };
260
+ }
261
+ function tt(e, t) {
262
+ let r = t;
263
+ for (let n = e.length - 1; n >= 0; n--) {
264
+ const s = e[n];
265
+ if (!s) continue;
266
+ const o = r;
267
+ r = () => s(o);
268
+ }
269
+ r();
270
+ }
271
+ function le() {
272
+ return new URLSearchParams(location.search);
273
+ }
274
+ var Ae = class {
275
+ updateMap = /* @__PURE__ */ new Map();
276
+ options = {
277
+ history: "replace",
278
+ scroll: !1,
279
+ shallow: !0
280
+ };
281
+ timeMs = D.timeMs;
282
+ transitions = /* @__PURE__ */ new Set();
283
+ resolvers = null;
284
+ controller = null;
285
+ lastFlushedAt = 0;
286
+ resetQueueOnNextPush = !1;
287
+ push({ key: e, query: t, options: r }, n = D.timeMs) {
288
+ this.resetQueueOnNextPush && (this.reset(), this.resetQueueOnNextPush = !1), g(7, e, t, r), this.updateMap.set(e, t), r.history === "push" && (this.options.history = "push"), r.scroll && (this.options.scroll = !0), r.shallow === !1 && (this.options.shallow = !1), r.startTransition && this.transitions.add(r.startTransition), (!Number.isFinite(this.timeMs) || n > this.timeMs) && (this.timeMs = n);
289
+ }
290
+ getQueuedQuery(e) {
291
+ return this.updateMap.get(e);
292
+ }
293
+ getPendingPromise({ getSearchParamsSnapshot: e = le }) {
294
+ return this.resolvers?.promise ?? Promise.resolve(e());
295
+ }
296
+ flush({ getSearchParamsSnapshot: e = le, rateLimitFactor: t = 1, ...r }, n) {
297
+ if (this.controller ??= new AbortController(), !Number.isFinite(this.timeMs))
298
+ return g(), Promise.resolve(e());
299
+ if (this.resolvers) return this.resolvers.promise;
300
+ this.resolvers = ae();
301
+ const s = () => {
302
+ this.lastFlushedAt = performance.now();
303
+ const [i, l] = this.applyPendingUpdates({
304
+ ...r,
305
+ autoResetQueueOnUpdate: r.autoResetQueueOnUpdate ?? !0,
306
+ getSearchParamsSnapshot: e
307
+ }, n);
308
+ l === null ? (this.resolvers.resolve(i), this.resetQueueOnNextPush = !0) : this.resolvers.reject(i), this.resolvers = null;
309
+ };
310
+ return ue(() => {
311
+ const i = performance.now() - this.lastFlushedAt, l = this.timeMs, c = t * Math.max(0, l - i);
312
+ g(9, c, l, t), c === 0 ? s() : ue(s, c, this.controller.signal);
313
+ }, 0, this.controller.signal), this.resolvers.promise;
314
+ }
315
+ abort() {
316
+ return this.controller?.abort(), this.controller = new AbortController(), this.resolvers?.resolve(new URLSearchParams()), this.resolvers = null, this.reset();
317
+ }
318
+ reset() {
319
+ const e = Array.from(this.updateMap.keys());
320
+ return g(10, JSON.stringify(Object.fromEntries(this.updateMap))), this.updateMap.clear(), this.transitions.clear(), this.options = {
321
+ history: "replace",
322
+ scroll: !1,
323
+ shallow: !0
324
+ }, this.timeMs = D.timeMs, e;
325
+ }
326
+ applyPendingUpdates(e, t) {
327
+ const { updateUrl: r, getSearchParamsSnapshot: n } = e;
328
+ let s = n();
329
+ if (g(11, this.updateMap.size, s.toString()), this.updateMap.size === 0) return [s, null];
330
+ const o = Array.from(this.updateMap.entries()), i = { ...this.options }, l = Array.from(this.transitions);
331
+ e.autoResetQueueOnUpdate && this.reset(), g(12, o, i);
332
+ for (const [c, h] of o) h === null ? s.delete(c) : s = et(s, c, h);
333
+ if (t) try {
334
+ s = t(s);
335
+ } catch (c) {
336
+ return console.error(Q(502), o.map(([h]) => h).join(), c), this.resetQueueOnNextPush = !0, [s, c];
337
+ }
338
+ try {
339
+ return tt(l, () => r(s, i)), [s, null];
340
+ } catch (c) {
341
+ return console.error(Q(429), o.map(([h]) => h).join(), c), [s, c];
342
+ }
343
+ }
344
+ };
345
+ const Y = W("throttle-queue", () => new Ae());
346
+ function rt(e, t, r) {
347
+ const n = J(() => {
348
+ const o = Object.fromEntries(e.map((i) => [i, r(i)]));
349
+ return [JSON.stringify(o), o];
350
+ }, [e.join(","), r]), s = L(null);
351
+ return s.current === null && (s.current = n()), Le(J((o) => {
352
+ const i = e.map((l) => t(l, o));
353
+ return () => i.forEach((l) => l());
354
+ }, [e.join(","), t]), () => {
355
+ const [o, i] = n();
356
+ return s.current[0] === o ? s.current[1] : (s.current = [o, i], i);
357
+ }, () => s.current[1]);
358
+ }
359
+ var nt = class {
360
+ resolvers = ae();
361
+ controller = new AbortController();
362
+ queuedValue = void 0;
363
+ abort() {
364
+ this.controller.abort(), this.queuedValue = void 0;
365
+ }
366
+ push(e, t, r) {
367
+ return this.queuedValue = e, this.controller.abort(), this.controller = new AbortController(), ue(() => {
368
+ const n = this.resolvers;
369
+ try {
370
+ g(13, e);
371
+ const s = r(e);
372
+ g(14, this.queuedValue), this.queuedValue = void 0, this.resolvers = ae(), s.then((o) => n.resolve(o)).catch((o) => n.reject(o));
373
+ } catch (s) {
374
+ this.queuedValue = void 0, n.reject(s);
375
+ }
376
+ }, t, this.controller.signal), this.resolvers.promise;
377
+ }
378
+ }, st = class {
379
+ throttleQueue;
380
+ queues = /* @__PURE__ */ new Map();
381
+ queuedQuerySync = Ee();
382
+ constructor(e = new Ae()) {
383
+ this.throttleQueue = e;
384
+ }
385
+ push(e, t, r, n) {
386
+ if (!Number.isFinite(t)) {
387
+ const c = r.getSearchParamsSnapshot ?? le;
388
+ return Promise.resolve(c());
389
+ }
390
+ const s = e.key;
391
+ let o = this.queues.get(s);
392
+ o || (g(15, s), o = new nt(), this.queues.set(s, o)), g(17, e);
393
+ const i = () => (this.throttleQueue.push(e), this.throttleQueue.flush(r, n).finally(() => {
394
+ this.queues.get(s)?.queuedValue === void 0 && (g(16, s), this.queues.delete(s)), this.queuedQuerySync.emit(s);
395
+ })), l = o.push(e, t, i);
396
+ return this.queuedQuerySync.emit(s), l;
397
+ }
398
+ abort(e) {
399
+ const t = this.queues.get(e);
400
+ return t ? (g(18, e, t.queuedValue?.query), this.queues.delete(e), t.abort(), this.queuedQuerySync.emit(e), (r) => (r.then(t.resolvers.resolve, t.resolvers.reject), r)) : (r) => r;
401
+ }
402
+ abortAll() {
403
+ for (const [e, t] of this.queues.entries())
404
+ g(18, e, t.queuedValue?.query), t.abort(), t.resolvers.resolve(new URLSearchParams()), this.queuedQuerySync.emit(e);
405
+ this.queues.clear();
406
+ }
407
+ getQueuedQuery(e) {
408
+ const t = this.queues.get(e)?.queuedValue?.query;
409
+ return t !== void 0 ? t : this.throttleQueue.getQueuedQuery(e);
410
+ }
411
+ };
412
+ const X = W("debounce-controller", () => new st(Y));
413
+ function ot(e) {
414
+ return rt(e, (t, r) => X.queuedQuerySync.on(t, r), (t) => X.getQueuedQuery(t));
415
+ }
416
+ function it(e, t) {
417
+ return e === t;
418
+ }
419
+ function ut(e, t) {
420
+ return e === t ? !0 : e === null || t === null || typeof e == "string" || typeof t == "string" || e.length !== t.length ? !1 : e.every((r, n) => r === t[n]);
421
+ }
422
+ function _(e, t) {
423
+ return Object.hasOwn(e, t) ? e[t] : void 0;
424
+ }
425
+ function at(e, t) {
426
+ return _(e, t) ?? t;
427
+ }
428
+ function Ie(e, t, r) {
429
+ try {
430
+ return e(t);
431
+ } catch (n) {
432
+ return r ? we(25, t, n, r) : we(24, t, n), null;
433
+ }
434
+ }
435
+ function q(e) {
436
+ function t(r) {
437
+ if (typeof r > "u") return null;
438
+ const n = Array.isArray(r);
439
+ return n && r[0] === void 0 ? null : (r = n ? r[0] : typeof r == "string" ? r : "", Ie(e.parse, r));
440
+ }
441
+ return {
442
+ type: "single",
443
+ eq: (r, n) => r === n,
444
+ ...e,
445
+ parseServerSide: t,
446
+ withDefault(r) {
447
+ return {
448
+ ...this,
449
+ defaultValue: r,
450
+ parseServerSide(n) {
451
+ return t(n) ?? r;
452
+ }
453
+ };
454
+ },
455
+ withOptions(r) {
456
+ return {
457
+ ...this,
458
+ ...r
459
+ };
460
+ }
461
+ };
462
+ }
463
+ q({
464
+ parse: (e) => e,
465
+ serialize: String
466
+ });
467
+ q({
468
+ parse: (e) => {
469
+ const t = parseInt(e);
470
+ return t == t ? t : null;
471
+ },
472
+ serialize: (e) => "" + Math.round(e)
473
+ });
474
+ q({
475
+ parse: (e) => {
476
+ const t = parseInt(e);
477
+ return t == t ? t - 1 : null;
478
+ },
479
+ serialize: (e) => "" + Math.round(e + 1)
480
+ });
481
+ q({
482
+ parse: (e) => {
483
+ const t = parseInt(e, 16);
484
+ return t == t ? t : null;
485
+ },
486
+ serialize: (e) => {
487
+ const t = Math.round(e).toString(16);
488
+ return t < "0" || !(t.length & 1) ? t : "0" + t;
489
+ }
490
+ });
491
+ q({
492
+ parse: (e) => {
493
+ const t = parseFloat(e);
494
+ return t == t ? t : null;
495
+ },
496
+ serialize: String
497
+ });
498
+ q({
499
+ parse: (e) => e.toLowerCase() === "true",
500
+ serialize: String
501
+ });
502
+ function ce(e, t) {
503
+ return e.valueOf() === t.valueOf();
504
+ }
505
+ q({
506
+ parse: (e) => {
507
+ const t = new Date(parseInt(e));
508
+ return +t == +t ? t : null;
509
+ },
510
+ serialize: (e) => "" + e.valueOf(),
511
+ eq: ce
512
+ });
513
+ q({
514
+ parse: (e) => {
515
+ const t = new Date(e);
516
+ return +t == +t && qe.parse(e) ? t : null;
517
+ },
518
+ serialize: (e) => e.toISOString(),
519
+ eq: ce
520
+ });
521
+ const qe = q({
522
+ parse: (e) => {
523
+ const t = new Date(e.slice(0, 10));
524
+ return +t == +t && qe.serialize(t) === e.slice(0, 10) ? t : null;
525
+ },
526
+ serialize: (e) => e.toISOString().slice(0, 10),
527
+ eq: ce
528
+ }), oe = W("sync-emitter", () => Ee()), lt = {}, ve = (e, t) => e === "defaultValue" ? void 0 : t;
529
+ function ct(e, t = {}) {
530
+ const r = Ne(), n = He(), s = Xe(), { history: o = n?.history ?? "replace", scroll: i = n?.scroll ?? !1, shallow: l = n?.shallow ?? !0, throttleMs: c = D.timeMs, limitUrlUpdates: h = n?.limitUrlUpdates, clearOnDefault: p = n?.clearOnDefault ?? !0, startTransition: d, urlKeys: E = lt } = t, u = Object.keys(e).join(","), y = L(e), b = y.current, m = JSON.stringify(Object.entries(b), ve) === JSON.stringify(Object.entries(e), ve) && Object.entries(e).every(([f, a]) => {
531
+ if (b[f]?.startTransition !== a.startTransition) return !1;
532
+ const O = b[f]?.defaultValue, I = a.defaultValue;
533
+ return Object.is(O, I) ? !0 : O !== void 0 && I !== void 0 && a.eq?.(O, I) === !0;
534
+ }) ? b : e;
535
+ y.current = m;
536
+ const v = ge(() => Object.fromEntries(Object.keys(e).map((f) => [f, at(E, f)])), [u, JSON.stringify(E)]), M = Object.values(v), S = Je(M), R = S.searchParams, B = L(null), Z = L(null), ee = ot(M), [he] = N(() => {
537
+ const f = {}, [, a] = Me(e, v, R, ee, f);
538
+ return [a, f];
539
+ }), z = L(he[1]), [K, te] = N(he[0]), A = L(K), fe = (f) => JSON.stringify([M.map((a) => [a, f.getAll(a)]), ee]), $ = fe(R), re = () => {
540
+ const [f, a] = Me(e, v, R, ee, z.current, A.current);
541
+ return f && (g(1, r, u, a), A.current = a, te(a)), f;
542
+ }, xe = Object.keys(z.current).join("&") !== M.join("&"), de = Z.current === null || Z.current === (S.pathname ?? location.pathname);
543
+ if (xe)
544
+ B.current = $, re(), z.current = Object.fromEntries(Object.entries(v).map(([f, a]) => [a, e[f]?.type === "multi" ? R.getAll(a) : R.get(a)]));
545
+ else {
546
+ let f = !1;
547
+ de && B.current !== $ && (B.current = $, f = re()), !f && K !== A.current && (de || S.pathname === void 0 && B.current === fe(new URLSearchParams(location.search))) && te(A.current);
548
+ }
549
+ H(() => {
550
+ Z.current = S.pathname ?? location.pathname, re();
551
+ }, [$, S.pathname]), H(() => {
552
+ const f = [];
553
+ for (const [a, O] of Object.entries(v)) {
554
+ const I = ({ state: x, query: F }) => {
555
+ te((U) => Object.is(U[a] ?? null, x) ? (g(2, r, u, O, x, e[a]?.defaultValue, A.current), U) : (A.current = {
556
+ ...A.current,
557
+ [a]: x
558
+ }, z.current[O] = F, g(3, r, u, O, x, e[a]?.defaultValue, A.current), A.current));
559
+ };
560
+ g(4, r, O, u), oe.on(O, I), f.push([O, I]);
561
+ }
562
+ return () => {
563
+ for (const [a, O] of f)
564
+ g(5, r, a, u), oe.off(a, O);
565
+ };
566
+ }, [u, v]);
567
+ const Te = J((f, a = {}) => {
568
+ const O = (typeof f == "function" ? f(Oe(A.current, m)) : f) ?? Object.fromEntries(Object.keys(m).map((C) => [C, null]));
569
+ g(6, r, u, O);
570
+ let I, x = 0;
571
+ const F = [];
572
+ for (let [C, T] of Object.entries(O)) {
573
+ const P = _(m, C), G = v[C];
574
+ if (!P || G === void 0 || T === void 0) continue;
575
+ (a.clearOnDefault ?? P.clearOnDefault ?? p) && T !== null && P.defaultValue !== void 0 && (P.eq ?? it)(T, P.defaultValue) && (T = null);
576
+ const pe = T === null ? null : (P.serialize ?? String)(T);
577
+ oe.emit(G, {
578
+ state: T,
579
+ query: pe
580
+ });
581
+ const me = {
582
+ key: G,
583
+ query: pe,
584
+ options: {
585
+ history: a.history ?? P.history ?? o,
586
+ shallow: a.shallow ?? P.shallow ?? l,
587
+ scroll: a.scroll ?? P.scroll ?? i,
588
+ startTransition: a.startTransition ?? P.startTransition ?? d
589
+ }
590
+ }, ne = a.limitUrlUpdates ?? P.limitUrlUpdates ?? h;
591
+ if (ne?.method === "debounce") {
592
+ const V = ne.timeMs ?? D.timeMs, Ue = X.push(me, V, S, s);
593
+ x < V && (I = Ue, x = V);
594
+ } else {
595
+ const V = ne?.timeMs ?? a.throttleMs ?? P.throttleMs ?? c;
596
+ F.push(X.abort(G)), Y.push(me, V);
597
+ }
598
+ }
599
+ let U = F.length ? Y.flush(S, s) : Y.getPendingPromise(S);
600
+ for (const C of F) U = C(U);
601
+ return I ?? U;
602
+ }, [
603
+ u,
604
+ o,
605
+ l,
606
+ i,
607
+ c,
608
+ h?.method,
609
+ h?.timeMs,
610
+ d,
611
+ p,
612
+ m,
613
+ v,
614
+ S.updateUrl,
615
+ S.getSearchParamsSnapshot,
616
+ S.rateLimitFactor,
617
+ s
618
+ ]);
619
+ return [ge(() => Oe(K, m), [K, m]), Te];
620
+ }
621
+ function Me(e, t, r, n, s = {}, o = {}) {
622
+ let i = !1;
623
+ const l = Object.entries(e).reduce((c, [h, p]) => {
624
+ const d = t[h], E = _(n, d), u = p.type === "multi" ? [] : null, y = E === void 0 ? p.type === "multi" ? r.getAll(d) : r.get(d) : E, b = _(o, h);
625
+ return b !== void 0 && ut(_(s, d) ?? u, y) ? (c[h] = b, c) : (i = !0, c[h] = (Ze(y) ? null : Ie(p.parse, y, d)) ?? null, s[d] = y, c);
626
+ }, {});
627
+ return i ||= Object.keys(l).length !== Object.keys(o).length, [i, l];
628
+ }
629
+ function Oe(e, t) {
630
+ return Object.fromEntries(Object.keys(e).map((r) => [r, e[r] ?? t[r]?.defaultValue ?? null]));
631
+ }
632
+ function Pe(e, t = {}) {
633
+ const { parse: r = (d) => d, type: n, serialize: s, eq: o, defaultValue: i, ...l } = t, c = {
634
+ parse: r,
635
+ type: n,
636
+ serialize: s,
637
+ eq: o,
638
+ defaultValue: i
639
+ }, [{ [e]: h }, p] = ct({ [e]: c }, l);
640
+ return [h, J((d, E = {}) => p((u) => ({ [e]: typeof d == "function" ? d(u[e]) : d }), E), [e, p])];
641
+ }
642
+ const ht = (e = 640) => {
643
+ const [t, r] = N(!1), n = () => {
644
+ r(window.matchMedia(`(max-width: ${e}px)`).matches);
645
+ };
646
+ return H(() => (n(), window.addEventListener("resize", n), () => {
647
+ window.removeEventListener("resize", n);
648
+ }), []), t;
649
+ }, Pt = (e = 0) => {
650
+ const t = ht(), [r, n] = Pe("page", {
651
+ parse: Number,
652
+ defaultValue: ye
653
+ }), [s, o] = Pe("pageSize", {
654
+ parse: Number,
655
+ defaultValue: be
656
+ }), i = Math.ceil(e / s);
657
+ return {
658
+ page: r,
659
+ pageSize: s,
660
+ totalPages: i,
661
+ isMobile: t,
662
+ setPage: n,
663
+ setPageSize: o,
664
+ resetPagination: () => {
665
+ n(ye), o(be);
666
+ },
667
+ generatePageNumbers: () => {
668
+ const h = [], p = t ? 1 : 5;
669
+ if (i <= p + 2)
670
+ for (let d = 1; d <= i; d++)
671
+ h.push(d);
672
+ else {
673
+ h.push(1), r > Math.floor(p / 2) + 1 && h.push("ellipsis-start");
674
+ let d = Math.max(2, r - Math.floor(p / 2)), E = Math.min(i - 1, r + Math.floor(p / 2));
675
+ r <= Math.floor(p / 2) + 1 && (E = p), r >= i - Math.floor(p / 2) && (d = i - p + 1);
676
+ for (let u = d; u <= E; u++) h.push(u);
677
+ r < i - Math.floor(p / 2) && h.push("ellipsis-end"), h.push(i);
678
+ }
679
+ return h;
680
+ }
681
+ };
682
+ }, Et = () => {
683
+ const e = () => typeof document > "u" ? "en" : document.documentElement.lang || "en", [t, r] = N(e);
684
+ return H(() => {
685
+ if (typeof document > "u")
686
+ return;
687
+ const n = document.documentElement, s = () => {
688
+ r(n.lang || "en");
689
+ };
690
+ s();
691
+ const o = new MutationObserver((i) => {
692
+ i.forEach((l) => {
693
+ l.type === "attributes" && l.attributeName === "lang" && s();
694
+ });
695
+ });
696
+ return o.observe(n, {
697
+ attributes: !0,
698
+ attributeFilter: ["lang"]
699
+ }), () => {
700
+ o.disconnect();
701
+ };
702
+ }, []), t;
703
+ }, ft = ie(
704
+ void 0
705
+ ), At = () => {
706
+ const e = k(ft);
707
+ if (!e)
708
+ throw new Error("useMainContext must be used within a MainProvider");
709
+ return e;
710
+ };
711
+ export {
712
+ yt as A,
713
+ ft as M,
714
+ wt as P,
715
+ pt as a,
716
+ St as b,
717
+ vt as c,
718
+ Pt as d,
719
+ ht as e,
720
+ At as f,
721
+ g,
722
+ X as h,
723
+ Y as i,
724
+ W as j,
725
+ Ee as k,
726
+ Ot as l,
727
+ gt as m,
728
+ mt as n,
729
+ bt as o,
730
+ Pe as p,
731
+ Mt as r,
732
+ Et as u
733
+ };