@mborecki/memory-game 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  2. package/dist/cjs/index-D_ddvJ2f.js +3228 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +13 -0
  5. package/dist/cjs/mb-memory-game.cjs.entry.js +213 -0
  6. package/dist/cjs/memory-game.cjs.js +25 -0
  7. package/dist/collection/collection-manifest.json +12 -0
  8. package/dist/collection/components/sliding-puzzle/memory-game.css +72 -0
  9. package/dist/collection/components/sliding-puzzle/memory-game.js +357 -0
  10. package/dist/collection/components/sliding-puzzle/tile.js +16 -0
  11. package/dist/collection/components/sliding-puzzle/types.js +1 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/get-set.js +23 -0
  14. package/dist/collection/utils/get-set.test.js +31 -0
  15. package/dist/components/index.d.ts +35 -0
  16. package/dist/components/index.js +1 -0
  17. package/dist/components/mb-memory-game.d.ts +11 -0
  18. package/dist/components/mb-memory-game.js +1 -0
  19. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  20. package/dist/esm/index-D2pBOsDL.js +3221 -0
  21. package/dist/esm/index.js +1 -0
  22. package/dist/esm/loader.js +11 -0
  23. package/dist/esm/mb-memory-game.entry.js +211 -0
  24. package/dist/esm/memory-game.js +21 -0
  25. package/dist/index.cjs.js +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/memory-game/index.esm.js +0 -0
  28. package/dist/memory-game/memory-game.esm.js +1 -0
  29. package/dist/memory-game/p-35b15a0c.entry.js +1 -0
  30. package/dist/memory-game/p-D2pBOsDL.js +2 -0
  31. package/dist/memory-game/p-DQuL1Twl.js +1 -0
  32. package/dist/types/components/sliding-puzzle/memory-game.d.ts +28 -0
  33. package/dist/types/components/sliding-puzzle/tile.d.ts +10 -0
  34. package/dist/types/components/sliding-puzzle/types.d.ts +24 -0
  35. package/dist/types/components.d.ts +84 -0
  36. package/dist/types/index.d.ts +10 -0
  37. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/apps/memory-game/vitest.config.d.ts +2 -0
  38. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/src/grid.d.ts +19 -0
  39. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/src/grid.test.d.ts +1 -0
  40. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/vitest.config.d.ts +2 -0
  41. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/src/vec2.d.ts +29 -0
  42. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/src/vec2.test.d.ts +1 -0
  43. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/vitest.config.d.ts +2 -0
  44. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  45. package/dist/types/utils/get-set.d.ts +1 -0
  46. package/dist/types/utils/get-set.test.d.ts +1 -0
  47. package/dist/vitest.config.js +4 -0
  48. package/loader/cdn.js +1 -0
  49. package/loader/index.cjs.js +1 -0
  50. package/loader/index.d.ts +24 -0
  51. package/loader/index.es2017.js +1 -0
  52. package/loader/index.js +2 -0
  53. package/package.json +53 -0
