proto-sudoku-wc 0.0.819 → 0.0.820
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.
@@ -252,30 +252,15 @@ const createStore = (defaultState, shouldUpdate) => {
|
|
252
252
|
|
253
253
|
// eslint-lint-disable-next-line @typescript-eslint/naming-convention
|
254
254
|
class HTTPError extends Error {
|
255
|
+
response;
|
256
|
+
request;
|
257
|
+
options;
|
255
258
|
constructor(response, request, options) {
|
256
259
|
const code = (response.status || response.status === 0) ? response.status : '';
|
257
260
|
const title = response.statusText || '';
|
258
261
|
const status = `${code} ${title}`.trim();
|
259
262
|
const reason = status ? `status code ${status}` : 'an unknown error';
|
260
263
|
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
261
|
-
Object.defineProperty(this, "response", {
|
262
|
-
enumerable: true,
|
263
|
-
configurable: true,
|
264
|
-
writable: true,
|
265
|
-
value: void 0
|
266
|
-
});
|
267
|
-
Object.defineProperty(this, "request", {
|
268
|
-
enumerable: true,
|
269
|
-
configurable: true,
|
270
|
-
writable: true,
|
271
|
-
value: void 0
|
272
|
-
});
|
273
|
-
Object.defineProperty(this, "options", {
|
274
|
-
enumerable: true,
|
275
|
-
configurable: true,
|
276
|
-
writable: true,
|
277
|
-
value: void 0
|
278
|
-
});
|
279
264
|
this.name = 'HTTPError';
|
280
265
|
this.response = response;
|
281
266
|
this.request = request;
|
@@ -284,14 +269,9 @@ class HTTPError extends Error {
|
|
284
269
|
}
|
285
270
|
|
286
271
|
class TimeoutError extends Error {
|
272
|
+
request;
|
287
273
|
constructor(request) {
|
288
274
|
super(`Request timed out: ${request.method} ${request.url}`);
|
289
|
-
Object.defineProperty(this, "request", {
|
290
|
-
enumerable: true,
|
291
|
-
configurable: true,
|
292
|
-
writable: true,
|
293
|
-
value: void 0
|
294
|
-
});
|
295
275
|
this.name = 'TimeoutError';
|
296
276
|
this.request = request;
|
297
277
|
}
|
@@ -451,7 +431,6 @@ const normalizeRetryOptions = (retry = {}) => {
|
|
451
431
|
return {
|
452
432
|
...defaultRetryOptions,
|
453
433
|
...retry,
|
454
|
-
afterStatusCodes: retryAfterStatusCodes,
|
455
434
|
};
|
456
435
|
};
|
457
436
|
|
@@ -567,38 +546,13 @@ class Ky {
|
|
567
546
|
}
|
568
547
|
return result;
|
569
548
|
}
|
549
|
+
request;
|
550
|
+
abortController;
|
551
|
+
_retryCount = 0;
|
552
|
+
_input;
|
553
|
+
_options;
|
570
554
|
// eslint-disable-next-line complexity
|
571
555
|
constructor(input, options = {}) {
|
572
|
-
Object.defineProperty(this, "request", {
|
573
|
-
enumerable: true,
|
574
|
-
configurable: true,
|
575
|
-
writable: true,
|
576
|
-
value: void 0
|
577
|
-
});
|
578
|
-
Object.defineProperty(this, "abortController", {
|
579
|
-
enumerable: true,
|
580
|
-
configurable: true,
|
581
|
-
writable: true,
|
582
|
-
value: void 0
|
583
|
-
});
|
584
|
-
Object.defineProperty(this, "_retryCount", {
|
585
|
-
enumerable: true,
|
586
|
-
configurable: true,
|
587
|
-
writable: true,
|
588
|
-
value: 0
|
589
|
-
});
|
590
|
-
Object.defineProperty(this, "_input", {
|
591
|
-
enumerable: true,
|
592
|
-
configurable: true,
|
593
|
-
writable: true,
|
594
|
-
value: void 0
|
595
|
-
});
|
596
|
-
Object.defineProperty(this, "_options", {
|
597
|
-
enumerable: true,
|
598
|
-
configurable: true,
|
599
|
-
writable: true,
|
600
|
-
value: void 0
|
601
|
-
});
|
602
556
|
this._input = input;
|
603
557
|
const credentials = this._input instanceof Request && 'credentials' in Request.prototype
|
604
558
|
? this._input.credentials
|
@@ -671,28 +625,28 @@ class Ky {
|
|
671
625
|
}
|
672
626
|
_calculateRetryDelay(error) {
|
673
627
|
this._retryCount++;
|
674
|
-
if (this._retryCount
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
return after < max ? after : max;
|
687
|
-
}
|
688
|
-
if (error.response.status === 413) {
|
689
|
-
return 0;
|
628
|
+
if (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {
|
629
|
+
throw error;
|
630
|
+
}
|
631
|
+
if (error instanceof HTTPError) {
|
632
|
+
if (!this._options.retry.statusCodes.includes(error.response.status)) {
|
633
|
+
throw error;
|
634
|
+
}
|
635
|
+
const retryAfter = error.response.headers.get('Retry-After');
|
636
|
+
if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
|
637
|
+
let after = Number(retryAfter) * 1000;
|
638
|
+
if (Number.isNaN(after)) {
|
639
|
+
after = Date.parse(retryAfter) - Date.now();
|
690
640
|
}
|
641
|
+
const max = this._options.retry.maxRetryAfter ?? after;
|
642
|
+
return after < max ? after : max;
|
643
|
+
}
|
644
|
+
if (error.response.status === 413) {
|
645
|
+
throw error;
|
691
646
|
}
|
692
|
-
const retryDelay = this._options.retry.delay(this._retryCount);
|
693
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
694
647
|
}
|
695
|
-
|
648
|
+
const retryDelay = this._options.retry.delay(this._retryCount);
|
649
|
+
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
696
650
|
}
|
697
651
|
_decorateResponse(response) {
|
698
652
|
if (this._options.parseJson) {
|
@@ -706,24 +660,24 @@ class Ky {
|
|
706
660
|
}
|
707
661
|
catch (error) {
|
708
662
|
const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
|
709
|
-
if (
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
663
|
+
if (this._retryCount < 1) {
|
664
|
+
throw error;
|
665
|
+
}
|
666
|
+
await delay(ms, { signal: this._options.signal });
|
667
|
+
for (const hook of this._options.hooks.beforeRetry) {
|
668
|
+
// eslint-disable-next-line no-await-in-loop
|
669
|
+
const hookResult = await hook({
|
670
|
+
request: this.request,
|
671
|
+
options: this._options,
|
672
|
+
error: error,
|
673
|
+
retryCount: this._retryCount,
|
674
|
+
});
|
675
|
+
// If `stop` is returned from the hook, the retry process is stopped
|
676
|
+
if (hookResult === stop) {
|
677
|
+
return;
|
723
678
|
}
|
724
|
-
return this._retry(function_);
|
725
679
|
}
|
726
|
-
|
680
|
+
return this._retry(function_);
|
727
681
|
}
|
728
682
|
}
|
729
683
|
async _fetch() {
|
@@ -800,7 +754,12 @@ const createInstance = (defaults) => {
|
|
800
754
|
ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
801
755
|
}
|
802
756
|
ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
803
|
-
ky.extend = (newDefaults) =>
|
757
|
+
ky.extend = (newDefaults) => {
|
758
|
+
if (typeof newDefaults === 'function') {
|
759
|
+
newDefaults = newDefaults(defaults ?? {});
|
760
|
+
}
|
761
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
762
|
+
};
|
804
763
|
ky.stop = stop;
|
805
764
|
return ky;
|
806
765
|
};
|
@@ -248,30 +248,15 @@ const createStore = (defaultState, shouldUpdate) => {
|
|
248
248
|
|
249
249
|
// eslint-lint-disable-next-line @typescript-eslint/naming-convention
|
250
250
|
class HTTPError extends Error {
|
251
|
+
response;
|
252
|
+
request;
|
253
|
+
options;
|
251
254
|
constructor(response, request, options) {
|
252
255
|
const code = (response.status || response.status === 0) ? response.status : '';
|
253
256
|
const title = response.statusText || '';
|
254
257
|
const status = `${code} ${title}`.trim();
|
255
258
|
const reason = status ? `status code ${status}` : 'an unknown error';
|
256
259
|
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
257
|
-
Object.defineProperty(this, "response", {
|
258
|
-
enumerable: true,
|
259
|
-
configurable: true,
|
260
|
-
writable: true,
|
261
|
-
value: void 0
|
262
|
-
});
|
263
|
-
Object.defineProperty(this, "request", {
|
264
|
-
enumerable: true,
|
265
|
-
configurable: true,
|
266
|
-
writable: true,
|
267
|
-
value: void 0
|
268
|
-
});
|
269
|
-
Object.defineProperty(this, "options", {
|
270
|
-
enumerable: true,
|
271
|
-
configurable: true,
|
272
|
-
writable: true,
|
273
|
-
value: void 0
|
274
|
-
});
|
275
260
|
this.name = 'HTTPError';
|
276
261
|
this.response = response;
|
277
262
|
this.request = request;
|
@@ -280,14 +265,9 @@ class HTTPError extends Error {
|
|
280
265
|
}
|
281
266
|
|
282
267
|
class TimeoutError extends Error {
|
268
|
+
request;
|
283
269
|
constructor(request) {
|
284
270
|
super(`Request timed out: ${request.method} ${request.url}`);
|
285
|
-
Object.defineProperty(this, "request", {
|
286
|
-
enumerable: true,
|
287
|
-
configurable: true,
|
288
|
-
writable: true,
|
289
|
-
value: void 0
|
290
|
-
});
|
291
271
|
this.name = 'TimeoutError';
|
292
272
|
this.request = request;
|
293
273
|
}
|
@@ -447,7 +427,6 @@ const normalizeRetryOptions = (retry = {}) => {
|
|
447
427
|
return {
|
448
428
|
...defaultRetryOptions,
|
449
429
|
...retry,
|
450
|
-
afterStatusCodes: retryAfterStatusCodes,
|
451
430
|
};
|
452
431
|
};
|
453
432
|
|
@@ -563,38 +542,13 @@ class Ky {
|
|
563
542
|
}
|
564
543
|
return result;
|
565
544
|
}
|
545
|
+
request;
|
546
|
+
abortController;
|
547
|
+
_retryCount = 0;
|
548
|
+
_input;
|
549
|
+
_options;
|
566
550
|
// eslint-disable-next-line complexity
|
567
551
|
constructor(input, options = {}) {
|
568
|
-
Object.defineProperty(this, "request", {
|
569
|
-
enumerable: true,
|
570
|
-
configurable: true,
|
571
|
-
writable: true,
|
572
|
-
value: void 0
|
573
|
-
});
|
574
|
-
Object.defineProperty(this, "abortController", {
|
575
|
-
enumerable: true,
|
576
|
-
configurable: true,
|
577
|
-
writable: true,
|
578
|
-
value: void 0
|
579
|
-
});
|
580
|
-
Object.defineProperty(this, "_retryCount", {
|
581
|
-
enumerable: true,
|
582
|
-
configurable: true,
|
583
|
-
writable: true,
|
584
|
-
value: 0
|
585
|
-
});
|
586
|
-
Object.defineProperty(this, "_input", {
|
587
|
-
enumerable: true,
|
588
|
-
configurable: true,
|
589
|
-
writable: true,
|
590
|
-
value: void 0
|
591
|
-
});
|
592
|
-
Object.defineProperty(this, "_options", {
|
593
|
-
enumerable: true,
|
594
|
-
configurable: true,
|
595
|
-
writable: true,
|
596
|
-
value: void 0
|
597
|
-
});
|
598
552
|
this._input = input;
|
599
553
|
const credentials = this._input instanceof Request && 'credentials' in Request.prototype
|
600
554
|
? this._input.credentials
|
@@ -667,28 +621,28 @@ class Ky {
|
|
667
621
|
}
|
668
622
|
_calculateRetryDelay(error) {
|
669
623
|
this._retryCount++;
|
670
|
-
if (this._retryCount
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
return after < max ? after : max;
|
683
|
-
}
|
684
|
-
if (error.response.status === 413) {
|
685
|
-
return 0;
|
624
|
+
if (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {
|
625
|
+
throw error;
|
626
|
+
}
|
627
|
+
if (error instanceof HTTPError) {
|
628
|
+
if (!this._options.retry.statusCodes.includes(error.response.status)) {
|
629
|
+
throw error;
|
630
|
+
}
|
631
|
+
const retryAfter = error.response.headers.get('Retry-After');
|
632
|
+
if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
|
633
|
+
let after = Number(retryAfter) * 1000;
|
634
|
+
if (Number.isNaN(after)) {
|
635
|
+
after = Date.parse(retryAfter) - Date.now();
|
686
636
|
}
|
637
|
+
const max = this._options.retry.maxRetryAfter ?? after;
|
638
|
+
return after < max ? after : max;
|
639
|
+
}
|
640
|
+
if (error.response.status === 413) {
|
641
|
+
throw error;
|
687
642
|
}
|
688
|
-
const retryDelay = this._options.retry.delay(this._retryCount);
|
689
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
690
643
|
}
|
691
|
-
|
644
|
+
const retryDelay = this._options.retry.delay(this._retryCount);
|
645
|
+
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
692
646
|
}
|
693
647
|
_decorateResponse(response) {
|
694
648
|
if (this._options.parseJson) {
|
@@ -702,24 +656,24 @@ class Ky {
|
|
702
656
|
}
|
703
657
|
catch (error) {
|
704
658
|
const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
|
705
|
-
if (
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
659
|
+
if (this._retryCount < 1) {
|
660
|
+
throw error;
|
661
|
+
}
|
662
|
+
await delay(ms, { signal: this._options.signal });
|
663
|
+
for (const hook of this._options.hooks.beforeRetry) {
|
664
|
+
// eslint-disable-next-line no-await-in-loop
|
665
|
+
const hookResult = await hook({
|
666
|
+
request: this.request,
|
667
|
+
options: this._options,
|
668
|
+
error: error,
|
669
|
+
retryCount: this._retryCount,
|
670
|
+
});
|
671
|
+
// If `stop` is returned from the hook, the retry process is stopped
|
672
|
+
if (hookResult === stop) {
|
673
|
+
return;
|
719
674
|
}
|
720
|
-
return this._retry(function_);
|
721
675
|
}
|
722
|
-
|
676
|
+
return this._retry(function_);
|
723
677
|
}
|
724
678
|
}
|
725
679
|
async _fetch() {
|
@@ -796,7 +750,12 @@ const createInstance = (defaults) => {
|
|
796
750
|
ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
797
751
|
}
|
798
752
|
ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
799
|
-
ky.extend = (newDefaults) =>
|
753
|
+
ky.extend = (newDefaults) => {
|
754
|
+
if (typeof newDefaults === 'function') {
|
755
|
+
newDefaults = newDefaults(defaults ?? {});
|
756
|
+
}
|
757
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
758
|
+
};
|
800
759
|
ky.stop = stop;
|
801
760
|
return ky;
|
802
761
|
};
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{h as t,g as e,f as r,r as o}from"./p-e323f35c.js";const s=e=>{const r=e.hex||"currentColor",o=e.size||24;return t("svg",{class:e.class,width:o,height:o,viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,e.label||"alien"),t("g",{fill:r},t("path",{d:"M10.31 10.93C11.33 12.57 11.18 14.5 9.96 15.28C8.74 16.04 6.92 15.33\n 5.89 13.69C4.87 12.05 5.03 10.1 6.25 9.34C7.47 8.58 9.29 9.29 10.31\n 10.93M12 17.75C14 17.75 14.5 17 14.5 17C14.5 17 14 19 12 19C10 19 9.5\n 17.03 9.5 17C9.5 17 10 17.75 12 17.75M17.75 9.34C18.97 10.1 19.13 12.05\n 18.11 13.69C17.08 15.33 15.26 16.04 14.04 15.28C12.82 14.5 12.67 12.57\n 13.69 10.93C14.71 9.29 16.53 8.58 17.75 9.34M12 20C14.5 20 20 14.86 20\n 11C20 7.14 16.41 4 12 4C7.59 4 4 7.14 4 11C4 14.86 9.5 20 12 20M12 2C17.5\n 2 22 6.04 22 11C22 15.08 16.32 22 12 22C7.68 22 2 15.08 2 11C2 6.04 6.5 2\n 12 2Z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},n="proto-sudoku",a=`${n}::data`,i=`${n}::inputs`,l=`${n}::pick`,c=t=>{const e=localStorage.getItem(t);return e?JSON.parse(e):void 0},d=(t,e)=>{const r=JSON.stringify(e);localStorage.setItem(t,r)},f=()=>[...c(i)],h=t=>{d(i,t.join(""))},p=()=>{const t=c(l);return null!==t?t:void 0},u=t=>{d(l,t>=0&&t<81?t:null)},b="Check ?",w="New Puzzle",g=t=>!("isConnected"in t)||t.isConnected,y=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys())t.set(e,t.get(e).filter(g))})(...e)}),2e3)}})(),m=t=>"function"==typeof t?t():t;class x extends Error{response;request;options;constructor(t,e,r){const o=`${t.status||0===t.status?t.status:""} ${t.statusText||""}`.trim();super(`Request failed with ${o?`status code ${o}`:"an unknown error"}: ${e.method} ${e.url}`),this.name="HTTPError",this.response=t,this.request=e,this.options=r}}class v extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}}const C=t=>null!==t&&"object"==typeof t,k=(...t)=>{for(const e of t)if((!C(e)||Array.isArray(e))&&void 0!==e)throw new TypeError("The `options` argument must be an object");return M({},...t)},T=(t={},e={})=>{const r=new globalThis.Headers(t),o=e instanceof globalThis.Headers,s=new globalThis.Headers(e);for(const[t,e]of s.entries())o&&"undefined"===e||void 0===e?r.delete(t):r.set(t,e);return r},M=(...t)=>{let e={},r={};for(const o of t)if(Array.isArray(o))Array.isArray(e)||(e=[]),e=[...e,...o];else if(C(o)){for(let[t,r]of Object.entries(o))C(r)&&t in e&&(r=M(e[t],r)),e={...e,[t]:r};C(o.headers)&&(r=T(r,o.headers),e.headers=r)}return e},R=(()=>{let t=!1,e=!1;const r="function"==typeof globalThis.ReadableStream,o="function"==typeof globalThis.Request;if(r&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&"unsupported BodyInit type"===t.message)return!1;throw t}return t&&!e})(),z="function"==typeof globalThis.AbortController,E="function"==typeof globalThis.ReadableStream,S="function"==typeof globalThis.FormData,j=["get","post","put","patch","head","delete"],A={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},P=2147483647,q=Symbol("stop"),U={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},$={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},B=t=>j.includes(t)?t.toUpperCase():t,O={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},N=(t={})=>{if("number"==typeof t)return{...O,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...O,...t}};class _{static create(t,e){const r=new _(t,e),o=async()=>{if("number"==typeof r._options.timeout&&r._options.timeout>P)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let t=await r._fetch();for(const e of r._options.hooks.afterResponse){const o=await e(r.request,r._options,r._decorateResponse(t.clone()));o instanceof globalThis.Response&&(t=o)}if(r._decorateResponse(t),!t.ok&&r._options.throwHttpErrors){let e=new x(t,r.request,r._options);for(const t of r._options.hooks.beforeError)e=await t(e);throw e}if(r._options.onDownloadProgress){if("function"!=typeof r._options.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!E)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return r._stream(t.clone(),r._options.onDownloadProgress)}return t},s=r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(o):o();for(const[t,o]of Object.entries(A))s[t]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||o);const n=(await s).clone();if("json"===t){if(204===n.status)return"";if(0===(await n.clone().arrayBuffer()).byteLength)return"";if(e.parseJson)return e.parseJson(await n.text())}return n[t]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(t,e={}){this._input=t;const r=this._input instanceof Request&&"credentials"in Request.prototype?this._input.credentials:void 0;if(this._options={...r&&{credentials:r},...e,headers:T(this._input.headers,e.headers),hooks:M({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},e.hooks),method:B(e.method??this._input.method),prefixUrl:String(e.prefixUrl||""),retry:N(e.retry),throwHttpErrors:!1!==e.throwHttpErrors,timeout:e.timeout??1e4,fetch:e.fetch??globalThis.fetch.bind(globalThis)},"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(z){if(this.abortController=new globalThis.AbortController,this._options.signal){const t=this._options.signal;this._options.signal.addEventListener("abort",(()=>{this.abortController.abort(t.reason)}))}this._options.signal=this.abortController.signal}if(R&&(this._options.duplex="half"),void 0!==this._options.json&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const t="string"==typeof this._options.searchParams?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),e=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,"?"+t);!(S&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(e,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof v)throw t;if(t instanceof x){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;const e=t.response.headers.get("Retry-After");if(e&&this._options.retry.afterStatusCodes.includes(t.response.status)){let t=1e3*Number(e);Number.isNaN(t)&&(t=Date.parse(e)-Date.now());const r=this._options.retry.maxRetryAfter??t;return t<r?t:r}if(413===t.response.status)throw t}const e=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,e)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(e){const r=Math.min(this._calculateRetryDelay(e),P);if(this._retryCount<1)throw e;await async function(t,{signal:e}){return new Promise(((r,o)=>{function s(){clearTimeout(n),o(e.reason)}e&&(e.throwIfAborted(),e.addEventListener("abort",s,{once:!0}));const n=setTimeout((()=>{e?.removeEventListener("abort",s),r()}),t)}))}(r,{signal:this._options.signal});for(const t of this._options.hooks.beforeRetry)if(await t({request:this.request,options:this._options,error:e,retryCount:this._retryCount})===q)return;return this._retry(t)}}async _fetch(){for(const t of this._options.hooks.beforeRequest){const e=await t(this.request,this._options);if(e instanceof Request){this.request=e;break}if(e instanceof Response)return e}const t=((t,e)=>{const r={};for(const o in e)o in $||o in U||o in t||(r[o]=e[o]);return r})(this.request,this._options),e=this.request;return this.request=e.clone(),!1===this._options.timeout?this._options.fetch(e,t):async function(t,e,r,o){return new Promise(((s,n)=>{const a=setTimeout((()=>{r&&r.abort(),n(new v(t))}),o.timeout);o.fetch(t,e).then(s).catch(n).then((()=>{clearTimeout(a)}))}))}(e,t,this.abortController,this._options)}_stream(t,e){const r=Number(t.headers.get("content-length"))||0;let o=0;return 204===t.status?(e&&e({percent:1,totalBytes:r,transferredBytes:o},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(s){const n=t.body.getReader();e&&e({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array),await async function t(){const{done:a,value:i}=await n.read();a?s.close():(e&&(o+=i.byteLength,e({percent:0===r?0:o/r,transferredBytes:o,totalBytes:r},i)),s.enqueue(i),await t())}()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}}
|
2
|
+
/*! MIT License © Sindre Sorhus */const D=t=>{const e=(e,r)=>_.create(e,k(t,r));for(const r of j)e[r]=(e,o)=>_.create(e,k(t,o,{method:r}));return e.create=t=>D(k(t)),e.extend=e=>("function"==typeof e&&(e=e(t??{})),D(k(t,e))),e.stop=q,e},H=D(),L={list:[],keys:[],locs:[],loading:!1,solved:!1,error:void 0,pick:void 0,data:void 0},{state:J}=(()=>{const t=((t,e=((t,e)=>t!==e))=>{const r=m(t);let o=new Map(Object.entries(null!=r?r:{}));const s={dispose:[],get:[],set:[],reset:[]},n=()=>{var e;o=new Map(Object.entries(null!==(e=m(t))&&void 0!==e?e:{})),s.reset.forEach((t=>t()))},a=t=>(s.get.forEach((e=>e(t))),o.get(t)),i=(t,r)=>{const n=o.get(t);e(r,n,t)&&(o.set(t,r),s.set.forEach((e=>e(t,r,n))))},l="undefined"==typeof Proxy?{}:new Proxy(r,{get:(t,e)=>a(e),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>o.has(e),set:(t,e,r)=>(i(e,r),!0)}),c=(t,e)=>(s[t].push(e),()=>{((t,e)=>{const r=t.indexOf(e);r>=0&&(t[r]=t[t.length-1],t.length--)})(s[t],e)});return{state:l,get:a,set:i,on:c,onChange:(e,r)=>{const o=c("set",((t,o)=>{t===e&&r(o)})),s=c("reset",(()=>r(m(t)[e])));return()=>{o(),s()}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(c("set",e.set)),e.get&&t.push(c("get",e.get)),e.reset&&t.push(c("reset",e.reset)),e.dispose&&t.push(c("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{s.dispose.forEach((t=>t())),n()},reset:n,forceUpdate:t=>{const e=o.get(t);s.set.forEach((r=>r(t,e,e)))}}})(L,void 0);return t.use((()=>{if("function"!=typeof e)return{};const t=new Map;return{dispose:()=>t.clear(),get:r=>{const o=e();o&&((t,e,r)=>{const o=t.get(e);o?o.includes(r)||o.push(r):t.set(e,[r])})(t,r,o)},set:e=>{const o=t.get(e);o&&t.set(e,o.filter(r)),y(t)},reset:()=>{t.forEach((t=>t.forEach(r))),y(t)}}})()),t})(),I=new Map([["row",new Map],["column",new Map],["box",new Map]]),W=["1","2","3","4","5","6","7","8","9"],X=t=>{if(void 0!==t&&t.indx!=J.pick){const{isClue:e,indx:r,row:o,column:s,box:n}=t,a=((t,e,r,o)=>{const s=new Map([["row",e],["column",r],["box",o]]),n=new Set;return s.forEach(((e,r)=>{I.get(r).get(e).forEach((e=>{e!==t&&n.add(e)}))})),Array.from(n)})(r,o,s,n),i=e?[]:(t=>{const{list:e}=J,r=new Set;return t.map((t=>{const{key:o}=e[t];"."!=o&&r.add(o)})),W.filter((t=>!r.has(t)))})(a);J.pick=r,J.keys=i,J.locs=a}else J.pick=void 0,J.keys=[],J.locs=[];Y(J.pick)};let Z;const K={netlify:"/.netlify/functions",vercel:"https://sudoku-rust-api.vercel.app/api"},V=t=>{h(t)},Y=t=>{u(t)},F=(t=!1)=>{J.list=[],J.keys=[],J.locs=[],J.loading=t,J.solved=!1,J.error=void 0,J.pick=void 0,J.data=void 0},G=(t,e=!0)=>{const{puzzle:r,ref:o}=t;e&&(h([]),d(a,t)),(t=>{if(t){const{puzzle:e,ref:r}=t,o=e?[...e]:[],s=r?atob(r):void 0,n=s?[...s]:[],a=o.map(((t,e)=>{const r=n[e],o=t===r,s=Math.floor(e/9),a=e%9,i=((t,e)=>e<3?t<3?0:t<6?3:6:e<6?t<3?1:t<6?4:7:t<3?2:t<6?5:8)(s,a);return((t,e,r,o)=>{new Map([["row",e],["column",r],["box",o]]).forEach(((e,r)=>{const o=I.get(r);o.has(e)?o.get(e).add(t):o.set(e,new Set([t]))}))})(e,s,a,i),{key:t,isClue:o,value:r,indx:e,row:s,column:a,box:i}}));(t=>{f().forEach(((e,r)=>{const o=t[r],{isClue:s}=o;s||(o.key=e)}))})(a),J.data=t,J.list=a}else J.data=void 0,J.list=[]})({puzzle:r,ref:o})},Q=t=>{J.list=[...t],t.length=0},tt={initApp:t=>{(t=>{const e=(t=>{const e=Object.keys(K).includes(t)?t:"vercel";return K[e]})(t);Z=H.extend({hooks:{beforeRequest:[t=>{t.headers.set("X-Requested-With","ky"),t.headers.set("X-Custom-Header","foobar")}]},prefixUrl:e,timeout:1e4})})(t),F();const e=c(a),r=p();if(e&&(G(e,!1),r>=0)){const{list:t}=J;X(t[r])}},refresh:async()=>{F(!0),V([]),Y(J.pick);try{const t=await Z.get("puzzle").json();G(t)}catch(t){const{message:e}=t;console.log("-- ",e),console.log(t),J.error=e}finally{J.loading=!1}},select:t=>{X(t)},check:()=>{const{list:t}=J,e=[];let r=0,o=0,s=0;t.forEach((t=>{const{key:n,value:a,isClue:i}=t;i?s+=1:"."!==n&&(n!==a?(r+=1,t.key="."):o+=1),e.push(t.key)}));const n=s+o;V(o?e:[]),r>0?Q(t):81===n&&(J.solved=!0)},input:t=>{const{pick:e,list:r}=J;r[e].key=t,Q(r)}},et=(...t)=>t.filter(Boolean).join(" "),rt=e=>{const r=e.hex||"currentColor",o=e.label||"loading...",s=e.size||24;return t("svg",{class:et(e.class||"","animate-spin"),width:s,height:s,fill:"none",viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,o),t("g",null,t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:r,"stroke-width":"4"}),t("path",{class:"opacity-75",fill:r,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},ot=e=>{const{message:r,salute:o,spinner:n=!1}=e;return t("div",{class:"mt-5 flex h-24px flex-row items-center"},t(n?rt:s,{class:"mr-2"}),o?t("label",{class:"mr-1 font-bold"},o,":"):"",t("label",{class:"italic"},r))},st=()=>{const{solved:e,loading:r,error:o}=J;return t("div",{class:"flex flex-col"},r||o||e?"":t(ot,{message:"Welcome, are you ready to play?..."}),r?t(ot,{message:"Loading...",spinner:!0}):"",o?t(ot,{message:o,salute:"ERROR"}):"",e?t(ot,{message:"You solved the puzzle!!"}):"")},nt=e=>{const r=e.hex||"currentColor",o=e.size||24;return t("svg",{class:e.class,width:o,height:o,viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,e.label||"fingerprint"),t("g",{fill:r},t("path",{d:"M17.81,4.47C17.73,4.47 17.65,4.45 17.58,4.41C15.66,3.42 14,3\n 12,3C10.03,3 8.15,3.47 6.44,4.41C6.2,4.54 5.9,4.45 5.76,4.21C5.63,3.97\n 5.72,3.66 5.96,3.53C7.82,2.5 9.86,2 12,2C14.14,2 16,2.47\n 18.04,3.5C18.29,3.65 18.38,3.95 18.25,4.19C18.16,4.37 18,4.47\n 17.81,4.47M3.5,9.72C3.4,9.72 3.3,9.69 3.21,9.63C3,9.47 2.93,9.16\n 3.09,8.93C4.08,7.53 5.34,6.43 6.84,5.66C10,4.04 14,4.03\n 17.15,5.65C18.65,6.42 19.91,7.5 20.9,8.9C21.06,9.12 21,9.44\n 20.78,9.6C20.55,9.76 20.24,9.71 20.08,9.5C19.18,8.22 18.04,7.23\n 16.69,6.54C13.82,5.07 10.15,5.07 7.29,6.55C5.93,7.25 4.79,8.25\n 3.89,9.5C3.81,9.65 3.66,9.72 3.5,9.72M9.75,21.79C9.62,21.79 9.5,21.74\n 9.4,21.64C8.53,20.77 8.06,20.21 7.39,19C6.7,17.77 6.34,16.27\n 6.34,14.66C6.34,11.69 8.88,9.27 12,9.27C15.12,9.27 17.66,11.69\n 17.66,14.66A0.5,0.5 0 0,1 17.16,15.16A0.5,0.5 0 0,1\n 16.66,14.66C16.66,12.24 14.57,10.27 12,10.27C9.43,10.27 7.34,12.24\n 7.34,14.66C7.34,16.1 7.66,17.43 8.27,18.5C8.91,19.66 9.35,20.15\n 10.12,20.93C10.31,21.13 10.31,21.44 10.12,21.64C10,21.74 9.88,21.79\n 9.75,21.79M16.92,19.94C15.73,19.94 14.68,19.64 13.82,19.05C12.33,18.04\n 11.44,16.4 11.44,14.66A0.5,0.5 0 0,1 11.94,14.16A0.5,0.5 0 0,1\n 12.44,14.66C12.44,16.07 13.16,17.4 14.38,18.22C15.09,18.7 15.92,18.93\n 16.92,18.93C17.16,18.93 17.56,18.9 17.96,18.83C18.23,18.78 18.5,18.96\n 18.54,19.24C18.59,19.5 18.41,19.77 18.13,19.82C17.56,19.93 17.06,19.94\n 16.92,19.94M14.91,22C14.87,22 14.82,22 14.78,22C13.19,21.54 12.15,20.95\n 11.06,19.88C9.66,18.5 8.89,16.64 8.89,14.66C8.89,13.04 10.27,11.72\n 11.97,11.72C13.67,11.72 15.05,13.04 15.05,14.66C15.05,15.73 16,16.6\n 17.13,16.6C18.28,16.6 19.21,15.73 19.21,14.66C19.21,10.89 15.96,7.83\n 11.96,7.83C9.12,7.83 6.5,9.41 5.35,11.86C4.96,12.67 4.76,13.62\n 4.76,14.66C4.76,15.44 4.83,16.67 5.43,18.27C5.53,18.53 5.4,18.82\n 5.14,18.91C4.88,19 4.59,18.87 4.5,18.62C4,17.31 3.77,16\n 3.77,14.66C3.77,13.46 4,12.37 4.45,11.42C5.78,8.63 8.73,6.82\n 11.96,6.82C16.5,6.82 20.21,10.33 20.21,14.65C20.21,16.27 18.83,17.59\n 17.13,17.59C15.43,17.59 14.05,16.27 14.05,14.65C14.05,13.58 13.12,12.71\n 11.97,12.71C10.82,12.71 9.89,13.58 9.89,14.65C9.89,16.36 10.55,17.96\n 11.76,19.16C12.71,20.1 13.62,20.62 15.03,21C15.3,21.08 15.45,21.36\n 15.38,21.62C15.33,21.85 15.12,22 14.91,22Z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},at="eswat2",it=()=>t("a",{class:"absolute right-0 top-0 text-clrs-gray hover:text-clrs-navy",href:"https://eswat2.dev","aria-label":at,target:"blank",title:at},t(nt,{label:at})),lt=(e,r)=>t("h1",{class:et("text-center uppercase text-clrs-red","mb-11 ml-0 mr-0 mt-11","text-6xl font-thin")},r),ct=e=>{const{label:r,callback:o,matched:s=!1}=e;return t("button",{class:et("rounded-md border border-solid border-clrs-slate4 font-bold",r===b?"mr-2 bg-clrs-yellow px-3 py-2 text-clrs-navy":r===w?"mr-2 bg-clrs-navy px-3 py-2 text-white":"x"===r?"mr-1 bg-clrs-red px-2 py-1 text-white":s?"mr-1 bg-clrs-slate4 px-2 py-1 text-white":"mr-1 bg-gray-50 px-2 py-1 text-clrs-navy"),onClick:o},r)},dt=()=>{const{keys:e,list:r,pick:o,solved:s}=J,n=t=>()=>{tt.input(t)},a=s?[]:e,i=null!=o?r[o]:void 0;return t("div",{class:"mt-2 flex flex-row justify-end"},s||!i||i.isClue||"."==i.key?"":t(ct,{label:"x",callback:n(".")}),a.map((e=>t(ct,{label:e,callback:n(e),matched:i.key===e}))))},ft=[2,5,11,14,20,23,29,32,38,41,47,50,56,59,65,68,74,77],ht=ft.map((t=>t+1)),pt=[18,19,20,21,22,23,24,25,26,45,46,47,48,49,50,51,52,53],ut=pt.map((t=>t+9)),bt=e=>{const{cell:r,focus:o,selected:s,solved:n}=e,{key:a,isClue:i,indx:l}=r,c="."!=a?a:"";return t("label",{class:et(`cell-${l}`,ft.includes(l)?"border-xbr-clrs-navy":"",ht.includes(l)?"border-xbl-clrs-navy":"",pt.includes(l)?"border-xbb-clrs-navy":"",ut.includes(l)?"border-xbt-clrs-navy":"","h-8 w-8 border border-solid text-center leading-8",s?"border-clrs-red bg-clrs-red-a50 text-clrs-red":o?"border-clrs-gray bg-clrs-green-a50 font-bold":i?"border-clrs-gray bg-clrs-silver":""!==c?"border-clrs-gray text-clrs-red":"border-clrs-gray"),onClick:((t,e)=>()=>{e||tt.select(t)})(r,n)},c)},wt=()=>{const{list:e,pick:r,locs:o,solved:s}=J;return t("div",{class:et("flex flex-row flex-wrap","border border-solid border-clrs-navy","h-76p5 w-76p5 text-lg")},e.map(((e,n)=>{const a=!s&&n===r,i=!s&&o.includes(n);return t(bt,{cell:e,focus:i,selected:a,solved:s})})))},gt=()=>t("label",{class:"ml-auto align-top text-xs italic text-clrs-slate4"},"Tailwind ","3.4.7"),yt=t=>()=>{t.refresh()},mt=t=>()=>{t.check()},xt=()=>{const{list:e,solved:r}=J;return t("div",{class:"flex flex-row"},t(ct,{label:w,callback:yt(tt)}),81!==e.length||r?"":t(ct,{label:b,callback:mt(tt)}),t(gt,null))},vt=class{constructor(t){o(this,t),this.tag="proto-sudoku",this.platform="vercel"}componentDidLoad(){tt.initApp(this.platform)}render(){return t("div",{key:"9f50eec975c4da5f4984b80380067d5155dda0d1",id:"app",class:"ds1-main relative max-w-min p-0.5"},t(it,{key:"e7bab7e257022a9920f8b43785d9dc33ab7fed65"}),t(lt,{key:"d8c32e6b9c20b9fe6c8ff2e9fc7a9900057a2679"},"Sudoku"),t(wt,{key:"8a028015ae4380aaa54a406ccf5cc908816ca6a4"}),t(dt,{key:"951b6d20ca7a99ced4c60aa39fe040af6e96dd46"}),t("hr",{key:"35ba2812a3b068b21b5252c5f07d0b5dc2f18527",class:"ml-0 mr-0"}),t(xt,{key:"114e7edd4bf3da82ae344f56cb7e856ce17a6da8"}),t(st,{key:"2c15eb0ba714d1e0c378882c62ce575c428adc2a"}))}};vt.style="*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.ds1-main{margin:1.5rem;display:flex;flex-direction:column;font-family:ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';color:var(--clrs-navy, #001f3f);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.absolute{position:absolute}.relative{position:relative}.right-0{right:0px}.top-0{top:0px}.mb-11{margin-bottom:2.75rem}.ml-0{margin-left:0px}.ml-auto{margin-left:auto}.mr-0{margin-right:0px}.mr-1{margin-right:0.25rem}.mr-2{margin-right:0.5rem}.mt-11{margin-top:2.75rem}.mt-2{margin-top:0.5rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.h-24px{height:24px}.h-76p5{height:19.125rem}.h-8{height:2rem}.w-76p5{width:19.125rem}.w-8{width:2rem}.max-w-min{max-width:-moz-min-content;max-width:min-content}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.rounded-md{border-radius:0.375rem}.border{border-width:1px}.border-solid{border-style:solid}.border-clrs-gray{border-color:var(--clrs-gray, #aaaaaa)}.border-clrs-navy{border-color:var(--clrs-navy, #001f3f)}.border-clrs-red{border-color:var(--clrs-red, #ff4136)}.border-clrs-slate4{border-color:var(--clrs-slate4, #4e5964)}.bg-clrs-green-a50{background-color:var(--clrs-green-a50, #2ecc4050)}.bg-clrs-navy{background-color:var(--clrs-navy, #001f3f)}.bg-clrs-red{background-color:var(--clrs-red, #ff4136)}.bg-clrs-red-a50{background-color:var(--clrs-red-a50, #ff413650)}.bg-clrs-silver{background-color:var(--clrs-silver, #dddddd)}.bg-clrs-slate4{background-color:var(--clrs-slate4, #4e5964)}.bg-clrs-yellow{background-color:var(--clrs-yellow, #ffdc00)}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.p-0\\.5{padding:0.125rem}.px-2{padding-left:0.5rem;padding-right:0.5rem}.px-3{padding-left:0.75rem;padding-right:0.75rem}.py-1{padding-top:0.25rem;padding-bottom:0.25rem}.py-2{padding-top:0.5rem;padding-bottom:0.5rem}.text-center{text-align:center}.align-top{vertical-align:top}.text-6xl{font-size:3.75rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xs{font-size:0.75rem;line-height:1rem}.font-bold{font-weight:700}.font-thin{font-weight:100}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-8{line-height:2rem}.text-clrs-gray{color:var(--clrs-gray, #aaaaaa)}.text-clrs-navy{color:var(--clrs-navy, #001f3f)}.text-clrs-red{color:var(--clrs-red, #ff4136)}.text-clrs-slate4{color:var(--clrs-slate4, #4e5964)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-25{opacity:0.25}.opacity-75{opacity:0.75}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),\n 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.border-xbb-clrs-navy{border-bottom:1px solid var(--clrs-navy, #001f3f) !important}.border-xbt-clrs-navy{border-top:1px solid var(--clrs-navy, #001f3f) !important}.border-xbl-clrs-navy{border-left:1px solid var(--clrs-navy, #001f3f) !important}.border-xbr-clrs-navy{border-right:1px solid var(--clrs-navy, #001f3f) !important}.hover\\:text-clrs-navy:hover{color:var(--clrs-navy, #001f3f)}";export{vt as proto_sudoku}
|
@@ -1 +1 @@
|
|
1
|
-
import{p as o,b as t}from"./p-e323f35c.js";export{s as setNonce}from"./p-e323f35c.js";import{g as
|
1
|
+
import{p as o,b as t}from"./p-e323f35c.js";export{s as setNonce}from"./p-e323f35c.js";import{g as a}from"./p-e1255160.js";(()=>{const s=import.meta.url,t={};return""!==s&&(t.resourcesUrl=new URL(".",s).href),o(t)})().then((async o=>(await a(),t([["p-6b8a7018",[[1,"proto-sudoku",{tag:[1],platform:[1]}]]]],o))));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "proto-sudoku-wc",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.820",
|
4
4
|
"description": "prototype - a simple Sudoku app rendered in Stencil and Tailwind",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.js",
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"dependencies": {
|
30
30
|
"@stencil/core": "4.19.2",
|
31
31
|
"@stencil/store": "2.0.16",
|
32
|
-
"ky": "1.
|
32
|
+
"ky": "1.5.0",
|
33
33
|
"proto-tailwindcss-clrs": "0.0.341",
|
34
34
|
"tailwindcss": "3.4.7"
|
35
35
|
},
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import{h as t,g as e,f as r,r as o}from"./p-e323f35c.js";const s=e=>{const r=e.hex||"currentColor",o=e.size||24;return t("svg",{class:e.class,width:o,height:o,viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,e.label||"alien"),t("g",{fill:r},t("path",{d:"M10.31 10.93C11.33 12.57 11.18 14.5 9.96 15.28C8.74 16.04 6.92 15.33\n 5.89 13.69C4.87 12.05 5.03 10.1 6.25 9.34C7.47 8.58 9.29 9.29 10.31\n 10.93M12 17.75C14 17.75 14.5 17 14.5 17C14.5 17 14 19 12 19C10 19 9.5\n 17.03 9.5 17C9.5 17 10 17.75 12 17.75M17.75 9.34C18.97 10.1 19.13 12.05\n 18.11 13.69C17.08 15.33 15.26 16.04 14.04 15.28C12.82 14.5 12.67 12.57\n 13.69 10.93C14.71 9.29 16.53 8.58 17.75 9.34M12 20C14.5 20 20 14.86 20\n 11C20 7.14 16.41 4 12 4C7.59 4 4 7.14 4 11C4 14.86 9.5 20 12 20M12 2C17.5\n 2 22 6.04 22 11C22 15.08 16.32 22 12 22C7.68 22 2 15.08 2 11C2 6.04 6.5 2\n 12 2Z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},n="proto-sudoku",a=`${n}::data`,i=`${n}::inputs`,l=`${n}::pick`,c=t=>{const e=localStorage.getItem(t);return e?JSON.parse(e):void 0},d=(t,e)=>{const r=JSON.stringify(e);localStorage.setItem(t,r)},f=()=>[...c(i)],h=t=>{d(i,t.join(""))},u=()=>{const t=c(l);return null!==t?t:void 0},b=t=>{d(l,t>=0&&t<81?t:null)},p="Check ?",w="New Puzzle",g=t=>!("isConnected"in t)||t.isConnected,m=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys())t.set(e,t.get(e).filter(g))})(...e)}),2e3)}})(),y=t=>"function"==typeof t?t():t;class x extends Error{constructor(t,e,r){const o=`${t.status||0===t.status?t.status:""} ${t.statusText||""}`.trim();super(`Request failed with ${o?`status code ${o}`:"an unknown error"}: ${e.method} ${e.url}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=e,this.options=r}}class v extends Error{constructor(t){super(`Request timed out: ${t.method} ${t.url}`),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}}const C=t=>null!==t&&"object"==typeof t,k=(...t)=>{for(const e of t)if((!C(e)||Array.isArray(e))&&void 0!==e)throw new TypeError("The `options` argument must be an object");return j({},...t)},T=(t={},e={})=>{const r=new globalThis.Headers(t),o=e instanceof globalThis.Headers,s=new globalThis.Headers(e);for(const[t,e]of s.entries())o&&"undefined"===e||void 0===e?r.delete(t):r.set(t,e);return r},j=(...t)=>{let e={},r={};for(const o of t)if(Array.isArray(o))Array.isArray(e)||(e=[]),e=[...e,...o];else if(C(o)){for(let[t,r]of Object.entries(o))C(r)&&t in e&&(r=j(e[t],r)),e={...e,[t]:r};C(o.headers)&&(r=T(r,o.headers),e.headers=r)}return e},M=(()=>{let t=!1,e=!1;const r="function"==typeof globalThis.ReadableStream,o="function"==typeof globalThis.Request;if(r&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&"unsupported BodyInit type"===t.message)return!1;throw t}return t&&!e})(),R="function"==typeof globalThis.AbortController,z="function"==typeof globalThis.ReadableStream,S="function"==typeof globalThis.FormData,E=["get","post","put","patch","head","delete"],O={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},A=2147483647,P=Symbol("stop"),q={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},U={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},$=t=>E.includes(t)?t.toUpperCase():t,B=[413,429,503],N={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:B,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},_=(t={})=>{if("number"==typeof t)return{...N,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...N,...t,afterStatusCodes:B}};class D{static create(t,e){const r=new D(t,e),o=async()=>{if("number"==typeof r._options.timeout&&r._options.timeout>A)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let t=await r._fetch();for(const e of r._options.hooks.afterResponse){const o=await e(r.request,r._options,r._decorateResponse(t.clone()));o instanceof globalThis.Response&&(t=o)}if(r._decorateResponse(t),!t.ok&&r._options.throwHttpErrors){let e=new x(t,r.request,r._options);for(const t of r._options.hooks.beforeError)e=await t(e);throw e}if(r._options.onDownloadProgress){if("function"!=typeof r._options.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!z)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return r._stream(t.clone(),r._options.onDownloadProgress)}return t},s=r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(o):o();for(const[t,o]of Object.entries(O))s[t]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||o);const n=(await s).clone();if("json"===t){if(204===n.status)return"";if(0===(await n.clone().arrayBuffer()).byteLength)return"";if(e.parseJson)return e.parseJson(await n.text())}return n[t]()};return s}constructor(t,e={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;const r=this._input instanceof Request&&"credentials"in Request.prototype?this._input.credentials:void 0;if(this._options={...r&&{credentials:r},...e,headers:T(this._input.headers,e.headers),hooks:j({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},e.hooks),method:$(e.method??this._input.method),prefixUrl:String(e.prefixUrl||""),retry:_(e.retry),throwHttpErrors:!1!==e.throwHttpErrors,timeout:e.timeout??1e4,fetch:e.fetch??globalThis.fetch.bind(globalThis)},"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(R){if(this.abortController=new globalThis.AbortController,this._options.signal){const t=this._options.signal;this._options.signal.addEventListener("abort",(()=>{this.abortController.abort(t.reason)}))}this._options.signal=this.abortController.signal}if(M&&(this._options.duplex="half"),void 0!==this._options.json&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const t="string"==typeof this._options.searchParams?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),e=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,"?"+t);!(S&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(e,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof v)){if(t instanceof x){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;const e=t.response.headers.get("Retry-After");if(e&&this._options.retry.afterStatusCodes.includes(t.response.status)){let t=1e3*Number(e);Number.isNaN(t)&&(t=Date.parse(e)-Date.now());const r=this._options.retry.maxRetryAfter??t;return t<r?t:r}if(413===t.response.status)return 0}const e=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,e)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(e){const r=Math.min(this._calculateRetryDelay(e),A);if(0!==r&&this._retryCount>0){await async function(t,{signal:e}){return new Promise(((r,o)=>{function s(){clearTimeout(n),o(e.reason)}e&&(e.throwIfAborted(),e.addEventListener("abort",s,{once:!0}));const n=setTimeout((()=>{e?.removeEventListener("abort",s),r()}),t)}))}(r,{signal:this._options.signal});for(const t of this._options.hooks.beforeRetry)if(await t({request:this.request,options:this._options,error:e,retryCount:this._retryCount})===P)return;return this._retry(t)}throw e}}async _fetch(){for(const t of this._options.hooks.beforeRequest){const e=await t(this.request,this._options);if(e instanceof Request){this.request=e;break}if(e instanceof Response)return e}const t=((t,e)=>{const r={};for(const o in e)o in U||o in q||o in t||(r[o]=e[o]);return r})(this.request,this._options),e=this.request;return this.request=e.clone(),!1===this._options.timeout?this._options.fetch(e,t):async function(t,e,r,o){return new Promise(((s,n)=>{const a=setTimeout((()=>{r&&r.abort(),n(new v(t))}),o.timeout);o.fetch(t,e).then(s).catch(n).then((()=>{clearTimeout(a)}))}))}(e,t,this.abortController,this._options)}_stream(t,e){const r=Number(t.headers.get("content-length"))||0;let o=0;return 204===t.status?(e&&e({percent:1,totalBytes:r,transferredBytes:o},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(s){const n=t.body.getReader();e&&e({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array),await async function t(){const{done:a,value:i}=await n.read();a?s.close():(e&&(o+=i.byteLength,e({percent:0===r?0:o/r,transferredBytes:o,totalBytes:r},i)),s.enqueue(i),await t())}()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}}
|
2
|
-
/*! MIT License © Sindre Sorhus */const H=t=>{const e=(e,r)=>D.create(e,k(t,r));for(const r of E)e[r]=(e,o)=>D.create(e,k(t,o,{method:r}));return e.create=t=>H(k(t)),e.extend=e=>H(k(t,e)),e.stop=P,e},L=H(),J={list:[],keys:[],locs:[],loading:!1,solved:!1,error:void 0,pick:void 0,data:void 0},{state:I}=(()=>{const t=((t,e=((t,e)=>t!==e))=>{const r=y(t);let o=new Map(Object.entries(null!=r?r:{}));const s={dispose:[],get:[],set:[],reset:[]},n=()=>{var e;o=new Map(Object.entries(null!==(e=y(t))&&void 0!==e?e:{})),s.reset.forEach((t=>t()))},a=t=>(s.get.forEach((e=>e(t))),o.get(t)),i=(t,r)=>{const n=o.get(t);e(r,n,t)&&(o.set(t,r),s.set.forEach((e=>e(t,r,n))))},l="undefined"==typeof Proxy?{}:new Proxy(r,{get:(t,e)=>a(e),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>o.has(e),set:(t,e,r)=>(i(e,r),!0)}),c=(t,e)=>(s[t].push(e),()=>{((t,e)=>{const r=t.indexOf(e);r>=0&&(t[r]=t[t.length-1],t.length--)})(s[t],e)});return{state:l,get:a,set:i,on:c,onChange:(e,r)=>{const o=c("set",((t,o)=>{t===e&&r(o)})),s=c("reset",(()=>r(y(t)[e])));return()=>{o(),s()}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(c("set",e.set)),e.get&&t.push(c("get",e.get)),e.reset&&t.push(c("reset",e.reset)),e.dispose&&t.push(c("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{s.dispose.forEach((t=>t())),n()},reset:n,forceUpdate:t=>{const e=o.get(t);s.set.forEach((r=>r(t,e,e)))}}})(J,void 0);return t.use((()=>{if("function"!=typeof e)return{};const t=new Map;return{dispose:()=>t.clear(),get:r=>{const o=e();o&&((t,e,r)=>{const o=t.get(e);o?o.includes(r)||o.push(r):t.set(e,[r])})(t,r,o)},set:e=>{const o=t.get(e);o&&t.set(e,o.filter(r)),m(t)},reset:()=>{t.forEach((t=>t.forEach(r))),m(t)}}})()),t})(),W=new Map([["row",new Map],["column",new Map],["box",new Map]]),X=["1","2","3","4","5","6","7","8","9"],Z=t=>{if(void 0!==t&&t.indx!=I.pick){const{isClue:e,indx:r,row:o,column:s,box:n}=t,a=((t,e,r,o)=>{const s=new Map([["row",e],["column",r],["box",o]]),n=new Set;return s.forEach(((e,r)=>{W.get(r).get(e).forEach((e=>{e!==t&&n.add(e)}))})),Array.from(n)})(r,o,s,n),i=e?[]:(t=>{const{list:e}=I,r=new Set;return t.map((t=>{const{key:o}=e[t];"."!=o&&r.add(o)})),X.filter((t=>!r.has(t)))})(a);I.pick=r,I.keys=i,I.locs=a}else I.pick=void 0,I.keys=[],I.locs=[];F(I.pick)};let K;const V={netlify:"/.netlify/functions",vercel:"https://sudoku-rust-api.vercel.app/api"},Y=t=>{h(t)},F=t=>{b(t)},G=(t=!1)=>{I.list=[],I.keys=[],I.locs=[],I.loading=t,I.solved=!1,I.error=void 0,I.pick=void 0,I.data=void 0},Q=(t,e=!0)=>{const{puzzle:r,ref:o}=t;e&&(h([]),d(a,t)),(t=>{if(t){const{puzzle:e,ref:r}=t,o=e?[...e]:[],s=r?atob(r):void 0,n=s?[...s]:[],a=o.map(((t,e)=>{const r=n[e],o=t===r,s=Math.floor(e/9),a=e%9,i=((t,e)=>e<3?t<3?0:t<6?3:6:e<6?t<3?1:t<6?4:7:t<3?2:t<6?5:8)(s,a);return((t,e,r,o)=>{new Map([["row",e],["column",r],["box",o]]).forEach(((e,r)=>{const o=W.get(r);o.has(e)?o.get(e).add(t):o.set(e,new Set([t]))}))})(e,s,a,i),{key:t,isClue:o,value:r,indx:e,row:s,column:a,box:i}}));(t=>{f().forEach(((e,r)=>{const o=t[r],{isClue:s}=o;s||(o.key=e)}))})(a),I.data=t,I.list=a}else I.data=void 0,I.list=[]})({puzzle:r,ref:o})},tt=t=>{I.list=[...t],t.length=0},et={initApp:t=>{(t=>{const e=(t=>{const e=Object.keys(V).includes(t)?t:"vercel";return V[e]})(t);K=L.extend({hooks:{beforeRequest:[t=>{t.headers.set("X-Requested-With","ky"),t.headers.set("X-Custom-Header","foobar")}]},prefixUrl:e,timeout:1e4})})(t),G();const e=c(a),r=u();if(e&&(Q(e,!1),r>=0)){const{list:t}=I;Z(t[r])}},refresh:async()=>{G(!0),Y([]),F(I.pick);try{const t=await K.get("puzzle").json();Q(t)}catch(t){const{message:e}=t;console.log("-- ",e),console.log(t),I.error=e}finally{I.loading=!1}},select:t=>{Z(t)},check:()=>{const{list:t}=I,e=[];let r=0,o=0,s=0;t.forEach((t=>{const{key:n,value:a,isClue:i}=t;i?s+=1:"."!==n&&(n!==a?(r+=1,t.key="."):o+=1),e.push(t.key)}));const n=s+o;Y(o?e:[]),r>0?tt(t):81===n&&(I.solved=!0)},input:t=>{const{pick:e,list:r}=I;r[e].key=t,tt(r)}},rt=(...t)=>t.filter(Boolean).join(" "),ot=e=>{const r=e.hex||"currentColor",o=e.label||"loading...",s=e.size||24;return t("svg",{class:rt(e.class||"","animate-spin"),width:s,height:s,fill:"none",viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,o),t("g",null,t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:r,"stroke-width":"4"}),t("path",{class:"opacity-75",fill:r,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},st=e=>{const{message:r,salute:o,spinner:n=!1}=e;return t("div",{class:"mt-5 flex h-24px flex-row items-center"},t(n?ot:s,{class:"mr-2"}),o?t("label",{class:"mr-1 font-bold"},o,":"):"",t("label",{class:"italic"},r))},nt=()=>{const{solved:e,loading:r,error:o}=I;return t("div",{class:"flex flex-col"},r||o||e?"":t(st,{message:"Welcome, are you ready to play?..."}),r?t(st,{message:"Loading...",spinner:!0}):"",o?t(st,{message:o,salute:"ERROR"}):"",e?t(st,{message:"You solved the puzzle!!"}):"")},at=e=>{const r=e.hex||"currentColor",o=e.size||24;return t("svg",{class:e.class,width:o,height:o,viewBox:"0 0 24 24",role:"img","aria-label":"title"},t("title",null,e.label||"fingerprint"),t("g",{fill:r},t("path",{d:"M17.81,4.47C17.73,4.47 17.65,4.45 17.58,4.41C15.66,3.42 14,3\n 12,3C10.03,3 8.15,3.47 6.44,4.41C6.2,4.54 5.9,4.45 5.76,4.21C5.63,3.97\n 5.72,3.66 5.96,3.53C7.82,2.5 9.86,2 12,2C14.14,2 16,2.47\n 18.04,3.5C18.29,3.65 18.38,3.95 18.25,4.19C18.16,4.37 18,4.47\n 17.81,4.47M3.5,9.72C3.4,9.72 3.3,9.69 3.21,9.63C3,9.47 2.93,9.16\n 3.09,8.93C4.08,7.53 5.34,6.43 6.84,5.66C10,4.04 14,4.03\n 17.15,5.65C18.65,6.42 19.91,7.5 20.9,8.9C21.06,9.12 21,9.44\n 20.78,9.6C20.55,9.76 20.24,9.71 20.08,9.5C19.18,8.22 18.04,7.23\n 16.69,6.54C13.82,5.07 10.15,5.07 7.29,6.55C5.93,7.25 4.79,8.25\n 3.89,9.5C3.81,9.65 3.66,9.72 3.5,9.72M9.75,21.79C9.62,21.79 9.5,21.74\n 9.4,21.64C8.53,20.77 8.06,20.21 7.39,19C6.7,17.77 6.34,16.27\n 6.34,14.66C6.34,11.69 8.88,9.27 12,9.27C15.12,9.27 17.66,11.69\n 17.66,14.66A0.5,0.5 0 0,1 17.16,15.16A0.5,0.5 0 0,1\n 16.66,14.66C16.66,12.24 14.57,10.27 12,10.27C9.43,10.27 7.34,12.24\n 7.34,14.66C7.34,16.1 7.66,17.43 8.27,18.5C8.91,19.66 9.35,20.15\n 10.12,20.93C10.31,21.13 10.31,21.44 10.12,21.64C10,21.74 9.88,21.79\n 9.75,21.79M16.92,19.94C15.73,19.94 14.68,19.64 13.82,19.05C12.33,18.04\n 11.44,16.4 11.44,14.66A0.5,0.5 0 0,1 11.94,14.16A0.5,0.5 0 0,1\n 12.44,14.66C12.44,16.07 13.16,17.4 14.38,18.22C15.09,18.7 15.92,18.93\n 16.92,18.93C17.16,18.93 17.56,18.9 17.96,18.83C18.23,18.78 18.5,18.96\n 18.54,19.24C18.59,19.5 18.41,19.77 18.13,19.82C17.56,19.93 17.06,19.94\n 16.92,19.94M14.91,22C14.87,22 14.82,22 14.78,22C13.19,21.54 12.15,20.95\n 11.06,19.88C9.66,18.5 8.89,16.64 8.89,14.66C8.89,13.04 10.27,11.72\n 11.97,11.72C13.67,11.72 15.05,13.04 15.05,14.66C15.05,15.73 16,16.6\n 17.13,16.6C18.28,16.6 19.21,15.73 19.21,14.66C19.21,10.89 15.96,7.83\n 11.96,7.83C9.12,7.83 6.5,9.41 5.35,11.86C4.96,12.67 4.76,13.62\n 4.76,14.66C4.76,15.44 4.83,16.67 5.43,18.27C5.53,18.53 5.4,18.82\n 5.14,18.91C4.88,19 4.59,18.87 4.5,18.62C4,17.31 3.77,16\n 3.77,14.66C3.77,13.46 4,12.37 4.45,11.42C5.78,8.63 8.73,6.82\n 11.96,6.82C16.5,6.82 20.21,10.33 20.21,14.65C20.21,16.27 18.83,17.59\n 17.13,17.59C15.43,17.59 14.05,16.27 14.05,14.65C14.05,13.58 13.12,12.71\n 11.97,12.71C10.82,12.71 9.89,13.58 9.89,14.65C9.89,16.36 10.55,17.96\n 11.76,19.16C12.71,20.1 13.62,20.62 15.03,21C15.3,21.08 15.45,21.36\n 15.38,21.62C15.33,21.85 15.12,22 14.91,22Z"})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},it="eswat2",lt=()=>t("a",{class:"absolute right-0 top-0 text-clrs-gray hover:text-clrs-navy",href:"https://eswat2.dev","aria-label":it,target:"blank",title:it},t(at,{label:it})),ct=(e,r)=>t("h1",{class:rt("text-center uppercase text-clrs-red","mb-11 ml-0 mr-0 mt-11","text-6xl font-thin")},r),dt=e=>{const{label:r,callback:o,matched:s=!1}=e;return t("button",{class:rt("rounded-md border border-solid border-clrs-slate4 font-bold",r===p?"mr-2 bg-clrs-yellow px-3 py-2 text-clrs-navy":r===w?"mr-2 bg-clrs-navy px-3 py-2 text-white":"x"===r?"mr-1 bg-clrs-red px-2 py-1 text-white":s?"mr-1 bg-clrs-slate4 px-2 py-1 text-white":"mr-1 bg-gray-50 px-2 py-1 text-clrs-navy"),onClick:o},r)},ft=()=>{const{keys:e,list:r,pick:o,solved:s}=I,n=t=>()=>{et.input(t)},a=s?[]:e,i=null!=o?r[o]:void 0;return t("div",{class:"mt-2 flex flex-row justify-end"},s||!i||i.isClue||"."==i.key?"":t(dt,{label:"x",callback:n(".")}),a.map((e=>t(dt,{label:e,callback:n(e),matched:i.key===e}))))},ht=[2,5,11,14,20,23,29,32,38,41,47,50,56,59,65,68,74,77],ut=ht.map((t=>t+1)),bt=[18,19,20,21,22,23,24,25,26,45,46,47,48,49,50,51,52,53],pt=bt.map((t=>t+9)),wt=e=>{const{cell:r,focus:o,selected:s,solved:n}=e,{key:a,isClue:i,indx:l}=r,c="."!=a?a:"";return t("label",{class:rt(`cell-${l}`,ht.includes(l)?"border-xbr-clrs-navy":"",ut.includes(l)?"border-xbl-clrs-navy":"",bt.includes(l)?"border-xbb-clrs-navy":"",pt.includes(l)?"border-xbt-clrs-navy":"","h-8 w-8 border border-solid text-center leading-8",s?"border-clrs-red bg-clrs-red-a50 text-clrs-red":o?"border-clrs-gray bg-clrs-green-a50 font-bold":i?"border-clrs-gray bg-clrs-silver":""!==c?"border-clrs-gray text-clrs-red":"border-clrs-gray"),onClick:((t,e)=>()=>{e||et.select(t)})(r,n)},c)},gt=()=>{const{list:e,pick:r,locs:o,solved:s}=I;return t("div",{class:rt("flex flex-row flex-wrap","border border-solid border-clrs-navy","h-76p5 w-76p5 text-lg")},e.map(((e,n)=>{const a=!s&&n===r,i=!s&&o.includes(n);return t(wt,{cell:e,focus:i,selected:a,solved:s})})))},mt=()=>t("label",{class:"ml-auto align-top text-xs italic text-clrs-slate4"},"Tailwind ","3.4.7"),yt=t=>()=>{t.refresh()},xt=t=>()=>{t.check()},vt=()=>{const{list:e,solved:r}=I;return t("div",{class:"flex flex-row"},t(dt,{label:w,callback:yt(et)}),81!==e.length||r?"":t(dt,{label:p,callback:xt(et)}),t(mt,null))},Ct=class{constructor(t){o(this,t),this.tag="proto-sudoku",this.platform="vercel"}componentDidLoad(){et.initApp(this.platform)}render(){return t("div",{key:"9f50eec975c4da5f4984b80380067d5155dda0d1",id:"app",class:"ds1-main relative max-w-min p-0.5"},t(lt,{key:"e7bab7e257022a9920f8b43785d9dc33ab7fed65"}),t(ct,{key:"d8c32e6b9c20b9fe6c8ff2e9fc7a9900057a2679"},"Sudoku"),t(gt,{key:"8a028015ae4380aaa54a406ccf5cc908816ca6a4"}),t(ft,{key:"951b6d20ca7a99ced4c60aa39fe040af6e96dd46"}),t("hr",{key:"35ba2812a3b068b21b5252c5f07d0b5dc2f18527",class:"ml-0 mr-0"}),t(vt,{key:"114e7edd4bf3da82ae344f56cb7e856ce17a6da8"}),t(nt,{key:"2c15eb0ba714d1e0c378882c62ce575c428adc2a"}))}};Ct.style="*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.ds1-main{margin:1.5rem;display:flex;flex-direction:column;font-family:ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';color:var(--clrs-navy, #001f3f);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.absolute{position:absolute}.relative{position:relative}.right-0{right:0px}.top-0{top:0px}.mb-11{margin-bottom:2.75rem}.ml-0{margin-left:0px}.ml-auto{margin-left:auto}.mr-0{margin-right:0px}.mr-1{margin-right:0.25rem}.mr-2{margin-right:0.5rem}.mt-11{margin-top:2.75rem}.mt-2{margin-top:0.5rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.h-24px{height:24px}.h-76p5{height:19.125rem}.h-8{height:2rem}.w-76p5{width:19.125rem}.w-8{width:2rem}.max-w-min{max-width:-moz-min-content;max-width:min-content}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.rounded-md{border-radius:0.375rem}.border{border-width:1px}.border-solid{border-style:solid}.border-clrs-gray{border-color:var(--clrs-gray, #aaaaaa)}.border-clrs-navy{border-color:var(--clrs-navy, #001f3f)}.border-clrs-red{border-color:var(--clrs-red, #ff4136)}.border-clrs-slate4{border-color:var(--clrs-slate4, #4e5964)}.bg-clrs-green-a50{background-color:var(--clrs-green-a50, #2ecc4050)}.bg-clrs-navy{background-color:var(--clrs-navy, #001f3f)}.bg-clrs-red{background-color:var(--clrs-red, #ff4136)}.bg-clrs-red-a50{background-color:var(--clrs-red-a50, #ff413650)}.bg-clrs-silver{background-color:var(--clrs-silver, #dddddd)}.bg-clrs-slate4{background-color:var(--clrs-slate4, #4e5964)}.bg-clrs-yellow{background-color:var(--clrs-yellow, #ffdc00)}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.p-0\\.5{padding:0.125rem}.px-2{padding-left:0.5rem;padding-right:0.5rem}.px-3{padding-left:0.75rem;padding-right:0.75rem}.py-1{padding-top:0.25rem;padding-bottom:0.25rem}.py-2{padding-top:0.5rem;padding-bottom:0.5rem}.text-center{text-align:center}.align-top{vertical-align:top}.text-6xl{font-size:3.75rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xs{font-size:0.75rem;line-height:1rem}.font-bold{font-weight:700}.font-thin{font-weight:100}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-8{line-height:2rem}.text-clrs-gray{color:var(--clrs-gray, #aaaaaa)}.text-clrs-navy{color:var(--clrs-navy, #001f3f)}.text-clrs-red{color:var(--clrs-red, #ff4136)}.text-clrs-slate4{color:var(--clrs-slate4, #4e5964)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-25{opacity:0.25}.opacity-75{opacity:0.75}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),\n 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.border-xbb-clrs-navy{border-bottom:1px solid var(--clrs-navy, #001f3f) !important}.border-xbt-clrs-navy{border-top:1px solid var(--clrs-navy, #001f3f) !important}.border-xbl-clrs-navy{border-left:1px solid var(--clrs-navy, #001f3f) !important}.border-xbr-clrs-navy{border-right:1px solid var(--clrs-navy, #001f3f) !important}.hover\\:text-clrs-navy:hover{color:var(--clrs-navy, #001f3f)}";export{Ct as proto_sudoku}
|