magcore-app-sudoku
Version:
Sudoku is a well-known Japanese puzzle. You need to fill all the cells the way there won't be the same two numbers in each row, column or block.
2 lines • 26.2 kB
JavaScript
!function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=6)}([function(e,t,i){"use strict";var s=i(2),n=i(8).parse,o=new s;o.query=n(document.location.search.substring(1)),o.config=i(9),o.activePage=null,o.route=function(e,t){var i,s=o.activePage;return!(!e||e.active)&&(e.name,e.id,e.name,e.id,(i=o.activePage)&&i.active&&(i.$node.classList.remove("active"),i.active=!1,o.activePage=null,i.name,i.id,i.name,i.id,i.events["hide"]&&i.emit("hide")),function(e,t){!e||e.active||(e.$node.classList.add("active"),e.active=!0,o.activePage=e,e.name,e.id,e.name,e.id,e.events["show"]&&e.emit("show",{data:t}))}(e,t),this.events["route"]&&this.emit("route",{from:s,to:e}),!0)},e.exports=o},function(e,t,i){"use strict";var s=i(7);e.exports=s},function(e,t,i){"use strict";function s(){this.events={}}s.prototype={addListener:function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)},once:function(e,t){var i=this;this.events[e]=this.events[e]||[],this.events[e].push(function s(){i.removeListener(e,s),t.apply(i,arguments)})},addListeners:function(e){var t;for(t in e)e.hasOwnProperty(t)&&this.addListener(t,e[t])},removeListener:function(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(function(e){return e!==t}),0===this.events[e].length&&(this.events[e]=void 0))},emit:function(e){var t,i=this.events[e];if(i)for(t=0;t<i.length;t++)i[t].apply(this,Array.prototype.slice.call(arguments,1))}},s.prototype.constructor=s,e.exports=s},function(e,t,i){"use strict";var s=i(0);e.exports=function(e){var t=document.createElement("link");t.rel="stylesheet",t.href="css/"+e+"."+s.metrics.height+".css",document.head.appendChild(t)}},function(e,t,i){"use strict";e.exports=i(16),e.exports.prototype.name="stb-component-page"},function(e,t,i){"use strict";e.exports={VKBlock:!0,gs:{"size":{480:{"scr":{"w":360,"h":360},"cll":{"w":40,"h":40}},576:{"scr":{"w":450,"h":450},"cll":{"w":50,"h":50}},720:{"scr":{"w":495,"h":495},"cll":{"w":55,"h":55}},1080:{"scr":{"w":765,"h":765},"cll":{"w":85,"h":85}}},"infoItems":{"x":9,"y":9},"position":{"old":{"x":0,"y":0},"current":{"x":0,"y":0}},"items":{"x":9,"y":9},"squares":[[[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]],[[0,3],[0,4],[0,5],[1,3],[1,4],[1,5],[2,3],[2,4],[2,5]],[[0,6],[0,7],[0,8],[1,6],[1,7],[1,8],[2,6],[2,7],[2,8]],[[3,0],[3,1],[3,2],[4,0],[4,1],[4,2],[5,0],[5,1],[5,2]],[[3,3],[3,4],[3,5],[4,3],[4,4],[4,5],[5,3],[5,4],[5,5]],[[3,6],[3,7],[3,8],[4,6],[4,7],[4,8],[5,6],[5,7],[5,8]],[[6,0],[6,1],[6,2],[7,0],[7,1],[7,2],[8,0],[8,1],[8,2]],[[6,3],[6,4],[6,5],[7,3],[7,4],[7,5],[8,3],[8,4],[8,5]],[[6,6],[6,7],[6,8],[7,6],[7,7],[7,8],[8,6],[8,7],[8,8]]],"complexity":{"easy":[[3,5,4,4,4,4,4,5,3],[5,4,4,3,5,3,3,4,5],[4,4,4,4,4,4,4,4,4],[5,3,3,4,5,4,3,3,5],[5,2,4,3,6,3,4,2,6],[3,3,5,4,5,4,5,3,3]],"normal":[[2,4,3,3,3,3,3,4,2],[4,3,3,2,4,2,2,3,4],[3,3,3,3,3,3,3,3,3],[4,2,2,3,4,3,2,2,4],[5,1,3,2,5,2,3,1,5],[2,2,4,3,4,3,4,2,2]],"hard":[[0,3,2,2,2,2,2,3,1],[3,2,2,1,3,1,1,2,3],[2,2,2,2,2,2,2,2,2],[3,1,1,2,3,2,1,1,3],[4,0,2,1,4,1,2,0,4],[1,1,3,2,3,2,3,1,1]]}}}},function(e,t,i){"use strict";var s=i(1);s.once("load",function(){s.pages={init:i(15),main:i(18)},s.ready(),s.route(s.pages.main)})},function(e,t,i){"use strict";var s=i(0),n=i(10);window.core=window.parent.getCoreInstance(window,s),i(11),i(12),i(3)("sdk"),i(14),i(3)("app"),s.platform="mag",s.ready=function(){window.core.call("app:ready")},s.exit=function(){s.events["exit"]&&s.emit("exit"),core.call("exit")},n.load=function(e){document.body.setAttribute("platform",s.platform),core.ready?s.events["load"]&&s.emit("load",{}):core.once("load",function(){s.events[e.type]&&s.emit(e.type,e)})},n.contextmenu=function(e){e.preventDefault()},Object.keys(n).forEach(function(e){window.addEventListener(e,n[e])}),e.exports=s},function(e,t,i){"use strict";e.exports={parse:function(e){var t={};return e.split("&").forEach(function(e){2===(e=e.split("=")).length&&(t[e[0]]=decodeURIComponent(e[1]))}),t},stringify:function(e){var t=[];return Object.keys(e).forEach(function(i){t.push(i+"="+encodeURIComponent(e[i]))}),t.join("&")}}},function(e,t,i){"use strict";e.exports={}},function(e,t,i){"use strict";var s=i(0);e.exports={DOMContentLoaded:function(e){s.events["dom"]&&s.emit("dom",e)},load:function(e){s.events[e.type]&&s.emit(e.type,e)},unload:function(e){s.events[e.type]&&s.emit(e.type,e)},error:function(e){},keydown:function(e){var t,i=s.activePage,n={code:e.keyCode,stop:!1};e.ctrlKey&&(n.code+="c"),e.altKey&&(n.code+="a"),e.shiftKey&&(n.code+="s"),(t=i.activeComponent)&&t!==i&&(t.events[e.type]&&t.emit(e.type,n,e),!n.stop&&t.propagate&&t.parent&&t.parent.events[e.type]&&t.parent.emit(e.type,n,e)),n.stop||(i.events[e.type]&&i.emit(e.type,n,e),e.stop||s.events[e.type]&&s.emit(e.type,n,e))},keypress:function(e){var t=s.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e)},mousewheel:function(e){var t=s.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e),e.stop||t.events[e.type]&&t.emit(e.type,e)}}},function(e,t,i){"use strict";if(!document.documentElement.classList){var s=Array.prototype,n=s.indexOf,o=s.slice,a=s.push,r=s.splice,l=s.join;window.DOMTokenList=function(e){if(this._element=e,e.className!==this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,i=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;t<i.length;t++)a.call(this,i[t])}},window.DOMTokenList.prototype={add:function(e){this.contains(e)||(a.call(this,e),this._element.className=o.call(this,0).join(" "))},contains:function(e){return-1!==n.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var t=n.call(this,e);-1!==t&&(r.call(this,t,1),this._element.className=o.call(this,0).join(" "))},toString:function(){return l.call(this," ")},toggle:function(e){return this.contains(e)?this.remove(e):this.add(e),this.contains(e)}},Object.defineProperty(Element.prototype,"classList",{get:function(){return new window.DOMTokenList(this)}})}},function(e,t,i){"use strict";var s=i(0),n=i(13);s.metrics=n[s.query.screenHeight]||n[screen.height]||n[720],s.metrics.availHeight=s.metrics.height-(s.metrics.availTop+s.metrics.availBottom),s.metrics.availWidth=s.metrics.width-(s.metrics.availLeft+s.metrics.availRight)},function(e,t,i){"use strict";e.exports={480:{height:480,width:720,availTop:24,availBottom:24,availRight:32,availLeft:48},576:{height:576,width:720,availTop:24,availBottom:24,availRight:26,availLeft:54},720:{height:720,width:1280,availTop:30,availBottom:30,availRight:40,availLeft:40},1080:{height:1080,width:1920,availTop:45,availBottom:45,availRight:60,availLeft:60}}},function(e,t,i){"use strict";var s,n=i(0);(s=document.createElement("link")).rel="stylesheet",s.href=window.core.theme.path+n.metrics.height+".css",document.head.appendChild(s),e.exports=s},function(e,t,i){"use strict";var s=new(i(4))({$node:document.getElementById("pageInit")});e.exports=s},function(e,t,i){"use strict";var s=i(17);function n(e){e=e||{},this.active=!1,this.activeComponent=null,s.call(this,e),this.active=this.$node.classList.contains("active"),null===this.$node.parentNode&&document.body.appendChild(this.$node),this.page=this}n.prototype=Object.create(s.prototype),n.prototype.constructor=n,n.prototype.name="spa-component-page",e.exports=n},function(e,t,i){"use strict";var s=i(0),n=i(2),o=0;function a(e){var t,i=this;if(e=e||{},this.visible=!0,this.focusable=!0,this.$node=null,this.$body=null,this.parent=null,this.children=[],this.propagate=!!e.propagate,n.call(this),this.$node=e.$node||document.createElement("div"),this.$body=e.$body||this.$node,this.$node.className=this.name+" "+(e.className||""),this.id=e.id||this.$node.id||"cid"+o++,e.parent&&e.parent.add(this),!1===e.visible&&this.hide(),!1===e.focusable&&(this.focusable=!1),this.defaultEvents)for(t in e.events=e.events||{},this.defaultEvents)e.events[t]=e.events[t]||this.defaultEvents[t];e.events&&Object.keys(e.events).forEach(function(t){i.addListener(t,e.events[t])}),e.children&&this.add.apply(this,e.children),this.$node.addEventListener("click",function(e){i.focus(),i.events["click"]&&i.emit("click",e),e.stopPropagation()}),this.name,this.id,this.name,this.id}a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.defaultEvents=null,a.prototype.add=function(e){var t;for(t=0;t<arguments.length;t++)e=arguments[t],this.children.push(e),e.parent=this,e.$node&&null===e.$node.parentNode&&this.$body.appendChild(e.$node),e.name,e.id,this.name,this.id,this.name,this.id,e.name,e.id,this.events["add"]&&this.emit("add",{item:e})},a.prototype.remove=function(){this.parent&&(s.activePage.activeComponent===this&&(this.blur(),this.parent.focus()),this.parent.children.splice(this.parent.children.indexOf(this),1)),this.children.forEach(function(e){e.remove()}),this.$node.parentNode.removeChild(this.$node),this.events["remove"]&&this.emit("remove"),this.events={},this.name,this.id,this.name,this.id},a.prototype.focus=function(e){var t=s.activePage,i=t.activeComponent;return!(!this.focusable||this===i)&&(i&&i.blur(),t.activeComponent=i=this,i.$node.classList.add("focus"),this.name,this.id,this.name,this.id,i.events["focus"]&&i.emit("focus",e),!0)},a.prototype.blur=function(){var e=s.activePage,t=e.activeComponent;return this.$node.classList.remove("focus"),this===t?(e.activeComponent=null,this.name,this.id,this.name,this.id,this.events["blur"]&&this.emit("blur"),!0):(this.name,this.id,this.name,this.id,!1)},a.prototype.show=function(e,t){return!this.visible&&(this.$node.classList.remove("hidden"),this.visible=!0,this.name,this.id,this.name,this.id,this.events["show"]&&this.emit("show",e),"function"==typeof t&&setTimeout(t),!0)},a.prototype.hide=function(e){return!!this.visible&&(this.$node.classList.add("hidden"),this.visible=!1,this.name,this.id,this.name,this.id,this.events["hide"]&&this.emit("hide"),"function"==typeof e&&setTimeout(e),!0)},e.exports=a},function(e,t,i){"use strict";var s=new(i(4))({$node:document.getElementById("pageMain")}),n=i(1),o=i(19),a=n.metrics.height,r="./img/"+a+"/",l=i(5).gs,c=i(5).VKBlock;s.addListener("load",function(){c=!0,document.getElementById("game").width=l.size[a].scr.w,document.getElementById("game").height=l.size[a].scr.h,window.moveTo(0,0)}),s.addListener("keydown",function(e){if(document.getElementById("errorCell").style.display="none",1!=c)switch(e.code){case o.right:l.position.old.y=l.position.current.y,l.position.old.x=l.position.current.x,l.position.current.x+1<=l.infoItems.x-1?l.position.current.x++:l.position.current.x=0,m.item();break;case o.left:l.position.old.y=l.position.current.y,l.position.old.x=l.position.current.x,l.position.current.x-1>=0?l.position.current.x--:l.position.current.x=l.infoItems.x-1,m.item();break;case o.down:l.position.old.y=l.position.current.y,l.position.old.x=l.position.current.x,l.position.current.y+1<=l.infoItems.y-1?l.position.current.y++:l.position.current.y=0,m.item();break;case o.up:l.position.old.y=l.position.current.y,l.position.old.x=l.position.current.x,l.position.current.y-1>=0?l.position.current.y--:l.position.current.y=l.infoItems.y-1,m.item();break;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:m.PressNUM(e.code);break;case o.f2:m.Erase();break;case o.f1:m.Tips();break;case o.f4:m.Candidats();break;case o.ok:m.PressOK();break;case o.refresh:window.location.reload(!0);break;case o.back:d()}else switch(e.code){case o.down:m.startCursor(-1);break;case o.up:m.startCursor(1);break;case o.ok:m.PressOK();break;case o.back:d()}});var m={"vars":{"model":"MAG250","mode":"setNums","tips":!0,"modeCandidats":!0,"started":!1,"gameTime":0,"timer":null,"openOne":!1,"counterSteps":0,"counterGoodSteps":0,"complexity":"easy"},"start":function(){var e=this;l.items=[];for(var t=0;t<l.infoItems.y;t++){l.items[t]=[];for(var i=0;i<l.infoItems.x;i++)l.items[t][i]={"delCand":[],"val":-1,"show":!1,"changeble":!1}}var s=[1,2,3,4,5,6,7,8,9].shuffle(),n=[s[0],s[1],s[2]],o=[s[3],s[4],s[5]],a=[s[6],s[7],s[8]];l.items[0][0].val=n[0],l.items[0][1].val=n[1],l.items[0][2].val=n[2],l.items[0][3].val=o[0],l.items[0][4].val=o[1],l.items[0][5].val=o[2],l.items[0][6].val=a[0],l.items[0][7].val=a[1],l.items[0][8].val=a[2],l.items[1][0].val=a[0],l.items[1][1].val=a[1],l.items[1][2].val=a[2],l.items[1][3].val=n[0],l.items[1][4].val=n[1],l.items[1][5].val=n[2],l.items[1][6].val=o[0],l.items[1][7].val=o[1],l.items[1][8].val=o[2],l.items[2][0].val=o[0],l.items[2][1].val=o[1],l.items[2][2].val=o[2],l.items[2][3].val=a[0],l.items[2][4].val=a[1],l.items[2][5].val=a[2],l.items[2][6].val=n[0],l.items[2][7].val=n[1],l.items[2][8].val=n[2],l.items[3][0].val=a[1],l.items[3][1].val=a[2],l.items[3][2].val=a[0],l.items[3][3].val=n[1],l.items[3][4].val=n[2],l.items[3][5].val=n[0],l.items[3][6].val=o[1],l.items[3][7].val=o[2],l.items[3][8].val=o[0],l.items[4][0].val=o[1],l.items[4][1].val=o[2],l.items[4][2].val=o[0],l.items[4][3].val=a[1],l.items[4][4].val=a[2],l.items[4][5].val=a[0],l.items[4][6].val=n[1],l.items[4][7].val=n[2],l.items[4][8].val=n[0],l.items[5][0].val=n[1],l.items[5][1].val=n[2],l.items[5][2].val=n[0],l.items[5][3].val=o[1],l.items[5][4].val=o[2],l.items[5][5].val=o[0],l.items[5][6].val=a[1],l.items[5][7].val=a[2],l.items[5][8].val=a[0],l.items[6][0].val=n[2],l.items[6][1].val=n[0],l.items[6][2].val=n[1],l.items[6][3].val=o[2],l.items[6][4].val=o[0],l.items[6][5].val=o[1],l.items[6][6].val=a[2],l.items[6][7].val=a[0],l.items[6][8].val=a[1],l.items[7][0].val=a[2],l.items[7][1].val=a[0],l.items[7][2].val=a[1],l.items[7][3].val=n[2],l.items[7][4].val=n[0],l.items[7][5].val=n[1],l.items[7][6].val=o[2],l.items[7][7].val=o[0],l.items[7][8].val=o[1],l.items[8][0].val=o[2],l.items[8][1].val=o[0],l.items[8][2].val=o[1],l.items[8][3].val=a[2],l.items[8][4].val=a[0],l.items[8][5].val=a[1],l.items[8][6].val=n[2],l.items[8][7].val=n[0],l.items[8][8].val=n[1];var r=[[0,1,2],[3,4,5],[6,7,8]],m=[[0,1,2].shuffle(),[0,1,2].shuffle(),[0,1,2].shuffle()],d=[0,1,2].shuffle(),u=[r[d[0]][m[0][0]],r[d[0]][m[0][1]],r[d[0]][m[0][2]],r[d[1]][m[1][0]],r[d[1]][m[1][1]],r[d[1]][m[1][2]],r[d[2]][m[2][0]],r[d[2]][m[2][1]],r[d[2]][m[2][2]]],h=[[1,2,0].shuffle(),[1,2,0].shuffle(),[1,2,0].shuffle()],p=[1,2,0].shuffle(),v=[r[p[0]][h[0][0]],r[p[0]][h[0][1]],r[p[0]][h[0][2]],r[p[1]][h[1][0]],r[p[1]][h[1][1]],r[p[1]][h[1][2]],r[p[2]][h[2][0]],r[p[2]][h[2][1]],r[p[2]][h[2][2]]];r.toString(),u.toString(),v.toString();var f=[];for(t=0;t<l.infoItems.y;t++){f[t]=[];for(i=0;i<l.infoItems.x;i++)f[t][i]=l.items[v[t]][u[i]]}l.items=f,f=null;for(var y,g,b=(y=0,g=l.complexity[this.vars.complexity].length-1,y=parseInt(y,10),g=parseInt(g,10),Math.floor(Math.random()*(g-y+1))+y),I=0;I<l.complexity[this.vars.complexity][b].length;I++)for(var x=[0,1,2,3,4,5,6,7,8].shuffle().slice(0,l.complexity[this.vars.complexity][b][I]),E=0;E<x.length;E++)l.items[l.squares[I][x[E]][0]][l.squares[I][x[E]][1]].show=!0;for(t=0;t<l.infoItems.y;t++)for(i=0;i<l.infoItems.x;i++)0==l.items[t][i].show&&(l.items[t][i].val=-1,l.items[t][i].changeble=!0,l.items[t][i].flag=!1);setTimeout(function(){e.item(),e.vars.started=!0,c=!1,null!=e.vars.timer&&clearInterval(e.vars.timer),e.vars.timer=null,e.Candidats(),e.vars.timer=setInterval(function(){e.vars.gameTime++;var t=Math.floor(e.vars.gameTime/60),i=e.vars.gameTime-60*t;document.getElementById("counter_time").getElementsByClassName("cover")[0].innerHTML=(t<10?"0"+t:t)+" "+(i<10?"0"+i:i),e.vars.gameTime>=7200&&(document.getElementById("finish").style.display="block",null!=e.vars.timer&&clearInterval(e.vars.timer),e.vars.timer=null,c=!0,e.vars.started=!1)},999),e.fillVariants()},1)},"item":function(){document.getElementById("cursor").style.display="block",document.getElementById("cursor").style.marginLeft=l.position.current.x*l.size[a].cll.w+"px",document.getElementById("cursor").style.marginTop=l.position.current.y*l.size[a].cll.h+"px"},"PressOK":function(){0!=this.vars.started||"block"!=document.getElementById("finish").style.display?0==this.vars.started&&(document.getElementById("finish").style.display="none",document.getElementById("begin").style.display="none",this.start()):window.location.reload(!0)},"fillVariants":function(){for(var e,t=document.getElementById("game").getElementsByClassName("box"),i=0,s=0,n=0;n<t.length;n++)if(i=Math.floor(n/l.infoItems.x),s=n%l.infoItems.x,e=n<10?"0"+n:""+n,-1!=l.items[i][s].val)0==l.items[i][s].changeble?document.getElementById("p_"+e).innerHTML="<span>"+l.items[i][s].val+"</span>":document.getElementById("p_"+e).innerHTML="<strong>"+l.items[i][s].val+"</strong>";else if(1==this.vars.tips){var o=this.getArrToCell(s,i,document.getElementById("p_"+e).parentNode.id),a="",r=[];l.items[i][s].delCand.length>0&&(l.items[i][s].delCand.toString(),o.toString());for(var c=0;c<o.length;c++)if(l.items[i][s].delCand.length>0){for(var m=!1,d=0;d<l.items[i][s].delCand.length;d++)if(l.items[i][s].delCand[d]==o[c]){m=!0;break}1!=m&&r.push(o[c])}else r.push(o[c]);for(var u=[1,2,3,4,5,6,7,8,9],h=0;h<9;h++){m=!1;for(var p=0;p<r.length;p++)u[h]==r[p]&&(m=!0);a+=1==m?u[h]+" ":"<s>"+u[h]+"</s> "}document.getElementById("p_"+e).innerHTML=a}else document.getElementById("p_"+e).innerHTML=""},"fillOne":function(e,t,i,s,n){var o=l.infoItems.x*n+s;o=o<10?"0"+o:""+o;var a=this.getArrToCell(s,n,document.getElementById("p_"+o).parentNode.id);if(s==e&&n==t)for(var r=0;r<a.length;r++)a[r]==i&&(l.items[n][s].flag=!0);else if(-1!=l.items[n][s].val)1==l.items[n][s].changeble?document.getElementById("p_"+o).innerHTML="<strong>"+l.items[n][s].val+"</strong>":document.getElementById("p_"+o).innerHTML="<span>"+l.items[n][s].val+"</span>";else if(1==this.vars.tips){for(var c="",m=[1,2,3,4,5,6,7,8,9],d=0;d<m.length;d++){for(var u=!1,h=0;h<a.length;h++)m[d]==a[h]&&(u=!0);if(1==u){if(1==l.items[t][e].flag&&i==m[d]){c+="<s>"+m[d]+"</s> ";continue}c+=m[d]+" "}else c+="<s>"+m[d]+"</s> "}document.getElementById("p_"+o).innerHTML=c}else document.getElementById("p_"+o).innerHTML=""},"fillCellCand":function(e,t){var i=l.infoItems.x*t+e;i=i<10?"0"+i:""+i;var s=this.getArrToCell(e,t,document.getElementById("p_"+i).parentNode.id);if(-1==l.items[t][e].val)if(1==this.vars.tips){for(var n="",o=[1,2,3,4,5,6,7,8,9],a=0;a<o.length;a++){for(var r=!1,c=0;c<s.length;c++)if(o[a]==s[c]){r=!0;break}l.items[t][e].delCand.toString();for(var m=0;m<l.items[t][e].delCand.length;m++)if(l.items[t][e].delCand[m]==o[a]){r=!1;break}n+=1==r?o[a]+" ":"<s>"+o[a]+"</s> "}document.getElementById("p_"+i).innerHTML=n}else document.getElementById("p_"+i).innerHTML=""},"fillVariantsXY":function(e,t,i){var s,n,o;for(l.items[t][e].val=-1,this.fillOne(e,t,i,e,t),s=0;s<l.infoItems.x;s++)this.fillOne(e,t,i,s,t);for(n=0;n<l.infoItems.y;n++)this.fillOne(e,t,i,e,n);if(1==this.vars.tips&&1==l.items[t][e].flag){o=(o=l.infoItems.x*t+e)<10?"0"+o:""+o;for(var r=document.getElementById(document.getElementById("p_"+o).parentNode.id).getElementsByClassName("box"),c=0;c<r.length;c++){var m=parseInt(r[c].id.substr(2,2),10);s=m%l.infoItems.x,n=Math.floor(m/l.infoItems.x),this.fillOne(e,t,i,s,n)}}if(-1!=i)o=(o=l.infoItems.x*t+e)<10?"0"+o:""+o,1==l.items[t][e].flag?(l.items[t][e].val=i,document.getElementById("p_"+o).innerHTML="<strong>"+l.items[t][e].val+"</strong>"):(document.getElementById("errorCell").style.margin=t*l.size[a].cll.h+"px 0 0 "+e*l.size[a].cll.w+"px",document.getElementById("errorCell").style.display="block",setTimeout(function(){document.getElementById("errorCell").style.display="none"},1250));else if(l.items[t][e].val=i,o=(o=l.infoItems.x*t+e)<10?"0"+o:""+o,1==this.vars.tips){for(var d=this.getArrToCell(e,t,document.getElementById("p_"+o).parentNode.id),u="",h=[1,2,3,4,5,6,7,8,9],p=0;p<h.length;p++){for(var v=!1,f=0;f<d.length;f++)h[p]==d[f]&&(v=!0);if(1==v){if(1==l.items[t][e].flag&&i==h[p]){u+="<s>"+h[p]+"</s> ";continue}u+=h[p]+" "}else u+="<s>"+h[p]+"</s> "}document.getElementById("p_"+o).innerHTML=u}else document.getElementById("p_"+o).innerHTML=""},"getArrToCell":function(e,t,i){for(var s,n=[1,2,3,4,5,6,7,8,9],o=[],a=!1,r=-1,c=0;c<n.length;c++){a=!1;for(var m=0;m<l.infoItems.x;m++)if(l.items[t][m].val==n[c]){a=!0;break}for(var d=0;d<l.infoItems.x;d++)if(l.items[d][e].val==n[c]){a=!0;break}s=document.getElementById(i).getElementsByClassName("box");for(var u=0;u<s.length;u++)if(r=parseInt(s[u].id.substr(2,2),10),l.items[Math.floor(r/l.infoItems.x)][r%l.infoItems.x].val==n[c]){a=!0;break}0==a&&o.push(n[c])}return o},"PressNUM":function(e){var t=-1;switch(e){case 49:t=1;break;case 50:t=2;break;case 51:t=3;break;case 52:t=4;break;case 53:t=5;break;case 54:t=6;break;case 55:t=7;break;case 56:t=8;break;case 57:t=9}if(1==this.vars.modeCandidats){var i=!1;for(var s in l.items[l.position.current.y][l.position.current.x].delCand)l.items[l.position.current.y][l.position.current.x].delCand[s]==t&&(l.items[l.position.current.y][l.position.current.x].delCand.splice(s,1),i=!0);0==i&&l.items[l.position.current.y][l.position.current.x].delCand.push(t),this.fillCellCand(l.position.current.x,l.position.current.y)}else{if(1==l.items[l.position.current.y][l.position.current.x].changeble){var n=l.infoItems.x*l.position.current.y+l.position.current.x;n=n<10?"0"+n:""+n;for(var o=this.getArrToCell(l.position.current.x,l.position.current.y,document.getElementById("p_"+n).parentNode.id),r=!1,m=0;m<o.length;m++)o[m]==t&&(r=!0);1==r?this.fillVariantsXY(l.position.current.x,l.position.current.y,t):(document.getElementById("errorCell").style.margin=l.position.current.y*l.size[a].cll.h+"px 0 0 "+l.position.current.x*l.size[a].cll.w+"px",document.getElementById("errorCell").style.display="block",setTimeout(function(){document.getElementById("errorCell").style.display="none"},1250))}for(var d=0,u=0,h=0;h<l.infoItems.y;h++)for(var p=0;p<l.infoItems.x;p++)u++,-1!=l.items[h][p].val&&d++;u==d&&(document.getElementById("finish").style.display="block",null!=this.vars.timer&&clearInterval(this.vars.timer),this.vars.timer=null,c=!0,this.vars.started=!1)}},"Erase":function(){1==l.items[l.position.current.y][l.position.current.x].changeble&&(l.items[l.position.current.y][l.position.current.x].val=-1,this.fillVariantsXY(l.position.current.x,l.position.current.y,-1))},"Tips":function(){1==this.vars.tips?(this.vars.tips=!1,this.fillVariants(),document.getElementById("showTips").style.backgroundImage="url("+r+"btn_red50.png)",document.getElementById("showCandidats").style.display="none"):(this.vars.tips=!0,this.fillVariants(),document.getElementById("showTips").style.backgroundImage="url("+r+"btn_red.png)",document.getElementById("showCandidats").style.display="block",document.getElementById("showCandidats").style.backgroundImage="url("+r+"btn_blue.png)")},"Candidats":function(){1==this.vars.tips&&(1==this.vars.modeCandidats?(this.vars.modeCandidats=!1,document.getElementById("showCandidats").style.backgroundImage="url("+r+"btn_blue50.png)",document.getElementById("cursor").className=""):(this.vars.modeCandidats=!0,document.getElementById("showCandidats").style.backgroundImage="url("+r+"btn_blue.png)",document.getElementById("cursor").className="del"))},"startCursor":function(e){switch(this.vars.complexity){case"easy":document.getElementById("c_easy").style.backgroundImage="url("+r+"start/easy0.png)",1==e?(this.vars.complexity="hard",document.getElementById("c_hard").style.backgroundImage="url("+r+"start/hard1.png)"):(this.vars.complexity="normal",document.getElementById("c_normal").style.backgroundImage="url("+r+"start/normal1.png)");break;case"normal":document.getElementById("c_normal").style.backgroundImage="url("+r+"start/normal0.png)",1==e?(this.vars.complexity="easy",document.getElementById("c_easy").style.backgroundImage="url("+r+"start/easy1.png)"):(this.vars.complexity="hard",document.getElementById("c_hard").style.backgroundImage="url("+r+"start/hard1.png)");break;case"hard":document.getElementById("c_hard").style.backgroundImage="url("+r+"start/hard0.png)",1==e?(this.vars.complexity="normal",document.getElementById("c_normal").style.backgroundImage="url("+r+"start/normal1.png)"):(this.vars.complexity="easy",document.getElementById("c_easy").style.backgroundImage="url("+r+"start/easy1.png)")}}};function d(){core.notify({title:"Do you want to exit?",icon:"alert",type:"",buttons:[{value:"Exit",click:function(){core.call("exit")}},{value:"Cancel",click:function(){}}],timeout:5e3})}Array.prototype.shuffle=function(){for(var e,t,i=this.length;i--;)t=this[e=Math.floor(i*Math.random())],this[e]=this[i],this[i]=t;return this},e.exports=s},function(e,t,i){"use strict";var s=i(20);s.back=s.backspace,s.channelNext=s.tab,s.channelPrev=s.tab+"s",s.ok=s.enter,s.exit=s.escape,s.volumeUp=107,s.volumeDown=109,s.f1="112c",s.f2="113c",s.f3="114c",s.f4="115c",s.refresh="116c",s.frame="117c",s.phone="119c",s.set="120c",s.tv="121c",s.menu="122c",s.app="123c",s.rewind="66a",s.forward="70a",s.audio="71a",s.standby="74a",s.keyboard="76a",s.usbMounted="80a",s.usbUnmounted="81a",s.playPause="82a",s.play=-1,s.pause=-1,s.stop="83a",s.power="85a",s.record="87a",s.info="89a",s.mute="192a",s.digit0=48,s.digit1=49,s.digit2=50,s.digit3=51,s.digit4=52,s.digit5=53,s.digit6=54,s.digit7=55,s.digit8=56,s.digit9=57,e.exports=s},function(e,t,i){"use strict";e.exports={backspace:8,tab:9,enter:13,escape:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,del:46}}]);
//# sourceMappingURL=main.js.map