@@ -0,0 +1,16 @@
1
+ import { h } from "@stencil/core";
2
+ export function Tile({ tile, selected, matched, uncovered, reversTile }) {
3
+ return h("div", { class: {
4
+ 'tile-container': true,
5
+ selected,
6
+ matched
7
+ } }, h(TileRender, { tile: uncovered ? tile.data : reversTile }));
8
+ }
9
+ function TileRender({ tile }) {
10
+ if (tile.type === 'text') {
11
+ return h("button", { class: "tile tile-text" }, tile.text);
12
+ }
13
+ if (tile.type === 'image') {
14
+ return h("button", { class: "tile tile-image" }, h("img", { src: tile.imageSrc }));
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ export function getSet(items, count) {
2
+ console.log('getSet', items, count);
3
+ if (items.length <= 0)
4
+ throw new Error("getSet() - no items");
5
+ if (items.length === count) {
6
+ return [...items];
7
+ }
8
+ let result = [];
9
+ while (count - result.length > items.length) {
10
+ result = [
11
+ ...result,
12
+ ...items
13
+ ];
14
+ }
15
+ const rest = new Set();
16
+ while (rest.size < count - result.length) {
17
+ rest.add(items[Math.floor(Math.random() * items.length)]);
18
+ }
19
+ return [
20
+ ...result,
21
+ ...rest
22
+ ];
23
+ }
@@ -0,0 +1,31 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { getSet } from "./get-set";
3
+ describe('getSet()', () => {
4
+ it('items.length === count', () => {
5
+ const items = [1, 2, 3, 4, 5];
6
+ const result = getSet(items, 5);
7
+ expect(result).toMatchObject([1, 2, 3, 4, 5]);
8
+ expect(result).not.toBe(items);
9
+ });
10
+ it('items.length === 1', () => {
11
+ const items = [1];
12
+ const result = getSet(items, 5);
13
+ expect(result).toMatchObject([1, 1, 1, 1, 1]);
14
+ });
15
+ it('items.length < count', () => {
16
+ const items = [1, 2, 3, 4, 5];
17
+ const result = getSet(items, 3);
18
+ expect(result.length).toBe(3);
19
+ expect((new Set(result)).size).toBe(3);
20
+ });
21
+ it('items.length > count', () => {
22
+ const items = [1, 2, 3, 4, 5];
23
+ const result = getSet(items, 12);
24
+ expect(result.length).toBe(12);
25
+ expect([2, 3].includes(result.filter(i => i === 1).length)).toBeTruthy();
26
+ expect([2, 3].includes(result.filter(i => i === 2).length)).toBeTruthy();
27
+ expect([2, 3].includes(result.filter(i => i === 3).length)).toBeTruthy();
28
+ expect([2, 3].includes(result.filter(i => i === 4).length)).toBeTruthy();
29
+ expect([2, 3].includes(result.filter(i => i === 5).length)).toBeTruthy();
30
+ });
31
+ });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get the base path to where the assets can be found. Use "setAssetPath(path)"
3
+ * if the path needs to be customized.
4
+ */
5
+ export declare const getAssetPath: (path: string) => string;
6
+
7
+ /**
8
+ * Used to manually set the base path where assets can be found.
9
+ * If the script is used as "module", it's recommended to use "import.meta.url",
10
+ * such as "setAssetPath(import.meta.url)". Other options include
11
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
12
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
13
+ * But do note that this configuration depends on how your script is bundled, or lack of
14
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
15
+ * will have to ensure the static assets are copied to its build directory.
16
+ */
17
+ export declare const setAssetPath: (path: string) => void;
18
+
19
+ /**
20
+ * Used to specify a nonce value that corresponds with an application's CSP.
21
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
22
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
23
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
24
+ * will result in the same behavior.
25
+ */
26
+ export declare const setNonce: (nonce: string) => void
27
+
28
+ export interface SetPlatformOptions {
29
+ raf?: (c: FrameRequestCallback) => number;
30
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
31
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
32
+ }
33
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
34
+
35
+ export * from '../types';
@@ -0,0 +1 @@
1
+ var t,e,n,i,s,r,o,l,h,c,f,u,a,p,d,v,m,b=Object.create,w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,$=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,j=t=>{throw TypeError(t)},S=(t,e)=>function(){return e||(0,t[y(t)[0]])((e={exports:{}}).exports,e),e.exports},E=(t,e,n)=>e.has(t)||j("Cannot "+n),M=(t,e,n)=>(E(t,e,"read from private field"),n?n.call(t):e.get(t)),k=(t,e,n)=>e.has(t)?j("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),x=(t,e,n)=>(E(t,e,"write to private field"),e.set(t,n),n),N=(t,e,n)=>(E(t,e,"access private method"),n),P=S({"node_modules/balanced-match/index.js"(t,e){function n(t,e,n){t instanceof RegExp&&(t=i(t,n)),e instanceof RegExp&&(e=i(e,n));var r=s(t,e,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+t.length,r[1]),post:n.slice(r[1]+e.length)}}function i(t,e){var n=e.match(t);return n?n[0]:null}function s(t,e,n){var i,s,r,o,l,h=n.indexOf(t),c=n.indexOf(e,h+1),f=h;if(h>=0&&c>0){if(t===e)return[h,c];for(i=[],r=n.length;f>=0&&!l;)f==h?(i.push(f),h=n.indexOf(t,f+1)):1==i.length?l=[i.pop(),c]:((s=i.pop())<r&&(r=s,o=c),c=n.indexOf(e,f+1)),f=h<c&&h>=0?h:c;i.length&&(l=[r,o])}return l}e.exports=n,n.range=s}}),W=S({"node_modules/brace-expansion/index.js"(t,e){var n=P();e.exports=function(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),v(function(t){return t.split("\\\\").join(i).split("\\{").join(s).split("\\}").join(r).split("\\,").join(o).split("\\.").join(l)}(t),!0).map(c)):[]};var i="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",r="\0CLOSE"+Math.random()+"\0",o="\0COMMA"+Math.random()+"\0",l="\0PERIOD"+Math.random()+"\0";function h(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function c(t){return t.split(i).join("\\").split(s).join("{").split(r).join("}").split(o).join(",").split(l).join(".")}function f(t){if(!t)return[""];var e=[],i=n("{","}",t);if(!i)return t.split(",");var s=i.body,r=i.post,o=i.pre.split(",");o[o.length-1]+="{"+s+"}";var l=f(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),e.push.apply(e,o),e}function u(t){return"{"+t+"}"}function a(t){return/^-?0\d/.test(t)}function p(t,e){return t<=e}function d(t,e){return t>=e}function v(t,e){var i=[],s=n("{","}",t);if(!s)return[t];var o=s.pre,l=s.post.length?v(s.post,!1):[""];if(/\$$/.test(s.pre))for(var c=0;c<l.length;c++)i.push(A=o+"{"+s.body+"}"+l[c]);else{var m,b,w=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),y=w||g,$=s.body.indexOf(",")>=0;if(!y&&!$)return s.post.match(/,(?!,).*\}/)?v(t=s.pre+"{"+s.body+r+s.post):[t];if(y)m=s.body.split(/\.\./);else if(1===(m=f(s.body)).length&&1===(m=v(m[0],!1).map(u)).length)return l.map((function(t){return s.pre+m[0]+t}));if(y){var O=h(m[0]),j=h(m[1]),S=Math.max(m[0].length,m[1].length),E=3==m.length?Math.abs(h(m[2])):1,M=p;j<O&&(E*=-1,M=d);var k=m.some(a);b=[];for(var x=O;M(x,j);x+=E){var N;if(g)"\\"===(N=String.fromCharCode(x))&&(N="");else if(N=x+"",k){var P=S-N.length;if(P>0){var W=Array(P+1).join("0");N=x<0?"-"+W+N.slice(1):W+N}}b.push(N)}}else{b=[];for(var R=0;R<m.length;R++)b.push.apply(b,v(m[R],!1))}for(R=0;R<b.length;R++)for(c=0;c<l.length;c++){var A=o+b[R]+l[c];(!e||y||A)&&i.push(A)}}return i}}}),R=(t,e)=>{var n;Object.entries(null!=(n=e.i.t)?n:{}).map((([n,[i]])=>{if(31&i||32&i){const i=t[n],s=function(t,e){for(;t;){const n=Object.getOwnPropertyDescriptor(t,e);if(null==n?void 0:n.get)return n;t=Object.getPrototypeOf(t)}}(Object.getPrototypeOf(t),n)||Object.getOwnPropertyDescriptor(t,n);s&&Object.defineProperty(t,n,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),t[n]=e.o.has(n)?e.o.get(n):i}}))},A=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},C=(t,e)=>e in t,z=(t,e)=>(0,console.error)(t,e),L=new Map,_="undefined"!=typeof window?window:{},T=_.HTMLElement||class{},D={l:0,h:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,i)=>t.addEventListener(e,n,i),rel:(t,e,n,i)=>t.removeEventListener(e,n,i),ce:(t,e)=>new CustomEvent(t,e)},U=(()=>{try{return!!_.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),F=!!U&&(()=>!!_.document&&Object.getOwnPropertyDescriptor(_.document.adoptedStyleSheets,"length").writable)(),G=!1,I=[],Z=[],H=(t,e)=>n=>{t.push(n),G||(G=!0,e&&4&D.l?B(q):D.raf(q))},V=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){z(t)}t.length=0},q=()=>{V(I),V(Z),(G=I.length>0)&&D.raf(q)},B=t=>Promise.resolve(void 0).then(t),J=H(Z,!0),Y=t=>{const e=new URL(t,D.h);return e.origin!==_.location.origin?e.href:e.pathname},K=t=>D.h=t,Q=t=>"object"==(t=typeof t)||"function"===t,X=((t,e,n)=>(n=null!=t?b($(t)):{},((t,e,n,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of y(e))O.call(t,n)||undefined===n||w(t,n,{get:()=>e[n],enumerable:!(i=g(e,n))||i.enumerable});return t})(w(n,"default",{value:t,enumerable:!0}),t)))(W()),tt=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},et={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},nt=t=>t.replace(/[[\]\\-]/g,"\\$&"),it=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),st=t=>t.join(""),rt=(t,e)=>{const n=e;if("["!==t.charAt(n))throw Error("not in a brace expression");const i=[],s=[];let r=n+1,o=!1,l=!1,h=!1,c=!1,f=n,u="";t:for(;r<t.length;){const e=t.charAt(r);if("!"!==e&&"^"!==e||r!==n+1){if("]"===e&&o&&!h){f=r+1;break}if(o=!0,"\\"!==e||h){if("["===e&&!h)for(const[e,[o,h,c]]of Object.entries(et))if(t.startsWith(e,r)){if(u)return["$.",!1,t.length-n,!0];r+=e.length,c?s.push(o):i.push(o),l=l||h;continue t}h=!1,u?(e>u?i.push(nt(u)+"-"+nt(e)):e===u&&i.push(nt(e)),u="",r++):t.startsWith("-]",r+1)?(i.push(nt(e+"-")),r+=2):t.startsWith("-",r+1)?(u=e,r+=2):(i.push(nt(e)),r++)}else h=!0,r++}else c=!0,r++}if(f<r)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,t.length-n,!0];if(0===s.length&&1===i.length&&/^\\?.$/.test(i[0])&&!c){const t=2===i[0].length?i[0].slice(-1):i[0];return[it(t),!1,f-n,!1]}const a="["+(c?"^":"")+st(i)+"]",p="["+(c?"":"^")+st(s)+"]";return[i.length&&s.length?"("+a+"|"+p+")":i.length?a:p,l,f-n,!0]},ot=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),lt=new Set(["!","?","+","*","@"]),ht=t=>lt.has(t),ct="(?!\\.)",ft=new Set(["[","."]),ut=new Set(["..","."]),at=new Set("().*{}+?[]^$\\!"),pt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),dt="[^/]",vt=dt+"*?",mt=dt+"+?",bt=class b{constructor(a,p,d={}){k(this,u),((t,e,n)=>{((t,e,n)=>{e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,e+"",n)})(this,"type"),k(this,t),k(this,e),k(this,n,!1),k(this,i,[]),k(this,s),k(this,r),k(this,o),k(this,l,!1),k(this,h),k(this,c),k(this,f,!1),this.type=a,a&&x(this,e,!0),x(this,s,p),x(this,t,M(this,s)?M(M(this,s),t):this),x(this,h,M(this,t)===this?d:M(M(this,t),h)),x(this,o,M(this,t)===this?[]:M(M(this,t),o)),"!"!==a||M(M(this,t),l)||M(this,o).push(this),x(this,r,M(this,s)?M(M(this,s),i).length:0)}get hasMagic(){if(void 0!==M(this,e))return M(this,e);for(const t of M(this,i))if("string"!=typeof t&&(t.type||t.hasMagic))return x(this,e,!0);return M(this,e)}toString(){return void 0!==M(this,c)?M(this,c):x(this,c,this.type?this.type+"("+M(this,i).map((t=>t+"")).join("|")+")":M(this,i).map((t=>t+"")).join(""))}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof b&&M(e,s)===this))throw Error("invalid part: "+e);M(this,i).push(e)}}toJSON(){var e;const n=null===this.type?M(this,i).slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...M(this,i).map((t=>t.toJSON()))];return this.isStart()&&!this.type&&n.unshift([]),this.isEnd()&&(this===M(this,t)||M(M(this,t),l)&&"!"===(null==(e=M(this,s))?void 0:e.type))&&n.push({}),n}isStart(){var e;if(M(this,t)===this)return!0;if(!(null==(e=M(this,s))?void 0:e.isStart()))return!1;if(0===M(this,r))return!0;const n=M(this,s);for(let t=0;t<M(this,r);t++){const e=M(n,i)[t];if(!(e instanceof b&&"!"===e.type))return!1}return!0}isEnd(){var e,n,o;if(M(this,t)===this)return!0;if("!"===(null==(e=M(this,s))?void 0:e.type))return!0;if(!(null==(n=M(this,s))?void 0:n.isEnd()))return!1;if(!this.type)return null==(o=M(this,s))?void 0:o.isEnd();const l=M(this,s)?M(M(this,s),i).length:0;return M(this,r)===l-1}copyIn(t){this.push("string"==typeof t?t:t.clone(this))}clone(t){const e=new b(this.type,t);for(const t of M(this,i))e.copyIn(t);return e}static fromGlob(t,e={}){var n;const i=new b(null,void 0,e);return N(n=b,p,d).call(n,t,i,0,e),i}toMMPattern(){if(this!==M(this,t))return M(this,t).toMMPattern();const n=""+this,[i,s,r,o]=this.toRegExpSource();if(!(r||M(this,e)||M(this,h).nocase&&!M(this,h).nocaseMagicOnly&&n.toUpperCase()!==n.toLowerCase()))return s;const l=(M(this,h).nocase?"i":"")+(o?"u":"");return Object.assign(RegExp(`^${i}$`,l),{_src:i,_glob:n})}get options(){return M(this,h)}toRegExpSource(r){var o;const c=null!=r?r:!!M(this,h).dot;if(M(this,t)===this&&N(this,u,a).call(this),!this.type){const h=this.isStart()&&this.isEnd(),f=M(this,i).map((t=>{var i;const[s,o,l,c]="string"==typeof t?N(i=b,p,m).call(i,t,M(this,e),h):t.toRegExpSource(r);return x(this,e,M(this,e)||l),x(this,n,M(this,n)||c),s})).join("");let u="";if(this.isStart()&&"string"==typeof M(this,i)[0]&&(1!==M(this,i).length||!ut.has(M(this,i)[0]))){const t=ft,e=c&&t.has(f.charAt(0))||f.startsWith("\\.")&&t.has(f.charAt(2))||f.startsWith("\\.\\.")&&t.has(f.charAt(4)),n=!c&&!r&&t.has(f.charAt(0));u=e?"(?!(?:^|/)\\.\\.?(?:$|/))":n?ct:""}let a="";return this.isEnd()&&M(M(this,t),l)&&"!"===(null==(o=M(this,s))?void 0:o.type)&&(a="(?:$|\\/)"),[u+f+a,ot(f),x(this,e,!!M(this,e)),M(this,n)]}const d="*"===this.type||"+"===this.type,w="!"===this.type?"(?:(?!(?:":"(?:";let g=N(this,u,v).call(this,c);if(this.isStart()&&this.isEnd()&&!g&&"!"!==this.type){const t=""+this;return x(this,i,[t]),this.type=null,x(this,e,void 0),[t,ot(""+this),!1,!1]}let y=!d||r||c?"":N(this,u,v).call(this,!0);y===g&&(y=""),y&&(g=`(?:${g})(?:${y})*?`);let $="";return $="!"===this.type&&M(this,f)?(this.isStart()&&!c?ct:"")+mt:w+g+("!"===this.type?"))"+(!this.isStart()||c||r?"":ct)+vt+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&y?")":"*"===this.type&&y?")?":")"+this.type),[$,ot(g),x(this,e,!!M(this,e)),M(this,n)]}};t=new WeakMap,e=new WeakMap,n=new WeakMap,i=new WeakMap,s=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,u=new WeakSet,a=function(){if(this!==M(this,t))throw Error("should only call on root");if(M(this,l))return this;let e;for(x(this,l,!0);e=M(this,o).pop();){if("!"!==e.type)continue;let t=e,n=M(t,s);for(;n;){for(let s=M(t,r)+1;!n.type&&s<M(n,i).length;s++)for(const t of M(e,i)){if("string"==typeof t)throw Error("string part in extglob AST??");t.copyIn(M(n,i)[s])}t=n,n=M(t,s)}}return this},p=new WeakSet,d=function(t,n,s,r){var o,l;let h=!1,c=!1,u=-1,a=!1;if(null===n.type){let e=s,i="";for(;e<t.length;){const s=t.charAt(e++);if(h||"\\"===s)h=!h,i+=s;else if(c)e===u+1?"^"!==s&&"!"!==s||(a=!0):"]"!==s||e===u+2&&a||(c=!1),i+=s;else if("["!==s)if(r.noext||!ht(s)||"("!==t.charAt(e))i+=s;else{n.push(i),i="";const l=new bt(s,n);e=N(o=bt,p,d).call(o,t,l,e,r),n.push(l)}else c=!0,u=e,a=!1,i+=s}return n.push(i),e}let v=s+1,m=new bt(null,n);const b=[];let w="";for(;v<t.length;){const e=t.charAt(v++);if(h||"\\"===e)h=!h,w+=e;else if(c)v===u+1?"^"!==e&&"!"!==e||(a=!0):"]"!==e||v===u+2&&a||(c=!1),w+=e;else if("["!==e)if(ht(e)&&"("===t.charAt(v)){m.push(w),w="";const n=new bt(e,m);m.push(n),v=N(l=bt,p,d).call(l,t,n,v,r)}else if("|"!==e){if(")"===e)return""===w&&0===M(n,i).length&&x(n,f,!0),m.push(w),w="",n.push(...b,m),v;w+=e}else m.push(w),w="",b.push(m),m=new bt(null,n);else c=!0,u=v,a=!1,w+=e}return n.type=null,x(n,e,void 0),x(n,i,[t.substring(s-1)]),v},v=function(t){return M(this,i).map((e=>{if("string"==typeof e)throw Error("string type in extglob ast??");const[i,s,r,o]=e.toRegExpSource(t);return x(this,n,M(this,n)||o),i})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")},m=function(t,e,n=!1){let i=!1,s="",r=!1;for(let o=0;o<t.length;o++){const l=t.charAt(o);if(i)i=!1,s+=(at.has(l)?"\\":"")+l;else if("\\"!==l){if("["===l){const[n,i,l,h]=rt(t,o);if(l){s+=n,r=r||i,o+=l-1,e=e||h;continue}}"*"!==l?"?"!==l?s+=pt(l):(s+=dt,e=!0):(s+=n&&"*"===t?mt:vt,e=!0)}else o===t.length-1?s+="\\\\":i=!0}return[s,ot(t),!!e,r]},k(bt,p);var wt=bt,gt=(t,e,n={})=>(tt(e),!(!n.nocomment&&"#"===e.charAt(0))&&new Ht(e,n).match(t)),yt=/^\*+([^+@!?\*\[\(]*)$/,$t=t=>e=>!e.startsWith(".")&&e.endsWith(t),Ot=t=>e=>e.endsWith(t),jt=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),St=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Et=/^\*+\.\*+$/,Mt=t=>!t.startsWith(".")&&t.includes("."),kt=t=>"."!==t&&".."!==t&&t.includes("."),xt=/^\.\*+$/,Nt=t=>"."!==t&&".."!==t&&t.startsWith("."),Pt=/^\*+$/,Wt=t=>0!==t.length&&!t.startsWith("."),Rt=t=>0!==t.length&&"."!==t&&".."!==t,At=/^\?+([^+@!?\*\[\(]*)?$/,Ct=([t,e=""])=>{const n=Tt([t]);return e?(e=e.toLowerCase(),t=>n(t)&&t.toLowerCase().endsWith(e)):n},zt=([t,e=""])=>{const n=Dt([t]);return e?(e=e.toLowerCase(),t=>n(t)&&t.toLowerCase().endsWith(e)):n},Lt=([t,e=""])=>{const n=Dt([t]);return e?t=>n(t)&&t.endsWith(e):n},_t=([t,e=""])=>{const n=Tt([t]);return e?t=>n(t)&&t.endsWith(e):n},Tt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},Dt=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},Ut="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";gt.sep="win32"===Ut?"\\":"/";var Ft=Symbol("globstar **");gt.GLOBSTAR=Ft,gt.filter=(t,e={})=>n=>gt(n,t,e);var Gt=(t,e={})=>Object.assign({},t,e);gt.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return gt;const e=gt;return Object.assign(((n,i,s={})=>e(n,i,Gt(t,s))),{Minimatch:class extends e.Minimatch{constructor(e,n={}){super(e,Gt(t,n))}static defaults(n){return e.defaults(Gt(t,n)).Minimatch}},AST:class extends e.AST{constructor(e,n,i={}){super(e,n,Gt(t,i))}static fromGlob(n,i={}){return e.AST.fromGlob(n,Gt(t,i))}},unescape:(n,i={})=>e.unescape(n,Gt(t,i)),escape:(n,i={})=>e.escape(n,Gt(t,i)),filter:(n,i={})=>e.filter(n,Gt(t,i)),defaults:n=>e.defaults(Gt(t,n)),makeRe:(n,i={})=>e.makeRe(n,Gt(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,Gt(t,i)),match:(n,i,s={})=>e.match(n,i,Gt(t,s)),sep:e.sep,GLOBSTAR:Ft})};var It=(t,e={})=>(tt(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,X.default)(t));gt.braceExpand=It,gt.makeRe=(t,e={})=>new Ht(t,e).makeRe(),gt.match=(t,e,n={})=>{const i=new Ht(e,n);return t=t.filter((t=>i.match(t))),i.options.nonull&&!t.length&&t.push(e),t};var Zt=/[?*]|[+@!]\(.*?\)|\[|\]/,Ht=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){tt(t),this.options=e=e||{},this.pattern=t,this.platform=e.platform||Ut,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const n=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((t=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&Zt.test(t[2])||Zt.test(t[3])),n=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(n)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,i),this.set=i.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++)"**"===t[e][n]&&(t[e][n]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let n=e;for(;"**"===t[n+1];)n++;n!==e&&t.splice(e,n-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const n=t[t.length-1];return"**"===e&&"**"===n?t:".."===e&&n&&".."!==n&&"."!==n&&"**"!==n?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){const i=t[n];1===n&&""===i&&""===t[0]||"."!==i&&""!==i||(e=!0,t.splice(n,1),n--)}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let n=0;for(;-1!==(n=t.indexOf("..",n+1));){const i=t[n-1];i&&"."!==i&&".."!==i&&"**"!==i&&(e=!0,t.splice(n-1,2),n-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let n of t){let i=-1;for(;-1!==(i=n.indexOf("**",i+1));){let s=i;for(;"**"===n[s+1];)s++;s>i&&n.splice(i+1,s-i);const r=n[i+2],o=n[i+3];if(".."!==n[i+1])continue;if(!r||"."===r||".."===r||!o||"."===o||".."===o)continue;e=!0,n.splice(i,1);const l=n.slice(0);l[i]="**",t.push(l),i--}if(!this.preserveMultipleSlashes){for(let t=1;t<n.length-1;t++){const i=n[t];1===t&&""===i&&""===n[0]||"."!==i&&""!==i||(e=!0,n.splice(t,1),t--)}"."!==n[0]||2!==n.length||"."!==n[1]&&""!==n[1]||(e=!0,n.pop())}let s=0;for(;-1!==(s=n.indexOf("..",s+1));){const t=n[s-1];t&&"."!==t&&".."!==t&&"**"!==t&&(e=!0,n.splice(s-1,2,...1===s&&"**"===n[s+1]?["."]:[]),0===n.length&&n.push(""),s-=2)}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let n=e+1;n<t.length;n++){const i=this.partsMatch(t[e],t[n],!this.preserveMultipleSlashes);i&&(t[e]=i,t[n]=[])}return t.filter((t=>t.length))}partsMatch(t,e,n=!1){let i=0,s=0,r=[],o="";for(;i<t.length&&s<e.length;)if(t[i]===e[s])r.push("b"===o?e[s]:t[i]),i++,s++;else if(n&&"**"===t[i]&&e[s]===t[i+1])r.push(t[i]),i++;else if(n&&"**"===e[s]&&t[i]===e[s+1])r.push(e[s]),s++;else if("*"!==t[i]||!e[s]||!this.options.dot&&e[s].startsWith(".")||"**"===e[s]){if("*"!==e[s]||!t[i]||!this.options.dot&&t[i].startsWith(".")||"**"===t[i])return!1;if("a"===o)return!1;o="b",r.push(e[s]),i++,s++}else{if("b"===o)return!1;o="a",r.push(t[i]),i++,s++}return t.length===e.length&&r}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,n=0;for(let i=0;i<t.length&&"!"===t.charAt(i);i++)e=!e,n++;n&&(this.pattern=t.slice(n)),this.negate=e}matchOne(t,e,n=!1){const i=this.options;if(this.isWindows){const n="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),i=!n&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),s="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),r=i?3:n?0:void 0,o=!s&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])?3:s?0:void 0;if("number"==typeof r&&"number"==typeof o){const[n,i]=[t[r],e[o]];n.toLowerCase()===i.toLowerCase()&&(e[o]=n,o>r?e=e.slice(o):r>o&&(t=t.slice(r)))}}const{optimizationLevel:s=1}=this.options;s>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var r=0,o=0,l=t.length,h=e.length;r<l&&o<h;r++,o++){this.debug("matchOne loop");var c=e[o],f=t[r];if(this.debug(e,c,f),!1===c)return!1;if(c===Ft){this.debug("GLOBSTAR",[e,c,f]);var u=r,a=o+1;if(a===h){for(this.debug("** at the end");r<l;r++)if("."===t[r]||".."===t[r]||!i.dot&&"."===t[r].charAt(0))return!1;return!0}for(;u<l;){var p=t[u];if(this.debug("\nglobstar while",t,u,e,a,p),this.matchOne(t.slice(u),e.slice(a),n))return this.debug("globstar found match!",u,l,p),!0;if("."===p||".."===p||!i.dot&&"."===p.charAt(0)){this.debug("dot detected!",t,u,e,a);break}this.debug("globstar swallow a segment, and continue"),u++}return!(!n||(this.debug("\n>>> no match, partial?",t,u,e,a),u!==l))}let s;if("string"==typeof c?(s=f===c,this.debug("string match",c,f,s)):(s=c.test(f),this.debug("pattern match",c,f,s)),!s)return!1}if(r===l&&o===h)return!0;if(r===l)return n;if(o===h)return r===l-1&&""===t[r];throw Error("wtf?")}braceExpand(){return It(this.pattern,this.options)}parse(t){tt(t);const e=this.options;if("**"===t)return Ft;if(""===t)return"";let n,i=null;(n=t.match(Pt))?i=e.dot?Rt:Wt:(n=t.match(yt))?i=(e.nocase?e.dot?St:jt:e.dot?Ot:$t)(n[1]):(n=t.match(At))?i=(e.nocase?e.dot?zt:Ct:e.dot?Lt:_t)(n):(n=t.match(Et))?i=e.dot?kt:Mt:(n=t.match(xt))&&(i=Nt);const s=wt.fromGlob(t,this.options).toMMPattern();return i&&"object"==typeof s&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,n=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(e.nocase?["i"]:[]);let s=t.map((t=>{const e=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))i.add(e);return"string"==typeof t?(t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))(t):t===Ft?Ft:t._src}));return e.forEach(((t,i)=>{const s=e[i+1],r=e[i-1];t===Ft&&r!==Ft&&(void 0===r?void 0!==s&&s!==Ft?e[i+1]="(?:\\/|"+n+"\\/)?"+s:e[i]=n:void 0===s?e[i-1]=r+"(?:\\/|"+n+")?":s!==Ft&&(e[i-1]=r+"(?:\\/|\\/"+n+"\\/)"+s,e[i+1]=Ft))})),e.filter((t=>t!==Ft)).join("/")})).join("|");const[r,o]=t.length>1?["(?:",")"]:["",""];s="^"+r+s+o+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=RegExp(s,[...i].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const n=this.options;this.isWindows&&(t=t.split("\\").join("/"));const i=this.slashSplit(t);this.debug(this.pattern,"split",i);const s=this.set;this.debug(this.pattern,"set",s);let r=i[i.length-1];if(!r)for(let t=i.length-2;!r&&t>=0;t--)r=i[t];for(let t=0;t<s.length;t++){const o=s[t];let l=i;if(n.matchBase&&1===o.length&&(l=[r]),this.matchOne(l,o,e))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate}static defaults(t){return gt.defaults(t).Minimatch}};gt.AST=wt,gt.Minimatch=Ht,gt.escape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),gt.unescape=ot,((t,e)=>{for(var n in e)w(t,n,{get:e[n],enumerable:!0})})({},{err:()=>qt,map:()=>Bt,ok:()=>Vt,unwrap:()=>Yt,unwrapErr:()=>Kt});var Vt=t=>({isOk:!0,isErr:!1,value:t}),qt=t=>({isOk:!1,isErr:!0,value:t});function Bt(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((t=>Vt(t))):Vt(n)}if(t.isErr)return qt(t.value);throw"should never get here"}var Jt,Yt=t=>{if(t.isOk)return t.value;throw t.value},Kt=t=>{if(t.isErr)return t.value;throw t.value};function Qt(){const t=this.attachShadow({mode:"open"});void 0===Jt&&(Jt=null),Jt&&(F?t.adoptedStyleSheets.push(Jt):t.adoptedStyleSheets=[...t.adoptedStyleSheets,Jt])}function Xt(t,e,n){let i,s=0,r=[];for(;s<t.length;s++){if(i=t[s],i["s-sr"]&&(!e||i["s-hn"]===e)&&(void 0===n||te(i)===n)&&(r.push(i),void 0!==n))return r;r=[...r,...Xt(i.childNodes,e,n)]}return r}var te=t=>"string"==typeof t["s-sn"]?t["s-sn"]:1===t.nodeType&&t.getAttribute("slot")||void 0;var ee=new WeakMap,ne=t=>"sc-"+t.u,ie=(t,e,...n)=>{let i=null,s=null,r=!1,o=!1;const l=[],h=e=>{for(let n=0;n<e.length;n++)i=e[n],Array.isArray(i)?h(i):null!=i&&"boolean"!=typeof i&&((r="function"!=typeof t&&!Q(i))&&(i+=""),r&&o?l[l.length-1].p+=i:l.push(r?se(null,i):i),o=r)};if(h(n),e){e.key&&(s=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}if("function"==typeof t)return t(null===e?{}:e,l,oe);const c=se(t,null);return c.v=e,l.length>0&&(c.m=l),c.$=s,c},se=(t,e)=>({l:0,O:t,p:e,j:null,m:null,v:null,$:null}),re={},oe={forEach:(t,e)=>t.map(le).forEach(e),map:(t,e)=>t.map(le).map(e).map(he)},le=t=>({vattrs:t.v,vchildren:t.m,vkey:t.$,vname:t.S,vtag:t.O,vtext:t.p}),he=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),ie(t.vtag,e,...t.vchildren||[])}const e=se(t.vtag,t.vtext);return e.v=t.vattrs,e.m=t.vchildren,e.$=t.vkey,e.S=t.vname,e},ce=t=>{const e=(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t);return RegExp(`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${e}))(${e}\\b)`,"g")};ce("::slotted"),ce(":host"),ce(":host-context");var fe,ue=(t,e)=>null==t||Q(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:t,ae=(t,e)=>{const n=t;return{emit:t=>pe(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},pe=(t,e,n)=>{const i=D.ce(e,n);return t.dispatchEvent(i),i},de=(t,e,n,i,s,r)=>{if(n===i)return;let o=C(t,e),l=e.toLowerCase();if("class"===e){const e=t.classList,s=me(n);let r=me(i);e.remove(...s.filter((t=>t&&!r.includes(t)))),e.add(...r.filter((t=>t&&!s.includes(t))))}else if("style"===e){for(const e in n)i&&null!=i[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in i)n&&i[e]===n[e]||(e.includes("-")?t.style.setProperty(e,i[e]):t.style[e]=i[e])}else if("key"===e);else if("ref"===e)i&&i(t);else if(t.__lookupSetter__(e)||"o"!==e[0]||"n"!==e[1]){const l=Q(i);if(o||l&&null!==i)try{if(t.tagName.includes("-"))t[e]!==i&&(t[e]=i);else{const s=null==i?"":i;"list"===e?o=!1:null!=n&&t[e]==s||("function"==typeof t.__lookupSetter__(e)?t[e]=s:t.setAttribute(e,s))}}catch(t){}null==i||!1===i?!1===i&&""!==t.getAttribute(e)||t.removeAttribute(e):(!o||4&r||s)&&!l&&1===t.nodeType&&t.setAttribute(e,i=!0===i?"":i)}else if(e="-"===e[2]?e.slice(3):C(_,l)?l.slice(2):l[2]+e.slice(3),n||i){const s=e.endsWith(be);e=e.replace(we,""),n&&D.rel(t,e,n,s),i&&D.ael(t,e,i,s)}},ve=/\s/,me=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(ve):[]),be="Capture",we=RegExp(be+"$"),ge=(t,e,n)=>{const i=11===e.j.nodeType&&e.j.host?e.j.host:e.j,s=t&&t.v||{},r=e.v||{};for(const t of ye(Object.keys(s)))t in r||de(i,t,s[t],void 0,n,e.l);for(const t of ye(Object.keys(r)))de(i,t,s[t],r[t],n,e.l)};function ye(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var $e=!1,Oe=(t,e,n)=>{const i=e.m[n];let s,r,o=0;if(null!==i.p)s=i.j=_.document.createTextNode(i.p);else{if(!_.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(s=i.j=_.document.createElement(i.O),ge(null,i,$e),i.m){const e="template"===i.O?s.content:s;for(o=0;o<i.m.length;++o)r=Oe(t,i,o),r&&e.appendChild(r)}}return s["s-hn"]=fe,s},je=(t,e,n,i,s,r)=>{let o,l=t;for(l.shadowRoot&&l.tagName===fe&&(l=l.shadowRoot),"template"===n.O&&(l=l.content);s<=r;++s)i[s]&&(o=Oe(null,n,s),o&&(i[s].j=o,xe(l,o,e)))},Se=(t,e,n)=>{for(let i=e;i<=n;++i){const e=t[i];if(e){const t=e.j;ke(e),t&&t.remove()}}},Ee=(t,e,n=!1)=>t.O===e.O&&(n?(n&&!t.$&&e.$&&(t.$=e.$),!0):t.$===e.$),Me=(t,e,n=!1)=>{const i=e.j=t.j,s=t.m,r=e.m,o=e.p;null===o?(ge(t,e,$e),null!==s&&null!==r?((t,e,n,i,s=!1)=>{let r,o,l=0,h=0,c=0,f=0,u=e.length-1,a=e[0],p=e[u],d=i.length-1,v=i[0],m=i[d];const b="template"===n.O?t.content:t;for(;l<=u&&h<=d;)if(null==a)a=e[++l];else if(null==p)p=e[--u];else if(null==v)v=i[++h];else if(null==m)m=i[--d];else if(Ee(a,v,s))Me(a,v,s),a=e[++l],v=i[++h];else if(Ee(p,m,s))Me(p,m,s),p=e[--u],m=i[--d];else if(Ee(a,m,s))Me(a,m,s),xe(b,a.j,p.j.nextSibling),a=e[++l],m=i[--d];else if(Ee(p,v,s))Me(p,v,s),xe(b,p.j,a.j),p=e[--u],v=i[++h];else{for(c=-1,f=l;f<=u;++f)if(e[f]&&null!==e[f].$&&e[f].$===v.$){c=f;break}c>=0?(o=e[c],o.O!==v.O?r=Oe(e&&e[h],n,c):(Me(o,v,s),e[c]=void 0,r=o.j),v=i[++h]):(r=Oe(e&&e[h],n,h),v=i[++h]),r&&xe(a.j.parentNode,r,a.j)}l>u?je(t,null==i[d+1]?null:i[d+1].j,n,i,h,d):h>d&&Se(e,l,u)})(i,s,e,r,n):null!==r?(null!==t.p&&(i.textContent=""),je(i,null,e,r,0,r.length-1)):!n&&null!==s&&Se(s,0,s.length-1)):t.p!==o&&(i.data=o)},ke=t=>{t.v&&t.v.ref&&t.v.ref(null),t.m&&t.m.map(ke)},xe=(t,e,n)=>{if("string"==typeof e["s-sn"]){t.insertBefore(e,n);const{slotNode:i}=function(t,e){var n;if(!(e=e||(null==(n=t["s-ol"])?void 0:n.parentElement)))return{slotNode:null,slotName:""};const i=t["s-sn"]=te(t)||"";return{slotNode:Xt(function(t,e){if("__"+e in t){const n=t["__"+e];return"function"!=typeof n?n:n.bind(t)}return"function"!=typeof t[e]?t[e]:t[e].bind(t)}(e,"childNodes"),e.tagName,i)[0],slotName:i}}(e);return i&&function(t){t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1}))}(i),e}return t.__insertBefore?t.__insertBefore(e,n):null==t?void 0:t.insertBefore(e,n)},Ne=(t,e,n=!1)=>{const i=t.$hostElement$,s=t.M||se(null,null),r=(t=>t&&t.O===re)(e)?e:ie(null,null,e);if(fe=i.tagName,n&&r.v)for(const t of Object.keys(r.v))i.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(r.v[t]=i[t]);r.O=null,r.l|=4,t.M=r,r.j=s.j=i.shadowRoot||i,Me(s,r,n)},Pe=(t,e)=>{if(e&&!t.k&&e["s-p"]){const n=e["s-p"].push(new Promise((i=>t.k=()=>{e["s-p"].splice(n-1,1),i()})))}},We=(t,e)=>{if(t.l|=16,4&t.l)return void(t.l|=512);Pe(t,t.N);const n=()=>Re(t,e);if(!e)return J(n);queueMicrotask((()=>{n()}))},Re=(t,e)=>{const n=t.$hostElement$,i=n;if(!i)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let s;return s=De(i,e?"componentWillLoad":"componentWillUpdate",void 0,n),s=Ae(s,(()=>De(i,"componentWillRender",void 0,n))),Ae(s,(()=>ze(t,i,e)))},Ae=(t,e)=>Ce(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),Ce=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,ze=async(t,e,n)=>{var i;const s=t.$hostElement$,r=s["s-rc"];n&&(t=>{const e=t.i,n=t.$hostElement$,i=e.l,s=((t,e)=>{var n,i,s;const r=ne(e),o=L.get(r);if(!_.document)return r;if(t=11===t.nodeType?t:_.document,o)if("string"==typeof o){let s,l=ee.get(t=t.head||t);if(l||ee.set(t,l=new Set),!l.has(r)){s=_.document.createElement("style"),s.innerHTML=o;const h=null!=(n=D.P)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=_.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=h&&s.setAttribute("nonce",h),!(1&e.l))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(s,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(U){const e=new(null!=(i=t.defaultView)?i:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(o),F?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.innerHTML=o+e.innerHTML:t.prepend(s)}else t.append(s);1&e.l&&t.insertBefore(s,null),4&e.l&&(s.innerHTML+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),l&&l.add(r)}}else{let e=ee.get(t);if(e||ee.set(t,e=new Set),!e.has(r)){const n=null!=(s=t.defaultView)?s:t.ownerDocument.defaultView;let i;if(o.constructor===n.CSSStyleSheet)i=o;else{i=new n.CSSStyleSheet;for(let t=0;t<o.cssRules.length;t++)i.insertRule(o.cssRules[t].cssText,t)}F?t.adoptedStyleSheets.push(i):t.adoptedStyleSheets=[...t.adoptedStyleSheets,i],e.add(r)}}return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&i&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(t);Le(t,e,s,n),r&&(r.map((t=>t())),s["s-rc"]=void 0);{const e=null!=(i=s["s-p"])?i:[],n=()=>_e(t);0===e.length?n():(Promise.all(e).then(n),t.l|=4,e.length=0)}},Le=(t,e,n,i)=>{try{e=e.render(),t.l&=-17,t.l|=2,Ne(t,e,i)}catch(e){z(e,t.$hostElement$)}return null},_e=t=>{const e=t.$hostElement$,n=e,i=t.N;De(n,"componentDidRender",void 0,e),64&t.l?De(n,"componentDidUpdate",void 0,e):(t.l|=64,Ue(e),De(n,"componentDidLoad",void 0,e),t.W(e),i||Te()),t.k&&(t.k(),t.k=void 0),512&t.l&&B((()=>We(t,!1))),t.l&=-517},Te=()=>{B((()=>pe(_,"appload",{detail:{namespace:"memory-game"}})))},De=(t,e,n,i)=>{if(t&&t[e])try{return t[e](n)}catch(t){z(t,i)}},Ue=t=>t.classList.add("hydrated"),Fe=(t,e,n,i)=>{const s=A(t);if(!s)return;const r=t,o=s.o.get(e),l=s.l,h=r;if(!((n=ue(n,i.t[e][0]))===o||Number.isNaN(o)&&Number.isNaN(n))){if(s.o.set(e,n),i.R){const t=i.R[e];t&&t.map((t=>{try{const[[i,r]]=Object.entries(t);(128&l||1&r)&&(h?h[i](n,o,e):s.A.push((()=>{s.C[i](n,o,e)})))}catch(t){z(t,r)}}))}if(2==(18&l)){if(h.componentShouldUpdate&&!1===h.componentShouldUpdate(n,o,e))return;We(s,!1)}}},Ge=(t,e)=>{var n,i;const s=t.prototype;{t.watchers&&!e.R&&(e.R=t.watchers),t.deserializers&&!e.L&&(e.L=t.deserializers),t.serializers&&!e._&&(e._=t.serializers);const r=Object.entries(null!=(n=e.t)?n:{});r.map((([t,[n]])=>{if(31&n||32&n){const{get:i,set:r}=Object.getOwnPropertyDescriptor(s,t)||{};i&&(e.t[t][0]|=2048),r&&(e.t[t][0]|=4096),Object.defineProperty(s,t,{get(){return i?i.apply(this):((t,e)=>A(this).o.get(e))(0,t)},configurable:!0,enumerable:!0}),Object.defineProperty(s,t,{set(i){const s=A(this);if(s){if(r)return void 0===(32&n?this[t]:s.$hostElement$[t])&&s.o.get(t)&&(i=s.o.get(t)),r.call(this,ue(i,n)),void Fe(this,t,i=32&n?this[t]:s.$hostElement$[t],e);Fe(this,t,i,e)}}})}}));{const n=new Map;s.attributeChangedCallback=function(t,i,o){D.jmp((()=>{var l;const h=n.get(t),c=A(this);if(this.hasOwnProperty(h),s.hasOwnProperty(h)&&"number"==typeof this[h]&&this[h]==o)return;if(null==h){const n=null==c?void 0:c.l;if(c&&n&&!(8&n)&&o!==i){const s=this,r=null==(l=e.R)?void 0:l[t];null==r||r.forEach((e=>{const[[r,l]]=Object.entries(e);null!=s[r]&&(128&n||1&l)&&s[r].call(s,o,i,t)}))}return}const f=r.find((([t])=>t===h));f&&4&f[1][0]&&(o=null!==o&&"false"!==o);const u=Object.getOwnPropertyDescriptor(s,h);o==this[h]||u.get&&!u.set||(this[h]=o)}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=e.R)?i:{}),...r.filter((([t,e])=>31&e[0])).map((([t,e])=>{const i=e[1]||t;return n.set(i,t),i}))]))}}return t},Ie=(t,e)=>{const n={l:e[0],u:e[1]};n.t=e[2],n.R=t.R,n.L=t.L,n._=t._;const i=t.prototype.connectedCallback,s=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const n={l:0,$hostElement$:t,i:e,o:new Map,T:new Map};n.D=new Promise((t=>n.W=t)),t["s-p"]=[],t["s-rc"]=[];const i=n;t.__stencil__getHostRef=()=>i,512&e.l&&R(t,n)})(this,n)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!A(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&D.l)){const e=A(t);if(!e)return;const n=e.i,i=()=>{};if(1&e.l)(null==e?void 0:e.C)||(null==e?void 0:e.D)&&e.D.then((()=>{}));else{e.l|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){Pe(e,e.N=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&e in t&&t[e]!==Object.prototype[e]){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let i;if(!(32&e.l)&&(e.l|=32,i=t.constructor,customElements.whenDefined(t.localName).then((()=>e.l|=128)),i&&i.style)){let t;"string"==typeof i.style&&(t=i.style);const e=ne(n);if(!L.has(e)){const i=()=>{};((t,e,n)=>{let i=L.get(t);U&&n?(i=i||new CSSStyleSheet,"string"==typeof i?i=e:i.replaceSync(e)):i=e,L.set(t,i)})(e,t,!!(1&n.l)),i()}}const s=e.N,r=()=>We(e,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(t,e,n)}i()}})(this),i&&i.call(this)},disconnectedCallback(){(async t=>{ee.has(t)&&ee.delete(t),t.shadowRoot&&ee.has(t.shadowRoot)&&ee.delete(t.shadowRoot)})(this),s&&s.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${n.u}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else Qt.call(this,n)}}),t.is=n.u,Ge(t,n)},Ze=t=>D.P=t,He=t=>Object.assign(D,t);function Ve(t,e){Ne({$hostElement$:e},t)}function qe(t){return t}export{T as H,ae as c,Y as getAssetPath,ie as h,Ie as p,Ve as render,K as setAssetPath,Ze as setNonce,He as setPlatformOptions,qe as t}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MbMemoryGame extends Components.MbMemoryGame, HTMLElement {}
4
+ export const MbMemoryGame: {
5
+ prototype: MbMemoryGame;
6
+ new (): MbMemoryGame;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{h as t,t as e,p as i,H as s,c as r}from"./index.js";function a({tile:e,selected:i,matched:s,uncovered:r,reversTile:a}){return t("div",{class:{"tile-container":!0,selected:i,matched:s}},t(c,{tile:r?e.data:a}))}function c({tile:e}){return"text"===e.type?t("button",{class:"tile tile-text"},e.text):"image"===e.type?t("button",{class:"tile tile-image"},t("img",{src:e.imageSrc})):void 0}const o=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.completed=r(this,"completed"),this.matched=r(this,"matched")}tileGroups=[];reverseTile={type:"text",text:"?"};init=!0;watchBoard(){this.init&&this.initGame()}tiles=[];selected=[];matchedTiles=[];watchMatchedTiles(){this.matchedTiles.length===this.tiles.length&&this.completed.emit()}cols;blockUI=!1;uncoverSelected=!1;completed;matched;componentWillLoad(){console.log("componentDidLoad",this.init),this.init&&this.tileGroups&&this.initGame()}slots=new Map;get gridCols(){return this.cols?this.cols:Math.floor(Math.sqrt(this.tiles.length))}get gridRows(){return Math.ceil(this.tiles.length/this.gridCols)}get gridAspectRatio(){return this.gridCols/this.gridRows}async initGame(t=this.tileGroups,e=this.reverseTile){console.log("initGame",t),this.reverseTile=e,this.buildTiles(t)}buildTiles(t){let e=[],i=0;t.forEach((t=>{const s=function(t,e){if(console.log("getSet",t,e),t.length<=0)throw Error("getSet() - no items");if(t.length===e)return[...t];let i=[];for(;e-i.length>t.length;)i=[...i,...t];const s=new Set;for(;s.size<e-i.length;)s.add(t[Math.floor(Math.random()*t.length)]);return[...i,...s]}(t.tiles,t.count);e=[...e,...s.map((e=>({id:i++,data:{...e},groupId:t.id,uncovered:!1,matched:!1})))]})),this.tiles=e.sort((()=>Math.random()-.5))}async onTileClick(t){if(!this.blockUI)if(this.selected.includes(t))this.selected=this.selected.filter((e=>e!==t));else if(this.selected=[...this.selected,t],2===this.selected.length){const t=this.tiles.find((t=>t.id===this.selected[0])),e=this.tiles.find((t=>t.id===this.selected[1]));if(!t||!e)return;this.blockUI=!0,this.uncoverSelected=!0,t.groupId===e.groupId?(await Promise.all([this.markAsMatched(t.id),this.markAsMatched(e.id)]),this.matched.emit({t1:t.data,t2:e.data,groupId:t.groupId}),this.matchedTiles=[...this.matchedTiles,t.id,e.id]):await Promise.all([this.animateWrongMatch(t.id),this.animateWrongMatch(e.id)]),this.uncoverSelected=!1,this.blockUI=!1,this.selected=[]}}markAsMatched(t){return new Promise((e=>{const i=this.slots.get(t);if(!i)return;const s=i.children[0].animate([],{duration:1e3});s.addEventListener("finish",(()=>{e()})),s.addEventListener("cancel",(()=>{e()}))}))}animateWrongMatch(t){return new Promise((e=>{const i=this.slots.get(t);if(!i)return;const s=i.children[0].animate([{rotate:"0deg"},{rotate:"0deg"},{rotate:"30deg"},{rotate:"0deg"},{rotate:"-30deg"},{rotate:"0deg"},{rotate:"0deg"}],{duration:1500});s.addEventListener("finish",(()=>{e()})),s.addEventListener("cancel",(()=>{e()}))}))}render(){return t("div",{key:"bb7b898014606de493fd580e50ef685f529ac2bb",part:"container",style:{"--aspect":""+this.gridAspectRatio}},t("div",{key:"0c677fb539e7af023c21411e70adf64050c97077",part:"list",style:{"--cols":""+this.gridCols,"--rows":""+this.gridRows}},this.tiles.map((e=>t("div",{part:"tile-slot",onClick:()=>this.onTileClick(e.id),ref:t=>this.slots.set(e.id,t)},t(a,{tile:e,selected:this.selected.includes(e.id),matched:this.matchedTiles.includes(e.id),reversTile:this.reverseTile,uncovered:this.uncoverSelected&&this.selected.includes(e.id)}))))))}static get watchers(){return{board:[{watchBoard:0}],matchedTiles:[{watchMatchedTiles:0}]}}static get style(){return":host{box-sizing:border-box;display:grid;place-content:center;width:100%;height:100%;container-type:size}[part=container]{width:min(100cqw, 100cqh / var(--aspect, 1));height:min(100cqw * var(--aspect, 1), 100cqh);container-type:size;background:pink}[part=list]{width:100cqw;height:100cqh;display:grid;grid-template-columns:repeat(var(--cols, 4), 1fr);grid-template-columns:repeat(var(--rows, 4), 1fr)}[part=tile-slot]{display:block;aspect-ratio:1;padding:5%}.tile-container{min-width:0;transition:scale 0.3s;width:100%;height:100%}.tile-container:hover{scale:1.05}.tile-container.selected{scale:1.1}.tile-container.matched{scale:0}.tile{border-radius:var(--tile-border-radius, 5px);border:var(--tile-border-width, 2px) solid var(--tile-border-color, black);padding:0;margin:0}.tile-text{width:100%;height:100%;aspect-ratio:1;background:#d9d9d9;display:grid;place-content:center}.tile-image{width:100%;height:100%}.tile-image img{display:block;width:100%;height:100%;object-fit:cover}"}},[513,"mb-memory-game",{tileGroups:[16],reverseTile:[16],init:[4],cols:[2],tiles:[32],selected:[32],matchedTiles:[32],uncoverSelected:[32],initGame:[64]},void 0,{board:[{watchBoard:0}],matchedTiles:[{watchMatchedTiles:0}]}]);function h(){"undefined"!=typeof customElements&&["mb-memory-game"].forEach((t=>{"mb-memory-game"===t&&(customElements.get(e(t))||customElements.define(e(t),o))}))}h();const n=o,d=h;export{n as MbMemoryGame,d as defineCustomElement}
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };