cubing 0.25.6 → 0.25.7
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.
- package/dist/esm/{2x2x2.sgs.json-GQVTWF7L.js → 2x2x2.sgs.json-3ZT7QXX6.js} +3 -3
- package/dist/esm/{2x2x2.sgs.json-GQVTWF7L.js.map → 2x2x2.sgs.json-3ZT7QXX6.js.map} +0 -0
- package/dist/esm/{3d-dynamic-DKWMBHRS.js → 3d-dynamic-PTVO24C3.js} +4 -4
- package/dist/esm/{3d-dynamic-DKWMBHRS.js.map → 3d-dynamic-PTVO24C3.js.map} +0 -0
- package/dist/esm/{444-solver-ZBJQH3QR.js → 444-solver-BYA4CXZO.js} +4 -4
- package/dist/esm/{444-solver-ZBJQH3QR.js.map → 444-solver-BYA4CXZO.js.map} +0 -0
- package/dist/esm/bluetooth/index.js +3 -3
- package/dist/esm/{chunk-L7AOT5LY.js → chunk-ANYSPBCR.js} +2 -2
- package/dist/esm/{chunk-L7AOT5LY.js.map → chunk-ANYSPBCR.js.map} +0 -0
- package/dist/esm/{chunk-BOKO2BWT.js → chunk-CNIY6YZL.js} +2 -2
- package/dist/esm/{chunk-BOKO2BWT.js.map → chunk-CNIY6YZL.js.map} +0 -0
- package/dist/esm/{chunk-T2BDGTK3.js → chunk-HFQZM22L.js} +3 -3
- package/dist/esm/{chunk-T2BDGTK3.js.map → chunk-HFQZM22L.js.map} +0 -0
- package/dist/esm/{chunk-TG5KP5IL.js → chunk-JGAZXWH2.js} +2 -2
- package/dist/esm/{chunk-TG5KP5IL.js.map → chunk-JGAZXWH2.js.map} +0 -0
- package/dist/esm/{chunk-L73RWUDG.js → chunk-JW2JE4D3.js} +2 -2
- package/dist/esm/{chunk-L73RWUDG.js.map → chunk-JW2JE4D3.js.map} +0 -0
- package/dist/esm/{chunk-FE3HTWQK.js → chunk-MVKZPDII.js} +13 -1
- package/dist/esm/chunk-MVKZPDII.js.map +7 -0
- package/dist/esm/{chunk-ME2QTCHN.js → chunk-NROLOGGL.js} +3 -3
- package/dist/esm/{chunk-ME2QTCHN.js.map → chunk-NROLOGGL.js.map} +0 -0
- package/dist/esm/{chunk-LZGPOT2V.js → chunk-OAPHPP4R.js} +2 -2
- package/dist/esm/{chunk-LZGPOT2V.js.map → chunk-OAPHPP4R.js.map} +0 -0
- package/dist/esm/{chunk-HTPDDD3Q.js → chunk-ZIHFCBOI.js} +2 -2
- package/dist/esm/{chunk-HTPDDD3Q.js.map → chunk-ZIHFCBOI.js.map} +0 -0
- package/dist/esm/{fto.dynamic-ZH5IVUKX.js → fto.dynamic-FLX5JKRG.js} +3 -3
- package/dist/esm/{fto.dynamic-ZH5IVUKX.js.map → fto.dynamic-FLX5JKRG.js.map} +0 -0
- package/dist/esm/kpuzzle/index.js +1 -1
- package/dist/esm/{megaminx.sgs.json-JXXOXGQE.js → megaminx.sgs.json-CGIZZZMZ.js} +3 -3
- package/dist/esm/{megaminx.sgs.json-JXXOXGQE.js.map → megaminx.sgs.json-CGIZZZMZ.js.map} +0 -0
- package/dist/esm/protocol/index.js +2 -2
- package/dist/esm/puzzles/index.js +2 -2
- package/dist/esm/{pyraminx.sgs.json-EHYGSC7B.js → pyraminx.sgs.json-XGJQTHLV.js} +4 -4
- package/dist/esm/{pyraminx.sgs.json-EHYGSC7B.js.map → pyraminx.sgs.json-XGJQTHLV.js.map} +0 -0
- package/dist/esm/scramble/index.js +4 -4
- package/dist/esm/search/index.js +4 -4
- package/dist/esm/{search-worker-js-entry-BDMABBZV.js → search-worker-js-entry-A4VBA2ZD.js} +13 -13
- package/dist/esm/{search-worker-js-entry-BDMABBZV.js.map → search-worker-js-entry-A4VBA2ZD.js.map} +0 -0
- package/dist/esm/{search-worker-ts-entry-3B5U6XER.js → search-worker-ts-entry-LUHAXJBE.js} +2 -2
- package/dist/esm/{search-worker-ts-entry-3B5U6XER.js.map → search-worker-ts-entry-LUHAXJBE.js.map} +0 -0
- package/dist/esm/{skewb.sgs.json-F5FL7533.js → skewb.sgs.json-HNUN4G7F.js} +3 -3
- package/dist/esm/{skewb.sgs.json-F5FL7533.js.map → skewb.sgs.json-HNUN4G7F.js.map} +0 -0
- package/dist/esm/twisty/index.js +13 -5
- package/dist/esm/twisty/index.js.map +2 -2
- package/dist/esm/{worker-inside-generated-string-AHMSHHSF.js → worker-inside-generated-string-VHOABMFC.js} +2 -2
- package/dist/esm/worker-inside-generated-string-VHOABMFC.js.map +7 -0
- package/dist/types/kpuzzle/KState.d.ts +1 -0
- package/dist/types/kpuzzle/KTransformation.d.ts +1 -0
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/chunk-FE3HTWQK.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-AHMSHHSF.js.map +0 -7
|
@@ -5,7 +5,7 @@ var workerSource = `var J0=Object.defineProperty;var Pp=e=>J0(e,"__esModule",{va
|
|
|
5
5
|
\`)||t.includes("\\r"))throw new Error("LineComment cannot contain newline");q(this,gr,t)}get text(){return d(this,gr)}isIdentical(t){let r=t;return t.is(wa)&&d(this,gr)===d(r,gr)}invert(){return this}*experimentalExpand(t=V.Forwards,r=1/0){yield this}toString(){return\`//\${d(this,gr)}\`}},Ut=wa;gr=new WeakMap});var $e,xl=U(()=>{qt();yt();$e=class extends We{toString(){return\`
|
|
6
6
|
\`}isIdentical(t){return t.is($e)}invert(){return this}*experimentalExpand(t=V.Forwards,r=1/0){yield this}}});var et,wl=U(()=>{qt();yt();et=class extends We{toString(){return"."}isIdentical(t){return t.is(et)}invert(){return this}*experimentalExpand(t=V.Forwards,r=1/0){yield this}}});function wo(e,t){return e?parseInt(e):t}function Sa(e){return new So().parseAlg(e)}function u2(e){return new So().parseMove(e)}function g2(e){return new So().parseQuantumMove(e)}function tt(e,t,r){let n=e;return n.startCharIndex=t,n.endCharIndex=r,n}function c2(e,t){return"startCharIndex"in e&&(t.startCharIndex=e.startCharIndex),"endCharIndex"in e&&(t.endCharIndex=e.endCharIndex),t}var f2,Xp,$p,em,tm,rm,it,T,So,va=U(()=>{Vt();xa();yl();Ul();vo();bl();Ht();xl();wl();f2=/^(\\d+)?('?)/,Xp=/^[_\\dA-Za-z]/,$p=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,em=/^[^\\n]*/,tm=/^(-?\\d+), ?/,rm=/^(-?\\d+)\\)/;So=class{constructor(){le(this,it,"");le(this,T,0)}parseAlg(t){q(this,it,t),q(this,T,0);let r=this.parseAlgWithStopping([]);return this.mustBeAtEndOfInput(),r}parseMove(t){q(this,it,t),q(this,T,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(t){q(this,it,t),q(this,T,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(d(this,T)!==d(this,it).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(t){let r=d(this,T),n=d(this,T),l=new Lt,o=!1,i=a=>{if(o)throw new Error(\`Unexpected character at index \${a}. Are you missing a space?\`)};e:for(;d(this,T)<d(this,it).length;){let a=d(this,T);if(t.includes(d(this,it)[d(this,T)]))return tt(l.toAlg(),r,n);if(this.tryConsumeNext(" ")){o=!1,l.experimentalNumUnits()===0&&(r=d(this,T));continue e}else if(Xp.test(d(this,it)[d(this,T)])){i(a);let s=this.parseMoveImpl();l.push(s),o=!0,n=d(this,T);continue e}else if(this.tryConsumeNext("(")){i(a);let s=this.tryRegex(tm);if(s){let f=s[1],g=d(this,T),c=this.parseRegex(rm),u=tt(new B(new P("U_SQ_"),parseInt(f)),a+1,a+1+f.length),p=tt(new B(new P("D_SQ_"),parseInt(c[1])),g,d(this,T)-1),m=tt(new _([u,p]),a+1,d(this,T)-1);l.push(tt(new pt(m),a,d(this,T))),o=!0,n=d(this,T);continue e}else{let f=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let g=this.parseAmount();l.push(tt(new pt(f,g),a,d(this,T))),o=!0,n=d(this,T);continue e}}else if(this.tryConsumeNext("[")){i(a);let s=this.parseAlgWithStopping([",",":"]),f=this.popNext(),g=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),f){case":":l.push(tt(new Qe(s,g),a,d(this,T))),o=!0,n=d(this,T);continue e;case",":l.push(tt(new Ke(s,g),a,d(this,T))),o=!0,n=d(this,T);continue e;default:throw"unexpected parsing error"}}else if(this.tryConsumeNext(\`
|
|
7
7
|
\`)){l.push(tt(new $e,a,d(this,T))),o=!1,n=d(this,T);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(a);let[s]=this.parseRegex(em);l.push(tt(new Ut(s),a,d(this,T))),o=!1,n=d(this,T);continue e}else{l.push(tt(new B("_SLASH_"),a,d(this,T))),o=!0,n=d(this,T);continue e}else if(this.tryConsumeNext(".")){i(a),l.push(tt(new et,a,d(this,T))),o=!0,n=d(this,T);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(d(this,T)!==d(this,it).length)throw new Error("did not finish parsing?");if(t.length>0)throw new Error("expected stopping");return tt(l.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,t,r,n]=this.parseRegex($p);return new P(n,wo(r,void 0),wo(t,void 0))}parseMoveImpl(){let t=d(this,T);if(this.tryConsumeNext("/"))return tt(new B("_SLASH_"),t,d(this,T));let r=this.parseQuantumMoveImpl(),[n,l]=this.parseAmountAndTrackEmptyAbsAmount(),o=this.parseMoveSuffix();if(o){if(n<0)throw new Error("uh-oh");if((o==="++"||o==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((o==="++"||o==="--")&&!l)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&l)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${o==="+"?"PLUS":"PLUSPLUS"}_\`})),o.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${o==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return tt(new B(r,n),t,d(this,T))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=d(this,T),[,r,n]=this.parseRegex(f2);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${t}: An amount can only start with 0 if it's exactly the digit 0.\`);return[wo(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=d(this,T),[,r,n]=this.parseRegex(f2);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${t}: An amount number can only start with 0 if it's exactly the digit 0.\`);return wo(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return q(this,T,d(this,T)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(q(this,T,d(this,T)+r[0].length),r)}remaining(){return d(this,it).slice(d(this,T))}popNext(){let t=d(this,it)[d(this,T)];return Da(this,T)._++,t}tryConsumeNext(t){return d(this,it)[d(this,T)]===t?(Da(this,T)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};it=new WeakMap,T=new WeakMap});function Eo(e){p2.has(e)||(console.warn(e),p2.add(e))}var p2,Ea=U(()=>{p2=new Set});var yn,ka=U(()=>{yt();ba();yn=class{constructor(t,r=1){if(this.quantum=t,this.amount=r,!Number.isInteger(this.amount)||this.amount<s2||this.amount>Al)throw new Error(\`Unit amount absolute value must be a non-negative integer from \${Dn} to \${Dn}.\`)}suffix(){let t="",r=Math.abs(this.amount);return r!==1&&(t+=r),this.amount<0&&(t+="'"),t}isIdentical(t){return this.quantum.isIdentical(t.quantum)&&this.amount===t.amount}*experimentalExpand(t,r){let n=Math.abs(this.amount),l=i2(t,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(l,r)}}});var Yt,je,qe,ko,P,Ne,Un,B,Ht=U(()=>{qt();yt();ba();va();Ea();ka();ko=class extends Uo{constructor(t,r,n){super();le(this,Yt,void 0);le(this,je,void 0);le(this,qe,void 0);if(q(this,Yt,t),q(this,je,r??null),q(this,qe,n??null),Object.freeze(this),d(this,je)!==null&&(!Number.isInteger(d(this,je))||d(this,je)<1||d(this,je)>Al))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Dn}.\`);if(d(this,qe)!==null&&(!Number.isInteger(d(this,qe))||d(this,qe)<1||d(this,qe)>Al))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Dn}.\`);if(d(this,qe)!==null&&d(this,je)!==null&&d(this,je)<=d(this,qe))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(d(this,qe)!==null&&d(this,je)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(t){return g2(t)}modified(t){return new ko(t.family??d(this,Yt),t.innerLayer??d(this,je),t.outerLayer??d(this,qe))}isIdentical(t){let r=t;return t.is(ko)&&d(this,Yt)===d(r,Yt)&&d(this,je)===d(r,je)&&d(this,qe)===d(r,qe)}get family(){return d(this,Yt)}get outerLayer(){return d(this,qe)}get innerLayer(){return d(this,je)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let t=d(this,Yt);return d(this,je)!==null&&(t=String(d(this,je))+t,d(this,qe)!==null&&(t=String(d(this,qe))+"-"+t)),t}},P=ko;Yt=new WeakMap,je=new WeakMap,qe=new WeakMap;Un=class extends We{constructor(...t){super();le(this,Ne,void 0);if(typeof t[0]=="string")if(t[1]??null){q(this,Ne,new yn(P.fromString(t[0]),t[1]));return}else return Un.fromString(t[0]);q(this,Ne,new yn(t[0],t[1]))}isIdentical(t){let r=t.as(Un);return!!r&&d(this,Ne).isIdentical(d(r,Ne))}invert(){return c2(this,new Un(d(this,Ne).quantum,-this.amount))}*experimentalExpand(t=V.Forwards){t===V.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return d(this,Ne).quantum}modified(t){return new Un(d(this,Ne).quantum.modified(t),t.amount??this.amount)}static fromString(t){return u2(t)}get amount(){return d(this,Ne).amount}get type(){return Eo("deprecated: type"),"blockMove"}get family(){return d(this,Ne).quantum.family??void 0}get outerLayer(){return d(this,Ne).quantum.outerLayer??void 0}get innerLayer(){return d(this,Ne).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return d(this,Ne).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let t=Math.abs(this.amount);return d(this,Ne).quantum.toString().slice(0,-10)+(t===1?"":t)+(this.amount<0?"--":"++")}return d(this,Ne).quantum.toString()+d(this,Ne).suffix()}},B=Un;Ne=new WeakMap});var m2,L2,at,_o,pt,vo=U(()=>{Vt();qt();yt();Ht();ka();m2=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(t){let r=this.tuple(t);return r?\`(\${r.map(n=>n.amount).join(", ")})\`:null}tuple(t){this.quantumU_SQ_||(this.quantumU_SQ_=new P("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new P("D_SQ_"));let r=t.alg;if(r.experimentalNumUnits()===2){let[n,l]=r.units();if(n.as(B)?.quantum.isIdentical(this.quantumU_SQ_)&&l.as(B)?.quantum.isIdentical(this.quantumD_SQ_)){if(t.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,l]}}return null}},L2=new m2,_o=class extends We{constructor(t,r){super();le(this,at,void 0);let n=ur(t);q(this,at,new yn(n,r))}isIdentical(t){let r=t;return t.is(_o)&&d(this,at).isIdentical(d(r,at))}get alg(){return d(this,at).quantum}get amount(){return d(this,at).amount}get experimentalRepetitionSuffix(){return d(this,at).suffix()}invert(){return new _o(d(this,at).quantum,-d(this,at).amount)}*experimentalExpand(t=V.Forwards,r){r??(r=1/0),r===0?yield t===V.Forwards?this:this.invert():yield*d(this,at).experimentalExpand(t,r-1)}static fromString(){throw new Error("unimplemented")}toString(){return L2.format(this)??\`(\${d(this,at).quantum.toString()})\${d(this,at).suffix()}\`}experimentalAsSquare1Tuple(){return L2.tuple(this)}},pt=_o;at=new WeakMap});var zo=U(()=>{vo();bl();yl();Ul();Ht();xl();wl()});function bt(e,t){return e instanceof t}function B2(e){return bt(e,pt)||bt(e,Ut)||bt(e,Ke)||bt(e,Qe)||bt(e,B)||bt(e,$e)||bt(e,et)}var _a=U(()=>{zo()});function R2(e,t,r){if(t.is(pt))return e.traverseGrouping(t,r);if(t.is(B))return e.traverseMove(t,r);if(t.is(Ke))return e.traverseCommutator(t,r);if(t.is(Qe))return e.traverseConjugate(t,r);if(t.is(et))return e.traversePause(t,r);if(t.is($e))return e.traverseNewline(t,r);if(t.is(Ut))return e.traverseLineComment(t,r);throw new Error("unknown unit")}function d2(e){if(e.is(pt)||e.is(B)||e.is(Ke)||e.is(Qe)||e.is(et)||e.is($e)||e.is(Ut))return e;throw"internal error: expected unit"}var bn,xn,Co,nm,Ca,za,h2,D2,Pa=U(()=>{vo();yl();Ht();xl();wl();Ul();bl();bn=class{traverseUnit(t,r){return R2(this,t,r)}traverseIntoUnit(t,r){return d2(this.traverseUnit(t,r))}},xn=class extends bn{traverseUnit(t){return R2(this,t,void 0)}traverseIntoUnit(t){return d2(this.traverseUnit(t))}},Ca=class extends bn{*traverseAlg(t,r){if(r.depth===0){yield*t.units();return}let n=[],l=null,o=r?.collapseMoves??!0;function i(f,g){var p;let c=Z0(p=Ca,Co,nm).call(p,f,g,r);if(c===0)return!1;let u=new B(f.quantum,c);return n.push(u),l=u,!0}function a(f){o&&l?.is(B)&&f.is(B)&&l.quantum.isIdentical(f.quantum)?(n.pop(),i(l,f.amount)||(l=n.slice(-1)[0])):f.is(B)?i(f,0):(n.push(f),l=f)}let s={depth:r.depth?r.depth-1:null};for(let f of t.units())for(let g of this.traverseUnit(f,s))a(g);for(let f of n)yield f}*traverseGrouping(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new pt(this.traverseAlg(t.alg,n))}*traverseMove(t,r){yield t}*traverseCommutator(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new Ke(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traverseConjugate(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new Qe(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traversePause(t,r){yield t}*traverseNewline(t,r){yield t}*traverseLineComment(t,r){yield t}},za=Ca;Co=new WeakSet,nm=function(t,r,n){let l=t.amount+r;if(n?.quantumMoveOrder){let o=n.quantumMoveOrder(t.quantum),i=Math.floor(o/2)+1-o;l=(l%o+o-i)%o+i}return l},le(za,Co);h2=new za,D2=h2.traverseAlg.bind(h2)});function F2(e){if(!e)return[];if(bt(e,_))return e.units();if(typeof e=="string")return Sa(e).units();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw"Invalid unit"}function ur(e){return bt(e,_)?e:new _(e)}function lm(e,t){return e.is($e)||t.is($e)?"":e.is(Ut)&&!t.is($e)?\`
|
|
8
|
-
\`:" "}var st,Wr,_,Vt=U(()=>{qt();_a();yt();va();Pa();bl();Ht();xl();Ea();Wr=class extends We{constructor(t){super();le(this,st,void 0);q(this,st,Array.from(F2(t)));for(let r of d(this,st))if(!B2(r))throw new Error("An alg can only contain units.")}isIdentical(t){let r=t;if(!t.is(Wr))return!1;let n=Array.from(d(this,st)),l=Array.from(d(r,st));if(n.length!==l.length)return!1;for(let o=0;o<n.length;o++)if(!n[o].isIdentical(l[o]))return!1;return!0}invert(){return new Wr(a2(Array.from(d(this,st)).map(t=>t.invert())))}*experimentalExpand(t=V.Forwards,r){r??(r=1/0);for(let n of Ua(d(this,st),t))yield*n.experimentalExpand(t,r)}expand(t){return new Wr(this.experimentalExpand(V.Forwards,t?.depth??1/0))}*experimentalLeafMoves(){for(let t of this.experimentalExpand())t.is(B)&&(yield t)}concat(t){return new Wr(Array.from(d(this,st)).concat(Array.from(F2(t))))}experimentalIsEmpty(){for(let t of d(this,st))return!1;return!0}static fromString(t){return Sa(t)}*units(){for(let t of d(this,st))yield t}experimentalNumUnits(){return Array.from(d(this,st)).length}get type(){return Eo("deprecated: type"),"sequence"}toString(){let t="",r=null;for(let n of d(this,st))r&&(t+=lm(r,n)),t+=n.toString(),r=n;return t}simplify(t){return new Wr(D2(this,t??{}))}},_=Wr;st=new WeakMap});var om,A2=U(()=>{Vt();zo();yl();Ul();Ht();wl();om={Sune:new _([new B("R",1),new B("U",1),new B("R",-1),new B("U",1),new B("R",1),new B("U",-2),new B("R",-1)]),AntiSune:new _([new B("R",1),new B("U",2),new B("R",-1),new B("U",-1),new B("R",1),new B("U",-1),new B("R",-1)]),SuneCommutator:new _([new Ke(new _([new B("R",1),new B("U",1),new B("R",-2)]),new _([new Qe(new _([new B("R",1)]),new _([new B("U",1)]))]))]),Niklas:new _([new B("R",1),new B("U",-1),new B("L",-1),new B("U",1),new B("R",-1),new B("U",-1),new B("L",1),new B("U",1)]),EPerm:new _([new B("x",-1),new Ke(new _([new Qe(new _([new B("R",1)]),new _([new B("U",-1)]))]),new _([new B("D",1)])),new Ke(new _([new Qe(new _([new B("R",1)]),new _([new B("U",1)]))]),new _([new B("D",1)])),new B("x",1)]),FURURFCompact:new _([new Qe(new _([new B("F",1)]),new _([new Ke(new _([new B("U",1)]),new _([new B("R",1)]))]))]),APermCompact:new _([new Qe(new _([new B("R",2)]),new _([new Ke(new _([new B("F",2)]),new _([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new _([new B("F",1),new B("U",1),new B("R",1),new B("U",-1),new B("R",-1),new B("F",-1)]),TPerm:new _([new B("R",1),new B("U",1),new B("R",-1),new B("U",-1),new B("R",-1),new B("F",1),new B("R",2),new B("U",-1),new B("R",-1),new B("U",-1),new B("R",1),new B("U",1),new B("R",-1),new B("F",-1)]),HeadlightSwaps:new _([new Qe(new _([new B("F",1)]),new _([new pt(new _([new Ke(new _([new B("R",1)]),new _([new B("U",1)]))]),3)]))]),TriplePause:new _([new et,new et,new et])}});var oA,y2=U(()=>{Ht();oA={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'")}});var U2=U(()=>{});var b2=U(()=>{Vt()});var Re=U(()=>{Vt();xa();Pa();A2();y2();zo();Ht();U2();b2();_a();yt()});function Sl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(vl(o.numOrientations,a))n[l]=i;else if(vl(o.numOrientations,i))n[l]=a;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.permutation[a.permutation[f]];n[l]={permutation:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.permutation[a.permutation[g]];n[l]={permutation:s,orientation:f}}}}return n}function Ma(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(vl(o.numOrientations,a))n[l]=i;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.pieces[a.permutation[f]];n[l]={pieces:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.pieces[a.permutation[g]];n[l]={pieces:s,orientation:f}}}}return n}var Po=U(()=>{El()});function im(e){let t=w2.get(e);if(t)return t;let r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[o]=o,n[o]=0;let l={permutation:r,orientation:n};return x2&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),w2.set(e,l),l}function S2(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=im(n.numPieces);return x2&&Object.freeze(t),t}function v2(e,t){let r=t.quantum.toString(),n=e.definition.moves[r];if(!n){let i=e.definition.experimentalDerivedMoves?.[r];i&&(n=e.algToTransformation(i).transformationData)}if(n)return cr(e,n,t.amount);let l=e.definition.moves[t.toString()];if(l)return l;let o=e.definition.moves[t.invert().toString()];if(o)return cr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var x2,w2,Na=U(()=>{El();x2=!1,w2=new Map});var de,Mo=U(()=>{Po();kl();de=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}static fromTransformation(t){let r=Ma(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new de(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new de(this.kpuzzle,this.stateData);let r=Ma(this.kpuzzle.definition,this.stateData,t.transformationData);return new de(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new xt(this.kpuzzle,t)}}});var Kr,pr,xt,kl=U(()=>{El();Po();Na();Mo();pr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;le(this,Kr,void 0)}invert(){return new pr(this.kpuzzle,Ga(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return d(this,Kr)??q(this,Kr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new pr(t,S2(t.definition));return q(r,Kr,!0),r}isIdentical(t){return E2(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return d(this,Kr)?new pr(this.kpuzzle,t.transformationData):d(t,Kr)?new pr(this.kpuzzle,this.transformationData):new pr(this.kpuzzle,Sl(this.kpuzzle.definition,this.transformationData,t.transformationData))}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}toKState(){return de.fromTransformation(this)}repetitionOrder(){return k2(this.kpuzzle.definition,this)}selfMultiply(t){return new pr(this.kpuzzle,cr(this.kpuzzle,this.transformationData,t))}},xt=pr;Kr=new WeakMap});function vl(e,t){let{permutation:r}=t,n=r.length;for(let l=0;l<n;l++)if(r[l]!==l)return!1;if(e>1){let{orientation:l}=t;for(let o=0;o<n;o++)if(l[o]!==0)return!1}return!0}function am(e,t,r,n={}){for(let l=0;l<e.numPieces;l++)if(!n?.ignoreOrientation&&t.orientation[l]!==r.orientation[l]||!n?.ignorePermutation&&t.permutation[l]!==r.permutation[l])return!1;return!0}function E2(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!am(l,t[n],r[n]))return!1;return!0}function Ga(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(vl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)i[o.permutation[a]]=a;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),a=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++){let f=o.permutation[s];i[f]=s,a[f]=(l.numOrientations-o.orientation[s]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:a}}}return r}function cr(e,t,r){if(r===1)return t;if(r<0)return cr(e,Ga(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=cr(e,t,Math.floor(r/2)));let l=Sl(e.definition,n,n);return r%2==0?l:Sl(e.definition,t,l)}function Oa(e,t){return t?Oa(t,e%t):e}function k2(e,t){let r=1;for(let n in e.orbits){let l=e.orbits[n],o=t.transformationData[n],i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)if(!i[a]){let s=a,f=0,g=0;for(;i[s]=!0,f=f+o.orientation[s],g=g+1,s=o.permutation[s],s!==a;);f!==0&&(g=g*l.numOrientations/Oa(l.numOrientations,f)),r=r*g/Oa(r,g)}}return r}var _2,z2,C2,El=U(()=>{Re();Po();kl();_2=class extends bn{traverseAlg(t,r){let n=null;for(let l of t.units())n?n=n.applyTransformation(this.traverseUnit(l,r)):n=this.traverseUnit(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new xt(r,cr(r,n.transformationData,t.amount))}traverseMove(t,r){return r.moveToTransformation(t)}traverseCommutator(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert()).applyTransformation(l.invert())}traverseConjugate(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert())}traversePause(t,r){return r.identityTransformation()}traverseNewline(t,r){return r.identityTransformation()}traverseLineComment(t,r){return r.identityTransformation()}},z2=new _2,C2=z2.traverseAlg.bind(z2)});var wn,No,we,Ta=U(()=>{Re();El();Na();Mo();kl();we=class{constructor(t,r){this.definition=t;le(this,wn,new Map);le(this,No,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return xt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=d(this,wn).get(r);if(n)return new xt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return d(this,wn).set(r,o),new xt(this,o)}let l=v2(this,t);return d(this,wn).set(r,l),new xt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new _(t)),C2(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(_)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new de(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return d(this,No)??q(this,No,(()=>{for(let[t,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let l of this.definition.startStateData[t].pieces)n[l]=!0;for(let l of n)if(!l)return!1}return!0})())}get state(){throw new Error("KPuzzle is now a different (stateless) class.")}reset(){throw new Error("KPuzzle is now a different (stateless) class.")}applyMove(t){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(t){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};wn=new WeakMap,No=new WeakMap});var Fe,P2=U(()=>{Fe={name:"3x3x3",orbits:{EDGES:{numPieces:12,numOrientations:2},CORNERS:{numPieces:8,numOrientations:3},CENTERS:{numPieces:6,numOrientations:4}},startStateData:{EDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{pieces:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}},moves:{U:{EDGES:{permutation:[1,2,3,0,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[1,0,0,0,0,0]}},y:{EDGES:{permutation:[1,2,3,0,5,6,7,4,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,3]}},x:{EDGES:{permutation:[4,8,0,9,6,10,2,11,5,7,1,3],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,3,0,1,2,2]}},L:{EDGES:{permutation:[0,1,2,11,4,5,6,9,8,3,10,7],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,1,0,0,0,0]}},F:{EDGES:{permutation:[9,1,2,3,8,5,6,7,0,4,10,11],orientation:[1,0,0,0,1,0,0,0,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,1,0,0,0]}},R:{EDGES:{permutation:[0,8,2,3,4,10,6,7,5,9,1,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,1,0,0]}},B:{EDGES:{permutation:[0,1,10,3,4,5,11,7,8,9,6,2],orientation:[0,0,1,0,0,0,1,0,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,1,0]}},D:{EDGES:{permutation:[0,1,2,3,7,4,5,6,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,1]}},z:{EDGES:{permutation:[9,3,11,7,8,1,10,5,0,4,2,6],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,3,1]}},M:{EDGES:{permutation:[2,1,6,3,0,5,4,7,8,9,10,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,0,0,0,2,0]}},E:{EDGES:{permutation:[0,1,2,3,4,5,6,7,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,0]}},S:{EDGES:{permutation:[0,3,2,7,4,1,6,5,8,9,10,11],orientation:[0,1,0,1,0,1,0,1,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,0,1,0,1]}},u:{EDGES:{permutation:[1,2,3,0,4,5,6,7,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,0]}},l:{EDGES:{permutation:[2,1,6,11,0,5,4,9,8,3,10,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,0,2,0]}},f:{EDGES:{permutation:[9,3,2,7,8,1,6,5,0,4,10,11],orientation:[1,1,0,1,1,1,0,1,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,0,1]}},r:{EDGES:{permutation:[4,8,0,3,6,10,2,7,5,9,1,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,0,0,1,2,2]}},b:{EDGES:{permutation:[0,5,10,1,4,7,11,3,8,9,6,2],orientation:[0,1,1,1,0,1,1,1,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,0,3,1,3]}},d:{EDGES:{permutation:[0,1,2,3,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,1]}}}};Fe.moves.Uw=Fe.moves.u;Fe.moves.Lw=Fe.moves.l;Fe.moves.Fw=Fe.moves.f;Fe.moves.Rw=Fe.moves.r;Fe.moves.Bw=Fe.moves.b;Fe.moves.Dw=Fe.moves.d;Fe.moves.Rv=Fe.moves.x;Fe.moves.Uv=Fe.moves.y;Fe.moves.Fv=Fe.moves.z;Fe.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Fe.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Fe.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});var Ia,Ve=U(()=>{Ta();Mo();kl();P2();Ta();Ia=new we(Fe)});var M2=U(()=>{Ve()});var sm,py,N2=U(()=>{sm={"333":{puzzleID:"3x3x3",eventName:"3x3x3 Cube"},"222":{puzzleID:"2x2x2",eventName:"2x2x2 Cube"},"444":{puzzleID:"4x4x4",eventName:"4x4x4 Cube"},"555":{puzzleID:"5x5x5",eventName:"5x5x5 Cube"},"666":{puzzleID:"6x6x6",eventName:"6x6x6 Cube"},"777":{puzzleID:"7x7x7",eventName:"7x7x7 Cube"},"333bf":{puzzleID:"3x3x3",eventName:"3x3x3 Blindfolded"},"333fm":{puzzleID:"3x3x3",eventName:"3x3x3 Fewest Moves"},"333oh":{puzzleID:"3x3x3",eventName:"3x3x3 One-Handed"},clock:{puzzleID:"clock",eventName:"Clock"},minx:{puzzleID:"megaminx",eventName:"Megaminx"},pyram:{puzzleID:"pyraminx",eventName:"Pyraminx"},skewb:{puzzleID:"skewb",eventName:"Skewb"},sq1:{puzzleID:"square1",eventName:"Square-1"},"444bf":{puzzleID:"4x4x4",eventName:"4x4x4 Blindfolded"},"555bf":{puzzleID:"5x5x5",eventName:"5x5x5 Blindfolded"},"333mb":{puzzleID:"3x3x3",eventName:"3x3x3 Multi-Blind"}},py={...sm,fto:{puzzleID:"fto",eventName:"Face-Turning Octahedron"},master_tetraminx:{puzzleID:"master_tetraminx",eventName:"Master Tetraminx"},kilominx:{puzzleID:"kilominx",eventName:"Kilominx"},redi_cube:{puzzleID:"redi_cube",eventName:"Redi Cube"}}});function dm(e){switch(e){case x.Regular:return fm;case x.Dim:return Lm;case x.Ignored:return um;case x.OrientationStickers:return gm;case x.Invisible:return cm;case x.IgnoreNonPrimary:return pm;case x.PermuteNonPrimary:return mm;case x.Ignoriented:return Bm;case x.OrientationWithoutPermutation:return Rm}}var x,Sn,Mt,He,vn,Go,Qr,fm,um,gm,cm,pm,mm,Lm,Bm,Rm,_l,zl,Cl=U(()=>{(function(f){f.Regular="Regular",f.Dim="Dim",f.Ignored="Ignored",f.OrientationStickers="OrientationStickers",f.Invisible="Invisible",f.Ignoriented="Ignoriented",f.IgnoreNonPrimary="IgnoreNonPrimary",f.PermuteNonPrimary="PermuteNonPrimary",f.OrientationWithoutPermutation="OrientationWithoutPermutation"})(x||(x={}));Sn=class{constructor(t,r){this.stickerings=new Map;for(let[n,l]of Object.entries(t.definition.orbits))this.stickerings.set(n,new Array(l.numPieces).fill(r))}},Mt="regular",He="ignored",vn="oriented",Go="invisible",Qr="dim",fm={facelets:[Mt,Mt,Mt,Mt,Mt]},um={facelets:[He,He,He,He,He]},gm={facelets:[vn,vn,vn,vn,vn]},cm={facelets:[Go,Go,Go,Go]},pm={facelets:[Mt,He,He,He,He]},mm={facelets:[Qr,Mt,Mt,Mt,Mt]},Lm={facelets:[Qr,Qr,Qr,Qr,Qr]},Bm={facelets:[Qr,He,He,He,He]},Rm={facelets:[vn,He,He,He,He]};_l=class extends Sn{constructor(t){super(t,x.Regular)}set(t,r){for(let[n,l]of this.stickerings.entries())for(let o=0;o<l.length;o++)t.stickerings.get(n)[o]&&(l[o]=r);return this}toAppearance(){let t={orbits:{}};for(let[r,n]of this.stickerings.entries()){let l=[],o={pieces:l};t.orbits[r]=o;for(let i of n)l.push(dm(i))}return t}},zl=class{constructor(t){this.kpuzzle=t}and(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!0;for(let i of t)if(!i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!1;continue e}}}return r}or(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!1;for(let i of t)if(i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!0;continue e}}}return r}not(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<l.numPieces;o++)r.stickerings.get(n)[o]=!t.stickerings.get(n)[o];return r}all(){return this.and(this.moves([]))}move(t){let r=this.kpuzzle.moveToTransformation(t),n=new Sn(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}}});function hm(e){(async()=>{G2=e;let t=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${t.length} players!\`);let r=[];for(let n of t)r.push((async()=>{let l=await n.experimentalModel.stickering.get();n.experimentalStickering=l==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function O2(e,t){G2(e,t)}var G2,T2=U(()=>{Cl();G2=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=hm,window.PieceStickering=x,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Nt(e,t){let r=await e.kpuzzle(),n=new _l(r),l=new zl(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.not(i()),s=()=>l.or(l.moves(["L","R"])),f=()=>l.not(s()),g=()=>l.or(l.moves(["F","B"])),c=()=>l.not(g()),u=()=>l.not(o()),p=()=>l.and([o(),f(),c()]),m=()=>l.and([l.and(l.moves(["F","R"])),l.not(i())]),L=()=>l.and(l.moves(["D","R","F"])),R=()=>l.or([L(),m()]),h=()=>l.or([l.and([f(),a()]),l.and([f(),c()]),l.and([a(),c()])]),y=()=>l.or([l.and([f(),i(),g()]),l.and([a(),s(),g()]),l.and([c(),i(),s()])]),A=()=>l.not(l.or([h(),y()])),k=()=>l.or([f(),l.and([o(),y()])]);function E(){n.set(u(),x.Dim)}function Q(){n.set(o(),x.PermuteNonPrimary),n.set(p(),x.Dim)}function $(){n.set(o(),x.IgnoreNonPrimary),n.set(p(),x.Regular)}function N(){n.set(o(),x.Ignoriented),n.set(p(),x.Dim)}switch(t){case"full":break;case"PLL":E(),Q();break;case"CLS":E(),n.set(l.and(l.moves(["D","R","F"])),x.Regular),n.set(o(),x.Ignoriented),n.set(l.and([o(),f(),c()]),x.Dim),n.set(l.and([o(),A()]),x.IgnoreNonPrimary);break;case"OLL":E(),$();break;case"COLL":E(),Q(),n.set(l.and([o(),A()]),x.Regular);break;case"OCLL":E(),N(),n.set(l.and([o(),A()]),x.IgnoreNonPrimary);break;case"CLL":E(),n.set(l.not(l.and([A(),o()])),x.Dim);break;case"ELL":E(),n.set(o(),x.Dim),n.set(l.and([o(),y()]),x.Regular);break;case"ELS":E(),$(),n.set(l.and([o(),A()]),x.Ignored),n.set(m(),x.Regular),n.set(L(),x.Ignored);break;case"LL":E();break;case"F2L":n.set(o(),x.Ignored);break;case"ZBLL":E(),n.set(o(),x.PermuteNonPrimary),n.set(p(),x.Dim),n.set(l.and([o(),A()]),x.Regular);break;case"ZBLS":E(),n.set(R(),x.Regular),$(),n.set(l.and([o(),A()]),x.Ignored);break;case"WVLS":case"VLS":E(),n.set(R(),x.Regular),$();break;case"LS":E(),n.set(R(),x.Regular),n.set(o(),x.Ignored),n.set(p(),x.Dim);break;case"EO":n.set(A(),x.Ignored),n.set(y(),x.OrientationWithoutPermutation);break;case"EOline":n.set(A(),x.Ignored),n.set(y(),x.OrientationWithoutPermutation),n.set(l.and(l.moves(["D","M"])),x.Regular);break;case"EOcross":n.set(y(),x.OrientationWithoutPermutation),n.set(l.move("D"),x.Regular),n.set(A(),x.Ignored);break;case"CMLL":n.set(u(),x.Dim),n.set(k(),x.Ignored),n.set(l.and([o(),A()]),x.Regular);break;case"L6E":n.set(l.not(k()),x.Dim);break;case"L6EO":n.set(l.not(k()),x.Dim),n.set(k(),x.OrientationWithoutPermutation),n.set(l.and([h(),i()]),x.OrientationStickers);break;case"Daisy":n.set(l.all(),x.Ignored),n.set(h(),x.Dim),n.set(l.and([l.move("D"),h()]),x.Regular),n.set(l.and([l.move("U"),y()]),x.IgnoreNonPrimary);break;case"Cross":n.set(l.all(),x.Ignored),n.set(h(),x.Dim),n.set(l.and([l.move("D"),h()]),x.Regular),n.set(l.and([l.move("D"),y()]),x.Regular);break;case"2x2x2":n.set(l.or(l.moves(["U","F","R"])),x.Ignored),n.set(l.and([l.or(l.moves(["U","F","R"])),h()]),x.Dim);break;case"2x2x3":n.set(l.all(),x.Dim),n.set(l.or(l.moves(["U","F","R"])),x.Ignored),n.set(l.and([l.or(l.moves(["U","F","R"])),h()]),x.Dim),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),x.Regular);break;case"Void Cube":n.set(h(),x.Invisible);break;case"picture":case"invisible":n.set(l.all(),x.Invisible);break;case"centers-only":n.set(l.not(h()),x.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":O2(n,l);break;default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),x.Dim)}return n.toAppearance()}async function En(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","EOline","EOcross","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only"]}var kn=U(()=>{Cl();T2()});function Ae(e){let t=null;return()=>t??(t=e())}var Jt=U(()=>{});var Pl,I2=U(()=>{Pl=class{constructor(t,r){this.facenames=t;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<t.length;n++)for(let l=0;this.prefixFree&&l<t.length;l++)n!==l&&t[n].startsWith(t[l])&&(this.prefixFree=!1)}setGripNames(t){this.gripnames=t}splitByFaceNames(t){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let l=-1;for(let o=0;o<this.facenames.length;o++)t.substr(n).startsWith(this.facenames[o])&&(l<0||this.facenames[o].length>this.facenames[l].length)&&(l=o);if(l>=0)r.push(l),n+=this.facenames[l].length;else throw new Error("Could not split "+t+" into face names.")}return r}joinByFaceIndices(t){let r="",n=[];for(let l=0;l<t.length;l++)n.push(r),n.push(this.facenames[t[l]]),this.prefixFree||(r="_");return n.join("")}spinmatch(t,r){if(t===r)return!0;try{let n=this.splitByFaceNames(t),l=this.splitByFaceNames(r);if(n.length!==l.length&&n.length<3)return!1;for(let o=0;o<n.length;o++){for(let a=0;a<o;a++)if(n[o]===n[a])return!1;let i=!1;for(let a=0;a<l.length;a++)if(n[o]===l[a]){i=!0;break}if(!i)return!1}return!0}catch(n){return!1}}spinmatchv(t,r){return t.endsWith("v")&&r.endsWith("v")?this.spinmatch(t.slice(0,t.length-1),r.slice(0,r.length-1)):this.spinmatch(t,r)}unswizzle(t){(t.endsWith("v")||t.endsWith("w"))&&t[0]<="Z"&&(t=t.slice(0,t.length-1));let r=t.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let l=this.gripnames[n];if(this.spinmatch(r,l))return l}return t}}});var _n,W2=U(()=>{_n=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Oo,K2=U(()=>{Re();Oo=class{constructor(t,r){this.child=t;this.sw=r}notationToInternal(t){return t.family==="T"&&t.innerLayer===void 0&&t.outerLayer===void 0?new B(new P("FLRv",t.innerLayer,t.outerLayer),t.amount):this.child.notationToInternal(t)}notationToExternal(t){let r=t.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new B(new P("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Ml,Q2=U(()=>{Re();Ml=class{constructor(t,r){this.internalNames=t;this.externalNames=r}convertString(t,r,n){let l="";(t.endsWith("v")||t.endsWith("v"))&&t<="_"&&(l=t.slice(t.length-1),t=t.slice(0,t.length-1));let o=t.toUpperCase(),i=!1;return t!==o&&(i=!0,t=o),t=n.joinByFaceIndices(r.splitByFaceNames(t)),i&&(t=t.toLowerCase()),t+l}convert(t,r,n){let l=t.family,o=this.convertString(l,r,n);return l===o?t:new B(new P(o,t.innerLayer,t.outerLayer),t.amount)}notationToInternal(t){return this.convert(t,this.externalNames,this.internalNames)}notationToExternal(t){return this.convert(t,this.internalNames,this.externalNames)}}});var To,j2=U(()=>{Re();To=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer===void 0&&t.outerLayer===void 0){if(Math.abs(t.amount)===1){if(t.family==="R++")return new B(new P("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new P("L",3,2),2*t.amount);if(t.family==="D++")return new B(new P("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new P("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new P("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new P("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="Uv"?new B(new P("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Io,q2=U(()=>{Re();Io=class{constructor(t){this.slices=t}notationToInternal(t){let r=t.family;return!t.innerLayer&&!t.outerLayer&&(r==="x"?t=new B("Rv",t.amount):r==="y"?t=new B("Uv",t.amount):r==="z"&&(t=new B("Fv",t.amount)),(this.slices&1)==1&&(r==="E"?t=new B(new P("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new P("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new P("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new P("D",this.slices-1,2),t.amount):r==="m"?t=new B(new P("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new P("F",this.slices-1,2),t.amount)))),t}notationToExternal(t){let r=t.family;if(!t.innerLayer&&!t.outerLayer){if(r==="Rv")return new B("x",t.amount);if(r==="Uv")return new B("y",t.amount);if(r==="Fv")return new B("z",t.amount);if(r==="Lv")return new B("x",-t.amount);if(r==="Dv")return new B("y",-t.amount);if(r==="Bv")return new B("z",-t.amount)}return t}}});var Dm,Fm,V2,H2,Y2,Nl,Wo,J2=U(()=>{Re();Dm={U:"frl",L:"fld",R:"fdr",B:"dlr",u:"FRL",l:"FLD",r:"FDR",b:"DLR",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R"},Fm={U:"FRL",L:"FLD",R:"FDR",B:"DLR",u:"frl",l:"fld",r:"fdr",b:"dlr",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R",d:"d",f:"f",bl:"l",br:"r"},V2={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},H2=new P("y"),Y2=new P("Dv"),Nl=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=Dm}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=V2[t.family];if(n)return new B(new P(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new P(r,t.innerLayer,t.outerLayer),t.amount):H2.isIdentical(t.quantum)?new B(Y2,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(V2))if(this.child.spinmatch(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount);return Y2.isIdentical(t.quantum)?new B(H2,-t.amount):null}},Wo=class extends Nl{constructor(t){super(t);this.map=Fm}}});var Z2,Wa,X2,Am,Ka,$2,ym,Qa,ef,Um,Ko,tf=U(()=>{Re();Z2={U:"UBL",UL:"ULF",F:"UFR",UR:"URB",B:"DBL",D:"DFR",L:"DLF",R:"DRB",Uv:"UBLv",ULv:"ULFv",Fv:"UFRv",URv:"URBv",Bv:"DBLv",Dv:"DFRv",Lv:"DLFv",Rv:"DRBv"},Wa=new P("x"),X2=new P("Rv"),Am=new P("Lv"),Ka=new P("y"),$2=new P("Uv"),ym=new P("Dv"),Qa=new P("z"),ef=new P("Fv"),Um=new P("Bv"),Ko=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Z2[t.family];return r?new B(new P(r,t.outerLayer,t.innerLayer),t.amount):Wa.isIdentical(t.quantum)?new B(X2,t.amount):Ka.isIdentical(t.quantum)?new B($2,t.amount):Qa.isIdentical(t.quantum)?new B(ef,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Z2))if(this.child.spinmatchv(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount);return X2.isIdentical(t.quantum)?new B(Wa,t.amount):Am.isIdentical(t.quantum)?new B(Wa,-t.amount):$2.isIdentical(t.quantum)?new B(Ka,t.amount):ym.isIdentical(t.quantum)?new B(Ka,-t.amount):ef.isIdentical(t.quantum)?new B(Qa,t.amount):Um.isIdentical(t.quantum)?new B(Qa,-t.amount):null}}});var ja=U(()=>{W2();K2();Q2();j2();q2();J2();tf()});function rf(e){let t=0,r={};for(;t<e.length&&e[t][0]==="-";){let l=e[t++];if(l==="--rotations")r.addRotations=!0;else if(l==="--allmoves")r.allMoves=!0;else if(l==="--outerblockmoves")r.outerBlockMoves=!0;else if(l==="--vertexmoves")r.vertexMoves=!0;else if(l==="--nocorners")r.includeCornerOrbits=!1;else if(l==="--noedges")r.includeEdgeOrbits=!1;else if(l==="--noorientation")r.fixedOrientation=!0;else if(l==="--nocenters")r.includeCenterOrbits=!1;else if(l==="--omit")r.excludeOrbits=e[t].split(","),t++;else if(l==="--moves")r.moveList=e[t].split(","),t++;else if(l==="--optimize")r.optimizeOrbits=!0;else if(l==="--scramble")r.scrambleAmount=100;else if(l==="--fixcorner")r.fixedPieceType="v";else if(l==="--fixedge")r.fixedPieceType="e";else if(l==="--fixcenter")r.fixedPieceType="f";else if(l==="--orientcenters")r.orientCenters=!0;else if(l==="--puzzleorientation")r.puzzleOrientation=JSON.parse(e[t]),t++;else throw new Error("Bad option: "+l)}return{puzzleDescription:Gl(e.slice(t).join(" ")),options:r}}var qa,Va=U(()=>{Qo();qa=class{constructor(t={}){this.verbosity=0;this.allMoves=!1;this.vertexMoves=!1;this.addRotations=!1;this.moveList=null;this.fixedOrientation=!1;this.fixedPieceType=null;this.orientCenters=!1;this.includeCornerOrbits=!0;this.includeCenterOrbits=!0;this.includeEdgeOrbits=!0;this.excludeOrbits=[];this.optimizeOrbits=!1;this.grayCorners=!1;this.grayCenters=!1;this.grayEdges=!1;this.puzzleOrientation=null;this.puzzleOrientations=null;this.scrambleAmount=0;Object.assign(this,t)}}});function mr(e){if(!Ha[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;Ha[e]=t}return Ha[e]}function Gt(e){if(!Ya[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;Ya[e]=t}return Ya[e]}function nf(e){return new Bt(Gt(e))}function lf(e){let t=1;for(;e>1;)t*=e,e--;return t}function bm(e,t){if(e>t){let r=e;e=t,t=r}for(;e>0;){let r=t%e;t=e,e=r}return t}function Ja(e,t){return e/bm(e,t)*t}var Ha,Ya,Bt,jo=U(()=>{Ha=[],Ya=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return"Perm["+this.p.join(" ")+"]"}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push("("+l.join(",")+")")}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=Ja(t,l)}return t}}});function Za(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function of(e,t){let r=e.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],l=[];for(let i=0;i<r;i++){let a=e.moveops[i];n.push(a.order());let s=0;for(let f=0;f<r;f++){if(f===i)continue;let g=e.moveops[f];a.mul(g).equal(g.mul(a))&&(s|=1<<f)}l.push(s)}let o={};o[0]=1;for(let i=0;i<100;i++){let a=0,s={},f=0;for(let g in o){let c=+g,u=o[c];a+=u,f++;for(let p=0;p<n.length;p++)if((c>>p&1)==0&&(c&l[p]&(1<<p)-1)==0){let m=c&l[p]|1<<p;s[m]===void 0&&(s[m]=0),s[m]+=(n[p]-1)*u}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var Ol,xm,zn,wt,Zt,Xa,Lr,Cn,$a,af=U(()=>{Re();ja();jo();Ol=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return lf(this.size)*Math.pow(this.mod,this.size)}},xm=0;zn=class{constructor(t,r,n,l,o){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}toKsolve(t,r=new _n){let n=[];n.push("Name "+t),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=Za(r,this.movenames[l]),i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)i?this.moveops[l].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[l].orbits[a].appendDefinition(n,this.orbitnames[a],!0);n.push("End")}return n}toKPuzzleDefinition(t){let r={},n={};for(let o=0;o<this.orbitnames.length;o++){r[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let i=this.solved.orbits[o].toKPuzzle();n[this.orbitnames[o]]={pieces:i.permutation,orientation:i.orientation}}let l={};if(t)for(let o=0;o<this.movenames.length;o++)l[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++xm}\`,orbits:r,startStateData:n,moves:l}}optimize(){let t=[],r=[],n=[],l=[];for(let o=0;o<this.moveops.length;o++)l.push([]);for(let o=0;o<this.orbitdefs.length;o++){let i=this.orbitdefs[o].mod,a=this.orbitdefs[o].size,s=new $a(a),f=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)f[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let m=0;m<a;m++)(this.moveops[p].orbits[o].perm[m]!==m||this.moveops[p].orbits[o].ori[m]!==0)&&(f[m]=!0,s.union(m,this.moveops[p].orbits[o].perm[m]));let g=!0;if(i>1){g=!1;let p=new $a(this.orbitdefs[o].size*i);for(let m=0;m<this.moveops.length;m++)for(let L=0;L<a;L++)if(this.moveops[m].orbits[o].perm[L]!==L||this.moveops[m].orbits[o].ori[L]!==0)for(let R=0;R<i;R++)p.union(L*i+R,this.moveops[m].orbits[o].perm[L]*i+(R+this.moveops[m].orbits[o].ori[L])%i);for(let m=0;!g&&m<a;m++)for(let L=1;L<i;L++)p.find(m*i)===p.find(m*i+L)&&(g=!0);for(let m=0;!g&&m<a;m++)for(let L=0;L<m;L++)this.solved.orbits[o].perm[m]===this.solved.orbits[o].perm[L]&&(g=!0)}let c=-1,u=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let m=s.find(p);c<0?c=m:c!==m&&(u=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let L=[],R=[],h=0;for(let y=0;y<this.orbitdefs[o].size;y++)s.find(y)===p&&(L[h]=y,R[y]=h,h++);if(u?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),g){r.push(new Ol(h,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(L,h));for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h))}else{r.push(new Ol(h,1)),n.push(this.solved.orbits[o].remapVS(L,h).killOri());for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h).killOri())}}}return new zn(t,r,new Cn(n),this.movenames,l.map(o=>new Lr(o)))}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),a=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[a]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[a]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=1;for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},wt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new wt(Gt(t),mr(t),r)}mul(t){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let l=0;l<r;l++)n[l]=this.perm[t.perm[l]];return new wt(n,this.ori,this.orimod)}else{let l=new Array(r);for(let o=0;o<r;o++)n[o]=this.perm[t.perm[o]],l[o]=(this.ori[t.perm[o]]+t.ori[o])%this.orimod;return new wt(n,l,this.orimod)}}inv(){let t=this.perm.length,r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[this.perm[l]]=l,n[this.perm[l]]=(this.orimod-this.ori[l])%this.orimod;return new wt(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let a=l+1;a<r;a++)this.perm[a]===o&&i.push(a);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Gt(t)&&this.ori===mr(t))return!0;for(let r=0;r<t;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let t=this.perm.length;if(this.ori===mr(t))return!0;for(let r=0;r<t;r++)if(this.ori[r]!==0)return!1;return!0}remap(t,r,n){let l=new Array(n),o=new Array(n);for(let i=0;i<n;i++)l[i]=r[this.perm[t[i]]],o[i]=this.ori[t[i]];return new wt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let a=0;a<r;a++){let s=this.perm[t[a]];i[s]===void 0&&(i[s]=o++),n[a]=i[s],l[a]=this.ori[t[a]]}return new wt(n,l,this.orimod)}appendDefinition(t,r,n,l=!0){if(!(l&&this.isIdentity())&&(t.push(r),t.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let i=0;i<o.length;i++)o[this.perm[i]]=this.ori[i];t.push(o.join(" "))}else t.push(this.ori.join(" "))}toKPuzzle(){let t=this.perm.length;return this.isIdentity()?(wt.kcache[t]||(wt.kcache[t]={permutation:Gt(t),orientation:mr(t)}),wt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Zt=wt;Zt.kcache=[];Xa=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=Ja(t,r.order());return t}},Lr=class extends Xa{constructor(t){super(t)}mul(t){return new Lr(this.internalMul(t))}mulScalar(t){if(t===0)return this.e();let r=this;for(t<0&&(r=r.inv(),t=-t);(t&1)==0;)r=r.mul(r),t>>=1;if(t===1)return r;let n=r,l=this.e();for(;t>0;)t&1&&(l=l.mul(n)),t>1&&(n=n.mul(n)),t>>=1;return l}inv(){return new Lr(this.internalInv())}e(){return new Lr(this.orbits.map(t=>Zt.e(t.perm.length,t.orimod)))}},Cn=class extends Xa{constructor(t){super(t)}mul(t){return new Cn(this.internalMul(t))}},$a=class{constructor(t){this.n=t;this.heads=new Array(t);for(let r=0;r<t;r++)this.heads[r]=r}find(t){let r=this.heads[t];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[t]=r),r}union(t,r){let n=this.find(t),l=this.find(r);n<l?this.heads[l]=n:n>l&&(this.heads[n]=l)}}});var qo,sf=U(()=>{qo={"2x2x2":"c f 0","3x3x3":"c f 0.333333333333333","4x4x4":"c f 0.5 f 0","5x5x5":"c f 0.6 f 0.2","6x6x6":"c f 0.666666666666667 f 0.333333333333333 f 0","7x7x7":"c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143","8x8x8":"c f 0.75 f 0.5 f 0.25 f 0","9x9x9":"c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111","10x10x10":"c f 0.8 f 0.6 f 0.4 f 0.2 f 0","11x11x11":"c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909","12x12x12":"c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0","13x13x13":"c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769","20x20x20":"c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9","30x30x30":"c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333","40x40x40":"c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95",skewb:"c v 0","master skewb":"c v 0.275","professor skewb":"c v 0 v 0.38","compy cube":"c v 0.915641442663986",helicopter:"c e 0.707106781186547","curvy copter":"c e 0.83",dino:"c v 0.577350269189626","little chop":"c e 0",pyramorphix:"t e 0",mastermorphix:"t e 0.346184634065199",pyraminx:"t v 0.333333333333333 v 1.66666666666667",tetraminx:"t v 0.333333333333333","master pyraminx":"t v 0 v 1 v 2","master tetraminx":"t v 0 v 1","professor pyraminx":"t v -0.2 v 0.6 v 1.4 v 2.2","professor tetraminx":"t v -0.2 v 0.6 v 1.4","Jing pyraminx":"t f 0","master pyramorphix":"t e 0.866025403784437",megaminx:"d f 0.7",gigaminx:"d f 0.64 f 0.82",teraminx:"d f 0.64 f 0.76 f 0.88",petaminx:"d f 0.64 f 0.73 f 0.82 f 0.91",examinx:"d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928",zetaminx:"d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94",yottaminx:"d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486",pentultimate:"d f 0","master pentultimate":"d f 0.1","elite pentultimate":"d f 0 f 0.145905",starminx:"d v 0.937962370425399","starminx 2":"d f 0.23606797749979","pyraminx crystal":"d f 0.447213595499989",chopasaurus:"d v 0","big chop":"d e 0","skewb diamond":"o f 0",FTO:"o f 0.333333333333333","master FTO":"o f 0.5 f 0","Christopher's jewel":"o v 0.577350269189626",octastar:"o e 0","Trajber's octahedron":"o v 0.433012701892219","radio chop":"i f 0",icosamate:"i v 0","icosahedron 2":"i v 0.18759247376021","icosahedron 3":"i v 0.18759247376021 e 0","icosahedron static faces":"i v 0.84","icosahedron moving faces":"i v 0.73","Eitan's star":"i f 0.61803398874989","2x2x2 + dino":"c f 0 v 0.577350269189626","2x2x2 + little chop":"c f 0 e 0","dino + little chop":"c v 0.577350269189626 e 0","2x2x2 + dino + little chop":"c f 0 v 0.577350269189626 e 0","megaminx + chopasaurus":"d f 0.61803398875 v 0","starminx combo":"d f 0.23606797749979 v 0.937962370425399"}});function Vo(e){let t=new I(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function ff(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var jr,I,Ho=U(()=>{jr=1e-9;I=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new I(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new I(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new I(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new I(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new I(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new I(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new I(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new I(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new I(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,a,s,f){return t*(o*f-i*s)+r*(i*a-l*f)+n*(l*s-o*a)}rotateplane(t){let r=t.mul(new I(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new I(0,1,0,0)).normalize():r<t&&r<n?this.cross(new I(0,0,1,0)).normalize():this.cross(new I(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<jr)return new I(1,0,0,0);let n=r.sum(t);n.len()<jr?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<jr?!1:new I(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>jr?1:t<-jr?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)==5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let a=[];for(let s=0;s<t.length;s++){(o[s]===i||o[s]===0)&&a.push(t[s]);let f=(s+1)%t.length;if(o[s]+o[f]===0&&o[s]!==0){let g=t[s].dot(this)-r,c=t[f].dot(this)-r,u=g/(g-c),p=t[s].smul(1-u).sum(t[f].smul(u));a.push(p)}}l.push(a)}}return l}cutfaces(t){let r=[];for(let n=0;n<t.length;n++){let l=t[n],o=this.cutface(l);o?(r.push(o[0]),r.push(o[1])):r.push(l)}return r}faceside(t){let r=this.a;for(let n=0;n<t.length;n++){let l=this.side(t[n].dot(this)-r);if(l!==0)return l}throw new Error("Could not determine side of plane in faceside")}sameplane(t){let r=this.normalize(),n=t.normalize();return r.dist(n)<jr||r.dist(n.smul(-1))<jr}makecut(t){return new I(t,this.b,this.c,this.d)}}});function uf(){let e=Math.sqrt(.5);return[new I(e,e,0,0),new I(e,0,e,0)]}function gf(){return[new I(.5,.5,.5,.5),new I(.5,.5,.5,-.5)]}function cf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new I(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new I(.5,.5,.5,.5)]}function pf(){let e=1/6+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new I(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new I(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function mf(){let e=Math.sqrt(.5);return[new I(.5,.5,.5,.5),new I(e,0,0,e)]}function Lf(e){let t=[new I(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let a=0;a<t.length;a++)if(l.dist(t[a])<Yo||o.dist(t[a])<Yo){i=!0;break}i||t.push(l)}return t}function es(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let a=0;a<r.length;a++)if(o.dist(r[a])<Yo){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function ts(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=ff(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<Yo){o=!0;break}o||t.push(l)}}for(;;){let r=!1;for(let n=0;n<t.length;n++){let l=(n+1)%t.length;if(e[0].dot(t[n].cross(t[l]))<0){let o=t[n];t[n]=t[l],t[l]=o,r=!0}}if(!r)break}return t}var Yo,Bf=U(()=>{Ho();Yo=1e-9});function Jo(e,t){let r=e[0].p.length,n=nf(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let m=p.p.length-1;m>=0;m--){let L=p.p[m];if(L!==m){if(!l[m][L])return!1;p=p.mul(o[m][L])}}return!0}function g(p,m,L){a[p].push(m),s[p].push(L);for(let R=0;R<l[p].length;R++)l[p][R]&&c(p,l[p][R].mul(m),L+i[p][R])}function c(p,m,L){let R=m.p[p];if(!l[p][R]){l[p][R]=m,o[p][R]=m.inv(),i[p][R]=L;for(let y=0;y<a[p].length;y++)c(p,m.mul(a[p][y]),L+s[p][y]);return}let h=m.mul(o[p][R]);f(h)||g(p-1,h,L+i[p][R])}function u(){l=[],o=[],a=[],i=[],s=[];for(let L=0;L<r;L++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[L][L]=n,o[L][L]=n,i[L][L]=0;let p=0,m=1;for(let L=0;L<e.length;L++){g(r-1,e[L],1),m=1;let R=0,h=0,y=[],A=new Rf;for(let k=0;k<r;k++){let E=0,Q=0;for(let N=0;N<r;N++)l[k][N]&&(E++,Q+=i[k][N],k!==N&&p++);R+=a[k].length,m*=E,E>1&&A.multiply(E);let $=Q/E;y.push($),h+=$}t(\`\${L}: sz \${m} T \${R} sol \${h} none \${p} mults \${A.toString()}\`)}return m}return u()}var Rf,rs=U(()=>{jo();Rf=class{constructor(){this.mult=[]}multiply(t){for(let r=2;r*r<=t;r++)for(;t%r==0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,t/=r;t>1&&(this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1)}toString(){let t="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(t!==""&&(t+="*"),t+=r,this.mult[r]>1&&(t+=\`^\${this.mult[r]}\`));return t}}});function ns(e){return e}function ls(e){}function wm(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function Em(){return{4:[["F","D","L","R"]],6:[["F","D","L","U","R"],["R","F","","B",""]],8:[["F","D","L","R"],["D","F","BR",""],["BR","D","","BB"],["BB","BR","U","BL"]],12:[["U","F","","","",""],["F","U","R","C","A","L"],["R","F","","","E",""],["E","R","","BF","",""],["BF","E","BR","BL","I","D"]],20:[["R","C","F","E"],["F","R","L","U"],["L","F","A",""],["E","R","G","I"],["I","E","S","H"],["S","I","J","B"],["B","S","K","D"],["K","B","M","O"],["O","K","P","N"],["P","O","Q",""]]}}function km(){return{4:{F:"#00ff00",D:"#ffff00",L:"#ff0000",R:"#0000ff"},6:{U:"#ffffff",F:"#00ff00",R:"#ff0000",D:"#ffff00",B:"#0000ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#00bb00",D:"#ffff00",BB:"#1122ff",L:"#9524c5",BL:"#ff8800",BR:"#aaaaaa"},12:{U:"#ffffff",F:"#006633",R:"#ff0000",C:"#ffffd0",A:"#3399ff",L:"#660099",E:"#ff66cc",BF:"#99ff00",BR:"#0000ff",BL:"#ffff00",I:"#ff6633",D:"#999999"},20:{R:"#db69f0",C:"#178fde",F:"#23238b",E:"#9cc726",L:"#2c212d",U:"#177fa7",A:"#e0de7f",G:"#2b57c0",I:"#41126b",S:"#4b8c28",H:"#7c098d",J:"#7fe7b4",B:"#85fb74",K:"#3f4bc3",D:"#0ff555",M:"#f1c2c8",O:"#58d340",P:"#c514f2",N:"#14494e",Q:"#8b1be1"}}}function _m(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function zm(){return{4:[["FLR",[0,1,0]],["F",[0,0,1]]],6:[["U",[0,1,0]],["F",[0,0,1]]],8:[["U",[0,1,0]],["F",[0,0,1]]],12:[["U",[0,1,0]],["F",[0,0,1]]],20:[["GUQMJ",[0,1,0]],["F",[0,0,1]]]}}function Zo(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<_e)return r;throw new Error("Element not found")}function df(){return qo}function hf(e){return qo[e]}function Gl(e){let t=e.split(/ /).filter(Boolean);if(t.length%2==0)return null;let r=t[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let l=1;l<t.length;l+=2){if(t[l]!=="f"&&t[l]!=="v"&&t[l]!=="e")return null;n.push({cutType:t[l],distance:parseFloat(t[l+1])})}return{shape:r,cuts:n}}function os(e,t={}){let r=Gl(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new $o(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function Mn(e,t){return os(qo[e],t)}function Cm(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=l+"v";else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw\`We only support slice and outer block moves right now. \${t}\`;return[o+l,n]}function Pm(e,t){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let l="";for(let o of t)e.substr(n).startsWith(o[1])&&o[1].length>l.length&&(l=o[1]);if(l!=="")r.push(l),n+=l.length;else throw new Error("Could not split "+e+" into face names.")}return r}function Xo(e,t){return[e.b/t,-e.c/t,e.d/t]}function is(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Xo(e.get(n-l-1),t);r[3*l]=o[0],r[3*l+1]=o[1],r[3*l+2]=o[2]}return r}var Pn,Tl,_e,Sm,vm,$o,qr,Qo=U(()=>{Re();I2();ja();Va();jo();af();sf();Bf();Ho();rs();Pn=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new I(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new I(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new Pn(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new Pn(t)}},Tl=class{constructor(t,r,n){this.face=t;this.left=r;this.right=n}split(t){let r=t.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new Tl(r[0]),this.right=new Tl(r[1])):(this.left=this.left?.split(t),this.right=this.right?.split(t))),this}collect(t,r){return this.left===void 0?t.push(new Pn(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};_e=1e-9,Sm="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",vm=!1;$o=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new _n;this.addNotationMapper="";this.setReidOrder=!1;let n=ns("genperms");this.options=new qa(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(t),ls(n)}create(t){let{shape:r,cuts:n}=t;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let l=null;switch(r){case"c":l=uf();break;case"o":l=mf();break;case"i":l=pf();break;case"t":l=gf();break;case"d":l=cf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=Lf(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=es(o,this.rotations);let i=this.baseplanerot.map(F=>o.rotateplane(F));this.baseplanes=i,this.baseFaceCount=i.length;let a=Em()[i.length];this.net=a,this.colors=km()[i.length],this.faceorder=_m()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let s=ts(i),f=new I(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+s.length);let g=i[0].makenormal(),c=s[0].sum(s[1]).makenormal(),u=s[0].makenormal(),p=new I(1,g.b,g.c,g.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let L=es(p,this.rotations).map(F=>p.rotateplane(F)),R=ts(L);this.edgedistance=R[0].sum(R[1]).smul(.5).dist(f),this.vertexdistance=R[0].dist(f);let h=[],y=[],A=!1,k=!1,E=!1;for(let F of n){let v=null,O=0;switch(F.cutType){case"f":v=g,O=1,A=!0;break;case"v":v=u,O=this.vertexdistance,E=!0;break;case"e":v=c,O=this.edgedistance,k=!0;break;default:throw new Error("Bad cut argument: "+F.cutType)}h.push(v.makecut(F.distance)),y.push(F.distance<O)}this.options.addRotations&&(A||h.push(g.makecut(10)),E||h.push(u.makecut(10)),k||h.push(c.makecut(10))),this.basefaces=[];for(let F of this.baseplanerot){let v=F.rotateface(R);this.basefaces.push(new Pn(v))}let Q=[],$=[],N=[],oe=[],b=R.length;function z(F,v,O){for(let K of F)if(K[0].dist(v)<_e){K.push(O);return}F.push([v,O])}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R);for(let O=0;O<v.length;O++){let K=(O+1)%v.length,ie=v[O].sum(v[K]).smul(.5);z(oe,ie,F)}}let M=[];for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=[];for(let K=0;K<v.length;K++){let ie=(K+1)%v.length,Je=v[K].sum(v[ie]).smul(.5),ct=oe[Zo(oe,Je)];if(F===ct[1])O.push(ct[2]);else if(F===ct[2])O.push(ct[1]);else throw new Error("Could not find edge")}M.push(O)}let w={},S=[];S.push(a[0][0]),w[a[0][0]]=0,S[M[0][0]]=a[0][1],w[a[0][1]]=M[0][0];for(let F of a){let v=F[0],O=w[v];if(O===void 0)throw new Error("Bad edge description; first edge not connected");let K=-1;for(let ie=0;ie<M[O].length;ie++){let Je=S[M[O][ie]];if(Je!==void 0&&Je===F[1]){K=ie;break}}if(K<0)throw new Error("First element of a net not known");for(let ie=2;ie<F.length;ie++){if(F[ie]==="")continue;let Je=M[O][(ie+K-1)%b],ct=S[Je];if(ct!==void 0&&ct!==F[ie])throw new Error("Face mismatch in net");S[Je]=F[ie],w[F[ie]]=Je}}for(let F=0;F<S.length;F++){let v=!1;for(let O=0;O<this.faceorder.length;O++)if(S[F]===this.faceorder[O]){this.faceprecedence[F]=O,v=!0;break}if(!v)throw new Error("Could not find face "+S[F]+" in face order list "+this.faceorder)}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=p.rotateplane(this.baseplanerot[F]),K=S[F];Q.push([v,K]),$.push([O,K])}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=S[F];for(let K=0;K<v.length;K++){let ie=(K+1)%v.length,Je=v[K].sum(v[ie]).smul(.5),ct=(K+2)%v.length,_p=v[ie].sum(v[ct]).smul(.5),zp=Zo(oe,Je),Cp=Zo(oe,_p);z(N,v[ie],[O,Cp,zp])}}this.swizzler=new Pl(Q.map(F=>F[1]));let C=this.swizzler.prefixFree?"":"_";for(let F=0;F<oe.length;F++){if(oe[F].length!==3)throw new Error("Bad length in edge names "+oe[F]);let v=S[oe[F][1]],O=S[oe[F][2]];this.faceprecedence[oe[F][1]]<this.faceprecedence[oe[F][2]]?v=v+C+O:v=O+C+v,oe[F]=[oe[F][0],v]}for(let F=0;F<N.length;F++){if(N[F].length<4)throw new Error("Bad length in vertex names");let v=1;for(let K=2;K<N[F].length;K++)this.faceprecedence[w[N[F][K][0]]]<this.faceprecedence[w[N[F][v][0]]]&&(v=K);let O="";for(let K=1;K<N[F].length;K++){K===1?O=N[F][v][0]:O=O+C+N[F][v][0];for(let ie=1;ie<N[F].length;ie++)if(N[F][v][1]===N[F][ie][2]){v=ie;break}}N[F]=[N[F][0],O]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+Q.map(F=>F[1]).join(" ")),console.log("# Edge names: "+oe.map(F=>F[1]).join(" ")),console.log("# Vertex names: "+N.map(F=>F[1]).join(" ")));let j=[];for(let F of $)j.push([F[0].makenormal(),F[1],"f"]);for(let F of oe)j.push([F[0].makenormal(),F[1],"e"]);for(let F of N)j.push([F[0].makenormal(),F[1],"v"]);this.facenames=Q,this.faceplanes=$,this.edgenames=oe,this.vertexnames=N,this.geonormals=j;let J=j.map(F=>F[1]);this.swizzler.setGripNames(J),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let F=0;F<h.length;F++)for(let v of this.rotations){let O=h[F].rotateplane(v),K=!1;for(let ie of this.moveplanes)if(O.sameplane(ie)){K=!0;break}K||(this.moveplanes.push(O),y[F]&&this.moveplanes2.push(O))}let me=new Tl(R),he=this.moveplanes2.slice(),xe=31;for(let F=0;F<he.length;F++){let v=F+Math.floor((he.length-F)*(xe/65536));me=me.split(he[v]),he[v]=he[F],xe=(xe*1657+101)%65536}let ke=me.collect([],!0);this.faces=ke,this.options.verbosity>0&&console.log("# Faces is now "+ke.length),this.stickersperface=ke.length;let Pt=[],Ie=Vo(R);for(let F of this.rotations){let v=F.rotateface(R);Ie.dist(Vo(v))<_e&&Pt.push(F)}let ot=new Array(ke.length),Pe=[];for(let F=0;F<ke.length;F++){let v=ke[F].centermass();Pe.push([Ie.dist(v),v,F])}Pe.sort((F,v)=>F[0]-v[0]);for(let F=0;F<ke.length;F++){let v=Pe[F][2];if(!ot[v]){ot[v]=!0;for(let O of Pt){let K=ke[v].rotate(O),ie=K.centermass();for(let Je=F+1;Je<ke.length&&!(Pe[Je][0]-Pe[F][0]>_e);Je++){let ct=Pe[Je][2];if(!ot[ct]&&ie.dist(Pe[Je][1])<_e){ot[ct]=!0,ke[ct]=K;break}}}}}this.shortedge=1e99;for(let F of ke)for(let v=0;v<F.length;v++){let O=(v+1)%F.length,K=F.get(v).dist(F.get(O));K<this.shortedge&&(this.shortedge=K)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&A&&!k&&!E&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&E&&!A&&!k&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(E||A)&&!k&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&A&&(this.notationMapper=new Ml(this.swizzler,new Pl(["F","D","L","BL","R","U","BR","B"])),!k&&!E&&(this.addNotationMapper="FTOMapper")),r==="d"&&A&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Ml(this.swizzler,new Pl(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(t){return this.keyface2(t.centermass())}keyface2(t){let r="",n=String.fromCharCode;for(let l of this.moveplanesets)if(l.length>0){let o=t.dot(l[0]),i=0,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);if(i<47)r=r+n(33+i);else if(i<47+47*47)r=r+n(33+47+Math.floor(i/47)-1)+n(33+i%47);else if(i<47+47*47+47*47*47)r=r+n(33+47+Math.floor((i-47)/(47*47)-1))+n(33+47+Math.floor((i-47)/47)%47)+n(33+i%47);else throw Error("Too many slices for cubie encoding")}return r}keyface3(t){let r=t.centermass(),n=[];for(let l of this.moveplanesets)if(l.length>0){let o=r.dot(l[0]),i=0,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);n.push(i)}return n}findface(t){let r=this.keyface2(t),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let l=0;l+1<n.length;l++){let o=this.facelisthash.get(r)[l];if(Math.abs(t.dist(this.facecentermass[o]))<_e)return o}return n[n.length-1]}project2d(t,r,n){let l=this.facenames[t][0],o=(r+1)%l.length,i=this.baseplanes[t],a=l[o].sub(l[r]),s=a.len();a=a.normalize();let f=a.cross(i).normalize(),g=n[1].sub(n[0]),c=g.len()/s;g=g.normalize();let u=g.b,p=g.c,m=a.smul(u).sub(f.smul(p)).smul(c),L=f.smul(u).sum(a.smul(p)).smul(c),R=new I(0,n[0].b-m.dot(l[r]),n[0].c-L.dot(l[r]),0);return[m,L,R]}allstickers(){let t=ns("allstickers");this.faces=wm(this.baseplanerot,this.faces),this.options.verbosity>0&&console.log("# Total stickers is now "+this.faces.length),this.facecentermass=new Array(this.faces.length);for(let b=0;b<this.faces.length;b++)this.facecentermass[b]=this.faces[b].centermass();let r=[],n=[];for(let b of this.moveplanes){let z=b.makenormal(),M=!1;for(let w of n)z.sameplane(w.makenormal())&&(M=!0);M||(n.push(z),r.push([]))}for(let b of this.moveplanes2){let z=b.makenormal();for(let M=0;M<n.length;M++)if(z.sameplane(n[M])){r[M].push(b);break}}for(let b=0;b<r.length;b++){let z=r[b].map(w=>w.normalizeplane()),M=n[b];for(let w=0;w<z.length;w++)z[w].makenormal().dist(M)>_e&&(z[w]=z[w].smul(-1));z.sort((w,S)=>w.a-S.a),r[b]=z}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(b=>b.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let b=0;b<r.length;b++)o.push([]);for(let b of this.rotations){if(Math.abs(Math.abs(b.a)-1)<_e)continue;let z=b.makenormal();for(let M=0;M<r.length;M++)if(z.sameplane(n[M])){o[M].push(b);break}}this.moverotations=o;for(let b=0;b<o.length;b++){let z=o[b],M=z[0].makenormal();for(let w=0;w<z.length;w++)M.dist(z[w].makenormal())>_e&&(z[w]=z[w].smul(-1));z.sort((w,S)=>w.angle()-S.angle()),o[b][0].dot(n[b])<0&&z.reverse()}let i=o.map(b=>1+b.length);this.movesetorders=i;let a=[],s="?";for(let b=0;b<r.length;b++){let z=n[b],M=null,w=null;for(let S of this.geonormals){let C=z.dot(S[0]);Math.abs(C-1)<_e?(w=[S[1],S[2]],s=S[2]):Math.abs(C+1)<_e&&(M=[S[1],S[2]],s=S[2])}if(w===null||M===null)throw new Error("Saw positive or negative sides as null");a.push([w[0],w[1],M[0],M[1],1+r[b].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new Io(1+r[b].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Ko(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(r[0].length===2&&r[0][0].a===.333333333333333&&r[0][1].a===1.66666666666667?(this.notationMapper=new Nl(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Wo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new To(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new Oo(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,g=this.faces;for(let b=0;b<g.length;b++){let z=g[b],M=this.keyface(z);if(!f.get(M))f.set(M,[b]);else{let w=f.get(M);if(w.push(b),w.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let S=0;S<w.length;S++){let C=M+" "+S;f.set(C,[w[S]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let c=[],u=[],p=[];for(let b of f.values())if(b.length!==this.baseFaceCount){if(b.length>1){let z=b.map(C=>g[C].centermass()),M=Vo(z);for(let C=0;b.length>2;C++){let j=!1;for(let J=0;J<b.length;J++){let me=(J+1)%b.length;if(M.dot(z[J].cross(z[me]))<0){let he=z[J];z[J]=z[me],z[me]=he;let xe=b[J];b[J]=b[me],b[me]=xe,j=!0}}if(!j)break;if(C>1e3)throw new Error("Bad epsilon math; too close to border")}let w=0,S=b[w];for(let C=1;C<b.length;C++){let j=b[C];this.faceprecedence[this.getfaceindex(j)]<this.faceprecedence[this.getfaceindex(S)]&&(w=C,S=j)}if(w!==0){let C=b.slice();for(let j=0;j<b.length;j++)b[j]=C[(w+j)%b.length]}}for(let z=0;z<b.length;z++){let M=b[z];u[M]=c.length,p[M]=z}c.push(b)}this.cubies=c,this.facetocubie=u,this.facetoord=p;let m=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],R=[0,0,0,0,0,0],h=[],y=[],A=0,k=[],E=[],Q=[],$=[],N=b=>c[b].map(z=>this.getfaceindex(z)).join(" "),oe=[];for(let b=0;b<c.length;b++){if(y[b])continue;let z=c[b];if(z.length===0)continue;let M={},w=0;Q.push(0),oe.push([]);let S=z.length,C=R[S]++,j=m[S];(j===void 0||S===this.baseFaceCount)&&(j="CORE"),j=j+(C===0?"":C+1),L[A]=j,h[A]=S;let J=[b],me=0;for(y[b]=!0;me<J.length;){let he=J[me++],xe=N(he);if((z.length>1||M[xe]===void 0)&&(M[xe]=w++),$[he]=M[xe],k[he]=A,oe[A].push(he),E[he]=Q[A]++,J.length<this.rotations.length){let ke=this.facecentermass[c[he][0]];for(let Pt of o){let Ie=this.facetocubie[this.findface(ke.rotatepoint(Pt[0]))];y[Ie]||(J.push(Ie),y[Ie]=!0)}}}A++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let b=[["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],["UFR","URB","UBL","ULF","DRF","DFL","DLB","DBR"],["U","L","F","R","B","D"]],z={};for(let M of b)for(let w=0;w<M.length;w++){let S=0;for(let C=0;C<M[w].length;C++)S|=1<<M[w].charCodeAt(C)-65;z[S]=w}for(let M of oe)for(let w of M){let S=0;for(let C of c[w])S|=1<<this.facenames[this.getfaceindex(C)][1].charCodeAt(0)-65;E[w]=z[S]}}if(this.cubiesetnums=k,this.cubieordnums=E,this.cubiesetnames=L,this.cubieords=Q,this.orbitoris=h,this.cubievaluemap=$,this.cubiesetcubies=oe,this.options.fixedPieceType!==null){for(let b=0;b<c.length;b++)if(this.options.fixedPieceType==="v"&&c[b].length>2||this.options.fixedPieceType==="e"&&c[b].length===2||this.options.fixedPieceType==="f"&&c[b].length===1){this.fixedCubie=b;break}if(this.fixedCubie<0)throw new Error("Could not find a cubie of type "+this.options.fixedPieceType+" to fix.")}this.options.verbosity>0&&console.log("# Cubie orbit sizes "+Q),ls(t)}unswizzle(t){let r=this.notationMapper.notationToInternal(t);return r===null?"":this.swizzler.unswizzle(r.family)}stringToBlockMove(t){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=t.match(r);if(n===null)throw new Error("Bad move passed "+t);let l=n[4],o,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");o=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let a="1",s=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),s=parseInt(a,10)),new B(new P(l,i,o),s)}parseMove(t){let r=this.notationMapper.notationToInternal(t);if(r===null)throw new Error("Bad move "+t.family);t=r;let n=t.family,l=!1;if(n.endsWith("v")&&n[0]<="Z"){if(t.innerLayer!==void 0||t.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),l=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,i=-1,a=this.swizzler.unswizzle(n),s=!1;for(let c=0;c<this.movesetgeos.length;c++){let u=this.movesetgeos[c];a===u[0]&&(s=!0,o=u,i=c),a===u[2]&&(s=!1,o=u,i=c)}let f=1,g=1;if(n.toUpperCase()!==n&&(g=2),o===void 0)throw new Error("Bad grip in move "+t.family);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(g=t.innerLayer,n<="Z"?f=g:f=1):g=t.innerLayer),f--,g--,l&&(f=0,g=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||g<0||g>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+g+" vs "+this.moveplanesets[i].length);if(!vm&&f===0&&g===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,g,s,t.amount]}parsemove(t){let r=this.parseMove(this.stringToBlockMove(t));return r[0]=t,r}genperms(){let t=ns("genperms");if(this.cmovesbyslice.length>0)return;let r=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let l=this.cubies[n][0],o=this.getfaceindex(l);if(this.basefaces[o].centermass().dist(this.facecentermass[l])<_e){let i=this.basefaces[o].length;for(let a=1;a<i;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[l]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],a=1;for(;a*2<=l.length;)a*=2;for(let g=0;g<this.faces.length;g++){let c=0;if(l.length>0){let u=this.facecentermass[g].dot(l[0]);for(let p=a;p>0;p>>=1)c+p<=l.length&&u>l[c+p-1].a&&(c+=p);c=l.length-c}for(o.push(c);i.length<=c;)i.push(0);i[c]++}let s=new Array(i.length);for(let g=0;g<i.length;g++)s[g]=[];let f=[];for(let g=0;g<this.faces.length;g++){if(o[g]<0)continue;let c=[this.facetocubie[g],this.facetoord[g]],u=this.facecentermass[g],p=u,m=g,L=o[m];for(;;){o[m]=-1;let R=u.rotatepoint(this.moverotations[n][0]);if(R.dist(p)<_e)break;m=this.findface(R),c.push(this.facetocubie[m],this.facetoord[m]),u=R}if(c.length>2&&this.options.orientCenters&&(this.cubies[c[0]].length===1||this.duplicatedCubies[c[0]]>1)&&this.facecentermass[g].dist(this.basefaces[this.getfaceindex(g)].centermass())<_e){let R=this.faces[this.cubies[c[0]][0]];for(let h=0;h<c.length;h+=2){let y=this.faces[this.cubies[c[h]][0]],A=-1;for(let k=0;k<R.length;k++)if(y.get(k).dist(R.get(0))<_e){A=k;break}if(A<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");c[h+1]=A,R=R.rotate(this.moverotations[n][0])}}if(c.length===2&&this.options.orientCenters)for(let R=1;R<this.movesetorders[n];R++)L===0?c.push(c[0],R):c.push(c[0],(this.movesetorders[n]-R)%this.movesetorders[n]);if(c.length>2&&!f[c[0]]){if(c.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let R of c)s[L].push(R)}for(let R=0;R<c.length;R+=2)f[c[R]]=!0}for(let g=0;g<s.length;g++)s[g]=s[g].slice();r.push(s)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let l of this.options.moveList)n.push(this.parsemove(l));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],ls(t)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(t){let r=this.moveplanesets[t].length,n=[];if(this.parsedmovelist!==void 0)for(let l of this.parsedmovelist)l[1]===t&&(l[4]?n.push([l[2],l[3]]):n.push([r-l[3],r-l[2]]),n.push(l[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let l=this.movesetgeos[t];if(l[1]!==l[3])for(let o=0;o<r;o++)l[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,r]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let l=0;l<=r;l++)!this.options.allMoves&&l+l===r||(this.options.outerBlockMoves?l+l>r?n.push([l,r]):n.push([0,l]):n.push([l,l]),n.push(1));if(this.fixedCubie>=0){let l=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[t],o=[];for(let i=0;i<n.length;i+=2){let a=n[i];if(l>=a[0]&&l<=a[1])if(a[0]===0)a=[a[1]+1,r];else if(r===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let s=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===a[0]&&o[f][1]===a[1]&&o[f+1]===n[i+1]){s=!0;break}s||(o.push(a),o.push(n[i+1]))}n=o}return n}graybyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||r===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||r>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(t){return this.skipbyori(t)}header(t){return t+Sm+\`
|
|
8
|
+
\`:" "}var st,Wr,_,Vt=U(()=>{qt();_a();yt();va();Pa();bl();Ht();xl();Ea();Wr=class extends We{constructor(t){super();le(this,st,void 0);q(this,st,Array.from(F2(t)));for(let r of d(this,st))if(!B2(r))throw new Error("An alg can only contain units.")}isIdentical(t){let r=t;if(!t.is(Wr))return!1;let n=Array.from(d(this,st)),l=Array.from(d(r,st));if(n.length!==l.length)return!1;for(let o=0;o<n.length;o++)if(!n[o].isIdentical(l[o]))return!1;return!0}invert(){return new Wr(a2(Array.from(d(this,st)).map(t=>t.invert())))}*experimentalExpand(t=V.Forwards,r){r??(r=1/0);for(let n of Ua(d(this,st),t))yield*n.experimentalExpand(t,r)}expand(t){return new Wr(this.experimentalExpand(V.Forwards,t?.depth??1/0))}*experimentalLeafMoves(){for(let t of this.experimentalExpand())t.is(B)&&(yield t)}concat(t){return new Wr(Array.from(d(this,st)).concat(Array.from(F2(t))))}experimentalIsEmpty(){for(let t of d(this,st))return!1;return!0}static fromString(t){return Sa(t)}*units(){for(let t of d(this,st))yield t}experimentalNumUnits(){return Array.from(d(this,st)).length}get type(){return Eo("deprecated: type"),"sequence"}toString(){let t="",r=null;for(let n of d(this,st))r&&(t+=lm(r,n)),t+=n.toString(),r=n;return t}simplify(t){return new Wr(D2(this,t??{}))}},_=Wr;st=new WeakMap});var om,A2=U(()=>{Vt();zo();yl();Ul();Ht();wl();om={Sune:new _([new B("R",1),new B("U",1),new B("R",-1),new B("U",1),new B("R",1),new B("U",-2),new B("R",-1)]),AntiSune:new _([new B("R",1),new B("U",2),new B("R",-1),new B("U",-1),new B("R",1),new B("U",-1),new B("R",-1)]),SuneCommutator:new _([new Ke(new _([new B("R",1),new B("U",1),new B("R",-2)]),new _([new Qe(new _([new B("R",1)]),new _([new B("U",1)]))]))]),Niklas:new _([new B("R",1),new B("U",-1),new B("L",-1),new B("U",1),new B("R",-1),new B("U",-1),new B("L",1),new B("U",1)]),EPerm:new _([new B("x",-1),new Ke(new _([new Qe(new _([new B("R",1)]),new _([new B("U",-1)]))]),new _([new B("D",1)])),new Ke(new _([new Qe(new _([new B("R",1)]),new _([new B("U",1)]))]),new _([new B("D",1)])),new B("x",1)]),FURURFCompact:new _([new Qe(new _([new B("F",1)]),new _([new Ke(new _([new B("U",1)]),new _([new B("R",1)]))]))]),APermCompact:new _([new Qe(new _([new B("R",2)]),new _([new Ke(new _([new B("F",2)]),new _([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new _([new B("F",1),new B("U",1),new B("R",1),new B("U",-1),new B("R",-1),new B("F",-1)]),TPerm:new _([new B("R",1),new B("U",1),new B("R",-1),new B("U",-1),new B("R",-1),new B("F",1),new B("R",2),new B("U",-1),new B("R",-1),new B("U",-1),new B("R",1),new B("U",1),new B("R",-1),new B("F",-1)]),HeadlightSwaps:new _([new Qe(new _([new B("F",1)]),new _([new pt(new _([new Ke(new _([new B("R",1)]),new _([new B("U",1)]))]),3)]))]),TriplePause:new _([new et,new et,new et])}});var oA,y2=U(()=>{Ht();oA={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'")}});var U2=U(()=>{});var b2=U(()=>{Vt()});var Re=U(()=>{Vt();xa();Pa();A2();y2();zo();Ht();U2();b2();_a();yt()});function Sl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(vl(o.numOrientations,a))n[l]=i;else if(vl(o.numOrientations,i))n[l]=a;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.permutation[a.permutation[f]];n[l]={permutation:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.permutation[a.permutation[g]];n[l]={permutation:s,orientation:f}}}}return n}function Ma(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(vl(o.numOrientations,a))n[l]=i;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.pieces[a.permutation[f]];n[l]={pieces:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.pieces[a.permutation[g]];n[l]={pieces:s,orientation:f}}}}return n}var Po=U(()=>{El()});function im(e){let t=w2.get(e);if(t)return t;let r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[o]=o,n[o]=0;let l={permutation:r,orientation:n};return x2&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),w2.set(e,l),l}function S2(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=im(n.numPieces);return x2&&Object.freeze(t),t}function v2(e,t){let r=t.quantum.toString(),n=e.definition.moves[r];if(!n){let i=e.definition.experimentalDerivedMoves?.[r];i&&(n=e.algToTransformation(i).transformationData)}if(n)return cr(e,n,t.amount);let l=e.definition.moves[t.toString()];if(l)return l;let o=e.definition.moves[t.invert().toString()];if(o)return cr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var x2,w2,Na=U(()=>{El();x2=!1,w2=new Map});var de,Mo=U(()=>{Po();kl();de=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=Ma(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new de(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new de(this.kpuzzle,this.stateData);let r=Ma(this.kpuzzle.definition,this.stateData,t.transformationData);return new de(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new xt(this.kpuzzle,t)}}});var Kr,pr,xt,kl=U(()=>{El();Po();Na();Mo();pr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;le(this,Kr,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new pr(this.kpuzzle,Ga(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return d(this,Kr)??q(this,Kr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new pr(t,S2(t.definition));return q(r,Kr,!0),r}isIdentical(t){return E2(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return d(this,Kr)?new pr(this.kpuzzle,t.transformationData):d(t,Kr)?new pr(this.kpuzzle,this.transformationData):new pr(this.kpuzzle,Sl(this.kpuzzle.definition,this.transformationData,t.transformationData))}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}toKState(){return de.fromTransformation(this)}repetitionOrder(){return k2(this.kpuzzle.definition,this)}selfMultiply(t){return new pr(this.kpuzzle,cr(this.kpuzzle,this.transformationData,t))}},xt=pr;Kr=new WeakMap});function vl(e,t){let{permutation:r}=t,n=r.length;for(let l=0;l<n;l++)if(r[l]!==l)return!1;if(e>1){let{orientation:l}=t;for(let o=0;o<n;o++)if(l[o]!==0)return!1}return!0}function am(e,t,r,n={}){for(let l=0;l<e.numPieces;l++)if(!n?.ignoreOrientation&&t.orientation[l]!==r.orientation[l]||!n?.ignorePermutation&&t.permutation[l]!==r.permutation[l])return!1;return!0}function E2(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!am(l,t[n],r[n]))return!1;return!0}function Ga(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(vl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)i[o.permutation[a]]=a;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),a=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++){let f=o.permutation[s];i[f]=s,a[f]=(l.numOrientations-o.orientation[s]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:a}}}return r}function cr(e,t,r){if(r===1)return t;if(r<0)return cr(e,Ga(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=cr(e,t,Math.floor(r/2)));let l=Sl(e.definition,n,n);return r%2==0?l:Sl(e.definition,t,l)}function Oa(e,t){return t?Oa(t,e%t):e}function k2(e,t){let r=1;for(let n in e.orbits){let l=e.orbits[n],o=t.transformationData[n],i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)if(!i[a]){let s=a,f=0,g=0;for(;i[s]=!0,f=f+o.orientation[s],g=g+1,s=o.permutation[s],s!==a;);f!==0&&(g=g*l.numOrientations/Oa(l.numOrientations,f)),r=r*g/Oa(r,g)}}return r}var _2,z2,C2,El=U(()=>{Re();Po();kl();_2=class extends bn{traverseAlg(t,r){let n=null;for(let l of t.units())n?n=n.applyTransformation(this.traverseUnit(l,r)):n=this.traverseUnit(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new xt(r,cr(r,n.transformationData,t.amount))}traverseMove(t,r){return r.moveToTransformation(t)}traverseCommutator(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert()).applyTransformation(l.invert())}traverseConjugate(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert())}traversePause(t,r){return r.identityTransformation()}traverseNewline(t,r){return r.identityTransformation()}traverseLineComment(t,r){return r.identityTransformation()}},z2=new _2,C2=z2.traverseAlg.bind(z2)});var wn,No,we,Ta=U(()=>{Re();El();Na();Mo();kl();we=class{constructor(t,r){this.definition=t;le(this,wn,new Map);le(this,No,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return xt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=d(this,wn).get(r);if(n)return new xt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return d(this,wn).set(r,o),new xt(this,o)}let l=v2(this,t);return d(this,wn).set(r,l),new xt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new _(t)),C2(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(_)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new de(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return d(this,No)??q(this,No,(()=>{for(let[t,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let l of this.definition.startStateData[t].pieces)n[l]=!0;for(let l of n)if(!l)return!1}return!0})())}get state(){throw new Error("KPuzzle is now a different (stateless) class.")}reset(){throw new Error("KPuzzle is now a different (stateless) class.")}applyMove(t){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(t){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};wn=new WeakMap,No=new WeakMap});var Fe,P2=U(()=>{Fe={name:"3x3x3",orbits:{EDGES:{numPieces:12,numOrientations:2},CORNERS:{numPieces:8,numOrientations:3},CENTERS:{numPieces:6,numOrientations:4}},startStateData:{EDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{pieces:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}},moves:{U:{EDGES:{permutation:[1,2,3,0,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[1,0,0,0,0,0]}},y:{EDGES:{permutation:[1,2,3,0,5,6,7,4,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,3]}},x:{EDGES:{permutation:[4,8,0,9,6,10,2,11,5,7,1,3],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,3,0,1,2,2]}},L:{EDGES:{permutation:[0,1,2,11,4,5,6,9,8,3,10,7],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,1,0,0,0,0]}},F:{EDGES:{permutation:[9,1,2,3,8,5,6,7,0,4,10,11],orientation:[1,0,0,0,1,0,0,0,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,1,0,0,0]}},R:{EDGES:{permutation:[0,8,2,3,4,10,6,7,5,9,1,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,1,0,0]}},B:{EDGES:{permutation:[0,1,10,3,4,5,11,7,8,9,6,2],orientation:[0,0,1,0,0,0,1,0,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,1,0]}},D:{EDGES:{permutation:[0,1,2,3,7,4,5,6,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,1]}},z:{EDGES:{permutation:[9,3,11,7,8,1,10,5,0,4,2,6],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,3,1]}},M:{EDGES:{permutation:[2,1,6,3,0,5,4,7,8,9,10,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,0,0,0,2,0]}},E:{EDGES:{permutation:[0,1,2,3,4,5,6,7,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,0]}},S:{EDGES:{permutation:[0,3,2,7,4,1,6,5,8,9,10,11],orientation:[0,1,0,1,0,1,0,1,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,0,1,0,1]}},u:{EDGES:{permutation:[1,2,3,0,4,5,6,7,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,0]}},l:{EDGES:{permutation:[2,1,6,11,0,5,4,9,8,3,10,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,0,2,0]}},f:{EDGES:{permutation:[9,3,2,7,8,1,6,5,0,4,10,11],orientation:[1,1,0,1,1,1,0,1,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,0,1]}},r:{EDGES:{permutation:[4,8,0,3,6,10,2,7,5,9,1,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,0,0,1,2,2]}},b:{EDGES:{permutation:[0,5,10,1,4,7,11,3,8,9,6,2],orientation:[0,1,1,1,0,1,1,1,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,0,3,1,3]}},d:{EDGES:{permutation:[0,1,2,3,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,1]}}}};Fe.moves.Uw=Fe.moves.u;Fe.moves.Lw=Fe.moves.l;Fe.moves.Fw=Fe.moves.f;Fe.moves.Rw=Fe.moves.r;Fe.moves.Bw=Fe.moves.b;Fe.moves.Dw=Fe.moves.d;Fe.moves.Rv=Fe.moves.x;Fe.moves.Uv=Fe.moves.y;Fe.moves.Fv=Fe.moves.z;Fe.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Fe.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Fe.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});var Ia,Ve=U(()=>{Ta();Mo();kl();P2();Ta();Ia=new we(Fe)});var M2=U(()=>{Ve()});var sm,py,N2=U(()=>{sm={"333":{puzzleID:"3x3x3",eventName:"3x3x3 Cube"},"222":{puzzleID:"2x2x2",eventName:"2x2x2 Cube"},"444":{puzzleID:"4x4x4",eventName:"4x4x4 Cube"},"555":{puzzleID:"5x5x5",eventName:"5x5x5 Cube"},"666":{puzzleID:"6x6x6",eventName:"6x6x6 Cube"},"777":{puzzleID:"7x7x7",eventName:"7x7x7 Cube"},"333bf":{puzzleID:"3x3x3",eventName:"3x3x3 Blindfolded"},"333fm":{puzzleID:"3x3x3",eventName:"3x3x3 Fewest Moves"},"333oh":{puzzleID:"3x3x3",eventName:"3x3x3 One-Handed"},clock:{puzzleID:"clock",eventName:"Clock"},minx:{puzzleID:"megaminx",eventName:"Megaminx"},pyram:{puzzleID:"pyraminx",eventName:"Pyraminx"},skewb:{puzzleID:"skewb",eventName:"Skewb"},sq1:{puzzleID:"square1",eventName:"Square-1"},"444bf":{puzzleID:"4x4x4",eventName:"4x4x4 Blindfolded"},"555bf":{puzzleID:"5x5x5",eventName:"5x5x5 Blindfolded"},"333mb":{puzzleID:"3x3x3",eventName:"3x3x3 Multi-Blind"}},py={...sm,fto:{puzzleID:"fto",eventName:"Face-Turning Octahedron"},master_tetraminx:{puzzleID:"master_tetraminx",eventName:"Master Tetraminx"},kilominx:{puzzleID:"kilominx",eventName:"Kilominx"},redi_cube:{puzzleID:"redi_cube",eventName:"Redi Cube"}}});function dm(e){switch(e){case x.Regular:return fm;case x.Dim:return Lm;case x.Ignored:return um;case x.OrientationStickers:return gm;case x.Invisible:return cm;case x.IgnoreNonPrimary:return pm;case x.PermuteNonPrimary:return mm;case x.Ignoriented:return Bm;case x.OrientationWithoutPermutation:return Rm}}var x,Sn,Mt,He,vn,Go,Qr,fm,um,gm,cm,pm,mm,Lm,Bm,Rm,_l,zl,Cl=U(()=>{(function(f){f.Regular="Regular",f.Dim="Dim",f.Ignored="Ignored",f.OrientationStickers="OrientationStickers",f.Invisible="Invisible",f.Ignoriented="Ignoriented",f.IgnoreNonPrimary="IgnoreNonPrimary",f.PermuteNonPrimary="PermuteNonPrimary",f.OrientationWithoutPermutation="OrientationWithoutPermutation"})(x||(x={}));Sn=class{constructor(t,r){this.stickerings=new Map;for(let[n,l]of Object.entries(t.definition.orbits))this.stickerings.set(n,new Array(l.numPieces).fill(r))}},Mt="regular",He="ignored",vn="oriented",Go="invisible",Qr="dim",fm={facelets:[Mt,Mt,Mt,Mt,Mt]},um={facelets:[He,He,He,He,He]},gm={facelets:[vn,vn,vn,vn,vn]},cm={facelets:[Go,Go,Go,Go]},pm={facelets:[Mt,He,He,He,He]},mm={facelets:[Qr,Mt,Mt,Mt,Mt]},Lm={facelets:[Qr,Qr,Qr,Qr,Qr]},Bm={facelets:[Qr,He,He,He,He]},Rm={facelets:[vn,He,He,He,He]};_l=class extends Sn{constructor(t){super(t,x.Regular)}set(t,r){for(let[n,l]of this.stickerings.entries())for(let o=0;o<l.length;o++)t.stickerings.get(n)[o]&&(l[o]=r);return this}toAppearance(){let t={orbits:{}};for(let[r,n]of this.stickerings.entries()){let l=[],o={pieces:l};t.orbits[r]=o;for(let i of n)l.push(dm(i))}return t}},zl=class{constructor(t){this.kpuzzle=t}and(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!0;for(let i of t)if(!i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!1;continue e}}}return r}or(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!1;for(let i of t)if(i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!0;continue e}}}return r}not(t){let r=new Sn(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<l.numPieces;o++)r.stickerings.get(n)[o]=!t.stickerings.get(n)[o];return r}all(){return this.and(this.moves([]))}move(t){let r=this.kpuzzle.moveToTransformation(t),n=new Sn(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}}});function hm(e){(async()=>{G2=e;let t=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${t.length} players!\`);let r=[];for(let n of t)r.push((async()=>{let l=await n.experimentalModel.stickering.get();n.experimentalStickering=l==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function O2(e,t){G2(e,t)}var G2,T2=U(()=>{Cl();G2=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=hm,window.PieceStickering=x,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Nt(e,t){let r=await e.kpuzzle(),n=new _l(r),l=new zl(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.not(i()),s=()=>l.or(l.moves(["L","R"])),f=()=>l.not(s()),g=()=>l.or(l.moves(["F","B"])),c=()=>l.not(g()),u=()=>l.not(o()),p=()=>l.and([o(),f(),c()]),m=()=>l.and([l.and(l.moves(["F","R"])),l.not(i())]),L=()=>l.and(l.moves(["D","R","F"])),R=()=>l.or([L(),m()]),h=()=>l.or([l.and([f(),a()]),l.and([f(),c()]),l.and([a(),c()])]),y=()=>l.or([l.and([f(),i(),g()]),l.and([a(),s(),g()]),l.and([c(),i(),s()])]),A=()=>l.not(l.or([h(),y()])),k=()=>l.or([f(),l.and([o(),y()])]);function E(){n.set(u(),x.Dim)}function Q(){n.set(o(),x.PermuteNonPrimary),n.set(p(),x.Dim)}function $(){n.set(o(),x.IgnoreNonPrimary),n.set(p(),x.Regular)}function N(){n.set(o(),x.Ignoriented),n.set(p(),x.Dim)}switch(t){case"full":break;case"PLL":E(),Q();break;case"CLS":E(),n.set(l.and(l.moves(["D","R","F"])),x.Regular),n.set(o(),x.Ignoriented),n.set(l.and([o(),f(),c()]),x.Dim),n.set(l.and([o(),A()]),x.IgnoreNonPrimary);break;case"OLL":E(),$();break;case"COLL":E(),Q(),n.set(l.and([o(),A()]),x.Regular);break;case"OCLL":E(),N(),n.set(l.and([o(),A()]),x.IgnoreNonPrimary);break;case"CLL":E(),n.set(l.not(l.and([A(),o()])),x.Dim);break;case"ELL":E(),n.set(o(),x.Dim),n.set(l.and([o(),y()]),x.Regular);break;case"ELS":E(),$(),n.set(l.and([o(),A()]),x.Ignored),n.set(m(),x.Regular),n.set(L(),x.Ignored);break;case"LL":E();break;case"F2L":n.set(o(),x.Ignored);break;case"ZBLL":E(),n.set(o(),x.PermuteNonPrimary),n.set(p(),x.Dim),n.set(l.and([o(),A()]),x.Regular);break;case"ZBLS":E(),n.set(R(),x.Regular),$(),n.set(l.and([o(),A()]),x.Ignored);break;case"WVLS":case"VLS":E(),n.set(R(),x.Regular),$();break;case"LS":E(),n.set(R(),x.Regular),n.set(o(),x.Ignored),n.set(p(),x.Dim);break;case"EO":n.set(A(),x.Ignored),n.set(y(),x.OrientationWithoutPermutation);break;case"EOline":n.set(A(),x.Ignored),n.set(y(),x.OrientationWithoutPermutation),n.set(l.and(l.moves(["D","M"])),x.Regular);break;case"EOcross":n.set(y(),x.OrientationWithoutPermutation),n.set(l.move("D"),x.Regular),n.set(A(),x.Ignored);break;case"CMLL":n.set(u(),x.Dim),n.set(k(),x.Ignored),n.set(l.and([o(),A()]),x.Regular);break;case"L6E":n.set(l.not(k()),x.Dim);break;case"L6EO":n.set(l.not(k()),x.Dim),n.set(k(),x.OrientationWithoutPermutation),n.set(l.and([h(),i()]),x.OrientationStickers);break;case"Daisy":n.set(l.all(),x.Ignored),n.set(h(),x.Dim),n.set(l.and([l.move("D"),h()]),x.Regular),n.set(l.and([l.move("U"),y()]),x.IgnoreNonPrimary);break;case"Cross":n.set(l.all(),x.Ignored),n.set(h(),x.Dim),n.set(l.and([l.move("D"),h()]),x.Regular),n.set(l.and([l.move("D"),y()]),x.Regular);break;case"2x2x2":n.set(l.or(l.moves(["U","F","R"])),x.Ignored),n.set(l.and([l.or(l.moves(["U","F","R"])),h()]),x.Dim);break;case"2x2x3":n.set(l.all(),x.Dim),n.set(l.or(l.moves(["U","F","R"])),x.Ignored),n.set(l.and([l.or(l.moves(["U","F","R"])),h()]),x.Dim),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),x.Regular);break;case"Void Cube":n.set(h(),x.Invisible);break;case"picture":case"invisible":n.set(l.all(),x.Invisible);break;case"centers-only":n.set(l.not(h()),x.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":O2(n,l);break;default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),x.Dim)}return n.toAppearance()}async function En(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","EOline","EOcross","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only"]}var kn=U(()=>{Cl();T2()});function Ae(e){let t=null;return()=>t??(t=e())}var Jt=U(()=>{});var Pl,I2=U(()=>{Pl=class{constructor(t,r){this.facenames=t;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<t.length;n++)for(let l=0;this.prefixFree&&l<t.length;l++)n!==l&&t[n].startsWith(t[l])&&(this.prefixFree=!1)}setGripNames(t){this.gripnames=t}splitByFaceNames(t){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let l=-1;for(let o=0;o<this.facenames.length;o++)t.substr(n).startsWith(this.facenames[o])&&(l<0||this.facenames[o].length>this.facenames[l].length)&&(l=o);if(l>=0)r.push(l),n+=this.facenames[l].length;else throw new Error("Could not split "+t+" into face names.")}return r}joinByFaceIndices(t){let r="",n=[];for(let l=0;l<t.length;l++)n.push(r),n.push(this.facenames[t[l]]),this.prefixFree||(r="_");return n.join("")}spinmatch(t,r){if(t===r)return!0;try{let n=this.splitByFaceNames(t),l=this.splitByFaceNames(r);if(n.length!==l.length&&n.length<3)return!1;for(let o=0;o<n.length;o++){for(let a=0;a<o;a++)if(n[o]===n[a])return!1;let i=!1;for(let a=0;a<l.length;a++)if(n[o]===l[a]){i=!0;break}if(!i)return!1}return!0}catch(n){return!1}}spinmatchv(t,r){return t.endsWith("v")&&r.endsWith("v")?this.spinmatch(t.slice(0,t.length-1),r.slice(0,r.length-1)):this.spinmatch(t,r)}unswizzle(t){(t.endsWith("v")||t.endsWith("w"))&&t[0]<="Z"&&(t=t.slice(0,t.length-1));let r=t.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let l=this.gripnames[n];if(this.spinmatch(r,l))return l}return t}}});var _n,W2=U(()=>{_n=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Oo,K2=U(()=>{Re();Oo=class{constructor(t,r){this.child=t;this.sw=r}notationToInternal(t){return t.family==="T"&&t.innerLayer===void 0&&t.outerLayer===void 0?new B(new P("FLRv",t.innerLayer,t.outerLayer),t.amount):this.child.notationToInternal(t)}notationToExternal(t){let r=t.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new B(new P("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Ml,Q2=U(()=>{Re();Ml=class{constructor(t,r){this.internalNames=t;this.externalNames=r}convertString(t,r,n){let l="";(t.endsWith("v")||t.endsWith("v"))&&t<="_"&&(l=t.slice(t.length-1),t=t.slice(0,t.length-1));let o=t.toUpperCase(),i=!1;return t!==o&&(i=!0,t=o),t=n.joinByFaceIndices(r.splitByFaceNames(t)),i&&(t=t.toLowerCase()),t+l}convert(t,r,n){let l=t.family,o=this.convertString(l,r,n);return l===o?t:new B(new P(o,t.innerLayer,t.outerLayer),t.amount)}notationToInternal(t){return this.convert(t,this.externalNames,this.internalNames)}notationToExternal(t){return this.convert(t,this.internalNames,this.externalNames)}}});var To,j2=U(()=>{Re();To=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer===void 0&&t.outerLayer===void 0){if(Math.abs(t.amount)===1){if(t.family==="R++")return new B(new P("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new P("L",3,2),2*t.amount);if(t.family==="D++")return new B(new P("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new P("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new P("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new P("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="Uv"?new B(new P("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Io,q2=U(()=>{Re();Io=class{constructor(t){this.slices=t}notationToInternal(t){let r=t.family;return!t.innerLayer&&!t.outerLayer&&(r==="x"?t=new B("Rv",t.amount):r==="y"?t=new B("Uv",t.amount):r==="z"&&(t=new B("Fv",t.amount)),(this.slices&1)==1&&(r==="E"?t=new B(new P("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new P("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new P("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new P("D",this.slices-1,2),t.amount):r==="m"?t=new B(new P("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new P("F",this.slices-1,2),t.amount)))),t}notationToExternal(t){let r=t.family;if(!t.innerLayer&&!t.outerLayer){if(r==="Rv")return new B("x",t.amount);if(r==="Uv")return new B("y",t.amount);if(r==="Fv")return new B("z",t.amount);if(r==="Lv")return new B("x",-t.amount);if(r==="Dv")return new B("y",-t.amount);if(r==="Bv")return new B("z",-t.amount)}return t}}});var Dm,Fm,V2,H2,Y2,Nl,Wo,J2=U(()=>{Re();Dm={U:"frl",L:"fld",R:"fdr",B:"dlr",u:"FRL",l:"FLD",r:"FDR",b:"DLR",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R"},Fm={U:"FRL",L:"FLD",R:"FDR",B:"DLR",u:"frl",l:"fld",r:"fdr",b:"dlr",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R",d:"d",f:"f",bl:"l",br:"r"},V2={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},H2=new P("y"),Y2=new P("Dv"),Nl=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=Dm}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=V2[t.family];if(n)return new B(new P(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new P(r,t.innerLayer,t.outerLayer),t.amount):H2.isIdentical(t.quantum)?new B(Y2,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(V2))if(this.child.spinmatch(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount);return Y2.isIdentical(t.quantum)?new B(H2,-t.amount):null}},Wo=class extends Nl{constructor(t){super(t);this.map=Fm}}});var Z2,Wa,X2,Am,Ka,$2,ym,Qa,ef,Um,Ko,tf=U(()=>{Re();Z2={U:"UBL",UL:"ULF",F:"UFR",UR:"URB",B:"DBL",D:"DFR",L:"DLF",R:"DRB",Uv:"UBLv",ULv:"ULFv",Fv:"UFRv",URv:"URBv",Bv:"DBLv",Dv:"DFRv",Lv:"DLFv",Rv:"DRBv"},Wa=new P("x"),X2=new P("Rv"),Am=new P("Lv"),Ka=new P("y"),$2=new P("Uv"),ym=new P("Dv"),Qa=new P("z"),ef=new P("Fv"),Um=new P("Bv"),Ko=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Z2[t.family];return r?new B(new P(r,t.outerLayer,t.innerLayer),t.amount):Wa.isIdentical(t.quantum)?new B(X2,t.amount):Ka.isIdentical(t.quantum)?new B($2,t.amount):Qa.isIdentical(t.quantum)?new B(ef,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Z2))if(this.child.spinmatchv(t.family,n))return new B(new P(r,t.innerLayer,t.outerLayer),t.amount);return X2.isIdentical(t.quantum)?new B(Wa,t.amount):Am.isIdentical(t.quantum)?new B(Wa,-t.amount):$2.isIdentical(t.quantum)?new B(Ka,t.amount):ym.isIdentical(t.quantum)?new B(Ka,-t.amount):ef.isIdentical(t.quantum)?new B(Qa,t.amount):Um.isIdentical(t.quantum)?new B(Qa,-t.amount):null}}});var ja=U(()=>{W2();K2();Q2();j2();q2();J2();tf()});function rf(e){let t=0,r={};for(;t<e.length&&e[t][0]==="-";){let l=e[t++];if(l==="--rotations")r.addRotations=!0;else if(l==="--allmoves")r.allMoves=!0;else if(l==="--outerblockmoves")r.outerBlockMoves=!0;else if(l==="--vertexmoves")r.vertexMoves=!0;else if(l==="--nocorners")r.includeCornerOrbits=!1;else if(l==="--noedges")r.includeEdgeOrbits=!1;else if(l==="--noorientation")r.fixedOrientation=!0;else if(l==="--nocenters")r.includeCenterOrbits=!1;else if(l==="--omit")r.excludeOrbits=e[t].split(","),t++;else if(l==="--moves")r.moveList=e[t].split(","),t++;else if(l==="--optimize")r.optimizeOrbits=!0;else if(l==="--scramble")r.scrambleAmount=100;else if(l==="--fixcorner")r.fixedPieceType="v";else if(l==="--fixedge")r.fixedPieceType="e";else if(l==="--fixcenter")r.fixedPieceType="f";else if(l==="--orientcenters")r.orientCenters=!0;else if(l==="--puzzleorientation")r.puzzleOrientation=JSON.parse(e[t]),t++;else throw new Error("Bad option: "+l)}return{puzzleDescription:Gl(e.slice(t).join(" ")),options:r}}var qa,Va=U(()=>{Qo();qa=class{constructor(t={}){this.verbosity=0;this.allMoves=!1;this.vertexMoves=!1;this.addRotations=!1;this.moveList=null;this.fixedOrientation=!1;this.fixedPieceType=null;this.orientCenters=!1;this.includeCornerOrbits=!0;this.includeCenterOrbits=!0;this.includeEdgeOrbits=!0;this.excludeOrbits=[];this.optimizeOrbits=!1;this.grayCorners=!1;this.grayCenters=!1;this.grayEdges=!1;this.puzzleOrientation=null;this.puzzleOrientations=null;this.scrambleAmount=0;Object.assign(this,t)}}});function mr(e){if(!Ha[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;Ha[e]=t}return Ha[e]}function Gt(e){if(!Ya[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;Ya[e]=t}return Ya[e]}function nf(e){return new Bt(Gt(e))}function lf(e){let t=1;for(;e>1;)t*=e,e--;return t}function bm(e,t){if(e>t){let r=e;e=t,t=r}for(;e>0;){let r=t%e;t=e,e=r}return t}function Ja(e,t){return e/bm(e,t)*t}var Ha,Ya,Bt,jo=U(()=>{Ha=[],Ya=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return"Perm["+this.p.join(" ")+"]"}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push("("+l.join(",")+")")}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=Ja(t,l)}return t}}});function Za(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function of(e,t){let r=e.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],l=[];for(let i=0;i<r;i++){let a=e.moveops[i];n.push(a.order());let s=0;for(let f=0;f<r;f++){if(f===i)continue;let g=e.moveops[f];a.mul(g).equal(g.mul(a))&&(s|=1<<f)}l.push(s)}let o={};o[0]=1;for(let i=0;i<100;i++){let a=0,s={},f=0;for(let g in o){let c=+g,u=o[c];a+=u,f++;for(let p=0;p<n.length;p++)if((c>>p&1)==0&&(c&l[p]&(1<<p)-1)==0){let m=c&l[p]|1<<p;s[m]===void 0&&(s[m]=0),s[m]+=(n[p]-1)*u}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var Ol,xm,zn,wt,Zt,Xa,Lr,Cn,$a,af=U(()=>{Re();ja();jo();Ol=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return lf(this.size)*Math.pow(this.mod,this.size)}},xm=0;zn=class{constructor(t,r,n,l,o){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}toKsolve(t,r=new _n){let n=[];n.push("Name "+t),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=Za(r,this.movenames[l]),i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)i?this.moveops[l].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[l].orbits[a].appendDefinition(n,this.orbitnames[a],!0);n.push("End")}return n}toKPuzzleDefinition(t){let r={},n={};for(let o=0;o<this.orbitnames.length;o++){r[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let i=this.solved.orbits[o].toKPuzzle();n[this.orbitnames[o]]={pieces:i.permutation,orientation:i.orientation}}let l={};if(t)for(let o=0;o<this.movenames.length;o++)l[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++xm}\`,orbits:r,startStateData:n,moves:l}}optimize(){let t=[],r=[],n=[],l=[];for(let o=0;o<this.moveops.length;o++)l.push([]);for(let o=0;o<this.orbitdefs.length;o++){let i=this.orbitdefs[o].mod,a=this.orbitdefs[o].size,s=new $a(a),f=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)f[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let m=0;m<a;m++)(this.moveops[p].orbits[o].perm[m]!==m||this.moveops[p].orbits[o].ori[m]!==0)&&(f[m]=!0,s.union(m,this.moveops[p].orbits[o].perm[m]));let g=!0;if(i>1){g=!1;let p=new $a(this.orbitdefs[o].size*i);for(let m=0;m<this.moveops.length;m++)for(let L=0;L<a;L++)if(this.moveops[m].orbits[o].perm[L]!==L||this.moveops[m].orbits[o].ori[L]!==0)for(let R=0;R<i;R++)p.union(L*i+R,this.moveops[m].orbits[o].perm[L]*i+(R+this.moveops[m].orbits[o].ori[L])%i);for(let m=0;!g&&m<a;m++)for(let L=1;L<i;L++)p.find(m*i)===p.find(m*i+L)&&(g=!0);for(let m=0;!g&&m<a;m++)for(let L=0;L<m;L++)this.solved.orbits[o].perm[m]===this.solved.orbits[o].perm[L]&&(g=!0)}let c=-1,u=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let m=s.find(p);c<0?c=m:c!==m&&(u=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let L=[],R=[],h=0;for(let y=0;y<this.orbitdefs[o].size;y++)s.find(y)===p&&(L[h]=y,R[y]=h,h++);if(u?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),g){r.push(new Ol(h,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(L,h));for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h))}else{r.push(new Ol(h,1)),n.push(this.solved.orbits[o].remapVS(L,h).killOri());for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h).killOri())}}}return new zn(t,r,new Cn(n),this.movenames,l.map(o=>new Lr(o)))}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),a=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[a]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[a]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=1;for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},wt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new wt(Gt(t),mr(t),r)}mul(t){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let l=0;l<r;l++)n[l]=this.perm[t.perm[l]];return new wt(n,this.ori,this.orimod)}else{let l=new Array(r);for(let o=0;o<r;o++)n[o]=this.perm[t.perm[o]],l[o]=(this.ori[t.perm[o]]+t.ori[o])%this.orimod;return new wt(n,l,this.orimod)}}inv(){let t=this.perm.length,r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[this.perm[l]]=l,n[this.perm[l]]=(this.orimod-this.ori[l])%this.orimod;return new wt(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let a=l+1;a<r;a++)this.perm[a]===o&&i.push(a);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Gt(t)&&this.ori===mr(t))return!0;for(let r=0;r<t;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let t=this.perm.length;if(this.ori===mr(t))return!0;for(let r=0;r<t;r++)if(this.ori[r]!==0)return!1;return!0}remap(t,r,n){let l=new Array(n),o=new Array(n);for(let i=0;i<n;i++)l[i]=r[this.perm[t[i]]],o[i]=this.ori[t[i]];return new wt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let a=0;a<r;a++){let s=this.perm[t[a]];i[s]===void 0&&(i[s]=o++),n[a]=i[s],l[a]=this.ori[t[a]]}return new wt(n,l,this.orimod)}appendDefinition(t,r,n,l=!0){if(!(l&&this.isIdentity())&&(t.push(r),t.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let i=0;i<o.length;i++)o[this.perm[i]]=this.ori[i];t.push(o.join(" "))}else t.push(this.ori.join(" "))}toKPuzzle(){let t=this.perm.length;return this.isIdentity()?(wt.kcache[t]||(wt.kcache[t]={permutation:Gt(t),orientation:mr(t)}),wt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Zt=wt;Zt.kcache=[];Xa=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=Ja(t,r.order());return t}},Lr=class extends Xa{constructor(t){super(t)}mul(t){return new Lr(this.internalMul(t))}mulScalar(t){if(t===0)return this.e();let r=this;for(t<0&&(r=r.inv(),t=-t);(t&1)==0;)r=r.mul(r),t>>=1;if(t===1)return r;let n=r,l=this.e();for(;t>0;)t&1&&(l=l.mul(n)),t>1&&(n=n.mul(n)),t>>=1;return l}inv(){return new Lr(this.internalInv())}e(){return new Lr(this.orbits.map(t=>Zt.e(t.perm.length,t.orimod)))}},Cn=class extends Xa{constructor(t){super(t)}mul(t){return new Cn(this.internalMul(t))}},$a=class{constructor(t){this.n=t;this.heads=new Array(t);for(let r=0;r<t;r++)this.heads[r]=r}find(t){let r=this.heads[t];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[t]=r),r}union(t,r){let n=this.find(t),l=this.find(r);n<l?this.heads[l]=n:n>l&&(this.heads[n]=l)}}});var qo,sf=U(()=>{qo={"2x2x2":"c f 0","3x3x3":"c f 0.333333333333333","4x4x4":"c f 0.5 f 0","5x5x5":"c f 0.6 f 0.2","6x6x6":"c f 0.666666666666667 f 0.333333333333333 f 0","7x7x7":"c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143","8x8x8":"c f 0.75 f 0.5 f 0.25 f 0","9x9x9":"c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111","10x10x10":"c f 0.8 f 0.6 f 0.4 f 0.2 f 0","11x11x11":"c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909","12x12x12":"c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0","13x13x13":"c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769","20x20x20":"c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9","30x30x30":"c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333","40x40x40":"c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95",skewb:"c v 0","master skewb":"c v 0.275","professor skewb":"c v 0 v 0.38","compy cube":"c v 0.915641442663986",helicopter:"c e 0.707106781186547","curvy copter":"c e 0.83",dino:"c v 0.577350269189626","little chop":"c e 0",pyramorphix:"t e 0",mastermorphix:"t e 0.346184634065199",pyraminx:"t v 0.333333333333333 v 1.66666666666667",tetraminx:"t v 0.333333333333333","master pyraminx":"t v 0 v 1 v 2","master tetraminx":"t v 0 v 1","professor pyraminx":"t v -0.2 v 0.6 v 1.4 v 2.2","professor tetraminx":"t v -0.2 v 0.6 v 1.4","Jing pyraminx":"t f 0","master pyramorphix":"t e 0.866025403784437",megaminx:"d f 0.7",gigaminx:"d f 0.64 f 0.82",teraminx:"d f 0.64 f 0.76 f 0.88",petaminx:"d f 0.64 f 0.73 f 0.82 f 0.91",examinx:"d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928",zetaminx:"d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94",yottaminx:"d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486",pentultimate:"d f 0","master pentultimate":"d f 0.1","elite pentultimate":"d f 0 f 0.145905",starminx:"d v 0.937962370425399","starminx 2":"d f 0.23606797749979","pyraminx crystal":"d f 0.447213595499989",chopasaurus:"d v 0","big chop":"d e 0","skewb diamond":"o f 0",FTO:"o f 0.333333333333333","master FTO":"o f 0.5 f 0","Christopher's jewel":"o v 0.577350269189626",octastar:"o e 0","Trajber's octahedron":"o v 0.433012701892219","radio chop":"i f 0",icosamate:"i v 0","icosahedron 2":"i v 0.18759247376021","icosahedron 3":"i v 0.18759247376021 e 0","icosahedron static faces":"i v 0.84","icosahedron moving faces":"i v 0.73","Eitan's star":"i f 0.61803398874989","2x2x2 + dino":"c f 0 v 0.577350269189626","2x2x2 + little chop":"c f 0 e 0","dino + little chop":"c v 0.577350269189626 e 0","2x2x2 + dino + little chop":"c f 0 v 0.577350269189626 e 0","megaminx + chopasaurus":"d f 0.61803398875 v 0","starminx combo":"d f 0.23606797749979 v 0.937962370425399"}});function Vo(e){let t=new I(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function ff(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var jr,I,Ho=U(()=>{jr=1e-9;I=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new I(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new I(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new I(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new I(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new I(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new I(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new I(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new I(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new I(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,a,s,f){return t*(o*f-i*s)+r*(i*a-l*f)+n*(l*s-o*a)}rotateplane(t){let r=t.mul(new I(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new I(0,1,0,0)).normalize():r<t&&r<n?this.cross(new I(0,0,1,0)).normalize():this.cross(new I(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<jr)return new I(1,0,0,0);let n=r.sum(t);n.len()<jr?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<jr?!1:new I(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>jr?1:t<-jr?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)==5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let a=[];for(let s=0;s<t.length;s++){(o[s]===i||o[s]===0)&&a.push(t[s]);let f=(s+1)%t.length;if(o[s]+o[f]===0&&o[s]!==0){let g=t[s].dot(this)-r,c=t[f].dot(this)-r,u=g/(g-c),p=t[s].smul(1-u).sum(t[f].smul(u));a.push(p)}}l.push(a)}}return l}cutfaces(t){let r=[];for(let n=0;n<t.length;n++){let l=t[n],o=this.cutface(l);o?(r.push(o[0]),r.push(o[1])):r.push(l)}return r}faceside(t){let r=this.a;for(let n=0;n<t.length;n++){let l=this.side(t[n].dot(this)-r);if(l!==0)return l}throw new Error("Could not determine side of plane in faceside")}sameplane(t){let r=this.normalize(),n=t.normalize();return r.dist(n)<jr||r.dist(n.smul(-1))<jr}makecut(t){return new I(t,this.b,this.c,this.d)}}});function uf(){let e=Math.sqrt(.5);return[new I(e,e,0,0),new I(e,0,e,0)]}function gf(){return[new I(.5,.5,.5,.5),new I(.5,.5,.5,-.5)]}function cf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new I(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new I(.5,.5,.5,.5)]}function pf(){let e=1/6+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new I(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new I(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function mf(){let e=Math.sqrt(.5);return[new I(.5,.5,.5,.5),new I(e,0,0,e)]}function Lf(e){let t=[new I(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let a=0;a<t.length;a++)if(l.dist(t[a])<Yo||o.dist(t[a])<Yo){i=!0;break}i||t.push(l)}return t}function es(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let a=0;a<r.length;a++)if(o.dist(r[a])<Yo){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function ts(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=ff(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<Yo){o=!0;break}o||t.push(l)}}for(;;){let r=!1;for(let n=0;n<t.length;n++){let l=(n+1)%t.length;if(e[0].dot(t[n].cross(t[l]))<0){let o=t[n];t[n]=t[l],t[l]=o,r=!0}}if(!r)break}return t}var Yo,Bf=U(()=>{Ho();Yo=1e-9});function Jo(e,t){let r=e[0].p.length,n=nf(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let m=p.p.length-1;m>=0;m--){let L=p.p[m];if(L!==m){if(!l[m][L])return!1;p=p.mul(o[m][L])}}return!0}function g(p,m,L){a[p].push(m),s[p].push(L);for(let R=0;R<l[p].length;R++)l[p][R]&&c(p,l[p][R].mul(m),L+i[p][R])}function c(p,m,L){let R=m.p[p];if(!l[p][R]){l[p][R]=m,o[p][R]=m.inv(),i[p][R]=L;for(let y=0;y<a[p].length;y++)c(p,m.mul(a[p][y]),L+s[p][y]);return}let h=m.mul(o[p][R]);f(h)||g(p-1,h,L+i[p][R])}function u(){l=[],o=[],a=[],i=[],s=[];for(let L=0;L<r;L++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[L][L]=n,o[L][L]=n,i[L][L]=0;let p=0,m=1;for(let L=0;L<e.length;L++){g(r-1,e[L],1),m=1;let R=0,h=0,y=[],A=new Rf;for(let k=0;k<r;k++){let E=0,Q=0;for(let N=0;N<r;N++)l[k][N]&&(E++,Q+=i[k][N],k!==N&&p++);R+=a[k].length,m*=E,E>1&&A.multiply(E);let $=Q/E;y.push($),h+=$}t(\`\${L}: sz \${m} T \${R} sol \${h} none \${p} mults \${A.toString()}\`)}return m}return u()}var Rf,rs=U(()=>{jo();Rf=class{constructor(){this.mult=[]}multiply(t){for(let r=2;r*r<=t;r++)for(;t%r==0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,t/=r;t>1&&(this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1)}toString(){let t="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(t!==""&&(t+="*"),t+=r,this.mult[r]>1&&(t+=\`^\${this.mult[r]}\`));return t}}});function ns(e){return e}function ls(e){}function wm(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function Em(){return{4:[["F","D","L","R"]],6:[["F","D","L","U","R"],["R","F","","B",""]],8:[["F","D","L","R"],["D","F","BR",""],["BR","D","","BB"],["BB","BR","U","BL"]],12:[["U","F","","","",""],["F","U","R","C","A","L"],["R","F","","","E",""],["E","R","","BF","",""],["BF","E","BR","BL","I","D"]],20:[["R","C","F","E"],["F","R","L","U"],["L","F","A",""],["E","R","G","I"],["I","E","S","H"],["S","I","J","B"],["B","S","K","D"],["K","B","M","O"],["O","K","P","N"],["P","O","Q",""]]}}function km(){return{4:{F:"#00ff00",D:"#ffff00",L:"#ff0000",R:"#0000ff"},6:{U:"#ffffff",F:"#00ff00",R:"#ff0000",D:"#ffff00",B:"#0000ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#00bb00",D:"#ffff00",BB:"#1122ff",L:"#9524c5",BL:"#ff8800",BR:"#aaaaaa"},12:{U:"#ffffff",F:"#006633",R:"#ff0000",C:"#ffffd0",A:"#3399ff",L:"#660099",E:"#ff66cc",BF:"#99ff00",BR:"#0000ff",BL:"#ffff00",I:"#ff6633",D:"#999999"},20:{R:"#db69f0",C:"#178fde",F:"#23238b",E:"#9cc726",L:"#2c212d",U:"#177fa7",A:"#e0de7f",G:"#2b57c0",I:"#41126b",S:"#4b8c28",H:"#7c098d",J:"#7fe7b4",B:"#85fb74",K:"#3f4bc3",D:"#0ff555",M:"#f1c2c8",O:"#58d340",P:"#c514f2",N:"#14494e",Q:"#8b1be1"}}}function _m(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function zm(){return{4:[["FLR",[0,1,0]],["F",[0,0,1]]],6:[["U",[0,1,0]],["F",[0,0,1]]],8:[["U",[0,1,0]],["F",[0,0,1]]],12:[["U",[0,1,0]],["F",[0,0,1]]],20:[["GUQMJ",[0,1,0]],["F",[0,0,1]]]}}function Zo(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<_e)return r;throw new Error("Element not found")}function df(){return qo}function hf(e){return qo[e]}function Gl(e){let t=e.split(/ /).filter(Boolean);if(t.length%2==0)return null;let r=t[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let l=1;l<t.length;l+=2){if(t[l]!=="f"&&t[l]!=="v"&&t[l]!=="e")return null;n.push({cutType:t[l],distance:parseFloat(t[l+1])})}return{shape:r,cuts:n}}function os(e,t={}){let r=Gl(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new $o(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function Mn(e,t){return os(qo[e],t)}function Cm(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=l+"v";else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw\`We only support slice and outer block moves right now. \${t}\`;return[o+l,n]}function Pm(e,t){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let l="";for(let o of t)e.substr(n).startsWith(o[1])&&o[1].length>l.length&&(l=o[1]);if(l!=="")r.push(l),n+=l.length;else throw new Error("Could not split "+e+" into face names.")}return r}function Xo(e,t){return[e.b/t,-e.c/t,e.d/t]}function is(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Xo(e.get(n-l-1),t);r[3*l]=o[0],r[3*l+1]=o[1],r[3*l+2]=o[2]}return r}var Pn,Tl,_e,Sm,vm,$o,qr,Qo=U(()=>{Re();I2();ja();Va();jo();af();sf();Bf();Ho();rs();Pn=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new I(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new I(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new Pn(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new Pn(t)}},Tl=class{constructor(t,r,n){this.face=t;this.left=r;this.right=n}split(t){let r=t.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new Tl(r[0]),this.right=new Tl(r[1])):(this.left=this.left?.split(t),this.right=this.right?.split(t))),this}collect(t,r){return this.left===void 0?t.push(new Pn(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};_e=1e-9,Sm="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",vm=!1;$o=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new _n;this.addNotationMapper="";this.setReidOrder=!1;let n=ns("genperms");this.options=new qa(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(t),ls(n)}create(t){let{shape:r,cuts:n}=t;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let l=null;switch(r){case"c":l=uf();break;case"o":l=mf();break;case"i":l=pf();break;case"t":l=gf();break;case"d":l=cf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=Lf(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=es(o,this.rotations);let i=this.baseplanerot.map(F=>o.rotateplane(F));this.baseplanes=i,this.baseFaceCount=i.length;let a=Em()[i.length];this.net=a,this.colors=km()[i.length],this.faceorder=_m()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let s=ts(i),f=new I(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+s.length);let g=i[0].makenormal(),c=s[0].sum(s[1]).makenormal(),u=s[0].makenormal(),p=new I(1,g.b,g.c,g.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let L=es(p,this.rotations).map(F=>p.rotateplane(F)),R=ts(L);this.edgedistance=R[0].sum(R[1]).smul(.5).dist(f),this.vertexdistance=R[0].dist(f);let h=[],y=[],A=!1,k=!1,E=!1;for(let F of n){let v=null,O=0;switch(F.cutType){case"f":v=g,O=1,A=!0;break;case"v":v=u,O=this.vertexdistance,E=!0;break;case"e":v=c,O=this.edgedistance,k=!0;break;default:throw new Error("Bad cut argument: "+F.cutType)}h.push(v.makecut(F.distance)),y.push(F.distance<O)}this.options.addRotations&&(A||h.push(g.makecut(10)),E||h.push(u.makecut(10)),k||h.push(c.makecut(10))),this.basefaces=[];for(let F of this.baseplanerot){let v=F.rotateface(R);this.basefaces.push(new Pn(v))}let Q=[],$=[],N=[],oe=[],b=R.length;function z(F,v,O){for(let K of F)if(K[0].dist(v)<_e){K.push(O);return}F.push([v,O])}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R);for(let O=0;O<v.length;O++){let K=(O+1)%v.length,ie=v[O].sum(v[K]).smul(.5);z(oe,ie,F)}}let M=[];for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=[];for(let K=0;K<v.length;K++){let ie=(K+1)%v.length,Je=v[K].sum(v[ie]).smul(.5),ct=oe[Zo(oe,Je)];if(F===ct[1])O.push(ct[2]);else if(F===ct[2])O.push(ct[1]);else throw new Error("Could not find edge")}M.push(O)}let w={},S=[];S.push(a[0][0]),w[a[0][0]]=0,S[M[0][0]]=a[0][1],w[a[0][1]]=M[0][0];for(let F of a){let v=F[0],O=w[v];if(O===void 0)throw new Error("Bad edge description; first edge not connected");let K=-1;for(let ie=0;ie<M[O].length;ie++){let Je=S[M[O][ie]];if(Je!==void 0&&Je===F[1]){K=ie;break}}if(K<0)throw new Error("First element of a net not known");for(let ie=2;ie<F.length;ie++){if(F[ie]==="")continue;let Je=M[O][(ie+K-1)%b],ct=S[Je];if(ct!==void 0&&ct!==F[ie])throw new Error("Face mismatch in net");S[Je]=F[ie],w[F[ie]]=Je}}for(let F=0;F<S.length;F++){let v=!1;for(let O=0;O<this.faceorder.length;O++)if(S[F]===this.faceorder[O]){this.faceprecedence[F]=O,v=!0;break}if(!v)throw new Error("Could not find face "+S[F]+" in face order list "+this.faceorder)}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=p.rotateplane(this.baseplanerot[F]),K=S[F];Q.push([v,K]),$.push([O,K])}for(let F=0;F<this.baseplanerot.length;F++){let v=this.baseplanerot[F].rotateface(R),O=S[F];for(let K=0;K<v.length;K++){let ie=(K+1)%v.length,Je=v[K].sum(v[ie]).smul(.5),ct=(K+2)%v.length,_p=v[ie].sum(v[ct]).smul(.5),zp=Zo(oe,Je),Cp=Zo(oe,_p);z(N,v[ie],[O,Cp,zp])}}this.swizzler=new Pl(Q.map(F=>F[1]));let C=this.swizzler.prefixFree?"":"_";for(let F=0;F<oe.length;F++){if(oe[F].length!==3)throw new Error("Bad length in edge names "+oe[F]);let v=S[oe[F][1]],O=S[oe[F][2]];this.faceprecedence[oe[F][1]]<this.faceprecedence[oe[F][2]]?v=v+C+O:v=O+C+v,oe[F]=[oe[F][0],v]}for(let F=0;F<N.length;F++){if(N[F].length<4)throw new Error("Bad length in vertex names");let v=1;for(let K=2;K<N[F].length;K++)this.faceprecedence[w[N[F][K][0]]]<this.faceprecedence[w[N[F][v][0]]]&&(v=K);let O="";for(let K=1;K<N[F].length;K++){K===1?O=N[F][v][0]:O=O+C+N[F][v][0];for(let ie=1;ie<N[F].length;ie++)if(N[F][v][1]===N[F][ie][2]){v=ie;break}}N[F]=[N[F][0],O]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+Q.map(F=>F[1]).join(" ")),console.log("# Edge names: "+oe.map(F=>F[1]).join(" ")),console.log("# Vertex names: "+N.map(F=>F[1]).join(" ")));let j=[];for(let F of $)j.push([F[0].makenormal(),F[1],"f"]);for(let F of oe)j.push([F[0].makenormal(),F[1],"e"]);for(let F of N)j.push([F[0].makenormal(),F[1],"v"]);this.facenames=Q,this.faceplanes=$,this.edgenames=oe,this.vertexnames=N,this.geonormals=j;let J=j.map(F=>F[1]);this.swizzler.setGripNames(J),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let F=0;F<h.length;F++)for(let v of this.rotations){let O=h[F].rotateplane(v),K=!1;for(let ie of this.moveplanes)if(O.sameplane(ie)){K=!0;break}K||(this.moveplanes.push(O),y[F]&&this.moveplanes2.push(O))}let me=new Tl(R),he=this.moveplanes2.slice(),xe=31;for(let F=0;F<he.length;F++){let v=F+Math.floor((he.length-F)*(xe/65536));me=me.split(he[v]),he[v]=he[F],xe=(xe*1657+101)%65536}let ke=me.collect([],!0);this.faces=ke,this.options.verbosity>0&&console.log("# Faces is now "+ke.length),this.stickersperface=ke.length;let Pt=[],Ie=Vo(R);for(let F of this.rotations){let v=F.rotateface(R);Ie.dist(Vo(v))<_e&&Pt.push(F)}let ot=new Array(ke.length),Pe=[];for(let F=0;F<ke.length;F++){let v=ke[F].centermass();Pe.push([Ie.dist(v),v,F])}Pe.sort((F,v)=>F[0]-v[0]);for(let F=0;F<ke.length;F++){let v=Pe[F][2];if(!ot[v]){ot[v]=!0;for(let O of Pt){let K=ke[v].rotate(O),ie=K.centermass();for(let Je=F+1;Je<ke.length&&!(Pe[Je][0]-Pe[F][0]>_e);Je++){let ct=Pe[Je][2];if(!ot[ct]&&ie.dist(Pe[Je][1])<_e){ot[ct]=!0,ke[ct]=K;break}}}}}this.shortedge=1e99;for(let F of ke)for(let v=0;v<F.length;v++){let O=(v+1)%F.length,K=F.get(v).dist(F.get(O));K<this.shortedge&&(this.shortedge=K)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&A&&!k&&!E&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&E&&!A&&!k&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(E||A)&&!k&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&A&&(this.notationMapper=new Ml(this.swizzler,new Pl(["F","D","L","BL","R","U","BR","B"])),!k&&!E&&(this.addNotationMapper="FTOMapper")),r==="d"&&A&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Ml(this.swizzler,new Pl(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(t){return this.keyface2(t.centermass())}keyface2(t){let r="",n=String.fromCharCode;for(let l of this.moveplanesets)if(l.length>0){let o=t.dot(l[0]),i=0,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);if(i<47)r=r+n(33+i);else if(i<47+47*47)r=r+n(33+47+Math.floor(i/47)-1)+n(33+i%47);else if(i<47+47*47+47*47*47)r=r+n(33+47+Math.floor((i-47)/(47*47)-1))+n(33+47+Math.floor((i-47)/47)%47)+n(33+i%47);else throw Error("Too many slices for cubie encoding")}return r}keyface3(t){let r=t.centermass(),n=[];for(let l of this.moveplanesets)if(l.length>0){let o=r.dot(l[0]),i=0,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);n.push(i)}return n}findface(t){let r=this.keyface2(t),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let l=0;l+1<n.length;l++){let o=this.facelisthash.get(r)[l];if(Math.abs(t.dist(this.facecentermass[o]))<_e)return o}return n[n.length-1]}project2d(t,r,n){let l=this.facenames[t][0],o=(r+1)%l.length,i=this.baseplanes[t],a=l[o].sub(l[r]),s=a.len();a=a.normalize();let f=a.cross(i).normalize(),g=n[1].sub(n[0]),c=g.len()/s;g=g.normalize();let u=g.b,p=g.c,m=a.smul(u).sub(f.smul(p)).smul(c),L=f.smul(u).sum(a.smul(p)).smul(c),R=new I(0,n[0].b-m.dot(l[r]),n[0].c-L.dot(l[r]),0);return[m,L,R]}allstickers(){let t=ns("allstickers");this.faces=wm(this.baseplanerot,this.faces),this.options.verbosity>0&&console.log("# Total stickers is now "+this.faces.length),this.facecentermass=new Array(this.faces.length);for(let b=0;b<this.faces.length;b++)this.facecentermass[b]=this.faces[b].centermass();let r=[],n=[];for(let b of this.moveplanes){let z=b.makenormal(),M=!1;for(let w of n)z.sameplane(w.makenormal())&&(M=!0);M||(n.push(z),r.push([]))}for(let b of this.moveplanes2){let z=b.makenormal();for(let M=0;M<n.length;M++)if(z.sameplane(n[M])){r[M].push(b);break}}for(let b=0;b<r.length;b++){let z=r[b].map(w=>w.normalizeplane()),M=n[b];for(let w=0;w<z.length;w++)z[w].makenormal().dist(M)>_e&&(z[w]=z[w].smul(-1));z.sort((w,S)=>w.a-S.a),r[b]=z}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(b=>b.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let b=0;b<r.length;b++)o.push([]);for(let b of this.rotations){if(Math.abs(Math.abs(b.a)-1)<_e)continue;let z=b.makenormal();for(let M=0;M<r.length;M++)if(z.sameplane(n[M])){o[M].push(b);break}}this.moverotations=o;for(let b=0;b<o.length;b++){let z=o[b],M=z[0].makenormal();for(let w=0;w<z.length;w++)M.dist(z[w].makenormal())>_e&&(z[w]=z[w].smul(-1));z.sort((w,S)=>w.angle()-S.angle()),o[b][0].dot(n[b])<0&&z.reverse()}let i=o.map(b=>1+b.length);this.movesetorders=i;let a=[],s="?";for(let b=0;b<r.length;b++){let z=n[b],M=null,w=null;for(let S of this.geonormals){let C=z.dot(S[0]);Math.abs(C-1)<_e?(w=[S[1],S[2]],s=S[2]):Math.abs(C+1)<_e&&(M=[S[1],S[2]],s=S[2])}if(w===null||M===null)throw new Error("Saw positive or negative sides as null");a.push([w[0],w[1],M[0],M[1],1+r[b].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new Io(1+r[b].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Ko(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(r[0].length===2&&r[0][0].a===.333333333333333&&r[0][1].a===1.66666666666667?(this.notationMapper=new Nl(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Wo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new To(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new Oo(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,g=this.faces;for(let b=0;b<g.length;b++){let z=g[b],M=this.keyface(z);if(!f.get(M))f.set(M,[b]);else{let w=f.get(M);if(w.push(b),w.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let S=0;S<w.length;S++){let C=M+" "+S;f.set(C,[w[S]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let c=[],u=[],p=[];for(let b of f.values())if(b.length!==this.baseFaceCount){if(b.length>1){let z=b.map(C=>g[C].centermass()),M=Vo(z);for(let C=0;b.length>2;C++){let j=!1;for(let J=0;J<b.length;J++){let me=(J+1)%b.length;if(M.dot(z[J].cross(z[me]))<0){let he=z[J];z[J]=z[me],z[me]=he;let xe=b[J];b[J]=b[me],b[me]=xe,j=!0}}if(!j)break;if(C>1e3)throw new Error("Bad epsilon math; too close to border")}let w=0,S=b[w];for(let C=1;C<b.length;C++){let j=b[C];this.faceprecedence[this.getfaceindex(j)]<this.faceprecedence[this.getfaceindex(S)]&&(w=C,S=j)}if(w!==0){let C=b.slice();for(let j=0;j<b.length;j++)b[j]=C[(w+j)%b.length]}}for(let z=0;z<b.length;z++){let M=b[z];u[M]=c.length,p[M]=z}c.push(b)}this.cubies=c,this.facetocubie=u,this.facetoord=p;let m=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],R=[0,0,0,0,0,0],h=[],y=[],A=0,k=[],E=[],Q=[],$=[],N=b=>c[b].map(z=>this.getfaceindex(z)).join(" "),oe=[];for(let b=0;b<c.length;b++){if(y[b])continue;let z=c[b];if(z.length===0)continue;let M={},w=0;Q.push(0),oe.push([]);let S=z.length,C=R[S]++,j=m[S];(j===void 0||S===this.baseFaceCount)&&(j="CORE"),j=j+(C===0?"":C+1),L[A]=j,h[A]=S;let J=[b],me=0;for(y[b]=!0;me<J.length;){let he=J[me++],xe=N(he);if((z.length>1||M[xe]===void 0)&&(M[xe]=w++),$[he]=M[xe],k[he]=A,oe[A].push(he),E[he]=Q[A]++,J.length<this.rotations.length){let ke=this.facecentermass[c[he][0]];for(let Pt of o){let Ie=this.facetocubie[this.findface(ke.rotatepoint(Pt[0]))];y[Ie]||(J.push(Ie),y[Ie]=!0)}}}A++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let b=[["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],["UFR","URB","UBL","ULF","DRF","DFL","DLB","DBR"],["U","L","F","R","B","D"]],z={};for(let M of b)for(let w=0;w<M.length;w++){let S=0;for(let C=0;C<M[w].length;C++)S|=1<<M[w].charCodeAt(C)-65;z[S]=w}for(let M of oe)for(let w of M){let S=0;for(let C of c[w])S|=1<<this.facenames[this.getfaceindex(C)][1].charCodeAt(0)-65;E[w]=z[S]}}if(this.cubiesetnums=k,this.cubieordnums=E,this.cubiesetnames=L,this.cubieords=Q,this.orbitoris=h,this.cubievaluemap=$,this.cubiesetcubies=oe,this.options.fixedPieceType!==null){for(let b=0;b<c.length;b++)if(this.options.fixedPieceType==="v"&&c[b].length>2||this.options.fixedPieceType==="e"&&c[b].length===2||this.options.fixedPieceType==="f"&&c[b].length===1){this.fixedCubie=b;break}if(this.fixedCubie<0)throw new Error("Could not find a cubie of type "+this.options.fixedPieceType+" to fix.")}this.options.verbosity>0&&console.log("# Cubie orbit sizes "+Q),ls(t)}unswizzle(t){let r=this.notationMapper.notationToInternal(t);return r===null?"":this.swizzler.unswizzle(r.family)}stringToBlockMove(t){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=t.match(r);if(n===null)throw new Error("Bad move passed "+t);let l=n[4],o,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");o=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let a="1",s=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),s=parseInt(a,10)),new B(new P(l,i,o),s)}parseMove(t){let r=this.notationMapper.notationToInternal(t);if(r===null)throw new Error("Bad move "+t.family);t=r;let n=t.family,l=!1;if(n.endsWith("v")&&n[0]<="Z"){if(t.innerLayer!==void 0||t.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),l=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,i=-1,a=this.swizzler.unswizzle(n),s=!1;for(let c=0;c<this.movesetgeos.length;c++){let u=this.movesetgeos[c];a===u[0]&&(s=!0,o=u,i=c),a===u[2]&&(s=!1,o=u,i=c)}let f=1,g=1;if(n.toUpperCase()!==n&&(g=2),o===void 0)throw new Error("Bad grip in move "+t.family);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(g=t.innerLayer,n<="Z"?f=g:f=1):g=t.innerLayer),f--,g--,l&&(f=0,g=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||g<0||g>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+g+" vs "+this.moveplanesets[i].length);if(!vm&&f===0&&g===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,g,s,t.amount]}parsemove(t){let r=this.parseMove(this.stringToBlockMove(t));return r[0]=t,r}genperms(){let t=ns("genperms");if(this.cmovesbyslice.length>0)return;let r=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let l=this.cubies[n][0],o=this.getfaceindex(l);if(this.basefaces[o].centermass().dist(this.facecentermass[l])<_e){let i=this.basefaces[o].length;for(let a=1;a<i;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[l]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],a=1;for(;a*2<=l.length;)a*=2;for(let g=0;g<this.faces.length;g++){let c=0;if(l.length>0){let u=this.facecentermass[g].dot(l[0]);for(let p=a;p>0;p>>=1)c+p<=l.length&&u>l[c+p-1].a&&(c+=p);c=l.length-c}for(o.push(c);i.length<=c;)i.push(0);i[c]++}let s=new Array(i.length);for(let g=0;g<i.length;g++)s[g]=[];let f=[];for(let g=0;g<this.faces.length;g++){if(o[g]<0)continue;let c=[this.facetocubie[g],this.facetoord[g]],u=this.facecentermass[g],p=u,m=g,L=o[m];for(;;){o[m]=-1;let R=u.rotatepoint(this.moverotations[n][0]);if(R.dist(p)<_e)break;m=this.findface(R),c.push(this.facetocubie[m],this.facetoord[m]),u=R}if(c.length>2&&this.options.orientCenters&&(this.cubies[c[0]].length===1||this.duplicatedCubies[c[0]]>1)&&this.facecentermass[g].dist(this.basefaces[this.getfaceindex(g)].centermass())<_e){let R=this.faces[this.cubies[c[0]][0]];for(let h=0;h<c.length;h+=2){let y=this.faces[this.cubies[c[h]][0]],A=-1;for(let k=0;k<R.length;k++)if(y.get(k).dist(R.get(0))<_e){A=k;break}if(A<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");c[h+1]=A,R=R.rotate(this.moverotations[n][0])}}if(c.length===2&&this.options.orientCenters)for(let R=1;R<this.movesetorders[n];R++)L===0?c.push(c[0],R):c.push(c[0],(this.movesetorders[n]-R)%this.movesetorders[n]);if(c.length>2&&!f[c[0]]){if(c.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let R of c)s[L].push(R)}for(let R=0;R<c.length;R+=2)f[c[R]]=!0}for(let g=0;g<s.length;g++)s[g]=s[g].slice();r.push(s)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let l of this.options.moveList)n.push(this.parsemove(l));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],ls(t)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(t){let r=this.moveplanesets[t].length,n=[];if(this.parsedmovelist!==void 0)for(let l of this.parsedmovelist)l[1]===t&&(l[4]?n.push([l[2],l[3]]):n.push([r-l[3],r-l[2]]),n.push(l[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let l=this.movesetgeos[t];if(l[1]!==l[3])for(let o=0;o<r;o++)l[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,r]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let l=0;l<=r;l++)!this.options.allMoves&&l+l===r||(this.options.outerBlockMoves?l+l>r?n.push([l,r]):n.push([0,l]):n.push([l,l]),n.push(1));if(this.fixedCubie>=0){let l=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[t],o=[];for(let i=0;i<n.length;i+=2){let a=n[i];if(l>=a[0]&&l<=a[1])if(a[0]===0)a=[a[1]+1,r];else if(r===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let s=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===a[0]&&o[f][1]===a[1]&&o[f+1]===n[i+1]){s=!0;break}s||(o.push(a),o.push(n[i+1]))}n=o}return n}graybyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||r===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||r>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(t){return this.skipbyori(t)}header(t){return t+Sm+\`
|
|
9
9
|
\`+t+\`
|
|
10
10
|
\`}writegap(){let t=this.getOrbitsDef(!1),r=[],n=[];for(let o=0;o<t.moveops.length;o++){let i="M_"+Za(this.notationMapper,t.movenames[o]),a=!1;i[i.length-1]==="'"&&(i=i.substring(0,i.length-1),a=!0),n.push(i),a?r.push(i+":="+t.moveops[o].toPerm().inv().toGap()+";"):r.push(i+":="+t.moveops[o].toPerm().toGap()+";")}r.push("Gen:=["),r.push(n.join(",")),r.push("];");let l=t.solved.identicalPieces();return r.push("ip:=["+l.map(o=>"["+o.map(i=>i+1).join(",")+"]").join(",")+"];"),r.push("# Size(Group(Gen));"),r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));"),r.push(""),this.header("# ")+r.join(\`
|
|
11
11
|
\`)}writeksolve(t="PuzzleGeometryPuzzle"){let r=this.getOrbitsDef(!1);return this.header("# ")+r.toKsolve(t,this.notationMapper).join(\`
|
|
@@ -3671,4 +3671,4 @@ Alg R' U' R U B' U' B L\`)}var wD,SD,I0=U(()=>{Ve();Nn();Gn();wD=null;SD=null});
|
|
|
3671
3671
|
export {
|
|
3672
3672
|
workerSource
|
|
3673
3673
|
};
|
|
3674
|
-
//# sourceMappingURL=worker-inside-generated-string-
|
|
3674
|
+
//# sourceMappingURL=worker-inside-generated-string-VHOABMFC.js.map
|