cubing 0.24.0-pre4 → 0.24.2
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-5IQQFXW7.js → 2x2x2.sgs.json-5MCXGXA6.js} +3 -3
- package/dist/esm/{2x2x2.sgs.json-5IQQFXW7.js.map → 2x2x2.sgs.json-5MCXGXA6.js.map} +0 -0
- package/dist/esm/{3d-dynamic-inside-OGANXBOW.js → 3d-dynamic-inside-XYXXTULQ.js} +4 -4
- package/dist/esm/{3d-dynamic-inside-OGANXBOW.js.map → 3d-dynamic-inside-XYXXTULQ.js.map} +0 -0
- package/dist/esm/bluetooth/index.js +3 -3
- package/dist/esm/{chunk-2IHGN4YF.js → chunk-2CGRUO5X.js} +120 -96
- package/dist/esm/chunk-2CGRUO5X.js.map +7 -0
- package/dist/esm/{chunk-NMODRU23.js → chunk-2I3MTSRM.js} +3 -3
- package/dist/esm/{chunk-NMODRU23.js.map → chunk-2I3MTSRM.js.map} +0 -0
- package/dist/esm/{chunk-Z36TNZT2.js → chunk-B27E6KTE.js} +9 -4
- package/dist/esm/chunk-B27E6KTE.js.map +7 -0
- package/dist/esm/{chunk-QBSUFYNB.js → chunk-BBEJTW6Z.js} +2 -2
- package/dist/esm/{chunk-QBSUFYNB.js.map → chunk-BBEJTW6Z.js.map} +0 -0
- package/dist/esm/{chunk-VSR6KPDV.js → chunk-GBIDMAJS.js} +2 -2
- package/dist/esm/{chunk-VSR6KPDV.js.map → chunk-GBIDMAJS.js.map} +0 -0
- package/dist/esm/{chunk-5HKJRHTE.js → chunk-HU55EGD6.js} +2 -2
- package/dist/esm/{chunk-5HKJRHTE.js.map → chunk-HU55EGD6.js.map} +0 -0
- package/dist/esm/{chunk-WOZD7WE6.js → chunk-LR6VCMD2.js} +2 -2
- package/dist/esm/{chunk-WOZD7WE6.js.map → chunk-LR6VCMD2.js.map} +0 -0
- package/dist/esm/{chunk-UYT3253Q.js → chunk-TOPMNZ57.js} +2 -2
- package/dist/esm/{chunk-UYT3253Q.js.map → chunk-TOPMNZ57.js.map} +0 -0
- package/dist/esm/{chunk-Z7Z3EXTF.js → chunk-UZTY6GHM.js} +3 -3
- package/dist/esm/chunk-UZTY6GHM.js.map +7 -0
- package/dist/esm/{entry-JFJRMSLA.js → entry-FOASJVBZ.js} +14 -14
- package/dist/esm/{entry-JFJRMSLA.js.map → entry-FOASJVBZ.js.map} +0 -0
- package/dist/esm/{fto.sgs.json-7I3SDUV5.js → fto.sgs.json-USK5JCKN.js} +3 -3
- package/dist/esm/{fto.sgs.json-7I3SDUV5.js.map → fto.sgs.json-USK5JCKN.js.map} +0 -0
- package/dist/esm/kpuzzle/index.js +3 -1
- package/dist/esm/{megaminx.sgs.json-H4UHRFJ6.js → megaminx.sgs.json-3UELYHNZ.js} +3 -3
- package/dist/esm/{megaminx.sgs.json-H4UHRFJ6.js.map → megaminx.sgs.json-3UELYHNZ.js.map} +0 -0
- package/dist/esm/{module-entry-4JHVVJZL.js → module-entry-DBPFVUZH.js} +2 -2
- package/dist/esm/{module-entry-4JHVVJZL.js.map → module-entry-DBPFVUZH.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-ADZX6JEQ.js → pyraminx.sgs.json-ARYGZ7E4.js} +4 -4
- package/dist/esm/{pyraminx.sgs.json-ADZX6JEQ.js.map → pyraminx.sgs.json-ARYGZ7E4.js.map} +0 -0
- package/dist/esm/scramble/index.js +4 -4
- package/dist/esm/{scramble_444-QWIUGTEG.js → scramble_444-HZ7HJLTT.js} +6 -5
- package/dist/esm/scramble_444-HZ7HJLTT.js.map +7 -0
- package/dist/esm/search/index.js +4 -4
- package/dist/esm/{skewb.sgs.json-KZUPZ744.js → skewb.sgs.json-QVGBEYZV.js} +3 -3
- package/dist/esm/{skewb.sgs.json-KZUPZ744.js.map → skewb.sgs.json-QVGBEYZV.js.map} +0 -0
- package/dist/esm/twisty/index.js +404 -205
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/{worker-inside-generated-string-MFGRIFCG.js → worker-inside-generated-string-OWBTRAXR.js} +21 -21
- package/dist/esm/worker-inside-generated-string-OWBTRAXR.js.map +7 -0
- package/dist/types/kpuzzle/index.d.ts +2 -2
- package/dist/types/puzzles/async/async-pg3d.d.ts +23 -6
- package/dist/types/puzzles/async/lazy-cached.d.ts +1 -0
- package/dist/types/puzzles/implementations/fto/index.d.ts +11 -2
- package/dist/types/puzzles/implementations/megaminx/index.d.ts +11 -2
- package/dist/types/puzzles/implementations/pyraminx/index.d.ts +7 -2
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/twisty/index.d.ts +1 -0
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts +44 -42
- package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/state/{AnchoredStartProp.d.ts → AnchorTransformationProp.d.ts} +3 -3
- package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +1 -0
- package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +1 -0
- package/dist/types/twisty/views/ManagedCustomElement.d.ts +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +1 -1
- package/dist/types/twisty/views/twizzle/TwizzleLink.css.d.ts +2 -0
- package/dist/types/twisty/views/twizzle/TwizzleLink.d.ts +11 -0
- package/dist/types/twisty/views/twizzle/url-params.d.ts +18 -0
- package/package.json +2 -1
- package/dist/esm/chunk-2IHGN4YF.js.map +0 -7
- package/dist/esm/chunk-Z36TNZT2.js.map +0 -7
- package/dist/esm/chunk-Z7Z3EXTF.js.map +0 -7
- package/dist/esm/scramble_444-QWIUGTEG.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-MFGRIFCG.js.map +0 -7
- package/dist/types/puzzles/async/lazy-cached-kpuzzle.d.ts +0 -2
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import "./chunk-WO2AXYFE.js";
|
|
2
2
|
|
|
3
3
|
// src/cubing/search/worker-inside-generated-string.js
|
|
4
|
-
var workerSource = `var
|
|
5
|
-
\`)||e.includes("\\r"))throw new Error("LineComment cannot contain newline")
|
|
6
|
-
\`}isIdentical(e){return e.is(
|
|
7
|
-
\`)){o.push(qe(new Qe,s,R(this,O))),l=!1,n=R(this,O);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(s);let[u]=this.parseRegex(t1);o.push(qe(new pt(u),s,R(this,O))),l=!1,n=R(this,O);continue e}else{o.push(qe(new c("_SLASH_"),s,R(this,O))),l=!0,n=R(this,O);continue e}else if(this.tryConsumeNext(".")){i(s),o.push(qe(new je,s,R(this,O))),l=!0,n=R(this,O);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,O)!==R(this,Je).length)throw new Error("did not finish parsing?");if(e.length>0)throw new Error("expected stopping");return qe(o.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,e,r,n]=this.parseRegex(e1);return new G(n,Ko(r,void 0),Ko(e,void 0))}parseMoveImpl(){let e=R(this,O);if(this.tryConsumeNext("/"))return qe(new c("_SLASH_"),e,R(this,O));let r=this.parseQuantumMoveImpl(),[n,o]=this.parseAmountAndTrackEmptyAbsAmount(),l=this.parseMoveSuffix();if(l){if(n<0)throw new Error("uh-oh");if((l==="++"||l==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((l==="++"||l==="--")&&!o)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((l==="+"||l==="-")&&o)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");l.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${l==="+"?"PLUS":"PLUSPLUS"}_\`})),l.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${l==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return qe(new c(r,n),e,R(this,O))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let e=R(this,O),[,r,n]=this.parseRegex(Pa);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${e}: An amount can only start with 0 if it's exactly the digit 0.\`);return[Ko(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let e=R(this,O),[,r,n]=this.parseRegex(Pa);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${e}: An amount number can only start with 0 if it's exactly the digit 0.\`);return Ko(r,1)*(n==="'"?-1:1)}parseRegex(e){let r=e.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return $(this,O,R(this,O)+r[0].length),r}tryRegex(e){let r=e.exec(this.remaining());return r===null?null:($(this,O,R(this,O)+r[0].length),r)}remaining(){return R(this,Je).slice(R(this,O))}popNext(){let e=R(this,Je)[R(this,O)];return mi(this,O)._++,e}tryConsumeNext(e){return R(this,Je)[R(this,O)]===e?(mi(this,O)._++,!0):!1}mustConsumeNext(e){let r=this.popNext();if(r!==e)throw new Error(\`expected \\\`\${e}\\\` while parsing, encountered \${r}\`);return r}};Je=new WeakMap,O=new WeakMap});function jo(t){Ia.has(t)||(console.warn(t),Ia.add(t))}var Ia,Ui=U(()=>{Ia=new Set});var Vr,bi=U(()=>{ct();di();Vr=class{constructor(e,r=1){if(this.quantum=e,this.amount=r,!Number.isInteger(this.amount)||this.amount<Ca||this.amount>On)throw new Error(\`Unit amount absolute value must be a non-negative integer from \${Qr} to \${Qr}.\`)}suffix(){let e="",r=Math.abs(this.amount);return r!==1&&(e+=r),this.amount<0&&(e+="'"),e}isIdentical(e){return this.quantum.isIdentical(e.quantum)&&this.amount===e.amount}*experimentalExpand(e,r){let n=Math.abs(this.amount),o=ka(e,this.amount<0);for(let l=0;l<n;l++)yield*this.quantum.experimentalExpand(o,r)}}});var It,Ge,Te,qo,G,we,Hr,c,Tt=U(()=>{Mt();ct();di();yi();Ui();bi();qo=class extends No{constructor(e,r,n){super();ae(this,It,void 0);ae(this,Ge,void 0);ae(this,Te,void 0);if($(this,It,e),$(this,Ge,r??null),$(this,Te,n??null),Object.freeze(this),R(this,Ge)!==null&&(!Number.isInteger(R(this,Ge))||R(this,Ge)<1||R(this,Ge)>On))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Qr}.\`);if(R(this,Te)!==null&&(!Number.isInteger(R(this,Te))||R(this,Te)<1||R(this,Te)>On))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Qr}.\`);if(R(this,Te)!==null&&R(this,Ge)!==null&&R(this,Ge)<=R(this,Te))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Te)!==null&&R(this,Ge)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(e){return Ga(e)}modified(e){return new qo(e.family??R(this,It),e.innerLayer??R(this,Ge),e.outerLayer??R(this,Te))}isIdentical(e){let r=e;return e.is(qo)&&R(this,It)===R(r,It)&&R(this,Ge)===R(r,Ge)&&R(this,Te)===R(r,Te)}get family(){return R(this,It)}get outerLayer(){return R(this,Te)}get innerLayer(){return R(this,Ge)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let e=R(this,It);return R(this,Ge)!==null&&(e=String(R(this,Ge))+e,R(this,Te)!==null&&(e=String(R(this,Te))+"-"+e)),e}},G=qo;It=new WeakMap,Ge=new WeakMap,Te=new WeakMap;Hr=class extends Ce{constructor(...e){super();ae(this,we,void 0);if(typeof e[0]=="string")if(e[1]??null){$(this,we,new Vr(G.fromString(e[0]),e[1]));return}else return Hr.fromString(e[0]);$(this,we,new Vr(e[0],e[1]))}isIdentical(e){let r=e.as(Hr);return!!r&&R(this,we).isIdentical(R(r,we))}invert(){return Ta(this,new Hr(R(this,we).quantum,-this.amount))}*experimentalExpand(e=Q.Forwards){e===Q.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,we).quantum}modified(e){return new Hr(R(this,we).quantum.modified(e),e.amount??this.amount)}static fromString(e){return Ma(e)}get amount(){return R(this,we).amount}get type(){return jo("deprecated: type"),"blockMove"}get family(){return R(this,we).quantum.family??void 0}get outerLayer(){return R(this,we).quantum.outerLayer??void 0}get innerLayer(){return R(this,we).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,we).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let e=Math.abs(this.amount);return R(this,we).quantum.toString().slice(0,-10)+(e===1?"":e)+(this.amount<0?"--":"++")}return R(this,we).quantum.toString()+R(this,we).suffix()}},c=Hr;we=new WeakMap});var Na,Oa,$e,Vo,it,Qo=U(()=>{Gt();Mt();ct();Tt();bi();Na=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(e){let r=this.tuple(e);return r?\`(\${r.map(n=>n.amount).join(", ")})\`:null}tuple(e){this.quantumU_SQ_||(this.quantumU_SQ_=new G("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new G("D_SQ_"));let r=e.alg;if(r.experimentalNumUnits()===2){let[n,o]=r.units();if(n.as(c)?.quantum.isIdentical(this.quantumU_SQ_)&&o.as(c)?.quantum.isIdentical(this.quantumD_SQ_)){if(e.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,o]}}return null}},Oa=new Na,Vo=class extends Ce{constructor(e,r){super();ae(this,$e,void 0);let n=Zt(e);$(this,$e,new Vr(n,r))}isIdentical(e){let r=e;return e.is(Vo)&&R(this,$e).isIdentical(R(r,$e))}get alg(){return R(this,$e).quantum}get amount(){return R(this,$e).amount}get experimentalRepetitionSuffix(){return R(this,$e).suffix()}invert(){return new Vo(R(this,$e).quantum,-R(this,$e).amount)}*experimentalExpand(e=Q.Forwards,r){r??(r=1/0),r===0?yield e===Q.Forwards?this:this.invert():yield*R(this,$e).experimentalExpand(e,r-1)}static fromString(){throw new Error("unimplemented")}toString(){return Oa.format(this)??\`(\${R(this,$e).quantum.toString()})\${R(this,$e).suffix()}\`}experimentalAsSquare1Tuple(){return Oa.tuple(this)}},it=Vo;$e=new WeakMap});var Ho=U(()=>{Qo();Wn();_n();Kn();Tt();Qn();jn()});function Rt(t,e){return t instanceof e}function _a(t){return Rt(t,it)||Rt(t,pt)||Rt(t,Pe)||Rt(t,Me)||Rt(t,c)||Rt(t,Qe)||Rt(t,je)}var Si=U(()=>{Ho()});function Ka(t,e,r){if(e.is(it))return t.traverseGrouping(e,r);if(e.is(c))return t.traverseMove(e,r);if(e.is(Pe))return t.traverseCommutator(e,r);if(e.is(Me))return t.traverseConjugate(e,r);if(e.is(je))return t.traversePause(e,r);if(e.is(Qe))return t.traverseNewline(e,r);if(e.is(pt))return t.traverseLineComment(e,r);throw new Error("unknown unit")}function Wa(t){if(t.is(it)||t.is(c)||t.is(Pe)||t.is(Me)||t.is(je)||t.is(Qe)||t.is(pt))return t;throw"internal error: expected unit"}var Yr,Zr,Yo,o1,wi,xi,Qa,ja,vi=U(()=>{Qo();_n();Tt();Qn();jn();Kn();Wn();Yr=class{traverseUnit(e,r){return Ka(this,e,r)}traverseIntoUnit(e,r){return Wa(this.traverseUnit(e,r))}},Zr=class extends Yr{traverseUnit(e){return Ka(this,e,void 0)}traverseIntoUnit(e){return Wa(this.traverseUnit(e))}},wi=class extends Yr{*traverseAlg(e,r){if(r.depth===0){yield*e.units();return}let n=[],o=null,l=r?.collapseMoves??!0;function i(a,f){var B;let g=da(B=wi,Yo,o1).call(B,a,f,r);if(g===0)return!1;let L=new c(a.quantum,g);return n.push(L),o=L,!0}function s(a){l&&o?.is(c)&&a.is(c)&&o.quantum.isIdentical(a.quantum)?(n.pop(),i(o,a.amount)||(o=n.slice(-1)[0])):a.is(c)?i(a,0):(n.push(a),o=a)}let u={depth:r.depth?r.depth-1:null};for(let a of e.units())for(let f of this.traverseUnit(a,u))s(f);for(let a of n)yield a}*traverseGrouping(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new it(this.traverseAlg(e.alg,n))}*traverseMove(e,r){yield e}*traverseCommutator(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new Pe(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traverseConjugate(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new Me(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traversePause(e,r){yield e}*traverseNewline(e,r){yield e}*traverseLineComment(e,r){yield e}},xi=wi;Yo=new WeakSet,o1=function(e,r,n){let o=e.amount+r;if(n?.quantumMoveOrder){let l=n.quantumMoveOrder(e.quantum),i=Math.floor(l/2)+1-l;o=(o%l+l-i)%l+i}return o},ae(xi,Yo);Qa=new xi,ja=Qa.traverseAlg.bind(Qa)});function qa(t){if(!t)return[];if(Rt(t,k))return t.units();if(typeof t=="string")return hi(t).units();let e=t;if(typeof e[Symbol.iterator]=="function")return e;throw"Invalid unit"}function Zt(t){return Rt(t,k)?t:new k(t)}function l1(t,e){return t.is(Qe)||e.is(Qe)?"":t.is(pt)&&!e.is(Qe)?\`
|
|
8
|
-
\`:" "}var et,hr,k,Gt=U(()=>{Mt();Si();ct();yi();vi();Wn();Tt();Qn();Ui();hr=class extends Ce{constructor(e){super();ae(this,et,void 0);$(this,et,Array.from(qa(e)));for(let r of R(this,et))if(!_a(r))throw new Error("An alg can only contain units.")}isIdentical(e){let r=e;if(!e.is(hr))return!1;let n=Array.from(R(this,et)),o=Array.from(R(r,et));if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++)if(!n[l].isIdentical(o[l]))return!1;return!0}invert(){return new hr(za(Array.from(R(this,et)).map(e=>e.invert())))}*experimentalExpand(e=Q.Forwards,r){r??(r=1/0);for(let n of Di(R(this,et),e))yield*n.experimentalExpand(e,r)}expand(e){return new hr(this.experimentalExpand(Q.Forwards,e?.depth??1/0))}*experimentalLeafMoves(){for(let e of this.experimentalExpand())e.is(c)&&(yield e)}concat(e){return new hr(Array.from(R(this,et)).concat(Array.from(qa(e))))}experimentalIsEmpty(){for(let e of R(this,et))return!1;return!0}static fromString(e){return hi(e)}*units(){for(let e of R(this,et))yield e}experimentalNumUnits(){return Array.from(R(this,et)).length}get type(){return jo("deprecated: type"),"sequence"}toString(){let e="",r=null;for(let n of R(this,et))r&&(e+=l1(r,n)),e+=n.toString(),r=n;return e}simplify(e){return new hr(ja(this,e??{}))}},k=hr;et=new WeakMap});var i1,Va=U(()=>{Gt();Ho();_n();Kn();Tt();jn();i1={Sune:new k([new c("R",1),new c("U",1),new c("R",-1),new c("U",1),new c("R",1),new c("U",-2),new c("R",-1)]),AntiSune:new k([new c("R",1),new c("U",2),new c("R",-1),new c("U",-1),new c("R",1),new c("U",-1),new c("R",-1)]),SuneCommutator:new k([new Pe(new k([new c("R",1),new c("U",1),new c("R",-2)]),new k([new Me(new k([new c("R",1)]),new k([new c("U",1)]))]))]),Niklas:new k([new c("R",1),new c("U",-1),new c("L",-1),new c("U",1),new c("R",-1),new c("U",-1),new c("L",1),new c("U",1)]),EPerm:new k([new c("x",-1),new Pe(new k([new Me(new k([new c("R",1)]),new k([new c("U",-1)]))]),new k([new c("D",1)])),new Pe(new k([new Me(new k([new c("R",1)]),new k([new c("U",1)]))]),new k([new c("D",1)])),new c("x",1)]),FURURFCompact:new k([new Me(new k([new c("F",1)]),new k([new Pe(new k([new c("U",1)]),new k([new c("R",1)]))]))]),APermCompact:new k([new Me(new k([new c("R",2)]),new k([new Pe(new k([new c("F",2)]),new k([new c("R",-1),new c("B",-1),new c("R",1)]))]))]),FURURFMoves:new k([new c("F",1),new c("U",1),new c("R",1),new c("U",-1),new c("R",-1),new c("F",-1)]),TPerm:new k([new c("R",1),new c("U",1),new c("R",-1),new c("U",-1),new c("R",-1),new c("F",1),new c("R",2),new c("U",-1),new c("R",-1),new c("U",-1),new c("R",1),new c("U",1),new c("R",-1),new c("F",-1)]),HeadlightSwaps:new k([new Me(new k([new c("F",1)]),new k([new it(new k([new Pe(new k([new c("R",1)]),new k([new c("U",1)]))]),3)]))]),TriplePause:new k([new je,new je,new je])}});var AR,Ha=U(()=>{Tt();AR={73:new c("R"),75:new c("R'"),87:new c("B"),79:new c("B'"),83:new c("D"),76:new c("D'"),68:new c("L"),69:new c("L'"),74:new c("U"),70:new c("U'"),72:new c("F"),71:new c("F'"),78:new c("x'"),67:new c("l"),82:new c("l'"),85:new c("r"),77:new c("r'"),88:new c("d"),188:new c("d'"),84:new c("x"),89:new c("x"),66:new c("x'"),186:new c("y"),59:new c("y"),65:new c("y'"),80:new c("z"),81:new c("z'"),90:new c("M'"),190:new c("M'")}});var Ya=U(()=>{});var Za=U(()=>{Gt()});var Ae=U(()=>{Gt();Fi();vi();Va();Ha();Ho();Tt();Ya();Za();Si();ct()});function qn(t,e,r){let n={};for(let o in t.orbits){let l=t.orbits[o],i=e[o],s=r[o];if(Vn(l.numOrientations,s))n[o]=i;else if(Vn(l.numOrientations,i))n[o]=s;else{let u=new Array(l.numPieces);if(l.numOrientations===1){for(let a=0;a<l.numPieces;a++)u[a]=i.permutation[s.permutation[a]];n[o]={permutation:u,orientation:i.orientation}}else{let a=new Array(l.numPieces);for(let f=0;f<l.numPieces;f++)a[f]=(i.orientation[s.permutation[f]]+s.orientation[f])%l.numOrientations,u[f]=i.permutation[s.permutation[f]];n[o]={permutation:u,orientation:a}}}}return n}function Ei(t,e,r){let n={};for(let o in t.orbits){let l=t.orbits[o],i=e[o],s=r[o];if(Vn(l.numOrientations,s))n[o]=i;else{let u=new Array(l.numPieces);if(l.numOrientations===1){for(let a=0;a<l.numPieces;a++)u[a]=i.pieces[s.permutation[a]];n[o]={pieces:u,orientation:i.orientation}}else{let a=new Array(l.numPieces);for(let f=0;f<l.numPieces;f++)a[f]=(i.orientation[s.permutation[f]]+s.orientation[f])%l.numOrientations,u[f]=i.pieces[s.permutation[f]];n[o]={pieces:u,orientation:a}}}}return n}var Zo=U(()=>{Hn()});function s1(t){let e=Ja.get(t);if(e)return e;let r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[l]=l,n[l]=0;let o={permutation:r,orientation:n};return Xa&&(Object.freeze(r),Object.freeze(n),Object.freeze(o)),Ja.set(t,o),o}function $a(t){let e={};for(let[r,n]of Object.entries(t.orbits))e[r]=s1(n.numPieces);return Xa&&Object.freeze(e),e}function e0(t,e){let r=e.quantum.toString(),n=t.definition.moves[r];if(n)return Jt(t,n,e.amount);let o=t.definition.moves[e.toString()];if(o)return o;let l=t.definition.moves[e.invert().toString()];if(l)return Jt(t,l,-1);throw new Error(\`Invalid move for KPuzzle (\${t.name()}): \${e}\`)}var Xa,Ja,ki=U(()=>{Hn();Xa=!1,Ja=new Map});var Be,Xo=U(()=>{Zo();Jo();Be=class{constructor(e,r){this.kpuzzle=e;this.stateData=r}static fromTransformation(e){let r=Ei(e.kpuzzle.definition,e.kpuzzle.definition.startStateData,e.transformationData);return new Be(e.kpuzzle,r)}apply(e){return this.applyTransformation(this.kpuzzle.toTransformation(e))}applyTransformation(e){if(e.isIdentityTransformation())return new Be(this.kpuzzle,this.stateData);let r=Ei(this.kpuzzle.definition,this.stateData,e.transformationData);return new Be(this.kpuzzle,r)}applyMove(e){return this.applyTransformation(this.kpuzzle.moveToTransformation(e))}applyAlg(e){return this.applyTransformation(this.kpuzzle.algToTransformation(e))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let e={};for(let[r,n]of Object.entries(this.stateData)){let o={permutation:n.pieces,orientation:n.orientation};e[r]=o}return new wt(this.kpuzzle,e)}}});var yr,$t,wt,Jo=U(()=>{Hn();Zo();ki();Xo();$t=class{constructor(e,r){this.kpuzzle=e;this.transformationData=r;ae(this,yr,void 0)}invert(){return new $t(this.kpuzzle,zi(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,yr)??$(this,yr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(e){let r=new $t(e,$a(e.definition));return $(r,yr,!0),r}isIdentical(e){return t0(this.kpuzzle,this.transformationData,e.transformationData)}apply(e){return this.applyTransformation(this.kpuzzle.toTransformation(e))}applyTransformation(e){if(this.kpuzzle!==e.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${e.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,yr)?new $t(this.kpuzzle,e.transformationData):R(e,yr)?new $t(this.kpuzzle,this.transformationData):new $t(this.kpuzzle,qn(this.kpuzzle.definition,this.transformationData,e.transformationData))}applyMove(e){return this.applyTransformation(this.kpuzzle.moveToTransformation(e))}applyAlg(e){return this.applyTransformation(this.kpuzzle.algToTransformation(e))}toKState(){return Be.fromTransformation(this)}repetitionOrder(){return r0(this.kpuzzle.definition,this)}selfMultiply(e){return new $t(this.kpuzzle,Jt(this.kpuzzle,this.transformationData,e))}},wt=$t;yr=new WeakMap});function Vn(t,e){let{permutation:r}=e,n=r.length;for(let o=0;o<n;o++)if(r[o]!==o)return!1;if(t>1){let{orientation:o}=e;for(let l=0;l<n;l++)if(o[l]!==0)return!1}return!0}function a1(t,e,r,n={}){for(let o=0;o<t.numPieces;o++)if(!n?.ignoreOrientation&&e.orientation[o]!==r.orientation[o]||!n?.ignorePermutation&&e.permutation[o]!==r.permutation[o])return!1;return!0}function t0(t,e,r){for(let[n,o]of Object.entries(t.definition.orbits))if(!a1(o,e[n],r[n]))return!1;return!0}function zi(t,e){let r={};for(let n in t.definition.orbits){let o=t.definition.orbits[n],l=e[n];if(Vn(o.numOrientations,l))r[n]=l;else if(o.numOrientations===1){let i=new Array(o.numPieces);for(let s=0;s<o.numPieces;s++)i[l.permutation[s]]=s;r[n]={permutation:i,orientation:l.orientation}}else{let i=new Array(o.numPieces),s=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++){let a=l.permutation[u];i[a]=u,s[a]=(o.numOrientations-l.orientation[u]+o.numOrientations)%o.numOrientations}r[n]={permutation:i,orientation:s}}}return r}function Jt(t,e,r){if(r===1)return e;if(r<0)return Jt(t,zi(t,e),-r);if(r===0){let{transformationData:l}=t.identityTransformation();return l}let n=e;r!==2&&(n=Jt(t,e,Math.floor(r/2)));let o=qn(t.definition,n,n);return r%2==0?o:qn(t.definition,e,o)}function Ci(t,e){return e?Ci(e,t%e):t}function r0(t,e){let r=1;for(let n in t.orbits){let o=t.orbits[n],l=e.transformationData[n],i=new Array(o.numPieces);for(let s=0;s<o.numPieces;s++)if(!i[s]){let u=s,a=0,f=0;for(;i[u]=!0,a=a+l.orientation[u],f=f+1,u=l.permutation[u],u!==s;);a!==0&&(f=f*o.numOrientations/Ci(o.numOrientations,a)),r=r*f/Ci(r,f)}}return r}var n0,o0,l0,Hn=U(()=>{Ae();Zo();Jo();n0=class extends Yr{traverseAlg(e,r){let n=r.identityTransformation();for(let o of e.units())n=n.applyTransformation(this.traverseUnit(o,r));return n}traverseGrouping(e,r){let n=this.traverseAlg(e.alg,r);return new wt(r,Jt(r,n.transformationData,e.amount))}traverseMove(e,r){return r.moveToTransformation(e)}traverseCommutator(e,r){let n=this.traverseAlg(e.A,r),o=this.traverseAlg(e.B,r);return n.applyTransformation(o).applyTransformation(n.invert()).applyTransformation(o.invert())}traverseConjugate(e,r){let n=this.traverseAlg(e.A,r),o=this.traverseAlg(e.B,r);return n.applyTransformation(o).applyTransformation(n.invert())}traversePause(e,r){return r.identityTransformation()}traverseNewline(e,r){return r.identityTransformation()}traverseLineComment(e,r){return r.identityTransformation()}},o0=new n0,l0=o0.traverseAlg.bind(o0)});var Xr,$o,Ie,Pi=U(()=>{Ae();Hn();ki();Xo();Jo();Ie=class{constructor(e,r){this.definition=e;ae(this,Xr,new Map);ae(this,$o,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return wt.experimentalConstructIdentity(this)}moveToTransformation(e){typeof e=="string"&&(e=new c(e));let r=e.toString(),n=R(this,Xr).get(r);if(n)return new wt(this,n);if(this.experimentalPGNotation){let l=this.experimentalPGNotation.lookupMove(e);if(!l)throw new Error(\`could not map to internal move: \${e}\`);return R(this,Xr).set(r,l),new wt(this,l)}let o=e0(this,e);return R(this,Xr).set(r,o),new wt(this,o)}algToTransformation(e){return typeof e=="string"&&(e=new k(e)),l0(e,this)}toTransformation(e){return typeof e=="string"?this.algToTransformation(e):e?.is?.(k)?this.algToTransformation(e):e?.is?.(c)?this.moveToTransformation(e):e}startState(){return new Be(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,$o)??$(this,$o,(()=>{for(let[e,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let o of this.definition.startStateData[e].pieces)n[o]=!0;for(let o of n)if(!o)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(e){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(e){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};Xr=new WeakMap,$o=new WeakMap});var i0=U(()=>{});var pe,s0=U(()=>{pe={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]}}}};pe.moves.Uw=pe.moves.u;pe.moves.Lw=pe.moves.l;pe.moves.Fw=pe.moves.f;pe.moves.Rw=pe.moves.r;pe.moves.Bw=pe.moves.b;pe.moves.Dw=pe.moves.d;pe.moves.Rv=pe.moves.x;pe.moves.Uv=pe.moves.y;pe.moves.Fv=pe.moves.z;pe.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]}};pe.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]}};pe.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 Mi,Ve=U(()=>{Pi();i0();Xo();Pi();s0();Mi=new Ie(pe)});var a0=U(()=>{Ve()});function D1(t){switch(t){case S.Regular:return u1;case S.Dim:return c1;case S.Ignored:return f1;case S.OrientationStickers:return g1;case S.Invisible:return L1;case S.IgnoreNonPrimary:return B1;case S.PermuteNonPrimary:return m1;case S.Ignoriented:return p1;case S.OrientationWithoutPermutation:return R1}}var S,Jr,vt,Ne,$r,el,Ur,u1,f1,g1,L1,B1,m1,c1,p1,R1,Yn,Zn,Xn=U(()=>{(function(a){a.Regular="Regular",a.Dim="Dim",a.Ignored="Ignored",a.OrientationStickers="OrientationStickers",a.Invisible="Invisible",a.Ignoriented="Ignoriented",a.IgnoreNonPrimary="IgnoreNonPrimary",a.PermuteNonPrimary="PermuteNonPrimary",a.OrientationWithoutPermutation="OrientationWithoutPermutation"})(S||(S={}));Jr=class{constructor(e,r){this.stickerings=new Map;for(let[n,o]of Object.entries(e.definition.orbits))this.stickerings.set(n,new Array(o.numPieces).fill(r))}},vt="regular",Ne="ignored",$r="oriented",el="invisible",Ur="dim",u1={facelets:[vt,vt,vt,vt,vt]},f1={facelets:[Ne,Ne,Ne,Ne,Ne]},g1={facelets:[$r,$r,$r,$r,$r]},L1={facelets:[el,el,el,el]},B1={facelets:[vt,Ne,Ne,Ne,Ne]},m1={facelets:[Ur,vt,vt,vt,vt]},c1={facelets:[Ur,Ur,Ur,Ur,Ur]},p1={facelets:[Ur,Ne,Ne,Ne,Ne]},R1={facelets:[$r,Ne,Ne,Ne,Ne]};Yn=class extends Jr{constructor(e){super(e,S.Regular)}set(e,r){for(let[n,o]of this.stickerings.entries())for(let l=0;l<o.length;l++)e.stickerings.get(n)[l]&&(o[l]=r);return this}toAppearance(){let e={orbits:{}};for(let[r,n]of this.stickerings.entries()){let o=[],l={pieces:o};e.orbits[r]=l;for(let i of n)o.push(D1(i))}return e}},Zn=class{constructor(e){this.kpuzzle=e}and(e){let r=new Jr(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let l=0;l<o.numPieces;l++){r.stickerings.get(n)[l]=!0;for(let i of e)if(!i.stickerings.get(n)[l]){r.stickerings.get(n)[l]=!1;continue e}}}return r}or(e){let r=new Jr(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let l=0;l<o.numPieces;l++){r.stickerings.get(n)[l]=!1;for(let i of e)if(i.stickerings.get(n)[l]){r.stickerings.get(n)[l]=!0;continue e}}}return r}not(e){let r=new Jr(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits))for(let l=0;l<o.numPieces;l++)r.stickerings.get(n)[l]=!e.stickerings.get(n)[l];return r}all(){return this.and(this.moves([]))}move(e){let r=this.kpuzzle.moveToTransformation(e),n=new Jr(this.kpuzzle,!1);for(let[o,l]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<l.numPieces;i++)(r.transformationData[o].permutation[i]!==i||r.transformationData[o].orientation[i]!==0)&&(n.stickerings.get(o)[i]=!0);return n}moves(e){return e.map(r=>this.move(r))}}});function d1(t){(async()=>{u0=t;let e=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${e.length} players!\`);let r=[];for(let n of e)r.push((async()=>{let o=await n.experimentalModel.stickeringProp.get();n.experimentalStickering=o==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function f0(t,e){u0(t,e)}var u0,g0=U(()=>{Xn();u0=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=d1,window.PieceStickering=S,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 Dt(t,e){let r=await t.kpuzzle(),n=new Yn(r),o=new Zn(r),l=()=>o.move("U"),i=()=>o.or(o.moves(["U","D"])),s=()=>o.not(i()),u=()=>o.or(o.moves(["L","R"])),a=()=>o.not(u()),f=()=>o.or(o.moves(["F","B"])),g=()=>o.not(f()),L=()=>o.not(l()),B=()=>o.and([l(),a(),g()]),p=()=>o.and([o.and(o.moves(["F","R"])),o.not(i())]),m=()=>o.and(o.moves(["D","R","F"])),F=()=>o.or([m(),p()]),A=()=>o.or([o.and([a(),s()]),o.and([a(),g()]),o.and([s(),g()])]),b=()=>o.or([o.and([a(),i(),f()]),o.and([s(),u(),f()]),o.and([g(),i(),u()])]),h=()=>o.not(o.or([A(),b()])),C=()=>o.or([a(),o.and([l(),b()])]);function E(){n.set(L(),S.Dim)}function j(){n.set(l(),S.PermuteNonPrimary),n.set(B(),S.Dim)}function te(){n.set(l(),S.IgnoreNonPrimary),n.set(B(),S.Regular)}function I(){n.set(l(),S.Ignoriented),n.set(B(),S.Dim)}switch(e){case"full":break;case"PLL":E(),j();break;case"CLS":E(),n.set(o.and(o.moves(["D","R","F"])),S.Regular),n.set(l(),S.Ignoriented),n.set(o.and([l(),h()]),S.IgnoreNonPrimary);break;case"OLL":E(),te();break;case"COLL":E(),j(),n.set(o.and([l(),h()]),S.Regular);break;case"OCLL":E(),I(),n.set(o.and([l(),h()]),S.IgnoreNonPrimary);break;case"CLL":E(),n.set(o.not(o.and([h(),l()])),S.Dim);break;case"ELL":E(),n.set(l(),S.Dim),n.set(o.and([l(),b()]),S.Regular);break;case"ELS":E(),te(),n.set(o.and([l(),h()]),S.Ignored),n.set(p(),S.Regular),n.set(m(),S.Ignored);break;case"LL":E();break;case"F2L":n.set(l(),S.Ignored);break;case"ZBLL":E(),n.set(l(),S.PermuteNonPrimary),n.set(B(),S.Dim),n.set(o.and([l(),h()]),S.Regular);break;case"ZBLS":E(),n.set(F(),S.Regular),te(),n.set(o.and([l(),h()]),S.Ignored);break;case"WVLS":case"VLS":E(),n.set(F(),S.Regular),te();break;case"LS":E(),n.set(F(),S.Regular),n.set(l(),S.Ignored),n.set(B(),S.Dim);break;case"EO":n.set(h(),S.Ignored),n.set(b(),S.OrientationWithoutPermutation);break;case"EOline":n.set(h(),S.Ignored),n.set(b(),S.OrientationWithoutPermutation),n.set(o.and(o.moves(["D","M"])),S.Regular);break;case"EOcross":n.set(b(),S.OrientationWithoutPermutation),n.set(o.move("D"),S.Regular),n.set(h(),S.Ignored);break;case"CMLL":n.set(L(),S.Dim),n.set(C(),S.Ignored),n.set(o.and([l(),h()]),S.Regular);break;case"L6E":n.set(o.not(C()),S.Dim);break;case"L6EO":n.set(o.not(C()),S.Dim),n.set(C(),S.OrientationWithoutPermutation),n.set(o.and([A(),i()]),S.OrientationStickers);break;case"Daisy":n.set(o.all(),S.Ignored),n.set(A(),S.Dim),n.set(o.and([o.move("D"),A()]),S.Regular),n.set(o.and([o.move("U"),b()]),S.IgnoreNonPrimary);break;case"Cross":n.set(o.all(),S.Ignored),n.set(A(),S.Dim),n.set(o.and([o.move("D"),A()]),S.Regular),n.set(o.and([o.move("D"),b()]),S.Regular);break;case"2x2x2":n.set(o.or(o.moves(["U","F","R"])),S.Ignored),n.set(o.and([o.or(o.moves(["U","F","R"])),A()]),S.Dim);break;case"2x2x3":n.set(o.all(),S.Dim),n.set(o.or(o.moves(["U","F","R"])),S.Ignored),n.set(o.and([o.or(o.moves(["U","F","R"])),A()]),S.Dim),n.set(o.and([o.move("F"),o.not(o.or(o.moves(["U","R"])))]),S.Regular);break;case"Void Cube":n.set(A(),S.Invisible);break;case"picture":case"invisible":n.set(o.all(),S.Invisible);break;case"centers-only":n.set(o.not(A()),S.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":f0(n,o);break;default:console.warn(\`Unsupported stickering for \${t.id}: \${e}. Setting all pieces to dim.\`),n.set(o.and(o.moves([])),S.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","experimental-global-custom-1","experimental-global-custom-2"]}var tn=U(()=>{Xn();g0()});function er(t){let e=null;return()=>e??(e=t())}var Jn=U(()=>{});var $n,L0=U(()=>{$n=class{constructor(e,r){this.facenames=e;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<e.length;n++)for(let o=0;this.prefixFree&&o<e.length;o++)n!==o&&e[n].startsWith(e[o])&&(this.prefixFree=!1)}setGripNames(e){this.gripnames=e}splitByFaceNames(e){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let o=-1;for(let l=0;l<this.facenames.length;l++)e.substr(n).startsWith(this.facenames[l])&&(o<0||this.facenames[l].length>this.facenames[o].length)&&(o=l);if(o>=0)r.push(o),n+=this.facenames[o].length;else throw new Error("Could not split "+e+" into face names.")}return r}joinByFaceIndices(e){let r="",n=[];for(let o=0;o<e.length;o++)n.push(r),n.push(this.facenames[e[o]]),this.prefixFree||(r="_");return n.join("")}spinmatch(e,r){if(e===r)return!0;try{let n=this.splitByFaceNames(e),o=this.splitByFaceNames(r);if(n.length!==o.length&&n.length<3)return!1;for(let l=0;l<n.length;l++){for(let s=0;s<l;s++)if(n[l]===n[s])return!1;let i=!1;for(let s=0;s<o.length;s++)if(n[l]===o[s]){i=!0;break}if(!i)return!1}return!0}catch(n){return!1}}unswizzle(e){(e.endsWith("v")||e.endsWith("w"))&&e[0]<="Z"&&(e=e.slice(0,e.length-1));let r=e.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let o=this.gripnames[n];if(this.spinmatch(r,o))return o}return e}}});var rn,B0=U(()=>{rn=class{notationToInternal(e){return e}notationToExternal(e){return e}}});var tl,m0=U(()=>{Ae();tl=class{constructor(e,r){this.child=e;this.sw=r}notationToInternal(e){return e.family==="T"&&e.innerLayer===void 0&&e.outerLayer===void 0?new c(new G("FLRv",e.innerLayer,e.outerLayer),e.amount):this.child.notationToInternal(e)}notationToExternal(e){let r=e.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new c(new G("T",e.innerLayer,e.outerLayer),e.amount):this.child.notationToExternal(e)}}});var eo,c0=U(()=>{Ae();eo=class{constructor(e,r){this.internalNames=e;this.externalNames=r}convertString(e,r,n){let o="";(e.endsWith("v")||e.endsWith("v"))&&e<="_"&&(o=e.slice(e.length-1),e=e.slice(0,e.length-1));let l=e.toUpperCase(),i=!1;return e!==l&&(i=!0,e=l),e=n.joinByFaceIndices(r.splitByFaceNames(e)),i&&(e=e.toLowerCase()),e+o}convert(e,r,n){let o=e.family,l=this.convertString(o,r,n);return o===l?e:new c(new G(l,e.innerLayer,e.outerLayer),e.amount)}notationToInternal(e){return this.convert(e,this.externalNames,this.internalNames)}notationToExternal(e){return this.convert(e,this.internalNames,this.externalNames)}}});var rl,p0=U(()=>{Ae();rl=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer===void 0&&e.outerLayer===void 0){if(Math.abs(e.amount)===1){if(e.family==="R++")return new c(new G("L",3,2),-2*e.amount);if(e.family==="R--")return new c(new G("L",3,2),2*e.amount);if(e.family==="D++")return new c(new G("U",3,2),-2*e.amount);if(e.family==="D--")return new c(new G("U",3,2),2*e.amount);if(e.family==="R_PLUSPLUS_")return new c(new G("L",3,2),-2*e.amount);if(e.family==="D_PLUSPLUS_")return new c(new G("U",3,2),-2*e.amount)}if(e.family==="y")return new c("Uv",e.amount)}return this.child.notationToInternal(e)}notationToExternal(e){return e.family==="Uv"?new c(new G("y",e.innerLayer,e.outerLayer),e.amount):e.family==="Dv"?new c("y",-e.amount):this.child.notationToExternal(e)}}});var nl,R0=U(()=>{Ae();nl=class{constructor(e){this.slices=e}notationToInternal(e){let r=e.family;return!e.innerLayer&&!e.outerLayer&&(r==="x"?e=new c("Rv",e.amount):r==="y"?e=new c("Uv",e.amount):r==="z"&&(e=new c("Fv",e.amount)),(this.slices&1)==1&&(r==="E"?e=new c(new G("D",(this.slices+1)/2),e.amount):r==="M"?e=new c(new G("L",(this.slices+1)/2),e.amount):r==="S"&&(e=new c(new G("F",(this.slices+1)/2),e.amount))),this.slices>2&&(r==="e"?e=new c(new G("D",this.slices-1,2),e.amount):r==="m"?e=new c(new G("L",this.slices-1,2),e.amount):r==="s"&&(e=new c(new G("F",this.slices-1,2),e.amount)))),e}notationToExternal(e){let r=e.family;if(!e.innerLayer&&!e.outerLayer){if(r==="Rv")return new c("x",e.amount);if(r==="Uv")return new c("y",e.amount);if(r==="Fv")return new c("z",e.amount);if(r==="Lv")return new c("x",-e.amount);if(r==="Dv")return new c("y",-e.amount);if(r==="Bv")return new c("z",-e.amount)}return e}}});var F1,A1,D0,d0,F0,to,ol,A0=U(()=>{Ae();F1={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"},A1={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"},D0={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},d0=new G("y"),F0=new G("Dv"),to=class{constructor(e){this.child=e;this.wcaHack=!1;this.map=F1}notationToInternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){let n=D0[e.family];if(n)return new c(new G(n,e.innerLayer,e.outerLayer),e.amount)}let r=this.map[e.family];return r?new c(new G(r,e.innerLayer,e.outerLayer),e.amount):d0.isIdentical(e.quantum)?new c(F0,-e.amount):null}notationToExternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){for(let[r,n]of Object.entries(D0))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount);return F0.isIdentical(e.quantum)?new c(d0,-e.amount):null}},ol=class extends to{constructor(e){super(e);this.map=A1}}});var h0,y0,U0,b0,S0,x0,w0,ll,v0=U(()=>{Ae();h0={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"},y0=new G("x"),U0=new G("Rv"),b0=new G("y"),S0=new G("Uv"),x0=new G("z"),w0=new G("Fv"),ll=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer||e.outerLayer)return null;let r=h0[e.family];return r?new c(new G(r,e.outerLayer,e.innerLayer),e.amount):y0.isIdentical(e.quantum)?new c(U0,e.amount):b0.isIdentical(e.quantum)?new c(S0,e.amount):x0.isIdentical(e.quantum)?new c(w0,e.amount):null}notationToExternal(e){for(let[r,n]of Object.entries(h0))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount);return U0.isIdentical(e.quantum)?new c(y0,e.amount):S0.isIdentical(e.quantum)?new c(b0,e.amount):w0.isIdentical(e.quantum)?new c(x0,e.amount):null}}});var Gi=U(()=>{B0();m0();c0();p0();R0();A0();v0()});function E0(t){let e=0,r={};for(;e<t.length&&t[e][0]==="-";){let o=t[e++];if(o==="--rotations")r.addRotations=!0;else if(o==="--allmoves")r.allMoves=!0;else if(o==="--outerblockmoves")r.outerBlockMoves=!0;else if(o==="--vertexmoves")r.vertexMoves=!0;else if(o==="--nocorners")r.includeCornerOrbits=!1;else if(o==="--noedges")r.includeEdgeOrbits=!1;else if(o==="--noorientation")r.fixedOrientation=!0;else if(o==="--nocenters")r.includeCenterOrbits=!1;else if(o==="--omit")r.excludeOrbits=t[e].split(","),e++;else if(o==="--moves")r.moveList=t[e].split(","),e++;else if(o==="--optimize")r.optimizeOrbits=!0;else if(o==="--scramble")r.scrambleAmount=100;else if(o==="--fixcorner")r.fixedPieceType="v";else if(o==="--fixedge")r.fixedPieceType="e";else if(o==="--fixcenter")r.fixedPieceType="f";else if(o==="--orientcenters")r.orientCenters=!0;else if(o==="--puzzleorientation")r.puzzleOrientation=JSON.parse(t[e]),e++;else throw new Error("Bad option: "+o)}return{puzzleDescription:ro(t.slice(e).join(" ")),options:r}}var Ti,Ii=U(()=>{il();Ti=class{constructor(e={}){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,e)}}});function tr(t){if(!Ni[t]){let e=Array(t);for(let r=0;r<t;r++)e[r]=0;Ni[t]=e}return Ni[t]}function Et(t){if(!Oi[t]){let e=Array(t);for(let r=0;r<t;r++)e[r]=r;Oi[t]=e}return Oi[t]}function k0(t){return new ft(Et(t))}function z0(t){let e=1;for(;t>1;)e*=t,t--;return e}function h1(t,e){if(t>e){let r=t;t=e,e=r}for(;t>0;){let r=e%t;e=t,t=r}return e}function _i(t,e){return t/h1(t,e)*e}var Ni,Oi,ft,sl=U(()=>{Ni=[],Oi=[];ft=class{constructor(e){this.n=e.length,this.p=e}toString(){return"Perm["+this.p.join(" ")+"]"}mul(e){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=e.p[this.p[n]];return new ft(r)}rmul(e){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[e.p[n]];return new ft(r)}inv(){let e=Array(this.n);for(let r=0;r<this.n;r++)e[this.p[r]]=r;return new ft(e)}compareTo(e){for(let r=0;r<this.n;r++)if(this.p[r]!==e.p[r])return this.p[r]-e.p[r];return 0}toGap(){let e=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 o=new Array;for(let l=n;!r[l];l=this.p[l])o.push(1+l),r[l]=!0;e.push("("+o.join(",")+")")}return e.join("")}order(){let e=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let o=0;for(let l=n;!r[l];l=this.p[l])o++,r[l]=!0;e=_i(e,o)}return e}}});function Ki(t,e){let r=c.fromString(e),n=t.notationToExternal(r);return n===null||r===n?e:n.toString()}function C0(t,e){let r=t.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],o=[];for(let i=0;i<r;i++){let s=t.moveops[i];n.push(s.order());let u=0;for(let a=0;a<r;a++){if(a===i)continue;let f=t.moveops[a];s.mul(f).equal(f.mul(s))&&(u|=1<<a)}o.push(u)}let l={};l[0]=1;for(let i=0;i<100;i++){let s=0,u={},a=0;for(let f in l){let g=+f,L=l[g];s+=L,a++;for(let B=0;B<n.length;B++)if((g>>B&1)==0&&(g&o[B]&(1<<B)-1)==0){let p=g&o[B]|1<<B;u[p]===void 0&&(u[p]=0),u[p]+=(n[B]-1)*L}}e(\`\${i}: canonseq \${s} states \${a}\`),l=u}}var no,y1,nn,dt,Nt,Wi,rr,on,Qi,P0=U(()=>{Ae();Gi();sl();no=class{constructor(e,r){this.size=e;this.mod=r}reassemblySize(){return z0(this.size)*Math.pow(this.mod,this.size)}},y1=0;nn=class{constructor(e,r,n,o,l){this.orbitnames=e;this.orbitdefs=r;this.solved=n;this.movenames=o;this.moveops=l}transformToKTransformationData(e){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=e.orbits[n].toKPuzzle();return r}static transformToKTransformationData(e,r){let n={};for(let o=0;o<e.length;o++)n[e[o]]=r.orbits[o].toKPuzzle();return n}toKsolve(e,r=new rn){let n=[];n.push("Name "+e),n.push("");for(let o=0;o<this.orbitnames.length;o++)n.push(\`Set \${this.orbitnames[o]} \${this.orbitdefs[o].size} \${this.orbitdefs[o].mod}\`);n.push(""),n.push("Solved");for(let o=0;o<this.orbitnames.length;o++)this.solved.orbits[o].appendDefinition(n,this.orbitnames[o],!1,!1);n.push("End");for(let o=0;o<this.movenames.length;o++){n.push("");let l=Ki(r,this.movenames[o]),i=!1;l[l.length-1]==="'"&&(i=!0,l=l.substring(0,l.length-1)),n.push("Move "+l);for(let s=0;s<this.orbitnames.length;s++)i?this.moveops[o].orbits[s].inv().appendDefinition(n,this.orbitnames[s],!0):this.moveops[o].orbits[s].appendDefinition(n,this.orbitnames[s],!0);n.push("End")}return n}toKPuzzleDefinition(e){let r={},n={};for(let l=0;l<this.orbitnames.length;l++){r[this.orbitnames[l]]={numPieces:this.orbitdefs[l].size,numOrientations:this.orbitdefs[l].mod};let i=this.solved.orbits[l].toKPuzzle();n[this.orbitnames[l]]={pieces:i.permutation,orientation:i.orientation}}let o={};if(e)for(let l=0;l<this.movenames.length;l++)o[this.movenames[l]]=this.transformToKTransformationData(this.moveops[l]);return{name:\`PG3D #\${++y1}\`,orbits:r,startStateData:n,moves:o}}optimize(){let e=[],r=[],n=[],o=[];for(let l=0;l<this.moveops.length;l++)o.push([]);for(let l=0;l<this.orbitdefs.length;l++){let i=this.orbitdefs[l].mod,s=this.orbitdefs[l].size,u=new Qi(s),a=new Array(this.orbitdefs[l].size);for(let B=0;B<s;B++)a[B]=!1;for(let B=0;B<this.moveops.length;B++)for(let p=0;p<s;p++)(this.moveops[B].orbits[l].perm[p]!==p||this.moveops[B].orbits[l].ori[p]!==0)&&(a[p]=!0,u.union(p,this.moveops[B].orbits[l].perm[p]));let f=!0;if(i>1){f=!1;let B=new Qi(this.orbitdefs[l].size*i);for(let p=0;p<this.moveops.length;p++)for(let m=0;m<s;m++)if(this.moveops[p].orbits[l].perm[m]!==m||this.moveops[p].orbits[l].ori[m]!==0)for(let F=0;F<i;F++)B.union(m*i+F,this.moveops[p].orbits[l].perm[m]*i+(F+this.moveops[p].orbits[l].ori[m])%i);for(let p=0;!f&&p<s;p++)for(let m=1;m<i;m++)B.find(p*i)===B.find(p*i+m)&&(f=!0);for(let p=0;!f&&p<s;p++)for(let m=0;m<p;m++)this.solved.orbits[l].perm[p]===this.solved.orbits[l].perm[m]&&(f=!0)}let g=-1,L=!1;for(let B=0;B<this.orbitdefs[l].size;B++)if(a[B]){let p=u.find(B);g<0?g=p:g!==p&&(L=!0)}for(let B=0;B<this.orbitdefs[l].size;B++){if(!a[B]||u.find(B)!==B)continue;let m=[],F=[],A=0;for(let b=0;b<this.orbitdefs[l].size;b++)u.find(b)===B&&(m[A]=b,F[b]=A,A++);if(L?e.push(\`\${this.orbitnames[l]}_p\${B}\`):e.push(this.orbitnames[l]),f){r.push(new no(A,this.orbitdefs[l].mod)),n.push(this.solved.orbits[l].remapVS(m,A));for(let b=0;b<this.moveops.length;b++)o[b].push(this.moveops[b].orbits[l].remap(m,F,A))}else{r.push(new no(A,1)),n.push(this.solved.orbits[l].remapVS(m,A).killOri());for(let b=0;b<this.moveops.length;b++)o[b].push(this.moveops[b].orbits[l].remap(m,F,A).killOri())}}}return new nn(e,r,new on(n),this.movenames,o.map(l=>new rr(l)))}scramble(e){let r=[];for(let o=0;o<this.moveops.length;o++)r[o]=this.moveops[o];for(let o=0;o<r.length;o++){let l=Math.floor(Math.random()*r.length),i=r[o];r[o]=r[l],r[l]=i}e<r.length&&(e=r.length);for(let o=0;o<e;o++){let l=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),s=Math.floor(Math.random()*this.moveops.length);r[l]=r[l].mul(r[i]).mul(this.moveops[s]),Math.random()<.1&&(r[l]=r[l].mul(this.moveops[s]))}let n=r[0];for(let o=1;o<r.length;o++)n=n.mul(r[o]);this.solved=this.solved.mul(n)}reassemblySize(){let e=1;for(let r=0;r<this.orbitdefs.length;r++)e*=this.orbitdefs[r].reassemblySize();return e}},dt=class{constructor(e,r,n){this.perm=e;this.ori=r;this.orimod=n}static e(e,r){return new dt(Et(e),tr(e),r)}mul(e){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let o=0;o<r;o++)n[o]=this.perm[e.perm[o]];return new dt(n,this.ori,this.orimod)}else{let o=new Array(r);for(let l=0;l<r;l++)n[l]=this.perm[e.perm[l]],o[l]=(this.ori[e.perm[l]]+e.ori[l])%this.orimod;return new dt(n,o,this.orimod)}}inv(){let e=this.perm.length,r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[this.perm[o]]=o,n[this.perm[o]]=(this.orimod-this.ori[o])%this.orimod;return new dt(r,n,this.orimod)}equal(e){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==e.perm[n]||this.ori[n]!==e.ori[n])return!1;return!0}killOri(){let e=this.perm.length;for(let r=0;r<e;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let e=this.orimod;if(e===1)return new ft(this.perm);let r=this.perm.length,n=new Array(r*e);for(let o=0;o<r;o++)for(let l=0;l<e;l++)n[o*e+l]=e*this.perm[o]+(this.ori[o]+l)%e;return new ft(n)}identicalPieces(){let e=[],r=this.perm.length,n=[];for(let o=0;o<r;o++){let l=this.perm[o];if(e[l]===void 0){let i=[o];e[l]=!0;for(let s=o+1;s<r;s++)this.perm[s]===l&&i.push(s);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let e=this.perm.length;if(this.perm===Et(e)&&this.ori===tr(e))return!0;for(let r=0;r<e;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let e=this.perm.length;if(this.ori===tr(e))return!0;for(let r=0;r<e;r++)if(this.ori[r]!==0)return!1;return!0}remap(e,r,n){let o=new Array(n),l=new Array(n);for(let i=0;i<n;i++)o[i]=r[this.perm[e[i]]],l[i]=this.ori[e[i]];return new dt(o,l,this.orimod)}remapVS(e,r){let n=new Array(r),o=new Array(r),l=0,i=[];for(let s=0;s<r;s++){let u=this.perm[e[s]];i[u]===void 0&&(i[u]=l++),n[s]=i[u],o[s]=this.ori[e[s]]}return new dt(n,o,this.orimod)}appendDefinition(e,r,n,o=!0){if(!(o&&this.isIdentity())&&(e.push(r),e.push(this.perm.map(l=>l+1).join(" ")),!this.zeroOris()))if(n){let l=new Array(this.ori.length);for(let i=0;i<l.length;i++)l[this.perm[i]]=this.ori[i];e.push(l.join(" "))}else e.push(this.ori.join(" "))}toKPuzzle(){let e=this.perm.length;return this.isIdentity()?(dt.kcache[e]||(dt.kcache[e]={permutation:Et(e),orientation:tr(e)}),dt.kcache[e]):{permutation:this.perm,orientation:this.ori}}},Nt=dt;Nt.kcache=[];Wi=class{constructor(e){this.orbits=e}internalMul(e){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(e.orbits[n]));return r}internalInv(){let e=[];for(let r of this.orbits)e.push(r.inv());return e}equal(e){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(e.orbits[r]))return!1;return!0}killOri(){for(let e of this.orbits)e.killOri();return this}toPerm(){let e=new Array,r=0;for(let o of this.orbits){let l=o.toPerm();e.push(l),r+=l.n}let n=new Array(r);r=0;for(let o of e){for(let l=0;l<o.n;l++)n[r+l]=r+o.p[l];r+=o.n}return new ft(n)}identicalPieces(){let e=[],r=0;for(let n of this.orbits){let o=n.orimod,l=n.identicalPieces();for(let i=0;i<l.length;i++)e.push(l[i].map(s=>s*o+r));r+=o*n.perm.length}return e}order(){let e=1;for(let r of this.orbits)e=_i(e,r.order());return e}},rr=class extends Wi{constructor(e){super(e)}mul(e){return new rr(this.internalMul(e))}mulScalar(e){if(e===0)return this.e();let r=this;for(e<0&&(r=r.inv(),e=-e);(e&1)==0;)r=r.mul(r),e>>=1;if(e===1)return r;let n=r,o=this.e();for(;e>0;)e&1&&(o=o.mul(n)),e>1&&(n=n.mul(n)),e>>=1;return o}inv(){return new rr(this.internalInv())}e(){return new rr(this.orbits.map(e=>Nt.e(e.perm.length,e.orimod)))}},on=class extends Wi{constructor(e){super(e)}mul(e){return new on(this.internalMul(e))}},Qi=class{constructor(e){this.n=e;this.heads=new Array(e);for(let r=0;r<e;r++)this.heads[r]=r}find(e){let r=this.heads[e];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[e]=r),r}union(e,r){let n=this.find(e),o=this.find(r);n<o?this.heads[o]=n:n>o&&(this.heads[n]=o)}}});var al,M0=U(()=>{al={"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 ul(t){let e=new _(0,0,0,0);for(let r=0;r<t.length;r++)e=e.sum(t[r]);return e.smul(1/t.length)}function G0(t,e,r,n){let o=n[t].intersect3(n[e],n[r]);if(!o)return o;for(let l=0;l<n.length;l++)if(l!==t&&l!==e&&l!==r){let i=n[l].b*o.b+n[l].c*o.c+n[l].d*o.d;if(n[l].a>0&&i>n[l].a||n[l].a<0&&i<n[l].a)return!1}return o}var br,_,fl=U(()=>{br=1e-9;_=class{constructor(e,r,n,o){this.a=e;this.b=r;this.c=n;this.d=o}mul(e){return new _(this.a*e.a-this.b*e.b-this.c*e.c-this.d*e.d,this.a*e.b+this.b*e.a+this.c*e.d-this.d*e.c,this.a*e.c-this.b*e.d+this.c*e.a+this.d*e.b,this.a*e.d+this.b*e.c-this.c*e.b+this.d*e.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(e){return Math.hypot(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(e){return new _(0,this.c*e.d-this.d*e.c,this.d*e.b-this.b*e.d,this.b*e.c-this.c*e.b)}dot(e){return this.b*e.b+this.c*e.c+this.d*e.d}normalize(){let e=Math.sqrt(this.dot(this));return new _(this.a/e,this.b/e,this.c/e,this.d/e)}makenormal(){return new _(0,this.b,this.c,this.d).normalize()}normalizeplane(){let e=Math.hypot(this.b,this.c,this.d);return new _(this.a/e,this.b/e,this.c/e,this.d/e)}smul(e){return new _(this.a*e,this.b*e,this.c*e,this.d*e)}sum(e){return new _(this.a+e.a,this.b+e.b,this.c+e.c,this.d+e.d)}sub(e){return new _(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new _(this.a,-this.b,-this.c,-this.d)}det3x3(e,r,n,o,l,i,s,u,a){return e*(l*a-i*u)+r*(i*s-o*a)+n*(o*u-l*s)}rotateplane(e){let r=e.mul(new _(0,this.b,this.c,this.d)).mul(e.invrot());return r.a=this.a,r}orthogonal(){let e=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return e<r&&e<n?this.cross(new _(0,1,0,0)).normalize():r<e&&r<n?this.cross(new _(0,0,1,0)).normalize():this.cross(new _(0,0,0,1)).normalize()}pointrotation(e){let r=this.normalize();if(e=e.normalize(),r.sub(e).len()<br)return new _(1,0,0,0);let n=r.sum(e);n.len()<br?n=n.orthogonal():n=n.normalize();let o=r.cross(n);return o.a=r.dot(n),o}unproject(e){return this.sum(e.smul(-this.dot(e)/(this.len()*e.len())))}rotatepoint(e){return e.mul(this).mul(e.invrot())}rotateface(e){return e.map(r=>r.rotatepoint(this))}intersect3(e,r){let n=this.det3x3(this.b,this.c,this.d,e.b,e.c,e.d,r.b,r.c,r.d);return Math.abs(n)<br?!1:new _(0,this.det3x3(this.a,this.c,this.d,e.a,e.c,e.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,e.b,e.a,e.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,e.b,e.c,e.a,r.b,r.c,r.a)/n)}side(e){return e>br?1:e<-br?-1:0}cutface(e){let r=this.a,n=0,o=null;for(let l=0;l<e.length;l++)n|=1<<this.side(e[l].dot(this)-r)+1;if((n&5)==5){o=[];let l=e.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let s=[];for(let u=0;u<e.length;u++){(l[u]===i||l[u]===0)&&s.push(e[u]);let a=(u+1)%e.length;if(l[u]+l[a]===0&&l[u]!==0){let f=e[u].dot(this)-r,g=e[a].dot(this)-r,L=f/(f-g),B=e[u].smul(1-L).sum(e[a].smul(L));s.push(B)}}o.push(s)}}return o}cutfaces(e){let r=[];for(let n=0;n<e.length;n++){let o=e[n],l=this.cutface(o);l?(r.push(l[0]),r.push(l[1])):r.push(o)}return r}faceside(e){let r=this.a;for(let n=0;n<e.length;n++){let o=this.side(e[n].dot(this)-r);if(o!==0)return o}throw new Error("Could not determine side of plane in faceside")}sameplane(e){let r=this.normalize(),n=e.normalize();return r.dist(n)<br||r.dist(n.smul(-1))<br}makecut(e){return new _(e,this.b,this.c,this.d)}}});function T0(){let t=Math.sqrt(.5);return[new _(t,t,0,0),new _(t,0,t,0)]}function I0(){return[new _(.5,.5,.5,.5),new _(.5,.5,.5,-.5)]}function N0(){let t=2*Math.PI/10,e=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(e*e+r*r);return e/=n,r/=n,[new _(Math.cos(t),e*Math.sin(t),r*Math.sin(t),0),new _(.5,.5,.5,.5)]}function O0(){let t=1/6+Math.sqrt(5)/6,e=2/3+Math.sqrt(5)/3,r=Math.sqrt(t*t+e*e);t/=r,e/=r;let n=2*Math.PI/6;return[new _(Math.cos(n),t*Math.sin(n),e*Math.sin(n),0),new _(Math.cos(n),-t*Math.sin(n),e*Math.sin(n),0)]}function _0(){let t=Math.sqrt(.5);return[new _(.5,.5,.5,.5),new _(t,0,0,t)]}function K0(t){let e=[new _(1,0,0,0)];for(let r=0;r<e.length;r++)for(let n=0;n<t.length;n++){let o=t[n].mul(e[r]),l=o.smul(-1),i=!1;for(let s=0;s<e.length;s++)if(o.dist(e[s])<gl||l.dist(e[s])<gl){i=!0;break}i||e.push(o)}return e}function ji(t,e){let r=[],n=[];for(let o=0;o<e.length;o++){let l=t.rotateplane(e[o]),i=!1;for(let s=0;s<r.length;s++)if(l.dist(r[s])<gl){i=!0;break}i||(r.push(l),n.push(e[o]))}return n}function qi(t){let e=[];for(let r=1;r<t.length;r++)for(let n=r+1;n<t.length;n++){let o=G0(0,r,n,t);if(o){let l=!1;for(let i=0;i<e.length;i++)if(o.dist(e[i])<gl){l=!0;break}l||e.push(o)}}for(;;){let r=!1;for(let n=0;n<e.length;n++){let o=(n+1)%e.length;if(t[0].dot(e[n].cross(e[o]))<0){let l=e[n];e[n]=e[o],e[o]=l,r=!0}}if(!r)break}return e}var gl,W0=U(()=>{fl();gl=1e-9});function Ll(t,e){let r=t[0].p.length,n=k0(r),o=[],l=[],i=[],s=[],u=[];function a(B){for(let p=B.p.length-1;p>=0;p--){let m=B.p[p];if(m!==p){if(!o[p][m])return!1;B=B.mul(l[p][m])}}return!0}function f(B,p,m){s[B].push(p),u[B].push(m);for(let F=0;F<o[B].length;F++)o[B][F]&&g(B,o[B][F].mul(p),m+i[B][F])}function g(B,p,m){let F=p.p[B];if(!o[B][F]){o[B][F]=p,l[B][F]=p.inv(),i[B][F]=m;for(let b=0;b<s[B].length;b++)g(B,p.mul(s[B][b]),m+u[B][b]);return}let A=p.mul(l[B][F]);a(A)||f(B-1,A,m+i[B][F])}function L(){o=[],l=[],s=[],i=[],u=[];for(let m=0;m<r;m++)o.push([]),l.push([]),i.push([]),s.push([]),u.push([]),o[m][m]=n,l[m][m]=n,i[m][m]=0;let B=0,p=1;for(let m=0;m<t.length;m++){f(r-1,t[m],1),p=1;let F=0,A=0,b=[],h=new Q0;for(let C=0;C<r;C++){let E=0,j=0;for(let I=0;I<r;I++)o[C][I]&&(E++,j+=i[C][I],C!==I&&B++);F+=s[C].length,p*=E,E>1&&h.multiply(E);let te=j/E;b.push(te),A+=te}e(\`\${m}: sz \${p} T \${F} sol \${A} none \${B} mults \${h.toString()}\`)}return p}return L()}var Q0,Vi=U(()=>{sl();Q0=class{constructor(){this.mult=[]}multiply(e){for(let r=2;r*r<=e;r++)for(;e%r==0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,e/=r;e>1&&(this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1)}toString(){let e="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(e!==""&&(e+="*"),e+=r,this.mult[r]>1&&(e+=\`^\${this.mult[r]}\`));return e}}});function Hi(t){return t}function Yi(t){}function U1(t,e){let r=[];for(let n of t)for(let o of e)r.push(o.rotate(n));return r}function x1(){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 w1(){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 v1(){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 E1(){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 Bl(t,e){for(let r=0;r<t.length;r++)if(t[r][0].dist(e)<be)return r;throw new Error("Element not found")}function j0(){return al}function q0(t){return al[t]}function ro(t){let e=t.split(/ /).filter(Boolean);if(e.length%2==0)return null;let r=e[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let o=1;o<e.length;o+=2){if(e[o]!=="f"&&e[o]!=="v"&&e[o]!=="e")return null;n.push({cutType:e[o],distance:parseFloat(e[o+1])})}return{shape:r,cuts:n}}function Zi(t,e={}){let r=ro(t);if(r===null)throw new Error("Could not parse the puzzle description");let n=new cl(r,Object.assign({},{allMoves:!0},e));return n.allstickers(),n.genperms(),n}function sn(t,e){return Zi(al[t],e)}function k1(t,e,r){let n=!1;r-e[1]<e[0]&&(t=[t[2],t[3],t[0],t[1]],e=[r-e[1],r-e[0]],n=!0);let o=t[0],l="";if(e[0]===0&&e[1]===r)o=o+"v";else if(e[0]===e[1])e[1]>0&&(l=String(e[1]+1));else if(e[0]===0)o=o.toLowerCase(),e[1]>1&&(l=String(e[1]+1));else throw\`We only support slice and outer block moves right now. \${e}\`;return[l+o,n]}function z1(t,e){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let o="";for(let l of e)t.substr(n).startsWith(l[1])&&l[1].length>o.length&&(o=l[1]);if(o!=="")r.push(o),n+=o.length;else throw new Error("Could not split "+t+" into face names.")}return r}function ml(t,e){return[t.b/e,-t.c/e,t.d/e]}function Xi(t,e){let r=[],n=t.length;for(let o=0;o<n;o++){let l=ml(t.get(n-o-1),e);r[3*o]=l[0],r[3*o+1]=l[1],r[3*o+2]=l[2]}return r}var ln,oo,be,b1,S1,cl,Sr,il=U(()=>{Ae();L0();Gi();Ii();sl();P0();M0();W0();fl();Vi();ln=class{constructor(e){this.coords=new Array(e.length*3);for(let r=0;r<e.length;r++)this.coords[3*r]=e[r].b,this.coords[3*r+1]=e[r].c,this.coords[3*r+2]=e[r].d;this.length=e.length}get(e){return new _(0,this.coords[3*e],this.coords[3*e+1],this.coords[3*e+2])}centermass(){let e=0,r=0,n=0;for(let o=0;o<this.length;o++)e+=this.coords[3*o],r+=this.coords[3*o+1],n+=this.coords[3*o+2];return new _(0,e/this.length,r/this.length,n/this.length)}rotate(e){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(e));return new ln(r)}rotateforward(){let e=[];for(let r=1;r<this.length;r++)e.push(this.get(r));return e.push(this.get(0)),new ln(e)}},oo=class{constructor(e,r,n){this.face=e;this.left=r;this.right=n}split(e){let r=e.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new oo(r[0]),this.right=new oo(r[1])):(this.left=this.left?.split(e),this.right=this.right?.split(e))),this}collect(e,r){return this.left===void 0?e.push(new ln(this.face)):r?(this.left?.collect(e,!1),this.right?.collect(e,!0)):(this.right?.collect(e,!1),this.left?.collect(e,!0)),e}};be=1e-9,b1="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",S1=!1;cl=class{constructor(e,r){this.puzzleDescription=e;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new rn;this.addNotationMapper="";this.setReidOrder=!1;let n=Hi("genperms");this.options=new Ti(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(e),Yi(n)}create(e){let{shape:r,cuts:n}=e;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let o=null;switch(r){case"c":o=T0();break;case"o":o=_0();break;case"i":o=O0();break;case"t":o=I0();break;case"d":o=N0();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=K0(o),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let l=o[0];this.baseplanerot=ji(l,this.rotations);let i=this.baseplanerot.map(d=>l.rotateplane(d));this.baseplanes=i,this.baseFaceCount=i.length;let s=x1()[i.length];this.net=s,this.colors=w1()[i.length],this.faceorder=v1()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let u=qi(i),a=new _(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+u.length);let f=i[0].makenormal(),g=u[0].sum(u[1]).makenormal(),L=u[0].makenormal(),B=new _(1,f.b,f.c,f.d);this.options.verbosity>0&&console.log("# Boundary is "+B);let m=ji(B,this.rotations).map(d=>B.rotateplane(d)),F=qi(m);this.edgedistance=F[0].sum(F[1]).smul(.5).dist(a),this.vertexdistance=F[0].dist(a);let A=[],b=[],h=!1,C=!1,E=!1;for(let d of n){let v=null,N=0;switch(d.cutType){case"f":v=f,N=1,h=!0;break;case"v":v=L,N=this.vertexdistance,E=!0;break;case"e":v=g,N=this.edgedistance,C=!0;break;default:throw new Error("Bad cut argument: "+d.cutType)}A.push(v.makecut(d.distance)),b.push(d.distance<N)}this.options.addRotations&&(h||A.push(f.makecut(10)),E||A.push(L.makecut(10)),C||A.push(g.makecut(10))),this.basefaces=[];for(let d of this.baseplanerot){let v=d.rotateface(F);this.basefaces.push(new ln(v))}let j=[],te=[],I=[],re=[],y=F.length;function z(d,v,N){for(let K of d)if(K[0].dist(v)<be){K.push(N);return}d.push([v,N])}for(let d=0;d<this.baseplanerot.length;d++){let v=this.baseplanerot[d].rotateface(F);for(let N=0;N<v.length;N++){let K=(N+1)%v.length,ne=v[N].sum(v[K]).smul(.5);z(re,ne,d)}}let M=[];for(let d=0;d<this.baseplanerot.length;d++){let v=this.baseplanerot[d].rotateface(F),N=[];for(let K=0;K<v.length;K++){let ne=(K+1)%v.length,Ke=v[K].sum(v[ne]).smul(.5),lt=re[Bl(re,Ke)];if(d===lt[1])N.push(lt[2]);else if(d===lt[2])N.push(lt[1]);else throw new Error("Could not find edge")}M.push(N)}let x={},w=[];w.push(s[0][0]),x[s[0][0]]=0,w[M[0][0]]=s[0][1],x[s[0][1]]=M[0][0];for(let d of s){let v=d[0],N=x[v];if(N===void 0)throw new Error("Bad edge description; first edge not connected");let K=-1;for(let ne=0;ne<M[N].length;ne++){let Ke=w[M[N][ne]];if(Ke!==void 0&&Ke===d[1]){K=ne;break}}if(K<0)throw new Error("First element of a net not known");for(let ne=2;ne<d.length;ne++){if(d[ne]==="")continue;let Ke=M[N][(ne+K-1)%y],lt=w[Ke];if(lt!==void 0&<!==d[ne])throw new Error("Face mismatch in net");w[Ke]=d[ne],x[d[ne]]=Ke}}for(let d=0;d<w.length;d++){let v=!1;for(let N=0;N<this.faceorder.length;N++)if(w[d]===this.faceorder[N]){this.faceprecedence[d]=N,v=!0;break}if(!v)throw new Error("Could not find face "+w[d]+" in face order list "+this.faceorder)}for(let d=0;d<this.baseplanerot.length;d++){let v=this.baseplanerot[d].rotateface(F),N=B.rotateplane(this.baseplanerot[d]),K=w[d];j.push([v,K]),te.push([N,K])}for(let d=0;d<this.baseplanerot.length;d++){let v=this.baseplanerot[d].rotateface(F),N=w[d];for(let K=0;K<v.length;K++){let ne=(K+1)%v.length,Ke=v[K].sum(v[ne]).smul(.5),lt=(K+2)%v.length,vg=v[ne].sum(v[lt]).smul(.5),Eg=Bl(re,Ke),kg=Bl(re,vg);z(I,v[ne],[N,kg,Eg])}}this.swizzler=new $n(j.map(d=>d[1]));let P=this.swizzler.prefixFree?"":"_";for(let d=0;d<re.length;d++){if(re[d].length!==3)throw new Error("Bad length in edge names "+re[d]);let v=w[re[d][1]],N=w[re[d][2]];this.faceprecedence[re[d][1]]<this.faceprecedence[re[d][2]]?v=v+P+N:v=N+P+v,re[d]=[re[d][0],v]}for(let d=0;d<I.length;d++){if(I[d].length<4)throw new Error("Bad length in vertex names");let v=1;for(let K=2;K<I[d].length;K++)this.faceprecedence[x[I[d][K][0]]]<this.faceprecedence[x[I[d][v][0]]]&&(v=K);let N="";for(let K=1;K<I[d].length;K++){K===1?N=I[d][v][0]:N=N+P+I[d][v][0];for(let ne=1;ne<I[d].length;ne++)if(I[d][v][1]===I[d][ne][2]){v=ne;break}}I[d]=[I[d][0],N]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+j.map(d=>d[1]).join(" ")),console.log("# Edge names: "+re.map(d=>d[1]).join(" ")),console.log("# Vertex names: "+I.map(d=>d[1]).join(" ")));let W=[];for(let d of te)W.push([d[0].makenormal(),d[1],"f"]);for(let d of re)W.push([d[0].makenormal(),d[1],"e"]);for(let d of I)W.push([d[0].makenormal(),d[1],"v"]);this.facenames=j,this.faceplanes=te,this.edgenames=re,this.vertexnames=I,this.geonormals=W;let H=W.map(d=>d[1]);this.swizzler.setGripNames(H),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let d=0;d<A.length;d++)for(let v of this.rotations){let N=A[d].rotateplane(v),K=!1;for(let ne of this.moveplanes)if(N.sameplane(ne)){K=!0;break}K||(this.moveplanes.push(N),b[d]&&this.moveplanes2.push(N))}let ge=new oo(F),me=this.moveplanes2.slice(),Fe=31;for(let d=0;d<me.length;d++){let v=d+Math.floor((me.length-d)*(Fe/65536));ge=ge.split(me[v]),me[v]=me[d],Fe=(Fe*1657+101)%65536}let ye=ge.collect([],!0);this.faces=ye,this.options.verbosity>0&&console.log("# Faces is now "+ye.length),this.stickersperface=ye.length;let xt=[],ze=ul(F);for(let d of this.rotations){let v=d.rotateface(F);ze.dist(ul(v))<be&&xt.push(d)}let Xe=new Array(ye.length),xe=[];for(let d=0;d<ye.length;d++){let v=ye[d].centermass();xe.push([ze.dist(v),v,d])}xe.sort((d,v)=>d[0]-v[0]);for(let d=0;d<ye.length;d++){let v=xe[d][2];if(!Xe[v]){Xe[v]=!0;for(let N of xt){let K=ye[v].rotate(N),ne=K.centermass();for(let Ke=d+1;Ke<ye.length&&!(xe[Ke][0]-xe[d][0]>be);Ke++){let lt=xe[Ke][2];if(!Xe[lt]&&ne.dist(xe[Ke][1])<be){Xe[lt]=!0,ye[lt]=K;break}}}}}this.shortedge=1e99;for(let d of ye)for(let v=0;v<d.length;v++){let N=(v+1)%d.length,K=d.get(v).dist(d.get(N));K<this.shortedge&&(this.shortedge=K)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&h&&!C&&!E&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&E&&!h&&!C&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(E||h)&&!C&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&h&&(this.notationMapper=new eo(this.swizzler,new $n(["F","D","L","BL","R","U","BR","B"])),!C&&!E&&(this.addNotationMapper="FTOMapper")),r==="d"&&h&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new eo(this.swizzler,new $n(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(e){return this.keyface2(e.centermass())}keyface2(e){let r="",n=String.fromCharCode;for(let o of this.moveplanesets)if(o.length>0){let l=e.dot(o[0]),i=0,s=1;for(;s*2<=o.length;)s*=2;for(;s>0;s>>=1)i+s<=o.length&&l>o[i+s-1].a&&(i+=s);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(e){let r=e.centermass(),n=[];for(let o of this.moveplanesets)if(o.length>0){let l=r.dot(o[0]),i=0,s=1;for(;s*2<=o.length;)s*=2;for(;s>0;s>>=1)i+s<=o.length&&l>o[i+s-1].a&&(i+=s);n.push(i)}return n}findface(e){let r=this.keyface2(e),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let o=0;o+1<n.length;o++){let l=this.facelisthash.get(r)[o];if(Math.abs(e.dist(this.facecentermass[l]))<be)return l}return n[n.length-1]}project2d(e,r,n){let o=this.facenames[e][0],l=(r+1)%o.length,i=this.baseplanes[e],s=o[l].sub(o[r]),u=s.len();s=s.normalize();let a=s.cross(i).normalize(),f=n[1].sub(n[0]),g=f.len()/u;f=f.normalize();let L=f.b,B=f.c,p=s.smul(L).sub(a.smul(B)).smul(g),m=a.smul(L).sum(s.smul(B)).smul(g),F=new _(0,n[0].b-p.dot(o[r]),n[0].c-m.dot(o[r]),0);return[p,m,F]}allstickers(){let e=Hi("allstickers");this.faces=U1(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 y=0;y<this.faces.length;y++)this.facecentermass[y]=this.faces[y].centermass();let r=[],n=[];for(let y of this.moveplanes){let z=y.makenormal(),M=!1;for(let x of n)z.sameplane(x.makenormal())&&(M=!0);M||(n.push(z),r.push([]))}for(let y of this.moveplanes2){let z=y.makenormal();for(let M=0;M<n.length;M++)if(z.sameplane(n[M])){r[M].push(y);break}}for(let y=0;y<r.length;y++){let z=r[y].map(x=>x.normalizeplane()),M=n[y];for(let x=0;x<z.length;x++)z[x].makenormal().dist(M)>be&&(z[x]=z[x].smul(-1));z.sort((x,w)=>x.a-w.a),r[y]=z}this.moveplanesets=r,this.moveplanenormals=n;let o=r.map(y=>y.length);this.options.verbosity>0&&console.log("# Move plane sets: "+o);let l=[];for(let y=0;y<r.length;y++)l.push([]);for(let y of this.rotations){if(Math.abs(Math.abs(y.a)-1)<be)continue;let z=y.makenormal();for(let M=0;M<r.length;M++)if(z.sameplane(n[M])){l[M].push(y);break}}this.moverotations=l;for(let y=0;y<l.length;y++){let z=l[y],M=z[0].makenormal();for(let x=0;x<z.length;x++)M.dist(z[x].makenormal())>be&&(z[x]=z[x].smul(-1));z.sort((x,w)=>x.angle()-w.angle()),l[y][0].dot(n[y])<0&&z.reverse()}let i=l.map(y=>1+y.length);this.movesetorders=i;let s=[],u="?";for(let y=0;y<r.length;y++){let z=n[y],M=null,x=null;for(let w of this.geonormals){let P=z.dot(w[0]);Math.abs(P-1)<be?(x=[w[1],w[2]],u=w[2]):Math.abs(P+1)<be&&(M=[w[1],w[2]],u=w[2])}if(x===null||M===null)throw new Error("Saw positive or negative sides as null");s.push([x[0],x[1],M[0],M[1],1+r[y].length]),this.addNotationMapper==="NxNxNCubeMapper"&&u==="f"&&(this.notationMapper=new nl(1+r[y].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new ll(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 to(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new ol(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&u==="f"&&(1+r[y].length===3&&(this.notationMapper=new rl(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&u==="f"&&(1+r[y].length===3&&(this.notationMapper=new tl(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=s;let a=new Map,f=this.faces;for(let y=0;y<f.length;y++){let z=f[y],M=this.keyface(z);if(!a.get(M))a.set(M,[y]);else{let x=a.get(M);if(x.push(y),x.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let w=0;w<x.length;w++){let P=M+" "+w;a.set(P,[x[w]])}}}}this.facelisthash=a,this.options.verbosity>0&&console.log("# Cubies: "+a.size);let g=[],L=[],B=[];for(let y of a.values())if(y.length!==this.baseFaceCount){if(y.length>1){let z=y.map(P=>f[P].centermass()),M=ul(z);for(let P=0;y.length>2;P++){let W=!1;for(let H=0;H<y.length;H++){let ge=(H+1)%y.length;if(M.dot(z[H].cross(z[ge]))<0){let me=z[H];z[H]=z[ge],z[ge]=me;let Fe=y[H];y[H]=y[ge],y[ge]=Fe,W=!0}}if(!W)break;if(P>1e3)throw new Error("Bad epsilon math; too close to border")}let x=0,w=y[x];for(let P=1;P<y.length;P++){let W=y[P];this.faceprecedence[this.getfaceindex(W)]<this.faceprecedence[this.getfaceindex(w)]&&(x=P,w=W)}if(x!==0){let P=y.slice();for(let W=0;W<y.length;W++)y[W]=P[(x+W)%y.length]}}for(let z=0;z<y.length;z++){let M=y[z];L[M]=g.length,B[M]=z}g.push(y)}this.cubies=g,this.facetocubie=L,this.facetoord=B;let p=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],F=[0,0,0,0,0,0],A=[],b=[],h=0,C=[],E=[],j=[],te=[],I=y=>g[y].map(z=>this.getfaceindex(z)).join(" "),re=[];for(let y=0;y<g.length;y++){if(b[y])continue;let z=g[y];if(z.length===0)continue;let M={},x=0;j.push(0),re.push([]);let w=z.length,P=F[w]++,W=p[w];(W===void 0||w===this.baseFaceCount)&&(W="CORE"),W=W+(P===0?"":P+1),m[h]=W,A[h]=w;let H=[y],ge=0;for(b[y]=!0;ge<H.length;){let me=H[ge++],Fe=I(me);if((z.length>1||M[Fe]===void 0)&&(M[Fe]=x++),te[me]=M[Fe],C[me]=h,re[h].push(me),E[me]=j[h]++,H.length<this.rotations.length){let ye=this.facecentermass[g[me][0]];for(let xt of l){let ze=this.facetocubie[this.findface(ye.rotatepoint(xt[0]))];b[ze]||(H.push(ze),b[ze]=!0)}}}h++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let y=[["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 y)for(let x=0;x<M.length;x++){let w=0;for(let P=0;P<M[x].length;P++)w|=1<<M[x].charCodeAt(P)-65;z[w]=x}for(let M of re)for(let x of M){let w=0;for(let P of g[x])w|=1<<this.facenames[this.getfaceindex(P)][1].charCodeAt(0)-65;E[x]=z[w]}}if(this.cubiesetnums=C,this.cubieordnums=E,this.cubiesetnames=m,this.cubieords=j,this.orbitoris=A,this.cubievaluemap=te,this.cubiesetcubies=re,this.options.fixedPieceType!==null){for(let y=0;y<g.length;y++)if(this.options.fixedPieceType==="v"&&g[y].length>2||this.options.fixedPieceType==="e"&&g[y].length===2||this.options.fixedPieceType==="f"&&g[y].length===1){this.fixedCubie=y;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 "+j),Yi(e)}unswizzle(e){let r=this.notationMapper.notationToInternal(e);return r===null?"":this.swizzler.unswizzle(r.family)}stringToBlockMove(e){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=e.match(r);if(n===null)throw new Error("Bad move passed "+e);let o=n[4],l,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");l=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let s="1",u=1;return n[5]!==void 0&&(s=n[5],s[0]==="'"&&(s="-"+s.substring(1)),u=parseInt(s,10)),new c(new G(o,i,l),u)}parseMove(e){let r=this.notationMapper.notationToInternal(e);if(r===null)throw new Error("Bad move "+e.family);e=r;let n=e.family,o=!1;if(n.endsWith("v")&&n[0]<="Z"){if(e.innerLayer!==void 0||e.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),o=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let l,i=-1,s=this.swizzler.unswizzle(n),u=!1;for(let g=0;g<this.movesetgeos.length;g++){let L=this.movesetgeos[g];s===L[0]&&(u=!0,l=L,i=g),s===L[2]&&(u=!1,l=L,i=g)}let a=1,f=1;if(n.toUpperCase()!==n&&(f=2),l===void 0)throw new Error("Bad grip in move "+e.family);if(e.outerLayer!==void 0&&(a=e.outerLayer),e.innerLayer!==void 0&&(e.outerLayer===void 0?(f=e.innerLayer,n<="Z"?a=f:a=1):f=e.innerLayer),a--,f--,o&&(a=0,f=this.moveplanesets[i].length),a<0||a>this.moveplanesets[i].length||f<0||f>this.moveplanesets[i].length)throw new Error("Bad slice spec "+a+" "+f+" vs "+this.moveplanesets[i].length);if(!S1&&a===0&&f===this.moveplanesets[i].length&&!o)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,a,f,u,e.amount]}parsemove(e){let r=this.parseMove(this.stringToBlockMove(e));return r[0]=e,r}genperms(){let e=Hi("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 o=this.cubies[n][0],l=this.getfaceindex(o);if(this.basefaces[l].centermass().dist(this.facecentermass[o])<be){let i=this.basefaces[l].length;for(let s=1;s<i;s++)this.cubies[n].push(this.cubies[n][s-1]);this.duplicatedFaces[o]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let o=this.moveplanesets[n],l=[],i=[o.length+1,0],s=1;for(;s*2<=o.length;)s*=2;for(let f=0;f<this.faces.length;f++){let g=0;if(o.length>0){let L=this.facecentermass[f].dot(o[0]);for(let B=s;B>0;B>>=1)g+B<=o.length&&L>o[g+B-1].a&&(g+=B);g=o.length-g}for(l.push(g);i.length<=g;)i.push(0);i[g]++}let u=new Array(i.length);for(let f=0;f<i.length;f++)u[f]=[];let a=[];for(let f=0;f<this.faces.length;f++){if(l[f]<0)continue;let g=[this.facetocubie[f],this.facetoord[f]],L=this.facecentermass[f],B=L,p=f,m=l[p];for(;;){l[p]=-1;let F=L.rotatepoint(this.moverotations[n][0]);if(F.dist(B)<be)break;p=this.findface(F),g.push(this.facetocubie[p],this.facetoord[p]),L=F}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[f].dist(this.basefaces[this.getfaceindex(f)].centermass())<be){let F=this.faces[this.cubies[g[0]][0]];for(let A=0;A<g.length;A+=2){let b=this.faces[this.cubies[g[A]][0]],h=-1;for(let C=0;C<F.length;C++)if(b.get(C).dist(F.get(0))<be){h=C;break}if(h<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[A+1]=h,F=F.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let F=1;F<this.movesetorders[n];F++)m===0?g.push(g[0],F):g.push(g[0],(this.movesetorders[n]-F)%this.movesetorders[n]);if(g.length>2&&!a[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let F of g)u[m].push(F)}for(let F=0;F<g.length;F+=2)a[g[F]]=!0}for(let f=0;f<u.length;f++)u[f]=u[f].slice();r.push(u)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let o of this.options.moveList)n.push(this.parsemove(o));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],Yi(e)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(e){let r=this.moveplanesets[e].length,n=[];if(this.parsedmovelist!==void 0)for(let o of this.parsedmovelist)o[1]===e&&(o[4]?n.push([o[2],o[3]]):n.push([r-o[3],r-o[2]]),n.push(o[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let o=this.movesetgeos[e];if(o[1]!==o[3])for(let l=0;l<r;l++)o[1]!=="v"?(this.options.outerBlockMoves?n.push([l+1,r]):n.push([l+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,l]):n.push([l,l]),n.push(1))}else for(let o=0;o<=r;o++)!this.options.allMoves&&o+o===r||(this.options.outerBlockMoves?o+o>r?n.push([o,r]):n.push([0,o]):n.push([o,o]),n.push(1));if(this.fixedCubie>=0){let o=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[e],l=[];for(let i=0;i<n.length;i+=2){let s=n[i];if(o>=s[0]&&o<=s[1])if(s[0]===0)s=[s[1]+1,r];else if(r===s[1])s=[0,s[0]-1];else throw Error("fixed cubie option would disconnect move");let u=!1;for(let a=0;a<l.length;a+=2)if(l[a][0]===s[0]&&l[a][1]===s[1]&&l[a+1]===n[i+1]){u=!0;break}u||(l.push(s),l.push(n[i+1]))}n=l}return n}graybyori(e){let r=this.cubies[e].length;return this.duplicatedCubies[e]&&(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(e){let r=this.cubies[e].length;return this.duplicatedCubies[e]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(e){return this.skipbyori(e)}header(e){return e+b1+\`
|
|
4
|
+
var workerSource = `var Gg=Object.create;var Go=Object.defineProperty;var Tg=Object.getOwnPropertyDescriptor;var Ig=Object.getOwnPropertyNames;var Ng=Object.getPrototypeOf,Og=Object.prototype.hasOwnProperty;var Ra=t=>Go(t,"__esModule",{value:!0});var U=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ue=(t,e)=>{Ra(t);for(var r in e)Go(t,r,{get:e[r],enumerable:!0})},_g=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ig(e))!Og.call(t,n)&&n!=="default"&&Go(t,n,{get:()=>e[n],enumerable:!(r=Tg(e,n))||r.enumerable});return t},da=t=>_g(Ra(Go(t!=null?Gg(Ng(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var mi=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var R=(t,e,r)=>(mi(t,e,"read from private field"),r?r.call(t):e.get(t)),te=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Q=(t,e,r,n)=>(mi(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ci=(t,e,r,n)=>({set _(o){Q(t,e,o,r)},get _(){return R(t,e,n)}}),Da=(t,e,r)=>(mi(t,e,"access private method"),r);var Sa={};Ue(Sa,{default:()=>$g});function Jg(t){let e=new WeakMap;return{postMessage:t.postMessage.bind(t),addEventListener:(r,n)=>{let o=l=>{"handleEvent"in n?n.handleEvent({data:l}):n({data:l})};t.on("message",o),e.set(n,o)},removeEventListener:(r,n)=>{let o=e.get(n);!o||(t.off("message",o),e.delete(n))},start:t.start&&t.start.bind(t)}}var $g,xa=U(()=>{$g=Jg});var wa={};Ue(wa,{port:()=>e1});async function e1(){let{parentPort:t}=await import("worker_threads").catch();return(await Promise.resolve().then(()=>(xa(),Sa))).default(t)}var va=U(()=>{});var r1,Io,Ce,Gt=U(()=>{r1=!1,Io=class{is(e){return this instanceof e}as(e){return this instanceof e?this:null}},Ce=class extends Io{constructor(){super();r1&&Object.defineProperty(this,"_debugStr",{get:()=>this.toString()})}get log(){return console.log.bind(console,this,this.toString())}}});function ka(t,e=!0){if(!e)return t;switch(t){case 1:return-1;case-1:return 1}}function Di(t,e){return e===-1?Array.from(t).reverse():t}function za(t){return Array.from(t).reverse()}var j,pt=U(()=>{(function(r){r[r.Forwards=1]="Forwards",r[r.Backwards=-1]="Backwards"})(j||(j={}))});var On,jr,Ca,Fi=U(()=>{On=2147483647,jr="2^31 - 1",Ca=-2147483648});var Dr,ft,Ai=U(()=>{Tt();ft=class{constructor(){te(this,Dr,[])}push(e){R(this,Dr).push(e)}experimentalPushAlg(e){for(let r of e.units())this.push(r)}experimentalNumUnits(){return R(this,Dr).length}toAlg(){return new k(R(this,Dr))}reset(){Q(this,Dr,[])}};Dr=new WeakMap});var Fr,Ar,No,Pe,_n=U(()=>{Tt();Gt();pt();No=class extends Ce{constructor(e,r){super();te(this,Fr,void 0);te(this,Ar,void 0);Q(this,Fr,Xt(e)),Q(this,Ar,Xt(r))}get A(){return R(this,Fr)}get B(){return R(this,Ar)}isIdentical(e){let r=e.as(No);return!!(r?.A.isIdentical(this.A)&&r?.B.isIdentical(this.B))}invert(){return new No(R(this,Ar),R(this,Fr))}*experimentalExpand(e=j.Forwards,r){r??(r=1/0),r===0?yield e===j.Forwards?this:this.invert():e===j.Forwards?(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1)):(yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${R(this,Fr).toString()}, \${R(this,Ar).toString()}]\`}},Pe=No;Fr=new WeakMap,Ar=new WeakMap});var qr,Vr,Oo,Me,Wn=U(()=>{Tt();Gt();pt();Oo=class extends Ce{constructor(e,r){super();te(this,qr,void 0);te(this,Vr,void 0);Q(this,qr,Xt(e)),Q(this,Vr,Xt(r))}get A(){return R(this,qr)}get B(){return R(this,Vr)}isIdentical(e){let r=e.as(Oo);return!!(r?.A.isIdentical(this.A)&&r?.B.isIdentical(this.B))}invert(){return new Oo(R(this,qr),R(this,Vr).invert())}*experimentalExpand(e,r){r??(r=1/0),r===0?yield e===j.Forwards?this:this.invert():(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(e,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${this.A}: \${this.B}]\`}},Me=Oo;qr=new WeakMap,Vr=new WeakMap});var Jt,hi,Rt,Kn=U(()=>{Gt();pt();hi=class extends Ce{constructor(e){super();te(this,Jt,void 0);if(e.includes(\`
|
|
5
|
+
\`)||e.includes("\\r"))throw new Error("LineComment cannot contain newline");Q(this,Jt,e)}get text(){return R(this,Jt)}isIdentical(e){let r=e;return e.is(hi)&&R(this,Jt)===R(r,Jt)}invert(){return this}*experimentalExpand(e=j.Forwards,r=1/0){yield this}toString(){return\`//\${R(this,Jt)}\`}},Rt=hi;Jt=new WeakMap});var je,Qn=U(()=>{Gt();pt();je=class extends Ce{toString(){return\`
|
|
6
|
+
\`}isIdentical(e){return e.is(je)}invert(){return this}*experimentalExpand(e=j.Forwards,r=1/0){yield this}}});var qe,jn=U(()=>{Gt();pt();qe=class extends Ce{toString(){return"."}isIdentical(e){return e.is(qe)}invert(){return this}*experimentalExpand(e=j.Forwards,r=1/0){yield this}}});function _o(t,e){return t?parseInt(t):e}function yi(t){return new Wo().parseAlg(t)}function Ma(t){return new Wo().parseMove(t)}function Ga(t){return new Wo().parseQuantumMove(t)}function Ve(t,e,r){let n=t;return n.startCharIndex=e,n.endCharIndex=r,n}function Ta(t,e){return"startCharIndex"in t&&(e.startCharIndex=t.startCharIndex),"endCharIndex"in t&&(e.endCharIndex=t.endCharIndex),e}var Pa,n1,o1,l1,i1,s1,$e,O,Wo,Ui=U(()=>{Tt();Ai();_n();Wn();Ko();Kn();It();Qn();jn();Pa=/^(\\d+)?('?)/,n1=/^[_\\dA-Za-z]/,o1=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,l1=/^[^\\n]*/,i1=/^(-?\\d+), ?/,s1=/^(-?\\d+)\\)/;Wo=class{constructor(){te(this,$e,"");te(this,O,0)}parseAlg(e){Q(this,$e,e),Q(this,O,0);let r=this.parseAlgWithStopping([]);return this.mustBeAtEndOfInput(),r}parseMove(e){Q(this,$e,e),Q(this,O,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(e){Q(this,$e,e),Q(this,O,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(R(this,O)!==R(this,$e).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(e){let r=R(this,O),n=R(this,O),o=new ft,l=!1,i=s=>{if(l)throw new Error(\`Unexpected character at index \${s}. Are you missing a space?\`)};e:for(;R(this,O)<R(this,$e).length;){let s=R(this,O);if(e.includes(R(this,$e)[R(this,O)]))return Ve(o.toAlg(),r,n);if(this.tryConsumeNext(" ")){l=!1,o.experimentalNumUnits()===0&&(r=R(this,O));continue e}else if(n1.test(R(this,$e)[R(this,O)])){i(s);let u=this.parseMoveImpl();o.push(u),l=!0,n=R(this,O);continue e}else if(this.tryConsumeNext("(")){i(s);let u=this.tryRegex(i1);if(u){let a=u[1],f=R(this,O),g=this.parseRegex(s1),L=Ve(new c(new G("U_SQ_"),parseInt(a)),s+1,s+1+a.length),B=Ve(new c(new G("D_SQ_"),parseInt(g[1])),f,R(this,O)-1),p=Ve(new k([L,B]),s+1,R(this,O)-1);o.push(Ve(new st(p),s,R(this,O))),l=!0,n=R(this,O);continue e}else{let a=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let f=this.parseAmount();o.push(Ve(new st(a,f),s,R(this,O))),l=!0,n=R(this,O);continue e}}else if(this.tryConsumeNext("[")){i(s);let u=this.parseAlgWithStopping([",",":"]),a=this.popNext(),f=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),a){case":":o.push(Ve(new Me(u,f),s,R(this,O))),l=!0,n=R(this,O);continue e;case",":o.push(Ve(new Pe(u,f),s,R(this,O))),l=!0,n=R(this,O);continue e;default:throw"unexpected parsing error"}}else if(this.tryConsumeNext(\`
|
|
7
|
+
\`)){o.push(Ve(new je,s,R(this,O))),l=!1,n=R(this,O);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(s);let[u]=this.parseRegex(l1);o.push(Ve(new Rt(u),s,R(this,O))),l=!1,n=R(this,O);continue e}else{o.push(Ve(new c("_SLASH_"),s,R(this,O))),l=!0,n=R(this,O);continue e}else if(this.tryConsumeNext(".")){i(s),o.push(Ve(new qe,s,R(this,O))),l=!0,n=R(this,O);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,O)!==R(this,$e).length)throw new Error("did not finish parsing?");if(e.length>0)throw new Error("expected stopping");return Ve(o.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,e,r,n]=this.parseRegex(o1);return new G(n,_o(r,void 0),_o(e,void 0))}parseMoveImpl(){let e=R(this,O);if(this.tryConsumeNext("/"))return Ve(new c("_SLASH_"),e,R(this,O));let r=this.parseQuantumMoveImpl(),[n,o]=this.parseAmountAndTrackEmptyAbsAmount(),l=this.parseMoveSuffix();if(l){if(n<0)throw new Error("uh-oh");if((l==="++"||l==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((l==="++"||l==="--")&&!o)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((l==="+"||l==="-")&&o)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");l.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${l==="+"?"PLUS":"PLUSPLUS"}_\`})),l.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${l==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return Ve(new c(r,n),e,R(this,O))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let e=R(this,O),[,r,n]=this.parseRegex(Pa);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${e}: An amount can only start with 0 if it's exactly the digit 0.\`);return[_o(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let e=R(this,O),[,r,n]=this.parseRegex(Pa);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${e}: An amount number can only start with 0 if it's exactly the digit 0.\`);return _o(r,1)*(n==="'"?-1:1)}parseRegex(e){let r=e.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return Q(this,O,R(this,O)+r[0].length),r}tryRegex(e){let r=e.exec(this.remaining());return r===null?null:(Q(this,O,R(this,O)+r[0].length),r)}remaining(){return R(this,$e).slice(R(this,O))}popNext(){let e=R(this,$e)[R(this,O)];return ci(this,O)._++,e}tryConsumeNext(e){return R(this,$e)[R(this,O)]===e?(ci(this,O)._++,!0):!1}mustConsumeNext(e){let r=this.popNext();if(r!==e)throw new Error(\`expected \\\`\${e}\\\` while parsing, encountered \${r}\`);return r}};$e=new WeakMap,O=new WeakMap});function Qo(t){Ia.has(t)||(console.warn(t),Ia.add(t))}var Ia,bi=U(()=>{Ia=new Set});var Hr,Si=U(()=>{pt();Fi();Hr=class{constructor(e,r=1){if(this.quantum=e,this.amount=r,!Number.isInteger(this.amount)||this.amount<Ca||this.amount>On)throw new Error(\`Unit amount absolute value must be a non-negative integer from \${jr} to \${jr}.\`)}suffix(){let e="",r=Math.abs(this.amount);return r!==1&&(e+=r),this.amount<0&&(e+="'"),e}isIdentical(e){return this.quantum.isIdentical(e.quantum)&&this.amount===e.amount}*experimentalExpand(e,r){let n=Math.abs(this.amount),o=ka(e,this.amount<0);for(let l=0;l<n;l++)yield*this.quantum.experimentalExpand(o,r)}}});var Nt,Ge,Te,jo,G,we,Yr,c,It=U(()=>{Gt();pt();Fi();Ui();bi();Si();jo=class extends Io{constructor(e,r,n){super();te(this,Nt,void 0);te(this,Ge,void 0);te(this,Te,void 0);if(Q(this,Nt,e),Q(this,Ge,r??null),Q(this,Te,n??null),Object.freeze(this),R(this,Ge)!==null&&(!Number.isInteger(R(this,Ge))||R(this,Ge)<1||R(this,Ge)>On))throw new Error(\`QuantumMove inner layer must be a positive integer below \${jr}.\`);if(R(this,Te)!==null&&(!Number.isInteger(R(this,Te))||R(this,Te)<1||R(this,Te)>On))throw new Error(\`QuantumMove outer layer must be a positive integer below \${jr}.\`);if(R(this,Te)!==null&&R(this,Ge)!==null&&R(this,Ge)<=R(this,Te))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Te)!==null&&R(this,Ge)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(e){return Ga(e)}modified(e){return new jo(e.family??R(this,Nt),e.innerLayer??R(this,Ge),e.outerLayer??R(this,Te))}isIdentical(e){let r=e;return e.is(jo)&&R(this,Nt)===R(r,Nt)&&R(this,Ge)===R(r,Ge)&&R(this,Te)===R(r,Te)}get family(){return R(this,Nt)}get outerLayer(){return R(this,Te)}get innerLayer(){return R(this,Ge)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let e=R(this,Nt);return R(this,Ge)!==null&&(e=String(R(this,Ge))+e,R(this,Te)!==null&&(e=String(R(this,Te))+"-"+e)),e}},G=jo;Nt=new WeakMap,Ge=new WeakMap,Te=new WeakMap;Yr=class extends Ce{constructor(...e){super();te(this,we,void 0);if(typeof e[0]=="string")if(e[1]??null){Q(this,we,new Hr(G.fromString(e[0]),e[1]));return}else return Yr.fromString(e[0]);Q(this,we,new Hr(e[0],e[1]))}isIdentical(e){let r=e.as(Yr);return!!r&&R(this,we).isIdentical(R(r,we))}invert(){return Ta(this,new Yr(R(this,we).quantum,-this.amount))}*experimentalExpand(e=j.Forwards){e===j.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,we).quantum}modified(e){return new Yr(R(this,we).quantum.modified(e),e.amount??this.amount)}static fromString(e){return Ma(e)}get amount(){return R(this,we).amount}get type(){return Qo("deprecated: type"),"blockMove"}get family(){return R(this,we).quantum.family??void 0}get outerLayer(){return R(this,we).quantum.outerLayer??void 0}get innerLayer(){return R(this,we).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,we).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let e=Math.abs(this.amount);return R(this,we).quantum.toString().slice(0,-10)+(e===1?"":e)+(this.amount<0?"--":"++")}return R(this,we).quantum.toString()+R(this,we).suffix()}},c=Yr;we=new WeakMap});var Na,Oa,et,qo,st,Ko=U(()=>{Tt();Gt();pt();It();Si();Na=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(e){let r=this.tuple(e);return r?\`(\${r.map(n=>n.amount).join(", ")})\`:null}tuple(e){this.quantumU_SQ_||(this.quantumU_SQ_=new G("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new G("D_SQ_"));let r=e.alg;if(r.experimentalNumUnits()===2){let[n,o]=r.units();if(n.as(c)?.quantum.isIdentical(this.quantumU_SQ_)&&o.as(c)?.quantum.isIdentical(this.quantumD_SQ_)){if(e.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,o]}}return null}},Oa=new Na,qo=class extends Ce{constructor(e,r){super();te(this,et,void 0);let n=Xt(e);Q(this,et,new Hr(n,r))}isIdentical(e){let r=e;return e.is(qo)&&R(this,et).isIdentical(R(r,et))}get alg(){return R(this,et).quantum}get amount(){return R(this,et).amount}get experimentalRepetitionSuffix(){return R(this,et).suffix()}invert(){return new qo(R(this,et).quantum,-R(this,et).amount)}*experimentalExpand(e=j.Forwards,r){r??(r=1/0),r===0?yield e===j.Forwards?this:this.invert():yield*R(this,et).experimentalExpand(e,r-1)}static fromString(){throw new Error("unimplemented")}toString(){return Oa.format(this)??\`(\${R(this,et).quantum.toString()})\${R(this,et).suffix()}\`}experimentalAsSquare1Tuple(){return Oa.tuple(this)}},st=qo;et=new WeakMap});var Vo=U(()=>{Ko();Kn();_n();Wn();It();Qn();jn()});function dt(t,e){return t instanceof e}function _a(t){return dt(t,st)||dt(t,Rt)||dt(t,Pe)||dt(t,Me)||dt(t,c)||dt(t,je)||dt(t,qe)}var xi=U(()=>{Vo()});function Wa(t,e,r){if(e.is(st))return t.traverseGrouping(e,r);if(e.is(c))return t.traverseMove(e,r);if(e.is(Pe))return t.traverseCommutator(e,r);if(e.is(Me))return t.traverseConjugate(e,r);if(e.is(qe))return t.traversePause(e,r);if(e.is(je))return t.traverseNewline(e,r);if(e.is(Rt))return t.traverseLineComment(e,r);throw new Error("unknown unit")}function Ka(t){if(t.is(st)||t.is(c)||t.is(Pe)||t.is(Me)||t.is(qe)||t.is(je)||t.is(Rt))return t;throw"internal error: expected unit"}var Zr,Xr,Ho,a1,vi,wi,Qa,ja,Ei=U(()=>{Ko();_n();It();Qn();jn();Wn();Kn();Zr=class{traverseUnit(e,r){return Wa(this,e,r)}traverseIntoUnit(e,r){return Ka(this.traverseUnit(e,r))}},Xr=class extends Zr{traverseUnit(e){return Wa(this,e,void 0)}traverseIntoUnit(e){return Ka(this.traverseUnit(e))}},vi=class extends Zr{*traverseAlg(e,r){if(r.depth===0){yield*e.units();return}let n=[],o=null,l=r?.collapseMoves??!0;function i(a,f){var B;let g=Da(B=vi,Ho,a1).call(B,a,f,r);if(g===0)return!1;let L=new c(a.quantum,g);return n.push(L),o=L,!0}function s(a){l&&o?.is(c)&&a.is(c)&&o.quantum.isIdentical(a.quantum)?(n.pop(),i(o,a.amount)||(o=n.slice(-1)[0])):a.is(c)?i(a,0):(n.push(a),o=a)}let u={depth:r.depth?r.depth-1:null};for(let a of e.units())for(let f of this.traverseUnit(a,u))s(f);for(let a of n)yield a}*traverseGrouping(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new st(this.traverseAlg(e.alg,n))}*traverseMove(e,r){yield e}*traverseCommutator(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new Pe(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traverseConjugate(e,r){if(r.depth===0){yield e;return}let n={depth:r.depth?r.depth-1:null};yield new Me(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traversePause(e,r){yield e}*traverseNewline(e,r){yield e}*traverseLineComment(e,r){yield e}},wi=vi;Ho=new WeakSet,a1=function(e,r,n){let o=e.amount+r;if(n?.quantumMoveOrder){let l=n.quantumMoveOrder(e.quantum),i=Math.floor(l/2)+1-l;o=(o%l+l-i)%l+i}return o},te(wi,Ho);Qa=new wi,ja=Qa.traverseAlg.bind(Qa)});function qa(t){if(!t)return[];if(dt(t,k))return t.units();if(typeof t=="string")return yi(t).units();let e=t;if(typeof e[Symbol.iterator]=="function")return e;throw"Invalid unit"}function Xt(t){return dt(t,k)?t:new k(t)}function u1(t,e){return t.is(je)||e.is(je)?"":t.is(Rt)&&!e.is(je)?\`
|
|
8
|
+
\`:" "}var tt,hr,k,Tt=U(()=>{Gt();xi();pt();Ui();Ei();Kn();It();Qn();bi();hr=class extends Ce{constructor(e){super();te(this,tt,void 0);Q(this,tt,Array.from(qa(e)));for(let r of R(this,tt))if(!_a(r))throw new Error("An alg can only contain units.")}isIdentical(e){let r=e;if(!e.is(hr))return!1;let n=Array.from(R(this,tt)),o=Array.from(R(r,tt));if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++)if(!n[l].isIdentical(o[l]))return!1;return!0}invert(){return new hr(za(Array.from(R(this,tt)).map(e=>e.invert())))}*experimentalExpand(e=j.Forwards,r){r??(r=1/0);for(let n of Di(R(this,tt),e))yield*n.experimentalExpand(e,r)}expand(e){return new hr(this.experimentalExpand(j.Forwards,e?.depth??1/0))}*experimentalLeafMoves(){for(let e of this.experimentalExpand())e.is(c)&&(yield e)}concat(e){return new hr(Array.from(R(this,tt)).concat(Array.from(qa(e))))}experimentalIsEmpty(){for(let e of R(this,tt))return!1;return!0}static fromString(e){return yi(e)}*units(){for(let e of R(this,tt))yield e}experimentalNumUnits(){return Array.from(R(this,tt)).length}get type(){return Qo("deprecated: type"),"sequence"}toString(){let e="",r=null;for(let n of R(this,tt))r&&(e+=u1(r,n)),e+=n.toString(),r=n;return e}simplify(e){return new hr(ja(this,e??{}))}},k=hr;tt=new WeakMap});var f1,Va=U(()=>{Tt();Vo();_n();Wn();It();jn();f1={Sune:new k([new c("R",1),new c("U",1),new c("R",-1),new c("U",1),new c("R",1),new c("U",-2),new c("R",-1)]),AntiSune:new k([new c("R",1),new c("U",2),new c("R",-1),new c("U",-1),new c("R",1),new c("U",-1),new c("R",-1)]),SuneCommutator:new k([new Pe(new k([new c("R",1),new c("U",1),new c("R",-2)]),new k([new Me(new k([new c("R",1)]),new k([new c("U",1)]))]))]),Niklas:new k([new c("R",1),new c("U",-1),new c("L",-1),new c("U",1),new c("R",-1),new c("U",-1),new c("L",1),new c("U",1)]),EPerm:new k([new c("x",-1),new Pe(new k([new Me(new k([new c("R",1)]),new k([new c("U",-1)]))]),new k([new c("D",1)])),new Pe(new k([new Me(new k([new c("R",1)]),new k([new c("U",1)]))]),new k([new c("D",1)])),new c("x",1)]),FURURFCompact:new k([new Me(new k([new c("F",1)]),new k([new Pe(new k([new c("U",1)]),new k([new c("R",1)]))]))]),APermCompact:new k([new Me(new k([new c("R",2)]),new k([new Pe(new k([new c("F",2)]),new k([new c("R",-1),new c("B",-1),new c("R",1)]))]))]),FURURFMoves:new k([new c("F",1),new c("U",1),new c("R",1),new c("U",-1),new c("R",-1),new c("F",-1)]),TPerm:new k([new c("R",1),new c("U",1),new c("R",-1),new c("U",-1),new c("R",-1),new c("F",1),new c("R",2),new c("U",-1),new c("R",-1),new c("U",-1),new c("R",1),new c("U",1),new c("R",-1),new c("F",-1)]),HeadlightSwaps:new k([new Me(new k([new c("F",1)]),new k([new st(new k([new Pe(new k([new c("R",1)]),new k([new c("U",1)]))]),3)]))]),TriplePause:new k([new qe,new qe,new qe])}});var bR,Ha=U(()=>{It();bR={73:new c("R"),75:new c("R'"),87:new c("B"),79:new c("B'"),83:new c("D"),76:new c("D'"),68:new c("L"),69:new c("L'"),74:new c("U"),70:new c("U'"),72:new c("F"),71:new c("F'"),78:new c("x'"),67:new c("l"),82:new c("l'"),85:new c("r"),77:new c("r'"),88:new c("d"),188:new c("d'"),84:new c("x"),89:new c("x"),66:new c("x'"),186:new c("y"),59:new c("y"),65:new c("y'"),80:new c("z"),81:new c("z'"),90:new c("M'"),190:new c("M'")}});var Ya=U(()=>{});var Za=U(()=>{Tt()});var Ae=U(()=>{Tt();Ai();Ei();Va();Ha();Vo();It();Ya();Za();xi();pt()});function qn(t,e,r){let n={};for(let o in t.orbits){let l=t.orbits[o],i=e[o],s=r[o];if(Vn(l.numOrientations,s))n[o]=i;else if(Vn(l.numOrientations,i))n[o]=s;else{let u=new Array(l.numPieces);if(l.numOrientations===1){for(let a=0;a<l.numPieces;a++)u[a]=i.permutation[s.permutation[a]];n[o]={permutation:u,orientation:i.orientation}}else{let a=new Array(l.numPieces);for(let f=0;f<l.numPieces;f++)a[f]=(i.orientation[s.permutation[f]]+s.orientation[f])%l.numOrientations,u[f]=i.permutation[s.permutation[f]];n[o]={permutation:u,orientation:a}}}}return n}function ki(t,e,r){let n={};for(let o in t.orbits){let l=t.orbits[o],i=e[o],s=r[o];if(Vn(l.numOrientations,s))n[o]=i;else{let u=new Array(l.numPieces);if(l.numOrientations===1){for(let a=0;a<l.numPieces;a++)u[a]=i.pieces[s.permutation[a]];n[o]={pieces:u,orientation:i.orientation}}else{let a=new Array(l.numPieces);for(let f=0;f<l.numPieces;f++)a[f]=(i.orientation[s.permutation[f]]+s.orientation[f])%l.numOrientations,u[f]=i.pieces[s.permutation[f]];n[o]={pieces:u,orientation:a}}}}return n}var Yo=U(()=>{Hn()});function g1(t){let e=Ja.get(t);if(e)return e;let r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[l]=l,n[l]=0;let o={permutation:r,orientation:n};return Xa&&(Object.freeze(r),Object.freeze(n),Object.freeze(o)),Ja.set(t,o),o}function $a(t){let e={};for(let[r,n]of Object.entries(t.orbits))e[r]=g1(n.numPieces);return Xa&&Object.freeze(e),e}function e0(t,e){let r=e.quantum.toString(),n=t.definition.moves[r];if(n)return $t(t,n,e.amount);let o=t.definition.moves[e.toString()];if(o)return o;let l=t.definition.moves[e.invert().toString()];if(l)return $t(t,l,-1);throw new Error(\`Invalid move for KPuzzle (\${t.name()}): \${e}\`)}var Xa,Ja,zi=U(()=>{Hn();Xa=!1,Ja=new Map});var Be,Zo=U(()=>{Yo();Yn();Be=class{constructor(e,r){this.kpuzzle=e;this.stateData=r}static fromTransformation(e){let r=ki(e.kpuzzle.definition,e.kpuzzle.definition.startStateData,e.transformationData);return new Be(e.kpuzzle,r)}apply(e){return this.applyTransformation(this.kpuzzle.toTransformation(e))}applyTransformation(e){if(e.isIdentityTransformation())return new Be(this.kpuzzle,this.stateData);let r=ki(this.kpuzzle.definition,this.stateData,e.transformationData);return new Be(this.kpuzzle,r)}applyMove(e){return this.applyTransformation(this.kpuzzle.moveToTransformation(e))}applyAlg(e){return this.applyTransformation(this.kpuzzle.algToTransformation(e))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let e={};for(let[r,n]of Object.entries(this.stateData)){let o={permutation:n.pieces,orientation:n.orientation};e[r]=o}return new Dt(this.kpuzzle,e)}}});var yr,er,Dt,Yn=U(()=>{Hn();Yo();zi();Zo();er=class{constructor(e,r){this.kpuzzle=e;this.transformationData=r;te(this,yr,void 0)}invert(){return new er(this.kpuzzle,Ci(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,yr)??Q(this,yr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(e){let r=new er(e,$a(e.definition));return Q(r,yr,!0),r}isIdentical(e){return t0(this.kpuzzle,this.transformationData,e.transformationData)}apply(e){return this.applyTransformation(this.kpuzzle.toTransformation(e))}applyTransformation(e){if(this.kpuzzle!==e.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${e.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,yr)?new er(this.kpuzzle,e.transformationData):R(e,yr)?new er(this.kpuzzle,this.transformationData):new er(this.kpuzzle,qn(this.kpuzzle.definition,this.transformationData,e.transformationData))}applyMove(e){return this.applyTransformation(this.kpuzzle.moveToTransformation(e))}applyAlg(e){return this.applyTransformation(this.kpuzzle.algToTransformation(e))}toKState(){return Be.fromTransformation(this)}repetitionOrder(){return r0(this.kpuzzle.definition,this)}selfMultiply(e){return new er(this.kpuzzle,$t(this.kpuzzle,this.transformationData,e))}},Dt=er;yr=new WeakMap});function Vn(t,e){let{permutation:r}=e,n=r.length;for(let o=0;o<n;o++)if(r[o]!==o)return!1;if(t>1){let{orientation:o}=e;for(let l=0;l<n;l++)if(o[l]!==0)return!1}return!0}function L1(t,e,r,n={}){for(let o=0;o<t.numPieces;o++)if(!n?.ignoreOrientation&&e.orientation[o]!==r.orientation[o]||!n?.ignorePermutation&&e.permutation[o]!==r.permutation[o])return!1;return!0}function t0(t,e,r){for(let[n,o]of Object.entries(t.definition.orbits))if(!L1(o,e[n],r[n]))return!1;return!0}function Ci(t,e){let r={};for(let n in t.definition.orbits){let o=t.definition.orbits[n],l=e[n];if(Vn(o.numOrientations,l))r[n]=l;else if(o.numOrientations===1){let i=new Array(o.numPieces);for(let s=0;s<o.numPieces;s++)i[l.permutation[s]]=s;r[n]={permutation:i,orientation:l.orientation}}else{let i=new Array(o.numPieces),s=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++){let a=l.permutation[u];i[a]=u,s[a]=(o.numOrientations-l.orientation[u]+o.numOrientations)%o.numOrientations}r[n]={permutation:i,orientation:s}}}return r}function $t(t,e,r){if(r===1)return e;if(r<0)return $t(t,Ci(t,e),-r);if(r===0){let{transformationData:l}=t.identityTransformation();return l}let n=e;r!==2&&(n=$t(t,e,Math.floor(r/2)));let o=qn(t.definition,n,n);return r%2==0?o:qn(t.definition,e,o)}function Pi(t,e){return e?Pi(e,t%e):t}function r0(t,e){let r=1;for(let n in t.orbits){let o=t.orbits[n],l=e.transformationData[n],i=new Array(o.numPieces);for(let s=0;s<o.numPieces;s++)if(!i[s]){let u=s,a=0,f=0;for(;i[u]=!0,a=a+l.orientation[u],f=f+1,u=l.permutation[u],u!==s;);a!==0&&(f=f*o.numOrientations/Pi(o.numOrientations,a)),r=r*f/Pi(r,f)}}return r}var n0,o0,l0,Hn=U(()=>{Ae();Yo();Yn();n0=class extends Zr{traverseAlg(e,r){let n=null;for(let o of e.units())n?n=n.applyTransformation(this.traverseUnit(o,r)):n=this.traverseUnit(o,r);return n??r.identityTransformation()}traverseGrouping(e,r){let n=this.traverseAlg(e.alg,r);return new Dt(r,$t(r,n.transformationData,e.amount))}traverseMove(e,r){return r.moveToTransformation(e)}traverseCommutator(e,r){let n=this.traverseAlg(e.A,r),o=this.traverseAlg(e.B,r);return n.applyTransformation(o).applyTransformation(n.invert()).applyTransformation(o.invert())}traverseConjugate(e,r){let n=this.traverseAlg(e.A,r),o=this.traverseAlg(e.B,r);return n.applyTransformation(o).applyTransformation(n.invert())}traversePause(e,r){return r.identityTransformation()}traverseNewline(e,r){return r.identityTransformation()}traverseLineComment(e,r){return r.identityTransformation()}},o0=new n0,l0=o0.traverseAlg.bind(o0)});var Jr,Xo,Ie,Mi=U(()=>{Ae();Hn();zi();Zo();Yn();Ie=class{constructor(e,r){this.definition=e;te(this,Jr,new Map);te(this,Xo,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Dt.experimentalConstructIdentity(this)}moveToTransformation(e){typeof e=="string"&&(e=new c(e));let r=e.toString(),n=R(this,Jr).get(r);if(n)return new Dt(this,n);if(this.experimentalPGNotation){let l=this.experimentalPGNotation.lookupMove(e);if(!l)throw new Error(\`could not map to internal move: \${e}\`);return R(this,Jr).set(r,l),new Dt(this,l)}let o=e0(this,e);return R(this,Jr).set(r,o),new Dt(this,o)}algToTransformation(e){return typeof e=="string"&&(e=new k(e)),l0(e,this)}toTransformation(e){return typeof e=="string"?this.algToTransformation(e):e?.is?.(k)?this.algToTransformation(e):e?.is?.(c)?this.moveToTransformation(e):e}startState(){return new Be(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,Xo)??Q(this,Xo,(()=>{for(let[e,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let o of this.definition.startStateData[e].pieces)n[o]=!0;for(let o of n)if(!o)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(e){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(e){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};Jr=new WeakMap,Xo=new WeakMap});var pe,i0=U(()=>{pe={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]}}}};pe.moves.Uw=pe.moves.u;pe.moves.Lw=pe.moves.l;pe.moves.Fw=pe.moves.f;pe.moves.Rw=pe.moves.r;pe.moves.Bw=pe.moves.b;pe.moves.Dw=pe.moves.d;pe.moves.Rv=pe.moves.x;pe.moves.Uv=pe.moves.y;pe.moves.Fv=pe.moves.z;pe.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]}};pe.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]}};pe.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 Gi,He=U(()=>{Mi();Zo();Yn();i0();Mi();Gi=new Ie(pe)});var s0=U(()=>{He()});function h1(t){switch(t){case S.Regular:return B1;case S.Dim:return D1;case S.Ignored:return m1;case S.OrientationStickers:return c1;case S.Invisible:return p1;case S.IgnoreNonPrimary:return R1;case S.PermuteNonPrimary:return d1;case S.Ignoriented:return F1;case S.OrientationWithoutPermutation:return A1}}var S,$r,vt,Ne,en,Jo,Ur,B1,m1,c1,p1,R1,d1,D1,F1,A1,Zn,Xn,Jn=U(()=>{(function(a){a.Regular="Regular",a.Dim="Dim",a.Ignored="Ignored",a.OrientationStickers="OrientationStickers",a.Invisible="Invisible",a.Ignoriented="Ignoriented",a.IgnoreNonPrimary="IgnoreNonPrimary",a.PermuteNonPrimary="PermuteNonPrimary",a.OrientationWithoutPermutation="OrientationWithoutPermutation"})(S||(S={}));$r=class{constructor(e,r){this.stickerings=new Map;for(let[n,o]of Object.entries(e.definition.orbits))this.stickerings.set(n,new Array(o.numPieces).fill(r))}},vt="regular",Ne="ignored",en="oriented",Jo="invisible",Ur="dim",B1={facelets:[vt,vt,vt,vt,vt]},m1={facelets:[Ne,Ne,Ne,Ne,Ne]},c1={facelets:[en,en,en,en,en]},p1={facelets:[Jo,Jo,Jo,Jo]},R1={facelets:[vt,Ne,Ne,Ne,Ne]},d1={facelets:[Ur,vt,vt,vt,vt]},D1={facelets:[Ur,Ur,Ur,Ur,Ur]},F1={facelets:[Ur,Ne,Ne,Ne,Ne]},A1={facelets:[en,Ne,Ne,Ne,Ne]};Zn=class extends $r{constructor(e){super(e,S.Regular)}set(e,r){for(let[n,o]of this.stickerings.entries())for(let l=0;l<o.length;l++)e.stickerings.get(n)[l]&&(o[l]=r);return this}toAppearance(){let e={orbits:{}};for(let[r,n]of this.stickerings.entries()){let o=[],l={pieces:o};e.orbits[r]=l;for(let i of n)o.push(h1(i))}return e}},Xn=class{constructor(e){this.kpuzzle=e}and(e){let r=new $r(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let l=0;l<o.numPieces;l++){r.stickerings.get(n)[l]=!0;for(let i of e)if(!i.stickerings.get(n)[l]){r.stickerings.get(n)[l]=!1;continue e}}}return r}or(e){let r=new $r(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let l=0;l<o.numPieces;l++){r.stickerings.get(n)[l]=!1;for(let i of e)if(i.stickerings.get(n)[l]){r.stickerings.get(n)[l]=!0;continue e}}}return r}not(e){let r=new $r(this.kpuzzle,!1);for(let[n,o]of Object.entries(this.kpuzzle.definition.orbits))for(let l=0;l<o.numPieces;l++)r.stickerings.get(n)[l]=!e.stickerings.get(n)[l];return r}all(){return this.and(this.moves([]))}move(e){let r=this.kpuzzle.moveToTransformation(e),n=new $r(this.kpuzzle,!1);for(let[o,l]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<l.numPieces;i++)(r.transformationData[o].permutation[i]!==i||r.transformationData[o].orientation[i]!==0)&&(n.stickerings.get(o)[i]=!0);return n}moves(e){return e.map(r=>this.move(r))}}});function y1(t){(async()=>{a0=t;let e=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${e.length} players!\`);let r=[];for(let n of e)r.push((async()=>{let o=await n.experimentalModel.stickering.get();n.experimentalStickering=o==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function u0(t,e){a0(t,e)}var a0,f0=U(()=>{Jn();a0=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=y1,window.PieceStickering=S,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 Et(t,e){let r=await t.kpuzzle(),n=new Zn(r),o=new Xn(r),l=()=>o.move("U"),i=()=>o.or(o.moves(["U","D"])),s=()=>o.not(i()),u=()=>o.or(o.moves(["L","R"])),a=()=>o.not(u()),f=()=>o.or(o.moves(["F","B"])),g=()=>o.not(f()),L=()=>o.not(l()),B=()=>o.and([l(),a(),g()]),p=()=>o.and([o.and(o.moves(["F","R"])),o.not(i())]),m=()=>o.and(o.moves(["D","R","F"])),F=()=>o.or([m(),p()]),A=()=>o.or([o.and([a(),s()]),o.and([a(),g()]),o.and([s(),g()])]),b=()=>o.or([o.and([a(),i(),f()]),o.and([s(),u(),f()]),o.and([g(),i(),u()])]),h=()=>o.not(o.or([A(),b()])),C=()=>o.or([a(),o.and([l(),b()])]);function E(){n.set(L(),S.Dim)}function q(){n.set(l(),S.PermuteNonPrimary),n.set(B(),S.Dim)}function re(){n.set(l(),S.IgnoreNonPrimary),n.set(B(),S.Regular)}function I(){n.set(l(),S.Ignoriented),n.set(B(),S.Dim)}switch(e){case"full":break;case"PLL":E(),q();break;case"CLS":E(),n.set(o.and(o.moves(["D","R","F"])),S.Regular),n.set(l(),S.Ignoriented),n.set(o.and([l(),h()]),S.IgnoreNonPrimary);break;case"OLL":E(),re();break;case"COLL":E(),q(),n.set(o.and([l(),h()]),S.Regular);break;case"OCLL":E(),I(),n.set(o.and([l(),h()]),S.IgnoreNonPrimary);break;case"CLL":E(),n.set(o.not(o.and([h(),l()])),S.Dim);break;case"ELL":E(),n.set(l(),S.Dim),n.set(o.and([l(),b()]),S.Regular);break;case"ELS":E(),re(),n.set(o.and([l(),h()]),S.Ignored),n.set(p(),S.Regular),n.set(m(),S.Ignored);break;case"LL":E();break;case"F2L":n.set(l(),S.Ignored);break;case"ZBLL":E(),n.set(l(),S.PermuteNonPrimary),n.set(B(),S.Dim),n.set(o.and([l(),h()]),S.Regular);break;case"ZBLS":E(),n.set(F(),S.Regular),re(),n.set(o.and([l(),h()]),S.Ignored);break;case"WVLS":case"VLS":E(),n.set(F(),S.Regular),re();break;case"LS":E(),n.set(F(),S.Regular),n.set(l(),S.Ignored),n.set(B(),S.Dim);break;case"EO":n.set(h(),S.Ignored),n.set(b(),S.OrientationWithoutPermutation);break;case"EOline":n.set(h(),S.Ignored),n.set(b(),S.OrientationWithoutPermutation),n.set(o.and(o.moves(["D","M"])),S.Regular);break;case"EOcross":n.set(b(),S.OrientationWithoutPermutation),n.set(o.move("D"),S.Regular),n.set(h(),S.Ignored);break;case"CMLL":n.set(L(),S.Dim),n.set(C(),S.Ignored),n.set(o.and([l(),h()]),S.Regular);break;case"L6E":n.set(o.not(C()),S.Dim);break;case"L6EO":n.set(o.not(C()),S.Dim),n.set(C(),S.OrientationWithoutPermutation),n.set(o.and([A(),i()]),S.OrientationStickers);break;case"Daisy":n.set(o.all(),S.Ignored),n.set(A(),S.Dim),n.set(o.and([o.move("D"),A()]),S.Regular),n.set(o.and([o.move("U"),b()]),S.IgnoreNonPrimary);break;case"Cross":n.set(o.all(),S.Ignored),n.set(A(),S.Dim),n.set(o.and([o.move("D"),A()]),S.Regular),n.set(o.and([o.move("D"),b()]),S.Regular);break;case"2x2x2":n.set(o.or(o.moves(["U","F","R"])),S.Ignored),n.set(o.and([o.or(o.moves(["U","F","R"])),A()]),S.Dim);break;case"2x2x3":n.set(o.all(),S.Dim),n.set(o.or(o.moves(["U","F","R"])),S.Ignored),n.set(o.and([o.or(o.moves(["U","F","R"])),A()]),S.Dim),n.set(o.and([o.move("F"),o.not(o.or(o.moves(["U","R"])))]),S.Regular);break;case"Void Cube":n.set(A(),S.Invisible);break;case"picture":case"invisible":n.set(o.all(),S.Invisible);break;case"centers-only":n.set(o.not(A()),S.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":u0(n,o);break;default:console.warn(\`Unsupported stickering for \${t.id}: \${e}. Setting all pieces to dim.\`),n.set(o.and(o.moves([])),S.Dim)}return n.toAppearance()}async function tn(){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 rn=U(()=>{Jn();f0()});function Oe(t){let e=null;return()=>e??(e=t())}var br=U(()=>{});var $n,g0=U(()=>{$n=class{constructor(e,r){this.facenames=e;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<e.length;n++)for(let o=0;this.prefixFree&&o<e.length;o++)n!==o&&e[n].startsWith(e[o])&&(this.prefixFree=!1)}setGripNames(e){this.gripnames=e}splitByFaceNames(e){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let o=-1;for(let l=0;l<this.facenames.length;l++)e.substr(n).startsWith(this.facenames[l])&&(o<0||this.facenames[l].length>this.facenames[o].length)&&(o=l);if(o>=0)r.push(o),n+=this.facenames[o].length;else throw new Error("Could not split "+e+" into face names.")}return r}joinByFaceIndices(e){let r="",n=[];for(let o=0;o<e.length;o++)n.push(r),n.push(this.facenames[e[o]]),this.prefixFree||(r="_");return n.join("")}spinmatch(e,r){if(e===r)return!0;try{let n=this.splitByFaceNames(e),o=this.splitByFaceNames(r);if(n.length!==o.length&&n.length<3)return!1;for(let l=0;l<n.length;l++){for(let s=0;s<l;s++)if(n[l]===n[s])return!1;let i=!1;for(let s=0;s<o.length;s++)if(n[l]===o[s]){i=!0;break}if(!i)return!1}return!0}catch(n){return!1}}unswizzle(e){(e.endsWith("v")||e.endsWith("w"))&&e[0]<="Z"&&(e=e.slice(0,e.length-1));let r=e.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let o=this.gripnames[n];if(this.spinmatch(r,o))return o}return e}}});var nn,L0=U(()=>{nn=class{notationToInternal(e){return e}notationToExternal(e){return e}}});var $o,B0=U(()=>{Ae();$o=class{constructor(e,r){this.child=e;this.sw=r}notationToInternal(e){return e.family==="T"&&e.innerLayer===void 0&&e.outerLayer===void 0?new c(new G("FLRv",e.innerLayer,e.outerLayer),e.amount):this.child.notationToInternal(e)}notationToExternal(e){let r=e.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new c(new G("T",e.innerLayer,e.outerLayer),e.amount):this.child.notationToExternal(e)}}});var eo,m0=U(()=>{Ae();eo=class{constructor(e,r){this.internalNames=e;this.externalNames=r}convertString(e,r,n){let o="";(e.endsWith("v")||e.endsWith("v"))&&e<="_"&&(o=e.slice(e.length-1),e=e.slice(0,e.length-1));let l=e.toUpperCase(),i=!1;return e!==l&&(i=!0,e=l),e=n.joinByFaceIndices(r.splitByFaceNames(e)),i&&(e=e.toLowerCase()),e+o}convert(e,r,n){let o=e.family,l=this.convertString(o,r,n);return o===l?e:new c(new G(l,e.innerLayer,e.outerLayer),e.amount)}notationToInternal(e){return this.convert(e,this.externalNames,this.internalNames)}notationToExternal(e){return this.convert(e,this.internalNames,this.externalNames)}}});var el,c0=U(()=>{Ae();el=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer===void 0&&e.outerLayer===void 0){if(Math.abs(e.amount)===1){if(e.family==="R++")return new c(new G("L",3,2),-2*e.amount);if(e.family==="R--")return new c(new G("L",3,2),2*e.amount);if(e.family==="D++")return new c(new G("U",3,2),-2*e.amount);if(e.family==="D--")return new c(new G("U",3,2),2*e.amount);if(e.family==="R_PLUSPLUS_")return new c(new G("L",3,2),-2*e.amount);if(e.family==="D_PLUSPLUS_")return new c(new G("U",3,2),-2*e.amount)}if(e.family==="y")return new c("Uv",e.amount)}return this.child.notationToInternal(e)}notationToExternal(e){return e.family==="Uv"?new c(new G("y",e.innerLayer,e.outerLayer),e.amount):e.family==="Dv"?new c("y",-e.amount):this.child.notationToExternal(e)}}});var tl,p0=U(()=>{Ae();tl=class{constructor(e){this.slices=e}notationToInternal(e){let r=e.family;return!e.innerLayer&&!e.outerLayer&&(r==="x"?e=new c("Rv",e.amount):r==="y"?e=new c("Uv",e.amount):r==="z"&&(e=new c("Fv",e.amount)),(this.slices&1)==1&&(r==="E"?e=new c(new G("D",(this.slices+1)/2),e.amount):r==="M"?e=new c(new G("L",(this.slices+1)/2),e.amount):r==="S"&&(e=new c(new G("F",(this.slices+1)/2),e.amount))),this.slices>2&&(r==="e"?e=new c(new G("D",this.slices-1,2),e.amount):r==="m"?e=new c(new G("L",this.slices-1,2),e.amount):r==="s"&&(e=new c(new G("F",this.slices-1,2),e.amount)))),e}notationToExternal(e){let r=e.family;if(!e.innerLayer&&!e.outerLayer){if(r==="Rv")return new c("x",e.amount);if(r==="Uv")return new c("y",e.amount);if(r==="Fv")return new c("z",e.amount);if(r==="Lv")return new c("x",-e.amount);if(r==="Dv")return new c("y",-e.amount);if(r==="Bv")return new c("z",-e.amount)}return e}}});var U1,b1,R0,d0,D0,to,rl,F0=U(()=>{Ae();U1={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"},b1={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"},R0={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},d0=new G("y"),D0=new G("Dv"),to=class{constructor(e){this.child=e;this.wcaHack=!1;this.map=U1}notationToInternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){let n=R0[e.family];if(n)return new c(new G(n,e.innerLayer,e.outerLayer),e.amount)}let r=this.map[e.family];return r?new c(new G(r,e.innerLayer,e.outerLayer),e.amount):d0.isIdentical(e.quantum)?new c(D0,-e.amount):null}notationToExternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){for(let[r,n]of Object.entries(R0))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount);return D0.isIdentical(e.quantum)?new c(d0,-e.amount):null}},rl=class extends to{constructor(e){super(e);this.map=b1}}});var A0,h0,y0,U0,b0,S0,x0,nl,w0=U(()=>{Ae();A0={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"},h0=new G("x"),y0=new G("Rv"),U0=new G("y"),b0=new G("Uv"),S0=new G("z"),x0=new G("Fv"),nl=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer||e.outerLayer)return null;let r=A0[e.family];return r?new c(new G(r,e.outerLayer,e.innerLayer),e.amount):h0.isIdentical(e.quantum)?new c(y0,e.amount):U0.isIdentical(e.quantum)?new c(b0,e.amount):S0.isIdentical(e.quantum)?new c(x0,e.amount):null}notationToExternal(e){for(let[r,n]of Object.entries(A0))if(this.child.spinmatch(e.family,n))return new c(new G(r,e.innerLayer,e.outerLayer),e.amount);return y0.isIdentical(e.quantum)?new c(h0,e.amount):b0.isIdentical(e.quantum)?new c(U0,e.amount):x0.isIdentical(e.quantum)?new c(S0,e.amount):null}}});var Ti=U(()=>{L0();B0();m0();c0();p0();F0();w0()});function v0(t){let e=0,r={};for(;e<t.length&&t[e][0]==="-";){let o=t[e++];if(o==="--rotations")r.addRotations=!0;else if(o==="--allmoves")r.allMoves=!0;else if(o==="--outerblockmoves")r.outerBlockMoves=!0;else if(o==="--vertexmoves")r.vertexMoves=!0;else if(o==="--nocorners")r.includeCornerOrbits=!1;else if(o==="--noedges")r.includeEdgeOrbits=!1;else if(o==="--noorientation")r.fixedOrientation=!0;else if(o==="--nocenters")r.includeCenterOrbits=!1;else if(o==="--omit")r.excludeOrbits=t[e].split(","),e++;else if(o==="--moves")r.moveList=t[e].split(","),e++;else if(o==="--optimize")r.optimizeOrbits=!0;else if(o==="--scramble")r.scrambleAmount=100;else if(o==="--fixcorner")r.fixedPieceType="v";else if(o==="--fixedge")r.fixedPieceType="e";else if(o==="--fixcenter")r.fixedPieceType="f";else if(o==="--orientcenters")r.orientCenters=!0;else if(o==="--puzzleorientation")r.puzzleOrientation=JSON.parse(t[e]),e++;else throw new Error("Bad option: "+o)}return{puzzleDescription:ro(t.slice(e).join(" ")),options:r}}var Ii,Ni=U(()=>{ol();Ii=class{constructor(e={}){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,e)}}});function tr(t){if(!Oi[t]){let e=Array(t);for(let r=0;r<t;r++)e[r]=0;Oi[t]=e}return Oi[t]}function kt(t){if(!_i[t]){let e=Array(t);for(let r=0;r<t;r++)e[r]=r;_i[t]=e}return _i[t]}function E0(t){return new gt(kt(t))}function k0(t){let e=1;for(;t>1;)e*=t,t--;return e}function S1(t,e){if(t>e){let r=t;t=e,e=r}for(;t>0;){let r=e%t;e=t,t=r}return e}function Wi(t,e){return t/S1(t,e)*e}var Oi,_i,gt,ll=U(()=>{Oi=[],_i=[];gt=class{constructor(e){this.n=e.length,this.p=e}toString(){return"Perm["+this.p.join(" ")+"]"}mul(e){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=e.p[this.p[n]];return new gt(r)}rmul(e){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[e.p[n]];return new gt(r)}inv(){let e=Array(this.n);for(let r=0;r<this.n;r++)e[this.p[r]]=r;return new gt(e)}compareTo(e){for(let r=0;r<this.n;r++)if(this.p[r]!==e.p[r])return this.p[r]-e.p[r];return 0}toGap(){let e=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 o=new Array;for(let l=n;!r[l];l=this.p[l])o.push(1+l),r[l]=!0;e.push("("+o.join(",")+")")}return e.join("")}order(){let e=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let o=0;for(let l=n;!r[l];l=this.p[l])o++,r[l]=!0;e=Wi(e,o)}return e}}});function Ki(t,e){let r=c.fromString(e),n=t.notationToExternal(r);return n===null||r===n?e:n.toString()}function z0(t,e){let r=t.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],o=[];for(let i=0;i<r;i++){let s=t.moveops[i];n.push(s.order());let u=0;for(let a=0;a<r;a++){if(a===i)continue;let f=t.moveops[a];s.mul(f).equal(f.mul(s))&&(u|=1<<a)}o.push(u)}let l={};l[0]=1;for(let i=0;i<100;i++){let s=0,u={},a=0;for(let f in l){let g=+f,L=l[g];s+=L,a++;for(let B=0;B<n.length;B++)if((g>>B&1)==0&&(g&o[B]&(1<<B)-1)==0){let p=g&o[B]|1<<B;u[p]===void 0&&(u[p]=0),u[p]+=(n[B]-1)*L}}e(\`\${i}: canonseq \${s} states \${a}\`),l=u}}var no,x1,on,Ft,Ot,Qi,rr,ln,ji,C0=U(()=>{Ae();Ti();ll();no=class{constructor(e,r){this.size=e;this.mod=r}reassemblySize(){return k0(this.size)*Math.pow(this.mod,this.size)}},x1=0;on=class{constructor(e,r,n,o,l){this.orbitnames=e;this.orbitdefs=r;this.solved=n;this.movenames=o;this.moveops=l}transformToKTransformationData(e){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=e.orbits[n].toKPuzzle();return r}static transformToKTransformationData(e,r){let n={};for(let o=0;o<e.length;o++)n[e[o]]=r.orbits[o].toKPuzzle();return n}toKsolve(e,r=new nn){let n=[];n.push("Name "+e),n.push("");for(let o=0;o<this.orbitnames.length;o++)n.push(\`Set \${this.orbitnames[o]} \${this.orbitdefs[o].size} \${this.orbitdefs[o].mod}\`);n.push(""),n.push("Solved");for(let o=0;o<this.orbitnames.length;o++)this.solved.orbits[o].appendDefinition(n,this.orbitnames[o],!1,!1);n.push("End");for(let o=0;o<this.movenames.length;o++){n.push("");let l=Ki(r,this.movenames[o]),i=!1;l[l.length-1]==="'"&&(i=!0,l=l.substring(0,l.length-1)),n.push("Move "+l);for(let s=0;s<this.orbitnames.length;s++)i?this.moveops[o].orbits[s].inv().appendDefinition(n,this.orbitnames[s],!0):this.moveops[o].orbits[s].appendDefinition(n,this.orbitnames[s],!0);n.push("End")}return n}toKPuzzleDefinition(e){let r={},n={};for(let l=0;l<this.orbitnames.length;l++){r[this.orbitnames[l]]={numPieces:this.orbitdefs[l].size,numOrientations:this.orbitdefs[l].mod};let i=this.solved.orbits[l].toKPuzzle();n[this.orbitnames[l]]={pieces:i.permutation,orientation:i.orientation}}let o={};if(e)for(let l=0;l<this.movenames.length;l++)o[this.movenames[l]]=this.transformToKTransformationData(this.moveops[l]);return{name:\`PG3D #\${++x1}\`,orbits:r,startStateData:n,moves:o}}optimize(){let e=[],r=[],n=[],o=[];for(let l=0;l<this.moveops.length;l++)o.push([]);for(let l=0;l<this.orbitdefs.length;l++){let i=this.orbitdefs[l].mod,s=this.orbitdefs[l].size,u=new ji(s),a=new Array(this.orbitdefs[l].size);for(let B=0;B<s;B++)a[B]=!1;for(let B=0;B<this.moveops.length;B++)for(let p=0;p<s;p++)(this.moveops[B].orbits[l].perm[p]!==p||this.moveops[B].orbits[l].ori[p]!==0)&&(a[p]=!0,u.union(p,this.moveops[B].orbits[l].perm[p]));let f=!0;if(i>1){f=!1;let B=new ji(this.orbitdefs[l].size*i);for(let p=0;p<this.moveops.length;p++)for(let m=0;m<s;m++)if(this.moveops[p].orbits[l].perm[m]!==m||this.moveops[p].orbits[l].ori[m]!==0)for(let F=0;F<i;F++)B.union(m*i+F,this.moveops[p].orbits[l].perm[m]*i+(F+this.moveops[p].orbits[l].ori[m])%i);for(let p=0;!f&&p<s;p++)for(let m=1;m<i;m++)B.find(p*i)===B.find(p*i+m)&&(f=!0);for(let p=0;!f&&p<s;p++)for(let m=0;m<p;m++)this.solved.orbits[l].perm[p]===this.solved.orbits[l].perm[m]&&(f=!0)}let g=-1,L=!1;for(let B=0;B<this.orbitdefs[l].size;B++)if(a[B]){let p=u.find(B);g<0?g=p:g!==p&&(L=!0)}for(let B=0;B<this.orbitdefs[l].size;B++){if(!a[B]||u.find(B)!==B)continue;let m=[],F=[],A=0;for(let b=0;b<this.orbitdefs[l].size;b++)u.find(b)===B&&(m[A]=b,F[b]=A,A++);if(L?e.push(\`\${this.orbitnames[l]}_p\${B}\`):e.push(this.orbitnames[l]),f){r.push(new no(A,this.orbitdefs[l].mod)),n.push(this.solved.orbits[l].remapVS(m,A));for(let b=0;b<this.moveops.length;b++)o[b].push(this.moveops[b].orbits[l].remap(m,F,A))}else{r.push(new no(A,1)),n.push(this.solved.orbits[l].remapVS(m,A).killOri());for(let b=0;b<this.moveops.length;b++)o[b].push(this.moveops[b].orbits[l].remap(m,F,A).killOri())}}}return new on(e,r,new ln(n),this.movenames,o.map(l=>new rr(l)))}scramble(e){let r=[];for(let o=0;o<this.moveops.length;o++)r[o]=this.moveops[o];for(let o=0;o<r.length;o++){let l=Math.floor(Math.random()*r.length),i=r[o];r[o]=r[l],r[l]=i}e<r.length&&(e=r.length);for(let o=0;o<e;o++){let l=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),s=Math.floor(Math.random()*this.moveops.length);r[l]=r[l].mul(r[i]).mul(this.moveops[s]),Math.random()<.1&&(r[l]=r[l].mul(this.moveops[s]))}let n=r[0];for(let o=1;o<r.length;o++)n=n.mul(r[o]);this.solved=this.solved.mul(n)}reassemblySize(){let e=1;for(let r=0;r<this.orbitdefs.length;r++)e*=this.orbitdefs[r].reassemblySize();return e}},Ft=class{constructor(e,r,n){this.perm=e;this.ori=r;this.orimod=n}static e(e,r){return new Ft(kt(e),tr(e),r)}mul(e){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let o=0;o<r;o++)n[o]=this.perm[e.perm[o]];return new Ft(n,this.ori,this.orimod)}else{let o=new Array(r);for(let l=0;l<r;l++)n[l]=this.perm[e.perm[l]],o[l]=(this.ori[e.perm[l]]+e.ori[l])%this.orimod;return new Ft(n,o,this.orimod)}}inv(){let e=this.perm.length,r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[this.perm[o]]=o,n[this.perm[o]]=(this.orimod-this.ori[o])%this.orimod;return new Ft(r,n,this.orimod)}equal(e){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==e.perm[n]||this.ori[n]!==e.ori[n])return!1;return!0}killOri(){let e=this.perm.length;for(let r=0;r<e;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let e=this.orimod;if(e===1)return new gt(this.perm);let r=this.perm.length,n=new Array(r*e);for(let o=0;o<r;o++)for(let l=0;l<e;l++)n[o*e+l]=e*this.perm[o]+(this.ori[o]+l)%e;return new gt(n)}identicalPieces(){let e=[],r=this.perm.length,n=[];for(let o=0;o<r;o++){let l=this.perm[o];if(e[l]===void 0){let i=[o];e[l]=!0;for(let s=o+1;s<r;s++)this.perm[s]===l&&i.push(s);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let e=this.perm.length;if(this.perm===kt(e)&&this.ori===tr(e))return!0;for(let r=0;r<e;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let e=this.perm.length;if(this.ori===tr(e))return!0;for(let r=0;r<e;r++)if(this.ori[r]!==0)return!1;return!0}remap(e,r,n){let o=new Array(n),l=new Array(n);for(let i=0;i<n;i++)o[i]=r[this.perm[e[i]]],l[i]=this.ori[e[i]];return new Ft(o,l,this.orimod)}remapVS(e,r){let n=new Array(r),o=new Array(r),l=0,i=[];for(let s=0;s<r;s++){let u=this.perm[e[s]];i[u]===void 0&&(i[u]=l++),n[s]=i[u],o[s]=this.ori[e[s]]}return new Ft(n,o,this.orimod)}appendDefinition(e,r,n,o=!0){if(!(o&&this.isIdentity())&&(e.push(r),e.push(this.perm.map(l=>l+1).join(" ")),!this.zeroOris()))if(n){let l=new Array(this.ori.length);for(let i=0;i<l.length;i++)l[this.perm[i]]=this.ori[i];e.push(l.join(" "))}else e.push(this.ori.join(" "))}toKPuzzle(){let e=this.perm.length;return this.isIdentity()?(Ft.kcache[e]||(Ft.kcache[e]={permutation:kt(e),orientation:tr(e)}),Ft.kcache[e]):{permutation:this.perm,orientation:this.ori}}},Ot=Ft;Ot.kcache=[];Qi=class{constructor(e){this.orbits=e}internalMul(e){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(e.orbits[n]));return r}internalInv(){let e=[];for(let r of this.orbits)e.push(r.inv());return e}equal(e){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(e.orbits[r]))return!1;return!0}killOri(){for(let e of this.orbits)e.killOri();return this}toPerm(){let e=new Array,r=0;for(let o of this.orbits){let l=o.toPerm();e.push(l),r+=l.n}let n=new Array(r);r=0;for(let o of e){for(let l=0;l<o.n;l++)n[r+l]=r+o.p[l];r+=o.n}return new gt(n)}identicalPieces(){let e=[],r=0;for(let n of this.orbits){let o=n.orimod,l=n.identicalPieces();for(let i=0;i<l.length;i++)e.push(l[i].map(s=>s*o+r));r+=o*n.perm.length}return e}order(){let e=1;for(let r of this.orbits)e=Wi(e,r.order());return e}},rr=class extends Qi{constructor(e){super(e)}mul(e){return new rr(this.internalMul(e))}mulScalar(e){if(e===0)return this.e();let r=this;for(e<0&&(r=r.inv(),e=-e);(e&1)==0;)r=r.mul(r),e>>=1;if(e===1)return r;let n=r,o=this.e();for(;e>0;)e&1&&(o=o.mul(n)),e>1&&(n=n.mul(n)),e>>=1;return o}inv(){return new rr(this.internalInv())}e(){return new rr(this.orbits.map(e=>Ot.e(e.perm.length,e.orimod)))}},ln=class extends Qi{constructor(e){super(e)}mul(e){return new ln(this.internalMul(e))}},ji=class{constructor(e){this.n=e;this.heads=new Array(e);for(let r=0;r<e;r++)this.heads[r]=r}find(e){let r=this.heads[e];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[e]=r),r}union(e,r){let n=this.find(e),o=this.find(r);n<o?this.heads[o]=n:n>o&&(this.heads[n]=o)}}});var il,P0=U(()=>{il={"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 sl(t){let e=new _(0,0,0,0);for(let r=0;r<t.length;r++)e=e.sum(t[r]);return e.smul(1/t.length)}function M0(t,e,r,n){let o=n[t].intersect3(n[e],n[r]);if(!o)return o;for(let l=0;l<n.length;l++)if(l!==t&&l!==e&&l!==r){let i=n[l].b*o.b+n[l].c*o.c+n[l].d*o.d;if(n[l].a>0&&i>n[l].a||n[l].a<0&&i<n[l].a)return!1}return o}var Sr,_,al=U(()=>{Sr=1e-9;_=class{constructor(e,r,n,o){this.a=e;this.b=r;this.c=n;this.d=o}mul(e){return new _(this.a*e.a-this.b*e.b-this.c*e.c-this.d*e.d,this.a*e.b+this.b*e.a+this.c*e.d-this.d*e.c,this.a*e.c-this.b*e.d+this.c*e.a+this.d*e.b,this.a*e.d+this.b*e.c-this.c*e.b+this.d*e.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(e){return Math.hypot(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(e){return new _(0,this.c*e.d-this.d*e.c,this.d*e.b-this.b*e.d,this.b*e.c-this.c*e.b)}dot(e){return this.b*e.b+this.c*e.c+this.d*e.d}normalize(){let e=Math.sqrt(this.dot(this));return new _(this.a/e,this.b/e,this.c/e,this.d/e)}makenormal(){return new _(0,this.b,this.c,this.d).normalize()}normalizeplane(){let e=Math.hypot(this.b,this.c,this.d);return new _(this.a/e,this.b/e,this.c/e,this.d/e)}smul(e){return new _(this.a*e,this.b*e,this.c*e,this.d*e)}sum(e){return new _(this.a+e.a,this.b+e.b,this.c+e.c,this.d+e.d)}sub(e){return new _(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new _(this.a,-this.b,-this.c,-this.d)}det3x3(e,r,n,o,l,i,s,u,a){return e*(l*a-i*u)+r*(i*s-o*a)+n*(o*u-l*s)}rotateplane(e){let r=e.mul(new _(0,this.b,this.c,this.d)).mul(e.invrot());return r.a=this.a,r}orthogonal(){let e=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return e<r&&e<n?this.cross(new _(0,1,0,0)).normalize():r<e&&r<n?this.cross(new _(0,0,1,0)).normalize():this.cross(new _(0,0,0,1)).normalize()}pointrotation(e){let r=this.normalize();if(e=e.normalize(),r.sub(e).len()<Sr)return new _(1,0,0,0);let n=r.sum(e);n.len()<Sr?n=n.orthogonal():n=n.normalize();let o=r.cross(n);return o.a=r.dot(n),o}unproject(e){return this.sum(e.smul(-this.dot(e)/(this.len()*e.len())))}rotatepoint(e){return e.mul(this).mul(e.invrot())}rotateface(e){return e.map(r=>r.rotatepoint(this))}intersect3(e,r){let n=this.det3x3(this.b,this.c,this.d,e.b,e.c,e.d,r.b,r.c,r.d);return Math.abs(n)<Sr?!1:new _(0,this.det3x3(this.a,this.c,this.d,e.a,e.c,e.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,e.b,e.a,e.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,e.b,e.c,e.a,r.b,r.c,r.a)/n)}side(e){return e>Sr?1:e<-Sr?-1:0}cutface(e){let r=this.a,n=0,o=null;for(let l=0;l<e.length;l++)n|=1<<this.side(e[l].dot(this)-r)+1;if((n&5)==5){o=[];let l=e.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let s=[];for(let u=0;u<e.length;u++){(l[u]===i||l[u]===0)&&s.push(e[u]);let a=(u+1)%e.length;if(l[u]+l[a]===0&&l[u]!==0){let f=e[u].dot(this)-r,g=e[a].dot(this)-r,L=f/(f-g),B=e[u].smul(1-L).sum(e[a].smul(L));s.push(B)}}o.push(s)}}return o}cutfaces(e){let r=[];for(let n=0;n<e.length;n++){let o=e[n],l=this.cutface(o);l?(r.push(l[0]),r.push(l[1])):r.push(o)}return r}faceside(e){let r=this.a;for(let n=0;n<e.length;n++){let o=this.side(e[n].dot(this)-r);if(o!==0)return o}throw new Error("Could not determine side of plane in faceside")}sameplane(e){let r=this.normalize(),n=e.normalize();return r.dist(n)<Sr||r.dist(n.smul(-1))<Sr}makecut(e){return new _(e,this.b,this.c,this.d)}}});function G0(){let t=Math.sqrt(.5);return[new _(t,t,0,0),new _(t,0,t,0)]}function T0(){return[new _(.5,.5,.5,.5),new _(.5,.5,.5,-.5)]}function I0(){let t=2*Math.PI/10,e=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(e*e+r*r);return e/=n,r/=n,[new _(Math.cos(t),e*Math.sin(t),r*Math.sin(t),0),new _(.5,.5,.5,.5)]}function N0(){let t=1/6+Math.sqrt(5)/6,e=2/3+Math.sqrt(5)/3,r=Math.sqrt(t*t+e*e);t/=r,e/=r;let n=2*Math.PI/6;return[new _(Math.cos(n),t*Math.sin(n),e*Math.sin(n),0),new _(Math.cos(n),-t*Math.sin(n),e*Math.sin(n),0)]}function O0(){let t=Math.sqrt(.5);return[new _(.5,.5,.5,.5),new _(t,0,0,t)]}function _0(t){let e=[new _(1,0,0,0)];for(let r=0;r<e.length;r++)for(let n=0;n<t.length;n++){let o=t[n].mul(e[r]),l=o.smul(-1),i=!1;for(let s=0;s<e.length;s++)if(o.dist(e[s])<ul||l.dist(e[s])<ul){i=!0;break}i||e.push(o)}return e}function qi(t,e){let r=[],n=[];for(let o=0;o<e.length;o++){let l=t.rotateplane(e[o]),i=!1;for(let s=0;s<r.length;s++)if(l.dist(r[s])<ul){i=!0;break}i||(r.push(l),n.push(e[o]))}return n}function Vi(t){let e=[];for(let r=1;r<t.length;r++)for(let n=r+1;n<t.length;n++){let o=M0(0,r,n,t);if(o){let l=!1;for(let i=0;i<e.length;i++)if(o.dist(e[i])<ul){l=!0;break}l||e.push(o)}}for(;;){let r=!1;for(let n=0;n<e.length;n++){let o=(n+1)%e.length;if(t[0].dot(e[n].cross(e[o]))<0){let l=e[n];e[n]=e[o],e[o]=l,r=!0}}if(!r)break}return e}var ul,W0=U(()=>{al();ul=1e-9});function fl(t,e){let r=t[0].p.length,n=E0(r),o=[],l=[],i=[],s=[],u=[];function a(B){for(let p=B.p.length-1;p>=0;p--){let m=B.p[p];if(m!==p){if(!o[p][m])return!1;B=B.mul(l[p][m])}}return!0}function f(B,p,m){s[B].push(p),u[B].push(m);for(let F=0;F<o[B].length;F++)o[B][F]&&g(B,o[B][F].mul(p),m+i[B][F])}function g(B,p,m){let F=p.p[B];if(!o[B][F]){o[B][F]=p,l[B][F]=p.inv(),i[B][F]=m;for(let b=0;b<s[B].length;b++)g(B,p.mul(s[B][b]),m+u[B][b]);return}let A=p.mul(l[B][F]);a(A)||f(B-1,A,m+i[B][F])}function L(){o=[],l=[],s=[],i=[],u=[];for(let m=0;m<r;m++)o.push([]),l.push([]),i.push([]),s.push([]),u.push([]),o[m][m]=n,l[m][m]=n,i[m][m]=0;let B=0,p=1;for(let m=0;m<t.length;m++){f(r-1,t[m],1),p=1;let F=0,A=0,b=[],h=new K0;for(let C=0;C<r;C++){let E=0,q=0;for(let I=0;I<r;I++)o[C][I]&&(E++,q+=i[C][I],C!==I&&B++);F+=s[C].length,p*=E,E>1&&h.multiply(E);let re=q/E;b.push(re),A+=re}e(\`\${m}: sz \${p} T \${F} sol \${A} none \${B} mults \${h.toString()}\`)}return p}return L()}var K0,Hi=U(()=>{ll();K0=class{constructor(){this.mult=[]}multiply(e){for(let r=2;r*r<=e;r++)for(;e%r==0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,e/=r;e>1&&(this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1)}toString(){let e="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(e!==""&&(e+="*"),e+=r,this.mult[r]>1&&(e+=\`^\${this.mult[r]}\`));return e}}});function Yi(t){return t}function Zi(t){}function w1(t,e){let r=[];for(let n of t)for(let o of e)r.push(o.rotate(n));return r}function k1(){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 z1(){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 C1(){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 P1(){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 gl(t,e){for(let r=0;r<t.length;r++)if(t[r][0].dist(e)<be)return r;throw new Error("Element not found")}function Q0(){return il}function j0(t){return il[t]}function ro(t){let e=t.split(/ /).filter(Boolean);if(e.length%2==0)return null;let r=e[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let o=1;o<e.length;o+=2){if(e[o]!=="f"&&e[o]!=="v"&&e[o]!=="e")return null;n.push({cutType:e[o],distance:parseFloat(e[o+1])})}return{shape:r,cuts:n}}function Xi(t,e={}){let r=ro(t);if(r===null)throw new Error("Could not parse the puzzle description");let n=new Bl(r,Object.assign({},{allMoves:!0},e));return n.allstickers(),n.genperms(),n}function an(t,e){return Xi(il[t],e)}function M1(t,e,r){let n=!1;r-e[1]<e[0]&&(t=[t[2],t[3],t[0],t[1]],e=[r-e[1],r-e[0]],n=!0);let o=t[0],l="";if(e[0]===0&&e[1]===r)o=o+"v";else if(e[0]===e[1])e[1]>0&&(l=String(e[1]+1));else if(e[0]===0)o=o.toLowerCase(),e[1]>1&&(l=String(e[1]+1));else throw\`We only support slice and outer block moves right now. \${e}\`;return[l+o,n]}function G1(t,e){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let o="";for(let l of e)t.substr(n).startsWith(l[1])&&l[1].length>o.length&&(o=l[1]);if(o!=="")r.push(o),n+=o.length;else throw new Error("Could not split "+t+" into face names.")}return r}function Ll(t,e){return[t.b/e,-t.c/e,t.d/e]}function Ji(t,e){let r=[],n=t.length;for(let o=0;o<n;o++){let l=Ll(t.get(n-o-1),e);r[3*o]=l[0],r[3*o+1]=l[1],r[3*o+2]=l[2]}return r}var sn,oo,be,v1,E1,Bl,xr,ol=U(()=>{Ae();g0();Ti();Ni();ll();C0();P0();W0();al();Hi();sn=class{constructor(e){this.coords=new Array(e.length*3);for(let r=0;r<e.length;r++)this.coords[3*r]=e[r].b,this.coords[3*r+1]=e[r].c,this.coords[3*r+2]=e[r].d;this.length=e.length}get(e){return new _(0,this.coords[3*e],this.coords[3*e+1],this.coords[3*e+2])}centermass(){let e=0,r=0,n=0;for(let o=0;o<this.length;o++)e+=this.coords[3*o],r+=this.coords[3*o+1],n+=this.coords[3*o+2];return new _(0,e/this.length,r/this.length,n/this.length)}rotate(e){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(e));return new sn(r)}rotateforward(){let e=[];for(let r=1;r<this.length;r++)e.push(this.get(r));return e.push(this.get(0)),new sn(e)}},oo=class{constructor(e,r,n){this.face=e;this.left=r;this.right=n}split(e){let r=e.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new oo(r[0]),this.right=new oo(r[1])):(this.left=this.left?.split(e),this.right=this.right?.split(e))),this}collect(e,r){return this.left===void 0?e.push(new sn(this.face)):r?(this.left?.collect(e,!1),this.right?.collect(e,!0)):(this.right?.collect(e,!1),this.left?.collect(e,!0)),e}};be=1e-9,v1="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",E1=!1;Bl=class{constructor(e,r){this.puzzleDescription=e;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new nn;this.addNotationMapper="";this.setReidOrder=!1;let n=Yi("genperms");this.options=new Ii(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(e),Zi(n)}create(e){let{shape:r,cuts:n}=e;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let o=null;switch(r){case"c":o=G0();break;case"o":o=O0();break;case"i":o=N0();break;case"t":o=T0();break;case"d":o=I0();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=_0(o),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let l=o[0];this.baseplanerot=qi(l,this.rotations);let i=this.baseplanerot.map(D=>l.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let s=k1()[i.length];this.net=s,this.colors=z1()[i.length],this.faceorder=C1()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let u=Vi(i),a=new _(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+u.length);let f=i[0].makenormal(),g=u[0].sum(u[1]).makenormal(),L=u[0].makenormal(),B=new _(1,f.b,f.c,f.d);this.options.verbosity>0&&console.log("# Boundary is "+B);let m=qi(B,this.rotations).map(D=>B.rotateplane(D)),F=Vi(m);this.edgedistance=F[0].sum(F[1]).smul(.5).dist(a),this.vertexdistance=F[0].dist(a);let A=[],b=[],h=!1,C=!1,E=!1;for(let D of n){let v=null,N=0;switch(D.cutType){case"f":v=f,N=1,h=!0;break;case"v":v=L,N=this.vertexdistance,E=!0;break;case"e":v=g,N=this.edgedistance,C=!0;break;default:throw new Error("Bad cut argument: "+D.cutType)}A.push(v.makecut(D.distance)),b.push(D.distance<N)}this.options.addRotations&&(h||A.push(f.makecut(10)),E||A.push(L.makecut(10)),C||A.push(g.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let v=D.rotateface(F);this.basefaces.push(new sn(v))}let q=[],re=[],I=[],ne=[],y=F.length;function z(D,v,N){for(let W of D)if(W[0].dist(v)<be){W.push(N);return}D.push([v,N])}for(let D=0;D<this.baseplanerot.length;D++){let v=this.baseplanerot[D].rotateface(F);for(let N=0;N<v.length;N++){let W=(N+1)%v.length,oe=v[N].sum(v[W]).smul(.5);z(ne,oe,D)}}let M=[];for(let D=0;D<this.baseplanerot.length;D++){let v=this.baseplanerot[D].rotateface(F),N=[];for(let W=0;W<v.length;W++){let oe=(W+1)%v.length,Ke=v[W].sum(v[oe]).smul(.5),it=ne[gl(ne,Ke)];if(D===it[1])N.push(it[2]);else if(D===it[2])N.push(it[1]);else throw new Error("Could not find edge")}M.push(N)}let x={},w=[];w.push(s[0][0]),x[s[0][0]]=0,w[M[0][0]]=s[0][1],x[s[0][1]]=M[0][0];for(let D of s){let v=D[0],N=x[v];if(N===void 0)throw new Error("Bad edge description; first edge not connected");let W=-1;for(let oe=0;oe<M[N].length;oe++){let Ke=w[M[N][oe]];if(Ke!==void 0&&Ke===D[1]){W=oe;break}}if(W<0)throw new Error("First element of a net not known");for(let oe=2;oe<D.length;oe++){if(D[oe]==="")continue;let Ke=M[N][(oe+W-1)%y],it=w[Ke];if(it!==void 0&&it!==D[oe])throw new Error("Face mismatch in net");w[Ke]=D[oe],x[D[oe]]=Ke}}for(let D=0;D<w.length;D++){let v=!1;for(let N=0;N<this.faceorder.length;N++)if(w[D]===this.faceorder[N]){this.faceprecedence[D]=N,v=!0;break}if(!v)throw new Error("Could not find face "+w[D]+" in face order list "+this.faceorder)}for(let D=0;D<this.baseplanerot.length;D++){let v=this.baseplanerot[D].rotateface(F),N=B.rotateplane(this.baseplanerot[D]),W=w[D];q.push([v,W]),re.push([N,W])}for(let D=0;D<this.baseplanerot.length;D++){let v=this.baseplanerot[D].rotateface(F),N=w[D];for(let W=0;W<v.length;W++){let oe=(W+1)%v.length,Ke=v[W].sum(v[oe]).smul(.5),it=(W+2)%v.length,Cg=v[oe].sum(v[it]).smul(.5),Pg=gl(ne,Ke),Mg=gl(ne,Cg);z(I,v[oe],[N,Mg,Pg])}}this.swizzler=new $n(q.map(D=>D[1]));let P=this.swizzler.prefixFree?"":"_";for(let D=0;D<ne.length;D++){if(ne[D].length!==3)throw new Error("Bad length in edge names "+ne[D]);let v=w[ne[D][1]],N=w[ne[D][2]];this.faceprecedence[ne[D][1]]<this.faceprecedence[ne[D][2]]?v=v+P+N:v=N+P+v,ne[D]=[ne[D][0],v]}for(let D=0;D<I.length;D++){if(I[D].length<4)throw new Error("Bad length in vertex names");let v=1;for(let W=2;W<I[D].length;W++)this.faceprecedence[x[I[D][W][0]]]<this.faceprecedence[x[I[D][v][0]]]&&(v=W);let N="";for(let W=1;W<I[D].length;W++){W===1?N=I[D][v][0]:N=N+P+I[D][v][0];for(let oe=1;oe<I[D].length;oe++)if(I[D][v][1]===I[D][oe][2]){v=oe;break}}I[D]=[I[D][0],N]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+q.map(D=>D[1]).join(" ")),console.log("# Edge names: "+ne.map(D=>D[1]).join(" ")),console.log("# Vertex names: "+I.map(D=>D[1]).join(" ")));let K=[];for(let D of re)K.push([D[0].makenormal(),D[1],"f"]);for(let D of ne)K.push([D[0].makenormal(),D[1],"e"]);for(let D of I)K.push([D[0].makenormal(),D[1],"v"]);this.facenames=q,this.faceplanes=re,this.edgenames=ne,this.vertexnames=I,this.geonormals=K;let Y=K.map(D=>D[1]);this.swizzler.setGripNames(Y),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let D=0;D<A.length;D++)for(let v of this.rotations){let N=A[D].rotateplane(v),W=!1;for(let oe of this.moveplanes)if(N.sameplane(oe)){W=!0;break}W||(this.moveplanes.push(N),b[D]&&this.moveplanes2.push(N))}let ge=new oo(F),me=this.moveplanes2.slice(),Fe=31;for(let D=0;D<me.length;D++){let v=D+Math.floor((me.length-D)*(Fe/65536));ge=ge.split(me[v]),me[v]=me[D],Fe=(Fe*1657+101)%65536}let ye=ge.collect([],!0);this.faces=ye,this.options.verbosity>0&&console.log("# Faces is now "+ye.length),this.stickersperface=ye.length;let wt=[],ze=sl(F);for(let D of this.rotations){let v=D.rotateface(F);ze.dist(sl(v))<be&&wt.push(D)}let Je=new Array(ye.length),xe=[];for(let D=0;D<ye.length;D++){let v=ye[D].centermass();xe.push([ze.dist(v),v,D])}xe.sort((D,v)=>D[0]-v[0]);for(let D=0;D<ye.length;D++){let v=xe[D][2];if(!Je[v]){Je[v]=!0;for(let N of wt){let W=ye[v].rotate(N),oe=W.centermass();for(let Ke=D+1;Ke<ye.length&&!(xe[Ke][0]-xe[D][0]>be);Ke++){let it=xe[Ke][2];if(!Je[it]&&oe.dist(xe[Ke][1])<be){Je[it]=!0,ye[it]=W;break}}}}}this.shortedge=1e99;for(let D of ye)for(let v=0;v<D.length;v++){let N=(v+1)%D.length,W=D.get(v).dist(D.get(N));W<this.shortedge&&(this.shortedge=W)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&h&&!C&&!E&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&E&&!h&&!C&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(E||h)&&!C&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&h&&(this.notationMapper=new eo(this.swizzler,new $n(["F","D","L","BL","R","U","BR","B"])),!C&&!E&&(this.addNotationMapper="FTOMapper")),r==="d"&&h&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new eo(this.swizzler,new $n(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(e){return this.keyface2(e.centermass())}keyface2(e){let r="",n=String.fromCharCode;for(let o of this.moveplanesets)if(o.length>0){let l=e.dot(o[0]),i=0,s=1;for(;s*2<=o.length;)s*=2;for(;s>0;s>>=1)i+s<=o.length&&l>o[i+s-1].a&&(i+=s);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(e){let r=e.centermass(),n=[];for(let o of this.moveplanesets)if(o.length>0){let l=r.dot(o[0]),i=0,s=1;for(;s*2<=o.length;)s*=2;for(;s>0;s>>=1)i+s<=o.length&&l>o[i+s-1].a&&(i+=s);n.push(i)}return n}findface(e){let r=this.keyface2(e),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let o=0;o+1<n.length;o++){let l=this.facelisthash.get(r)[o];if(Math.abs(e.dist(this.facecentermass[l]))<be)return l}return n[n.length-1]}project2d(e,r,n){let o=this.facenames[e][0],l=(r+1)%o.length,i=this.baseplanes[e],s=o[l].sub(o[r]),u=s.len();s=s.normalize();let a=s.cross(i).normalize(),f=n[1].sub(n[0]),g=f.len()/u;f=f.normalize();let L=f.b,B=f.c,p=s.smul(L).sub(a.smul(B)).smul(g),m=a.smul(L).sum(s.smul(B)).smul(g),F=new _(0,n[0].b-p.dot(o[r]),n[0].c-m.dot(o[r]),0);return[p,m,F]}allstickers(){let e=Yi("allstickers");this.faces=w1(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 y=0;y<this.faces.length;y++)this.facecentermass[y]=this.faces[y].centermass();let r=[],n=[];for(let y of this.moveplanes){let z=y.makenormal(),M=!1;for(let x of n)z.sameplane(x.makenormal())&&(M=!0);M||(n.push(z),r.push([]))}for(let y of this.moveplanes2){let z=y.makenormal();for(let M=0;M<n.length;M++)if(z.sameplane(n[M])){r[M].push(y);break}}for(let y=0;y<r.length;y++){let z=r[y].map(x=>x.normalizeplane()),M=n[y];for(let x=0;x<z.length;x++)z[x].makenormal().dist(M)>be&&(z[x]=z[x].smul(-1));z.sort((x,w)=>x.a-w.a),r[y]=z}this.moveplanesets=r,this.moveplanenormals=n;let o=r.map(y=>y.length);this.options.verbosity>0&&console.log("# Move plane sets: "+o);let l=[];for(let y=0;y<r.length;y++)l.push([]);for(let y of this.rotations){if(Math.abs(Math.abs(y.a)-1)<be)continue;let z=y.makenormal();for(let M=0;M<r.length;M++)if(z.sameplane(n[M])){l[M].push(y);break}}this.moverotations=l;for(let y=0;y<l.length;y++){let z=l[y],M=z[0].makenormal();for(let x=0;x<z.length;x++)M.dist(z[x].makenormal())>be&&(z[x]=z[x].smul(-1));z.sort((x,w)=>x.angle()-w.angle()),l[y][0].dot(n[y])<0&&z.reverse()}let i=l.map(y=>1+y.length);this.movesetorders=i;let s=[],u="?";for(let y=0;y<r.length;y++){let z=n[y],M=null,x=null;for(let w of this.geonormals){let P=z.dot(w[0]);Math.abs(P-1)<be?(x=[w[1],w[2]],u=w[2]):Math.abs(P+1)<be&&(M=[w[1],w[2]],u=w[2])}if(x===null||M===null)throw new Error("Saw positive or negative sides as null");s.push([x[0],x[1],M[0],M[1],1+r[y].length]),this.addNotationMapper==="NxNxNCubeMapper"&&u==="f"&&(this.notationMapper=new tl(1+r[y].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new nl(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 to(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new rl(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&u==="f"&&(1+r[y].length===3&&(this.notationMapper=new el(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&u==="f"&&(1+r[y].length===3&&(this.notationMapper=new $o(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=s;let a=new Map,f=this.faces;for(let y=0;y<f.length;y++){let z=f[y],M=this.keyface(z);if(!a.get(M))a.set(M,[y]);else{let x=a.get(M);if(x.push(y),x.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let w=0;w<x.length;w++){let P=M+" "+w;a.set(P,[x[w]])}}}}this.facelisthash=a,this.options.verbosity>0&&console.log("# Cubies: "+a.size);let g=[],L=[],B=[];for(let y of a.values())if(y.length!==this.baseFaceCount){if(y.length>1){let z=y.map(P=>f[P].centermass()),M=sl(z);for(let P=0;y.length>2;P++){let K=!1;for(let Y=0;Y<y.length;Y++){let ge=(Y+1)%y.length;if(M.dot(z[Y].cross(z[ge]))<0){let me=z[Y];z[Y]=z[ge],z[ge]=me;let Fe=y[Y];y[Y]=y[ge],y[ge]=Fe,K=!0}}if(!K)break;if(P>1e3)throw new Error("Bad epsilon math; too close to border")}let x=0,w=y[x];for(let P=1;P<y.length;P++){let K=y[P];this.faceprecedence[this.getfaceindex(K)]<this.faceprecedence[this.getfaceindex(w)]&&(x=P,w=K)}if(x!==0){let P=y.slice();for(let K=0;K<y.length;K++)y[K]=P[(x+K)%y.length]}}for(let z=0;z<y.length;z++){let M=y[z];L[M]=g.length,B[M]=z}g.push(y)}this.cubies=g,this.facetocubie=L,this.facetoord=B;let p=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],F=[0,0,0,0,0,0],A=[],b=[],h=0,C=[],E=[],q=[],re=[],I=y=>g[y].map(z=>this.getfaceindex(z)).join(" "),ne=[];for(let y=0;y<g.length;y++){if(b[y])continue;let z=g[y];if(z.length===0)continue;let M={},x=0;q.push(0),ne.push([]);let w=z.length,P=F[w]++,K=p[w];(K===void 0||w===this.baseFaceCount)&&(K="CORE"),K=K+(P===0?"":P+1),m[h]=K,A[h]=w;let Y=[y],ge=0;for(b[y]=!0;ge<Y.length;){let me=Y[ge++],Fe=I(me);if((z.length>1||M[Fe]===void 0)&&(M[Fe]=x++),re[me]=M[Fe],C[me]=h,ne[h].push(me),E[me]=q[h]++,Y.length<this.rotations.length){let ye=this.facecentermass[g[me][0]];for(let wt of l){let ze=this.facetocubie[this.findface(ye.rotatepoint(wt[0]))];b[ze]||(Y.push(ze),b[ze]=!0)}}}h++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let y=[["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 y)for(let x=0;x<M.length;x++){let w=0;for(let P=0;P<M[x].length;P++)w|=1<<M[x].charCodeAt(P)-65;z[w]=x}for(let M of ne)for(let x of M){let w=0;for(let P of g[x])w|=1<<this.facenames[this.getfaceindex(P)][1].charCodeAt(0)-65;E[x]=z[w]}}if(this.cubiesetnums=C,this.cubieordnums=E,this.cubiesetnames=m,this.cubieords=q,this.orbitoris=A,this.cubievaluemap=re,this.cubiesetcubies=ne,this.options.fixedPieceType!==null){for(let y=0;y<g.length;y++)if(this.options.fixedPieceType==="v"&&g[y].length>2||this.options.fixedPieceType==="e"&&g[y].length===2||this.options.fixedPieceType==="f"&&g[y].length===1){this.fixedCubie=y;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),Zi(e)}unswizzle(e){let r=this.notationMapper.notationToInternal(e);return r===null?"":this.swizzler.unswizzle(r.family)}stringToBlockMove(e){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=e.match(r);if(n===null)throw new Error("Bad move passed "+e);let o=n[4],l,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");l=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let s="1",u=1;return n[5]!==void 0&&(s=n[5],s[0]==="'"&&(s="-"+s.substring(1)),u=parseInt(s,10)),new c(new G(o,i,l),u)}parseMove(e){let r=this.notationMapper.notationToInternal(e);if(r===null)throw new Error("Bad move "+e.family);e=r;let n=e.family,o=!1;if(n.endsWith("v")&&n[0]<="Z"){if(e.innerLayer!==void 0||e.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),o=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let l,i=-1,s=this.swizzler.unswizzle(n),u=!1;for(let g=0;g<this.movesetgeos.length;g++){let L=this.movesetgeos[g];s===L[0]&&(u=!0,l=L,i=g),s===L[2]&&(u=!1,l=L,i=g)}let a=1,f=1;if(n.toUpperCase()!==n&&(f=2),l===void 0)throw new Error("Bad grip in move "+e.family);if(e.outerLayer!==void 0&&(a=e.outerLayer),e.innerLayer!==void 0&&(e.outerLayer===void 0?(f=e.innerLayer,n<="Z"?a=f:a=1):f=e.innerLayer),a--,f--,o&&(a=0,f=this.moveplanesets[i].length),a<0||a>this.moveplanesets[i].length||f<0||f>this.moveplanesets[i].length)throw new Error("Bad slice spec "+a+" "+f+" vs "+this.moveplanesets[i].length);if(!E1&&a===0&&f===this.moveplanesets[i].length&&!o)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,a,f,u,e.amount]}parsemove(e){let r=this.parseMove(this.stringToBlockMove(e));return r[0]=e,r}genperms(){let e=Yi("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 o=this.cubies[n][0],l=this.getfaceindex(o);if(this.basefaces[l].centermass().dist(this.facecentermass[o])<be){let i=this.basefaces[l].length;for(let s=1;s<i;s++)this.cubies[n].push(this.cubies[n][s-1]);this.duplicatedFaces[o]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let o=this.moveplanesets[n],l=[],i=[o.length+1,0],s=1;for(;s*2<=o.length;)s*=2;for(let f=0;f<this.faces.length;f++){let g=0;if(o.length>0){let L=this.facecentermass[f].dot(o[0]);for(let B=s;B>0;B>>=1)g+B<=o.length&&L>o[g+B-1].a&&(g+=B);g=o.length-g}for(l.push(g);i.length<=g;)i.push(0);i[g]++}let u=new Array(i.length);for(let f=0;f<i.length;f++)u[f]=[];let a=[];for(let f=0;f<this.faces.length;f++){if(l[f]<0)continue;let g=[this.facetocubie[f],this.facetoord[f]],L=this.facecentermass[f],B=L,p=f,m=l[p];for(;;){l[p]=-1;let F=L.rotatepoint(this.moverotations[n][0]);if(F.dist(B)<be)break;p=this.findface(F),g.push(this.facetocubie[p],this.facetoord[p]),L=F}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[f].dist(this.basefaces[this.getfaceindex(f)].centermass())<be){let F=this.faces[this.cubies[g[0]][0]];for(let A=0;A<g.length;A+=2){let b=this.faces[this.cubies[g[A]][0]],h=-1;for(let C=0;C<F.length;C++)if(b.get(C).dist(F.get(0))<be){h=C;break}if(h<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[A+1]=h,F=F.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let F=1;F<this.movesetorders[n];F++)m===0?g.push(g[0],F):g.push(g[0],(this.movesetorders[n]-F)%this.movesetorders[n]);if(g.length>2&&!a[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let F of g)u[m].push(F)}for(let F=0;F<g.length;F+=2)a[g[F]]=!0}for(let f=0;f<u.length;f++)u[f]=u[f].slice();r.push(u)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let o of this.options.moveList)n.push(this.parsemove(o));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],Zi(e)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(e){let r=this.moveplanesets[e].length,n=[];if(this.parsedmovelist!==void 0)for(let o of this.parsedmovelist)o[1]===e&&(o[4]?n.push([o[2],o[3]]):n.push([r-o[3],r-o[2]]),n.push(o[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let o=this.movesetgeos[e];if(o[1]!==o[3])for(let l=0;l<r;l++)o[1]!=="v"?(this.options.outerBlockMoves?n.push([l+1,r]):n.push([l+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,l]):n.push([l,l]),n.push(1))}else for(let o=0;o<=r;o++)!this.options.allMoves&&o+o===r||(this.options.outerBlockMoves?o+o>r?n.push([o,r]):n.push([0,o]):n.push([o,o]),n.push(1));if(this.fixedCubie>=0){let o=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[e],l=[];for(let i=0;i<n.length;i+=2){let s=n[i];if(o>=s[0]&&o<=s[1])if(s[0]===0)s=[s[1]+1,r];else if(r===s[1])s=[0,s[0]-1];else throw Error("fixed cubie option would disconnect move");let u=!1;for(let a=0;a<l.length;a+=2)if(l[a][0]===s[0]&&l[a][1]===s[1]&&l[a+1]===n[i+1]){u=!0;break}u||(l.push(s),l.push(n[i+1]))}n=l}return n}graybyori(e){let r=this.cubies[e].length;return this.duplicatedCubies[e]&&(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(e){let r=this.cubies[e].length;return this.duplicatedCubies[e]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(e){return this.skipbyori(e)}header(e){return e+v1+\`
|
|
9
9
|
\`+e+\`
|
|
10
10
|
\`}writegap(){let e=this.getOrbitsDef(!1),r=[],n=[];for(let l=0;l<e.moveops.length;l++){let i="M_"+Ki(this.notationMapper,e.movenames[l]),s=!1;i[i.length-1]==="'"&&(i=i.substring(0,i.length-1),s=!0),n.push(i),s?r.push(i+":="+e.moveops[l].toPerm().inv().toGap()+";"):r.push(i+":="+e.moveops[l].toPerm().toGap()+";")}r.push("Gen:=["),r.push(n.join(",")),r.push("];");let o=e.solved.identicalPieces();return r.push("ip:=["+o.map(l=>"["+l.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(e="PuzzleGeometryPuzzle"){let r=this.getOrbitsDef(!1);return this.header("# ")+r.toKsolve(e,this.notationMapper).join(\`
|
|
12
|
-
\`)}getKPuzzleDefinition(e=!0,r=!0){let o=this.getOrbitsDef(e,r).toKPuzzleDefinition(r);if(o.exprimentalPuzzleDescription=this.puzzleDescription,!o)throw new Error("Missing definition!");return o}getMoveFromBits(e,r,n,o,l,i){let s=[],u=[],a=[];for(let L of this.cubieords)u.push(
|
|
12
|
+
\`)}getKPuzzleDefinition(e=!0,r=!0){let o=this.getOrbitsDef(e,r).toKPuzzleDefinition(r);if(o.exprimentalPuzzleDescription=this.puzzleDescription,!o)throw new Error("Missing definition!");return o}getMoveFromBits(e,r,n,o,l,i){let s=[],u=[],a=[];for(let L of this.cubieords)u.push(kt(L)),a.push(tr(L));for(let L=e[0];L<=e[1];L++){let B=o[L];for(let p=0;p<B.length;p+=2*i){let m=B.slice(p,p+2*i),F=this.cubiesetnums[m[0]];for(let h=0;h<m.length;h+=2)m[h]=this.cubieordnums[m[h]];let A=2,b=3;n&&(A=m.length-2,b=m.length-1),u[F]===kt(this.cubieords[F])&&(u[F]=u[F].slice(),this.orbitoris[F]>1&&!this.options.fixedOrientation&&(a[F]=a[F].slice()));for(let h=0;h<m.length;h+=2)u[F][m[(h+A)%m.length]]=m[h],this.orbitoris[F]>1&&!this.options.fixedOrientation&&(a[F][m[h]]=(m[(h+b)%m.length]-m[(h+1)%m.length]+2*this.orbitoris[F])%this.orbitoris[F])}}let f=new Ot(kt(24),tr(24),1);for(let L=0;L<this.cubiesetnames.length;L++)if(!(l&&!l[L]))if(this.orbitoris[L]===1||this.options.fixedOrientation)u[L]===kt(f.perm.length)?(u[L]!==f.perm&&(f=new Ot(u[L],a[L],1)),s.push(f)):s.push(new Ot(u[L],a[L],1));else{let B=new Array(a[L].length);for(let p=0;p<u[L].length;p++)B[p]=a[L][u[L][p]];s.push(new Ot(u[L],B,this.orbitoris[L]))}let g=new rr(s);return r!==1&&(g=g.mulScalar(r)),g}omitSet(e){for(let r of this.options.excludeOrbits)if(r===e)return!0;return!1}diffmvsets(e,r,n,o){for(let l=0;l<e.length;l+=2){let i=!1;for(let s=0;!i&&s<r.length;s+=2)o?e[l][0]+r[s][1]===n&&e[l][1]+r[s][0]===n&&e[l+1]===r[s+1]&&(i=!0):e[l][0]===r[s][0]&&e[l][1]===r[s][1]&&e[l+1]===r[s+1]&&(i=!0);if(!i)return!0}return!1}getOrbitsDef(e,r=!0){let n=[];if(e)for(let L=0;L<this.cubiesetnames.length;L++)n.push(1);let o=[],l=[],i=[],s=[];for(let L=0;L<this.moveplanesets.length;L++){let B=this.getmovesets(L);i.push(B),this.options.addRotations?s.push(1):s.push(0)}if(this.options.moveList&&this.options.addRotations){for(let L=0;L<this.moverotations.length;L++)s[L]=0;for(let L=0;L<this.moveplanesets.length;L++)for(let B=0;B<this.moverotations.length;B++){let p=this.moveplanenormals[L];for(let m=1;m*2<=this.movesetorders[B];m++){if(p=p.rotatepoint(this.moverotations[B][0]),s[B]&m)continue;let F=-1,A=!1;for(let h=0;h<this.moveplanenormals.length;h++)if(p.dist(this.moveplanenormals[h])<be){F=h;break}else if(p.dist(this.moveplanenormals[h].smul(-1))<be){F=h,A=!0;break}if(F<0)throw new Error("Could not find rotation");let b=i[F];(b.length!==i[L].length||this.moveplanesets[L].length!==this.moveplanesets[F].length||this.diffmvsets(b,i[L],this.moveplanesets[F].length,A))&&(s[B]|=m)}}for(let L=0;L<this.moverotations.length;L++)if(s[L]===0)s[L]=1;else if(s[L]===1)this.movesetorders[L]>3?s[L]=2:s[L]=0;else if(s[L]===3)s[L]=0;else throw new Error("Impossible addrot val")}for(let L=0;L<this.moveplanesets.length;L++)s[L]!==0&&(i[L].push([0,this.moveplanesets[L].length]),i[L].push(s[L]));for(let L=0;L<this.moveplanesets.length;L++){let B=i[L],p=this.movesetorders[L];for(let A=0;A<B.length;A+=2)for(let b=0;b<A;b+=2)if(B[A]===B[b]&&B[A+1]===B[b+1])throw new Error("Redundant moves in moveset.");let m=[];for(let A=0;A<B.length;A+=2)for(let b=B[A][0];b<=B[A][1];b++)m[b]=1;let F=this.cmovesbyslice[L];for(let A=0;A<F.length;A++){if(m[A]!==1)continue;let b=F[A];for(let h=0;h<b.length;h+=2*p){if(this.skipcubie(b[h]))continue;let C=this.cubiesetnums[b[h]];n[C]=1}}}for(let L=0;L<this.cubiesetnames.length;L++)if(!!n[L]){if(this.omitSet(this.cubiesetnames[L])){n[L]=0;continue}o.push(this.cubiesetnames[L]),l.push(new no(this.cubieords[L],this.options.fixedOrientation?1:this.orbitoris[L]))}let u=[];for(let L=0;L<this.cubiesetnames.length;L++){if(!n[L]||this.omitSet(this.cubiesetnames[L]))continue;let B=[],p=[];for(let m=0;m<this.cubieords[L];m++){if(e)B.push(m);else{let F=this.cubiesetcubies[L][m];B.push(this.cubievaluemap[F])}p.push(0)}u.push(new Ot(B,p,this.options.fixedOrientation?1:this.orbitoris[L]))}let a=[],f=[];if(r)for(let L=0;L<this.moveplanesets.length;L++){let p=this.moveplanesets[L].length,m=i[L],F=this.movesetgeos[L];for(let A=0;A<m.length;A+=2){let b=m[A],h=M1(F,b,p),C=h[0],E=h[1];m[A+1]===1?a.push(C):a.push(C+m[A+1]);let q=this.getMoveFromBits(b,m[A+1],E,this.cmovesbyslice[L],n,this.movesetorders[L]);f.push(q)}}let g=new on(o,l,new ln(u),a,f);return this.options.optimizeOrbits&&(g=g.optimize()),this.options.scrambleAmount!==0&&g.scramble(this.options.scrambleAmount),g}getMovesAsPerms(){return this.getOrbitsDef(!1).moveops.map(e=>e.toPerm())}showcanon(e){z0(this.getOrbitsDef(!1),e)}getsolved(){let e=[];for(let r=0;r<this.baseFaceCount;r++)for(let n=0;n<this.stickersperface;n++)e.push(r);return new gt(e)}getOrientationRotation(e){let[r,[n,o,l]]=e[0],i=new _(0,n,-o,l),[s,[u,a,f]]=e[1],g=new _(0,u,-a,f),L=null,B=null,p=this.swizzler.unswizzle(r),m=this.swizzler.unswizzle(s);for(let h of this.geonormals)p===h[1]&&(L=h[0]),m===h[1]&&(B=h[0]);if(!L)throw new Error("Could not find feature "+r);if(!B)throw new Error("Could not find feature "+s);let F=L.pointrotation(i);return B.rotatepoint(F).unproject(i).pointrotation(g.unproject(i)).mul(F)}getInitial3DRotation(){let e=this.baseFaceCount,r=null;if(this.options.puzzleOrientation?r=this.options.puzzleOrientation:this.options.puzzleOrientations&&(r=this.options.puzzleOrientations[e]),r||(r=P1()[e]),!r)throw new Error("No default orientation?");return this.getOrientationRotation(r)}generate2dmapping(e=800,r=500,n=10,o=!1,l=.92){e-=2*n,r-=2*n;function i(x,w){let P=x[1][0]-x[0][0],K=x[1][1]-x[0][1],Y=2*Math.PI/w,ge=Math.cos(Y),me=Math.sin(Y);for(let Fe=2;Fe<w;Fe++){let ye=P*ge+K*me;K=K*ge-P*me,P=ye,x.push([x[Fe-1][0]+P,x[Fe-1][1]+K])}}this.genperms();let a=this.getboundarygeometry().facenames[0][0].length,f=this.net;if(f===null)throw new Error("No net?");let g={},L=0,B=0,p=1,m=0;g[f[0][0]]=[[1,0],[0,0]],i(g[f[0][0]],a);for(let x of f){let w=x[0];if(!g[w])throw new Error("Bad edge description; first edge not connected.");for(let P=1;P<x.length;P++){let K=x[P];K===""||g[K]||(g[K]=[g[w][P%a],g[w][(P+a-1)%a]],i(g[K],a))}}for(let x in g){let w=g[x];for(let P of w)L=Math.min(L,P[0]),p=Math.max(p,P[0]),B=Math.min(B,P[1]),m=Math.max(m,P[1])}let F=Math.min(e/(p-L),r/(m-B)),A=.5*(e-F*(p+L)),b=.5*(r-F*(m+B)),h={},C=this.getboundarygeometry(),E={},q=[[F+A,b],[A,b]];E[f[0][0]]=q,i(E[f[0][0]],a),h[this.facenames[0][1]]=this.project2d(0,0,[new _(0,q[0][0],q[0][1],0),new _(0,q[1][0],q[1][1],0)]);let re=[];re[0]=0;for(let x of f){let w=x[0];if(!E[w])throw new Error("Bad edge description; first edge not connected.");let P=-1;for(let Y=0;Y<C.facenames.length;Y++)if(w===C.facenames[Y][1]){P=Y;break}if(P<0)throw new Error("Could not find first face name "+w);let K=C.facenames[P][0];for(let Y=1;Y<x.length;Y++){let ge=x[Y];if(ge===""||E[ge])continue;E[ge]=[E[w][Y%a],E[w][(Y+a-1)%a]],i(E[ge],a);let me=re[P],Fe=K[(me+Y)%a].sum(K[(me+Y+a-1)%a]).smul(.5),ye=gl(C.edgenames,Fe),wt=C.edgenames[ye][1],ze=G1(wt,this.facenames),Je=ze[w===ze[0]?1:0],xe=-1;for(let v=0;v<C.facenames.length;v++)if(Je===C.facenames[v][1]){xe=v;break}if(xe<0)throw new Error("Could not find second face name");let D=C.facenames[xe][0];for(let v=0;v<D.length;v++)if(D[v].sum(D[(v+1)%a]).smul(.5).dist(Fe)<=be){let W=E[w][(Y+a-1)%a],oe=E[w][Y%a];re[xe]=v,h[Je]=this.project2d(xe,v,[new _(0,oe[0],oe[1],0),new _(0,W[0],W[1],0)]);break}}}let I=0,ne=0,y=this.getInitial3DRotation();for(let x of this.faces){o&&(x=x.rotate(y));for(let w=0;w<x.length;w++)I=Math.max(I,Math.abs(x.get(w).b)),ne=Math.max(ne,Math.abs(x.get(w).c))}let z=Math.min(r/ne/2,(e-n)/I/4);return(x,w)=>{if(o){w=w.rotatepoint(y);let P=.5*n+.25*e,K=this.baseplanes[x].rotateplane(y).d<0?1:-1;return[n+e*.5+K*(P-w.b*z),n+r*.5+w.c*z]}else{let P=h[this.facenames[x][1]];return[n+l*w.dot(P[0])+P[2].b,n+r-l*w.dot(P[1])-P[2].c]}}}generatesvg(e=800,r=500,n=10,o=!1){let l=this.generate2dmapping(e,r,n,o);function i(L,B,p){return'<polygon id="'+L+'" class="sticker" style="fill: '+p+'" points="'+B.map(m=>m[0]+" "+m[1]).join(" ")+\`"/>
|
|
13
13
|
\`}let s=this.getsolved(),u=[],a=[];for(let L=0;L<this.baseFaceCount;L++)u[L]=this.colors[this.facenames[L][1]];for(let L=0;L<this.faces.length;L++){let B=this.faces[L],p=Math.floor(L/this.stickersperface),m=[];for(let F=0;F<B.length;F++)m.push(l(p,B.get(F)));a.push(m)}let f=[];for(let L=0;L<this.baseFaceCount;L++){f.push("<g>"),f.push("<title>"+this.facenames[L][1]+\`</title>
|
|
14
14
|
\`);for(let B=0;B<this.stickersperface;B++){let p=L*this.stickersperface+B,m=this.facetocubie[p],F=this.facetoord[p],A=this.cubiesetnums[m],b=this.cubieordnums[m],h=this.graybyori(m)?"#808080":u[s.p[p]],C=this.cubiesetnames[A]+"-l"+b+"-o"+F;if(f.push(i(C,a[p],h)),this.duplicatedFaces[p])for(let E=1;E<this.duplicatedFaces[p];E++)C=this.cubiesetnames[A]+"-l"+b+"-o"+E,f.push(i(C,a[p],h))}f.push("</g>")}return\`<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">
|
|
15
15
|
<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>
|
|
16
|
-
\`+f.join("")+"</svg>"}get3d(e){let r=[],n=this.getInitial3DRotation(),o=[],l=.52*this.basefaces[0].get(0).len();for(let a=0;a<this.basefaces.length;a++){let f=this.basefaces[a].rotate(n),g=this.facenames[a][1];o.push({coords:
|
|
16
|
+
\`+f.join("")+"</svg>"}get3d(e){let r=[],n=this.getInitial3DRotation(),o=[],l=.52*this.basefaces[0].get(0).len();for(let a=0;a<this.basefaces.length;a++){let f=this.basefaces[a].rotate(n),g=this.facenames[a][1];o.push({coords:Ji(f,l),name:g})}for(let a=0;a<this.faces.length;a++){let f=Math.floor(a/this.stickersperface),g=this.facetocubie[a],L=this.facetoord[a],B=this.cubiesetnums[g],p=this.cubieordnums[g],m=this.graybyori(g)?"#808080":this.colors[this.facenames[f][1]];e?.stickerColors&&(m=e.stickerColors[a]);let F=this.faces[a].rotate(n);r.push({coords:Ji(F,l),color:m,orbit:this.cubiesetnames[B],ord:p,ori:L,face:f});let A=F;if(this.duplicatedFaces[a]){let b=A.length/this.duplicatedFaces[a];for(let h=1;h<this.duplicatedFaces[a];h++){for(let C=0;C<b;C++)A=A.rotateforward();r.push({coords:Ji(A,l),color:m,orbit:this.cubiesetnames[B],ord:p,ori:h,face:f,isDup:!0})}}}let i=[];for(let a=0;a<this.movesetgeos.length;a++){let f=this.movesetgeos[a],g=this.movesetorders[a];for(let L of this.geonormals)f[0]===L[1]&&f[1]===L[2]&&(i.push({coordinates:Ll(L[0].rotatepoint(n),1),quantumMove:new c(f[0]),order:g}),i.push({coordinates:Ll(L[0].rotatepoint(n).smul(-1),1),quantumMove:new c(f[2]),order:g}))}let s=this.generate2dmapping(2880,2160,0,!1,1),u=function(){let a=n.invrot();return function(f,g){let L=new _(0,g[0]*l,-g[1]*l,g[2]*l);L=L.rotatepoint(a);let B=s(f,L);return B[0]/=2880,B[1]=1-B[1]/2160,B}}().bind(this);return{stickers:r,faces:o,axis:i,unswizzle:this.unswizzle.bind(this),notationMapper:this.notationMapper,textureMapper:{getuv:u}}}getGeoNormal(e){let r=this.getInitial3DRotation(),n=this.swizzler.unswizzle(e);for(let o of this.geonormals)if(n===o[1]){let l=Ll(o[0].rotatepoint(r),1);return Math.abs(l[0])<be&&Math.abs(l[2])<be&&(l[0]=0,l[2]=1e-6),l}}getfaceindex(e){let r=this.stickersperface;return Math.floor(e/r)}textForTwizzleExplorer(){return\`Faces \${this.baseplanerot.length}
|
|
17
17
|
Stickers per face \${this.stickersperface}
|
|
18
18
|
Short edge \${this.shortedge}
|
|
19
19
|
Cubies \${this.cubies.length}
|
|
20
20
|
Edge distance \${this.edgedistance}
|
|
21
|
-
Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrbitsDef(!1).reassemblySize();e(\`Reassembly size is \${n}\`);let o=
|
|
21
|
+
Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrbitsDef(!1).reassemblySize();e(\`Reassembly size is \${n}\`);let o=fl(this.getMovesAsPerms(),e),l=n/o;e(\`Ratio is \${l}\`)}},xr=class{constructor(e,r){this.pg=e;this.orbitNames=r.orbitnames}lookupMove(e){let r=this.pg.parseMove(e);if(this.pg.parsedmovelist){let i=!1;for(let s of this.pg.parsedmovelist)s[1]===r[1]&&s[2]===r[2]&&s[3]===r[3]&&s[4]===r[4]&&(i=!0);if(!i)return null}let n=[r[2],r[3]];if(!r[4]){let i=this.pg.moveplanesets[r[1]].length;n=[i-r[3],i-r[2]]}let o=this.pg.getMoveFromBits(n,r[5],!r[4],this.pg.cmovesbyslice[r[1]],void 0,this.pg.movesetorders[r[1]]);return on.transformToKTransformationData(this.orbitNames,o)}}});var $i={};Ue($i,{ExperimentalPGNotation:()=>xr,PuzzleGeometry:()=>Bl,Quat:()=>_,getPG3DNamedPuzzles:()=>Q0,getPuzzleDescriptionString:()=>j0,getPuzzleGeometryByDesc:()=>Xi,getPuzzleGeometryByName:()=>an,parseOptions:()=>v0,parsePuzzleDescription:()=>ro,schreierSims:()=>fl});var lo=U(()=>{ol();Ni();al();Hi();ol()});async function io(t){return(await Promise.resolve().then(()=>(lo(),$i))).getPuzzleGeometryByName(t,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function T1(t,e){let r=await t,n=r.getKPuzzleDefinition(!0);n.name=e;let o=await Promise.resolve().then(()=>(lo(),$i)),l=new o.ExperimentalPGNotation(r,r.getOrbitsDef(!0));return new Ie(n,{experimentalPGNotation:l})}var ml,cl,pl,Lt,wr,vr=U(()=>{He();rn();br();Lt=class{constructor(e){te(this,ml,void 0);te(this,cl,void 0);te(this,pl,void 0);this.id=e.id,this.fullName=e.fullName,this.inventedBy=e.inventedBy,this.inventionYear=e.inventionYear}pg(){let e=this.id==="fto"?"FTO":this.id;return R(this,ml)??Q(this,ml,io(e))}kpuzzle(){return R(this,cl)??Q(this,cl,T1(this.pg(),this.id))}svg(){return R(this,pl)??Q(this,pl,(async()=>(await this.pg()).generatesvg())())}};ml=new WeakMap,cl=new WeakMap,pl=new WeakMap;wr=class extends Lt{constructor(){super(...arguments);this.stickerings=tn}appearance(e){return Et(this,e)}}});var q0={};Ue(q0,{cube2x2x2KPuzzleDefinition:()=>zt});var zt,V0=U(()=>{zt={name:"2x2x2",orbits:{CORNERS:{numPieces:8,numOrientations:3}},startStateData:{CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]}},moves:{U:{CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]}},y:{CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]}},x:{CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]}},L:{CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]}},F:{CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]}},R:{CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]}},B:{CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]}},D:{CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}},z:{CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]}}}};zt.moves.Rv=zt.moves.x;zt.moves.Uv=zt.moves.y;zt.moves.Fv=zt.moves.z;zt.moves.Lv={CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]}};zt.moves.Dv={CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}};zt.moves.Bv={CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]}}});var H0={};Ue(H0,{default:()=>I1});var I1,Y0=U(()=>{I1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
22
22
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
23
23
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
24
24
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 520 394" preserveAspectRatio="xMidYMid meet">
|
|
@@ -62,7 +62,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
62
62
|
<use id="CORNERS-l7-o2" xlink:href="#sticker" transform="translate(6.6, 3.2)" style="fill: #26f"/>
|
|
63
63
|
</g>
|
|
64
64
|
|
|
65
|
-
</svg>\`});var so,
|
|
65
|
+
</svg>\`});var so,Z0=U(()=>{He();vr();br();rn();so={id:"2x2x2",fullName:"2\\xD72\\xD72 Cube",kpuzzle:Oe(async()=>new Ie((await Promise.resolve().then(()=>(V0(),q0))).cube2x2x2KPuzzleDefinition)),svg:async()=>(await Promise.resolve().then(()=>(Y0(),H0))).default,pg:Oe(async()=>io("2x2x2")),appearance:t=>Et(so,t),stickerings:tn}});var X0={};Ue(X0,{default:()=>N1});var N1,J0=U(()=>{N1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
66
66
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
67
67
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
68
68
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 518 392" preserveAspectRatio="xMidYMid meet">
|
|
@@ -189,7 +189,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
189
189
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" transform="translate(4.3,7.5)" style="fill: yellow"/>
|
|
190
190
|
</g>
|
|
191
191
|
|
|
192
|
-
</svg>\`});var
|
|
192
|
+
</svg>\`});var $0={};Ue($0,{default:()=>O1});var O1,e2=U(()=>{O1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
193
193
|
<svg width="288px" height="288px" viewBox="-16 -16 288 288" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
194
194
|
<title>3x3x3 LL</title>
|
|
195
195
|
<defs>
|
|
@@ -296,7 +296,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
296
296
|
<use id="CENTERS-l5-o2" xlink:href="#sticker" style="fill: yellow"/>
|
|
297
297
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" style="fill: yellow"/>
|
|
298
298
|
</g>
|
|
299
|
-
</svg>\`});var
|
|
299
|
+
</svg>\`});var es,t2=U(()=>{He();vr();br();rn();es={id:"3x3x3",fullName:"3\\xD73\\xD73 Cube",inventedBy:["Ern\\u0151 Rubik"],inventionYear:1974,kpuzzle:Oe(async()=>Gi),svg:Oe(async()=>(await Promise.resolve().then(()=>(J0(),X0))).default),llSVG:Oe(async()=>(await Promise.resolve().then(()=>(e2(),$0))).default),pg:Oe(async()=>io("3x3x3")),appearance:t=>Et(es,t),stickerings:tn}});var r2={};Ue(r2,{clockKPuzzleDefinition:()=>_1});var _1,n2=U(()=>{_1={name:"Clock",orbits:{DIALS:{numPieces:18,numOrientations:12},FACES:{numPieces:18,numOrientations:1},FRAME:{numPieces:1,numOrientations:2}},startStateData:{DIALS:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{pieces:[0],orientation:[0]}},moves:{UR_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,1,1,0,1,1,0,0,0,-1,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DR_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,-1,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},UL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,0,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},U_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,1,1,1,1,0,0,0,-1,0,-1,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},R_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,1,1,0,1,1,0,1,1,-1,0,0,0,0,0,-1,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},D_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,-1,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},L_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,0,1,1,0,1,1,0,0,0,-1,0,0,0,0,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},ALL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,1,1,1,1,1,1,1,-1,0,-1,0,0,0,-1,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},y2:{DIALS:{permutation:[9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[1]}},UL:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},UR:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DL:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DR:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}}}}});var o2={};Ue(o2,{default:()=>W1});var W1,l2=U(()=>{W1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
300
300
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 480 240" preserveAspectRatio="xMidYMid meet">
|
|
301
301
|
<title>clock</title>
|
|
302
302
|
<defs>
|
|
@@ -664,7 +664,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
664
664
|
</g>
|
|
665
665
|
</g>
|
|
666
666
|
</g>
|
|
667
|
-
</svg>\`});var s2
|
|
667
|
+
</svg>\`});var i2,s2=U(()=>{He();br();i2={id:"clock",fullName:"Clock",inventedBy:["Christopher C. Wiggs","Christopher J. Taylor"],inventionYear:1988,kpuzzle:Oe(async()=>new Ie((await Promise.resolve().then(()=>(n2(),r2))).clockKPuzzleDefinition)),svg:Oe(async()=>(await Promise.resolve().then(()=>(l2(),o2))).default)}});async function a2(t,e){let r=await t.kpuzzle(),n=new Zn(r),o=new Xn(r),l=()=>o.and([o.move("U"),o.not(o.or(o.moves(["F","BL","BR"])))]),i=()=>o.and([o.move("U"),o.not(o.move("F"))]),s=()=>o.or([i(),o.and([o.move("F"),o.not(o.or(o.moves(["U","BL","BR"])))])]),u=()=>o.not(o.or([o.and([o.move("U"),o.move("F")]),o.and([o.move("F"),o.move("BL")]),o.and([o.move("F"),o.move("BR")]),o.and([o.move("BL"),o.move("BR")])])),a=()=>o.not(o.or([o.and([o.move("F"),o.move("BL")]),o.and([o.move("F"),o.move("BR")]),o.and([o.move("BL"),o.move("BR")])]));switch(e){case"full":break;case"experimental-fto-fc":n.set(o.not(l()),S.Ignored);break;case"experimental-fto-f2t":n.set(o.not(i()),S.Ignored),n.set(l(),S.Dim);break;case"experimental-fto-sc":n.set(o.not(s()),S.Ignored),n.set(i(),S.Dim);break;case"experimental-fto-l2c":n.set(o.not(u()),S.Ignored),n.set(s(),S.Dim);break;case"experimental-fto-lbt":n.set(o.not(a()),S.Ignored),n.set(u(),S.Dim);break;case"experimental-fto-l3t":n.set(a(),S.Dim);break;default:console.warn(\`Unsupported stickering for \${t.id}: \${e}. Setting all pieces to dim.\`),n.set(o.and(o.moves([])),S.Dim)}return n.toAppearance()}async function u2(){return["full","experimental-fto-fc","experimental-fto-f2t","experimental-fto-sc","experimental-fto-l2c","experimental-fto-lbt","experimental-fto-l3t"]}var f2=U(()=>{Jn()});var g2,L2,B2=U(()=>{vr();f2();g2=class extends Lt{constructor(){super({id:"fto",fullName:"Face-Turning Octahedron",inventedBy:["Karl Rohrbach","David Pitcher"],inventionYear:1983});this.stickerings=u2}appearance(e){return a2(this,e)}},L2=new g2});async function m2(t,e){switch(e){case"full":case"F2L":case"LL":return Et(t,e);default:console.warn(\`Unsupported stickering for \${t.id}: \${e}. Setting all pieces to dim.\`)}return Et(t,"full")}async function c2(){return["full","F2L","LL"]}var p2=U(()=>{rn()});var R2,d2,D2=U(()=>{vr();p2();R2=class extends Lt{constructor(){super({id:"megaminx",fullName:"Megaminx",inventionYear:1981});this.stickerings=c2}appearance(e){return m2(this,e)}},d2=new R2});var F2={};Ue(F2,{default:()=>K1});var K1,A2=U(()=>{K1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
668
668
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
669
669
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
670
670
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-20 -20 546 480" preserveAspectRatio="xMidYMid meet">
|
|
@@ -751,7 +751,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
751
751
|
<use id="EDGES-l4-o1" xlink:href="#stickerV" transform="translate(1, 1)" style="fill: red"/>
|
|
752
752
|
</g>
|
|
753
753
|
|
|
754
|
-
</svg>\`});var
|
|
754
|
+
</svg>\`});var h2,y2,U2=U(()=>{vr();br();h2=class extends Lt{constructor(){super({id:"pyraminx",fullName:"Pyraminx",inventedBy:["Uwe Meffert"]});this.svg=Oe(async()=>(await Promise.resolve().then(()=>(A2(),F2))).default)}},y2=new h2});var b2={};Ue(b2,{sq1HyperOrbitKPuzzleDefinition:()=>Q1});var Q1,S2=U(()=>{Q1={name:"Square-1",orbits:{WEDGES:{numPieces:24,numOrientations:9},EQUATOR:{numPieces:2,numOrientations:6}},startStateData:{WEDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{pieces:[0,1],orientation:[0,0]}},moves:{U_SQ_:{WEDGES:{permutation:[11,0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,0]}},D_SQ_:{WEDGES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,23,12,13,14,15,16,17,18,19,20,21,22],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,0]}},_SLASH_:{WEDGES:{permutation:[0,1,2,3,4,5,12,13,14,15,16,17,6,7,8,9,10,11,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,3]}}}}});var x2={};Ue(x2,{default:()=>j1});var j1,w2=U(()=>{j1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
755
755
|
<svg width="360px" height="552px" viewBox="0 0 360 552" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
756
756
|
<!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
|
|
757
757
|
<title>sq1-fancy</title>
|
|
@@ -1045,8 +1045,8 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(e){let n=this.getOrb
|
|
|
1045
1045
|
<line x1="0.15767665" y1="262.276878" x2="70.4345542" y2="2.27488928e-16" id="TOP"></line>
|
|
1046
1046
|
</g>
|
|
1047
1047
|
</g>
|
|
1048
|
-
</svg>\`});var
|
|
1049
|
-
\`)){let g=f.split(" ");if(!f.startsWith("SetOrder ")){if(f.startsWith("Alg ")){let L=k.fromString(f.substring(4));n.push({alg:L,transformation:t.algToTransformation(L)})}else if(f.startsWith("SubgroupSizes "))for(let L=1;L<g.length;L++)r.push(parseInt(g[L]))}}let o={ordering:new Array(r.length)},l=[],i=0;l.push(0);let s=k.fromString(""),u=t.identityTransformation();for(let f=0;f<r.length;f++)i+=r[f],l.push(i),n.splice(i-1,0,{alg:s,transformation:u});if(n.length!==i)throw Error(\`Bad sgs; expected \${i-r.length} algs but saw \${n.length-r.length}\`);let a={};for(let f in t.definition.orbits){let g=t.definition.orbits[f];a[f]=new Array(g.numPieces).fill(!1)}for(let f=r.length-1;f>=0;f--){let g=[];for(let B=l[f];B<l[f+1];B++){let p=n[B].transformation;for(let m in t.definition.orbits){let F=t.definition.orbits[m];for(let A=0;A<F.numPieces;A++)(p.transformationData[m].permutation[A]!==A||p.transformationData[m].orientation[A]!==0)&&(a[m][A]||(g.push({orbitName:m,permutationIdx:A}),a[m][A]=!0))}}let L={};for(let B=l[f];B<l[f+1];B++){let p=n[B].transformation.invert(),m="";for(let F=0;F<g.length;F++){let A=g[F];m=\`\${m} \${p.transformationData[A.orbitName].permutation[A.permutationIdx]} \${p.transformationData[A.orbitName].orientation[A.permutationIdx]}\`}L[m]=n[B],n[B].alg=n[B].alg.invert(),n[B].transformation=n[B].transformation.invert()}o.ordering[f]={pieceOrdering:g,lookup:L}}return o}var fn=U(()=>{Ae()});var
|
|
1048
|
+
</svg>\`});var v2,E2=U(()=>{He();br();v2={id:"square1",fullName:"Square-1",inventedBy:["Karel Hr\\u0161el","Vojtech Kopsk\\xFD"],inventionYear:1990,kpuzzle:Oe(async()=>new Ie((await Promise.resolve().then(()=>(S2(),b2))).sq1HyperOrbitKPuzzleDefinition)),svg:Oe(async()=>(await Promise.resolve().then(()=>(w2(),x2))).default)}});var he,_t=U(()=>{s0();He();rn();vr();Z0();t2();s2();B2();D2();U2();E2();Jn();he={"3x3x3":es,"2x2x2":so,"4x4x4":new wr({id:"4x4x4",fullName:"4\\xD74\\xD74 Cube"}),"5x5x5":new wr({id:"5x5x5",fullName:"5\\xD75\\xD75 Cube"}),"6x6x6":new wr({id:"6x6x6",fullName:"6\\xD76\\xD76 Cube"}),"7x7x7":new wr({id:"7x7x7",fullName:"7\\xD77\\xD77 Cube"}),"40x40x40":new wr({id:"40x40x40",fullName:"40\\xD740\\xD740 Cube"}),clock:i2,megaminx:d2,pyraminx:y2,skewb:new Lt({id:"skewb",fullName:"Skewb",inventedBy:["Tony Durham"]}),square1:v2,fto:L2,gigaminx:new Lt({id:"gigaminx",fullName:"Gigaminx",inventedBy:["Tyler Fox"],inventionYear:2006}),master_tetraminx:new Lt({id:"master tetraminx",fullName:"Master Tetraminx",inventedBy:["Katsuhiko Okamoto"],inventionYear:2002})}});function z2(t){k2=t}function rt(){if(!k2)throw new Error("Must be called from inside a worker, to avoid impact on page performance. Try importing from the top level of \`cubing/solve\`?")}var k2,Wt=U(()=>{k2=!1});async function C2(){return globalThis?.crypto?.getRandomValues?crypto.getRandomValues.bind(crypto):(await(q1??(q1=import("crypto")))).webcrypto.getRandomValues}var q1,P2=U(()=>{q1=null});function Y1(t){let e=new Uint32Array(2);t(e);let r=e[0],n=e[1];return Math.floor(r*V1)+Math.floor(n/H1)}function Z1(t){if(typeof t!="number"||t<0||Math.floor(t)!==t)throw new Error("randomInt.below() not called with a positive integer value.");if(t>M2)throw new Error(\`Called randomInt.below() with max == \${t}, which is larger than JavaScript can handle with integer precision.\`)}async function at(){let t=await C2(),e=r=>{Z1(r);let n=Y1(t),o=Math.floor(M2/r)*r;return n<o?n%r:e(r)};return e}var M2,V1,H1,Rl=U(()=>{P2();M2=9007199254740992,V1=2097152,H1=2048});async function Kt(){let t=await at();return e=>e[t(e.length)]}var G2=U(()=>{Rl()});async function T2(t){for(let e=1;e<t.length;e++){let r=(await X1)(e);[t[e],t[r]]=[t[r],t[e]]}}var X1,nr=U(()=>{G2();Rl();Rl();X1=at()});function Ct(t,e){let r=[],n=[];for(let f of e.split(\`
|
|
1049
|
+
\`)){let g=f.split(" ");if(!f.startsWith("SetOrder ")){if(f.startsWith("Alg ")){let L=k.fromString(f.substring(4));n.push({alg:L,transformation:t.algToTransformation(L)})}else if(f.startsWith("SubgroupSizes "))for(let L=1;L<g.length;L++)r.push(parseInt(g[L]))}}let o={ordering:new Array(r.length)},l=[],i=0;l.push(0);let s=k.fromString(""),u=t.identityTransformation();for(let f=0;f<r.length;f++)i+=r[f],l.push(i),n.splice(i-1,0,{alg:s,transformation:u});if(n.length!==i)throw Error(\`Bad sgs; expected \${i-r.length} algs but saw \${n.length-r.length}\`);let a={};for(let f in t.definition.orbits){let g=t.definition.orbits[f];a[f]=new Array(g.numPieces).fill(!1)}for(let f=r.length-1;f>=0;f--){let g=[];for(let B=l[f];B<l[f+1];B++){let p=n[B].transformation;for(let m in t.definition.orbits){let F=t.definition.orbits[m];for(let A=0;A<F.numPieces;A++)(p.transformationData[m].permutation[A]!==A||p.transformationData[m].orientation[A]!==0)&&(a[m][A]||(g.push({orbitName:m,permutationIdx:A}),a[m][A]=!0))}}let L={};for(let B=l[f];B<l[f+1];B++){let p=n[B].transformation.invert(),m="";for(let F=0;F<g.length;F++){let A=g[F];m=\`\${m} \${p.transformationData[A.orbitName].permutation[A.permutationIdx]} \${p.transformationData[A.orbitName].orientation[A.permutationIdx]}\`}L[m]=n[B],n[B].alg=n[B].alg.invert(),n[B].transformation=n[B].transformation.invert()}o.ordering[f]={pieceOrdering:g,lookup:L}}return o}var fn=U(()=>{Ae()});var Q2={};Ue(Q2,{cachedData222:()=>sL,data222:()=>K2});async function sL(){return iL??(iL=K2())}async function K2(){return Ct(await so.kpuzzle(),\`SubgroupSizes 24 21 18 15 12 9 6
|
|
1050
1050
|
|
|
1051
1051
|
Alg F
|
|
1052
1052
|
Alg F2
|
|
@@ -1145,7 +1145,7 @@ Alg F D' F L' D F R2 U2 F' U'
|
|
|
1145
1145
|
Alg F D' L D' L F D2 L2 B' R'
|
|
1146
1146
|
Alg F L' D F R2 D2 L D F' U2
|
|
1147
1147
|
Alg F L' D F2 D' L F L2 F2 U
|
|
1148
|
-
Alg F D F' D L2 F R' F' D' B2 U'\`)}var rL,_2=U(()=>{Ot();fn();rL=null});async function gn(t,e){let r=new ut;r.experimentalPushAlg(t);for(let n of e){let o=(await Kt())(n);o!==null&&r.push(c.fromString(o))}return r.toAlg()}var Rl=U(()=>{Ae();nr()});function q2(t,e){return t.slice(e)+t.slice(0,e)}function gL(t){let e=[[],[]];for(let r=0;r<6;r++)if(t.stateData.CENTERS.pieces[r]!==r)throw new Error("non-oriented puzzles are not supported");for(let r=0;r<12;r++)e[0].push(q2(sL[t.stateData.EDGES.pieces[r]],t.stateData.EDGES.orientation[r]));for(let r=0;r<8;r++)e[1].push(q2(aL[t.stateData.CORNERS.pieces[r]],t.stateData.CORNERS.orientation[r]));return e.push(uL),e}function V2(t){let e=gL(t);return fL.map(([r,n,o])=>e[r][n][o]).join("")}var sL,aL,uL,fL,H2=U(()=>{sL="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),aL="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),uL="U L F R B D".split(" "),fL=[[1,2,0],[0,2,0],[1,1,0],[0,3,0],[2,0,0],[0,1,0],[1,3,0],[0,0,0],[1,0,0],[1,0,2],[0,1,1],[1,1,1],[0,8,1],[2,3,0],[0,10,1],[1,4,1],[0,5,1],[1,7,2],[1,3,2],[0,0,1],[1,0,1],[0,9,0],[2,2,0],[0,8,0],[1,5,1],[0,4,1],[1,4,2],[1,5,0],[0,4,0],[1,4,0],[0,7,0],[2,5,0],[0,5,0],[1,6,0],[0,6,0],[1,7,0],[1,2,2],[0,3,1],[1,3,1],[0,11,1],[2,1,0],[0,9,1],[1,6,1],[0,7,1],[1,5,2],[1,1,2],[0,2,1],[1,2,1],[0,10,0],[2,4,0],[0,11,0],[1,7,1],[0,6,1],[1,6,2]]});function Y2(t,e){let r=new Be(t.kpuzzle,{EDGES:t.stateData.EDGES,CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation(),n=new Be(e.kpuzzle,{EDGES:e.stateData.EDGES,CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation();return r.isIdentical(n)}function Z2(t,e){if(Y2(t.startState(),e))return!1;for(let r of"ULFRBD")for(let n=1;n<4;n++){let o=t.moveToTransformation(new c(r,n)).toKState();if(Y2(o,e))return!1}return!0}var X2=U(()=>{Ae();Ve()});var J2,$2=U(()=>{J2=[["R U'","R2 B","D2 B2","D' L B'","R' U'","B","D B2","R' B","L' U","L2 B'","B2","D L B'","L U","B'","U'","R B","D' B2","L B'","U2","U L' B'","","U' L' B'","U","L' B'"],["F2 L2","F' L'","R' F L2","D' L2","F L2","F2 L'","R' F' L'","R2 F L2","R2 F2 L'","L2","F L'","D' L","D2 L2","R2 F' L'","D L","","L2 F L'","L F' L2","L F L'","F' L2","L'","D L2","D F L'","L"],["R B U2 B'","R2 B U' B'","F2 B U B'","F B2 L' B2","B2 L B2","B U' B'","R2 B U2 B'","R' B U' B'","B2 L' B2","F B U B'","B2 U' B2","B' L B","L F' B D' B'","B' U' B2 D B'","B U2 B'","R B U' B'","B2 L2 B2","D' B' L B","B U B'","F' B2 L' B2","","B2 L' B' U' B'"],["U F2 L2 U'","F' U L' U'","F2 U L' U'","U F L2 U'","U2 B2 U2","R' U' B U","D2 U L U'","D U2 B' U2","U L2 U'","F U L' U'","D U L U'","U2 B' U2","","U2 B' U' L' U'","U2 L' U2","U' B U","U L U'","D' U2 B' U2","U L' U'","U2 B U2"],["R' D' F2","F'","F2","D R F'","R D' F2","R2 F'","D' F2","R F'","F2 R' D' F2","F","D2 F2","D' R F'","R2 D' F2","R' F'","D F2","D2 R F'","","F R' D' F2"],["R' D2 F' D F","R F2 R2 F2","R2 F' D2 F","F' R2 D2 F","L D' L'","D F' D2 F","F2 R2 F2","R F' D2 F","F' R2 D' F","F' R' D2 F","F2 R' F2","L D L'","F' R D' F","F2 R F2","F' D2 F","","L D2 R D' L'","F' D2 F' R F2","D2 R2 F2 R2 F2","D F' D' F","F' D F"],["U F2 U'","R U F' U'","D R U F2 U'","U F U'","R2 U F2 U'","R' U F' U'","R U F2 U'","R2 U F' U'","","U L D L' F U'","F2 D' R D F2","D2 U F U'","R' U F2 U'","U F' U'","F2 D2 R D2 F2","D U F U'"],["R2","R' B' D B","D R'","F' R2 F","","R B' D B","R'","B' D B","D' R'","D2 F' R2 F","R","R2 B' D B","D2 R'","B' D' B"],["R2 D' R2","F' R' F R","R D' R2 D R'","D2 R2 D2 R2","R' D' F' R F","U F D F' U'","","R2 D2 B R' B' R'","R' F D' F2 R F","R2 D R2","F2 U F U' F","R' D F' R F","D R2 D2 R2","U F D' F' U'","D R' D2 F' R F","R2 D2 R2","U F D2 F' U'","R' D2 F' R F"],["B R B'","F D F' B R2 B'","D B R2 B'","D2 B R' B'","B R2 B'","D B R' B'","D' B R2 B'","B R' B'","","B R2 B' D B R' B'","D2 B R2 B'","D' B R' B'"],["","R' D R F D2 F'","R' D R","D F D' F'","R F' R' F","F D' F'","R' D' R","F D2 F'","R' D2 R","F D F'"],["","F2 D2 R F' R' D2 F' D2 F'","F2 D2 F' D' F D' F' D2 F'","F2 D F2 D F2 D2 F2","D2 F L D2 L' D2 F'","D F D2 L D2 L' F'","R' D B' D2 B D' R","R' D2 B' D2 B R","F D2 F' D F D F'","F D' L D2 L' D F'","B D' F D B' D' F'","F D2 L D2 L' F'","F D' L D L' D F'","F L D2 L' D2 F'","R' B' D2 B D2 R"],["D'","F L D L' D' F'","D2","L B D B' D' L'","D","B' L' D' L D B","","D F L D L' D' F'"],["F' D2 F D F' D F","F' D' R' D R F","F' R' D' R D F","B D R D' R' B'","","D B' D' L' D L B"],["D F D F' D F D2 F'","F' U2 B' R' B U2 F' L F' L' F'","","D2 L D L2 F L F2 D F"],["L B' L' F L B L' F'","F2 U F' D2 F U' F' D2 F'","D' F' D B D' F D B'","F L2 F R2 F' L2 F R2 F2","D B D' F' D B' D' F","R F L F' R' F L' F'","","D2 B L' U2 L B' D2 B L' U2 L B'","D2 F R' U2 R F' D2 F R' U2 R F'","R F L' F' R' F L F'","D F D' B' D F' D' B","L2 F2 L' B2 L F2 L' B2 L'"],["L B R' B' L' B R B'","R' B R F' R' B' R F","L D2 L U L' D2 L U' L2","","D2 B' D2 F D' L2 F L2 F' D2 B D' F'","D2 F' R' F R2 B' D2 B D2 R' F D2 F'","L B L' F L B' L' F'","F' D2 F' U' F D2 F' U F2","D' B' D F D' B D F'"],["","D2 F' L U2 L' F D2 F' L U2 L' F","D2 B' R U2 R' B D2 B' R U2 R' B"]]});var ku={};Ue(ku,{initialize:()=>tB,solveState:()=>rB});function eu(){}function BL(t){function e(){}return e.prototype=t||{},new e}function mL(t){return t instanceof Array?t[0]:null}function fo(t,e,r){var n=Dl,o=cL,l=mL,i=n[t],s=l(i);i&&!s?q=i:(q=n[t]=e?o(e):{},q.castableTypeMap$=r,q.constructor=q,!e&&(q.typeMarker$=eu));for(var u=3;u<arguments.length;++u)arguments[u].prototype=q;s&&(q.___clazz$=s)}function cL(t){var e=Dl;return BL(e[t])}function pL(){}function dl(t){return t<<24>>24}function ls(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function is(t,e){var r;return r=new ls,r.packageName=t,r.compoundName=e,r}function lr(t,e,r){var n;return n=is(t,e),dL(r,n),n}function RL(t,e){var r;return r=is(t,e),r.modifiers=2,r}function Fl(t,e){var r;return r=is("",t),r.typeId=e,r.modifiers=1,r}function tu(t,e){var r=t.arrayLiterals=t.arrayLiterals||[];return r[e]||(r[e]=t.createClassLiteralForArray(e))}function DL(t){if(t.isPrimitive())return null;var e=t.typeId,r=Dl[e];return r}function dL(t,e){if(!!t){e.typeId=t;var r=DL(e);if(!r){Dl[t]=[e];return}r.___clazz$=e}}function X(t,e){return tu(t,e)}function Y(t,e,r,n,o,l){var i;return i=nu(o,n),J(X(t,l),e,r,o,i),i}function Ye(t,e,r,n,o,l){return ru(t,e,r,n,o,0,l)}function ru(t,e,r,n,o,l,i){var s,u,a,f,g;if(f=o[l],a=l==i-1,s=a?n:0,g=nu(s,f),J(X(t,i-l),e[l],r[l],s,g),!a)for(++l,u=0;u<f;++u)g[u]=ru(t,e,r,n,o,l,i);return g}function J(t,e,r,n,o){return o.___clazz$=t,o.castableTypeMap$=e,o.typeMarker$=eu,o.__elementTypeId$=r,o.__elementTypeCategory$=n,o}function nu(t,e){var r=new Array(e),n;switch(t){case 6:n={l:0,m:0,h:0};break;case 7:n=0;break;case 8:n=!1;break;default:return r}for(var o=0;o<e;++o)r[o]=n;return r}function ou(t){var e,r,n;return e=t&He,r=t>>22&He,n=t<0?or:0,FL(e,r,n)}function FL(t,e,r){return{l:t,m:e,h:r}}function AL(t,e){var r,n,o;return r=t.l+e.l,n=t.m+e.m+(r>>22),o=t.h+e.h+(n>>22),{l:r&He,m:n&He,h:o&or}}function Ct(t,e){return{l:t.l&e.l,m:t.m&e.m,h:t.h&e.h}}function ss(t){var e,r;return t>-129&&t<128?(e=t+128,hl==null&&(hl=Y($L,ie,293,256,0,1)),r=hl[e],!r&&(r=hl[e]=ou(t)),r):ou(t)}function lu(t,e){var r,n;return r=t.h>>19,n=e.h>>19,r==0?n!=0||t.h>e.h||t.h==e.h&&t.m>e.m||t.h==e.h&&t.m==e.m&&t.l>=e.l:!(n==0||t.h<e.h||t.h==e.h&&t.m<e.m||t.h==e.h&&t.m==e.m&&t.l<e.l)}function as(t,e){return t.l!=e.l||t.m!=e.m||t.h!=e.h}function us(t,e){return{l:t.l|e.l,m:t.m|e.m,h:t.h|e.h}}function Al(t,e){var r,n,o;return e&=63,e<22?(r=t.l<<e,n=t.m<<e|t.l>>22-e,o=t.h<<e|t.m>>22-e):e<44?(r=0,n=t.l<<e-22,o=t.m<<e-22|t.l>>44-e):(r=0,n=0,o=t.l<<e-44),{l:r&He,m:n&He,h:o&or}}function vr(t,e){var r,n,o,l,i;return e&=63,r=t.h,n=(r&LL)!=0,n&&(r|=-1048576),e<22?(i=r>>e,l=t.m>>e|r<<22-e,o=t.l>>e|t.m<<22-e):e<44?(i=n?or:0,l=r>>e-22,o=t.m>>e-22|r<<44-e):(i=n?or:0,l=n?He:0,o=r>>e-44),{l:o&He,m:l&He,h:i&or}}function iu(t,e){var r,n,o;return r=t.l-e.l,n=t.m-e.m+(r>>22),o=t.h-e.h+(n>>22),{l:r&He,m:n&He,h:o&or}}function Er(t){return t.l|t.m<<22}function hL(t){this.string=t}function ir(t,e){return t>e?t:e}function fs(t,e){return t<e?t:e}function yL(t,e){return t.indexOf(e)}function UL(t){return bL(t,0,t.length)}function bL(t,e,r){for(var n="",o=e;o<r;){var l=Math.min(o+1e4,r);n+=String.fromCharCode.apply(null,t.slice(o,l)),o=l}return n}function SL(t){return String.fromCharCode(t&Oe)}function su(t){return t.string+=" ",t}function au(t,e){return t.string+=e,t}function wL(){hL.call(this,"")}function yl(t,e){var r;if(t===e)return!0;if(t.length!=e.length)return!1;for(r=0;r<t.length;++r)if(t[r]!=e[r])return!1;return!0}function kr(){uu||(uu=!0,ar=Ye(De,[ie,Re],[11,0],7,[495,18],2),Dn=Ye(De,[ie,Re],[11,0],7,[324,18],2),cn=Ye(De,[ie,Re],[11,0],7,[336,18],2),sr=Ye(De,[ie,Re],[11,0],7,[495,8],2),Sl=Y(Ee,ve,0,20048,7,1),bl=Y(Ee,ve,0,20791,7,1),Rn=Y(Ee,ve,0,82945,7,1),Ln=Ye(De,[ie,Re],[11,0],7,[2768,10],2),mn=Ye(De,[ie,Re],[11,0],7,[2768,10],2),pn=Ye(De,[ie,Re],[11,0],7,[24,10],2),Bo=Ye(De,[ie,Re],[11,0],7,[24,16],2),zr=Ye(De,[ie,Re],[11,0],7,[140,16],2),Ul=Y(Ee,ve,0,8305,7,1),Bn=Y(Ee,ve,0,48441,7,1))}function vL(t,e,r){return t.slice_0=ar[e.slice_0][r],t.flip=cn[e.flip][(Z(),Pr)[r<<3|e.fsym]],t.fsym=t.flip&7^e.fsym,t.flip>>=3,t.twist=Dn[e.twist][Pr[r<<3|e.tsym]],t.tsym=t.twist&7^e.tsym,t.twist>>=3,t.prun=ir(ir(rt(Sl,t.twist*495+sr[t.slice_0][t.tsym]),rt(bl,t.flip*495+sr[t.slice_0][t.fsym])),rt(Rn,t.twist<<11|gr[t.flip<<3|t.fsym^t.tsym])),t.prun}function EL(t,e,r){return r=(Z(),po)[3][r],t.flipc=cn[e.flipc>>3][Pr[r<<3|e.flipc&7]]^e.flipc&7,t.twistc=Dn[e.twistc>>3][Pr[r<<3|e.twistc&7]]^e.twistc&7,rt(Rn,t.twistc>>3<<11|gr[t.flipc^t.twistc&7])}function fu(t,e,r){var n;return t.twist=(Z(),Ro)[El(e)],t.flip=Cr[vl(e)],t.tsym=t.twist&7,t.twist=t.twist>>3,t.prun=rt(Rn,t.twist<<11|gr[t.flip^t.tsym]),t.prun>r||(t.fsym=t.flip&7,t.flip=t.flip>>3,t.slice_0=494-An(e.ea,8,!0),t.prun=ir(t.prun,ir(rt(Sl,t.twist*495+sr[t.slice_0][t.tsym]),rt(bl,t.flip*495+sr[t.slice_0][t.fsym]))),t.prun>r)?!1:(n=new ue,mo(e,1,n),co(e,1,n),t.twistc=Ro[El(n)],t.flipc=Cr[vl(n)],t.prun=ir(t.prun,rt(Rn,t.twistc>>3<<11|gr[t.flipc^t.twistc&7])),t.prun<=r)}function go(){kr()}function rt(t,e){return kr(),t[e>>3]>>(e<<2)&15}function gu(t){kr(),!(xl==2||xl==1&&!t)&&(xl==0&&(WL(),kL(),CL(),ML(),zL(),Z(),ps(2048,Rs,Cr,Du=Y(De,Re,0,336,7,1),0),ps(2187,As,Ro,Fs=Y(De,Re,0,324,7,1),1),PL(),GL(),TL()),Lo(Ul,pn,Bo,Ln,(Z(),ds),584244,t),Lo(Bn,gs,zr,mn,ds,514084,t),Lo(Sl,ar,sr,Dn,Fs,431619,t),Lo(bl,ar,sr,cn,Du,431619,t),Lo(Rn,null,null,Dn,Fs,103939,t),xl=t?2:1)}function kL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<2768;r++)for(OL(t,(Z(),dn)[r]),n=0;n<10;n++)ur(t,fe[(We(),ht)[n]],e),Ln[r][n]=Cl(Qt[ot(e.ca,8,!1)])&Oe}function zL(){var t,e,r,n,o;for(t=new ue,e=new ue,gs=Ye(De,[ie,Re],[11,0],7,[140,10],2),r=0;r<140;r++){for(xu(t.ca,r%70,0,!1),o=0;o<10;o++)ur(t,(Z(),fe)[(We(),ht)[o]],e),gs[r][o]=An(e.ca,0,!1)+70*(165>>o&1^~~(r/70))&Oe;for(n=0;n<16;n++)mo(t,(Z(),nt)[0][n],e),zr[r][n]=An(e.ca,0,!1)+70*~~(r/70)&Oe}}function CL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<2768;r++)for(cu(t,(Z(),dn)[r]),n=0;n<10;n++)Lt(t,fe[(We(),ht)[n]],e),mn[r][n]=Qt[ot(e.ea,8,!0)]}function PL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<336;r++)for(ms(t,(Z(),Rs)[r]),n=0;n<18;n++)Lt(t,fe[n],e),cn[r][n]=Cr[vl(e)]}function ML(){var t,e,r,n,o;for(t=new ue,e=new ue,r=0;r<24;r++){for(Mr(t.ea,r,12,!0),o=0;o<10;o++)Lt(t,(Z(),fe)[(We(),ht)[o]],e),pn[r][o]=ot(e.ea,12,!0)%24&Oe;for(n=0;n<16;n++)co(t,(Z(),nt)[0][n],e),Bo[r][n]=ot(e.ea,12,!0)%24&Oe}}function Lo(t,e,r,n,o,l,i){var s,u,a,f,g,L,B,p,m,F,A,b,h,C,E,j,te,I,re,y,z,M,x,w,P,W,H,ge,me,Fe,ye,xt,ze,Xe,xe,d;if(h=l&15,A=(l>>4&1)==1?os:0,a=(l>>5&1)==1,s=l>>8&15,f=l>>12&15,g=l>>16&15,F=i?f:g,b=(1<<h)-1,u=e==null,p=u?2048:e.length,m=p*n.length,B=a?10:18,L=B==10?66:599186,E=(t[m>>3]>>(m<<2)&15)-1,E==-1){for(I=0;I<~~(m/8)+1;I++)t[I]=uo;t[0]^=1,E=0}for(;E<F;){for(P=(E+1)*uo^-1,re=0;re<t.length;re++)xe=t[re]^P,xe&=xe>>1,t[re]+=xe&xe>>2&uo;for(M=E>s,Fe=M?E+2:E,me=Fe*uo,C=M?E:E+2,++E,d=E^E+1,Xe=0,I=0;I<m;++I,Xe>>=4){if((I&7)==0&&(Xe=t[I>>3],((Xe^me)-uo&~(Xe^me)&-2004318072)==0)){I+=7;continue}if((Xe&15)==Fe)for(H=I%p,ye=~~(I/p),j=0,te=0,u&&(j=(Z(),Cr)[H],te=j&7,j>>=3),w=0;w<B;w++){if(ze=n[ye][w],u?ge=(Z(),gr)[cn[j][Pr[w<<3|te]]^te^ze&b]:ge=r[e[H][w]][ze&b],ze>>=h,y=ze*p+ge,W=t[y>>3]>>(y<<2)&15,W!=C){W<E-1&&(w+=L>>w&3);continue}if(M){t[I>>3]^=d<<(I<<2);break}for(t[y>>3]^=d<<(y<<2),x=1,xt=o[ze];(xt>>=1)!=0;x++)(xt&1)==1&&(z=ze*p,u?z+=(Z(),gr)[Cr[ge]^x]:z+=r[ge][x^A>>(x<<1)&3],(t[z>>3]>>(z<<2)&15)==C&&(t[z>>3]^=d<<(z<<2)))}}}}function GL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<324;r++)for(cs(t,(Z(),As)[r]),n=0;n<18;n++)ur(t,fe[n],e),Dn[r][n]=Ro[El(e)]}function TL(){var t,e,r,n,o,l,i,s;for(t=new ue,e=new ue,n=0;n<495;n++){for(xu(t.ea,494-n,8,!0),l=0;l<18;l+=3)Lt(t,(Z(),fe)[l],e),ar[n][l]=494-An(e.ea,8,!0)&Oe;for(o=0;o<16;o+=2)co(t,(Z(),nt)[0][o],e),sr[n][o>>1]=494-An(e.ea,8,!0)&Oe}for(r=0;r<495;r++)for(o=0;o<18;o+=3)for(s=ar[r][o],i=1;i<3;i++)s=ar[s][o],ar[r][o+i]=s&Oe}function Z(){Lu||(Lu=!0,Wt=Y(Do,ie,7,16,0,1),fe=Y(Do,ie,7,18,0,1),Ml=Y(eB,ie,0,18,6,1),du=Y(Ee,ve,0,48,7,1),jt=Ye(Ee,[ie,ve],[17,0],7,[16,16],2),nt=Ye(Ee,[ie,ve],[17,0],7,[16,16],2),po=Ye(Ee,[ie,ve],[17,0],7,[16,18],2),Pr=Y(Ee,ve,0,144,7,1),Lr=Ye(Ee,[ie,ve],[17,0],7,[16,18],2),Rs=Y(De,Re,0,336,7,1),As=Y(De,Re,0,324,7,1),dn=Y(De,Re,0,2768,7,1),Fn=Y(ee,le,0,2768,7,1),Ds=Y(De,Re,0,2768,7,1),Pl=Y(ee,le,0,24,7,1),Cr=Y(De,Re,0,2048,7,1),Ro=Y(De,Re,0,2187,7,1),Qt=Y(De,Re,0,40320,7,1),gr=Y(De,Re,0,2688,7,1),hs=new At(2531,1373,67026819,1367),ys=new At(2089,1906,322752913,2040),Gl=J(X(ee,2),ie,10,0,[J(X(ee,1),le,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),J(X(ee,1),le,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),J(X(ee,1),le,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),J(X(ee,1),le,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),J(X(ee,1),le,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),J(X(ee,1),le,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),KL(),QL())}function Ls(t){t.ca=J(X(ee,1),le,0,7,[0,1,2,3,4,5,6,7]),t.ea=J(X(ee,1),le,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function Bu(t){!t.temps&&(t.temps=new ue),ur(ys,t,t.temps),ur(t.temps,hs,t),Lt(ys,t,t.temps),Lt(t.temps,hs,t)}function Bs(t,e){var r,n;for(n=0;n<8;n++)t.ca[n]=e.ca[n];for(r=0;r<12;r++)t.ea[r]=e.ea[r]}function IL(t){return Cl(Qt[ot(t.ca,8,!1)])}function NL(t){return Qt[ot(t.ea,8,!0)]}function vl(t){var e,r;for(r=0,e=0;e<11;e++)r=r<<1|t.ea[e]&1;return r}function El(t){var e,r;for(r=0,e=0;e<7;e++)r+=(r<<1)+(t.ca[e]>>3);return r}function kl(t){var e,r;for(!t.temps&&(t.temps=new ue),r=0;r<12;r++)t.temps.ea[t.ea[r]>>1]=(r<<1|t.ea[r]&1)<<24>>24;for(e=0;e<8;e++)t.temps.ca[t.ca[e]&7]=(e|32>>(t.ca[e]>>3)&24)<<24>>24;Bs(t,t.temps)}function mu(t){var e,r,n,o,l,i,s;for(e=new pu(t),o=new ue,r=Cl(Qt[ot(e.ca,8,!1)])>>4,i={l:0,m:0,h:0},s=0;s<6;s++){if(n=Cl(Qt[ot(e.ca,8,!1)])>>4,r==n)for(l=0;l<16;l++)mo(e,nt[0][l],o),yl(o.ca,t.ca)&&(co(e,nt[0][l],o),yl(o.ea,t.ea)&&(i=us(i,Al({l:1,m:0,h:0},(s<<4|l)<48?s<<4|l:48))));Bu(e),s%3==2&&kl(e)}return i}function OL(t,e){Mr(t.ca,e,8,!1)}function cu(t,e){Mr(t.ea,e,8,!0)}function ms(t,e){var r,n,o;for(n=0,r=10;r>=0;--r,e>>=1)n^=o=e&1,t.ea[r]=(t.ea[r]&-2|o)<<24>>24;t.ea[11]=(t.ea[11]&-2|n)<<24>>24}function cs(t,e){var r,n,o;for(n=15,r=6;r>=0;--r,e=~~(e/3))n-=o=e%3,t.ca[r]=(t.ca[r]&7|o<<3)<<24>>24;t.ca[7]=(t.ca[7]&7|n%3<<3)<<24>>24}function _L(t){var e,r,n,o,l;for(l=0,o=0,n=0;n<12;n++)o|=1<<(t.ea[n]>>1),l^=t.ea[n]&1;if(o!=4095)return-2;if(l!=0)return-3;for(r=0,l=0,e=0;e<8;e++)r|=1<<(t.ca[e]&7),l+=t.ca[e]>>3;return r!=255?-4:l%3!=0?-5:(bs(ot(t.ea,12,!0),12)^bs(ot(t.ca,8,!1),8))!=0?-6:0}function mo(t,e,r){Z();var n,o,l,i,s,u;for(u=Wt[nt[0][e]],s=Wt[e],n=0;n<8;n++)l=u.ca[t.ca[s.ca[n]&7]&7]>>3,i=t.ca[s.ca[n]&7]>>3,o=l<3?i:(3-i)%3,r.ca[n]=(u.ca[t.ca[s.ca[n]&7]&7]&7|o<<3)<<24>>24}function ur(t,e,r){Z();var n,o,l;for(n=0;n<8;n++)o=t.ca[e.ca[n]&7]>>3,l=e.ca[n]>>3,r.ca[n]=(t.ca[e.ca[n]&7]&7|(o+l)%3<<3)<<24>>24}function zl(t,e,r){var n,o,l,i;for(n=0;n<8;n++)l=t.ca[e.ca[n]&7]>>3,i=e.ca[n]>>3,o=l+(l<3?i:6-i),o=o%3+(l<3==i<3?0:3),r.ca[n]=(t.ca[e.ca[n]&7]&7|o<<3)<<24>>24}function ue(){Z(),Ls(this)}function At(t,e,r,n){Ls(this),Mr(this.ca,t,8,!1),cs(this,e),Mr(this.ea,r,12,!0),ms(this,n)}function pu(t){Ls(this),Bs(this,t)}function Cl(t){return Z(),t^os>>((t&15)<<1)&3}function co(t,e,r){Z();var n,o,l;for(l=Wt[nt[0][e]],o=Wt[e],n=0;n<12;n++)r.ea[n]=(l.ea[t.ea[o.ea[n]>>1]>>1]^t.ea[o.ea[n]>>1]&1^o.ea[n]&1)<<24>>24}function Lt(t,e,r){Z();var n;for(n=0;n<12;n++)r.ea[n]=(t.ea[e.ea[n]>>1]^e.ea[n]&1)<<24>>24}function fr(t,e,r){Z();var n;return n=Ds[t],r&&(n=n^os>>((n&15)<<1)&3),n&65520|jt[n&15][e]}function Ru(){return Z(),0}function KL(){var t,e;for(fe[0]=new At(15120,0,119750400,0),fe[3]=new At(21021,1494,323403417,0),fe[6]=new At(8064,1236,29441808,550),fe[9]=new At(9,0,5880,0),fe[12]=new At(1230,412,2949660,0),fe[15]=new At(224,137,328552,137),t=0;t<18;t+=3)for(e=0;e<2;e++)fe[t+e+1]=new ue,Lt(fe[t+e],fe[t],fe[t+e+1]),ur(fe[t+e],fe[t],fe[t+e+1])}function WL(){Z();var t,e,r;for(ps(40320,dn,Qt,ds=Y(De,Re,0,2768,7,1),2),t=new ue,r=0;r<2768;r++)cu(t,dn[r]),Fn[r]=An(t.ea,0,!0)+bs(dn[r],8)*70<<24>>24,kl(t),Ds[r]=Qt[ot(t.ea,8,!0)];for(e=0;e<24;e++)Mr(t.ea,e,12,!0),kl(t),Pl[e]=ot(t.ea,12,!0)%24<<24>>24}function QL(){var t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;for(t=new ue,e=new ue,r=new At(28783,0,259268407,0),m=new At(15138,0,119765538,7),g=new At(5167,0,83473207,0),o=0;o<8;o++)g.ca[o]=dl(g.ca[o]|24);for(l=0;l<16;l++)Wt[l]=new pu(t),zl(t,m,e),Lt(t,m,e),p=e,e=t,t=p,l%4==3&&(zl(p,g,e),Lt(p,g,e),p=e,e=t,t=p),l%8==7&&(zl(p,r,e),Lt(p,r,e),p=e,e=t,t=p);for(i=0;i<16;i++)for(u=0;u<16;u++)for(zl(Wt[i],Wt[u],t),f=0;f<16;f++)if(yl(Wt[f].ca,t.ca)){jt[i][u]=f,nt[f][u]=i;break}for(a=0;a<18;a++)for(B=0;B<16;B++){for(mo(fe[a],nt[0][B],t),L=0;L<18;L++)if(yl(fe[L].ca,t.ca)){po[B][a]=L,Lr[B][(We(),hn)[a]]=hn[L];break}B%2==0&&(Pr[a<<3|B>>1]=po[B][a])}for(n=0;n<18;n++)for(Ml[n]=mu(fe[n]),s=n,B=0;B<48;B++)po[B%16][s]<n&&(du[B]|=1<<n),B%16==15&&(s=Gl[2][s])}function ps(t,e,r,n,o){Z();var l,i,s,u,a,f,g,L,B;for(l=new ue,s=new ue,i=0,a=0,B=o>=2?1:2,f=o!=1,u=0;u<t;u++)if(r[u]==0){switch(o){case 0:ms(l,u);break;case 1:cs(l,u);break;case 2:Mr(l.ea,u,8,!0)}for(g=0;g<16;g+=B){switch(f?co(l,g,s):mo(l,g,s),o){case 0:a=vl(s);break;case 1:a=El(s);break;case 2:a=ot(s.ea,8,!0)}o==0&&(gr[i<<3|g>>1]=a&Oe),a==u&&(n[i]=(n[i]|1<<~~(g/B))&Oe),L=~~((i<<4|g)/B),r[a]=L&Oe}e[i++]=u&Oe}return i}function jL(t,e,r,n,o,l,i,s){var u,a,f,g,L;if(g=ir(rt((kr(),Bn),(i>>4)*140+zr[(Z(),Fn)[s>>4]&255][nt[i&15][s&15]]),ir(rt(Bn,n*140+zr[Fn[e]&255][nt[o][r]]),rt(Ul,e*24+Bo[l][r]))),g>t.maxDep2)return g-t.maxDep2;for(u=t.maxDep2;u>=g&&(L=hu(t,n,o,e,r,l,u,t.depth1,10),!(L<0));u--){for(u-=L,t.solLen=0,t.solution=new Eu,JL(t.solution,t.verbose,t.urfIdx,t.depth1),f=0;f<t.depth1+u;f++)wu(t.solution,t.move[f]);for(a=t.preMoveLen-1;a>=0;a--)wu(t.solution,t.preMoves[a]);t.solLen=t.solution.length_0}return u!=t.maxDep2?(t.maxDep2=fs(Uu,t.solLen-t.length1-1),lu(t.probe,t.probeMin)?0:1):1}function qL(t){var e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;if(t.isRec=!1,lu(t.probe,t.solution?t.probeMin:t.probeMax))return 0;for(t.probe=AL(t.probe,{l:1,m:0,h:0}),n=t.valid1;n<t.depth1;n++)ur(t.phase1Cubie[n],(Z(),fe)[t.move[n]],t.phase1Cubie[n+1]),Lt(t.phase1Cubie[n],fe[t.move[n]],t.phase1Cubie[n+1]);for(t.valid1=t.depth1,s=IL(t.phase1Cubie[t.depth1]),u=s&15,s>>=4,a=NL(t.phase1Cubie[t.depth1]),f=a&15,a>>=4,g=ot(t.phase1Cubie[t.depth1].ea,12,!0)%24,r=fr(a,f,!1),e=fr(s,u,!0),o=t.depth1==0?-1:t.move[t.depth1-1],l=t.preMoveLen==0?-1:t.preMoves[t.preMoveLen-1],m=0,p=(t.preMoveLen==0?1:2)*(t.depth1==0?1:2),L=0,B=(1<<p)-1;L<p;L++){if((B>>L&1)!=0){if(B&=~(1<<L),m=jL(t,s,u,a,f,g,r,e),m==0||m>2)break;m==2&&(B&=4<<L)}if(B==0)break;(L&1)==0&&t.depth1>0?(i=(We(),hn)[~~(o/3)*3+1],t.move[t.depth1-1]=ht[i]*2-t.move[t.depth1-1],g=(kr(),pn)[g][i],s=Ln[s][(Z(),Lr)[u][i]],u=jt[s&15][u],s>>=4,a=mn[a][Lr[f][i]],f=jt[a&15][f],a>>=4,e=fr(s,u,!0),r=fr(a,f,!1)):t.preMoveLen>0&&(i=(We(),hn)[~~(l/3)*3+1],t.preMoves[t.preMoveLen-1]=ht[i]*2-t.preMoves[t.preMoveLen-1],g=(Z(),Pl)[(kr(),pn)[Pl[g]][i]],s=Ln[e>>4][Lr[e&15][i]],e=s&-16|jt[s&15][e&15],s=fr(e>>4,e&15,!0),u=s&15,s>>=4,a=mn[r>>4][Lr[r&15][i]],r=a&-16|jt[a&15][r&15],a=fr(r>>4,r&15,!1),f=a&15,a>>=4)}return t.depth1>0&&(t.move[t.depth1-1]=o),t.preMoveLen>0&&(t.preMoves[t.preMoveLen-1]=l),m==0?0:2}function VL(t){var e;for(t.conjMask=0,t.selfSym=mu(t.cc),t.conjMask|=as(Ct(vr(t.selfSym,16),{l:Oe,m:0,h:0}),{l:0,m:0,h:0})?18:0,t.conjMask|=as(Ct(vr(t.selfSym,32),{l:Oe,m:0,h:0}),{l:0,m:0,h:0})?36:0,t.conjMask|=as(Ct(vr(t.selfSym,48),{l:Oe,m:0,h:0}),{l:0,m:0,h:0})?56:0,t.selfSym=Ct(t.selfSym,{l:He,m:He,h:15}),t.maxPreMoves=t.conjMask>7?0:20,e=0;e<6;e++)Bs(t.urfCubieCube[e],t.cc),fu(t.urfCoordCube[e],t.urfCubieCube[e],20),Bu(t.cc),e%3==2&&kl(t.cc)}function Fu(t,e,r,n,o){var l,i,s,u,a,f;if(e.prun==0&&n<5)return t.allowShorter||n==0?(t.depth1-=n,a=qL(t),t.depth1+=n,a):1;for(f=Ru(ss(r)),l=0;l<18;l+=3)if(!(l==o||l==o-9)){for(s=0;s<3;s++)if(i=l+s,!(t.isRec&&i!=t.move[t.depth1-n]||f!=0&&(f&1<<i)!=0)){if(u=vL(t.nodeUD[n],e,i),u>n)break;if(u==n)continue;if(u=EL(t.nodeUD[n],e,i),u>n)break;if(u==n)continue;if(t.move[t.depth1-n]=i,t.valid1=fs(t.valid1,t.depth1-n),a=Fu(t,t.nodeUD[n],r&Er((Z(),Ml)[i]),n-1,l),a==0)return 0;if(a>=2)break}}return 1}function Au(t,e,r,n,o){var l,i,s;if(t.preMoveLen=t.maxPreMoves-e,(t.isRec?t.depth1==t.length1-t.preMoveLen:t.preMoveLen==0||(225207>>r&1)==0)&&(t.depth1=t.length1-t.preMoveLen,t.phase1Cubie[0]=n,t.allowShorter=t.depth1==Us&&t.preMoveLen!=0,fu(t.nodeUD[t.depth1+1],n,t.depth1)&&Fu(t,t.nodeUD[t.depth1+1],o,t.depth1,-1)==0))return 0;if(e==0||t.preMoveLen+Us>=t.length1)return 1;for(s=Ru(ss(o)),(e==1||t.preMoveLen+1+Us>=t.length1)&&(s|=225207),r=~~(r/3)*3,l=0;l<18;l++){if(l==r||l==r-9||l==r+9){l+=2;continue}if(!(t.isRec&&l!=t.preMoves[t.maxPreMoves-e]||(s&1<<l)!=0)&&(ur((Z(),fe)[l],n,t.preMoveCubes[e]),Lt(fe[l],n,t.preMoveCubes[e]),t.preMoves[t.maxPreMoves-e]=l,i=Au(t,e-1,l,t.preMoveCubes[e],o&Er(Ml[l])),i==0))return 0}return 1}function hu(t,e,r,n,o,l,i,s,u){var a,f,g,L,B,p,m,F,A,b,h;if(e==0&&n==0&&l==0)return i;for(A=(We(),Fo)[u],m=0;m<10;m++){if((A>>m&1)!=0){m+=66>>m&3;continue}if(F=(kr(),pn)[l][m],f=Ln[n][(Z(),Lr)[o][m]],g=jt[f&15][o],f>>=4,B=mn[e][Lr[r][m]],p=jt[B&15][r],B>>=4,L=fr(B,p,!1),a=fr(f,g,!0),b=rt(Bn,(L>>4)*140+zr[Fn[a>>4]&255][nt[L&15][a&15]]),b>i+1)return i-b+1;if(b>=i){m+=66>>m&3&i-b;continue}if(b=ir(rt(Ul,f*24+Bo[F][g]),rt(Bn,B*140+zr[Fn[f]&255][nt[p][g]])),b>=i){m+=66>>m&3&i-b;continue}if(h=hu(t,B,p,f,g,F,i-1,s+1,m),h>=0)return t.move[s]=ht[m],h;if(h<-2)break;h<-1&&(m+=66>>m&3)}return-1}function HL(t){for(t.length1=t.isRec?t.length1:0;t.length1<t.solLen;t.length1++)for(t.maxDep2=fs(Uu,t.solLen-t.length1-1),t.urfIdx=t.isRec?t.urfIdx:0;t.urfIdx<6;t.urfIdx++)if((t.conjMask&1<<t.urfIdx)==0&&Au(t,t.maxPreMoves,-30,t.urfCubieCube[t.urfIdx],Er(Ct(t.selfSym,{l:Oe,m:0,h:0})))==0)return t.solution?vu(t.solution):"Error 8";return t.solution?vu(t.solution):"Error 7"}function YL(t,e){var r;return r=ZL(t,e),r!=0?"Error "+(r<0?-r:r):(t.solLen=22,t.probe={l:0,m:0,h:0},t.probeMax={l:3531008,m:23,h:0},t.probeMin={l:0,m:0,h:0},t.verbose=0,t.solution=null,t.isRec=!1,gu(!1),VL(t),HL(t))}function ZL(t,e){var r,n,o,l;for(n=0,o=Y(ee,le,0,54,7,1),r=UL(J(X(De,1),Re,0,7,[e.charCodeAt(4),e.charCodeAt(13),e.charCodeAt(22),e.charCodeAt(31),e.charCodeAt(40),e.charCodeAt(49)])),l=0;l<54;l++){if(o[l]=yL(r,SL(e.charCodeAt(l)))<<24>>24,o[l]==-1)return-1;n+=1<<(o[l]<<2)}return n!=10066329?-1:(XL(o,t.cc),_L(t.cc))}function yu(){var t,e,r;for(this.move=Y(Ee,ve,0,31,7,1),this.nodeUD=Y(wl,ie,31,21,0,1),this.nodeRL=Y(wl,ie,31,21,0,1),this.nodeFB=Y(wl,ie,31,21,0,1),this.cc=new ue,this.urfCubieCube=Y(Do,ie,7,6,0,1),this.urfCoordCube=Y(wl,ie,31,6,0,1),this.phase1Cubie=Y(Do,ie,7,21,0,1),this.preMoveCubes=Y(Do,ie,7,21,0,1),this.preMoves=Y(Ee,ve,0,20,7,1),e=0;e<21;e++)this.nodeUD[e]=new go,this.nodeRL[e]=new go,this.nodeFB[e]=new go,this.phase1Cubie[e]=new ue;for(r=0;r<6;r++)this.urfCubieCube[r]=new ue,this.urfCoordCube[r]=new go;for(t=0;t<20;t++)this.preMoveCubes[t+1]=new ue}function We(){if(!bu){bu=!0;var t,e,r,n,o,l;for(Gr=J(X(ee,2),ie,10,0,[J(X(ee,1),le,0,7,[8,9,20]),J(X(ee,1),le,0,7,[6,18,38]),J(X(ee,1),le,0,7,[0,36,47]),J(X(ee,1),le,0,7,[2,45,11]),J(X(ee,1),le,0,7,[29,26,15]),J(X(ee,1),le,0,7,[27,44,24]),J(X(ee,1),le,0,7,[33,53,42]),J(X(ee,1),le,0,7,[35,17,51])]),Vt=J(X(ee,2),ie,10,0,[J(X(ee,1),le,0,7,[5,10]),J(X(ee,1),le,0,7,[7,19]),J(X(ee,1),le,0,7,[3,37]),J(X(ee,1),le,0,7,[1,46]),J(X(ee,1),le,0,7,[32,16]),J(X(ee,1),le,0,7,[28,25]),J(X(ee,1),le,0,7,[30,43]),J(X(ee,1),le,0,7,[34,52]),J(X(ee,1),le,0,7,[23,12]),J(X(ee,1),le,0,7,[21,41]),J(X(ee,1),le,0,7,[50,39]),J(X(ee,1),le,0,7,[48,14])]),qt=Ye(Ee,[ie,ve],[17,0],7,[13,13],2),Ss=J(X(xL,1),ie,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),ht=J(X(Ee,1),ve,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),hn=Y(Ee,ve,0,18,7,1),Fo=Y(Ee,ve,0,11,7,1),e=0;e<18;e++)hn[ht[e]]=e;for(r=0;r<10;r++)for(n=~~(ht[r]/3),Fo[r]=0,o=0;o<10;o++)l=~~(ht[o]/3),Fo[r]|=(n==l||n%3==l%3&&n>=l?1:0)<<o;for(Fo[10]=0,t=0;t<13;t++)for(qt[t][0]=qt[t][t]=1,o=1;o<t;o++)qt[t][o]=qt[t-1][o-1]+qt[t-1][o]}}function An(t,e,r){We();var n,o,l,i,s;for(n=t.length-1,l=0,s=4,o=n;o>=0;o--)i=Su(t[o],r),(i&12)==e&&(l+=qt[o][s--]);return l}function bs(t,e){We();var r,n;for(n=0,r=e-2;r>=0;r--)n^=t%(e-r),t=~~(t/(e-r));return n&1}function ot(t,e,r){We();var n,o,l,i;for(o=0,i={l:1323536,m:2777561,h:1043915},n=0;n<e-1;n++)l=Su(t[n],r)<<2,o=(e-n)*o+Er(Ct(vr(i,l),{l:15,m:0,h:0})),i=iu(i,Al({l:1118480,m:279620,h:69905},l));return o}function Su(t,e){return e?t>>1:t&7}function xu(t,e,r,n){We();var o,l,i,s;for(o=t.length-1,s=4,l=o,i=o;i>=0;i--)e>=qt[i][s]?(e-=qt[i][s--],t[i]=Tl(t[i],s|r,n)):((l&12)==r&&(l-=4),t[i]=Tl(t[i],l--,n))}function Mr(t,e,r,n){We();var o,l,i,s,u,a;for(a={l:1323536,m:2777561,h:1043915},o={l:0,m:0,h:0},s=2;s<=r;s++)o=us(Al(o,4),ss(e%s)),e=~~(e/s);for(l=0;l<r-1;l++)u=(Er(o)&15)<<2,o=vr(o,4),t[l]=Tl(t[l],Er(Ct(vr(a,u),{l:15,m:0,h:0})),n),i=iu(Al({l:1,m:0,h:0},u),{l:1,m:0,h:0}),a=us(Ct(a,i),Ct(vr(a,4),{l:~i.l&He,m:~i.m&He,h:~i.h&or}));t[r-1]=Tl(t[r-1],Er(Ct(a,{l:15,m:0,h:0})),n)}function Tl(t,e,r){return(r?e<<1|t&1:e|t&-8)<<24>>24}function XL(t,e){We();var r,n,o,l,i,s,u,a;for(l=0;l<8;l++)e.ca[l]=0;for(i=0;i<12;i++)e.ea[i]=0;for(s=0;s<8;s++){for(a=0;a<3&&!(t[Gr[s][a]]==0||t[Gr[s][a]]==3);a++);for(r=t[Gr[s][(a+1)%3]],n=t[Gr[s][(a+2)%3]],u=0;u<8;u++)if(r==~~(Gr[u][1]/9)&&n==~~(Gr[u][2]/9)){e.ca[s]=dl(a%3<<3|u);break}}for(o=0;o<12;o++)for(u=0;u<12;u++){if(t[Vt[o][0]]==~~(Vt[u][0]/9)&&t[Vt[o][1]]==~~(Vt[u][1]/9)){e.ea[o]=dl(u<<1);break}if(t[Vt[o][0]]==~~(Vt[u][1]/9)&&t[Vt[o][1]]==~~(Vt[u][0]/9)){e.ea[o]=dl(u<<1|1);break}}}function wu(t,e){var r,n,o;if(t.length_0==0){t.moves[t.length_0++]=e;return}if(r=~~(e/3),n=~~(t.moves[t.length_0-1]/3),r==n){o=(e%3+t.moves[t.length_0-1]%3+1)%4,o==3?--t.length_0:t.moves[t.length_0-1]=r*3+o;return}if(t.length_0>1&&r%3==n%3&&r==~~(t.moves[t.length_0-2]/3)){o=(e%3+t.moves[t.length_0-2]%3+1)%4,o==3?(t.moves[t.length_0-2]=t.moves[t.length_0-1],--t.length_0):t.moves[t.length_0-2]=r*3+o;return}t.moves[t.length_0++]=e}function JL(t,e,r,n){t.verbose=e,t.urfIdx=r,t.depth1=n}function vu(t){var e,r,n;if(r=new wL,n=(t.verbose&2)!=0?(t.urfIdx+3)%6:t.urfIdx,n<3)for(e=0;e<t.length_0;e++)(t.verbose&1)!=0&&e==t.depth1&&(r.string+=". "),su(au(r,(We(),Ss)[(Z(),Gl)[n][t.moves[e]]]));else for(e=t.length_0-1;e>=0;e--)su(au(r,(We(),Ss)[(Z(),Gl)[n][t.moves[e]]])),(t.verbose&1)!=0&&e==t.depth1&&(r.string+=". ");return r.string}function Eu(){this.moves=Y(Ee,ve,0,31,7,1)}var ie,He,or,LL,Oe,Re,ve,os,uo,le,q,Dl,hl,xL,uu,zr,gs,Ln,Bn,mn,cn,Ul,Bo,pn,Rn,Dn,sr,bl,ar,Sl,xl,wl,Lu,Wt,Qt,dn,Cr,Rs,gr,Pl,Fn,Ds,Pr,po,Lr,jt,nt,Du,ds,Fs,Ro,As,du,fe,Ml,hs,ys,Gl,Do,Uu,Us,bu,qt,Fo,Gr,Vt,Ss,hn,ht,Ee,$L,ee,eB,De,tB,rB,zu=U(()=>{ie={3:1},He=4194303,or=1048575,LL=524288,Oe=65535,Re={11:1,3:1},ve={17:1,3:1},os=14540032,uo=286331153,le={10:1,3:1},Dl={};fo(1,null,{},pL);fo(79,1,{},ls);q.createClassLiteralForArray=function(e){var r;return r=new ls,r.modifiers=4,e>1?r.componentType=tu(this,e-1):r.componentType=this,r};q.isPrimitive=function(){return(this.modifiers&1)!=0};xL=lr("java.lang","String",2);uu=!1;fo(31,1,{31:1},go);q.flip=0;q.flipc=0;q.fsym=0;q.prun=0;q.slice_0=0;q.tsym=0;q.twist=0;q.twistc=0;xl=0,wl=lr("org.cubing.min2phase.client","CoordCube",31),Lu=!1;Do=lr("org.cubing.min2phase.client","CubieCube",7);fo(72,1,{},yu);q.allowShorter=!1;q.conjMask=0;q.depth1=0;q.isRec=!1;q.length1=0;q.maxDep2=0;q.maxPreMoves=0;q.preMoveLen=0;q.probe={l:0,m:0,h:0};q.probeMax={l:0,m:0,h:0};q.probeMin={l:0,m:0,h:0};q.selfSym={l:0,m:0,h:0};q.solLen=0;q.urfIdx=0;q.valid1=0;q.verbose=0;Uu=12,Us=7,bu=!1;fo(150,1,{},Eu);q.depth1=0;q.length_0=0;q.urfIdx=0;q.verbose=0;Ee=Fl("int","I");lr("com.google.gwt.lang","CollapsedPropertyHolder",252);lr("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);$L=lr("com.google.gwt.lang","LongLibBase/LongEmul",null);lr("com.google.gwt.lang","ModuleUtils",257);ee=Fl("byte","B"),eB=Fl("long","J"),De=Fl("char","C");lr("com.google.gwt.user.client.rpc","XsrfToken",null),RL("java.util","Map/Entry");tB=function(){gu(!1)},rB=function(t){return YL(new yu,t)}});async function Cu(){let t=await he["3x3x3"].kpuzzle(),e=t.startState();for(let r of J2)e=e.applyAlg(k.fromString((await Kt())(r)));return Z2(t,e)?e:Cu()}function Pu(){return nB??(nB=Promise.resolve().then(()=>(zu(),ku)))}async function xs(t){return tt(),k.fromString((await Pu()).solveState(V2(t)))}async function yn(){return xs(await Cu())}async function Mu(){(await Pu()).initialize()}async function Gu(){return gn(await yn(),oB)}async function Iu(){let t=new ut,e=await yn();return t.experimentalPushAlg(Tu),t.experimentalPushAlg(e),t.experimentalPushAlg(Tu),t.toAlg()}var nB,oB,Tu,ws=U(()=>{Ae();Ot();nr();_t();Rl();H2();X2();$2();nB=null;oB=[[null,"Rw","Rw2","Rw'","Fw","Fw'"],[null,"Dw","Dw2","Dw'"]];Tu=new k("R' U' F")});function se(t,...e){let r=e.length,n=t[e[r-1]];for(let o=r;o>0;o--)t[e[o]]=t[e[o-1]];return t[e[0]]=n,se}function Nu(t,e,r,n){r=(r||8)-1;let o=1985229328,l=0;n??(n=0),n<0&&(e<<=1);for(let i=0;i<r;++i){let s=vs[r-i],u=~~(e/s);l^=u,e%=s,u<<=2,t[i]=o>>u&7;let a=(1<<u)-1;o=(o&a)+(o>>4&~a)}return n<0&&(l&1)!=0?(t[r]=t[r-1],t[r-1]=o&7):t[r]=o&7,t}var Le,vs,Ou=U(()=>{Le=[],vs=[1];for(let t=0;t<32;++t){Le[t]=[];for(let e=0;e<32;++e)Le[t][e]=0}for(let t=0;t<32;++t){Le[t][0]=Le[t][t]=1,vs[t+1]=vs[t]*(t+1);for(let e=1;e<t;++e)Le[t][e]=Le[t-1][e-1]+Le[t-1][e]}});var Hf={};Ue(Hf,{initialize:()=>dm,random444Scramble:()=>Fm});function T(t,e){let r=new Array(t);if(e!==void 0)for(let n=0;n<t;n++)r[n]=new Array(e);return r}function gB(t){return new Ao[t]}function at(t,e,r,...n){let o=Ao[t];o&&!o.___clazz$?V=o.prototype:(!o&&(o=Ao[t]=function(){}),V=o.prototype=e<0?{}:gB(e),V.castableTypeMap$=r);for(let l of n)l.prototype=V;o.___clazz$&&(V.___clazz$=o.___clazz$,o.___clazz$=null)}function Br(t){let e={};for(let r=0,n=t.length;r<n;++r)e[t[r]]=1;return e}function Qu(){}function LB(t,e){let r=ju(0,e);return qu(t.___clazz$,t.castableTypeMap$,t.queryId$,r),r}function ju(t,e){let r=new Array(e);if(t===3)for(let n=0;n<e;++n){let o={m:0,l:0,h:0};o.l=o.m=o.h=0,r[n]=o}else if(t>0){let n=[null,0,!1][t];for(let o=0;o<e;++o)r[o]=n}return r}function zs(t,e,r,n,o){let l=ju(o,n);return qu(t,e,r,l),l}function qu(t,e,r,n){return Hu(),mB(n,Cs,Ps),n.___clazz$=t,n.castableTypeMap$=e,n.queryId$=r,n}function Il(t,e,r){return t[e]=r}function Hu(){Vu||(Vu=!0,Cs=[],Ps=[],BB(new Qu,Cs,Ps))}function BB(t,e,r){let n=0,o;for(let l in t)(o=t[l])&&(e[n]=l,r[n]=o,++n)}function mB(t,e,r){Hu();for(let n=0,o=e.length;n<o;++n)t[e[n]]=r[n]}function cB(t,e){return t.castableTypeMap$&&!!t.castableTypeMap$[e]}function pB(t,e){return t!==null&&cB(t,e)}function RB(){if(Yu)return!1;Yu=!0,Wl=T(15582,36),Ql=T(15582),Ut=T(15582),Sn=T(48,48),bt=T(48,36),bn=T(48),Ts=T(48)}function Ms(t){t.ct=T(24)}function Zu(t,e){let r,n;if(pB(e,Ku)){for(r=e,n=0;n<24;++n)if(t.ct[n]!==r.ct[n])return!1;return!0}return!1}function Nl(t){let e,r,n;for(r=0,n=8,e=23;e>=0;--e)t.ct[e]===1&&(r+=Le[e][n--]);return r}function Ol(t){let e,r;if(Un!==null)return Un[Nl(t)];for(r=0;r<48;++r){if(e=yB(Nl(t)),e!==-1)return e*64+r;oe(t,0),r%2==1&&oe(t,1),r%8==7&&oe(t,2),r%16==15&&oe(t,3)}}function yt(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:D(t.ct,0,1,2,3,r);break;case 1:D(t.ct,16,17,18,19,r);break;case 2:D(t.ct,8,9,10,11,r);break;case 3:D(t.ct,4,5,6,7,r);break;case 4:D(t.ct,20,21,22,23,r);break;case 5:D(t.ct,12,13,14,15,r);break;case 6:D(t.ct,0,1,2,3,r),D(t.ct,8,20,12,16,r),D(t.ct,9,21,13,17,r);break;case 7:D(t.ct,16,17,18,19,r),D(t.ct,1,15,5,9,r),D(t.ct,2,12,6,10,r);break;case 8:D(t.ct,8,9,10,11,r),D(t.ct,2,19,4,21,r),D(t.ct,3,16,5,22,r);break;case 9:D(t.ct,4,5,6,7,r),D(t.ct,10,18,14,22,r),D(t.ct,11,19,15,23,r);break;case 10:D(t.ct,20,21,22,23,r),D(t.ct,0,8,4,14,r),D(t.ct,3,11,7,13,r);break;case 11:D(t.ct,12,13,14,15,r),D(t.ct,1,20,7,18,r),D(t.ct,0,23,6,17,r)}}function oe(t,e){switch(e){case 0:yt(t,19),yt(t,28);break;case 1:yt(t,21),yt(t,32);break;case 2:D(t.ct,0,3,1,2,1),D(t.ct,8,11,9,10,1),D(t.ct,4,7,5,6,1),D(t.ct,12,15,13,14,1),D(t.ct,16,19,21,22,1),D(t.ct,17,18,20,23,1);break;case 3:yt(t,18),yt(t,29),yt(t,24),yt(t,35)}}function Xu(t,e){let r;for(r=0;r<e;++r)oe(t,0),r%2==1&&oe(t,1),r%8==7&&oe(t,2),r%16==15&&oe(t,3)}function Gs(t,e){let r,n;for(n=8,r=23;r>=0;--r)t.ct[r]=0,e>=Le[r][n]&&(e-=Le[r][n--],t.ct[r]=1)}function _l(t,e){let r;for(r=0;r<24;++r)t.ct[r]=e.ct[r]}function ho(){let t;for(Ms(this),t=0;t<8;++t)this.ct[t]=1;for(t=8;t<24;++t)this.ct[t]=0}function Kl(t,e){let r;for(Ms(this),r=0;r<24;++r)this.ct[r]=~~(t.ct[r]/2)===e?1:0}function yo(t){let e;for(Ms(this),e=0;e<24;++e)this.ct[e]=t[e]}function DB(){let t,e,r=new ho,n=new ho;for(t=0;t<15582;++t)for(Gs(n,Ql[t]),e=0;e<36;++e)_l(r,n),yt(r,e),Wl[t][e]=Ol(r)}function dB(){let t,e,r,n,o,l,i,s;for(ai(Ut),Ut[0]=0,e=0,r=1;r!==15582;)for(l=e>4,s=l?-1:e,t=l?e:-1,++e,n=0;n<15582;++n)if(Ut[n]===s){for(i=0;i<27;++i)if(o=~~Wl[n][i]>>>6,Ut[o]===t)if(++r,l){Ut[n]=e;break}else Ut[o]=e}}function FB(t){let e,r,n,o=new yo(t.ct);for(n=0;n<48;++n){for(e=!0,r=0;r<24;++r)if(o.ct[r]!==~~(r/4)){e=!1;break}if(e)return n;oe(o,0),n%2==1&&oe(o,1),n%8==7&&oe(o,2),n%16==15&&oe(o,3)}return-1}function AB(){let t,e,r,n=new ho;for(t=0;t<24;++t)n.ct[t]=t;let o=new yo(n.ct),l=new yo(n.ct),i=new yo(n.ct);for(t=0;t<48;++t){for(e=0;e<48;++e){for(r=0;r<48;++r)Zu(n,o)&&(Sn[t][e]=r,r===0&&(bn[t]=e)),oe(o,0),r%2==1&&oe(o,1),r%8==7&&oe(o,2),r%16==15&&oe(o,3);oe(n,0),e%2==1&&oe(n,1),e%8==7&&oe(n,2),e%16==15&&oe(n,3)}oe(n,0),t%2==1&&oe(n,1),t%8==7&&oe(n,2),t%16==15&&oe(n,3)}for(t=0;t<48;++t)for(_l(n,l),Xu(n,bn[t]),e=0;e<36;++e)for(_l(o,n),yt(o,e),Xu(o,t),r=0;r<36;++r)if(_l(i,l),yt(i,r),Zu(i,o)){bt[t][e]=r;break}for(Gs(n,0),t=0;t<48;++t)Ts[bn[t]]=Nl(n),oe(n,0),t%2==1&&oe(n,1),t%8==7&&oe(n,2),t%16==15&&oe(n,3)}function hB(){let t,e,r,n,o=new ho,l=T(22984);for(e=0;e<22984;e++)l[e]=0;for(t=0,e=0;e<735471;++e)if((l[~~e>>>5]&1<<(e&31))==0){for(Gs(o,e),n=0;n<48;++n)r=Nl(o),l[~~r>>>5]|=1<<(r&31),Un!==null&&(Un[r]=t<<6|bn[n]),oe(o,0),n%2==1&&oe(o,1),n%8==7&&oe(o,2),n%16==15&&oe(o,3);Ql[t++]=e}}function yB(t){let e=fm(Ql,t);return e>=0?e:-1}function UB(){Ju||(Ju=!0,Hl=T(70,28),Vl=T(6435,28),of=T(70,16),rf=T(6435,16),Ze=T(450450),nf=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0])}function jl(t){let e,r,n;for(r=0,n=8,e=14;e>=0;--e)t.ct[e]!==t.ct[15]&&(r+=Le[e][n--]);return r}function ql(t){let e,r,n;for(r=0,n=4,e=6;e>=0;--e)t.rl[e]!==t.rl[7]&&(r+=Le[e][n--]);return r*2+t.parity}function xn(t,e){t.parity^=nf[e];let r=e%3;switch(e=~~(e/3),e){case 0:D(t.ct,0,1,2,3,r);break;case 1:D(t.rl,0,1,2,3,r);break;case 2:D(t.ct,8,9,10,11,r);break;case 3:D(t.ct,4,5,6,7,r);break;case 4:D(t.rl,4,5,6,7,r);break;case 5:D(t.ct,12,13,14,15,r);break;case 6:D(t.ct,0,1,2,3,r),D(t.rl,0,5,4,1,r),D(t.ct,8,9,12,13,r);break;case 7:D(t.rl,0,1,2,3,r),D(t.ct,1,15,5,9,r),D(t.ct,2,12,6,10,r);break;case 8:D(t.ct,8,9,10,11,r),D(t.rl,0,3,6,5,r),D(t.ct,3,2,5,4,r);break;case 9:D(t.ct,4,5,6,7,r),D(t.rl,3,2,7,6,r),D(t.ct,11,10,15,14,r);break;case 10:D(t.rl,4,5,6,7,r),D(t.ct,0,8,4,14,r),D(t.ct,3,11,7,13,r);break;case 11:D(t.ct,12,13,14,15,r),D(t.rl,1,4,7,2,r),D(t.ct,1,0,7,6,r)}}function wn(t,e){switch(e){case 0:xn(t,19),xn(t,28);break;case 1:xn(t,21),xn(t,32);break;case 2:D(t.ct,0,3,1,2,1),D(t.ct,8,11,9,10,1),D(t.ct,4,7,5,6,1),D(t.ct,12,15,13,14,1),D(t.rl,0,3,5,6,1),D(t.rl,1,2,4,7,1)}}function $u(t,e,r){let n;for(n=0;n<16;++n)t.ct[n]=~~(e.ct[n]/2);for(n=0;n<8;++n)t.rl[n]=e.ct[n+16];t.parity=r}function ef(t,e){let r,n;for(n=8,t.ct[15]=0,r=14;r>=0;--r)e>=Le[r][n]?(e-=Le[r][n--],t.ct[r]=1):t.ct[r]=0}function tf(t,e){let r,n;for(t.parity=e&1,e>>>=1,n=4,t.rl[7]=0,r=6;r>=0;--r)e>=Le[r][n]?(e-=Le[r][n--],t.rl[r]=1):t.rl[r]=0}function Is(){this.rl=T(8),this.ct=T(16)}function bB(){let t,e,r,n,o,l,i,s,u,a,f=new Is;for(o=0;o<70;++o)for(s=0;s<28;++s)tf(f,o),xn(f,Ir[s]),Hl[o][s]=ql(f);for(o=0;o<70;++o)for(tf(f,o),i=0;i<16;++i)of[o][i]=ql(f),wn(f,0),i%2==1&&wn(f,1),i%8==7&&wn(f,2);for(o=0;o<6435;++o)for(ef(f,o),i=0;i<16;++i)rf[o][i]=jl(f)&65535,wn(f,0),i%2==1&&wn(f,1),i%8==7&&wn(f,2);for(o=0;o<6435;++o)for(s=0;s<28;++s)ef(f,o),xn(f,Ir[s]),Vl[o][s]=jl(f)&65535;for(ai(Ze),Ze[0]=Ze[18]=Ze[28]=Ze[46]=Ze[54]=Ze[56]=0,r=0,n=6;n!==450450;){let g=r>6,L=g?-1:r,B=g?r:-1;for(++r,o=0;o<450450;++o)if(Ze[o]===L){for(t=~~(o/70),u=o%70,s=0;s<23;++s)if(e=Vl[t][s],a=Hl[u][s],l=e*70+a,Ze[l]===B)if(++n,g){Ze[o]=r;break}else Ze[l]=r}}}function SB(){lf||(lf=!0,Uo=T(29400,20),af=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1],mr=T(29400),_s=[0,9,14,23,27,28,41,42,46,55,60,69],Ks=T(70))}function Ns(t){let e,r,n,o;for(r=0,o=4,e=6;e>=0;--e)t.ud[e]!==t.ud[7]&&(r+=Le[e][o--]);for(r*=35,o=4,e=6;e>=0;--e)t.fb[e]!==t.fb[7]&&(r+=Le[e][o--]);r*=12;let l=t.fb[7]^t.ud[7];for(n=0,o=4,e=7;e>=0;--e)t.rl[e]!==l&&(n+=Le[e][o--]);return t.parity+2*(r+Ks[n])}function xB(t,e){switch(t.parity^=af[e],e){case 0:case 1:case 2:D(t.ud,0,1,2,3,e%3);break;case 3:D(t.rl,0,1,2,3,1);break;case 4:case 5:case 6:D(t.fb,0,1,2,3,(e-1)%3);break;case 7:case 8:case 9:D(t.ud,4,5,6,7,(e-1)%3);break;case 10:D(t.rl,4,5,6,7,1);break;case 11:case 12:case 13:D(t.fb,4,5,6,7,(e+1)%3);break;case 14:D(t.ud,0,1,2,3,1),D(t.rl,0,5,4,1,1),D(t.fb,0,5,4,1,1);break;case 15:D(t.rl,0,1,2,3,1),D(t.fb,1,4,7,2,1),D(t.ud,1,6,5,2,1);break;case 16:D(t.fb,0,1,2,3,1),D(t.ud,3,2,5,4,1),D(t.rl,0,3,6,5,1);break;case 17:D(t.ud,4,5,6,7,1),D(t.rl,3,2,7,6,1),D(t.fb,3,2,7,6,1);break;case 18:D(t.rl,4,5,6,7,1),D(t.fb,0,3,6,5,1),D(t.ud,0,3,4,7,1);break;case 19:D(t.fb,4,5,6,7,1),D(t.ud,0,7,6,1,1),D(t.rl,1,4,7,2,1)}}function sf(t,e,r){let n,o=(e.ct[0]>e.ct[8]?1:0)^(e.ct[8]>e.ct[16]?1:0)^(e.ct[0]>e.ct[16]?1:0)?1:0;for(n=0;n<8;++n)t.ud[n]=e.ct[n]&1^1,t.fb[n]=e.ct[n+8]&1^1,t.rl[n]=e.ct[n+16]&1^1^o;t.parity=o^r}function wB(t,e){let r,n,o,l;for(t.parity=e&1,e>>>=1,o=_s[e%12],e=~~(e/12),l=4,r=7;r>=0;--r)t.rl[r]=0,o>=Le[r][l]&&(o-=Le[r][l--],t.rl[r]=1);for(n=e%35,e=~~(e/35),l=4,t.fb[7]=0,r=6;r>=0;--r)n>=Le[r][l]?(n-=Le[r][l--],t.fb[r]=1):t.fb[r]=0;for(l=4,t.ud[7]=0,r=6;r>=0;--r)e>=Le[r][l]?(e-=Le[r][l--],t.ud[r]=1):t.ud[r]=0}function Os(){this.ud=T(8),this.rl=T(8),this.fb=T(8)}function vB(){let t,e,r,n;for(r=0;r<12;++r)Ks[_s[r]]=r;let o=new Os;for(r=0;r<29400;++r)for(n=0;n<20;++n)wB(o,r),xB(o,n),Uo[r][n]=Ns(o)&65535;for(ai(mr),mr[0]=0,t=0,e=1;e!==29400;){for(r=0;r<29400;++r)if(mr[r]===t)for(n=0;n<17;++n)mr[Uo[r][n]]===-1&&(mr[Uo[r][n]]=t+1,++e);++t}}function EB(t,e){let r;for(r=0;r<24;++r)t.ct[r]=e.ct[r]}function kB(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:D(t.ct,0,1,2,3,r);break;case 1:D(t.ct,16,17,18,19,r);break;case 2:D(t.ct,8,9,10,11,r);break;case 3:D(t.ct,4,5,6,7,r);break;case 4:D(t.ct,20,21,22,23,r);break;case 5:D(t.ct,12,13,14,15,r);break;case 6:D(t.ct,0,1,2,3,r),D(t.ct,8,20,12,16,r),D(t.ct,9,21,13,17,r);break;case 7:D(t.ct,16,17,18,19,r),D(t.ct,1,15,5,9,r),D(t.ct,2,12,6,10,r);break;case 8:D(t.ct,8,9,10,11,r),D(t.ct,2,19,4,21,r),D(t.ct,3,16,5,22,r);break;case 9:D(t.ct,4,5,6,7,r),D(t.ct,10,18,14,22,r),D(t.ct,11,19,15,23,r);break;case 10:D(t.ct,20,21,22,23,r),D(t.ct,0,8,4,14,r),D(t.ct,3,11,7,13,r);break;case 11:D(t.ct,12,13,14,15,r),D(t.ct,1,20,7,18,r),D(t.ct,0,23,6,17,r)}}function Ws(){let t;for(this.ct=T(24),t=0;t<24;++t)this.ct[t]=~~(t/4)}function uf(t){let e,r,n;for(Ws.call(this),e=0;e<23;++e)n=e+t(24-e),this.ct[n]!==this.ct[e]&&(r=this.ct[e],this.ct[e]=this.ct[n],this.ct[n]=r)}function zB(){ff||(ff=!0,Bt=T(18),MB())}function gf(t){t.cp=[0,1,2,3,4,5,6,7],t.co=[0,0,0,0,0,0,0,0]}function Lf(t,e){let r;for(r=0;r<8;++r)t.cp[r]=e.cp[r],t.co[r]=e.co[r]}function CB(t,e){!t.temps&&(t.temps=new Yl),Bf(t,Bt[e],t.temps),Lf(t,t.temps)}function PB(t,e){let r,n;for(n=0,r=6;r>=0;--r)n+=t.co[r]=e%3,e=~~(e/3);t.co[7]=(15-n)%3}function Bf(t,e,r){let n,o,l,i;for(n=0;n<8;++n)r.cp[n]=t.cp[e.cp[n]],l=t.co[e.cp[n]],i=e.co[n],o=l,o=o+(l<3?i:6-i),o=o%3,(l>=3?1:0)^(i>=3?1:0)&&(o=o+3),r.co[n]=o}function Yl(){gf(this)}function cr(t,e){gf(this),Nu(this.cp,t),PB(this,e)}function mf(t){cr.call(this,t(40320),t(2187))}function MB(){let t,e;for(Bt[0]=new cr(15120,0),Bt[3]=new cr(21021,1494),Bt[6]=new cr(8064,1236),Bt[9]=new cr(9,0),Bt[12]=new cr(1230,412),Bt[15]=new cr(224,137),t=0;t<18;t+=3)for(e=0;e<2;++e)Bt[t+e+1]=new Yl,Bf(Bt[t+e],Bt[t],Bt[t+e+1])}function GB(){cf||(cf=!0,St=T(1937880),$l=T(1538),ei=T(1538),Cn=T(11880),Af=[0,1,6,3,4,5,2,7],Vs=T(160,12),Hs=T(160,12),qs=[1,1,1,3,12,60,360,2520,20160,181440,1814400,19958400,239500800],js=[0,2,4,6,1,3,7,5,8,9,10,11])}function vn(t,e,r,n,o){let l=t.edgeo[o];t.edgeo[o]=t.edge[n],t.edge[n]=t.edgeo[r],t.edgeo[r]=t.edge[e],t.edge[e]=l}function En(t,e){let r,n,o,l,i;for(t.isStd||df(t),n=0,i=1985229328,l=47768,r=0;r<e;++r)o=t.edge[r]<<2,n*=12-r,o>=32?(n+=l>>o-32&15,l-=4368<<o-32):(n+=i>>o&15,l-=4369,i-=286331152<<o);return n}function pf(t){let e,r=En(t,4);e=Cn[r];let n=e&7;e>>=3,Xl(t,n);let o=En(t,10)%20160;return e*20160+o}function Zl(t,e){switch(t.isStd=!1,e){case 0:se(t.edge,0,4,1,5),se(t.edgeo,0,4,1,5);break;case 1:ce(t.edge,0,4,1,5),ce(t.edgeo,0,4,1,5);break;case 2:se(t.edge,0,5,1,4),se(t.edgeo,0,5,1,4);break;case 3:ce(t.edge,5,10,6,11),ce(t.edgeo,5,10,6,11);break;case 4:se(t.edge,0,11,3,8),se(t.edgeo,0,11,3,8);break;case 5:ce(t.edge,0,11,3,8),ce(t.edgeo,0,11,3,8);break;case 6:se(t.edge,0,8,3,11),se(t.edgeo,0,8,3,11);break;case 7:se(t.edge,2,7,3,6),se(t.edgeo,2,7,3,6);break;case 8:ce(t.edge,2,7,3,6),ce(t.edgeo,2,7,3,6);break;case 9:se(t.edge,2,6,3,7),se(t.edgeo,2,6,3,7);break;case 10:ce(t.edge,4,8,7,9),ce(t.edgeo,4,8,7,9);break;case 11:se(t.edge,1,9,2,10),se(t.edgeo,1,9,2,10);break;case 12:ce(t.edge,1,9,2,10),ce(t.edgeo,1,9,2,10);break;case 13:se(t.edge,1,10,2,9),se(t.edgeo,1,10,2,9);break;case 14:ce(t.edge,0,4,1,5),ce(t.edgeo,0,4,1,5),se(t.edge,9,11),se(t.edgeo,8,10);break;case 15:ce(t.edge,5,10,6,11),ce(t.edgeo,5,10,6,11),se(t.edge,1,3),se(t.edgeo,0,2);break;case 16:ce(t.edge,0,11,3,8),ce(t.edgeo,0,11,3,8),se(t.edge,5,7),se(t.edgeo,4,6);break;case 17:ce(t.edge,2,7,3,6),ce(t.edgeo,2,7,3,6),se(t.edge,8,10),se(t.edgeo,9,11);break;case 18:ce(t.edge,4,8,7,9),ce(t.edgeo,4,8,7,9),se(t.edge,0,2),se(t.edgeo,1,3);break;case 19:ce(t.edge,1,9,2,10),ce(t.edgeo,1,9,2,10),se(t.edge,4,6),se(t.edgeo,5,7)}}function kn(t,e){switch(t.isStd=!1,e){case 0:Zl(t,14),Zl(t,17);break;case 1:vn(t,11,5,10,6),vn(t,5,10,6,11),vn(t,1,2,3,0),vn(t,4,9,7,8),vn(t,8,4,9,7),vn(t,0,1,2,3);break;case 2:mt(t,4,5),mt(t,5,4),mt(t,11,8),mt(t,8,11),mt(t,7,6),mt(t,6,7),mt(t,9,10),mt(t,10,9),mt(t,1,1),mt(t,0,0),mt(t,3,3),mt(t,2,2)}}function Xl(t,e){for(;e>=2;)e-=2,kn(t,1),kn(t,2);e!==0&&kn(t,0)}function bo(t,e){let r,n,o,l,i,s;for(i=1985229328,s=47768,o=0,r=0;r<11;++r)if(n=qs[11-r],l=~~(e/n),e=e%n,o^=l,l<<=2,l>=32){l=l-32,t.edge[r]=s>>l&15;let u=(1<<l)-1;s=(s&u)+(s>>4&~u)}else{t.edge[r]=i>>l&15;let u=(1<<l)-1;i=(i&u)+(i>>>4&~u)+(s<<28),s=s>>4}for((o&1)==0?t.edge[11]=i:(t.edge[11]=t.edge[10],t.edge[10]=i),r=0;r<12;++r)t.edgeo[r]=r;t.isStd=!0}function Rf(t,e){let r;for(r=0;r<12;++r)t.edge[r]=e.edge[r],t.edgeo[r]=e.edgeo[r];t.isStd=e.isStd}function Df(t,e){let r,n,o,l;for(t.temp===null&&(t.temp=T(12)),r=0;r<12;++r)t.temp[r]=r,t.edge[r]=e.ep[js[r]+12]%12;for(n=1,r=0;r<12;++r)for(;t.edge[r]!==r;)l=t.edge[r],t.edge[r]=t.edge[l],t.edge[l]=l,o=t.temp[r],t.temp[r]=t.temp[l],t.temp[l]=o,n^=1;for(r=0;r<12;++r)t.edge[r]=t.temp[e.ep[js[r]]%12];return n}function df(t){let e;for(t.temp===null&&(t.temp=T(12)),e=0;e<12;++e)t.temp[t.edgeo[e]]=e;for(e=0;e<12;++e)t.edge[e]=t.temp[t.edge[e]],t.edgeo[e]=e;t.isStd=!0}function ce(t,e,r,n,o){let l;l=t[e],t[e]=t[n],t[n]=l,l=t[r],t[r]=t[o],t[o]=l}function mt(t,e,r){let n=t.edge[e];t.edge[e]=t.edgeo[r],t.edgeo[r]=n}function Ht(){this.edge=T(12),this.edgeo=T(12)}function TB(){let t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m,F,A,b,h,C,E,j=new Ht,te=new Ht,I=new Ht;for(ai(St),s=0,Jl=1,Qs(St,0,0);Jl!==31006080&&(p=s>9,i=s%3,l=(s+1)%3,a=p?3:i,t=p?i:3,!(s>=9));){for(g=0;g<31006080;g+=16)if(E=St[~~g>>4],!(!p&&E===-1)){for(f=g,u=g+16;f<u;++f,E>>=2)if((E&3)===a){for(b=~~(f/20160),e=$l[b],n=f%20160,bo(j,e*20160+n),F=0;F<17;++F)if(r=zn(j.edge,F<<3,4),h=Cn[r],C=h&7,h>>=3,o=zn(j.edge,F<<3|C,10)%20160,L=h*20160+o,So(St,L)===t){if(Qs(St,p?f:L,l),++Jl,p)break;if(A=ei[h],A!==1)for(Rf(te,j),Zl(te,F),Xl(te,C),m=1;(A=~~A>>1&65535)!=0;++m)(A&1)==1&&(Rf(I,te),Xl(I,m),B=h*20160+En(I,10)%20160,So(St,B)===t&&(Qs(St,B,l),++Jl))}}}++s}}function So(t,e){return t[e>>4]>>((e&15)<<1)&3}function zn(t,e,r){let n,o,l,i,s,u=Hs[e],a=Vs[e];for(o=0,s=1985229328,i=47768,n=0;n<r;++n)l=u[t[a[n]]]<<2,o*=12-n,l>=32?(o+=i>>l-32&15,i-=4368<<l-32):(o+=s>>l&15,i-=4369,s-=286331152<<l);return o}function Ff(t){let e,r,n,o,l,i,s,u,a,f,g,L=new Ht;if(i=0,l=So(St,t),l===3)return 10;for(;t!==0;)for(l===0?l=2:--l,a=~~(t/20160),e=$l[a],n=t%20160,bo(L,e*20160+n),u=0;u<17;++u)if(r=zn(L.edge,u<<3,4),f=Cn[r],g=f&7,f>>=3,o=zn(L.edge,u<<3|g,10)%20160,s=f*20160+o,So(St,s)===l){++i,t=s;break}return i}function IB(t,e){let r=So(St,t);return r===3?10:(1227133513<<r>>e&3)+e-1}function NB(){let t,e,r,n=new Ht;for(e=0;e<20;++e)for(r=0;r<8;++r){for(bo(n,0),Zl(n,e),Xl(n,r),t=0;t<12;++t)Vs[e<<3|r][t]=n.edge[t];for(df(n),t=0;t<12;++t)Hs[e<<3|r][t]=n.temp[t]}}function OB(){let t,e,r,n,o=new Ht,l=T(1485);for(e=0;e<1485;e++)l[e]=0;for(t=0,e=0;e<11880;++e)if((l[~~e>>>3]&1<<(e&7))==0){for(bo(o,e*qs[8]),n=0;n<8;++n)r=En(o,4),r===e&&(ei[t]=(ei[t]|1<<n)&65535),l[~~r>>3]=l[~~r>>3]|1<<(r&7),Cn[r]=t<<3|Af[n],kn(o,0),n%2==1&&(kn(o,1),kn(o,2));$l[t++]=e}}function Qs(t,e,r){t[e>>4]^=(3^r)<<((e&15)<<1)}function _B(){hf||(hf=!0)}function KB(t){let e,r,n;for(e=0,n=!1,r=0;r<12;++r)e|=1<<t.ep[r],n=n!==t.ep[r]>=12;return e&=~~e>>12,e===0&&!n}function WB(t,e){let r;for(r=0;r<24;++r)t.ep[r]=e.ep[r]}function QB(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:D(t.ep,0,1,2,3,r),D(t.ep,12,13,14,15,r);break;case 1:D(t.ep,11,15,10,19,r),D(t.ep,23,3,22,7,r);break;case 2:D(t.ep,0,11,6,8,r),D(t.ep,12,23,18,20,r);break;case 3:D(t.ep,4,5,6,7,r),D(t.ep,16,17,18,19,r);break;case 4:D(t.ep,1,20,5,21,r),D(t.ep,13,8,17,9,r);break;case 5:D(t.ep,2,9,4,10,r),D(t.ep,14,21,16,22,r);break;case 6:D(t.ep,0,1,2,3,r),D(t.ep,12,13,14,15,r),D(t.ep,9,22,11,20,r);break;case 7:D(t.ep,11,15,10,19,r),D(t.ep,23,3,22,7,r),D(t.ep,2,16,6,12,r);break;case 8:D(t.ep,0,11,6,8,r),D(t.ep,12,23,18,20,r),D(t.ep,3,19,5,13,r);break;case 9:D(t.ep,4,5,6,7,r),D(t.ep,16,17,18,19,r),D(t.ep,8,23,10,21,r);break;case 10:D(t.ep,1,20,5,21,r),D(t.ep,13,8,17,9,r),D(t.ep,14,0,18,4,r);break;case 11:D(t.ep,2,9,4,10,r),D(t.ep,14,21,16,22,r),D(t.ep,7,15,1,17,r)}}function Ys(){let t;for(this.ep=T(24),t=0;t<24;++t)this.ep[t]=t}function yf(t){let e,r,n;for(Ys.call(this),e=0;e<23;++e)n=e+t(24-e),n!==e&&(r=this.ep[e],this.ep[e]=this.ep[n],this.ep[n]=r)}function jB(){Uf||(Uf=!0,Zs=[35,1,34,2,4,6,22,5,19])}function bf(t){t.moveBuffer=T(60)}function qB(t,e){return t.value-e.value}function Pn(t,e){let r;for(WB(t.edge,e.edge),EB(t.center,e.center),Lf(t.corner,e.corner),t.value=e.value,t.add1=e.add1,t.length1=e.length1,t.length2=e.length2,t.length3=e.length3,t.sym=e.sym,r=0;r<60;++r)t.moveBuffer[r]=e.moveBuffer[r];t.moveLength=e.moveLength,t.edgeAvail=e.edgeAvail,t.centerAvail=e.centerAvail,t.cornerAvail=e.cornerAvail}function pr(t){for(;t.centerAvail<t.moveLength;)kB(t.center,t.moveBuffer[t.centerAvail++]);return t.center}function Sf(t){for(;t.cornerAvail<t.moveLength;)CB(t.corner,t.moveBuffer[t.cornerAvail++]%18);return t.corner}function xo(t){for(;t.edgeAvail<t.moveLength;)QB(t.edge,t.moveBuffer[t.edgeAvail++]);return t.edge}function VB(t){let e,r,n,o,l,i,s=new Array(t.moveLength-(t.add1?2:0));for(r=0,e=0;e<t.length1;++e)s[r++]=t.moveBuffer[e];for(i=t.sym,e=t.length1+(t.add1?2:0);e<t.moveLength;++e)bt[i][t.moveBuffer[e]]>=27?(s[r++]=bt[i][t.moveBuffer[e]]-9,o=Zs[bt[i][t.moveBuffer[e]]-27],i=Sn[i][o]):s[r++]=bt[i][t.moveBuffer[e]];let u=Sn[bn[i]][FB(pr(t))];for(l="",i=u,e=r-1;e>=0;--e)n=s[e],n=~~(n/3)*3+(2-n%3),bt[i][n]>=27?(l=l+Xs[bt[i][n]-9]+" ",o=Zs[bt[i][n]-27],i=Sn[i][o]):l=l+Xs[bt[i][n]]+" ";return l}function Tr(t,e){t.moveBuffer[t.moveLength++]=e}function ti(){bf(this),this.edge=new Ys,this.center=new Ws,this.corner=new Yl}function ri(t){ti.call(this),Pn(this,t)}function xf(t){bf(this),this.edge=new yf(t),this.center=new uf(t),this.corner=new mf(t)}function HB(t,e){return e.value-t.value}function ni(t,e){return HB(t,e)}function wf(){}function YB(){if(vf)return;vf=!0;let t,e;for(Xs=["U ","U2 ","U' ","R ","R2 ","R' ","F ","F2 ","F' ","D ","D2 ","D' ","L ","L2 ","L' ","B ","B2 ","B' ","Uw ","Uw2","Uw'","Rw ","Rw2","Rw'","Fw ","Fw2","Fw'","Dw ","Dw2","Dw'","Lw ","Lw2","Lw'","Bw ","Bw2","Bw'"],Ir=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,22,23,25,28,30,31,32,34,36],wo=[0,1,2,4,6,7,8,9,10,11,13,15,16,17,19,22,25,28,31,34,36],Ef=T(37),kf=T(37),Mn=T(37,36),oi=T(29,28),li=T(21,20),Js=T(36),vo=T(28),Gn=T(20),t=0;t<29;++t)Ef[Ir[t]]=t;for(t=0;t<21;++t)kf[wo[t]]=t;for(t=0;t<36;++t){for(e=0;e<36;++e)Mn[t][e]=~~(t/3)==~~(e/3)||~~(t/3)%3==~~(e/3)%3&&t>e;Mn[36][t]=!1}for(t=0;t<29;++t)for(e=0;e<28;++e)oi[t][e]=Mn[Ir[t]][Ir[e]];for(t=0;t<21;++t)for(e=0;e<20;++e)li[t][e]=Mn[wo[t]][wo[e]];for(t=0;t<36;++t)for(Js[t]=36,e=t;e<36;++e)if(!Mn[t][e]){Js[t]=e-1;break}for(t=0;t<28;++t)for(vo[t]=28,e=t;e<28;++e)if(!oi[t][e]){vo[t]=e-1;break}for(t=0;t<20;++t)for(Gn[t]=20,e=t;e<20;++e)if(!li[t][e]){Gn[t]=e-1;break}}function ZB(t){let e,r,n,o,l,i,s,u,a,f,g,L;t.solution="";let B=Ol(new Kl(pr(t.c),0)),p=Ol(new Kl(pr(t.c),1)),m=Ol(new Kl(pr(t.c),2)),F=Ut[~~B>>6],A=Ut[~~p>>6],b=Ut[~~m>>6];for(t.p1SolsCnt=0,t.arr2idx=0,lm(t.p1sols.heap),t.length1=(F<A?F:A)<b?F<A?F:A:b;t.length1<100&&!(b<=t.length1&&ii(t,~~m>>>6,m&63,t.length1,-1,0)||F<=t.length1&&ii(t,~~B>>>6,B&63,t.length1,-1,0)||A<=t.length1&&ii(t,~~p>>>6,p&63,t.length1,-1,0));++t.length1);let h=pm(t.p1sols,zs(Dm,Br([aB,Es,ks]),Wu,0,0));h.sort(function(j,te){return j.value-te.value}),e=9;do{e:for(u=h[0].value;u<100;++u)for(i=0;i<h.length&&!(h[i].value>u);++i)if(!(u-h[i].length1>e)&&(Pn(t.c1,h[i]),$u(t.ct2,pr(t.c1),si(xo(t.c1).ep)),g=jl(t.ct2),L=ql(t.ct2),t.length1=h[i].length1,t.length2=u-h[i].length1,zf(t,g,L,t.length2,28,0)))break e;++e}while(u===100);t.arr2.sort(function(j,te){return j.value-te.value}),s=0,r=13;do{e:for(a=t.arr2[0].value;a<100;++a)for(i=0;i<Math.min(t.arr2idx,100)&&!(t.arr2[i].value>a);++i)if(!(a-t.arr2[i].length1-t.arr2[i].length2>r)&&(l=Df(t.e12,xo(t.arr2[i])),sf(t.ct3,pr(t.arr2[i]),l^si(Sf(t.arr2[i]).cp)),n=Ns(t.ct3),o=En(t.e12,10),f=Ff(pf(t.e12)),f<=a-t.arr2[i].length1-t.arr2[i].length2&&Cf(t,o,n,f,a-t.arr2[i].length1-t.arr2[i].length2,20,0))){s=i;break e}++r}while(a===100);let C=new ri(t.arr2[s]);t.length1=C.length1,t.length2=C.length2;let E=a-t.length1-t.length2;for(i=0;i<E;++i)Tr(C,wo[t.move3[i]]);t.solution=VB(C)}function XB(t,e){let r,n;for(Pn(t.c1,t.c),r=0;r<t.length1;++r)Tr(t.c1,t.move1[r]);switch(Ts[e]){case 0:Tr(t.c1,24),Tr(t.c1,35),t.move1[t.length1]=24,t.move1[t.length1+1]=35,t.add1=!0,e=19;break;case 12869:Tr(t.c1,18),Tr(t.c1,29),t.move1[t.length1]=18,t.move1[t.length1+1]=29,t.add1=!0,e=34;break;case 735470:t.add1=!1,e=0}$u(t.ct2,pr(t.c1),si(xo(t.c1).ep));let o=jl(t.ct2),l=ql(t.ct2),i=Ze[o*70+l];return t.c1.value=i+t.length1,t.c1.length1=t.length1,t.c1.add1=t.add1,t.c1.sym=e,++t.p1SolsCnt,t.p1sols.heap.size<500?n=new ri(t.c1):(n=mm(t.p1sols),n.value>t.c1.value&&Pn(n,t.c1)),rm(t.p1sols,n),t.p1SolsCnt===1e4}function JB(t){let e;for(Pn(t.c2,t.c1),e=0;e<t.length2;++e)Tr(t.c2,t.move2[e]);if(!KB(xo(t.c2)))return!1;let r=Df(t.e12,xo(t.c2));sf(t.ct3,pr(t.c2),r^si(Sf(t.c2).cp));let n=Ns(t.ct3);En(t.e12,10);let o=Ff(pf(t.e12));return t.arr2[t.arr2idx]?Pn(t.arr2[t.arr2idx],t.c2):t.arr2[t.arr2idx]=new ri(t.c2),t.arr2[t.arr2idx].value=t.length1+t.length2+Math.max(o,mr[n]),t.arr2[t.arr2idx].length2=t.length2,++t.arr2idx,t.arr2idx===t.arr2.length}function $B(t,e){return Mf(),t.c=new xf(e),ZB(t),t.solution}function ii(t,e,r,n,o,l){let i,s,u,a,f,g;if(e===0)return n===0&&XB(t,r);for(i=0;i<27;i+=3)if(!(i===o||i===o-9||i===o-18))for(a=0;a<3;++a){if(u=i+a,s=Wl[e][bt[r][u]],f=Ut[~~s>>>6],f>=n){if(f>n)break;continue}if(g=Sn[r][s&63],s>>>=6,t.move1[l]=u,ii(t,s,g,n-1,i,l+1))return!0}return!1}function zf(t,e,r,n,o,l){let i,s,u,a;if(e===0&&Ze[r]===0)return n===0&&JB(t);for(s=0;s<23;++s){if(oi[o][s]){s=vo[s];continue}if(i=Vl[e][s],a=Hl[r][s],u=Ze[i*70+a],u>=n){u>n&&(s=vo[s]);continue}if(t.move2[l]=Ir[s],zf(t,i,a,n-1,s,l+1))return!0}return!1}function Cf(t,e,r,n,o,l,i){let s,u,a,f,g,L,B,p,m;if(o===0)return e===0&&r===0;for(bo(t.tempe[i],e),g=0;g<17;++g){if(li[l][g]){g=Gn[g];continue}if(a=Uo[r][g],L=mr[a],L>=o){L>o&&g<14&&(g=Gn[g]);continue}if(f=zn(t.tempe[i].edge,g<<3,10),s=~~(f/20160),p=Cn[s],m=p&7,p>>=3,u=zn(t.tempe[i].edge,g<<3|m,10)%20160,B=IB(p*20160+u,n),B>=o){B>o&&g<14&&(g=Gn[g]);continue}if(Cf(t,f,a,B,o-1,g,i+1))return t.move3[i]=g,!0}return!1}function Pf(){let t;for(this.p1sols=new Wf(new wf),this.move1=T(15),this.move2=T(20),this.move3=T(20),this.c1=new ti,this.c2=new ti,this.ct2=new Is,this.ct3=new Os,this.e12=new Ht,this.tempe=T(20),this.arr2=T(100),t=0;t<20;++t)this.tempe[t]=new Ht}function Mf(){Gf||(AB(),Un=T(735471),hB(),DB(),Un=null,dB(),bB(),vB(),NB(),OB(),TB(),Gf=!0)}function em(){Tf||(Tf=!0)}function si(t){let e,r,n,o;for(o=0,e=0,n=t.length;e<n;++e)for(r=e;r<n;++r)t[e]>t[r]&&(o^=1);return o}function D(t,e,r,n,o,l){let i;switch(l){case 0:i=t[o],t[o]=t[n],t[n]=t[r],t[r]=t[e],t[e]=i;return;case 1:i=t[e],t[e]=t[n],t[n]=i,i=t[r],t[r]=t[o],t[o]=i;return;case 2:i=t[e],t[e]=t[r],t[r]=t[n],t[n]=t[o],t[o]=i;return}}function If(){}function Nf(t,e,r,n){let o=new If;return o.typeName=t+e,_f(r!==0?-r:0)&&Kf(r!==0?-r:0,o),o.modifiers=4,o.superclass=$s,o.componentType=n,o}function Of(t,e,r,n){let o=new If;return o.typeName=t+e,_f(r)&&Kf(r,o),o.superclass=n,o}function tm(t){let e=Ao[t.seedId];return t=null,e}function _f(t){return typeof t=="number"&&t>0}function Kf(t,e){let r;if(e.seedId=t,t===2)r=String.prototype;else if(t>0){let n=tm(e);if(n)r=n.prototype;else{n=Ao[t]=function(){},n.___clazz$=e;return}}else return;r.___clazz$=e}function rm(t,e){if(Bm(t,e))return!0}function nm(t){t.array=zs(Qf,Br([Es,ks]),_u,0,0)}function om(t,e){return Il(t.array,t.size++,e),!0}function lm(t){t.array=zs(Qf,Br([Es,ks]),_u,0,0),t.size=0}function Rr(t,e){return t.array[e]}function im(t,e){let r=t.array[e];return um(t.array,e,1),--t.size,r}function Tn(t,e,r){let n=t.array[e];return Il(t.array,e,r),n}function sm(t,e){let r;for(e.length<t.size&&(e=LB(e,t.size)),r=0;r<t.size;++r)Il(e,r,t.array[r]);return e.length>t.size&&Il(e,t.size,null),e}function am(){nm(this),this.array.length=500}function um(t,e,r){t.splice(e,r)}function fm(t,e){let r,n,o,l;for(n=0,r=t.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=t[o],l<e)n=o+1;else if(l>e)r=o-1;else return o;return-n-1}function ai(t){gm(t,t.length)}function gm(t,e){let r;for(r=0;r<e;++r)t[r]=-1}function Lm(t,e){let r,n,o,l,i=t.heap.size,s=Rr(t.heap,e);for(;e*2+1<i&&(r=(n=2*e+1,o=n+1,l=n,o<i&&ni(Rr(t.heap,o),Rr(t.heap,n))<0&&(l=o),l),!(ni(s,Rr(t.heap,r))<0));)Tn(t.heap,e,Rr(t.heap,r)),e=r;Tn(t.heap,e,s)}function Bm(t,e){let r,n;for(n=t.heap.size,om(t.heap,e);n>0;){if(r=n,n=~~((n-1)/2),ni(Rr(t.heap,n),e)<=0)return Tn(t.heap,r,e),!0;Tn(t.heap,r,Rr(t.heap,n))}return Tn(t.heap,n,e),!0}function mm(t){if(t.heap.size===0)return null;let e=Rr(t.heap,0);return cm(t),e}function cm(t){let e=im(t.heap,t.heap.size-1);0<t.heap.size&&(Tn(t.heap,0,e),Lm(t,0))}function pm(t,e){return sm(t.heap,e)}function Wf(t){this.heap=new am,this.cmp=t}function Vf(){qf||(qf=!0,YB(),em(),RB(),UB(),SB(),GB(),zB(),_B(),jB(),jf=new Pf)}function dm(){Vf(),Mf()}async function Fm(){tt(),Vf();let t=k.fromString($B(jf,await st()));return(await yn()).concat(t)}var V,Ao,lB,_u,Es,Ku,iB,sB,Wu,aB,uB,fB,ks,Vu,Cs,Ps,Yu,Ut,Wl,Ts,Un,Ql,bn,bt,Sn,Ju,Vl,Ze,rf,nf,Hl,of,lf,Uo,af,mr,_s,Ks,ff,Bt,cf,js,Jl,St,qs,Vs,Hs,Cn,$l,Af,ei,hf,Uf,Zs,vf,Mn,oi,li,Ir,Xs,wo,Js,vo,Gn,Ef,kf,Gf,Tf,$s,Qf,Rm,Dm,jf,qf,Yf=U(()=>{Ae();ws();Ou();nr();_t();Ao={},lB={},_u=0,Es=30,Ku=21,iB=22,sB=23,Wu=24,aB=25,uB=34,fB=26,ks=40;at(1,-1,lB);V.value=null;at(73,1,{},Qu);V.queryId$=0;Vu=!1;Yu=!1;at(153,1,Br([Ku]),ho,Kl,yo);Un=null,Ju=!1;at(154,1,{},Is);V.parity=0;lf=!1;at(155,1,{},Os);V.parity=0;at(156,1,{},Ws,uf);ff=!1;at(157,1,Br([iB]),Yl,cr,mf);V.temps=null;cf=!1;at(158,1,Br([sB]),Ht);V.isStd=!0;V.temp=null;Jl=0,hf=!1;at(159,1,{},Ys,yf);Uf=!1;at(160,1,Br([Wu,uB]),ti,ri,xf);V.compareTo$=function(e){return qB(this,e)};V.add1=!1;V.center=null;V.centerAvail=0;V.corner=null;V.cornerAvail=0;V.edge=null;V.edgeAvail=0;V.length1=0;V.length2=0;V.length3=0;V.moveLength=0;V.sym=0;V.value=0;at(161,1,{},wf);V.compare=function(e,r){return ni(e,r)};vf=!1;at(163,1,Br([fB]),Pf);V.add1=!1;V.arr2idx=0;V.c=null;V.length1=0;V.length2=0;V.p1SolsCnt=0;V.solution="";Gf=!1,Tf=!1;V.val$outerIter=null;V.size=0;at(239,1,{},Wf);V.cmp=null;V.heap=null;$s=Of("java.lang.","Object",1,null),Qf=Nf("[Ljava.lang.","Object;",356,$s),Rm=Of("cs.threephase.","FullCube",160,$s),Dm=Nf("[Lcs.threephase.","FullCube;",381,Rm),qf=!1});var ta={};Ue(ta,{sgsDataFTO:()=>wm});async function wm(){return xm??(xm=vm())}async function vm(){return zt(await he.fto.kpuzzle(),\`SubgroupSizes 24 12 11 12 12 11 10 9 11 8 10 9 7 8 10 10 6 9 8 5 7 6 5 4 4 8 7 3 6 6 360
|
|
1148
|
+
Alg F D F' D L2 F R' F' D' B2 U'\`)}var iL,j2=U(()=>{_t();fn();iL=null});async function gn(t,e){let r=new ft;r.experimentalPushAlg(t);for(let n of e){let o=(await Kt())(n);o!==null&&r.push(c.fromString(o))}return r.toAlg()}var dl=U(()=>{Ae();nr()});function Z2(t,e){return t.slice(e)+t.slice(0,e)}function cL(t){let e=[[],[]];for(let r=0;r<6;r++)if(t.stateData.CENTERS.pieces[r]!==r)throw new Error("non-oriented puzzles are not supported");for(let r=0;r<12;r++)e[0].push(Z2(gL[t.stateData.EDGES.pieces[r]],t.stateData.EDGES.orientation[r]));for(let r=0;r<8;r++)e[1].push(Z2(LL[t.stateData.CORNERS.pieces[r]],t.stateData.CORNERS.orientation[r]));return e.push(BL),e}function X2(t){let e=cL(t);return mL.map(([r,n,o])=>e[r][n][o]).join("")}var gL,LL,BL,mL,J2=U(()=>{gL="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),LL="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),BL="U L F R B D".split(" "),mL=[[1,2,0],[0,2,0],[1,1,0],[0,3,0],[2,0,0],[0,1,0],[1,3,0],[0,0,0],[1,0,0],[1,0,2],[0,1,1],[1,1,1],[0,8,1],[2,3,0],[0,10,1],[1,4,1],[0,5,1],[1,7,2],[1,3,2],[0,0,1],[1,0,1],[0,9,0],[2,2,0],[0,8,0],[1,5,1],[0,4,1],[1,4,2],[1,5,0],[0,4,0],[1,4,0],[0,7,0],[2,5,0],[0,5,0],[1,6,0],[0,6,0],[1,7,0],[1,2,2],[0,3,1],[1,3,1],[0,11,1],[2,1,0],[0,9,1],[1,6,1],[0,7,1],[1,5,2],[1,1,2],[0,2,1],[1,2,1],[0,10,0],[2,4,0],[0,11,0],[1,7,1],[0,6,1],[1,6,2]]});function $2(t,e){let r=new Be(t.kpuzzle,{EDGES:t.stateData.EDGES,CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation(),n=new Be(e.kpuzzle,{EDGES:e.stateData.EDGES,CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation();return r.isIdentical(n)}function eu(t,e){if($2(t.startState(),e))return!1;for(let r of"ULFRBD")for(let n=1;n<4;n++){let o=t.moveToTransformation(new c(r,n)).toKState();if($2(o,e))return!1}return!0}var tu=U(()=>{Ae();He()});var ru,nu=U(()=>{ru=[["R U'","R2 B","D2 B2","D' L B'","R' U'","B","D B2","R' B","L' U","L2 B'","B2","D L B'","L U","B'","U'","R B","D' B2","L B'","U2","U L' B'","","U' L' B'","U","L' B'"],["F2 L2","F' L'","R' F L2","D' L2","F L2","F2 L'","R' F' L'","R2 F L2","R2 F2 L'","L2","F L'","D' L","D2 L2","R2 F' L'","D L","","L2 F L'","L F' L2","L F L'","F' L2","L'","D L2","D F L'","L"],["R B U2 B'","R2 B U' B'","F2 B U B'","F B2 L' B2","B2 L B2","B U' B'","R2 B U2 B'","R' B U' B'","B2 L' B2","F B U B'","B2 U' B2","B' L B","L F' B D' B'","B' U' B2 D B'","B U2 B'","R B U' B'","B2 L2 B2","D' B' L B","B U B'","F' B2 L' B2","","B2 L' B' U' B'"],["U F2 L2 U'","F' U L' U'","F2 U L' U'","U F L2 U'","U2 B2 U2","R' U' B U","D2 U L U'","D U2 B' U2","U L2 U'","F U L' U'","D U L U'","U2 B' U2","","U2 B' U' L' U'","U2 L' U2","U' B U","U L U'","D' U2 B' U2","U L' U'","U2 B U2"],["R' D' F2","F'","F2","D R F'","R D' F2","R2 F'","D' F2","R F'","F2 R' D' F2","F","D2 F2","D' R F'","R2 D' F2","R' F'","D F2","D2 R F'","","F R' D' F2"],["R' D2 F' D F","R F2 R2 F2","R2 F' D2 F","F' R2 D2 F","L D' L'","D F' D2 F","F2 R2 F2","R F' D2 F","F' R2 D' F","F' R' D2 F","F2 R' F2","L D L'","F' R D' F","F2 R F2","F' D2 F","","L D2 R D' L'","F' D2 F' R F2","D2 R2 F2 R2 F2","D F' D' F","F' D F"],["U F2 U'","R U F' U'","D R U F2 U'","U F U'","R2 U F2 U'","R' U F' U'","R U F2 U'","R2 U F' U'","","U L D L' F U'","F2 D' R D F2","D2 U F U'","R' U F2 U'","U F' U'","F2 D2 R D2 F2","D U F U'"],["R2","R' B' D B","D R'","F' R2 F","","R B' D B","R'","B' D B","D' R'","D2 F' R2 F","R","R2 B' D B","D2 R'","B' D' B"],["R2 D' R2","F' R' F R","R D' R2 D R'","D2 R2 D2 R2","R' D' F' R F","U F D F' U'","","R2 D2 B R' B' R'","R' F D' F2 R F","R2 D R2","F2 U F U' F","R' D F' R F","D R2 D2 R2","U F D' F' U'","D R' D2 F' R F","R2 D2 R2","U F D2 F' U'","R' D2 F' R F"],["B R B'","F D F' B R2 B'","D B R2 B'","D2 B R' B'","B R2 B'","D B R' B'","D' B R2 B'","B R' B'","","B R2 B' D B R' B'","D2 B R2 B'","D' B R' B'"],["","R' D R F D2 F'","R' D R","D F D' F'","R F' R' F","F D' F'","R' D' R","F D2 F'","R' D2 R","F D F'"],["","F2 D2 R F' R' D2 F' D2 F'","F2 D2 F' D' F D' F' D2 F'","F2 D F2 D F2 D2 F2","D2 F L D2 L' D2 F'","D F D2 L D2 L' F'","R' D B' D2 B D' R","R' D2 B' D2 B R","F D2 F' D F D F'","F D' L D2 L' D F'","B D' F D B' D' F'","F D2 L D2 L' F'","F D' L D L' D F'","F L D2 L' D2 F'","R' B' D2 B D2 R"],["D'","F L D L' D' F'","D2","L B D B' D' L'","D","B' L' D' L D B","","D F L D L' D' F'"],["F' D2 F D F' D F","F' D' R' D R F","F' R' D' R D F","B D R D' R' B'","","D B' D' L' D L B"],["D F D F' D F D2 F'","F' U2 B' R' B U2 F' L F' L' F'","","D2 L D L2 F L F2 D F"],["L B' L' F L B L' F'","F2 U F' D2 F U' F' D2 F'","D' F' D B D' F D B'","F L2 F R2 F' L2 F R2 F2","D B D' F' D B' D' F","R F L F' R' F L' F'","","D2 B L' U2 L B' D2 B L' U2 L B'","D2 F R' U2 R F' D2 F R' U2 R F'","R F L' F' R' F L F'","D F D' B' D F' D' B","L2 F2 L' B2 L F2 L' B2 L'"],["L B R' B' L' B R B'","R' B R F' R' B' R F","L D2 L U L' D2 L U' L2","","D2 B' D2 F D' L2 F L2 F' D2 B D' F'","D2 F' R' F R2 B' D2 B D2 R' F D2 F'","L B L' F L B' L' F'","F' D2 F' U' F D2 F' U F2","D' B' D F D' B D F'"],["","D2 F' L U2 L' F D2 F' L U2 L' F","D2 B' R U2 R' B D2 B' R U2 R' B"]]});var Mu={};Ue(Mu,{initialize:()=>lB,solveState:()=>iB});function ou(){}function RL(t){function e(){}return e.prototype=t||{},new e}function dL(t){return t instanceof Array?t[0]:null}function uo(t,e,r){var n=Dl,o=DL,l=dL,i=n[t],s=l(i);i&&!s?V=i:(V=n[t]=e?o(e):{},V.castableTypeMap$=r,V.constructor=V,!e&&(V.typeMarker$=ou));for(var u=3;u<arguments.length;++u)arguments[u].prototype=V;s&&(V.___clazz$=s)}function DL(t){var e=Dl;return RL(e[t])}function FL(){}function Fl(t){return t<<24>>24}function ls(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function is(t,e){var r;return r=new ls,r.packageName=t,r.compoundName=e,r}function lr(t,e,r){var n;return n=is(t,e),yL(r,n),n}function AL(t,e){var r;return r=is(t,e),r.modifiers=2,r}function Al(t,e){var r;return r=is("",t),r.typeId=e,r.modifiers=1,r}function lu(t,e){var r=t.arrayLiterals=t.arrayLiterals||[];return r[e]||(r[e]=t.createClassLiteralForArray(e))}function hL(t){if(t.isPrimitive())return null;var e=t.typeId,r=Dl[e];return r}function yL(t,e){if(!!t){e.typeId=t;var r=hL(e);if(!r){Dl[t]=[e];return}r.___clazz$=e}}function J(t,e){return lu(t,e)}function Z(t,e,r,n,o,l){var i;return i=su(o,n),$(J(t,l),e,r,o,i),i}function Ze(t,e,r,n,o,l){return iu(t,e,r,n,o,0,l)}function iu(t,e,r,n,o,l,i){var s,u,a,f,g;if(f=o[l],a=l==i-1,s=a?n:0,g=su(s,f),$(J(t,i-l),e[l],r[l],s,g),!a)for(++l,u=0;u<f;++u)g[u]=iu(t,e,r,n,o,l,i);return g}function $(t,e,r,n,o){return o.___clazz$=t,o.castableTypeMap$=e,o.typeMarker$=ou,o.__elementTypeId$=r,o.__elementTypeCategory$=n,o}function su(t,e){var r=new Array(e),n;switch(t){case 6:n={l:0,m:0,h:0};break;case 7:n=0;break;case 8:n=!1;break;default:return r}for(var o=0;o<e;++o)r[o]=n;return r}function au(t){var e,r,n;return e=t&Ye,r=t>>22&Ye,n=t<0?or:0,UL(e,r,n)}function UL(t,e,r){return{l:t,m:e,h:r}}function bL(t,e){var r,n,o;return r=t.l+e.l,n=t.m+e.m+(r>>22),o=t.h+e.h+(n>>22),{l:r&Ye,m:n&Ye,h:o&or}}function Pt(t,e){return{l:t.l&e.l,m:t.m&e.m,h:t.h&e.h}}function ss(t){var e,r;return t>-129&&t<128?(e=t+128,yl==null&&(yl=Z(nB,se,293,256,0,1)),r=yl[e],!r&&(r=yl[e]=au(t)),r):au(t)}function uu(t,e){var r,n;return r=t.h>>19,n=e.h>>19,r==0?n!=0||t.h>e.h||t.h==e.h&&t.m>e.m||t.h==e.h&&t.m==e.m&&t.l>=e.l:!(n==0||t.h<e.h||t.h==e.h&&t.m<e.m||t.h==e.h&&t.m==e.m&&t.l<e.l)}function as(t,e){return t.l!=e.l||t.m!=e.m||t.h!=e.h}function us(t,e){return{l:t.l|e.l,m:t.m|e.m,h:t.h|e.h}}function hl(t,e){var r,n,o;return e&=63,e<22?(r=t.l<<e,n=t.m<<e|t.l>>22-e,o=t.h<<e|t.m>>22-e):e<44?(r=0,n=t.l<<e-22,o=t.m<<e-22|t.l>>44-e):(r=0,n=0,o=t.l<<e-44),{l:r&Ye,m:n&Ye,h:o&or}}function Er(t,e){var r,n,o,l,i;return e&=63,r=t.h,n=(r&pL)!=0,n&&(r|=-1048576),e<22?(i=r>>e,l=t.m>>e|r<<22-e,o=t.l>>e|t.m<<22-e):e<44?(i=n?or:0,l=r>>e-22,o=t.m>>e-22|r<<44-e):(i=n?or:0,l=n?Ye:0,o=r>>e-44),{l:o&Ye,m:l&Ye,h:i&or}}function fu(t,e){var r,n,o;return r=t.l-e.l,n=t.m-e.m+(r>>22),o=t.h-e.h+(n>>22),{l:r&Ye,m:n&Ye,h:o&or}}function kr(t){return t.l|t.m<<22}function SL(t){this.string=t}function ir(t,e){return t>e?t:e}function fs(t,e){return t<e?t:e}function xL(t,e){return t.indexOf(e)}function wL(t){return vL(t,0,t.length)}function vL(t,e,r){for(var n="",o=e;o<r;){var l=Math.min(o+1e4,r);n+=String.fromCharCode.apply(null,t.slice(o,l)),o=l}return n}function EL(t){return String.fromCharCode(t&_e)}function gu(t){return t.string+=" ",t}function Lu(t,e){return t.string+=e,t}function zL(){SL.call(this,"")}function Ul(t,e){var r;if(t===e)return!0;if(t.length!=e.length)return!1;for(r=0;r<t.length;++r)if(t[r]!=e[r])return!1;return!0}function zr(){Bu||(Bu=!0,ar=Ze(de,[se,Re],[11,0],7,[495,18],2),dn=Ze(de,[se,Re],[11,0],7,[324,18],2),cn=Ze(de,[se,Re],[11,0],7,[336,18],2),sr=Ze(de,[se,Re],[11,0],7,[495,8],2),xl=Z(Ee,ve,0,20048,7,1),Sl=Z(Ee,ve,0,20791,7,1),Rn=Z(Ee,ve,0,82945,7,1),Ln=Ze(de,[se,Re],[11,0],7,[2768,10],2),mn=Ze(de,[se,Re],[11,0],7,[2768,10],2),pn=Ze(de,[se,Re],[11,0],7,[24,10],2),Lo=Ze(de,[se,Re],[11,0],7,[24,16],2),Cr=Ze(de,[se,Re],[11,0],7,[140,16],2),bl=Z(Ee,ve,0,8305,7,1),Bn=Z(Ee,ve,0,48441,7,1))}function CL(t,e,r){return t.slice_0=ar[e.slice_0][r],t.flip=cn[e.flip][(X(),Mr)[r<<3|e.fsym]],t.fsym=t.flip&7^e.fsym,t.flip>>=3,t.twist=dn[e.twist][Mr[r<<3|e.tsym]],t.tsym=t.twist&7^e.tsym,t.twist>>=3,t.prun=ir(ir(nt(xl,t.twist*495+sr[t.slice_0][t.tsym]),nt(Sl,t.flip*495+sr[t.slice_0][t.fsym])),nt(Rn,t.twist<<11|gr[t.flip<<3|t.fsym^t.tsym])),t.prun}function PL(t,e,r){return r=(X(),co)[3][r],t.flipc=cn[e.flipc>>3][Mr[r<<3|e.flipc&7]]^e.flipc&7,t.twistc=dn[e.twistc>>3][Mr[r<<3|e.twistc&7]]^e.twistc&7,nt(Rn,t.twistc>>3<<11|gr[t.flipc^t.twistc&7])}function mu(t,e,r){var n;return t.twist=(X(),po)[kl(e)],t.flip=Pr[El(e)],t.tsym=t.twist&7,t.twist=t.twist>>3,t.prun=nt(Rn,t.twist<<11|gr[t.flip^t.tsym]),t.prun>r||(t.fsym=t.flip&7,t.flip=t.flip>>3,t.slice_0=494-An(e.ea,8,!0),t.prun=ir(t.prun,ir(nt(xl,t.twist*495+sr[t.slice_0][t.tsym]),nt(Sl,t.flip*495+sr[t.slice_0][t.fsym]))),t.prun>r)?!1:(n=new ue,Bo(e,1,n),mo(e,1,n),t.twistc=po[kl(n)],t.flipc=Pr[El(n)],t.prun=ir(t.prun,nt(Rn,t.twistc>>3<<11|gr[t.flipc^t.twistc&7])),t.prun<=r)}function fo(){zr()}function nt(t,e){return zr(),t[e>>3]>>(e<<2)&15}function cu(t){zr(),!(wl==2||wl==1&&!t)&&(wl==0&&(VL(),ML(),TL(),NL(),GL(),X(),ps(2048,Rs,Pr,hu=Z(de,Re,0,336,7,1),0),ps(2187,As,po,Fs=Z(de,Re,0,324,7,1),1),IL(),OL(),_L()),go(bl,pn,Lo,Ln,(X(),Ds),584244,t),go(Bn,gs,Cr,mn,Ds,514084,t),go(xl,ar,sr,dn,Fs,431619,t),go(Sl,ar,sr,cn,hu,431619,t),go(Rn,null,null,dn,Fs,103939,t),wl=t?2:1)}function ML(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<2768;r++)for(QL(t,(X(),Dn)[r]),n=0;n<10;n++)ur(t,fe[(Qe(),yt)[n]],e),Ln[r][n]=Pl(jt[lt(e.ca,8,!1)])&_e}function GL(){var t,e,r,n,o;for(t=new ue,e=new ue,gs=Ze(de,[se,Re],[11,0],7,[140,10],2),r=0;r<140;r++){for(ku(t.ca,r%70,0,!1),o=0;o<10;o++)ur(t,(X(),fe)[(Qe(),yt)[o]],e),gs[r][o]=An(e.ca,0,!1)+70*(165>>o&1^~~(r/70))&_e;for(n=0;n<16;n++)Bo(t,(X(),ot)[0][n],e),Cr[r][n]=An(e.ca,0,!1)+70*~~(r/70)&_e}}function TL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<2768;r++)for(Du(t,(X(),Dn)[r]),n=0;n<10;n++)Bt(t,fe[(Qe(),yt)[n]],e),mn[r][n]=jt[lt(e.ea,8,!0)]}function IL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<336;r++)for(ms(t,(X(),Rs)[r]),n=0;n<18;n++)Bt(t,fe[n],e),cn[r][n]=Pr[El(e)]}function NL(){var t,e,r,n,o;for(t=new ue,e=new ue,r=0;r<24;r++){for(Gr(t.ea,r,12,!0),o=0;o<10;o++)Bt(t,(X(),fe)[(Qe(),yt)[o]],e),pn[r][o]=lt(e.ea,12,!0)%24&_e;for(n=0;n<16;n++)mo(t,(X(),ot)[0][n],e),Lo[r][n]=lt(e.ea,12,!0)%24&_e}}function go(t,e,r,n,o,l,i){var s,u,a,f,g,L,B,p,m,F,A,b,h,C,E,q,re,I,ne,y,z,M,x,w,P,K,Y,ge,me,Fe,ye,wt,ze,Je,xe,D;if(h=l&15,A=(l>>4&1)==1?os:0,a=(l>>5&1)==1,s=l>>8&15,f=l>>12&15,g=l>>16&15,F=i?f:g,b=(1<<h)-1,u=e==null,p=u?2048:e.length,m=p*n.length,B=a?10:18,L=B==10?66:599186,E=(t[m>>3]>>(m<<2)&15)-1,E==-1){for(I=0;I<~~(m/8)+1;I++)t[I]=ao;t[0]^=1,E=0}for(;E<F;){for(P=(E+1)*ao^-1,ne=0;ne<t.length;ne++)xe=t[ne]^P,xe&=xe>>1,t[ne]+=xe&xe>>2&ao;for(M=E>s,Fe=M?E+2:E,me=Fe*ao,C=M?E:E+2,++E,D=E^E+1,Je=0,I=0;I<m;++I,Je>>=4){if((I&7)==0&&(Je=t[I>>3],((Je^me)-ao&~(Je^me)&-2004318072)==0)){I+=7;continue}if((Je&15)==Fe)for(Y=I%p,ye=~~(I/p),q=0,re=0,u&&(q=(X(),Pr)[Y],re=q&7,q>>=3),w=0;w<B;w++){if(ze=n[ye][w],u?ge=(X(),gr)[cn[q][Mr[w<<3|re]]^re^ze&b]:ge=r[e[Y][w]][ze&b],ze>>=h,y=ze*p+ge,K=t[y>>3]>>(y<<2)&15,K!=C){K<E-1&&(w+=L>>w&3);continue}if(M){t[I>>3]^=D<<(I<<2);break}for(t[y>>3]^=D<<(y<<2),x=1,wt=o[ze];(wt>>=1)!=0;x++)(wt&1)==1&&(z=ze*p,u?z+=(X(),gr)[Pr[ge]^x]:z+=r[ge][x^A>>(x<<1)&3],(t[z>>3]>>(z<<2)&15)==C&&(t[z>>3]^=D<<(z<<2)))}}}}function OL(){var t,e,r,n;for(t=new ue,e=new ue,r=0;r<324;r++)for(cs(t,(X(),As)[r]),n=0;n<18;n++)ur(t,fe[n],e),dn[r][n]=po[kl(e)]}function _L(){var t,e,r,n,o,l,i,s;for(t=new ue,e=new ue,n=0;n<495;n++){for(ku(t.ea,494-n,8,!0),l=0;l<18;l+=3)Bt(t,(X(),fe)[l],e),ar[n][l]=494-An(e.ea,8,!0)&_e;for(o=0;o<16;o+=2)mo(t,(X(),ot)[0][o],e),sr[n][o>>1]=494-An(e.ea,8,!0)&_e}for(r=0;r<495;r++)for(o=0;o<18;o+=3)for(s=ar[r][o],i=1;i<3;i++)s=ar[s][o],ar[r][o+i]=s&_e}function X(){pu||(pu=!0,Qt=Z(Ro,se,7,16,0,1),fe=Z(Ro,se,7,18,0,1),Gl=Z(oB,se,0,18,6,1),yu=Z(Ee,ve,0,48,7,1),qt=Ze(Ee,[se,ve],[17,0],7,[16,16],2),ot=Ze(Ee,[se,ve],[17,0],7,[16,16],2),co=Ze(Ee,[se,ve],[17,0],7,[16,18],2),Mr=Z(Ee,ve,0,144,7,1),Lr=Ze(Ee,[se,ve],[17,0],7,[16,18],2),Rs=Z(de,Re,0,336,7,1),As=Z(de,Re,0,324,7,1),Dn=Z(de,Re,0,2768,7,1),Fn=Z(ee,ie,0,2768,7,1),ds=Z(de,Re,0,2768,7,1),Ml=Z(ee,ie,0,24,7,1),Pr=Z(de,Re,0,2048,7,1),po=Z(de,Re,0,2187,7,1),jt=Z(de,Re,0,40320,7,1),gr=Z(de,Re,0,2688,7,1),hs=new ht(2531,1373,67026819,1367),ys=new ht(2089,1906,322752913,2040),Tl=$(J(ee,2),se,10,0,[$(J(ee,1),ie,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),$(J(ee,1),ie,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),$(J(ee,1),ie,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),$(J(ee,1),ie,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),$(J(ee,1),ie,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),$(J(ee,1),ie,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),qL(),HL())}function Ls(t){t.ca=$(J(ee,1),ie,0,7,[0,1,2,3,4,5,6,7]),t.ea=$(J(ee,1),ie,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function Ru(t){!t.temps&&(t.temps=new ue),ur(ys,t,t.temps),ur(t.temps,hs,t),Bt(ys,t,t.temps),Bt(t.temps,hs,t)}function Bs(t,e){var r,n;for(n=0;n<8;n++)t.ca[n]=e.ca[n];for(r=0;r<12;r++)t.ea[r]=e.ea[r]}function WL(t){return Pl(jt[lt(t.ca,8,!1)])}function KL(t){return jt[lt(t.ea,8,!0)]}function El(t){var e,r;for(r=0,e=0;e<11;e++)r=r<<1|t.ea[e]&1;return r}function kl(t){var e,r;for(r=0,e=0;e<7;e++)r+=(r<<1)+(t.ca[e]>>3);return r}function zl(t){var e,r;for(!t.temps&&(t.temps=new ue),r=0;r<12;r++)t.temps.ea[t.ea[r]>>1]=(r<<1|t.ea[r]&1)<<24>>24;for(e=0;e<8;e++)t.temps.ca[t.ca[e]&7]=(e|32>>(t.ca[e]>>3)&24)<<24>>24;Bs(t,t.temps)}function du(t){var e,r,n,o,l,i,s;for(e=new Fu(t),o=new ue,r=Pl(jt[lt(e.ca,8,!1)])>>4,i={l:0,m:0,h:0},s=0;s<6;s++){if(n=Pl(jt[lt(e.ca,8,!1)])>>4,r==n)for(l=0;l<16;l++)Bo(e,ot[0][l],o),Ul(o.ca,t.ca)&&(mo(e,ot[0][l],o),Ul(o.ea,t.ea)&&(i=us(i,hl({l:1,m:0,h:0},(s<<4|l)<48?s<<4|l:48))));Ru(e),s%3==2&&zl(e)}return i}function QL(t,e){Gr(t.ca,e,8,!1)}function Du(t,e){Gr(t.ea,e,8,!0)}function ms(t,e){var r,n,o;for(n=0,r=10;r>=0;--r,e>>=1)n^=o=e&1,t.ea[r]=(t.ea[r]&-2|o)<<24>>24;t.ea[11]=(t.ea[11]&-2|n)<<24>>24}function cs(t,e){var r,n,o;for(n=15,r=6;r>=0;--r,e=~~(e/3))n-=o=e%3,t.ca[r]=(t.ca[r]&7|o<<3)<<24>>24;t.ca[7]=(t.ca[7]&7|n%3<<3)<<24>>24}function jL(t){var e,r,n,o,l;for(l=0,o=0,n=0;n<12;n++)o|=1<<(t.ea[n]>>1),l^=t.ea[n]&1;if(o!=4095)return-2;if(l!=0)return-3;for(r=0,l=0,e=0;e<8;e++)r|=1<<(t.ca[e]&7),l+=t.ca[e]>>3;return r!=255?-4:l%3!=0?-5:(bs(lt(t.ea,12,!0),12)^bs(lt(t.ca,8,!1),8))!=0?-6:0}function Bo(t,e,r){X();var n,o,l,i,s,u;for(u=Qt[ot[0][e]],s=Qt[e],n=0;n<8;n++)l=u.ca[t.ca[s.ca[n]&7]&7]>>3,i=t.ca[s.ca[n]&7]>>3,o=l<3?i:(3-i)%3,r.ca[n]=(u.ca[t.ca[s.ca[n]&7]&7]&7|o<<3)<<24>>24}function ur(t,e,r){X();var n,o,l;for(n=0;n<8;n++)o=t.ca[e.ca[n]&7]>>3,l=e.ca[n]>>3,r.ca[n]=(t.ca[e.ca[n]&7]&7|(o+l)%3<<3)<<24>>24}function Cl(t,e,r){var n,o,l,i;for(n=0;n<8;n++)l=t.ca[e.ca[n]&7]>>3,i=e.ca[n]>>3,o=l+(l<3?i:6-i),o=o%3+(l<3==i<3?0:3),r.ca[n]=(t.ca[e.ca[n]&7]&7|o<<3)<<24>>24}function ue(){X(),Ls(this)}function ht(t,e,r,n){Ls(this),Gr(this.ca,t,8,!1),cs(this,e),Gr(this.ea,r,12,!0),ms(this,n)}function Fu(t){Ls(this),Bs(this,t)}function Pl(t){return X(),t^os>>((t&15)<<1)&3}function mo(t,e,r){X();var n,o,l;for(l=Qt[ot[0][e]],o=Qt[e],n=0;n<12;n++)r.ea[n]=(l.ea[t.ea[o.ea[n]>>1]>>1]^t.ea[o.ea[n]>>1]&1^o.ea[n]&1)<<24>>24}function Bt(t,e,r){X();var n;for(n=0;n<12;n++)r.ea[n]=(t.ea[e.ea[n]>>1]^e.ea[n]&1)<<24>>24}function fr(t,e,r){X();var n;return n=ds[t],r&&(n=n^os>>((n&15)<<1)&3),n&65520|qt[n&15][e]}function Au(){return X(),0}function qL(){var t,e;for(fe[0]=new ht(15120,0,119750400,0),fe[3]=new ht(21021,1494,323403417,0),fe[6]=new ht(8064,1236,29441808,550),fe[9]=new ht(9,0,5880,0),fe[12]=new ht(1230,412,2949660,0),fe[15]=new ht(224,137,328552,137),t=0;t<18;t+=3)for(e=0;e<2;e++)fe[t+e+1]=new ue,Bt(fe[t+e],fe[t],fe[t+e+1]),ur(fe[t+e],fe[t],fe[t+e+1])}function VL(){X();var t,e,r;for(ps(40320,Dn,jt,Ds=Z(de,Re,0,2768,7,1),2),t=new ue,r=0;r<2768;r++)Du(t,Dn[r]),Fn[r]=An(t.ea,0,!0)+bs(Dn[r],8)*70<<24>>24,zl(t),ds[r]=jt[lt(t.ea,8,!0)];for(e=0;e<24;e++)Gr(t.ea,e,12,!0),zl(t),Ml[e]=lt(t.ea,12,!0)%24<<24>>24}function HL(){var t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;for(t=new ue,e=new ue,r=new ht(28783,0,259268407,0),m=new ht(15138,0,119765538,7),g=new ht(5167,0,83473207,0),o=0;o<8;o++)g.ca[o]=Fl(g.ca[o]|24);for(l=0;l<16;l++)Qt[l]=new Fu(t),Cl(t,m,e),Bt(t,m,e),p=e,e=t,t=p,l%4==3&&(Cl(p,g,e),Bt(p,g,e),p=e,e=t,t=p),l%8==7&&(Cl(p,r,e),Bt(p,r,e),p=e,e=t,t=p);for(i=0;i<16;i++)for(u=0;u<16;u++)for(Cl(Qt[i],Qt[u],t),f=0;f<16;f++)if(Ul(Qt[f].ca,t.ca)){qt[i][u]=f,ot[f][u]=i;break}for(a=0;a<18;a++)for(B=0;B<16;B++){for(Bo(fe[a],ot[0][B],t),L=0;L<18;L++)if(Ul(fe[L].ca,t.ca)){co[B][a]=L,Lr[B][(Qe(),hn)[a]]=hn[L];break}B%2==0&&(Mr[a<<3|B>>1]=co[B][a])}for(n=0;n<18;n++)for(Gl[n]=du(fe[n]),s=n,B=0;B<48;B++)co[B%16][s]<n&&(yu[B]|=1<<n),B%16==15&&(s=Tl[2][s])}function ps(t,e,r,n,o){X();var l,i,s,u,a,f,g,L,B;for(l=new ue,s=new ue,i=0,a=0,B=o>=2?1:2,f=o!=1,u=0;u<t;u++)if(r[u]==0){switch(o){case 0:ms(l,u);break;case 1:cs(l,u);break;case 2:Gr(l.ea,u,8,!0)}for(g=0;g<16;g+=B){switch(f?mo(l,g,s):Bo(l,g,s),o){case 0:a=El(s);break;case 1:a=kl(s);break;case 2:a=lt(s.ea,8,!0)}o==0&&(gr[i<<3|g>>1]=a&_e),a==u&&(n[i]=(n[i]|1<<~~(g/B))&_e),L=~~((i<<4|g)/B),r[a]=L&_e}e[i++]=u&_e}return i}function YL(t,e,r,n,o,l,i,s){var u,a,f,g,L;if(g=ir(nt((zr(),Bn),(i>>4)*140+Cr[(X(),Fn)[s>>4]&255][ot[i&15][s&15]]),ir(nt(Bn,n*140+Cr[Fn[e]&255][ot[o][r]]),nt(bl,e*24+Lo[l][r]))),g>t.maxDep2)return g-t.maxDep2;for(u=t.maxDep2;u>=g&&(L=Su(t,n,o,e,r,l,u,t.depth1,10),!(L<0));u--){for(u-=L,t.solLen=0,t.solution=new Pu,rB(t.solution,t.verbose,t.urfIdx,t.depth1),f=0;f<t.depth1+u;f++)zu(t.solution,t.move[f]);for(a=t.preMoveLen-1;a>=0;a--)zu(t.solution,t.preMoves[a]);t.solLen=t.solution.length_0}return u!=t.maxDep2?(t.maxDep2=fs(wu,t.solLen-t.length1-1),uu(t.probe,t.probeMin)?0:1):1}function ZL(t){var e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;if(t.isRec=!1,uu(t.probe,t.solution?t.probeMin:t.probeMax))return 0;for(t.probe=bL(t.probe,{l:1,m:0,h:0}),n=t.valid1;n<t.depth1;n++)ur(t.phase1Cubie[n],(X(),fe)[t.move[n]],t.phase1Cubie[n+1]),Bt(t.phase1Cubie[n],fe[t.move[n]],t.phase1Cubie[n+1]);for(t.valid1=t.depth1,s=WL(t.phase1Cubie[t.depth1]),u=s&15,s>>=4,a=KL(t.phase1Cubie[t.depth1]),f=a&15,a>>=4,g=lt(t.phase1Cubie[t.depth1].ea,12,!0)%24,r=fr(a,f,!1),e=fr(s,u,!0),o=t.depth1==0?-1:t.move[t.depth1-1],l=t.preMoveLen==0?-1:t.preMoves[t.preMoveLen-1],m=0,p=(t.preMoveLen==0?1:2)*(t.depth1==0?1:2),L=0,B=(1<<p)-1;L<p;L++){if((B>>L&1)!=0){if(B&=~(1<<L),m=YL(t,s,u,a,f,g,r,e),m==0||m>2)break;m==2&&(B&=4<<L)}if(B==0)break;(L&1)==0&&t.depth1>0?(i=(Qe(),hn)[~~(o/3)*3+1],t.move[t.depth1-1]=yt[i]*2-t.move[t.depth1-1],g=(zr(),pn)[g][i],s=Ln[s][(X(),Lr)[u][i]],u=qt[s&15][u],s>>=4,a=mn[a][Lr[f][i]],f=qt[a&15][f],a>>=4,e=fr(s,u,!0),r=fr(a,f,!1)):t.preMoveLen>0&&(i=(Qe(),hn)[~~(l/3)*3+1],t.preMoves[t.preMoveLen-1]=yt[i]*2-t.preMoves[t.preMoveLen-1],g=(X(),Ml)[(zr(),pn)[Ml[g]][i]],s=Ln[e>>4][Lr[e&15][i]],e=s&-16|qt[s&15][e&15],s=fr(e>>4,e&15,!0),u=s&15,s>>=4,a=mn[r>>4][Lr[r&15][i]],r=a&-16|qt[a&15][r&15],a=fr(r>>4,r&15,!1),f=a&15,a>>=4)}return t.depth1>0&&(t.move[t.depth1-1]=o),t.preMoveLen>0&&(t.preMoves[t.preMoveLen-1]=l),m==0?0:2}function XL(t){var e;for(t.conjMask=0,t.selfSym=du(t.cc),t.conjMask|=as(Pt(Er(t.selfSym,16),{l:_e,m:0,h:0}),{l:0,m:0,h:0})?18:0,t.conjMask|=as(Pt(Er(t.selfSym,32),{l:_e,m:0,h:0}),{l:0,m:0,h:0})?36:0,t.conjMask|=as(Pt(Er(t.selfSym,48),{l:_e,m:0,h:0}),{l:0,m:0,h:0})?56:0,t.selfSym=Pt(t.selfSym,{l:Ye,m:Ye,h:15}),t.maxPreMoves=t.conjMask>7?0:20,e=0;e<6;e++)Bs(t.urfCubieCube[e],t.cc),mu(t.urfCoordCube[e],t.urfCubieCube[e],20),Ru(t.cc),e%3==2&&zl(t.cc)}function Uu(t,e,r,n,o){var l,i,s,u,a,f;if(e.prun==0&&n<5)return t.allowShorter||n==0?(t.depth1-=n,a=ZL(t),t.depth1+=n,a):1;for(f=Au(ss(r)),l=0;l<18;l+=3)if(!(l==o||l==o-9)){for(s=0;s<3;s++)if(i=l+s,!(t.isRec&&i!=t.move[t.depth1-n]||f!=0&&(f&1<<i)!=0)){if(u=CL(t.nodeUD[n],e,i),u>n)break;if(u==n)continue;if(u=PL(t.nodeUD[n],e,i),u>n)break;if(u==n)continue;if(t.move[t.depth1-n]=i,t.valid1=fs(t.valid1,t.depth1-n),a=Uu(t,t.nodeUD[n],r&kr((X(),Gl)[i]),n-1,l),a==0)return 0;if(a>=2)break}}return 1}function bu(t,e,r,n,o){var l,i,s;if(t.preMoveLen=t.maxPreMoves-e,(t.isRec?t.depth1==t.length1-t.preMoveLen:t.preMoveLen==0||(225207>>r&1)==0)&&(t.depth1=t.length1-t.preMoveLen,t.phase1Cubie[0]=n,t.allowShorter=t.depth1==Us&&t.preMoveLen!=0,mu(t.nodeUD[t.depth1+1],n,t.depth1)&&Uu(t,t.nodeUD[t.depth1+1],o,t.depth1,-1)==0))return 0;if(e==0||t.preMoveLen+Us>=t.length1)return 1;for(s=Au(ss(o)),(e==1||t.preMoveLen+1+Us>=t.length1)&&(s|=225207),r=~~(r/3)*3,l=0;l<18;l++){if(l==r||l==r-9||l==r+9){l+=2;continue}if(!(t.isRec&&l!=t.preMoves[t.maxPreMoves-e]||(s&1<<l)!=0)&&(ur((X(),fe)[l],n,t.preMoveCubes[e]),Bt(fe[l],n,t.preMoveCubes[e]),t.preMoves[t.maxPreMoves-e]=l,i=bu(t,e-1,l,t.preMoveCubes[e],o&kr(Gl[l])),i==0))return 0}return 1}function Su(t,e,r,n,o,l,i,s,u){var a,f,g,L,B,p,m,F,A,b,h;if(e==0&&n==0&&l==0)return i;for(A=(Qe(),Do)[u],m=0;m<10;m++){if((A>>m&1)!=0){m+=66>>m&3;continue}if(F=(zr(),pn)[l][m],f=Ln[n][(X(),Lr)[o][m]],g=qt[f&15][o],f>>=4,B=mn[e][Lr[r][m]],p=qt[B&15][r],B>>=4,L=fr(B,p,!1),a=fr(f,g,!0),b=nt(Bn,(L>>4)*140+Cr[Fn[a>>4]&255][ot[L&15][a&15]]),b>i+1)return i-b+1;if(b>=i){m+=66>>m&3&i-b;continue}if(b=ir(nt(bl,f*24+Lo[F][g]),nt(Bn,B*140+Cr[Fn[f]&255][ot[p][g]])),b>=i){m+=66>>m&3&i-b;continue}if(h=Su(t,B,p,f,g,F,i-1,s+1,m),h>=0)return t.move[s]=yt[m],h;if(h<-2)break;h<-1&&(m+=66>>m&3)}return-1}function JL(t){for(t.length1=t.isRec?t.length1:0;t.length1<t.solLen;t.length1++)for(t.maxDep2=fs(wu,t.solLen-t.length1-1),t.urfIdx=t.isRec?t.urfIdx:0;t.urfIdx<6;t.urfIdx++)if((t.conjMask&1<<t.urfIdx)==0&&bu(t,t.maxPreMoves,-30,t.urfCubieCube[t.urfIdx],kr(Pt(t.selfSym,{l:_e,m:0,h:0})))==0)return t.solution?Cu(t.solution):"Error 8";return t.solution?Cu(t.solution):"Error 7"}function $L(t,e){var r;return r=eB(t,e),r!=0?"Error "+(r<0?-r:r):(t.solLen=22,t.probe={l:0,m:0,h:0},t.probeMax={l:3531008,m:23,h:0},t.probeMin={l:0,m:0,h:0},t.verbose=0,t.solution=null,t.isRec=!1,cu(!1),XL(t),JL(t))}function eB(t,e){var r,n,o,l;for(n=0,o=Z(ee,ie,0,54,7,1),r=wL($(J(de,1),Re,0,7,[e.charCodeAt(4),e.charCodeAt(13),e.charCodeAt(22),e.charCodeAt(31),e.charCodeAt(40),e.charCodeAt(49)])),l=0;l<54;l++){if(o[l]=xL(r,EL(e.charCodeAt(l)))<<24>>24,o[l]==-1)return-1;n+=1<<(o[l]<<2)}return n!=10066329?-1:(tB(o,t.cc),jL(t.cc))}function xu(){var t,e,r;for(this.move=Z(Ee,ve,0,31,7,1),this.nodeUD=Z(vl,se,31,21,0,1),this.nodeRL=Z(vl,se,31,21,0,1),this.nodeFB=Z(vl,se,31,21,0,1),this.cc=new ue,this.urfCubieCube=Z(Ro,se,7,6,0,1),this.urfCoordCube=Z(vl,se,31,6,0,1),this.phase1Cubie=Z(Ro,se,7,21,0,1),this.preMoveCubes=Z(Ro,se,7,21,0,1),this.preMoves=Z(Ee,ve,0,20,7,1),e=0;e<21;e++)this.nodeUD[e]=new fo,this.nodeRL[e]=new fo,this.nodeFB[e]=new fo,this.phase1Cubie[e]=new ue;for(r=0;r<6;r++)this.urfCubieCube[r]=new ue,this.urfCoordCube[r]=new fo;for(t=0;t<20;t++)this.preMoveCubes[t+1]=new ue}function Qe(){if(!vu){vu=!0;var t,e,r,n,o,l;for(Tr=$(J(ee,2),se,10,0,[$(J(ee,1),ie,0,7,[8,9,20]),$(J(ee,1),ie,0,7,[6,18,38]),$(J(ee,1),ie,0,7,[0,36,47]),$(J(ee,1),ie,0,7,[2,45,11]),$(J(ee,1),ie,0,7,[29,26,15]),$(J(ee,1),ie,0,7,[27,44,24]),$(J(ee,1),ie,0,7,[33,53,42]),$(J(ee,1),ie,0,7,[35,17,51])]),Ht=$(J(ee,2),se,10,0,[$(J(ee,1),ie,0,7,[5,10]),$(J(ee,1),ie,0,7,[7,19]),$(J(ee,1),ie,0,7,[3,37]),$(J(ee,1),ie,0,7,[1,46]),$(J(ee,1),ie,0,7,[32,16]),$(J(ee,1),ie,0,7,[28,25]),$(J(ee,1),ie,0,7,[30,43]),$(J(ee,1),ie,0,7,[34,52]),$(J(ee,1),ie,0,7,[23,12]),$(J(ee,1),ie,0,7,[21,41]),$(J(ee,1),ie,0,7,[50,39]),$(J(ee,1),ie,0,7,[48,14])]),Vt=Ze(Ee,[se,ve],[17,0],7,[13,13],2),Ss=$(J(kL,1),se,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),yt=$(J(Ee,1),ve,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),hn=Z(Ee,ve,0,18,7,1),Do=Z(Ee,ve,0,11,7,1),e=0;e<18;e++)hn[yt[e]]=e;for(r=0;r<10;r++)for(n=~~(yt[r]/3),Do[r]=0,o=0;o<10;o++)l=~~(yt[o]/3),Do[r]|=(n==l||n%3==l%3&&n>=l?1:0)<<o;for(Do[10]=0,t=0;t<13;t++)for(Vt[t][0]=Vt[t][t]=1,o=1;o<t;o++)Vt[t][o]=Vt[t-1][o-1]+Vt[t-1][o]}}function An(t,e,r){Qe();var n,o,l,i,s;for(n=t.length-1,l=0,s=4,o=n;o>=0;o--)i=Eu(t[o],r),(i&12)==e&&(l+=Vt[o][s--]);return l}function bs(t,e){Qe();var r,n;for(n=0,r=e-2;r>=0;r--)n^=t%(e-r),t=~~(t/(e-r));return n&1}function lt(t,e,r){Qe();var n,o,l,i;for(o=0,i={l:1323536,m:2777561,h:1043915},n=0;n<e-1;n++)l=Eu(t[n],r)<<2,o=(e-n)*o+kr(Pt(Er(i,l),{l:15,m:0,h:0})),i=fu(i,hl({l:1118480,m:279620,h:69905},l));return o}function Eu(t,e){return e?t>>1:t&7}function ku(t,e,r,n){Qe();var o,l,i,s;for(o=t.length-1,s=4,l=o,i=o;i>=0;i--)e>=Vt[i][s]?(e-=Vt[i][s--],t[i]=Il(t[i],s|r,n)):((l&12)==r&&(l-=4),t[i]=Il(t[i],l--,n))}function Gr(t,e,r,n){Qe();var o,l,i,s,u,a;for(a={l:1323536,m:2777561,h:1043915},o={l:0,m:0,h:0},s=2;s<=r;s++)o=us(hl(o,4),ss(e%s)),e=~~(e/s);for(l=0;l<r-1;l++)u=(kr(o)&15)<<2,o=Er(o,4),t[l]=Il(t[l],kr(Pt(Er(a,u),{l:15,m:0,h:0})),n),i=fu(hl({l:1,m:0,h:0},u),{l:1,m:0,h:0}),a=us(Pt(a,i),Pt(Er(a,4),{l:~i.l&Ye,m:~i.m&Ye,h:~i.h&or}));t[r-1]=Il(t[r-1],kr(Pt(a,{l:15,m:0,h:0})),n)}function Il(t,e,r){return(r?e<<1|t&1:e|t&-8)<<24>>24}function tB(t,e){Qe();var r,n,o,l,i,s,u,a;for(l=0;l<8;l++)e.ca[l]=0;for(i=0;i<12;i++)e.ea[i]=0;for(s=0;s<8;s++){for(a=0;a<3&&!(t[Tr[s][a]]==0||t[Tr[s][a]]==3);a++);for(r=t[Tr[s][(a+1)%3]],n=t[Tr[s][(a+2)%3]],u=0;u<8;u++)if(r==~~(Tr[u][1]/9)&&n==~~(Tr[u][2]/9)){e.ca[s]=Fl(a%3<<3|u);break}}for(o=0;o<12;o++)for(u=0;u<12;u++){if(t[Ht[o][0]]==~~(Ht[u][0]/9)&&t[Ht[o][1]]==~~(Ht[u][1]/9)){e.ea[o]=Fl(u<<1);break}if(t[Ht[o][0]]==~~(Ht[u][1]/9)&&t[Ht[o][1]]==~~(Ht[u][0]/9)){e.ea[o]=Fl(u<<1|1);break}}}function zu(t,e){var r,n,o;if(t.length_0==0){t.moves[t.length_0++]=e;return}if(r=~~(e/3),n=~~(t.moves[t.length_0-1]/3),r==n){o=(e%3+t.moves[t.length_0-1]%3+1)%4,o==3?--t.length_0:t.moves[t.length_0-1]=r*3+o;return}if(t.length_0>1&&r%3==n%3&&r==~~(t.moves[t.length_0-2]/3)){o=(e%3+t.moves[t.length_0-2]%3+1)%4,o==3?(t.moves[t.length_0-2]=t.moves[t.length_0-1],--t.length_0):t.moves[t.length_0-2]=r*3+o;return}t.moves[t.length_0++]=e}function rB(t,e,r,n){t.verbose=e,t.urfIdx=r,t.depth1=n}function Cu(t){var e,r,n;if(r=new zL,n=(t.verbose&2)!=0?(t.urfIdx+3)%6:t.urfIdx,n<3)for(e=0;e<t.length_0;e++)(t.verbose&1)!=0&&e==t.depth1&&(r.string+=". "),gu(Lu(r,(Qe(),Ss)[(X(),Tl)[n][t.moves[e]]]));else for(e=t.length_0-1;e>=0;e--)gu(Lu(r,(Qe(),Ss)[(X(),Tl)[n][t.moves[e]]])),(t.verbose&1)!=0&&e==t.depth1&&(r.string+=". ");return r.string}function Pu(){this.moves=Z(Ee,ve,0,31,7,1)}var se,Ye,or,pL,_e,Re,ve,os,ao,ie,V,Dl,yl,kL,Bu,Cr,gs,Ln,Bn,mn,cn,bl,Lo,pn,Rn,dn,sr,Sl,ar,xl,wl,vl,pu,Qt,jt,Dn,Pr,Rs,gr,Ml,Fn,ds,Mr,co,Lr,qt,ot,hu,Ds,Fs,po,As,yu,fe,Gl,hs,ys,Tl,Ro,wu,Us,vu,Vt,Do,Tr,Ht,Ss,hn,yt,Ee,nB,ee,oB,de,lB,iB,Gu=U(()=>{se={3:1},Ye=4194303,or=1048575,pL=524288,_e=65535,Re={11:1,3:1},ve={17:1,3:1},os=14540032,ao=286331153,ie={10:1,3:1},Dl={};uo(1,null,{},FL);uo(79,1,{},ls);V.createClassLiteralForArray=function(e){var r;return r=new ls,r.modifiers=4,e>1?r.componentType=lu(this,e-1):r.componentType=this,r};V.isPrimitive=function(){return(this.modifiers&1)!=0};kL=lr("java.lang","String",2);Bu=!1;uo(31,1,{31:1},fo);V.flip=0;V.flipc=0;V.fsym=0;V.prun=0;V.slice_0=0;V.tsym=0;V.twist=0;V.twistc=0;wl=0,vl=lr("org.cubing.min2phase.client","CoordCube",31),pu=!1;Ro=lr("org.cubing.min2phase.client","CubieCube",7);uo(72,1,{},xu);V.allowShorter=!1;V.conjMask=0;V.depth1=0;V.isRec=!1;V.length1=0;V.maxDep2=0;V.maxPreMoves=0;V.preMoveLen=0;V.probe={l:0,m:0,h:0};V.probeMax={l:0,m:0,h:0};V.probeMin={l:0,m:0,h:0};V.selfSym={l:0,m:0,h:0};V.solLen=0;V.urfIdx=0;V.valid1=0;V.verbose=0;wu=12,Us=7,vu=!1;uo(150,1,{},Pu);V.depth1=0;V.length_0=0;V.urfIdx=0;V.verbose=0;Ee=Al("int","I");lr("com.google.gwt.lang","CollapsedPropertyHolder",252);lr("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);nB=lr("com.google.gwt.lang","LongLibBase/LongEmul",null);lr("com.google.gwt.lang","ModuleUtils",257);ee=Al("byte","B"),oB=Al("long","J"),de=Al("char","C");lr("com.google.gwt.user.client.rpc","XsrfToken",null),AL("java.util","Map/Entry");lB=function(){cu(!1)},iB=function(t){return $L(new xu,t)}});async function Tu(){let t=await he["3x3x3"].kpuzzle(),e=t.startState();for(let r of ru)e=e.applyAlg(k.fromString((await Kt())(r)));return eu(t,e)?e:Tu()}function Iu(){return sB??(sB=Promise.resolve().then(()=>(Gu(),Mu)))}async function xs(t){return rt(),k.fromString((await Iu()).solveState(X2(t)))}async function yn(){return xs(await Tu())}async function Nu(){(await Iu()).initialize()}async function Ou(){return gn(await yn(),aB)}async function Wu(){let t=new ft,e=await yn();return t.experimentalPushAlg(_u),t.experimentalPushAlg(e),t.experimentalPushAlg(_u),t.toAlg()}var sB,aB,_u,ws=U(()=>{Ae();_t();nr();Wt();dl();J2();tu();nu();sB=null;aB=[[null,"Rw","Rw2","Rw'","Fw","Fw'"],[null,"Dw","Dw2","Dw'"]];_u=new k("R' U' F")});function ae(t,...e){let r=e.length,n=t[e[r-1]];for(let o=r;o>0;o--)t[e[o]]=t[e[o-1]];return t[e[0]]=n,ae}function Ku(t,e,r,n){r=(r||8)-1;let o=1985229328,l=0;n??(n=0),n<0&&(e<<=1);for(let i=0;i<r;++i){let s=vs[r-i],u=~~(e/s);l^=u,e%=s,u<<=2,t[i]=o>>u&7;let a=(1<<u)-1;o=(o&a)+(o>>4&~a)}return n<0&&(l&1)!=0?(t[r]=t[r-1],t[r-1]=o&7):t[r]=o&7,t}var Le,vs,Qu=U(()=>{Le=[],vs=[1];for(let t=0;t<32;++t){Le[t]=[];for(let e=0;e<32;++e)Le[t][e]=0}for(let t=0;t<32;++t){Le[t][0]=Le[t][t]=1,vs[t+1]=vs[t]*(t+1);for(let e=1;e<t;++e)Le[t][e]=Le[t-1][e-1]+Le[t-1][e]}});var Jf={};Ue(Jf,{initialize:()=>ym,random444Scramble:()=>Um});function T(t,e){let r=new Array(t);if(e!==void 0)for(let n=0;n<t;n++)r[n]=new Array(e);return r}function cB(t){return new Fo[t]}function ut(t,e,r,...n){let o=Fo[t];o&&!o.___clazz$?H=o.prototype:(!o&&(o=Fo[t]=function(){}),H=o.prototype=e<0?{}:cB(e),H.castableTypeMap$=r);for(let l of n)l.prototype=H;o.___clazz$&&(H.___clazz$=o.___clazz$,o.___clazz$=null)}function Br(t){let e={};for(let r=0,n=t.length;r<n;++r)e[t[r]]=1;return e}function Hu(){}function pB(t,e){let r=Yu(0,e);return Zu(t.___clazz$,t.castableTypeMap$,t.queryId$,r),r}function Yu(t,e){let r=new Array(e);if(t===3)for(let n=0;n<e;++n){let o={m:0,l:0,h:0};o.l=o.m=o.h=0,r[n]=o}else if(t>0){let n=[null,0,!1][t];for(let o=0;o<e;++o)r[o]=n}return r}function zs(t,e,r,n,o){let l=Yu(o,n);return Zu(t,e,r,l),l}function Zu(t,e,r,n){return Ju(),dB(n,Cs,Ps),n.___clazz$=t,n.castableTypeMap$=e,n.queryId$=r,n}function Nl(t,e,r){return t[e]=r}function Ju(){Xu||(Xu=!0,Cs=[],Ps=[],RB(new Hu,Cs,Ps))}function RB(t,e,r){let n=0,o;for(let l in t)(o=t[l])&&(e[n]=l,r[n]=o,++n)}function dB(t,e,r){Ju();for(let n=0,o=e.length;n<o;++n)t[e[n]]=r[n]}function DB(t,e){return t.castableTypeMap$&&!!t.castableTypeMap$[e]}function FB(t,e){return t!==null&&DB(t,e)}function AB(){if($u)return!1;$u=!0,Ql=T(15582,36),jl=T(15582),bt=T(15582),Sn=T(48,48),St=T(48,36),bn=T(48),Ts=T(48)}function Ms(t){t.ct=T(24)}function ef(t,e){let r,n;if(FB(e,qu)){for(r=e,n=0;n<24;++n)if(t.ct[n]!==r.ct[n])return!1;return!0}return!1}function Ol(t){let e,r,n;for(r=0,n=8,e=23;e>=0;--e)t.ct[e]===1&&(r+=Le[e][n--]);return r}function _l(t){let e,r;if(Un!==null)return Un[Ol(t)];for(r=0;r<48;++r){if(e=xB(Ol(t)),e!==-1)return e*64+r;le(t,0),r%2==1&&le(t,1),r%8==7&&le(t,2),r%16==15&&le(t,3)}}function Ut(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:d(t.ct,0,1,2,3,r);break;case 1:d(t.ct,16,17,18,19,r);break;case 2:d(t.ct,8,9,10,11,r);break;case 3:d(t.ct,4,5,6,7,r);break;case 4:d(t.ct,20,21,22,23,r);break;case 5:d(t.ct,12,13,14,15,r);break;case 6:d(t.ct,0,1,2,3,r),d(t.ct,8,20,12,16,r),d(t.ct,9,21,13,17,r);break;case 7:d(t.ct,16,17,18,19,r),d(t.ct,1,15,5,9,r),d(t.ct,2,12,6,10,r);break;case 8:d(t.ct,8,9,10,11,r),d(t.ct,2,19,4,21,r),d(t.ct,3,16,5,22,r);break;case 9:d(t.ct,4,5,6,7,r),d(t.ct,10,18,14,22,r),d(t.ct,11,19,15,23,r);break;case 10:d(t.ct,20,21,22,23,r),d(t.ct,0,8,4,14,r),d(t.ct,3,11,7,13,r);break;case 11:d(t.ct,12,13,14,15,r),d(t.ct,1,20,7,18,r),d(t.ct,0,23,6,17,r)}}function le(t,e){switch(e){case 0:Ut(t,19),Ut(t,28);break;case 1:Ut(t,21),Ut(t,32);break;case 2:d(t.ct,0,3,1,2,1),d(t.ct,8,11,9,10,1),d(t.ct,4,7,5,6,1),d(t.ct,12,15,13,14,1),d(t.ct,16,19,21,22,1),d(t.ct,17,18,20,23,1);break;case 3:Ut(t,18),Ut(t,29),Ut(t,24),Ut(t,35)}}function tf(t,e){let r;for(r=0;r<e;++r)le(t,0),r%2==1&&le(t,1),r%8==7&&le(t,2),r%16==15&&le(t,3)}function Gs(t,e){let r,n;for(n=8,r=23;r>=0;--r)t.ct[r]=0,e>=Le[r][n]&&(e-=Le[r][n--],t.ct[r]=1)}function Wl(t,e){let r;for(r=0;r<24;++r)t.ct[r]=e.ct[r]}function Ao(){let t;for(Ms(this),t=0;t<8;++t)this.ct[t]=1;for(t=8;t<24;++t)this.ct[t]=0}function Kl(t,e){let r;for(Ms(this),r=0;r<24;++r)this.ct[r]=~~(t.ct[r]/2)===e?1:0}function ho(t){let e;for(Ms(this),e=0;e<24;++e)this.ct[e]=t[e]}function hB(){let t,e,r=new Ao,n=new Ao;for(t=0;t<15582;++t)for(Gs(n,jl[t]),e=0;e<36;++e)Wl(r,n),Ut(r,e),Ql[t][e]=_l(r)}function yB(){let t,e,r,n,o,l,i,s;for(ui(bt),bt[0]=0,e=0,r=1;r!==15582;)for(l=e>4,s=l?-1:e,t=l?e:-1,++e,n=0;n<15582;++n)if(bt[n]===s){for(i=0;i<27;++i)if(o=~~Ql[n][i]>>>6,bt[o]===t)if(++r,l){bt[n]=e;break}else bt[o]=e}}function UB(t){let e,r,n,o=new ho(t.ct);for(n=0;n<48;++n){for(e=!0,r=0;r<24;++r)if(o.ct[r]!==~~(r/4)){e=!1;break}if(e)return n;le(o,0),n%2==1&&le(o,1),n%8==7&&le(o,2),n%16==15&&le(o,3)}return-1}function bB(){let t,e,r,n=new Ao;for(t=0;t<24;++t)n.ct[t]=t;let o=new ho(n.ct),l=new ho(n.ct),i=new ho(n.ct);for(t=0;t<48;++t){for(e=0;e<48;++e){for(r=0;r<48;++r)ef(n,o)&&(Sn[t][e]=r,r===0&&(bn[t]=e)),le(o,0),r%2==1&&le(o,1),r%8==7&&le(o,2),r%16==15&&le(o,3);le(n,0),e%2==1&&le(n,1),e%8==7&&le(n,2),e%16==15&&le(n,3)}le(n,0),t%2==1&&le(n,1),t%8==7&&le(n,2),t%16==15&&le(n,3)}for(t=0;t<48;++t)for(Wl(n,l),tf(n,bn[t]),e=0;e<36;++e)for(Wl(o,n),Ut(o,e),tf(o,t),r=0;r<36;++r)if(Wl(i,l),Ut(i,r),ef(i,o)){St[t][e]=r;break}for(Gs(n,0),t=0;t<48;++t)Ts[bn[t]]=Ol(n),le(n,0),t%2==1&&le(n,1),t%8==7&&le(n,2),t%16==15&&le(n,3)}function SB(){let t,e,r,n,o=new Ao,l=T(22984);for(e=0;e<22984;e++)l[e]=0;for(t=0,e=0;e<735471;++e)if((l[~~e>>>5]&1<<(e&31))==0){for(Gs(o,e),n=0;n<48;++n)r=Ol(o),l[~~r>>>5]|=1<<(r&31),Un!==null&&(Un[r]=t<<6|bn[n]),le(o,0),n%2==1&&le(o,1),n%8==7&&le(o,2),n%16==15&&le(o,3);jl[t++]=e}}function xB(t){let e=mm(jl,t);return e>=0?e:-1}function wB(){rf||(rf=!0,Yl=T(70,28),Hl=T(6435,28),uf=T(70,16),sf=T(6435,16),Xe=T(450450),af=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0])}function ql(t){let e,r,n;for(r=0,n=8,e=14;e>=0;--e)t.ct[e]!==t.ct[15]&&(r+=Le[e][n--]);return r}function Vl(t){let e,r,n;for(r=0,n=4,e=6;e>=0;--e)t.rl[e]!==t.rl[7]&&(r+=Le[e][n--]);return r*2+t.parity}function xn(t,e){t.parity^=af[e];let r=e%3;switch(e=~~(e/3),e){case 0:d(t.ct,0,1,2,3,r);break;case 1:d(t.rl,0,1,2,3,r);break;case 2:d(t.ct,8,9,10,11,r);break;case 3:d(t.ct,4,5,6,7,r);break;case 4:d(t.rl,4,5,6,7,r);break;case 5:d(t.ct,12,13,14,15,r);break;case 6:d(t.ct,0,1,2,3,r),d(t.rl,0,5,4,1,r),d(t.ct,8,9,12,13,r);break;case 7:d(t.rl,0,1,2,3,r),d(t.ct,1,15,5,9,r),d(t.ct,2,12,6,10,r);break;case 8:d(t.ct,8,9,10,11,r),d(t.rl,0,3,6,5,r),d(t.ct,3,2,5,4,r);break;case 9:d(t.ct,4,5,6,7,r),d(t.rl,3,2,7,6,r),d(t.ct,11,10,15,14,r);break;case 10:d(t.rl,4,5,6,7,r),d(t.ct,0,8,4,14,r),d(t.ct,3,11,7,13,r);break;case 11:d(t.ct,12,13,14,15,r),d(t.rl,1,4,7,2,r),d(t.ct,1,0,7,6,r)}}function wn(t,e){switch(e){case 0:xn(t,19),xn(t,28);break;case 1:xn(t,21),xn(t,32);break;case 2:d(t.ct,0,3,1,2,1),d(t.ct,8,11,9,10,1),d(t.ct,4,7,5,6,1),d(t.ct,12,15,13,14,1),d(t.rl,0,3,5,6,1),d(t.rl,1,2,4,7,1)}}function nf(t,e,r){let n;for(n=0;n<16;++n)t.ct[n]=~~(e.ct[n]/2);for(n=0;n<8;++n)t.rl[n]=e.ct[n+16];t.parity=r}function of(t,e){let r,n;for(n=8,t.ct[15]=0,r=14;r>=0;--r)e>=Le[r][n]?(e-=Le[r][n--],t.ct[r]=1):t.ct[r]=0}function lf(t,e){let r,n;for(t.parity=e&1,e>>>=1,n=4,t.rl[7]=0,r=6;r>=0;--r)e>=Le[r][n]?(e-=Le[r][n--],t.rl[r]=1):t.rl[r]=0}function Is(){this.rl=T(8),this.ct=T(16)}function vB(){let t,e,r,n,o,l,i,s,u,a,f=new Is;for(o=0;o<70;++o)for(s=0;s<28;++s)lf(f,o),xn(f,Nr[s]),Yl[o][s]=Vl(f);for(o=0;o<70;++o)for(lf(f,o),i=0;i<16;++i)uf[o][i]=Vl(f),wn(f,0),i%2==1&&wn(f,1),i%8==7&&wn(f,2);for(o=0;o<6435;++o)for(of(f,o),i=0;i<16;++i)sf[o][i]=ql(f)&65535,wn(f,0),i%2==1&&wn(f,1),i%8==7&&wn(f,2);for(o=0;o<6435;++o)for(s=0;s<28;++s)of(f,o),xn(f,Nr[s]),Hl[o][s]=ql(f)&65535;for(ui(Xe),Xe[0]=Xe[18]=Xe[28]=Xe[46]=Xe[54]=Xe[56]=0,r=0,n=6;n!==450450;){let g=r>6,L=g?-1:r,B=g?r:-1;for(++r,o=0;o<450450;++o)if(Xe[o]===L){for(t=~~(o/70),u=o%70,s=0;s<23;++s)if(e=Hl[t][s],a=Yl[u][s],l=e*70+a,Xe[l]===B)if(++n,g){Xe[o]=r;break}else Xe[l]=r}}}function EB(){ff||(ff=!0,yo=T(29400,20),Lf=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1],mr=T(29400),_s=[0,9,14,23,27,28,41,42,46,55,60,69],Ws=T(70))}function Ns(t){let e,r,n,o;for(r=0,o=4,e=6;e>=0;--e)t.ud[e]!==t.ud[7]&&(r+=Le[e][o--]);for(r*=35,o=4,e=6;e>=0;--e)t.fb[e]!==t.fb[7]&&(r+=Le[e][o--]);r*=12;let l=t.fb[7]^t.ud[7];for(n=0,o=4,e=7;e>=0;--e)t.rl[e]!==l&&(n+=Le[e][o--]);return t.parity+2*(r+Ws[n])}function kB(t,e){switch(t.parity^=Lf[e],e){case 0:case 1:case 2:d(t.ud,0,1,2,3,e%3);break;case 3:d(t.rl,0,1,2,3,1);break;case 4:case 5:case 6:d(t.fb,0,1,2,3,(e-1)%3);break;case 7:case 8:case 9:d(t.ud,4,5,6,7,(e-1)%3);break;case 10:d(t.rl,4,5,6,7,1);break;case 11:case 12:case 13:d(t.fb,4,5,6,7,(e+1)%3);break;case 14:d(t.ud,0,1,2,3,1),d(t.rl,0,5,4,1,1),d(t.fb,0,5,4,1,1);break;case 15:d(t.rl,0,1,2,3,1),d(t.fb,1,4,7,2,1),d(t.ud,1,6,5,2,1);break;case 16:d(t.fb,0,1,2,3,1),d(t.ud,3,2,5,4,1),d(t.rl,0,3,6,5,1);break;case 17:d(t.ud,4,5,6,7,1),d(t.rl,3,2,7,6,1),d(t.fb,3,2,7,6,1);break;case 18:d(t.rl,4,5,6,7,1),d(t.fb,0,3,6,5,1),d(t.ud,0,3,4,7,1);break;case 19:d(t.fb,4,5,6,7,1),d(t.ud,0,7,6,1,1),d(t.rl,1,4,7,2,1)}}function gf(t,e,r){let n,o=(e.ct[0]>e.ct[8]?1:0)^(e.ct[8]>e.ct[16]?1:0)^(e.ct[0]>e.ct[16]?1:0)?1:0;for(n=0;n<8;++n)t.ud[n]=e.ct[n]&1^1,t.fb[n]=e.ct[n+8]&1^1,t.rl[n]=e.ct[n+16]&1^1^o;t.parity=o^r}function zB(t,e){let r,n,o,l;for(t.parity=e&1,e>>>=1,o=_s[e%12],e=~~(e/12),l=4,r=7;r>=0;--r)t.rl[r]=0,o>=Le[r][l]&&(o-=Le[r][l--],t.rl[r]=1);for(n=e%35,e=~~(e/35),l=4,t.fb[7]=0,r=6;r>=0;--r)n>=Le[r][l]?(n-=Le[r][l--],t.fb[r]=1):t.fb[r]=0;for(l=4,t.ud[7]=0,r=6;r>=0;--r)e>=Le[r][l]?(e-=Le[r][l--],t.ud[r]=1):t.ud[r]=0}function Os(){this.ud=T(8),this.rl=T(8),this.fb=T(8)}function CB(){let t,e,r,n;for(r=0;r<12;++r)Ws[_s[r]]=r;let o=new Os;for(r=0;r<29400;++r)for(n=0;n<20;++n)zB(o,r),kB(o,n),yo[r][n]=Ns(o)&65535;for(ui(mr),mr[0]=0,t=0,e=1;e!==29400;){for(r=0;r<29400;++r)if(mr[r]===t)for(n=0;n<17;++n)mr[yo[r][n]]===-1&&(mr[yo[r][n]]=t+1,++e);++t}}function PB(t,e){let r;for(r=0;r<24;++r)t.ct[r]=e.ct[r]}function MB(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:d(t.ct,0,1,2,3,r);break;case 1:d(t.ct,16,17,18,19,r);break;case 2:d(t.ct,8,9,10,11,r);break;case 3:d(t.ct,4,5,6,7,r);break;case 4:d(t.ct,20,21,22,23,r);break;case 5:d(t.ct,12,13,14,15,r);break;case 6:d(t.ct,0,1,2,3,r),d(t.ct,8,20,12,16,r),d(t.ct,9,21,13,17,r);break;case 7:d(t.ct,16,17,18,19,r),d(t.ct,1,15,5,9,r),d(t.ct,2,12,6,10,r);break;case 8:d(t.ct,8,9,10,11,r),d(t.ct,2,19,4,21,r),d(t.ct,3,16,5,22,r);break;case 9:d(t.ct,4,5,6,7,r),d(t.ct,10,18,14,22,r),d(t.ct,11,19,15,23,r);break;case 10:d(t.ct,20,21,22,23,r),d(t.ct,0,8,4,14,r),d(t.ct,3,11,7,13,r);break;case 11:d(t.ct,12,13,14,15,r),d(t.ct,1,20,7,18,r),d(t.ct,0,23,6,17,r)}}function Ks(){let t;for(this.ct=T(24),t=0;t<24;++t)this.ct[t]=~~(t/4)}function Bf(t){let e,r,n;for(Ks.call(this),e=0;e<23;++e)n=e+t(24-e),this.ct[n]!==this.ct[e]&&(r=this.ct[e],this.ct[e]=this.ct[n],this.ct[n]=r)}function GB(){mf||(mf=!0,mt=T(18),NB())}function cf(t){t.cp=[0,1,2,3,4,5,6,7],t.co=[0,0,0,0,0,0,0,0]}function pf(t,e){let r;for(r=0;r<8;++r)t.cp[r]=e.cp[r],t.co[r]=e.co[r]}function TB(t,e){!t.temps&&(t.temps=new Zl),Rf(t,mt[e],t.temps),pf(t,t.temps)}function IB(t,e){let r,n;for(n=0,r=6;r>=0;--r)n+=t.co[r]=e%3,e=~~(e/3);t.co[7]=(15-n)%3}function Rf(t,e,r){let n,o,l,i;for(n=0;n<8;++n)r.cp[n]=t.cp[e.cp[n]],l=t.co[e.cp[n]],i=e.co[n],o=l,o=o+(l<3?i:6-i),o=o%3,(l>=3?1:0)^(i>=3?1:0)&&(o=o+3),r.co[n]=o}function Zl(){cf(this)}function cr(t,e){cf(this),Ku(this.cp,t),IB(this,e)}function df(t){cr.call(this,t(40320),t(2187))}function NB(){let t,e;for(mt[0]=new cr(15120,0),mt[3]=new cr(21021,1494),mt[6]=new cr(8064,1236),mt[9]=new cr(9,0),mt[12]=new cr(1230,412),mt[15]=new cr(224,137),t=0;t<18;t+=3)for(e=0;e<2;++e)mt[t+e+1]=new Zl,Rf(mt[t+e],mt[t],mt[t+e+1])}function OB(){Df||(Df=!0,xt=T(1937880),ei=T(1538),ti=T(1538),Cn=T(11880),bf=[0,1,6,3,4,5,2,7],Vs=T(160,12),Hs=T(160,12),qs=[1,1,1,3,12,60,360,2520,20160,181440,1814400,19958400,239500800],js=[0,2,4,6,1,3,7,5,8,9,10,11])}function vn(t,e,r,n,o){let l=t.edgeo[o];t.edgeo[o]=t.edge[n],t.edge[n]=t.edgeo[r],t.edgeo[r]=t.edge[e],t.edge[e]=l}function En(t,e){let r,n,o,l,i;for(t.isStd||yf(t),n=0,i=1985229328,l=47768,r=0;r<e;++r)o=t.edge[r]<<2,n*=12-r,o>=32?(n+=l>>o-32&15,l-=4368<<o-32):(n+=i>>o&15,l-=4369,i-=286331152<<o);return n}function Ff(t){let e,r=En(t,4);e=Cn[r];let n=e&7;e>>=3,Jl(t,n);let o=En(t,10)%20160;return e*20160+o}function Xl(t,e){switch(t.isStd=!1,e){case 0:ae(t.edge,0,4,1,5),ae(t.edgeo,0,4,1,5);break;case 1:ce(t.edge,0,4,1,5),ce(t.edgeo,0,4,1,5);break;case 2:ae(t.edge,0,5,1,4),ae(t.edgeo,0,5,1,4);break;case 3:ce(t.edge,5,10,6,11),ce(t.edgeo,5,10,6,11);break;case 4:ae(t.edge,0,11,3,8),ae(t.edgeo,0,11,3,8);break;case 5:ce(t.edge,0,11,3,8),ce(t.edgeo,0,11,3,8);break;case 6:ae(t.edge,0,8,3,11),ae(t.edgeo,0,8,3,11);break;case 7:ae(t.edge,2,7,3,6),ae(t.edgeo,2,7,3,6);break;case 8:ce(t.edge,2,7,3,6),ce(t.edgeo,2,7,3,6);break;case 9:ae(t.edge,2,6,3,7),ae(t.edgeo,2,6,3,7);break;case 10:ce(t.edge,4,8,7,9),ce(t.edgeo,4,8,7,9);break;case 11:ae(t.edge,1,9,2,10),ae(t.edgeo,1,9,2,10);break;case 12:ce(t.edge,1,9,2,10),ce(t.edgeo,1,9,2,10);break;case 13:ae(t.edge,1,10,2,9),ae(t.edgeo,1,10,2,9);break;case 14:ce(t.edge,0,4,1,5),ce(t.edgeo,0,4,1,5),ae(t.edge,9,11),ae(t.edgeo,8,10);break;case 15:ce(t.edge,5,10,6,11),ce(t.edgeo,5,10,6,11),ae(t.edge,1,3),ae(t.edgeo,0,2);break;case 16:ce(t.edge,0,11,3,8),ce(t.edgeo,0,11,3,8),ae(t.edge,5,7),ae(t.edgeo,4,6);break;case 17:ce(t.edge,2,7,3,6),ce(t.edgeo,2,7,3,6),ae(t.edge,8,10),ae(t.edgeo,9,11);break;case 18:ce(t.edge,4,8,7,9),ce(t.edgeo,4,8,7,9),ae(t.edge,0,2),ae(t.edgeo,1,3);break;case 19:ce(t.edge,1,9,2,10),ce(t.edgeo,1,9,2,10),ae(t.edge,4,6),ae(t.edgeo,5,7)}}function kn(t,e){switch(t.isStd=!1,e){case 0:Xl(t,14),Xl(t,17);break;case 1:vn(t,11,5,10,6),vn(t,5,10,6,11),vn(t,1,2,3,0),vn(t,4,9,7,8),vn(t,8,4,9,7),vn(t,0,1,2,3);break;case 2:ct(t,4,5),ct(t,5,4),ct(t,11,8),ct(t,8,11),ct(t,7,6),ct(t,6,7),ct(t,9,10),ct(t,10,9),ct(t,1,1),ct(t,0,0),ct(t,3,3),ct(t,2,2)}}function Jl(t,e){for(;e>=2;)e-=2,kn(t,1),kn(t,2);e!==0&&kn(t,0)}function Uo(t,e){let r,n,o,l,i,s;for(i=1985229328,s=47768,o=0,r=0;r<11;++r)if(n=qs[11-r],l=~~(e/n),e=e%n,o^=l,l<<=2,l>=32){l=l-32,t.edge[r]=s>>l&15;let u=(1<<l)-1;s=(s&u)+(s>>4&~u)}else{t.edge[r]=i>>l&15;let u=(1<<l)-1;i=(i&u)+(i>>>4&~u)+(s<<28),s=s>>4}for((o&1)==0?t.edge[11]=i:(t.edge[11]=t.edge[10],t.edge[10]=i),r=0;r<12;++r)t.edgeo[r]=r;t.isStd=!0}function Af(t,e){let r;for(r=0;r<12;++r)t.edge[r]=e.edge[r],t.edgeo[r]=e.edgeo[r];t.isStd=e.isStd}function hf(t,e){let r,n,o,l;for(t.temp===null&&(t.temp=T(12)),r=0;r<12;++r)t.temp[r]=r,t.edge[r]=e.ep[js[r]+12]%12;for(n=1,r=0;r<12;++r)for(;t.edge[r]!==r;)l=t.edge[r],t.edge[r]=t.edge[l],t.edge[l]=l,o=t.temp[r],t.temp[r]=t.temp[l],t.temp[l]=o,n^=1;for(r=0;r<12;++r)t.edge[r]=t.temp[e.ep[js[r]]%12];return n}function yf(t){let e;for(t.temp===null&&(t.temp=T(12)),e=0;e<12;++e)t.temp[t.edgeo[e]]=e;for(e=0;e<12;++e)t.edge[e]=t.temp[t.edge[e]],t.edgeo[e]=e;t.isStd=!0}function ce(t,e,r,n,o){let l;l=t[e],t[e]=t[n],t[n]=l,l=t[r],t[r]=t[o],t[o]=l}function ct(t,e,r){let n=t.edge[e];t.edge[e]=t.edgeo[r],t.edgeo[r]=n}function Yt(){this.edge=T(12),this.edgeo=T(12)}function _B(){let t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m,F,A,b,h,C,E,q=new Yt,re=new Yt,I=new Yt;for(ui(xt),s=0,$l=1,Qs(xt,0,0);$l!==31006080&&(p=s>9,i=s%3,l=(s+1)%3,a=p?3:i,t=p?i:3,!(s>=9));){for(g=0;g<31006080;g+=16)if(E=xt[~~g>>4],!(!p&&E===-1)){for(f=g,u=g+16;f<u;++f,E>>=2)if((E&3)===a){for(b=~~(f/20160),e=ei[b],n=f%20160,Uo(q,e*20160+n),F=0;F<17;++F)if(r=zn(q.edge,F<<3,4),h=Cn[r],C=h&7,h>>=3,o=zn(q.edge,F<<3|C,10)%20160,L=h*20160+o,bo(xt,L)===t){if(Qs(xt,p?f:L,l),++$l,p)break;if(A=ti[h],A!==1)for(Af(re,q),Xl(re,F),Jl(re,C),m=1;(A=~~A>>1&65535)!=0;++m)(A&1)==1&&(Af(I,re),Jl(I,m),B=h*20160+En(I,10)%20160,bo(xt,B)===t&&(Qs(xt,B,l),++$l))}}}++s}}function bo(t,e){return t[e>>4]>>((e&15)<<1)&3}function zn(t,e,r){let n,o,l,i,s,u=Hs[e],a=Vs[e];for(o=0,s=1985229328,i=47768,n=0;n<r;++n)l=u[t[a[n]]]<<2,o*=12-n,l>=32?(o+=i>>l-32&15,i-=4368<<l-32):(o+=s>>l&15,i-=4369,s-=286331152<<l);return o}function Uf(t){let e,r,n,o,l,i,s,u,a,f,g,L=new Yt;if(i=0,l=bo(xt,t),l===3)return 10;for(;t!==0;)for(l===0?l=2:--l,a=~~(t/20160),e=ei[a],n=t%20160,Uo(L,e*20160+n),u=0;u<17;++u)if(r=zn(L.edge,u<<3,4),f=Cn[r],g=f&7,f>>=3,o=zn(L.edge,u<<3|g,10)%20160,s=f*20160+o,bo(xt,s)===l){++i,t=s;break}return i}function WB(t,e){let r=bo(xt,t);return r===3?10:(1227133513<<r>>e&3)+e-1}function KB(){let t,e,r,n=new Yt;for(e=0;e<20;++e)for(r=0;r<8;++r){for(Uo(n,0),Xl(n,e),Jl(n,r),t=0;t<12;++t)Vs[e<<3|r][t]=n.edge[t];for(yf(n),t=0;t<12;++t)Hs[e<<3|r][t]=n.temp[t]}}function QB(){let t,e,r,n,o=new Yt,l=T(1485);for(e=0;e<1485;e++)l[e]=0;for(t=0,e=0;e<11880;++e)if((l[~~e>>>3]&1<<(e&7))==0){for(Uo(o,e*qs[8]),n=0;n<8;++n)r=En(o,4),r===e&&(ti[t]=(ti[t]|1<<n)&65535),l[~~r>>3]=l[~~r>>3]|1<<(r&7),Cn[r]=t<<3|bf[n],kn(o,0),n%2==1&&(kn(o,1),kn(o,2));ei[t++]=e}}function Qs(t,e,r){t[e>>4]^=(3^r)<<((e&15)<<1)}function jB(){Sf||(Sf=!0)}function qB(t){let e,r,n;for(e=0,n=!1,r=0;r<12;++r)e|=1<<t.ep[r],n=n!==t.ep[r]>=12;return e&=~~e>>12,e===0&&!n}function VB(t,e){let r;for(r=0;r<24;++r)t.ep[r]=e.ep[r]}function HB(t,e){let r=e%3;switch(e=~~(e/3),e){case 0:d(t.ep,0,1,2,3,r),d(t.ep,12,13,14,15,r);break;case 1:d(t.ep,11,15,10,19,r),d(t.ep,23,3,22,7,r);break;case 2:d(t.ep,0,11,6,8,r),d(t.ep,12,23,18,20,r);break;case 3:d(t.ep,4,5,6,7,r),d(t.ep,16,17,18,19,r);break;case 4:d(t.ep,1,20,5,21,r),d(t.ep,13,8,17,9,r);break;case 5:d(t.ep,2,9,4,10,r),d(t.ep,14,21,16,22,r);break;case 6:d(t.ep,0,1,2,3,r),d(t.ep,12,13,14,15,r),d(t.ep,9,22,11,20,r);break;case 7:d(t.ep,11,15,10,19,r),d(t.ep,23,3,22,7,r),d(t.ep,2,16,6,12,r);break;case 8:d(t.ep,0,11,6,8,r),d(t.ep,12,23,18,20,r),d(t.ep,3,19,5,13,r);break;case 9:d(t.ep,4,5,6,7,r),d(t.ep,16,17,18,19,r),d(t.ep,8,23,10,21,r);break;case 10:d(t.ep,1,20,5,21,r),d(t.ep,13,8,17,9,r),d(t.ep,14,0,18,4,r);break;case 11:d(t.ep,2,9,4,10,r),d(t.ep,14,21,16,22,r),d(t.ep,7,15,1,17,r)}}function Ys(){let t;for(this.ep=T(24),t=0;t<24;++t)this.ep[t]=t}function xf(t){let e,r,n;for(Ys.call(this),e=0;e<23;++e)n=e+t(24-e),n!==e&&(r=this.ep[e],this.ep[e]=this.ep[n],this.ep[n]=r)}function YB(){wf||(wf=!0,Zs=[35,1,34,2,4,6,22,5,19])}function vf(t){t.moveBuffer=T(60)}function ZB(t,e){return t.value-e.value}function Pn(t,e){let r;for(VB(t.edge,e.edge),PB(t.center,e.center),pf(t.corner,e.corner),t.value=e.value,t.add1=e.add1,t.length1=e.length1,t.length2=e.length2,t.length3=e.length3,t.sym=e.sym,r=0;r<60;++r)t.moveBuffer[r]=e.moveBuffer[r];t.moveLength=e.moveLength,t.edgeAvail=e.edgeAvail,t.centerAvail=e.centerAvail,t.cornerAvail=e.cornerAvail}function pr(t){for(;t.centerAvail<t.moveLength;)MB(t.center,t.moveBuffer[t.centerAvail++]);return t.center}function Ef(t){for(;t.cornerAvail<t.moveLength;)TB(t.corner,t.moveBuffer[t.cornerAvail++]%18);return t.corner}function So(t){for(;t.edgeAvail<t.moveLength;)HB(t.edge,t.moveBuffer[t.edgeAvail++]);return t.edge}function XB(t){let e,r,n,o,l,i,s=new Array(t.moveLength-(t.add1?2:0));for(r=0,e=0;e<t.length1;++e)s[r++]=t.moveBuffer[e];for(i=t.sym,e=t.length1+(t.add1?2:0);e<t.moveLength;++e)St[i][t.moveBuffer[e]]>=27?(s[r++]=St[i][t.moveBuffer[e]]-9,o=Zs[St[i][t.moveBuffer[e]]-27],i=Sn[i][o]):s[r++]=St[i][t.moveBuffer[e]];let u=Sn[bn[i]][UB(pr(t))];for(l="",i=u,e=r-1;e>=0;--e)n=s[e],n=~~(n/3)*3+(2-n%3),St[i][n]>=27?(l=l+Xs[St[i][n]-9]+" ",o=Zs[St[i][n]-27],i=Sn[i][o]):l=l+Xs[St[i][n]]+" ";return l}function Ir(t,e){t.moveBuffer[t.moveLength++]=e}function ri(){vf(this),this.edge=new Ys,this.center=new Ks,this.corner=new Zl}function ni(t){ri.call(this),Pn(this,t)}function kf(t){vf(this),this.edge=new xf(t),this.center=new Bf(t),this.corner=new df(t)}function JB(t,e){return e.value-t.value}function oi(t,e){return JB(t,e)}function zf(){}function $B(){if(Cf)return;Cf=!0;let t,e;for(Xs=["U ","U2 ","U' ","R ","R2 ","R' ","F ","F2 ","F' ","D ","D2 ","D' ","L ","L2 ","L' ","B ","B2 ","B' ","Uw ","Uw2","Uw'","Rw ","Rw2","Rw'","Fw ","Fw2","Fw'","Dw ","Dw2","Dw'","Lw ","Lw2","Lw'","Bw ","Bw2","Bw'"],Nr=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,22,23,25,28,30,31,32,34,36],xo=[0,1,2,4,6,7,8,9,10,11,13,15,16,17,19,22,25,28,31,34,36],Pf=T(37),Mf=T(37),Mn=T(37,36),li=T(29,28),ii=T(21,20),Js=T(36),wo=T(28),Gn=T(20),t=0;t<29;++t)Pf[Nr[t]]=t;for(t=0;t<21;++t)Mf[xo[t]]=t;for(t=0;t<36;++t){for(e=0;e<36;++e)Mn[t][e]=~~(t/3)==~~(e/3)||~~(t/3)%3==~~(e/3)%3&&t>e;Mn[36][t]=!1}for(t=0;t<29;++t)for(e=0;e<28;++e)li[t][e]=Mn[Nr[t]][Nr[e]];for(t=0;t<21;++t)for(e=0;e<20;++e)ii[t][e]=Mn[xo[t]][xo[e]];for(t=0;t<36;++t)for(Js[t]=36,e=t;e<36;++e)if(!Mn[t][e]){Js[t]=e-1;break}for(t=0;t<28;++t)for(wo[t]=28,e=t;e<28;++e)if(!li[t][e]){wo[t]=e-1;break}for(t=0;t<20;++t)for(Gn[t]=20,e=t;e<20;++e)if(!ii[t][e]){Gn[t]=e-1;break}}function em(t){let e,r,n,o,l,i,s,u,a,f,g,L;t.solution="";let B=_l(new Kl(pr(t.c),0)),p=_l(new Kl(pr(t.c),1)),m=_l(new Kl(pr(t.c),2)),F=bt[~~B>>6],A=bt[~~p>>6],b=bt[~~m>>6];for(t.p1SolsCnt=0,t.arr2idx=0,um(t.p1sols.heap),t.length1=(F<A?F:A)<b?F<A?F:A:b;t.length1<100&&!(b<=t.length1&&si(t,~~m>>>6,m&63,t.length1,-1,0)||F<=t.length1&&si(t,~~B>>>6,B&63,t.length1,-1,0)||A<=t.length1&&si(t,~~p>>>6,p&63,t.length1,-1,0));++t.length1);let h=Fm(t.p1sols,zs(hm,Br([LB,Es,ks]),Vu,0,0));h.sort(function(q,re){return q.value-re.value}),e=9;do{e:for(u=h[0].value;u<100;++u)for(i=0;i<h.length&&!(h[i].value>u);++i)if(!(u-h[i].length1>e)&&(Pn(t.c1,h[i]),nf(t.ct2,pr(t.c1),ai(So(t.c1).ep)),g=ql(t.ct2),L=Vl(t.ct2),t.length1=h[i].length1,t.length2=u-h[i].length1,Gf(t,g,L,t.length2,28,0)))break e;++e}while(u===100);t.arr2.sort(function(q,re){return q.value-re.value}),s=0,r=13;do{e:for(a=t.arr2[0].value;a<100;++a)for(i=0;i<Math.min(t.arr2idx,100)&&!(t.arr2[i].value>a);++i)if(!(a-t.arr2[i].length1-t.arr2[i].length2>r)&&(l=hf(t.e12,So(t.arr2[i])),gf(t.ct3,pr(t.arr2[i]),l^ai(Ef(t.arr2[i]).cp)),n=Ns(t.ct3),o=En(t.e12,10),f=Uf(Ff(t.e12)),f<=a-t.arr2[i].length1-t.arr2[i].length2&&Tf(t,o,n,f,a-t.arr2[i].length1-t.arr2[i].length2,20,0))){s=i;break e}++r}while(a===100);let C=new ni(t.arr2[s]);t.length1=C.length1,t.length2=C.length2;let E=a-t.length1-t.length2;for(i=0;i<E;++i)Ir(C,xo[t.move3[i]]);t.solution=XB(C)}function tm(t,e){let r,n;for(Pn(t.c1,t.c),r=0;r<t.length1;++r)Ir(t.c1,t.move1[r]);switch(Ts[e]){case 0:Ir(t.c1,24),Ir(t.c1,35),t.move1[t.length1]=24,t.move1[t.length1+1]=35,t.add1=!0,e=19;break;case 12869:Ir(t.c1,18),Ir(t.c1,29),t.move1[t.length1]=18,t.move1[t.length1+1]=29,t.add1=!0,e=34;break;case 735470:t.add1=!1,e=0}nf(t.ct2,pr(t.c1),ai(So(t.c1).ep));let o=ql(t.ct2),l=Vl(t.ct2),i=Xe[o*70+l];return t.c1.value=i+t.length1,t.c1.length1=t.length1,t.c1.add1=t.add1,t.c1.sym=e,++t.p1SolsCnt,t.p1sols.heap.size<500?n=new ni(t.c1):(n=dm(t.p1sols),n.value>t.c1.value&&Pn(n,t.c1)),im(t.p1sols,n),t.p1SolsCnt===1e4}function rm(t){let e;for(Pn(t.c2,t.c1),e=0;e<t.length2;++e)Ir(t.c2,t.move2[e]);if(!qB(So(t.c2)))return!1;let r=hf(t.e12,So(t.c2));gf(t.ct3,pr(t.c2),r^ai(Ef(t.c2).cp));let n=Ns(t.ct3);En(t.e12,10);let o=Uf(Ff(t.e12));return t.arr2[t.arr2idx]?Pn(t.arr2[t.arr2idx],t.c2):t.arr2[t.arr2idx]=new ni(t.c2),t.arr2[t.arr2idx].value=t.length1+t.length2+Math.max(o,mr[n]),t.arr2[t.arr2idx].length2=t.length2,++t.arr2idx,t.arr2idx===t.arr2.length}function nm(t,e){return Nf(),t.c=new kf(e),em(t),t.solution}function si(t,e,r,n,o,l){let i,s,u,a,f,g;if(e===0)return n===0&&tm(t,r);for(i=0;i<27;i+=3)if(!(i===o||i===o-9||i===o-18))for(a=0;a<3;++a){if(u=i+a,s=Ql[e][St[r][u]],f=bt[~~s>>>6],f>=n){if(f>n)break;continue}if(g=Sn[r][s&63],s>>>=6,t.move1[l]=u,si(t,s,g,n-1,i,l+1))return!0}return!1}function Gf(t,e,r,n,o,l){let i,s,u,a;if(e===0&&Xe[r]===0)return n===0&&rm(t);for(s=0;s<23;++s){if(li[o][s]){s=wo[s];continue}if(i=Hl[e][s],a=Yl[r][s],u=Xe[i*70+a],u>=n){u>n&&(s=wo[s]);continue}if(t.move2[l]=Nr[s],Gf(t,i,a,n-1,s,l+1))return!0}return!1}function Tf(t,e,r,n,o,l,i){let s,u,a,f,g,L,B,p,m;if(o===0)return e===0&&r===0;for(Uo(t.tempe[i],e),g=0;g<17;++g){if(ii[l][g]){g=Gn[g];continue}if(a=yo[r][g],L=mr[a],L>=o){L>o&&g<14&&(g=Gn[g]);continue}if(f=zn(t.tempe[i].edge,g<<3,10),s=~~(f/20160),p=Cn[s],m=p&7,p>>=3,u=zn(t.tempe[i].edge,g<<3|m,10)%20160,B=WB(p*20160+u,n),B>=o){B>o&&g<14&&(g=Gn[g]);continue}if(Tf(t,f,a,B,o-1,g,i+1))return t.move3[i]=g,!0}return!1}function If(){let t;for(this.p1sols=new Vf(new zf),this.move1=T(15),this.move2=T(20),this.move3=T(20),this.c1=new ri,this.c2=new ri,this.ct2=new Is,this.ct3=new Os,this.e12=new Yt,this.tempe=T(20),this.arr2=T(100),t=0;t<20;++t)this.tempe[t]=new Yt}function Nf(){Of||(bB(),Un=T(735471),SB(),hB(),Un=null,yB(),vB(),CB(),KB(),QB(),_B(),Of=!0)}function om(){_f||(_f=!0)}function ai(t){let e,r,n,o;for(o=0,e=0,n=t.length;e<n;++e)for(r=e;r<n;++r)t[e]>t[r]&&(o^=1);return o}function d(t,e,r,n,o,l){let i;switch(l){case 0:i=t[o],t[o]=t[n],t[n]=t[r],t[r]=t[e],t[e]=i;return;case 1:i=t[e],t[e]=t[n],t[n]=i,i=t[r],t[r]=t[o],t[o]=i;return;case 2:i=t[e],t[e]=t[r],t[r]=t[n],t[n]=t[o],t[o]=i;return}}function Wf(){}function Kf(t,e,r,n){let o=new Wf;return o.typeName=t+e,jf(r!==0?-r:0)&&qf(r!==0?-r:0,o),o.modifiers=4,o.superclass=$s,o.componentType=n,o}function Qf(t,e,r,n){let o=new Wf;return o.typeName=t+e,jf(r)&&qf(r,o),o.superclass=n,o}function lm(t){let e=Fo[t.seedId];return t=null,e}function jf(t){return typeof t=="number"&&t>0}function qf(t,e){let r;if(e.seedId=t,t===2)r=String.prototype;else if(t>0){let n=lm(e);if(n)r=n.prototype;else{n=Fo[t]=function(){},n.___clazz$=e;return}}else return;r.___clazz$=e}function im(t,e){if(Rm(t,e))return!0}function sm(t){t.array=zs(Hf,Br([Es,ks]),ju,0,0)}function am(t,e){return Nl(t.array,t.size++,e),!0}function um(t){t.array=zs(Hf,Br([Es,ks]),ju,0,0),t.size=0}function Rr(t,e){return t.array[e]}function fm(t,e){let r=t.array[e];return Bm(t.array,e,1),--t.size,r}function Tn(t,e,r){let n=t.array[e];return Nl(t.array,e,r),n}function gm(t,e){let r;for(e.length<t.size&&(e=pB(e,t.size)),r=0;r<t.size;++r)Nl(e,r,t.array[r]);return e.length>t.size&&Nl(e,t.size,null),e}function Lm(){sm(this),this.array.length=500}function Bm(t,e,r){t.splice(e,r)}function mm(t,e){let r,n,o,l;for(n=0,r=t.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=t[o],l<e)n=o+1;else if(l>e)r=o-1;else return o;return-n-1}function ui(t){cm(t,t.length)}function cm(t,e){let r;for(r=0;r<e;++r)t[r]=-1}function pm(t,e){let r,n,o,l,i=t.heap.size,s=Rr(t.heap,e);for(;e*2+1<i&&(r=(n=2*e+1,o=n+1,l=n,o<i&&oi(Rr(t.heap,o),Rr(t.heap,n))<0&&(l=o),l),!(oi(s,Rr(t.heap,r))<0));)Tn(t.heap,e,Rr(t.heap,r)),e=r;Tn(t.heap,e,s)}function Rm(t,e){let r,n;for(n=t.heap.size,am(t.heap,e);n>0;){if(r=n,n=~~((n-1)/2),oi(Rr(t.heap,n),e)<=0)return Tn(t.heap,r,e),!0;Tn(t.heap,r,Rr(t.heap,n))}return Tn(t.heap,n,e),!0}function dm(t){if(t.heap.size===0)return null;let e=Rr(t.heap,0);return Dm(t),e}function Dm(t){let e=fm(t.heap,t.heap.size-1);0<t.heap.size&&(Tn(t.heap,0,e),pm(t,0))}function Fm(t,e){return gm(t.heap,e)}function Vf(t){this.heap=new Lm,this.cmp=t}function Xf(){Zf||(Zf=!0,$B(),om(),AB(),wB(),EB(),OB(),GB(),jB(),YB(),Yf=new If)}function ym(){Xf(),Nf()}async function Um(){rt(),Xf();let t=k.fromString(nm(Yf,await at()));return(await yn()).concat(t)}var H,Fo,uB,ju,Es,qu,fB,gB,Vu,LB,BB,mB,ks,Xu,Cs,Ps,$u,bt,Ql,Ts,Un,jl,bn,St,Sn,rf,Hl,Xe,sf,af,Yl,uf,ff,yo,Lf,mr,_s,Ws,mf,mt,Df,js,$l,xt,qs,Vs,Hs,Cn,ei,bf,ti,Sf,wf,Zs,Cf,Mn,li,ii,Nr,Xs,xo,Js,wo,Gn,Pf,Mf,Of,_f,$s,Hf,Am,hm,Yf,Zf,$f=U(()=>{Ae();ws();Qu();nr();Wt();Fo={},uB={},ju=0,Es=30,qu=21,fB=22,gB=23,Vu=24,LB=25,BB=34,mB=26,ks=40;ut(1,-1,uB);H.value=null;ut(73,1,{},Hu);H.queryId$=0;Xu=!1;$u=!1;ut(153,1,Br([qu]),Ao,Kl,ho);Un=null,rf=!1;ut(154,1,{},Is);H.parity=0;ff=!1;ut(155,1,{},Os);H.parity=0;ut(156,1,{},Ks,Bf);mf=!1;ut(157,1,Br([fB]),Zl,cr,df);H.temps=null;Df=!1;ut(158,1,Br([gB]),Yt);H.isStd=!0;H.temp=null;$l=0,Sf=!1;ut(159,1,{},Ys,xf);wf=!1;ut(160,1,Br([Vu,BB]),ri,ni,kf);H.compareTo$=function(e){return ZB(this,e)};H.add1=!1;H.center=null;H.centerAvail=0;H.corner=null;H.cornerAvail=0;H.edge=null;H.edgeAvail=0;H.length1=0;H.length2=0;H.length3=0;H.moveLength=0;H.sym=0;H.value=0;ut(161,1,{},zf);H.compare=function(e,r){return oi(e,r)};Cf=!1;ut(163,1,Br([mB]),If);H.add1=!1;H.arr2idx=0;H.c=null;H.length1=0;H.length2=0;H.p1SolsCnt=0;H.solution="";Of=!1,_f=!1;H.val$outerIter=null;H.size=0;ut(239,1,{},Vf);H.cmp=null;H.heap=null;$s=Qf("java.lang.","Object",1,null),Hf=Kf("[Ljava.lang.","Object;",356,$s),Am=Qf("cs.threephase.","FullCube",160,$s),hm=Kf("[Lcs.threephase.","FullCube;",381,Am),Zf=!1});var ta={};Ue(ta,{sgsDataFTO:()=>zm});async function zm(){return km??(km=Cm())}async function Cm(){return Ct(await he.fto.kpuzzle(),\`SubgroupSizes 24 12 11 12 12 11 10 9 11 8 10 9 7 8 10 10 6 9 8 5 7 6 5 4 4 8 7 3 6 6 360
|
|
1149
1149
|
|
|
1150
1150
|
Alg T
|
|
1151
1151
|
Alg B
|
|
@@ -1764,7 +1764,7 @@ Alg BR' B U BR' R BR R' U' BR B'
|
|
|
1764
1764
|
Alg F' BL' BR R' BR BL BR' R BR' F
|
|
1765
1765
|
Alg BR L' BL BR' BL' BR' L U BR U'
|
|
1766
1766
|
Alg U BR' U' BR BL' BR BL BR'
|
|
1767
|
-
\`)}var
|
|
1767
|
+
\`)}var km,ra=U(()=>{_t();fn();km=null});var ug={};Ue(ug,{cachedMegaminxKPuzzleWithoutMO:()=>vo,cachedSGSDataMegaminx:()=>Om,sgsDataMegaminx:()=>ag});async function Tm(){let t=an("megaminx",{allMoves:!0,addRotations:!0}),e=new Ie(t.getKPuzzleDefinition(!0),{experimentalPGNotation:new xr(t,t.getOrbitsDef(!0))});return e.definition.name="megaminx",e}async function vo(){return Im??(Im=Tm())}async function Om(){return Nm??(Nm=ag())}async function ag(){return Ct(await vo(),\`SubgroupSizes 12 5 60 58 60 56 54 57 52 50 54 48 46 51 44 42 48 40 45 38 36 42 34 32 39 30 36 28 26 33 24 30 22 20 27 18 24 16 14 21 12 18 10 15 8 6 2 12 9 3
|
|
1768
1768
|
|
|
1769
1769
|
Alg Rv
|
|
1770
1770
|
Alg Rv2
|
|
@@ -3284,7 +3284,7 @@ Alg L' BL2 L2' F' L2 BL2' L2' F L2'
|
|
|
3284
3284
|
Alg U BL2' U R U' BL2 U' L U2 R' U2' L'
|
|
3285
3285
|
Alg U BR U' L2 F L' U BR' U' L F' L2'
|
|
3286
3286
|
Alg U L' BL2 L' FL' L BL2' L U' L2' FL L2
|
|
3287
|
-
Alg U BR2' U R' U2' L U2 R U' BR2 U' L'\`)}var
|
|
3287
|
+
Alg U BR2' U R' U2' L U2 R U' BR2 U' L'\`)}var Im,Nm,na=U(()=>{He();lo();fn();Im=null;Nm=null});var Bg={};Ue(Bg,{sgsDataPyraminx:()=>Lg,sgsDataPyraminxFixedOrientation:()=>oa});async function Lg(){return Km??(Km=Qm())}async function oa(){return{ordering:(await Lg()).ordering.slice(2)}}async function Qm(){return Ct(await he.pyraminx.kpuzzle(),\`SubgroupSizes 12 9 12 3 10 3 8 6 2 3 3 3 3
|
|
3288
3288
|
|
|
3289
3289
|
Alg B
|
|
3290
3290
|
Alg B'
|
|
@@ -3361,7 +3361,7 @@ Alg r
|
|
|
3361
3361
|
Alg r'
|
|
3362
3362
|
|
|
3363
3363
|
Alg u
|
|
3364
|
-
Alg u'\`)}var
|
|
3364
|
+
Alg u'\`)}var Km,la=U(()=>{_t();fn();Km=null});var Rg={};Ue(Rg,{sgsDataSkewb:()=>pg,sgsDataSkewbFixedCorner:()=>sa,skewbKPuzzleWithoutMOCached:()=>fi});async function Hm(){let t=an("skewb",{allMoves:!0,addRotations:!0});return new Ie(t.getKPuzzleDefinition(!0),{experimentalPGNotation:new xr(t,t.getOrbitsDef(!0))})}async function fi(){return Ym??(Ym=Hm())}async function pg(){return Zm??(Zm=Xm())}async function sa(){return{ordering:(await pg()).ordering.slice(1)}}async function Xm(){return Ct(await fi(),\`SubgroupSizes 24 6 5 12 9 3 4 9 3 3
|
|
3365
3365
|
|
|
3366
3366
|
Alg y
|
|
3367
3367
|
Alg y2
|
|
@@ -3439,9 +3439,9 @@ Alg U L U' B' U L' U' B
|
|
|
3439
3439
|
Alg U' B L U L B' U' L'
|
|
3440
3440
|
|
|
3441
3441
|
Alg U R' U' L B R' B' R
|
|
3442
|
-
Alg R' U' R U B' U' B L\`)}var jm,qm,aa=U(()=>{Ve();lo();fn();jm=null;qm=null});var Ug={};Ue(Ug,{getRandomSquare1ScrambleString:()=>Fc});function Jm(t,e){t.ul=e.ul,t.ur=e.ur,t.dl=e.dl,t.dr=e.dr,t.ml=e.ml}function pg(t,e){var r;e<<=2,e>24?(e=48-e,r=t.ul,t.ul=(~~t.ul>>e|t.ur<<24-e)&16777215,t.ur=(~~t.ur>>e|r<<24-e)&16777215):e>0?(r=t.ul,t.ul=(t.ul<<e|~~t.ur>>24-e)&16777215,t.ur=(t.ur<<e|~~r>>24-e)&16777215):e==0?(r=t.ur,t.ur=t.dl,t.dl=r,t.ml=1-t.ml):e>=-24?(e=-e,r=t.dl,t.dl=(t.dl<<e|~~t.dr>>24-e)&16777215,t.dr=(t.dr<<e|~~r>>24-e)&16777215):e<-24&&(e=48+e,r=t.dl,t.dl=(~~t.dl>>e|t.dr<<24-e)&16777215,t.dr=(~~t.dr>>e|r<<24-e)&16777215)}function $m(t){var e,r,n,o,l;for(n=0,t.arr[0]=Pt(t,0),o=1;o<24;++o)Pt(t,o)!=t.arr[n]&&(t.arr[++n]=Pt(t,o));for(l=0,e=0;e<16;++e)for(r=e+1;r<16;++r)t.arr[e]>t.arr[r]&&(l^=1);return l}function ec(t){var e,r,n,o;return o=t.ur&1118481,o|=~~o>>3,o|=~~o>>6,o=o&15|~~o>>12&48,n=t.ul&1118481,n|=~~n>>3,n|=~~n>>6,n=n&15|~~n>>12&48,r=t.dr&1118481,r|=~~r>>3,r|=~~r>>6,r=r&15|~~r>>12&48,e=t.dl&1118481,e|=~~e>>3,e|=~~e>>6,e=e&15|~~e>>12&48,ko($m(t)<<24|n<<18|o<<12|e<<6|r)}function tc(t,e){var r,n;for(r=0;r<8;++r)t.prm[r]=~~(~~Pt(t,r*3+1)>>1<<24)>>24;for(e.cornperm=Mo(t.prm),e.topEdgeFirst=Pt(t,0)==Pt(t,1),r=e.topEdgeFirst?2:0,n=0;n<4;r+=3,++n)t.prm[n]=~~(~~Pt(t,r)>>1<<24)>>24;for(e.botEdgeFirst=Pt(t,12)==Pt(t,13),r=e.botEdgeFirst?14:12;n<8;r+=3,++n)t.prm[n]=~~(~~Pt(t,r)>>1<<24)>>24;e.edgeperm=Mo(t.prm),e.ml=t.ml}function Pt(t,e){var r;return e<6?r=~~t.ul>>(5-e<<2):e<12?r=~~t.ur>>(11-e<<2):e<18?r=~~t.dl>>(17-e<<2):r=~~t.dr>>(23-e<<2),~~((r&15)<<24)>>24}function fa(t,e,r){e<6?(t.ul&=~(15<<(5-e<<2)),t.ul|=r<<(5-e<<2)):e<12?(t.ur&=~(15<<(11-e<<2)),t.ur|=r<<(11-e<<2)):e<18?(t.dl&=~(15<<(17-e<<2)),t.dl|=r<<(17-e<<2)):(t.dr&=~(15<<(23-e<<2)),t.dr|=r<<(23-e<<2))}function ga(){this.arr=[],this.prm=[]}async function rc(){let t=await st();var e,r,n,o,l,i,s,u,a;for(e=new ga,n=In[t(3678)],l=19088743<<1|286331153,o=19088743<<1,s=i=8,r=0;r<24;r++)(n>>r&1)==0?(u=t(i)<<2,fa(e,23-r,o>>u&15),a=(1<<u)-1,o=(o&a)+(o>>4&~a),--i):(u=t(s)<<2,fa(e,23-r,l>>u&15),fa(e,22-r,l>>u&15),a=(1<<u)-1,l=(l&a)+(l>>4&~a),--s,++r);return e.ml=t(2),e}function nc(){}function oc(t){var e,r,n,o,l,i;for(Jm(t.Search_d,t.Search_c),n=0;n<t.Search_length1;++n)pg(t.Search_d,t.Search_move[n]);for(tc(t.Search_d,t.Search_sq),r=t.Search_sq.edgeperm,e=t.Search_sq.cornperm,l=t.Search_sq.ml,i=Math.max(de[t.Search_sq.edgeperm<<1|l],de[t.Search_sq.cornperm<<1|l]),n=i;n<t.Search_maxlen2;++n)if(gi(t,r,e,t.Search_sq.topEdgeFirst,t.Search_sq.botEdgeFirst,l,n,t.Search_length1,0)){for(o=0;o<n;++o)pg(t.Search_d,t.Search_move[t.Search_length1+o]);return t.Search_sol_string=lc(t,n+t.Search_length1),!0}return!1}function lc(t,e){for(var r="",n=0,o=0,l=e-1;l>=0;l--){var i=t.Search_move[l];i>0?(i=12-i,n=i>6?i-12:i):i<0?(i=12+i,o=i>6?i-12:i):(n==0&&o==0?r+=" / ":r+="("+n+", "+o+") / ",n=o=0)}return(n!==0||o!==0)&&(r+="("+n+", "+o+")"),r}function fi(t,e,r,n,o,l){var i,s,u;if(r==0&&n<4)return n==0&&oc(t);if(l!=0&&(u=Li[e],s=ke[u],s<n&&(t.Search_move[o]=0,fi(t,u,s,n-1,o+1,0))))return!0;if(u=e,l<=0){for(i=0;i+=Co[u],u=~~i>>4,i&=15,!(i>=12||(s=ke[u],s>n));)if(s<n&&(t.Search_move[o]=i,fi(t,u,s,n-1,o+1,1)))return!0}if(u=e,l<=1){for(i=0;i+=zo[u],u=~~i>>4,i&=15,!(i>=6||(s=ke[u],s>n));)if(s<n&&(t.Search_move[o]=-i,fi(t,u,s,n-1,o+1,2)))return!0}return!1}function gi(t,e,r,n,o,l,i,s,u){var a,f,g,L,B,p,m;if(i==0&&!n&&o||u!=0&&n==o&&(g=Go[e],f=Go[r],de[g<<1|1-l]<i&&de[f<<1|1-l]<i&&(t.Search_move[s]=0,gi(t,g,f,n,o,1-l,i-1,s+1,0))))return!0;if(u<=0)for(m=!n,g=m?_r[e]:e,f=m?r:_r[r],L=m?1:2,B=de[g<<1|l],p=de[f<<1|l];L<12&&B<=i&&B<=i;){if(B<i&&p<i&&(t.Search_move[s]=L,gi(t,g,f,m,o,l,i-1,s+1,1)))return!0;m=!m,m?(g=_r[g],B=de[g<<1|l],L+=1):(f=_r[f],p=de[f<<1|l],L+=2)}if(u<=1)for(a=!o,g=a?Nr[e]:e,f=a?r:Nr[r],L=a?1:2,B=de[g<<1|l],p=de[f<<1|l];L<(i>3?6:12)&&B<=i&&B<=i;){if(B<i&&p<i&&(t.Search_move[s]=-L,gi(t,g,f,n,a,l,i-1,s+1,2)))return!0;a=!a,a?(g=Nr[g],B=de[g<<1|l],L+=1):(f=Nr[f],p=de[f<<1|l],L+=2)}return!1}function ic(t,e){var r;for(t.Search_c=e,r=ec(e),t.Search_length1=ke[r];t.Search_length1<100&&(t.Search_maxlen2=Math.min(31-t.Search_length1,17),!fi(t,r,ke[r],t.Search_length1,0,-1));++t.Search_length1);return t.Search_sol_string}function Rg(){this.Search_move=[],this.Search_d=new ga,this.Search_sq=new Ag}function sc(){}function ac(){Dg||(Dg=!0,Po=[0,3,6,12,15,24,27,30,48,51,54,60,63],In=[],ke=[],Co=[],zo=[],Li=[],gc())}function uc(t){var e,r;e=0,r=0;do(t.bottom&2048)==0?(e+=1,t.bottom=t.bottom<<1):(e+=2,t.bottom=t.bottom<<2^12291),r=1-r;while((Kr(t.bottom&63)&1)!=0);return(Kr(t.bottom)&2)==0&&(t.Shape_parity^=r),e}function La(t){var e;return e=yg(In,t.top<<12|t.bottom)<<1|t.Shape_parity,e}function Ba(t,e){t.Shape_parity=e&1,t.top=In[~~e>>1],t.bottom=t.top&4095,t.top>>=12}function fc(t){var e,r;e=0,r=0;do(t.top&2048)==0?(e+=1,t.top=t.top<<1):(e+=2,t.top=t.top<<2^12291),r=1-r;while((Kr(t.top&63)&1)!=0);return(Kr(t.top)&2)==0&&(t.Shape_parity^=r),e}function dg(){}function ko(t){var e;return e=yg(In,t&16777215)<<1|~~t>>24,e}function gc(){var t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;for(t=0,i=0;i<28561;++i)l=Po[i%13],r=Po[~~(i/13)%13],g=Po[~~(~~(i/13)/13)%13],f=Po[~~(~~(~~(i/13)/13)/13)],L=f<<18|g<<12|r<<6|l,Kr(L)==16&&(In[t++]=L);for(a=new dg,i=0;i<7356;++i)Ba(a,i),Co[i]=fc(a),Co[i]|=La(a)<<4,Ba(a,i),zo[i]=uc(a),zo[i]|=La(a)<<4,Ba(a,i),m=a.top&63,B=Kr(m),p=Kr(a.bottom&4032),a.Shape_parity^=1&~~(B&p)>>1,a.top=a.top&4032|~~a.bottom>>6&63,a.bottom=a.bottom&63|m<<6,Li[i]=La(a);for(i=0;i<7536;++i)ke[i]=-1;for(ke[ko(14378715)]=0,ke[ko(31157686)]=0,ke[ko(23967451)]=0,ke[ko(7191990)]=0,n=4,o=0,e=-1;n!=o;)for(o=n,++e,i=0;i<7536;++i)if(ke[i]==e){u=0,s=i;do s=Co[s],u+=s&15,s>>=4,ke[s]==-1&&(++n,ke[s]=e+1);while(u!=12);u=0,s=i;do s=zo[s],u+=s&15,s>>=4,ke[s]==-1&&(++n,ke[s]=e+1);while(u!=12);s=Li[i],ke[s]==-1&&(++n,ke[s]=e+1)}}function Lc(){}function Bc(){if(!Fg){Fg=!0,de=[],Go=[],_r=[],Nr=[],hg=[1,1,2,6,24,120,720,5040],Or=[];for(var t=0;t<12;++t)Or[t]=[];mc()}}function Ag(){}function Mo(t){var e,r,n,o;for(r=0,o=1985229328,e=0;e<7;++e)n=t[e]<<2,r=(8-e)*r+(~~o>>n&7),o-=286331152<<n;return r&65535}function mc(){var t,e,r,n,o,l,i,s,u,a,f,g,L;for(o=0;o<12;++o)for(Or[o][0]=1,Or[o][o]=1,u=1;u<o;++u)Or[o][u]=Or[o-1][u-1]+Or[o-1][u];for(g=[],o=0;o<40320;++o)ma(g,o),L=g[2],g[2]=g[4],g[4]=L,L=g[3],g[3]=g[5],g[5]=L,Go[o]=Mo(g),ma(g,o),L=g[0],g[0]=g[1],g[1]=g[2],g[2]=g[3],g[3]=L,_r[o]=Mo(g),ma(g,o),L=g[4],g[4]=g[5],g[5]=g[6],g[6]=g[7],g[7]=L,Nr[o]=Mo(g);for(o=0;o<80640;++o)de[o]=-1;for(de[0]=0,e=0,r=1;r<80640;){s=e>=11,n=s?-1:e,t=s?e:-1,++e;e:for(o=0;o<80640;++o)if(de[o]==n){if(l=~~o>>1,f=o&1,i=Go[l]<<1|1-f,de[i]==t&&(++r,de[s?o:i]=~~(e<<24)>>24,s))continue e;for(i=l,a=0;a<4;++a)if(i=_r[i],de[i<<1|f]==t&&(++r,de[s?o:i<<1|f]=~~(e<<24)>>24,s))continue e;for(a=0;a<4;++a)if(i=Nr[i],de[i<<1|f]==t&&(++r,de[s?o:i<<1|f]=~~(e<<24)>>24,s))continue e}}}function ma(t,e){var r,n,o,l,i;for(i=1985229328,r=0;r<7;++r)o=hg[7-r],l=~~(e/o),e-=l*o,l<<=2,t[r]=~~((~~i>>l&7)<<24)>>24,n=(1<<l)-1,i=(i&n)+(~~i>>4&~n);t[7]=~~(i<<24)>>24}function cc(){}function Kr(t){return t-=~~t>>1&1431655765,t=(~~t>>2&858993459)+(t&858993459),t=(~~t>>4)+t&252645135,t+=~~t>>8,t+=~~t>>16,t&63}function yg(t,e){var r,n,o,l;for(n=0,r=t.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=t[o],l<e)n=o+1;else if(l>e)r=o-1;else return o;return-n-1}async function Fc(){return(await dc()).scramble_string}var Se,Dg,zo,In,ke,Co,Li,Po,Fg,Nr,Or,de,_r,Go,hg,ca,pc,Rc,Dc,dc,bg=U(()=>{nr();Se=ga.prototype=nc.prototype;Se.dl=10062778;Se.dr=14536702;Se.ml=0;Se.ul=70195;Se.ur=4544119;Se=Rg.prototype=sc.prototype;Se.Search_c=null;Se.Search_length1=0;Se.Search_maxlen2=0;Se.Search_sol_string=null;Dg=!1;Se=dg.prototype=Lc.prototype;Se.bottom=0;Se.Shape_parity=0;Se.top=0;Fg=!1;Se=Ag.prototype=cc.prototype;Se.botEdgeFirst=!1;Se.cornperm=0;Se.edgeperm=0;Se.ml=0;Se.topEdgeFirst=!1;ca=!1,pc=function(t,e,r){ca||(ac(),Bc()),r&&r("Done initializing Square-1."),ca=!0,t!=null&&t()},Rc=async function(){return ca||pc(),rc()},Dc=function(t){var e=new Rg;return ic(e,t)},dc=async function(){var t=await Rc(),e=Dc(t);return{state:t,scramble_string:e}}});var Fa=Symbol("Comlink.proxy"),Ig=Symbol("Comlink.endpoint"),Ng=Symbol("Comlink.releaseProxy"),ci=Symbol("Comlink.thrown"),Aa=t=>typeof t=="object"&&t!==null||typeof t=="function",Og={canHandle:t=>Aa(t)&&t[Fa],serialize(t){let{port1:e,port2:r}=new MessageChannel;return Nn(t,e),[r,[r]]},deserialize(t){return t.start(),Wg(t)}},_g={canHandle:t=>Aa(t)&&ci in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},ha=new Map([["proxy",Og],["throw",_g]]);function Nn(t,e=self){e.addEventListener("message",function r(n){if(!n||!n.data)return;let{id:o,type:l,path:i}=Object.assign({path:[]},n.data),s=(n.data.argumentList||[]).map(Dr),u;try{let a=i.slice(0,-1).reduce((g,L)=>g[L],t),f=i.reduce((g,L)=>g[L],t);switch(l){case"GET":u=f;break;case"SET":a[i.slice(-1)[0]]=Dr(n.data.value),u=!0;break;case"APPLY":u=f.apply(a,s);break;case"CONSTRUCT":{let g=new f(...s);u=qg(g)}break;case"ENDPOINT":{let{port1:g,port2:L}=new MessageChannel;Nn(t,L),u=jg(g,[g])}break;case"RELEASE":u=void 0;break;default:return}}catch(a){u={value:a,[ci]:0}}Promise.resolve(u).catch(a=>({value:a,[ci]:0})).then(a=>{let[f,g]=Ri(a);e.postMessage(Object.assign(Object.assign({},f),{id:o}),g),l==="RELEASE"&&(e.removeEventListener("message",r),ya(e))})}),e.start&&e.start()}function Kg(t){return t.constructor.name==="MessagePort"}function ya(t){Kg(t)&&t.close()}function Wg(t,e){return pi(t,[],e)}function Io(t){if(t)throw new Error("Proxy has been released and is not useable")}function pi(t,e=[],r=function(){}){let n=!1,o=new Proxy(r,{get(l,i){if(Io(n),i===Ng)return()=>Wr(t,{type:"RELEASE",path:e.map(s=>s.toString())}).then(()=>{ya(t),n=!0});if(i==="then"){if(e.length===0)return{then:()=>o};let s=Wr(t,{type:"GET",path:e.map(u=>u.toString())}).then(Dr);return s.then.bind(s)}return pi(t,[...e,i])},set(l,i,s){Io(n);let[u,a]=Ri(s);return Wr(t,{type:"SET",path:[...e,i].map(f=>f.toString()),value:u},a).then(Dr)},apply(l,i,s){Io(n);let u=e[e.length-1];if(u===Ig)return Wr(t,{type:"ENDPOINT"}).then(Dr);if(u==="bind")return pi(t,e.slice(0,-1));let[a,f]=Ua(s);return Wr(t,{type:"APPLY",path:e.map(g=>g.toString()),argumentList:a},f).then(Dr)},construct(l,i){Io(n);let[s,u]=Ua(i);return Wr(t,{type:"CONSTRUCT",path:e.map(a=>a.toString()),argumentList:s},u).then(Dr)}});return o}function Qg(t){return Array.prototype.concat.apply([],t)}function Ua(t){let e=t.map(Ri);return[e.map(r=>r[0]),Qg(e.map(r=>r[1]))]}var ba=new WeakMap;function jg(t,e){return ba.set(t,e),t}function qg(t){return Object.assign(t,{[Fa]:!0})}function Ri(t){for(let[e,r]of ha)if(r.canHandle(t)){let[n,o]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},o]}return[{type:"RAW",value:t},ba.get(t)||[]]}function Dr(t){switch(t.type){case"HANDLER":return ha.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Wr(t,e,r){return new Promise(n=>{let o=Vg();t.addEventListener("message",function l(i){!i.data||!i.data.id||i.data.id!==o||(t.removeEventListener("message",l),n(i.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:o},e),r)})}function Vg(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Xg=typeof globalThis.Worker=="undefined"&&typeof globalThis.WorkerNavigator=="undefined";function Ea(t){Xg?(async()=>{let{port:e}=await Promise.resolve().then(()=>(va(),wa));Nn(t,await e())})():Nn(t)}Ve();Ot();_t();Ve();Ot();nr();_t();Ae();Ae();var ts=class extends Zr{constructor(e){super();this.metric=e}traverseAlg(e){let r=0;for(let n of e.units())r+=this.traverseUnit(n);return r}traverseGrouping(e){let r=e.alg;return this.traverseAlg(r)*Math.abs(e.amount)}traverseMove(e){return this.metric(e)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 0}traverseNewline(e){return 0}traverseLineComment(e){return 0}};function P2(t){return"A"<=t&&t<="Z"}function H1(t){let e=t.family;return P2(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}function Y1(t){let e=t.family;return P2(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:Math.abs(t.amount)}var M2=new ts(H1),rs=M2.traverseAlg.bind(M2),G2=new ts(Y1),Z1=G2.traverseAlg.bind(G2);Ae();var T2=class extends Zr{traverseAlg(e){let r=0;for(let n of e.units())r+=this.traverseUnit(n);return r}traverseGrouping(e){return this.traverseAlg(e.alg)*Math.abs(e.amount)}traverseMove(e){return 1}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 1}traverseNewline(e){return 0}traverseLineComment(e){return 0}},I2=new T2,X1=I2.traverseAlg.bind(I2);nr();var J1=2,$1=!0,eL=!1;function tL(t,e){let r=[];return e.forEach(function(n){let o=new c(n);if(o.amount!==1)throw new Error("SGS cannot handle def moves with an amount other than 1 yet.");let l=t.identityTransformation();for(let i=1;l=l.applyMove(o),!l.isIdentityTransformation();i++)r.push({move:o.modified({amount:i}),transformation:l})}),r}var Ft=class{constructor(e,r,n){this.kpuzzle=e;this.sgs=r;this.searchMoves=tL(this.kpuzzle,n??Object.keys(this.kpuzzle.definition.moves))}async solve(e,r=J1,n){let o=e.experimentalToTransformation();if(!o)throw new Error("distinguishable pieces are not supported in tremble solver yt");let l=null,i=1e6,s=(u,a,f)=>{if(a===0){let g=this.sgsPhaseSolve(u,i);if(!g)return;let L=f.concat(g).simplify({collapseMoves:!0,quantumMoveOrder:n}),B=rs(L);(l===null||B<i)&&(eL&&(console.log(\`New best (\${B} moves): \${L.toString()}\`),console.log(\`Tremble moves are: \${f.toString()}\`)),l=L,i=B);return}for(let g of this.searchMoves)s(u.applyTransformation(g.transformation),a-1,f.concat([g.move]))};for(let u=0;u<=r;u++)s(o,u,new k);if(l===null)throw new Error("SGS search failed.");return l}sgsPhaseSolve(e,r){let n=new ut,o=e;for(let l of this.sgs.ordering){let i=l.pieceOrdering,s="",u=o.invert();for(let f=0;f<i.length;f++){let g=i[f],L=g.orbitName,B=g.permutationIdx;s+=\` \${u.transformationData[L].permutation[B]} \${u.transformationData[L].orientation[B]}\`}let a=l.lookup[s];if(!a)throw new Error("Missing algorithm in sgs or esgs?");if(n.experimentalPushAlg(a.alg),n.experimentalNumUnits()>=r)return null;if(o=o.applyTransformation(a.transformation),$1)for(let f=0;f<i.length;f++){let g=i[f],L=g.orbitName,B=g.permutationIdx;if(o.transformationData[L].permutation[B]!==B||o.transformationData[L].orientation[B]!==0)throw new Error("bad SGS :-(")}}return n.toAlg()}};async function un(t,e){let r=await Kt(),n=t.identityTransformation();for(let o of e.ordering){let l=r(Object.values(o.lookup));n=n.applyTransformation(l.transformation)}return n.toKState()}var oL=3,K2=null;async function W2(){return K2||(K2=(async()=>{let t=await(await Promise.resolve().then(()=>(_2(),O2))).cachedData222();return new Ft(await he["2x2x2"].kpuzzle(),t,"URFLBD".split(""))})())}async function Q2(){await W2()}async function ns(t){return tt(),await(await W2()).solve(t,oL,()=>4)}async function lL(t,e,r,n){let o=await st();await C2(r.stateData[e].pieces);let l=t.definition.orbits[e],i=r.stateData[e].orientation,s=0;for(let u=0;u<l.numPieces;u++){let a=o(l.numOrientations);i[u]=a,s+=a}n&&"orientationSum"in n&&(i[0]=((i[0]+n.orientationSum-s)%l.numOrientations+l.numOrientations)%l.numOrientations)}async function iL(){let t=await he["2x2x2"].kpuzzle(),e=new Be(t,JSON.parse(JSON.stringify(t.startState().stateData)));return await lL(t,"CORNERS",e,{orientationSum:0}),e}async function j2(){return await ns(await iL())}ws();Rl();var Am=[[null,"x","x2","x'","z","z'"],[null,"y","y2","y'"]],hm=null;function Zf(){return hm??(hm=Promise.resolve().then(()=>(Yf(),Hf)))}async function Xf(){return(await Zf()).initialize()}async function ea(){return(await Zf()).random444Scramble()}async function Jf(){return gn(await ea(),Am)}Rl();Ae();nr();function ym(t){switch(t){case 5:return 60;case 6:return 80;default:return 100}}var Um=[["U","D"],["L","R"],["F","B"]],$f=new Map;function bm(t){let e=$f.get(t);if(e)return e;let r=[];for(let n of Um){let o=[];r.push(o);for(let l of n){o.push(new G(l)),t>3&&o.push(new G(\`\${l}w\`));for(let i=3;i<=t/2;i++)o.push(new G(\`\${l}w\`,i))}}return $f.set(t,r),r}async function Yt(t){let e=await st(),r=await Kt(),n=r,o=bm(t),l=ym(t),i=new ut,s=0,u=new Set;for(;i.experimentalNumUnits()<l;){let a=e(3);a!==s&&u.clear(),s=a;let f=r(o[s]),g=f.toString();u.has(g)||(u.add(g),i.push(new c(f,n([1,2,-1]))))}return i.toAlg()}var Sm=[[null,"3Rw","3Rw2","3Rw'","3Fw","3Fw'"],[null,"3Dw","3Dw2","3Dw'"]];async function eg(){return gn(await Yt(5),Sm)}Ot();_t();var Em=3,tg=null;async function km(){return tg||(tg=(async()=>{let e=await(await Promise.resolve().then(()=>(ra(),ta))).sgsDataFTO();return new Ft(await he.fto.kpuzzle(),e,["U","R","F","L","D","B","BR","BL"])})())}async function zm(t){return tt(),await(await km()).solve(t,Em,()=>3)}var rg=!1;async function ng(){rg||(console.warn("FTO scrambles are not yet optimized. They may be much too long (\\u224890 moves)."),rg=!0);let t=await Promise.resolve().then(()=>(ra(),ta));return zm(await un(await he.fto.kpuzzle(),await t.sgsDataFTO()))}Ve();_t();na();var Tm=2,ig=null;async function Im(){return ig||(ig=(async()=>{let e=await(await Promise.resolve().then(()=>(na(),lg))).cachedSGSDataMegaminx();return new Ft(await Eo(),e,["U","R","F","L","BR","BL","FR","FL","DR","DL","B","D"])})())}async function sg(t){tt();let e=await Im(),r=JSON.parse(JSON.stringify(t.stateData));r.CENTERS.orientation=new Array(12).fill(0);let n=new Be(await Eo(),r);return await e.solve(n,Tm,()=>5)}Ot();_t();la();var _m=3,fg=null;async function Km(){return fg||(fg=(async()=>{let e=await(await Promise.resolve().then(()=>(la(),ug))).sgsDataPyraminx();return new Ft(await he.pyraminx.kpuzzle(),e,"RLUB".split(""))})())}async function ia(t){return tt(),await(await Km()).solve(t,_m,()=>3)}async function Wm(){return un(await he.pyraminx.kpuzzle(),await oa())}async function gg(){return ia(await Wm())}Ve();_t();aa();var Hm=3,mg=null;async function Ym(){return mg||(mg=(async()=>{let t=await Promise.resolve().then(()=>(aa(),Bg)),e=await t.sgsDataSkewb();return new Ft(await t.skewbKPuzzleWithoutMOCached(),e,"RLUB".split(""))})())}function Zm(t){return new Be(t.kpuzzle,{CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}})}async function ua(t){return tt(),await(await Ym()).solve(Zm(t),Hm,n=>n.family==="y"?4:3)}async function Xm(){return un(await ui(),await sa())}async function cg(){return ua(await Xm())}Ae();var Ac=null;function hc(){return Ac??(Ac=Promise.resolve().then(()=>(bg(),Ug)))}async function Sg(){return k.fromString(await(await hc()).getRandomSquare1ScrambleString())}w2(!0);var xg=!0;function yc(t){xg=t}function wg(){return(typeof performance=="undefined"?Date:performance).now()}async function _e(t,e){if(!xg)return e();let r=wg(),n=e();n?.then&&await n;let o=wg();return console.warn(\`\${t}: \${Math.round(o-r)}ms\`),n}var pa={initialize:async t=>{switch(t){case"222":return _e("preInitialize222",Q2);case"333":case"333oh":case"333ft":return _e("initialize333",Mu);case"444":return _e("initialize444",Xf);default:throw new Error(\`unsupported event: \${t}\`)}},randomScrambleForEvent:async t=>{switch(t){case"222":return _e("random222Scramble",j2);case"333":case"333oh":case"333ft":return _e("random333Scramble",yn);case"333fm":return _e("random333FewestMovesScramble",Iu);case"333bf":case"333mb":return _e("random333OrientedScramble",Gu);case"444":return _e("random444Scramble",ea);case"444bf":return _e("random444OrientedScramble",Jf);case"555":return _e("bigCubeScramble(5)",Yt.bind(Yt,5));case"555bf":return _e("oriented555RandomMoves",eg);case"666":return _e("bigCubeScramble(6)",Yt.bind(Yt,6));case"777":return _e("bigCubeScramble(7)",Yt.bind(Yt,7));case"skewb":return _e("randomSkewbFixedCornerScramble",cg);case"pyram":return _e("randomPyraminxScrambleFixedOrientation",gg);case"sq1":return _e("getRandomSquare1Scramble",Sg);case"fto":return _e("randomFTOScramble",ng);default:throw new Error(\`unsupported event: \${t}\`)}},randomScrambleStringForEvent:async t=>(await pa.randomScrambleForEvent(t)).toString(),solve333ToString:async t=>{let e=new Be(await he["3x3x3"].kpuzzle(),t);return(await xs(e)).toString()},solve222ToString:async t=>{let e=new Be(await he["2x2x2"].kpuzzle(),t);return(await ns(e)).toString()},solveSkewbToString:async t=>{let e=new Be(await he.skewb.kpuzzle(),t);return(await ua(e)).toString()},solvePyraminxToString:async t=>{let e=new Be(await he.pyraminx.kpuzzle(),t);return(await ia(e)).toString()},solveMegaminxToString:async t=>{let e=new Be(await he.megaminx.kpuzzle(),t);return(await sg(e)).toString()},setDebugMeasurePerf:async t=>{yc(t)}};Ea(pa);
|
|
3442
|
+
Alg R' U' R U B' U' B L\`)}var Ym,Zm,aa=U(()=>{He();lo();fn();Ym=null;Zm=null});var wg={};Ue(wg,{getRandomSquare1ScrambleString:()=>Uc});function rc(t,e){t.ul=e.ul,t.ur=e.ur,t.dl=e.dl,t.dr=e.dr,t.ml=e.ml}function Fg(t,e){var r;e<<=2,e>24?(e=48-e,r=t.ul,t.ul=(~~t.ul>>e|t.ur<<24-e)&16777215,t.ur=(~~t.ur>>e|r<<24-e)&16777215):e>0?(r=t.ul,t.ul=(t.ul<<e|~~t.ur>>24-e)&16777215,t.ur=(t.ur<<e|~~r>>24-e)&16777215):e==0?(r=t.ur,t.ur=t.dl,t.dl=r,t.ml=1-t.ml):e>=-24?(e=-e,r=t.dl,t.dl=(t.dl<<e|~~t.dr>>24-e)&16777215,t.dr=(t.dr<<e|~~r>>24-e)&16777215):e<-24&&(e=48+e,r=t.dl,t.dl=(~~t.dl>>e|t.dr<<24-e)&16777215,t.dr=(~~t.dr>>e|r<<24-e)&16777215)}function nc(t){var e,r,n,o,l;for(n=0,t.arr[0]=Mt(t,0),o=1;o<24;++o)Mt(t,o)!=t.arr[n]&&(t.arr[++n]=Mt(t,o));for(l=0,e=0;e<16;++e)for(r=e+1;r<16;++r)t.arr[e]>t.arr[r]&&(l^=1);return l}function oc(t){var e,r,n,o;return o=t.ur&1118481,o|=~~o>>3,o|=~~o>>6,o=o&15|~~o>>12&48,n=t.ul&1118481,n|=~~n>>3,n|=~~n>>6,n=n&15|~~n>>12&48,r=t.dr&1118481,r|=~~r>>3,r|=~~r>>6,r=r&15|~~r>>12&48,e=t.dl&1118481,e|=~~e>>3,e|=~~e>>6,e=e&15|~~e>>12&48,Eo(nc(t)<<24|n<<18|o<<12|e<<6|r)}function lc(t,e){var r,n;for(r=0;r<8;++r)t.prm[r]=~~(~~Mt(t,r*3+1)>>1<<24)>>24;for(e.cornperm=Po(t.prm),e.topEdgeFirst=Mt(t,0)==Mt(t,1),r=e.topEdgeFirst?2:0,n=0;n<4;r+=3,++n)t.prm[n]=~~(~~Mt(t,r)>>1<<24)>>24;for(e.botEdgeFirst=Mt(t,12)==Mt(t,13),r=e.botEdgeFirst?14:12;n<8;r+=3,++n)t.prm[n]=~~(~~Mt(t,r)>>1<<24)>>24;e.edgeperm=Po(t.prm),e.ml=t.ml}function Mt(t,e){var r;return e<6?r=~~t.ul>>(5-e<<2):e<12?r=~~t.ur>>(11-e<<2):e<18?r=~~t.dl>>(17-e<<2):r=~~t.dr>>(23-e<<2),~~((r&15)<<24)>>24}function fa(t,e,r){e<6?(t.ul&=~(15<<(5-e<<2)),t.ul|=r<<(5-e<<2)):e<12?(t.ur&=~(15<<(11-e<<2)),t.ur|=r<<(11-e<<2)):e<18?(t.dl&=~(15<<(17-e<<2)),t.dl|=r<<(17-e<<2)):(t.dr&=~(15<<(23-e<<2)),t.dr|=r<<(23-e<<2))}function ga(){this.arr=[],this.prm=[]}async function ic(){let t=await at();var e,r,n,o,l,i,s,u,a;for(e=new ga,n=In[t(3678)],l=19088743<<1|286331153,o=19088743<<1,s=i=8,r=0;r<24;r++)(n>>r&1)==0?(u=t(i)<<2,fa(e,23-r,o>>u&15),a=(1<<u)-1,o=(o&a)+(o>>4&~a),--i):(u=t(s)<<2,fa(e,23-r,l>>u&15),fa(e,22-r,l>>u&15),a=(1<<u)-1,l=(l&a)+(l>>4&~a),--s,++r);return e.ml=t(2),e}function sc(){}function ac(t){var e,r,n,o,l,i;for(rc(t.Search_d,t.Search_c),n=0;n<t.Search_length1;++n)Fg(t.Search_d,t.Search_move[n]);for(lc(t.Search_d,t.Search_sq),r=t.Search_sq.edgeperm,e=t.Search_sq.cornperm,l=t.Search_sq.ml,i=Math.max(De[t.Search_sq.edgeperm<<1|l],De[t.Search_sq.cornperm<<1|l]),n=i;n<t.Search_maxlen2;++n)if(Li(t,r,e,t.Search_sq.topEdgeFirst,t.Search_sq.botEdgeFirst,l,n,t.Search_length1,0)){for(o=0;o<n;++o)Fg(t.Search_d,t.Search_move[t.Search_length1+o]);return t.Search_sol_string=uc(t,n+t.Search_length1),!0}return!1}function uc(t,e){for(var r="",n=0,o=0,l=e-1;l>=0;l--){var i=t.Search_move[l];i>0?(i=12-i,n=i>6?i-12:i):i<0?(i=12+i,o=i>6?i-12:i):(n==0&&o==0?r+=" / ":r+="("+n+", "+o+") / ",n=o=0)}return(n!==0||o!==0)&&(r+="("+n+", "+o+")"),r}function gi(t,e,r,n,o,l){var i,s,u;if(r==0&&n<4)return n==0&&ac(t);if(l!=0&&(u=Bi[e],s=ke[u],s<n&&(t.Search_move[o]=0,gi(t,u,s,n-1,o+1,0))))return!0;if(u=e,l<=0){for(i=0;i+=zo[u],u=~~i>>4,i&=15,!(i>=12||(s=ke[u],s>n));)if(s<n&&(t.Search_move[o]=i,gi(t,u,s,n-1,o+1,1)))return!0}if(u=e,l<=1){for(i=0;i+=ko[u],u=~~i>>4,i&=15,!(i>=6||(s=ke[u],s>n));)if(s<n&&(t.Search_move[o]=-i,gi(t,u,s,n-1,o+1,2)))return!0}return!1}function Li(t,e,r,n,o,l,i,s,u){var a,f,g,L,B,p,m;if(i==0&&!n&&o||u!=0&&n==o&&(g=Mo[e],f=Mo[r],De[g<<1|1-l]<i&&De[f<<1|1-l]<i&&(t.Search_move[s]=0,Li(t,g,f,n,o,1-l,i-1,s+1,0))))return!0;if(u<=0)for(m=!n,g=m?Wr[e]:e,f=m?r:Wr[r],L=m?1:2,B=De[g<<1|l],p=De[f<<1|l];L<12&&B<=i&&B<=i;){if(B<i&&p<i&&(t.Search_move[s]=L,Li(t,g,f,m,o,l,i-1,s+1,1)))return!0;m=!m,m?(g=Wr[g],B=De[g<<1|l],L+=1):(f=Wr[f],p=De[f<<1|l],L+=2)}if(u<=1)for(a=!o,g=a?Or[e]:e,f=a?r:Or[r],L=a?1:2,B=De[g<<1|l],p=De[f<<1|l];L<(i>3?6:12)&&B<=i&&B<=i;){if(B<i&&p<i&&(t.Search_move[s]=-L,Li(t,g,f,n,a,l,i-1,s+1,2)))return!0;a=!a,a?(g=Or[g],B=De[g<<1|l],L+=1):(f=Or[f],p=De[f<<1|l],L+=2)}return!1}function fc(t,e){var r;for(t.Search_c=e,r=oc(e),t.Search_length1=ke[r];t.Search_length1<100&&(t.Search_maxlen2=Math.min(31-t.Search_length1,17),!gi(t,r,ke[r],t.Search_length1,0,-1));++t.Search_length1);return t.Search_sol_string}function Ag(){this.Search_move=[],this.Search_d=new ga,this.Search_sq=new bg}function gc(){}function Lc(){hg||(hg=!0,Co=[0,3,6,12,15,24,27,30,48,51,54,60,63],In=[],ke=[],zo=[],ko=[],Bi=[],cc())}function Bc(t){var e,r;e=0,r=0;do(t.bottom&2048)==0?(e+=1,t.bottom=t.bottom<<1):(e+=2,t.bottom=t.bottom<<2^12291),r=1-r;while((Kr(t.bottom&63)&1)!=0);return(Kr(t.bottom)&2)==0&&(t.Shape_parity^=r),e}function La(t){var e;return e=xg(In,t.top<<12|t.bottom)<<1|t.Shape_parity,e}function Ba(t,e){t.Shape_parity=e&1,t.top=In[~~e>>1],t.bottom=t.top&4095,t.top>>=12}function mc(t){var e,r;e=0,r=0;do(t.top&2048)==0?(e+=1,t.top=t.top<<1):(e+=2,t.top=t.top<<2^12291),r=1-r;while((Kr(t.top&63)&1)!=0);return(Kr(t.top)&2)==0&&(t.Shape_parity^=r),e}function yg(){}function Eo(t){var e;return e=xg(In,t&16777215)<<1|~~t>>24,e}function cc(){var t,e,r,n,o,l,i,s,u,a,f,g,L,B,p,m;for(t=0,i=0;i<28561;++i)l=Co[i%13],r=Co[~~(i/13)%13],g=Co[~~(~~(i/13)/13)%13],f=Co[~~(~~(~~(i/13)/13)/13)],L=f<<18|g<<12|r<<6|l,Kr(L)==16&&(In[t++]=L);for(a=new yg,i=0;i<7356;++i)Ba(a,i),zo[i]=mc(a),zo[i]|=La(a)<<4,Ba(a,i),ko[i]=Bc(a),ko[i]|=La(a)<<4,Ba(a,i),m=a.top&63,B=Kr(m),p=Kr(a.bottom&4032),a.Shape_parity^=1&~~(B&p)>>1,a.top=a.top&4032|~~a.bottom>>6&63,a.bottom=a.bottom&63|m<<6,Bi[i]=La(a);for(i=0;i<7536;++i)ke[i]=-1;for(ke[Eo(14378715)]=0,ke[Eo(31157686)]=0,ke[Eo(23967451)]=0,ke[Eo(7191990)]=0,n=4,o=0,e=-1;n!=o;)for(o=n,++e,i=0;i<7536;++i)if(ke[i]==e){u=0,s=i;do s=zo[s],u+=s&15,s>>=4,ke[s]==-1&&(++n,ke[s]=e+1);while(u!=12);u=0,s=i;do s=ko[s],u+=s&15,s>>=4,ke[s]==-1&&(++n,ke[s]=e+1);while(u!=12);s=Bi[i],ke[s]==-1&&(++n,ke[s]=e+1)}}function pc(){}function Rc(){if(!Ug){Ug=!0,De=[],Mo=[],Wr=[],Or=[],Sg=[1,1,2,6,24,120,720,5040],_r=[];for(var t=0;t<12;++t)_r[t]=[];dc()}}function bg(){}function Po(t){var e,r,n,o;for(r=0,o=1985229328,e=0;e<7;++e)n=t[e]<<2,r=(8-e)*r+(~~o>>n&7),o-=286331152<<n;return r&65535}function dc(){var t,e,r,n,o,l,i,s,u,a,f,g,L;for(o=0;o<12;++o)for(_r[o][0]=1,_r[o][o]=1,u=1;u<o;++u)_r[o][u]=_r[o-1][u-1]+_r[o-1][u];for(g=[],o=0;o<40320;++o)ma(g,o),L=g[2],g[2]=g[4],g[4]=L,L=g[3],g[3]=g[5],g[5]=L,Mo[o]=Po(g),ma(g,o),L=g[0],g[0]=g[1],g[1]=g[2],g[2]=g[3],g[3]=L,Wr[o]=Po(g),ma(g,o),L=g[4],g[4]=g[5],g[5]=g[6],g[6]=g[7],g[7]=L,Or[o]=Po(g);for(o=0;o<80640;++o)De[o]=-1;for(De[0]=0,e=0,r=1;r<80640;){s=e>=11,n=s?-1:e,t=s?e:-1,++e;e:for(o=0;o<80640;++o)if(De[o]==n){if(l=~~o>>1,f=o&1,i=Mo[l]<<1|1-f,De[i]==t&&(++r,De[s?o:i]=~~(e<<24)>>24,s))continue e;for(i=l,a=0;a<4;++a)if(i=Wr[i],De[i<<1|f]==t&&(++r,De[s?o:i<<1|f]=~~(e<<24)>>24,s))continue e;for(a=0;a<4;++a)if(i=Or[i],De[i<<1|f]==t&&(++r,De[s?o:i<<1|f]=~~(e<<24)>>24,s))continue e}}}function ma(t,e){var r,n,o,l,i;for(i=1985229328,r=0;r<7;++r)o=Sg[7-r],l=~~(e/o),e-=l*o,l<<=2,t[r]=~~((~~i>>l&7)<<24)>>24,n=(1<<l)-1,i=(i&n)+(~~i>>4&~n);t[7]=~~(i<<24)>>24}function Dc(){}function Kr(t){return t-=~~t>>1&1431655765,t=(~~t>>2&858993459)+(t&858993459),t=(~~t>>4)+t&252645135,t+=~~t>>8,t+=~~t>>16,t&63}function xg(t,e){var r,n,o,l;for(n=0,r=t.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=t[o],l<e)n=o+1;else if(l>e)r=o-1;else return o;return-n-1}async function Uc(){return(await yc()).scramble_string}var Se,hg,ko,In,ke,zo,Bi,Co,Ug,Or,_r,De,Wr,Mo,Sg,ca,Fc,Ac,hc,yc,vg=U(()=>{nr();Se=ga.prototype=sc.prototype;Se.dl=10062778;Se.dr=14536702;Se.ml=0;Se.ul=70195;Se.ur=4544119;Se=Ag.prototype=gc.prototype;Se.Search_c=null;Se.Search_length1=0;Se.Search_maxlen2=0;Se.Search_sol_string=null;hg=!1;Se=yg.prototype=pc.prototype;Se.bottom=0;Se.Shape_parity=0;Se.top=0;Ug=!1;Se=bg.prototype=Dc.prototype;Se.botEdgeFirst=!1;Se.cornperm=0;Se.edgeperm=0;Se.ml=0;Se.topEdgeFirst=!1;ca=!1,Fc=function(t,e,r){ca||(Lc(),Rc()),r&&r("Done initializing Square-1."),ca=!0,t!=null&&t()},Ac=async function(){return ca||Fc(),ic()},hc=function(t){var e=new Ag;return fc(e,t)},yc=async function(){var t=await Ac(),e=hc(t);return{state:t,scramble_string:e}}});var Fa=Symbol("Comlink.proxy"),Wg=Symbol("Comlink.endpoint"),Kg=Symbol("Comlink.releaseProxy"),pi=Symbol("Comlink.thrown"),Aa=t=>typeof t=="object"&&t!==null||typeof t=="function",Qg={canHandle:t=>Aa(t)&&t[Fa],serialize(t){let{port1:e,port2:r}=new MessageChannel;return Nn(t,e),[r,[r]]},deserialize(t){return t.start(),Vg(t)}},jg={canHandle:t=>Aa(t)&&pi in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},ha=new Map([["proxy",Qg],["throw",jg]]);function Nn(t,e=self){e.addEventListener("message",function r(n){if(!n||!n.data)return;let{id:o,type:l,path:i}=Object.assign({path:[]},n.data),s=(n.data.argumentList||[]).map(dr),u;try{let a=i.slice(0,-1).reduce((g,L)=>g[L],t),f=i.reduce((g,L)=>g[L],t);switch(l){case"GET":u=f;break;case"SET":a[i.slice(-1)[0]]=dr(n.data.value),u=!0;break;case"APPLY":u=f.apply(a,s);break;case"CONSTRUCT":{let g=new f(...s);u=Zg(g)}break;case"ENDPOINT":{let{port1:g,port2:L}=new MessageChannel;Nn(t,L),u=Yg(g,[g])}break;case"RELEASE":u=void 0;break;default:return}}catch(a){u={value:a,[pi]:0}}Promise.resolve(u).catch(a=>({value:a,[pi]:0})).then(a=>{let[f,g]=di(a);e.postMessage(Object.assign(Object.assign({},f),{id:o}),g),l==="RELEASE"&&(e.removeEventListener("message",r),ya(e))})}),e.start&&e.start()}function qg(t){return t.constructor.name==="MessagePort"}function ya(t){qg(t)&&t.close()}function Vg(t,e){return Ri(t,[],e)}function To(t){if(t)throw new Error("Proxy has been released and is not useable")}function Ri(t,e=[],r=function(){}){let n=!1,o=new Proxy(r,{get(l,i){if(To(n),i===Kg)return()=>Qr(t,{type:"RELEASE",path:e.map(s=>s.toString())}).then(()=>{ya(t),n=!0});if(i==="then"){if(e.length===0)return{then:()=>o};let s=Qr(t,{type:"GET",path:e.map(u=>u.toString())}).then(dr);return s.then.bind(s)}return Ri(t,[...e,i])},set(l,i,s){To(n);let[u,a]=di(s);return Qr(t,{type:"SET",path:[...e,i].map(f=>f.toString()),value:u},a).then(dr)},apply(l,i,s){To(n);let u=e[e.length-1];if(u===Wg)return Qr(t,{type:"ENDPOINT"}).then(dr);if(u==="bind")return Ri(t,e.slice(0,-1));let[a,f]=Ua(s);return Qr(t,{type:"APPLY",path:e.map(g=>g.toString()),argumentList:a},f).then(dr)},construct(l,i){To(n);let[s,u]=Ua(i);return Qr(t,{type:"CONSTRUCT",path:e.map(a=>a.toString()),argumentList:s},u).then(dr)}});return o}function Hg(t){return Array.prototype.concat.apply([],t)}function Ua(t){let e=t.map(di);return[e.map(r=>r[0]),Hg(e.map(r=>r[1]))]}var ba=new WeakMap;function Yg(t,e){return ba.set(t,e),t}function Zg(t){return Object.assign(t,{[Fa]:!0})}function di(t){for(let[e,r]of ha)if(r.canHandle(t)){let[n,o]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},o]}return[{type:"RAW",value:t},ba.get(t)||[]]}function dr(t){switch(t.type){case"HANDLER":return ha.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Qr(t,e,r){return new Promise(n=>{let o=Xg();t.addEventListener("message",function l(i){!i.data||!i.data.id||i.data.id!==o||(t.removeEventListener("message",l),n(i.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:o},e),r)})}function Xg(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var t1=typeof globalThis.Worker=="undefined"&&typeof globalThis.WorkerNavigator=="undefined";function Ea(t){t1?(async()=>{let{port:e}=await Promise.resolve().then(()=>(va(),wa));Nn(t,await e())})():Nn(t)}He();_t();Wt();He();_t();nr();Wt();Ae();Ae();var ts=class extends Xr{constructor(e){super();this.metric=e}traverseAlg(e){let r=0;for(let n of e.units())r+=this.traverseUnit(n);return r}traverseGrouping(e){let r=e.alg;return this.traverseAlg(r)*Math.abs(e.amount)}traverseMove(e){return this.metric(e)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 0}traverseNewline(e){return 0}traverseLineComment(e){return 0}};function I2(t){return"A"<=t&&t<="Z"}function J1(t){let e=t.family;return I2(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}function $1(t){let e=t.family;return I2(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:Math.abs(t.amount)}var N2=new ts(J1),rs=N2.traverseAlg.bind(N2),O2=new ts($1),eL=O2.traverseAlg.bind(O2);Ae();var _2=class extends Xr{traverseAlg(e){let r=0;for(let n of e.units())r+=this.traverseUnit(n);return r}traverseGrouping(e){return this.traverseAlg(e.alg)*Math.abs(e.amount)}traverseMove(e){return 1}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 1}traverseNewline(e){return 0}traverseLineComment(e){return 0}},W2=new _2,tL=W2.traverseAlg.bind(W2);nr();var rL=2,nL=!0,oL=!1;function lL(t,e){let r=[];return e.forEach(function(n){let o=new c(n);if(o.amount!==1)throw new Error("SGS cannot handle def moves with an amount other than 1 yet.");let l=t.identityTransformation();for(let i=1;l=l.applyMove(o),!l.isIdentityTransformation();i++)r.push({move:o.modified({amount:i}),transformation:l})}),r}var At=class{constructor(e,r,n){this.kpuzzle=e;this.sgs=r;this.searchMoves=lL(this.kpuzzle,n??Object.keys(this.kpuzzle.definition.moves))}async solve(e,r=rL,n){let o=e.experimentalToTransformation();if(!o)throw new Error("distinguishable pieces are not supported in tremble solver yt");let l=null,i=1e6,s=(u,a,f)=>{if(a===0){let g=this.sgsPhaseSolve(u,i);if(!g)return;let L=f.concat(g).simplify({collapseMoves:!0,quantumMoveOrder:n}),B=rs(L);(l===null||B<i)&&(oL&&(console.log(\`New best (\${B} moves): \${L.toString()}\`),console.log(\`Tremble moves are: \${f.toString()}\`)),l=L,i=B);return}for(let g of this.searchMoves)s(u.applyTransformation(g.transformation),a-1,f.concat([g.move]))};for(let u=0;u<=r;u++)s(o,u,new k);if(l===null)throw new Error("SGS search failed.");return l}sgsPhaseSolve(e,r){let n=new ft,o=e;for(let l of this.sgs.ordering){let i=l.pieceOrdering,s="",u=o.invert();for(let f=0;f<i.length;f++){let g=i[f],L=g.orbitName,B=g.permutationIdx;s+=\` \${u.transformationData[L].permutation[B]} \${u.transformationData[L].orientation[B]}\`}let a=l.lookup[s];if(!a)throw new Error("Missing algorithm in sgs or esgs?");if(n.experimentalPushAlg(a.alg),n.experimentalNumUnits()>=r)return null;if(o=o.applyTransformation(a.transformation),nL)for(let f=0;f<i.length;f++){let g=i[f],L=g.orbitName,B=g.permutationIdx;if(o.transformationData[L].permutation[B]!==B||o.transformationData[L].orientation[B]!==0)throw new Error("bad SGS :-(")}}return n.toAlg()}};async function un(t,e){let r=await Kt(),n=t.identityTransformation();for(let o of e.ordering){let l=r(Object.values(o.lookup));n=n.applyTransformation(l.transformation)}return n.toKState()}var aL=3,q2=null;async function V2(){return q2||(q2=(async()=>{let t=await(await Promise.resolve().then(()=>(j2(),Q2))).cachedData222();return new At(await he["2x2x2"].kpuzzle(),t,"URFLBD".split(""))})())}async function H2(){await V2()}async function ns(t){return rt(),await(await V2()).solve(t,aL,()=>4)}async function uL(t,e,r,n){let o=await at();await T2(r.stateData[e].pieces);let l=t.definition.orbits[e],i=r.stateData[e].orientation,s=0;for(let u=0;u<l.numPieces;u++){let a=o(l.numOrientations);i[u]=a,s+=a}n&&"orientationSum"in n&&(i[0]=((i[0]+n.orientationSum-s)%l.numOrientations+l.numOrientations)%l.numOrientations)}async function fL(){let t=await he["2x2x2"].kpuzzle(),e=new Be(t,JSON.parse(JSON.stringify(t.startState().stateData)));return await uL(t,"CORNERS",e,{orientationSum:0}),e}async function Y2(){return await ns(await fL())}ws();dl();var bm=[[null,"x","x2","x'","z","z'"],[null,"y","y2","y'"]],Sm=null;function eg(){return Sm??(Sm=Promise.resolve().then(()=>($f(),Jf)))}async function tg(){return(await eg()).initialize()}async function ea(){return(await eg()).random444Scramble()}async function rg(){return gn(await ea(),bm)}dl();Ae();nr();function xm(t){switch(t){case 5:return 60;case 6:return 80;default:return 100}}var wm=[["U","D"],["L","R"],["F","B"]],ng=new Map;function vm(t){let e=ng.get(t);if(e)return e;let r=[];for(let n of wm){let o=[];r.push(o);for(let l of n){o.push(new G(l)),t>3&&o.push(new G(\`\${l}w\`));for(let i=3;i<=t/2;i++)o.push(new G(\`\${l}w\`,i))}}return ng.set(t,r),r}async function Zt(t){let e=await at(),r=await Kt(),n=r,o=vm(t),l=xm(t),i=new ft,s=0,u=new Set;for(;i.experimentalNumUnits()<l;){let a=e(3);a!==s&&u.clear(),s=a;let f=r(o[s]),g=f.toString();u.has(g)||(u.add(g),i.push(new c(f,n([1,2,-1]))))}return i.toAlg()}var Em=[[null,"3Rw","3Rw2","3Rw'","3Fw","3Fw'"],[null,"3Dw","3Dw2","3Dw'"]];async function og(){return gn(await Zt(5),Em)}_t();Wt();var Pm=3,lg=null;async function Mm(){return lg||(lg=(async()=>{let e=await(await Promise.resolve().then(()=>(ra(),ta))).sgsDataFTO();return new At(await he.fto.kpuzzle(),e,["U","R","F","L","D","B","BR","BL"])})())}async function Gm(t){return rt(),await(await Mm()).solve(t,Pm,()=>3)}var ig=!1;async function sg(){ig||(console.warn("FTO scrambles are not yet optimized. They may be much too long (\\u224890 moves)."),ig=!0);let t=await Promise.resolve().then(()=>(ra(),ta));return Gm(await un(await he.fto.kpuzzle(),await t.sgsDataFTO()))}He();Wt();na();var _m=2,fg=null;async function Wm(){return fg||(fg=(async()=>{let e=await(await Promise.resolve().then(()=>(na(),ug))).cachedSGSDataMegaminx();return new At(await vo(),e,["U","R","F","L","BR","BL","FR","FL","DR","DL","B","D"])})())}async function gg(t){rt();let e=await Wm(),r=JSON.parse(JSON.stringify(t.stateData));r.CENTERS.orientation=new Array(12).fill(0);let n=new Be(await vo(),r);return await e.solve(n,_m,()=>5)}_t();Wt();la();var jm=3,mg=null;async function qm(){return mg||(mg=(async()=>{let e=await(await Promise.resolve().then(()=>(la(),Bg))).sgsDataPyraminx();return new At(await he.pyraminx.kpuzzle(),e,"RLUB".split(""))})())}async function ia(t){return rt(),await(await qm()).solve(t,jm,()=>3)}async function Vm(){return un(await he.pyraminx.kpuzzle(),await oa())}async function cg(){return ia(await Vm())}He();Wt();aa();var Jm=3,dg=null;async function $m(){return dg||(dg=(async()=>{let t=await Promise.resolve().then(()=>(aa(),Rg)),e=await t.sgsDataSkewb();return new At(await t.skewbKPuzzleWithoutMOCached(),e,"RLUB".split(""))})())}function ec(t){return new Be(t.kpuzzle,{CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}})}async function ua(t){return rt(),await(await $m()).solve(ec(t),Jm,n=>n.family==="y"?4:3)}async function tc(){return un(await fi(),await sa())}async function Dg(){return ua(await tc())}Ae();var bc=null;function Sc(){return bc??(bc=Promise.resolve().then(()=>(vg(),wg)))}async function Eg(){return k.fromString(await(await Sc()).getRandomSquare1ScrambleString())}z2(!0);var kg=!0;function xc(t){kg=t}function zg(){return(typeof performance=="undefined"?Date:performance).now()}async function We(t,e){if(!kg)return e();let r=zg(),n=e();n?.then&&await n;let o=zg();return console.warn(\`\${t}: \${Math.round(o-r)}ms\`),n}var pa={initialize:async t=>{switch(t){case"222":return We("preInitialize222",H2);case"333":case"333oh":case"333ft":return We("initialize333",Nu);case"444":return We("initialize444",tg);default:throw new Error(\`unsupported event: \${t}\`)}},randomScrambleForEvent:async t=>{switch(t){case"222":return We("random222Scramble",Y2);case"333":case"333oh":case"333ft":return We("random333Scramble",yn);case"333fm":return We("random333FewestMovesScramble",Wu);case"333bf":case"333mb":return We("random333OrientedScramble",Ou);case"444":return We("random444Scramble",ea);case"444bf":return We("random444OrientedScramble",rg);case"555":return We("bigCubeScramble(5)",Zt.bind(Zt,5));case"555bf":return We("oriented555RandomMoves",og);case"666":return We("bigCubeScramble(6)",Zt.bind(Zt,6));case"777":return We("bigCubeScramble(7)",Zt.bind(Zt,7));case"skewb":return We("randomSkewbFixedCornerScramble",Dg);case"pyram":return We("randomPyraminxScrambleFixedOrientation",cg);case"sq1":return We("getRandomSquare1Scramble",Eg);case"fto":return We("randomFTOScramble",sg);default:throw new Error(\`unsupported event: \${t}\`)}},randomScrambleStringForEvent:async t=>(await pa.randomScrambleForEvent(t)).toString(),solve333ToString:async t=>{let e=new Be(await he["3x3x3"].kpuzzle(),t);return(await xs(e)).toString()},solve222ToString:async t=>{let e=new Be(await he["2x2x2"].kpuzzle(),t);return(await ns(e)).toString()},solveSkewbToString:async t=>{let e=new Be(await he.skewb.kpuzzle(),t);return(await ua(e)).toString()},solvePyraminxToString:async t=>{let e=new Be(await he.pyraminx.kpuzzle(),t);return(await ia(e)).toString()},solveMegaminxToString:async t=>{let e=new Be(await he.megaminx.kpuzzle(),t);return(await gg(e)).toString()},setDebugMeasurePerf:async t=>{xc(t)}};Ea(pa);
|
|
3443
3443
|
`;
|
|
3444
3444
|
export {
|
|
3445
3445
|
workerSource
|
|
3446
3446
|
};
|
|
3447
|
-
//# sourceMappingURL=worker-inside-generated-string-
|
|
3447
|
+
//# sourceMappingURL=worker-inside-generated-string-OWBTRAXR.js.map
|