diff --git a/dist/assets/index-CN7B9xhY.js b/dist/assets/index-BbzxYZdi.js
similarity index 92%
rename from dist/assets/index-CN7B9xhY.js
rename to dist/assets/index-BbzxYZdi.js
index 664edb5..eb4a264 100644
--- a/dist/assets/index-CN7B9xhY.js
+++ b/dist/assets/index-BbzxYZdi.js
@@ -7,22 +7,23 @@ var Re=Object.defineProperty;var Be=(m,t,e)=>t in m?Re(m,t,{enumerable:!0,config
------------------------------------------------------------------
`);const t=this.state.getBoardState(),e=t.indexOf(-1),s=T.getXY(e);G.prnt(s.getKey()+" - "+s.getValue());const n=T.getIndex(s.getKey(),s.getValue());G.prnt(`${e} - ${n}`);const a=T._getValidMoves(e);G.prnt(a);const d=this.getReward(t,this.goals);G.prnt("reward: "+d),G.prnt(`
-`),T.prntState(this.state)}getReward(t,e){const s=t.indexOf(-1),n=T.getXY(s),d=e.map(p=>this.getDistance(T.getXY(t.indexOf(p)),T.getXY(p-1))).reduce((p,A)=>p+A,0);if(d===0)return 100.5;const i=e.reduce((p,A)=>p+this.getDistance(T.getXY(t.indexOf(A)),n),0);return 1/(d+i)}getDistance(t,e){const s=Math.pow(e.getKey()-t.getKey(),2),n=Math.pow(e.getValue()-t.getValue(),2);return Math.sqrt(s+n)}};S(J,"stateProducer");let le=J;const ne=class ne{constructor(){S(this,"maxExperienceSize",2e3)}async train(t,e,s,n,a,d){if(!ye.semaphore.goodToGo(d))return;const i=new le(t);i.reset();let p=i.getInitState();const A=.5;let k=!1,I=0;for(;!k&&I<50;){if(!ye.semaphore.goodToGo(d))return;if(I++,le._isTerminalSuccess(p.getBoardState(),p.getGoals()))break;let q;const P=T.getPossibleActions(p);if(i.reverseAction!==null){const c=P.indexOf(i.reverseAction);P.splice(c,1)}Math.random()this.maxExperienceSize&&ne.experience.clear();const M=`QTable size: ${e.size}, experience size: ${ne.experience.size}`;let j=`
+`),T.prntState(this.state)}getReward(t,e){const s=t.indexOf(-1),n=T.getXY(s),d=e.map(p=>this.getDistance(T.getXY(t.indexOf(p)),T.getXY(p-1))).reduce((p,A)=>p+A,0);if(d===0)return 100.5;const i=e.reduce((p,A)=>p+this.getDistance(T.getXY(t.indexOf(A)),n),0);return 1/(d+i)}getDistance(t,e){const s=Math.pow(e.getKey()-t.getKey(),2),n=Math.pow(e.getValue()-t.getValue(),2);return Math.sqrt(s+n)}};S(J,"stateProducer");let le=J;const ne=class ne{constructor(){S(this,"maxExperienceSize",2e3)}async train(t,e,s,n,a,d){if(!ye.semaphore.goodToGo(d))return;const i=new le(t);i.reset();let p=i.getInitState();const A=.5;let k=!1,I=0;for(;!k&&I<50;){if(!ye.semaphore.goodToGo(d))return;if(I++,le._isTerminalSuccess(p.getBoardState(),p.getGoals()))break;let j;const P=T.getPossibleActions(p);if(i.reverseAction!==null){const c=P.indexOf(i.reverseAction);P.splice(c,1)}Math.random()this.maxExperienceSize&&ne.experience.clear();const M=`QTable size: ${e.size}, experience size: ${ne.experience.size}`;let q=`
`+a+`
-`+M;V.prntAtSomeElement("episodeTrainer",j),V.prntStatsInfo(M),await G.sleep(0)}static replayExperience(t,e,s,n,a){Array.from(t).sort(()=>Math.random()-.5).slice(0,a).forEach(i=>{ke.updateQTable(e,i.getState(),i.getAction(),i.getNewState(),i.getReward(),i.isDone(),s,n)})}};S(ne,"experience",new Set);let Ee=ne;class He{constructor(t){S(this,"lessonNo",0);S(this,"lessons");S(this,"lessonCount");S(this,"stateProducer");S(this,"state");S(this,"goals");S(this,"gameOver",!1);S(this,"step",0);S(this,"reverseAction",null);this.lessons=t,this.lessonCount=t.length,this.stateProducer=t[this.lessonNo];let e=oe.shuffle(ee.stateDone,[],1e3);this.state=new H(e,this.stateProducer),this.goals=this.stateProducer.getGoals()}resetIfGameIsOver(){if(!this.gameOver)return;this.lessonNo=0,this.stateProducer=this.lessons[this.lessonNo];let t=oe.shuffle(ee.stateDone,[],1e3);this.state=new H(t,this.stateProducer),this.goals=this.stateProducer.getGoals(),this.gameOver=!1,this.step=0,this.reverseAction=null}}class je{constructor(){S(this,"ctx",null);S(this,"lessons",null);S(this,"pauseBetweenMoves",1);S(this,"maxEpisodeSteps",200)}async init(){const t=await ee.getLessonProducersFromJson();this.ctx=new He(t)}makeMove(){if(this.ctx===null)return;this.ctx.gameOver=this.isGameDone(this.ctx.state),this.ctx.resetIfGameIsOver(),this.ctx.step++;const t=ae.qTable;let e=this.getAction(t,this.ctx.state,this.ctx.reverseAction);this.ctx.reverseAction=T.getReverseAction(e);const s=T.makeMove(this.ctx.state.getBoardState(),e),n=le._isTerminalSuccess(s,this.ctx.goals);if(this.ctx.state=new H(s,this.ctx.stateProducer),this.ctx.gameOver=this.isGameDone(this.ctx.state),this.ctx.gameOver=this.ctx.step>this.maxEpisodeSteps,this.prntState(this.ctx.state,this.ctx.step),n&&!this.ctx.gameOver&&this.ctx.lessonNoMath.random()-.5).slice(0,a).forEach(i=>{ke.updateQTable(e,i.getState(),i.getAction(),i.getNewState(),i.getReward(),i.isDone(),s,n)})}};S(ne,"experience",new Set);let Ee=ne;class He{constructor(t){S(this,"lessonNo",0);S(this,"lessons");S(this,"lessonCount");S(this,"stateProducer");S(this,"state");S(this,"goals");S(this,"gameOver",!1);S(this,"step",0);S(this,"reverseAction",null);this.lessons=t,this.lessonCount=t.length,this.stateProducer=t[this.lessonNo];let e=oe.shuffle(ee.stateDone,[],1e3);this.state=new H(e,this.stateProducer),this.goals=this.stateProducer.getGoals()}resetIfGameIsOver(){if(!this.gameOver)return;this.lessonNo=0,this.stateProducer=this.lessons[this.lessonNo];let t=oe.shuffle(ee.stateDone,[],1e3);this.state=new H(t,this.stateProducer),this.goals=this.stateProducer.getGoals(),this.gameOver=!1,this.step=0,this.reverseAction=null}}class qe{constructor(){S(this,"ctx",null);S(this,"lessons",null);S(this,"pauseBetweenMoves",1);S(this,"maxEpisodeSteps",200)}async init(){const t=await ee.getLessonProducersFromJson();this.ctx=new He(t)}makeMove(){if(this.ctx===null)return;this.ctx.gameOver=this.isGameDone(this.ctx.state),this.ctx.resetIfGameIsOver(),this.ctx.step++;const t=ae.qTable;let e=this.getAction(t,this.ctx.state,this.ctx.reverseAction);this.ctx.reverseAction=T.getReverseAction(e);const s=T.makeMove(this.ctx.state.getBoardState(),e),n=le._isTerminalSuccess(s,this.ctx.goals);if(this.ctx.state=new H(s,this.ctx.stateProducer),this.ctx.gameOver=this.isGameDone(this.ctx.state),this.ctx.gameOver=this.ctx.step>this.maxEpisodeSteps,this.prntState(this.ctx.state,this.ctx.step),n&&!this.ctx.gameOver&&this.ctx.lessonNo{await this.episodeTrainer.train(p,t,s,n,A,this.semaphoreId)},i=async(p,A,k)=>{let I=p.getEpisodesToTrain();for(let M=0;Mt.makeMove(),500)}stop(){ue.semaphore.stop(),this.shadowTesterIntervalId!==null&&(clearInterval(this.shadowTesterIntervalId),this.shadowTesterIntervalId=null)}};S(ue,"semaphore",new Ve);let ye=ue;const de=class de{static async train(){this.trainer=new ye,await this.trainer.train(de.qTable,10)}static async test(){this.tester=new fe,await this.tester.test()}static async stopTrainer(){var t;(t=this.trainer)==null||t.stop()}static async stopTester(){var t;(t=this.tester)==null||t.stop()}static async restartIfIsRunning(){fe.semaphore.isEnabled&&(await this.stopTester(),await this.test())}};S(de,"qTable",new Map),S(de,"trainer",null),S(de,"tester",null);let ae=de;class Me{static async getQTableActionMap(){const t="dist/qTableActions.csv",e="/public/qTableActions.csv";let s=await he.getFile(t);s=s===""?await he.getFile(e):s;const n=s.trim().split(`
-`),a=new Map;return n.forEach(d=>{const[i,p]=d.trim().split(",");a.set(i,x[p])}),a}static getStateActionKey(t){const e=t.getBoardState(),s=t.getGoals();return Array.from({length:16},(a,d)=>{let i;const p=e[d];return p===-1?i="*":s.includes(p)?i=`${p}`:s.includes(d+1)?i="o":i=" ",i+="_",d!==0&&(d+1)%4===0&&(i+="|"),i}).join("").trim()}}const me=class me{static async getConfig(){if(this.config!==void 0)return this.config;let t=await this.getConfigJson();try{return JSON.parse(t)}catch(e){const s="Invalid JSON string: "+e;return console.error(s),this.config={version:"-1",use_pretrained_data_while_testing:!0}}}static async getConfigJson(){if(this.configJson!==void 0)return this.configJson;const t="dist/config.json",e="/public/config.json";return this.configJson=await he.getFile(t),this.configJson===""?await he.getFile(e):this.configJson}static async updateConfigJson(t){try{let e=JSON.parse(t);return this.configJson=t,this.config=e,await me.updateTester(),{success:!0,messgae:"Configuration updated successfully. Please toggle the 'test', 'train' or other button to apply the changes."}}catch(e){return console.error("Invalid JSON string:",e),{success:!1,messgae:"Invalid JSON string: "+e}}}static async updateTester(){const t=this.config.use_pretrained_data_while_testing;fe.usePreloadedActions!==t&&await ae.restartIfIsRunning()}};S(me,"configJson"),S(me,"config");let we=me;const D=class D{constructor(){S(this,"semaphoreId",null)}async test(){const t=await we.getConfig();if(D.usePreloadedActions=t.use_pretrained_data_while_testing,D.usePreloadedActions&&D.actionMap===null&&(D.actionMap=await Me.getQTableActionMap()),this.semaphoreId=D.semaphore.enable(),!D.semaphore.goodToGo(this.semaphoreId))return;const e=ae.qTable;for(;;){if(!D.semaphore.goodToGo(this.semaphoreId))return;await this.testQTable(e)}}stop(){D.semaphore.stop()}async testQTable(t){if(!D.semaphore.goodToGo(this.semaphoreId))return;let e=0;const s=await ee.getLessonProducersFromJson(),n=s.length;let a=s[e],d=oe.shuffle(ee.stateDone,[],1e3),i=new H(d,a),p=a.getGoals();D.prntState(i,0);let A=!1,k=0,I=null;for(;!A&&k<200;){if(console.log("tester .. "),!D.semaphore.goodToGo(this.semaphoreId))return;k++;let j=this.getAction(t,i,I);I=T.getReverseAction(j);const q=T.makeMove(i.getBoardState(),j),P=le._isTerminalSuccess(q,p);i=new H(q,a),A=G.equalArrays(i.getBoardState(),ee.stateDone),await G.sleep(1e3/2),D.prntState(i,k),P&&!A&&e0){let a=Me.getStateActionKey(e);if((n=D.actionMap)!=null&&n.has(a)){let i=D.actionMap.get(a);return i===void 0&&V.prntErrorMsg("no action found"),i===void 0?T.getFirstPossibleAction(e,s):i}let d=T.getFirstPossibleAction(e,s);return V.prntErrorMsg("no action was found for state, first posible action is: "+d),d}else{const a=e.getHashCodeV2();ke.addStateWithZeroValuesToQTableIfStateNotExist(t,e);const d=t.get(a);return d?d.getActionWithMaxValue(s):(V.prntErrorMsg("no action found"),T.getFirstPossibleAction(e,s))}}static prntState(t,e){this.prntTerminalState(t,e,null)}static prntTerminalState(t,e,s){let n=T.zenGardenOn?"":`${e}
+${s}`;V.prntAtSomeElement("shadowTester",n+a+d)}}const ue=class ue{constructor(){S(this,"episodeTrainer",new Ee);S(this,"semaphoreId",null);S(this,"shadowTesterIntervalId",null)}async train(t,e){if(this.semaphoreId=ue.semaphore.enable(),!ue.semaphore.goodToGo(this.semaphoreId))return;await this.runShadowTester(),Ee.experience.clear();const s=.9,n=.1,a=await ee.getLessonProducersFromJson(),d=async(p,A)=>{await this.episodeTrainer.train(p,t,s,n,A,this.semaphoreId)},i=async(p,A,k)=>{let I=p.getEpisodesToTrain();for(let M=0;Mt.makeMove(),500)}stop(){ue.semaphore.stop(),this.shadowTesterIntervalId!==null&&(clearInterval(this.shadowTesterIntervalId),this.shadowTesterIntervalId=null)}};S(ue,"semaphore",new Ve);let ye=ue;const de=class de{static async train(){this.trainer=new ye,await this.trainer.train(de.qTable,10)}static async test(){this.tester=new fe,await this.tester.test()}static async stopTrainer(){var t;(t=this.trainer)==null||t.stop()}static async stopTester(){var t;(t=this.tester)==null||t.stop()}static async restartIfIsRunning(){fe.semaphore.isEnabled&&(await this.stopTester(),await this.test())}};S(de,"qTable",new Map),S(de,"trainer",null),S(de,"tester",null);let ae=de;class Me{static async getQTableActionMap(){const t="dist/qTableActions.csv",e="/public/qTableActions.csv";let s=await he.getFile(t);s=s===""?await he.getFile(e):s;const n=s.trim().split(`
+`),a=new Map;return n.forEach(d=>{const[i,p]=d.trim().split(",");a.set(i,x[p])}),a}static getStateActionKey(t){const e=t.getBoardState(),s=t.getGoals();return Array.from({length:16},(a,d)=>{let i;const p=e[d];return p===-1?i="*":s.includes(p)?i=`${p}`:s.includes(d+1)?i="o":i=" ",i+="_",d!==0&&(d+1)%4===0&&(i+="|"),i}).join("").trim()}}const me=class me{static async getConfig(){if(this.config!==void 0)return this.config;let t=await this.getConfigJson();try{return JSON.parse(t)}catch(e){const s="Invalid JSON string: "+e;return console.error(s),this.config={version:"-1",use_pretrained_data_while_testing:!0}}}static async getConfigJson(){if(this.configJson!==void 0)return this.configJson;const t="dist/config.json",e="/public/config.json";return this.configJson=await he.getFile(t),this.configJson===""?await he.getFile(e):this.configJson}static async updateConfigJson(t){try{let e=JSON.parse(t);return this.configJson=t,this.config=e,await me.updateTester(),{success:!0,messgae:"Configuration updated successfully. Please toggle the 'test', 'train' or other button to apply the changes."}}catch(e){return console.error("Invalid JSON string:",e),{success:!1,messgae:"Invalid JSON string: "+e}}}static async updateTester(){const t=this.config.use_pretrained_data_while_testing;fe.usePreloadedActions!==t&&await ae.restartIfIsRunning()}};S(me,"configJson"),S(me,"config");let we=me;const D=class D{constructor(){S(this,"semaphoreId",null)}async test(){const t=await we.getConfig();if(D.usePreloadedActions=t.use_pretrained_data_while_testing,D.usePreloadedActions&&D.actionMap===null&&(D.actionMap=await Me.getQTableActionMap()),this.semaphoreId=D.semaphore.enable(),!D.semaphore.goodToGo(this.semaphoreId))return;const e=ae.qTable;for(;;){if(!D.semaphore.goodToGo(this.semaphoreId))return;await this.testQTable(e)}}stop(){D.semaphore.stop()}async testQTable(t){if(!D.semaphore.goodToGo(this.semaphoreId))return;let e=0;const s=await ee.getLessonProducersFromJson(),n=s.length;let a=s[e],d=oe.shuffle(ee.stateDone,[],1e3),i=new H(d,a),p=a.getGoals();D.prntState(i,0);let A=!1,k=0,I=null;for(;!A&&k<200;){if(console.log("tester .. "),!D.semaphore.goodToGo(this.semaphoreId))return;k++;let q=this.getAction(t,i,I);I=T.getReverseAction(q);const j=T.makeMove(i.getBoardState(),q),P=le._isTerminalSuccess(j,p);i=new H(j,a),A=G.equalArrays(i.getBoardState(),ee.stateDone),await G.sleep(1e3/2),D.prntState(i,k),P&&!A&&e0){let a=Me.getStateActionKey(e);if((n=D.actionMap)!=null&&n.has(a)){let i=D.actionMap.get(a);return i===void 0&&V.prntErrorMsg("no action found"),i===void 0?T.getFirstPossibleAction(e,s):i}let d=T.getFirstPossibleAction(e,s);return V.prntErrorMsg("no action was found for state, first posible action is: "+d),d}else{const a=e.getHashCodeV2();ke.addStateWithZeroValuesToQTableIfStateNotExist(t,e);const d=t.get(a);return d?d.getActionWithMaxValue(s):(V.prntErrorMsg("no action found"),T.getFirstPossibleAction(e,s))}}static prntState(t,e){this.prntTerminalState(t,e,null)}static prntTerminalState(t,e,s){let n=T.zenGardenOn?"":`${e}
----
`,a=T.getStateAsString(t),d=T.zenGardenOn||s===null?"":`
----
-${s}`;V.prntAtSomeElement("shadowTester",n+a+d)}};S(D,"semaphore",new Ve),S(D,"usePreloadedActions"),S(D,"actionMap",null);let fe=D;const qe=window;function Qe(m,t,e={}){const s={tab:" ",indentOn:/[({\[]$/,moveToNewLine:/^[)}\]]/,spellcheck:!1,catchTab:!0,preserveIdent:!0,addClosing:!0,history:!0,window:qe,...e},n=s.window,a=n.document,d=[],i=[];let p=-1,A=!1,k=()=>{},I;m.setAttribute("contenteditable","plaintext-only"),m.setAttribute("spellcheck",s.spellcheck?"true":"false"),m.style.outline="none",m.style.overflowWrap="break-word",m.style.overflowY="auto",m.style.whiteSpace="pre-wrap";const M=(r,u)=>{t(r,u)};let j=!1;m.contentEditable!=="plaintext-only"&&(j=!0),j&&m.setAttribute("contenteditable","true");const q=Ae(()=>{const r=o();M(m,r),c(r)},30);let P=!1;const F=r=>!$(r)&&!Q(r)&&r.key!=="Meta"&&r.key!=="Control"&&r.key!=="Alt"&&!r.key.startsWith("Arrow"),N=Ae(r=>{F(r)&&(Y(),P=!1)},300),l=(r,u)=>{d.push([r,u]),m.addEventListener(r,u)};l("keydown",r=>{r.defaultPrevented||(I=K(),s.preserveIdent?E(r):w(r),s.catchTab&&z(r),s.addClosing&&L(r),s.history&&(X(r),F(r)&&!P&&(Y(),P=!0)),j&&!re(r)&&c(o()))}),l("keyup",r=>{r.defaultPrevented||r.isComposing||(I!==K()&&q(),N(r),k(K()))}),l("focus",r=>{A=!0}),l("blur",r=>{A=!1}),l("paste",r=>{Y(),be(r),Y(),k(K())}),l("cut",r=>{Y(),Ce(r),Y(),k(K())});function o(){const r=Z(),u={start:0,end:0,dir:void 0};let{anchorNode:y,anchorOffset:b,focusNode:C,focusOffset:O}=r;if(!y||!C)throw"error1";if(y===m&&C===m)return u.start=b>0&&m.textContent?m.textContent.length:0,u.end=O>0&&m.textContent?m.textContent.length:0,u.dir=O>=b?"->":"<-",u;if(y.nodeType===Node.ELEMENT_NODE){const B=a.createTextNode("");y.insertBefore(B,y.childNodes[b]),y=B,b=0}if(C.nodeType===Node.ELEMENT_NODE){const B=a.createTextNode("");C.insertBefore(B,C.childNodes[O]),C=B,O=0}return xe(m,B=>{if(B===y&&B===C)return u.start+=b,u.end+=O,u.dir=b<=O?"->":"<-","stop";if(B===y)if(u.start+=b,!u.dir)u.dir="->";else return"stop";else if(B===C)if(u.end+=O,!u.dir)u.dir="<-";else return"stop";B.nodeType===Node.TEXT_NODE&&(u.dir!="->"&&(u.start+=B.nodeValue.length),u.dir!="<-"&&(u.end+=B.nodeValue.length))}),m.normalize(),u}function c(r){var Oe,Ie;const u=Z();let y,b=0,C,O=0;if(r.dir||(r.dir="->"),r.start<0&&(r.start=0),r.end<0&&(r.end=0),r.dir=="<-"){const{start:_,end:te}=r;r.start=te,r.end=_}let B=0;xe(m,_=>{if(_.nodeType!==Node.TEXT_NODE)return;const te=(_.nodeValue||"").length;if(B+te>r.start&&(y||(y=_,b=r.start-B),B+te>r.end))return C=_,O=r.end-B,"stop";B+=te}),y||(y=m,b=m.childNodes.length),C||(C=m,O=m.childNodes.length),r.dir=="<-"&&([y,b,C,O]=[C,O,y,b]);{const _=h(y);if(_){const pe=a.createTextNode("");(Oe=_.parentNode)==null||Oe.insertBefore(pe,_),y=pe,b=0}const te=h(C);if(te){const pe=a.createTextNode("");(Ie=te.parentNode)==null||Ie.insertBefore(pe,te),C=pe,O=0}}u.setBaseAndExtent(y,b,C,O),m.normalize()}function h(r){for(;r&&r!==m;){if(r.nodeType===Node.ELEMENT_NODE){const u=r;if(u.getAttribute("contenteditable")=="false")return u}r=r.parentNode}}function f(){const u=Z().getRangeAt(0),y=a.createRange();return y.selectNodeContents(m),y.setEnd(u.startContainer,u.startOffset),y.toString()}function v(){const u=Z().getRangeAt(0),y=a.createRange();return y.selectNodeContents(m),y.setStart(u.endContainer,u.endOffset),y.toString()}function E(r){if(r.key==="Enter"){const u=f(),y=v();let[b]=W(u),C=b;if(s.indentOn.test(u)&&(C+=s.tab),C.length>0?(U(r),r.stopPropagation(),R(`
+${s}`;V.prntAtSomeElement("shadowTester",n+a+d)}};S(D,"semaphore",new Ve),S(D,"usePreloadedActions"),S(D,"actionMap",null);let fe=D;const je=window;function Qe(m,t,e={}){const s={tab:" ",indentOn:/[({\[]$/,moveToNewLine:/^[)}\]]/,spellcheck:!1,catchTab:!0,preserveIdent:!0,addClosing:!0,history:!0,window:je,...e},n=s.window,a=n.document,d=[],i=[];let p=-1,A=!1,k=()=>{},I;m.setAttribute("contenteditable","plaintext-only"),m.setAttribute("spellcheck",s.spellcheck?"true":"false"),m.style.outline="none",m.style.overflowWrap="break-word",m.style.overflowY="auto",m.style.whiteSpace="pre-wrap";const M=(r,u)=>{t(r,u)};let q=!1;m.contentEditable!=="plaintext-only"&&(q=!0),q&&m.setAttribute("contenteditable","true");const j=Ae(()=>{const r=o();M(m,r),c(r)},30);let P=!1;const F=r=>!$(r)&&!Q(r)&&r.key!=="Meta"&&r.key!=="Control"&&r.key!=="Alt"&&!r.key.startsWith("Arrow"),N=Ae(r=>{F(r)&&(Y(),P=!1)},300),l=(r,u)=>{d.push([r,u]),m.addEventListener(r,u)};l("keydown",r=>{r.defaultPrevented||(I=K(),s.preserveIdent?E(r):w(r),s.catchTab&&z(r),s.addClosing&&L(r),s.history&&(X(r),F(r)&&!P&&(Y(),P=!0)),q&&!re(r)&&c(o()))}),l("keyup",r=>{r.defaultPrevented||r.isComposing||(I!==K()&&j(),N(r),k(K()))}),l("focus",r=>{A=!0}),l("blur",r=>{A=!1}),l("paste",r=>{Y(),be(r),Y(),k(K())}),l("cut",r=>{Y(),Ce(r),Y(),k(K())});function o(){const r=Z(),u={start:0,end:0,dir:void 0};let{anchorNode:y,anchorOffset:b,focusNode:C,focusOffset:O}=r;if(!y||!C)throw"error1";if(y===m&&C===m)return u.start=b>0&&m.textContent?m.textContent.length:0,u.end=O>0&&m.textContent?m.textContent.length:0,u.dir=O>=b?"->":"<-",u;if(y.nodeType===Node.ELEMENT_NODE){const B=a.createTextNode("");y.insertBefore(B,y.childNodes[b]),y=B,b=0}if(C.nodeType===Node.ELEMENT_NODE){const B=a.createTextNode("");C.insertBefore(B,C.childNodes[O]),C=B,O=0}return xe(m,B=>{if(B===y&&B===C)return u.start+=b,u.end+=O,u.dir=b<=O?"->":"<-","stop";if(B===y)if(u.start+=b,!u.dir)u.dir="->";else return"stop";else if(B===C)if(u.end+=O,!u.dir)u.dir="<-";else return"stop";B.nodeType===Node.TEXT_NODE&&(u.dir!="->"&&(u.start+=B.nodeValue.length),u.dir!="<-"&&(u.end+=B.nodeValue.length))}),m.normalize(),u}function c(r){var Oe,Ie;const u=Z();let y,b=0,C,O=0;if(r.dir||(r.dir="->"),r.start<0&&(r.start=0),r.end<0&&(r.end=0),r.dir=="<-"){const{start:_,end:te}=r;r.start=te,r.end=_}let B=0;xe(m,_=>{if(_.nodeType!==Node.TEXT_NODE)return;const te=(_.nodeValue||"").length;if(B+te>r.start&&(y||(y=_,b=r.start-B),B+te>r.end))return C=_,O=r.end-B,"stop";B+=te}),y||(y=m,b=m.childNodes.length),C||(C=m,O=m.childNodes.length),r.dir=="<-"&&([y,b,C,O]=[C,O,y,b]);{const _=h(y);if(_){const pe=a.createTextNode("");(Oe=_.parentNode)==null||Oe.insertBefore(pe,_),y=pe,b=0}const te=h(C);if(te){const pe=a.createTextNode("");(Ie=te.parentNode)==null||Ie.insertBefore(pe,te),C=pe,O=0}}u.setBaseAndExtent(y,b,C,O),m.normalize()}function h(r){for(;r&&r!==m;){if(r.nodeType===Node.ELEMENT_NODE){const u=r;if(u.getAttribute("contenteditable")=="false")return u}r=r.parentNode}}function f(){const u=Z().getRangeAt(0),y=a.createRange();return y.selectNodeContents(m),y.setEnd(u.startContainer,u.startOffset),y.toString()}function v(){const u=Z().getRangeAt(0),y=a.createRange();return y.selectNodeContents(m),y.setStart(u.endContainer,u.endOffset),y.toString()}function E(r){if(r.key==="Enter"){const u=f(),y=v();let[b]=W(u),C=b;if(s.indentOn.test(u)&&(C+=s.tab),C.length>0?(U(r),r.stopPropagation(),R(`
`+C)):w(r),C!==b&&s.moveToNewLine.test(y)){const O=o();R(`
-`+b),c(O)}}}function w(r){if(j&&r.key==="Enter")if(U(r),r.stopPropagation(),v()==""){R(`
+`+b),c(O)}}}function w(r){if(q&&r.key==="Enter")if(U(r),r.stopPropagation(),v()==""){R(`
`);const u=o();u.start=--u.end,c(u)}else R(`
`)}function L(r){const u=`([{'"`,y=`)]}'"`;if(u.includes(r.key)){U(r);const b=o(),C=b.start==b.end?"":Z().toString(),O=r.key+C+y[u.indexOf(r.key)];R(O),b.start++,b.end++,c(b)}}function z(r){if(r.key==="Tab")if(U(r),r.shiftKey){const u=f();let[y,b]=W(u);if(y.length>0){const C=o(),O=Math.min(s.tab.length,y.length);c({start:b,end:b+O}),a.execCommand("delete"),C.start-=O,C.end-=O,c(C)}}else R(s.tab)}function X(r){if($(r)){U(r),p--;const u=i[p];u&&(m.innerHTML=u.html,c(u.pos)),p<0&&(p=0)}if(Q(r)){U(r),p++;const u=i[p];u&&(m.innerHTML=u.html,c(u.pos)),p>=i.length&&p--}}function Y(){if(!A)return;const r=m.innerHTML,u=o(),y=i[p];if(y&&y.html===r&&y.pos.start===u.start&&y.pos.end===u.end)return;p++,i[p]={html:r,pos:u},i.splice(p+1);const b=300;p>b&&(p=b,i.splice(0,1))}function be(r){if(r.defaultPrevented)return;U(r);const y=(r.originalEvent??r).clipboardData.getData("text/plain").replace(/\r\n?/g,`
`),b=o();R(y),M(m),c({start:Math.min(b.start,b.end)+y.length,end:Math.min(b.start,b.end)+y.length,dir:"<-"})}function Ce(r){const u=o(),y=Z();(r.originalEvent??r).clipboardData.setData("text/plain",y.toString()),a.execCommand("delete"),M(m),c({start:Math.min(u.start,u.end),end:Math.min(u.start,u.end),dir:"<-"}),U(r)}function xe(r,u){const y=[];r.firstChild&&y.push(r.firstChild);let b=y.pop();for(;b&&u(b)!=="stop";)b.nextSibling&&y.push(b.nextSibling),b.firstChild&&y.push(b.firstChild),b=y.pop()}function ce(r){return r.metaKey||r.ctrlKey}function $(r){return ce(r)&&!r.shiftKey&&ie(r)==="Z"}function Q(r){return ce(r)&&r.shiftKey&&ie(r)==="Z"}function re(r){return ce(r)&&ie(r)==="C"}function ie(r){let u=r.key||r.keyCode||r.which;if(u)return(typeof u=="string"?u:String.fromCharCode(u)).toUpperCase()}function R(r){r=r.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),a.execCommand("insertHTML",!1,r)}function Ae(r,u){let y=0;return(...b)=>{clearTimeout(y),y=n.setTimeout(()=>r(...b),u)}}function W(r){let u=r.length-1;for(;u>=0&&r[u]!==`
@@ -33,5 +34,5 @@ ${s}`;V.prntAtSomeElement("shadowTester",n+a+d)}};S(D,"semaphore",new Ve),S(D,"u
* @author Lea Verou
* @namespace
* @public
- */var e=function(s){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,a=0,d={},i={manual:s.Prism&&s.Prism.manual,disableWorkerMessageHandler:s.Prism&&s.Prism.disableWorkerMessageHandler,util:{encode:function l(o){return o instanceof p?new p(o.type,l(o.content),o.alias):Array.isArray(o)?o.map(l):o.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(h){var l=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(h.stack)||[])[1];if(l){var o=document.getElementsByTagName("script");for(var c in o)if(o[c].src==l)return o[c]}return null}},isActive:function(l,o,c){for(var h="no-"+o;l;){var f=l.classList;if(f.contains(o))return!0;if(f.contains(h))return!1;l=l.parentElement}return!!c}},languages:{plain:d,plaintext:d,text:d,txt:d,extend:function(l,o){var c=i.util.clone(i.languages[l]);for(var h in o)c[h]=o[h];return c},insertBefore:function(l,o,c,h){h=h||i.languages;var f=h[l],v={};for(var E in f)if(f.hasOwnProperty(E)){if(E==o)for(var w in c)c.hasOwnProperty(w)&&(v[w]=c[w]);c.hasOwnProperty(E)||(v[E]=f[E])}var L=h[l];return h[l]=v,i.languages.DFS(i.languages,function(z,X){X===L&&z!=l&&(this[z]=v)}),v},DFS:function l(o,c,h,f){f=f||{};var v=i.util.objId;for(var E in o)if(o.hasOwnProperty(E)){c.call(o,E,o[E],h||E);var w=o[E],L=i.util.type(w);L==="Object"&&!f[v(w)]?(f[v(w)]=!0,l(w,c,null,f)):L==="Array"&&!f[v(w)]&&(f[v(w)]=!0,l(w,c,E,f))}}},plugins:{},highlightAll:function(l,o){i.highlightAllUnder(document,l,o)},highlightAllUnder:function(l,o,c){var h={callback:c,container:l,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",h),h.elements=Array.prototype.slice.apply(h.container.querySelectorAll(h.selector)),i.hooks.run("before-all-elements-highlight",h);for(var f=0,v;v=h.elements[f++];)i.highlightElement(v,o===!0,h.callback)},highlightElement:function(l,o,c){var h=i.util.getLanguage(l),f=i.languages[h];i.util.setLanguage(l,h);var v=l.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&i.util.setLanguage(v,h);var E=l.textContent,w={element:l,language:h,grammar:f,code:E};function L(X){w.highlightedCode=X,i.hooks.run("before-insert",w),w.element.innerHTML=w.highlightedCode,i.hooks.run("after-highlight",w),i.hooks.run("complete",w),c&&c.call(w.element)}if(i.hooks.run("before-sanity-check",w),v=w.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!w.code){i.hooks.run("complete",w),c&&c.call(w.element);return}if(i.hooks.run("before-highlight",w),!w.grammar){L(i.util.encode(w.code));return}if(o&&s.Worker){var z=new Worker(i.filename);z.onmessage=function(X){L(X.data)},z.postMessage(JSON.stringify({language:w.language,code:w.code,immediateClose:!0}))}else L(i.highlight(w.code,w.grammar,w.language))},highlight:function(l,o,c){var h={code:l,grammar:o,language:c};if(i.hooks.run("before-tokenize",h),!h.grammar)throw new Error('The language "'+h.language+'" has no grammar.');return h.tokens=i.tokenize(h.code,h.grammar),i.hooks.run("after-tokenize",h),p.stringify(i.util.encode(h.tokens),h.language)},tokenize:function(l,o){var c=o.rest;if(c){for(var h in c)o[h]=c[h];delete o.rest}var f=new I;return M(f,f.head,l),k(l,f,o,f.head,0),q(f)},hooks:{all:{},add:function(l,o){var c=i.hooks.all;c[l]=c[l]||[],c[l].push(o)},run:function(l,o){var c=i.hooks.all[l];if(!(!c||!c.length))for(var h=0,f;f=c[h++];)f(o)}},Token:p};s.Prism=i;function p(l,o,c,h){this.type=l,this.content=o,this.alias=c,this.length=(h||"").length|0}p.stringify=function l(o,c){if(typeof o=="string")return o;if(Array.isArray(o)){var h="";return o.forEach(function(L){h+=l(L,c)}),h}var f={type:o.type,content:l(o.content,c),tag:"span",classes:["token",o.type],attributes:{},language:c},v=o.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(f.classes,v):f.classes.push(v)),i.hooks.run("wrap",f);var E="";for(var w in f.attributes)E+=" "+w+'="'+(f.attributes[w]||"").replace(/"/g,""")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'"'+E+">"+f.content+""+f.tag+">"};function A(l,o,c,h){l.lastIndex=o;var f=l.exec(c);if(f&&h&&f[1]){var v=f[1].length;f.index+=v,f[0]=f[0].slice(v)}return f}function k(l,o,c,h,f,v){for(var E in c)if(!(!c.hasOwnProperty(E)||!c[E])){var w=c[E];w=Array.isArray(w)?w:[w];for(var L=0;L=v.reach);Q+=$.value.length,$=$.next){var re=$.value;if(o.length>l.length)return;if(!(re instanceof p)){var ie=1,R;if(be){if(R=A(ce,Q,l,Y),!R||R.index>=l.length)break;var U=R.index,Ae=R.index+R[0].length,W=Q;for(W+=$.value.length;U>=W;)$=$.next,W+=$.value.length;if(W-=$.value.length,Q=W,$.value instanceof p)continue;for(var K=$;K!==o.tail&&(Wv.reach&&(v.reach=y);var b=$.prev;r&&(b=M(o,b,r),Q+=r.length),j(o,b,ie);var C=new p(E,X?i.tokenize(Z,X):Z,Ce,Z);if($=M(o,b,C),u&&M(o,$,u),ie>1){var O={cause:E+","+L,reach:y};k(l,o,c,$.prev,Q,O),v&&O.reach>v.reach&&(v.reach=O.reach)}}}}}}function I(){var l={value:null,prev:null,next:null},o={value:null,prev:l,next:null};l.next=o,this.head=l,this.tail=o,this.length=0}function M(l,o,c){var h=o.next,f={value:c,prev:o,next:h};return o.next=f,h.prev=f,l.length++,f}function j(l,o,c){for(var h=o.next,f=0;f/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,a){var d={};d["language-"+a]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[a]},d.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:d}};i["language-"+a]={pattern:/[\s\S]+/,inside:e.languages[a]};var p={};p[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore("markup","cdata",p)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(s,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml,function(s){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var a=s.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))}(e),e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript,function(){if(typeof e>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="Loading…",n=function(P,F){return"✖ Error "+P+" while fetching file: "+F},a="✖ Error: File does not exist or is empty",d={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},i="data-src-status",p="loading",A="loaded",k="failed",I="pre[data-src]:not(["+i+'="'+A+'"]):not(['+i+'="'+p+'"])';function M(P,F,N){var l=new XMLHttpRequest;l.open("GET",P,!0),l.onreadystatechange=function(){l.readyState==4&&(l.status<400&&l.responseText?F(l.responseText):l.status>=400?N(n(l.status,l.statusText)):N(a))},l.send(null)}function j(P){var F=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(P||"");if(F){var N=Number(F[1]),l=F[2],o=F[3];return l?o?[N,Number(o)]:[N,void 0]:[N,N]}}e.hooks.add("before-highlightall",function(P){P.selector+=", "+I}),e.hooks.add("before-sanity-check",function(P){var F=P.element;if(F.matches(I)){P.code="",F.setAttribute(i,p);var N=F.appendChild(document.createElement("CODE"));N.textContent=s;var l=F.getAttribute("data-src"),o=P.language;if(o==="none"){var c=(/\.(\w+)$/.exec(l)||[,"none"])[1];o=d[c]||c}e.util.setLanguage(N,o),e.util.setLanguage(F,o);var h=e.plugins.autoloader;h&&h.loadLanguages(o),M(l,function(f){F.setAttribute(i,A);var v=j(F.getAttribute("data-range"));if(v){var E=f.split(/\r\n?|\n/g),w=v[0],L=v[1]==null?E.length:v[1];w<0&&(w+=E.length),w=Math.max(0,Math.min(w-1,E.length)),L<0&&(L+=E.length),L=Math.max(0,Math.min(L,E.length)),f=E.slice(w,L).join(`
-`),F.hasAttribute("data-start")||F.setAttribute("data-start",String(w+1))}N.textContent=f,e.highlightElement(N)},function(f){F.setAttribute(i,k),N.textContent=f})}}),e.plugins.fileHighlight={highlight:function(F){for(var N=(F||document).querySelectorAll(I),l=0,o;o=N[l++];)e.highlightElement(o)}};var q=!1;e.fileHighlight=function(){q||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),q=!0),e.plugins.fileHighlight.highlight.apply(this,arguments)}}()})($e);var De=$e.exports;class ve{static close(){var t;(t=document.getElementById("jsonEditor"))==null||t.remove()}static show(t,e){var I;const s=document.getElementById("tools");if(!s)return;(I=document.getElementById("jsonEditor"))==null||I.remove();const n=document.createElement("div"),a=document.createElement("div"),d=document.createElement("div"),i=document.createElement("div"),p=document.createElement("div");s.appendChild(n),n.appendChild(a),n.appendChild(p),n.appendChild(i),n.appendChild(d),n.id="jsonEditor",p.setAttribute("class","console-text"),a.textContent=this.divLine,d.textContent=this.divLine,Qe(i,async M=>this.update(t,M,p,e)).updateCode(t)}static async update(t,e,s,n){if(e.textContent===null)return;let a=e.textContent;if(e.innerHTML=De.highlight(a,De.languages.js,"js"),a===t)return;let d=await n(a);s.textContent=d.messgae}}S(ve,"divLine","--------------------------------------------------------------------------------------------------");class Ne{static async toggleLessonsDisplay(t){if(t){const e=await Se.getLessonsJson();let s=async n=>Se.updateLessonsJson(n);await ve.show(e,s)}else ve.close()}}class Ge{static async toggleConfigurationDisplay(t){if(t){const e=await we.getConfigJson();let s=async n=>await we.updateConfigJson(n);ve.show(e,s)}else ve.close()}}class se{static setupTools(){var t,e,s,n,a,d;(t=document.getElementById("startTrainingBtn"))==null||t.addEventListener("click",()=>se.startTraining().then()),(e=document.getElementById("startTestingBtn"))==null||e.addEventListener("click",()=>se.startTesting().then()),(s=document.getElementById("pretrainedBtn"))==null||s.addEventListener("click",()=>se.usePretrainedOnOff().then()),(n=document.getElementById("zenGardenBtn"))==null||n.addEventListener("click",()=>se.zenGardenOnOff().then()),(a=document.getElementById("lessonsBtn"))==null||a.addEventListener("click",()=>se.lessonsOnOff().then()),(d=document.getElementById("configBtn"))==null||d.addEventListener("click",()=>se.configOnOff().then()),this.startTesting().then()}static async startTraining(){ae.stopTester(),V.clearScreenX(),await ae.train(),await se.startTesting()}static async startTesting(){ae.stopTrainer(),V.clearScreenX(),await ae.test()}static async configOnOff(){this.btnOff("lessonsBtn","training lessons",t=>Ne.toggleLessonsDisplay(t)),this.btnOnOff("configBtn","configuration",t=>Ge.toggleConfigurationDisplay(t))}static async lessonsOnOff(){this.btnOff("configBtn","configuration",t=>Ge.toggleConfigurationDisplay(t)),this.btnOnOff("lessonsBtn","training lessons",t=>Ne.toggleLessonsDisplay(t))}static async usePretrainedOnOff(){this.btnOnOff("pretrainedBtn","use pretrained",t=>fe.usePreloadedActions=t)}static async zenGardenOnOff(){this.btnOnOff("zenGardenBtn","zen garden",t=>T.zenGardenOn=t)}static async btnOff(t,e,s){let n=document.getElementById(t);n==null||n.setAttribute("value",e+" off"),s(!1)}static async btnOnOff(t,e,s){let n=document.getElementById(t);(n==null?void 0:n.getAttribute("value"))!==e+" off"?(n==null||n.setAttribute("value",e+" off"),s(!1)):(n==null||n.setAttribute("value",e+" on"),s(!0))}}se.setupTools();
+ */var e=function(s){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,a=0,d={},i={manual:s.Prism&&s.Prism.manual,disableWorkerMessageHandler:s.Prism&&s.Prism.disableWorkerMessageHandler,util:{encode:function l(o){return o instanceof p?new p(o.type,l(o.content),o.alias):Array.isArray(o)?o.map(l):o.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(h){var l=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(h.stack)||[])[1];if(l){var o=document.getElementsByTagName("script");for(var c in o)if(o[c].src==l)return o[c]}return null}},isActive:function(l,o,c){for(var h="no-"+o;l;){var f=l.classList;if(f.contains(o))return!0;if(f.contains(h))return!1;l=l.parentElement}return!!c}},languages:{plain:d,plaintext:d,text:d,txt:d,extend:function(l,o){var c=i.util.clone(i.languages[l]);for(var h in o)c[h]=o[h];return c},insertBefore:function(l,o,c,h){h=h||i.languages;var f=h[l],v={};for(var E in f)if(f.hasOwnProperty(E)){if(E==o)for(var w in c)c.hasOwnProperty(w)&&(v[w]=c[w]);c.hasOwnProperty(E)||(v[E]=f[E])}var L=h[l];return h[l]=v,i.languages.DFS(i.languages,function(z,X){X===L&&z!=l&&(this[z]=v)}),v},DFS:function l(o,c,h,f){f=f||{};var v=i.util.objId;for(var E in o)if(o.hasOwnProperty(E)){c.call(o,E,o[E],h||E);var w=o[E],L=i.util.type(w);L==="Object"&&!f[v(w)]?(f[v(w)]=!0,l(w,c,null,f)):L==="Array"&&!f[v(w)]&&(f[v(w)]=!0,l(w,c,E,f))}}},plugins:{},highlightAll:function(l,o){i.highlightAllUnder(document,l,o)},highlightAllUnder:function(l,o,c){var h={callback:c,container:l,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",h),h.elements=Array.prototype.slice.apply(h.container.querySelectorAll(h.selector)),i.hooks.run("before-all-elements-highlight",h);for(var f=0,v;v=h.elements[f++];)i.highlightElement(v,o===!0,h.callback)},highlightElement:function(l,o,c){var h=i.util.getLanguage(l),f=i.languages[h];i.util.setLanguage(l,h);var v=l.parentElement;v&&v.nodeName.toLowerCase()==="pre"&&i.util.setLanguage(v,h);var E=l.textContent,w={element:l,language:h,grammar:f,code:E};function L(X){w.highlightedCode=X,i.hooks.run("before-insert",w),w.element.innerHTML=w.highlightedCode,i.hooks.run("after-highlight",w),i.hooks.run("complete",w),c&&c.call(w.element)}if(i.hooks.run("before-sanity-check",w),v=w.element.parentElement,v&&v.nodeName.toLowerCase()==="pre"&&!v.hasAttribute("tabindex")&&v.setAttribute("tabindex","0"),!w.code){i.hooks.run("complete",w),c&&c.call(w.element);return}if(i.hooks.run("before-highlight",w),!w.grammar){L(i.util.encode(w.code));return}if(o&&s.Worker){var z=new Worker(i.filename);z.onmessage=function(X){L(X.data)},z.postMessage(JSON.stringify({language:w.language,code:w.code,immediateClose:!0}))}else L(i.highlight(w.code,w.grammar,w.language))},highlight:function(l,o,c){var h={code:l,grammar:o,language:c};if(i.hooks.run("before-tokenize",h),!h.grammar)throw new Error('The language "'+h.language+'" has no grammar.');return h.tokens=i.tokenize(h.code,h.grammar),i.hooks.run("after-tokenize",h),p.stringify(i.util.encode(h.tokens),h.language)},tokenize:function(l,o){var c=o.rest;if(c){for(var h in c)o[h]=c[h];delete o.rest}var f=new I;return M(f,f.head,l),k(l,f,o,f.head,0),j(f)},hooks:{all:{},add:function(l,o){var c=i.hooks.all;c[l]=c[l]||[],c[l].push(o)},run:function(l,o){var c=i.hooks.all[l];if(!(!c||!c.length))for(var h=0,f;f=c[h++];)f(o)}},Token:p};s.Prism=i;function p(l,o,c,h){this.type=l,this.content=o,this.alias=c,this.length=(h||"").length|0}p.stringify=function l(o,c){if(typeof o=="string")return o;if(Array.isArray(o)){var h="";return o.forEach(function(L){h+=l(L,c)}),h}var f={type:o.type,content:l(o.content,c),tag:"span",classes:["token",o.type],attributes:{},language:c},v=o.alias;v&&(Array.isArray(v)?Array.prototype.push.apply(f.classes,v):f.classes.push(v)),i.hooks.run("wrap",f);var E="";for(var w in f.attributes)E+=" "+w+'="'+(f.attributes[w]||"").replace(/"/g,""")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'"'+E+">"+f.content+""+f.tag+">"};function A(l,o,c,h){l.lastIndex=o;var f=l.exec(c);if(f&&h&&f[1]){var v=f[1].length;f.index+=v,f[0]=f[0].slice(v)}return f}function k(l,o,c,h,f,v){for(var E in c)if(!(!c.hasOwnProperty(E)||!c[E])){var w=c[E];w=Array.isArray(w)?w:[w];for(var L=0;L=v.reach);Q+=$.value.length,$=$.next){var re=$.value;if(o.length>l.length)return;if(!(re instanceof p)){var ie=1,R;if(be){if(R=A(ce,Q,l,Y),!R||R.index>=l.length)break;var U=R.index,Ae=R.index+R[0].length,W=Q;for(W+=$.value.length;U>=W;)$=$.next,W+=$.value.length;if(W-=$.value.length,Q=W,$.value instanceof p)continue;for(var K=$;K!==o.tail&&(Wv.reach&&(v.reach=y);var b=$.prev;r&&(b=M(o,b,r),Q+=r.length),q(o,b,ie);var C=new p(E,X?i.tokenize(Z,X):Z,Ce,Z);if($=M(o,b,C),u&&M(o,$,u),ie>1){var O={cause:E+","+L,reach:y};k(l,o,c,$.prev,Q,O),v&&O.reach>v.reach&&(v.reach=O.reach)}}}}}}function I(){var l={value:null,prev:null,next:null},o={value:null,prev:l,next:null};l.next=o,this.head=l,this.tail=o,this.length=0}function M(l,o,c){var h=o.next,f={value:c,prev:o,next:h};return o.next=f,h.prev=f,l.length++,f}function q(l,o,c){for(var h=o.next,f=0;f/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,a){var d={};d["language-"+a]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[a]},d.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:d}};i["language-"+a]={pattern:/[\s\S]+/,inside:e.languages[a]};var p={};p[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore("markup","cdata",p)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(s,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml,function(s){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var a=s.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))}(e),e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript,function(){if(typeof e>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="Loading…",n=function(P,F){return"✖ Error "+P+" while fetching file: "+F},a="✖ Error: File does not exist or is empty",d={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},i="data-src-status",p="loading",A="loaded",k="failed",I="pre[data-src]:not(["+i+'="'+A+'"]):not(['+i+'="'+p+'"])';function M(P,F,N){var l=new XMLHttpRequest;l.open("GET",P,!0),l.onreadystatechange=function(){l.readyState==4&&(l.status<400&&l.responseText?F(l.responseText):l.status>=400?N(n(l.status,l.statusText)):N(a))},l.send(null)}function q(P){var F=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(P||"");if(F){var N=Number(F[1]),l=F[2],o=F[3];return l?o?[N,Number(o)]:[N,void 0]:[N,N]}}e.hooks.add("before-highlightall",function(P){P.selector+=", "+I}),e.hooks.add("before-sanity-check",function(P){var F=P.element;if(F.matches(I)){P.code="",F.setAttribute(i,p);var N=F.appendChild(document.createElement("CODE"));N.textContent=s;var l=F.getAttribute("data-src"),o=P.language;if(o==="none"){var c=(/\.(\w+)$/.exec(l)||[,"none"])[1];o=d[c]||c}e.util.setLanguage(N,o),e.util.setLanguage(F,o);var h=e.plugins.autoloader;h&&h.loadLanguages(o),M(l,function(f){F.setAttribute(i,A);var v=q(F.getAttribute("data-range"));if(v){var E=f.split(/\r\n?|\n/g),w=v[0],L=v[1]==null?E.length:v[1];w<0&&(w+=E.length),w=Math.max(0,Math.min(w-1,E.length)),L<0&&(L+=E.length),L=Math.max(0,Math.min(L,E.length)),f=E.slice(w,L).join(`
+`),F.hasAttribute("data-start")||F.setAttribute("data-start",String(w+1))}N.textContent=f,e.highlightElement(N)},function(f){F.setAttribute(i,k),N.textContent=f})}}),e.plugins.fileHighlight={highlight:function(F){for(var N=(F||document).querySelectorAll(I),l=0,o;o=N[l++];)e.highlightElement(o)}};var j=!1;e.fileHighlight=function(){j||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),j=!0),e.plugins.fileHighlight.highlight.apply(this,arguments)}}()})($e);var De=$e.exports;class ve{static close(){var t;(t=document.getElementById("jsonEditor"))==null||t.remove()}static show(t,e){var I;const s=document.getElementById("tools");if(!s)return;(I=document.getElementById("jsonEditor"))==null||I.remove();const n=document.createElement("div"),a=document.createElement("div"),d=document.createElement("div"),i=document.createElement("div"),p=document.createElement("div");s.appendChild(n),n.appendChild(a),n.appendChild(p),n.appendChild(i),n.appendChild(d),n.id="jsonEditor",p.setAttribute("class","console-text"),a.textContent=this.divLine,d.textContent=this.divLine,Qe(i,async M=>this.update(t,M,p,e)).updateCode(t)}static async update(t,e,s,n){if(e.textContent===null)return;let a=e.textContent;if(e.innerHTML=De.highlight(a,De.languages.js,"js"),a===t)return;let d=await n(a);s.textContent=d.messgae}}S(ve,"divLine","--------------------------------------------------------------------------------------------------");class Ne{static async toggleLessonsDisplay(t){if(t){const e=await Se.getLessonsJson();let s=async n=>Se.updateLessonsJson(n);await ve.show(e,s)}else ve.close()}}class Ge{static async toggleConfigurationDisplay(t){if(t){const e=await we.getConfigJson();let s=async n=>await we.updateConfigJson(n);ve.show(e,s)}else ve.close()}}class se{static setupTools(){var t,e,s,n,a,d;(t=document.getElementById("startTrainingBtn"))==null||t.addEventListener("click",()=>se.startTraining().then()),(e=document.getElementById("startTestingBtn"))==null||e.addEventListener("click",()=>se.startTesting().then()),(s=document.getElementById("pretrainedBtn"))==null||s.addEventListener("click",()=>se.usePretrainedOnOff().then()),(n=document.getElementById("zenGardenBtn"))==null||n.addEventListener("click",()=>se.zenGardenOnOff().then()),(a=document.getElementById("lessonsBtn"))==null||a.addEventListener("click",()=>se.lessonsOnOff().then()),(d=document.getElementById("configBtn"))==null||d.addEventListener("click",()=>se.configOnOff().then()),this.startTesting().then()}static async startTraining(){ae.stopTester(),V.clearScreenX(),await ae.train(),await se.startTesting()}static async startTesting(){ae.stopTrainer(),V.clearScreenX(),await ae.test()}static async configOnOff(){this.btnOff("lessonsBtn","training lessons",t=>Ne.toggleLessonsDisplay(t)),this.btnOnOff("configBtn","configuration",t=>Ge.toggleConfigurationDisplay(t))}static async lessonsOnOff(){this.btnOff("configBtn","configuration",t=>Ge.toggleConfigurationDisplay(t)),this.btnOnOff("lessonsBtn","training lessons",t=>Ne.toggleLessonsDisplay(t))}static async usePretrainedOnOff(){this.btnOnOff("pretrainedBtn","use pretrained",t=>fe.usePreloadedActions=t)}static async zenGardenOnOff(){this.btnOnOff("zenGardenBtn","zen garden",t=>T.zenGardenOn=t)}static async btnOff(t,e,s){let n=document.getElementById(t);n==null||n.setAttribute("value",e+" off"),s(!1)}static async btnOnOff(t,e,s){let n=document.getElementById(t);(n==null?void 0:n.getAttribute("value"))!==e+" off"?(n==null||n.setAttribute("value",e+" off"),s(!1)):(n==null||n.setAttribute("value",e+" on"),s(!0))}}se.setupTools();
diff --git a/dist/index.html b/dist/index.html
index 8da48ca..1b3ae1f 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -5,7 +5,7 @@
puzzle 15 ml
-
+
diff --git a/index.html b/index.html
index 21dea21..be532fc 100644
--- a/index.html
+++ b/index.html
@@ -5,7 +5,7 @@
puzzle 15 ml
-
+
diff --git a/src/game-15-reconstruction/qtable/EpisodeTrainer.ts b/src/game-15-reconstruction/qtable/EpisodeTrainer.ts
index 259bfa2..379916c 100644
--- a/src/game-15-reconstruction/qtable/EpisodeTrainer.ts
+++ b/src/game-15-reconstruction/qtable/EpisodeTrainer.ts
@@ -63,34 +63,17 @@ export class EpisodeRunner {
state0 = result.state;
}
- //todo: show progress some how - .. EpisodeTester. ??
-
EpisodeRunner.replayExperience(EpisodeRunner.experience, qTable, learningRate, discount, this.maxExperienceSize);
if (EpisodeRunner.experience.size > this.maxExperienceSize) EpisodeRunner.experience.clear();
-
const statsInfo = `QTable size: ${qTable.size}, experience size: ${EpisodeRunner.experience.size}`;
- // Utils.prnt("\n");
- // Utils.prnt(trainerInfo);
- // Utils.prnt(statsInfo);
-
let episodeTrainerMsg = '\n' + trainerInfo + '\n' + statsInfo;
ConsoleUtils.prntAtSomeElement('episodeTrainer', episodeTrainerMsg);
- // setTimeout(() => {
- // let lastPrnt = this.shadowTester.makeMove();
- // ConsoleUtils.prntAtSomeElement('lastPrnt', lastPrnt);
- // }, 2000);
-
-
- // let lastPrnt = this.shadowTester.makeMove();
- // ConsoleUtils.prntAtSomeElement('lastPrnt', lastPrnt);
-
- ConsoleUtils.prntStatsInfo(statsInfo);
+ ConsoleUtils.prntStatsInfo(statsInfo+'\nit will start to show some intelligence when the qtable size is around 8,500 .. ;)');
await Utils.sleep(0);
- // ConsoleUtils.clearScreen();
}
public static replayExperience(