diff --git a/public/javascripts/vendor/chessground.min.js b/public/javascripts/vendor/chessground.min.js index 166f8252f1..fea5d02bb1 100755 --- a/public/javascripts/vendor/chessground.min.js +++ b/public/javascripts/vendor/chessground.min.js @@ -1,3 +1,3 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Chessground=e()}}(function(){var e;return function t(e,n,r){function o(i,l){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;is;++s){var c=r[s],u=o(c);if("object"===u)for(var d in c){var f=e?a.clone(c[d]):c[d];i[d]=t?n(i[d],f):f}}return i}function o(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var a=function(e){return r(e===!0,!1,arguments)},i="merge";a.recursive=function(e){return r(e===!0,!0,arguments)},a.clone=function(e){var t,n,r=e,i=o(e);if("array"===i)for(r=[],n=e.length,t=0;n>t;++t)r[t]=a.clone(e[t]);else if("object"===i){r={};for(t in e)r[t]=a.clone(e[t])}return r},e?t.exports=a:window[i]=a}("object"==typeof t&&t&&"object"==typeof t.exports&&t.exports)},{}],3:[function(t,n,r){var o=function a(e,t){function n(e){j=e.document,A=e.location,D=e.cancelAnimationFrame||e.clearTimeout,N=e.requestAnimationFrame||e.setTimeout}function r(){var e,t=[].slice.call(arguments),n=!(null==t[1]||F.call(t[1])!==q||"tag"in t[1]||"view"in t[1]||"subtree"in t[1]),r=n?t[1]:{},o="class"in r?"class":"className",a={tag:"div",attrs:{}},i=[];if(F.call(t[0])!=R)throw new Error("selector in m(selector, attrs, children) should be a string");for(;e=K.exec(t[0]);)if(""===e[1]&&e[2])a.tag=e[2];else if("#"===e[1])a.attrs.id=e[2];else if("."===e[1])i.push(e[2]);else if("["===e[3][0]){var l=B.exec(e[3]);a.attrs[l[1]]=l[3]||(l[2]?"":!0)}var s=t.slice(n?2:1);a.children=1===s.length&&F.call(s[0])===S?s[0]:s;for(var c in r)r.hasOwnProperty(c)&&(c===o&&null!=r[c]&&""!==r[c]?(i.push(r[c]),a.attrs[c]=""):a.attrs[c]=r[c]);return i.length>0&&(a.attrs[o]=i.join(" ")),a}function o(e,n,a,c,d,f,p,h,v,g,m){try{(null==d||null==d.toString())&&(d="")}catch(b){d=""}if("retain"===d.subtree)return f;var y=F.call(f),w=F.call(d);if(null==f||y!==w){if(null!=f)if(a&&a.nodes){var k=h-c,x=k+(w===S?d:f.nodes).length;s(a.nodes.slice(k,x),a.slice(k,x))}else f.nodes&&s(f.nodes,f);f=new d.constructor,f.tag&&(f={}),f.nodes=[]}if(w===S){for(var E=0,C=d.length;C>E;E++)F.call(d[E])===S&&(d=d.concat.apply([],d),E--,C=d.length);for(var O=[],M=f.length===d.length,P=0,T=1,A=2,N=3,D={},K=!1,E=0;EE;E++)if(d[E]&&d[E].attrs&&null!=d[E].attrs.key){for(var U=0,C=d.length;C>U;U++)d[U]&&d[U].attrs&&null==d[U].attrs.key&&(d[U].attrs.key="__mithril__"+B++);break}if(K){var X=!1;if(d.length!=f.length)X=!0;else for(var z,H,E=0;z=f[E],H=d[E];E++)if(z.attrs&&H.attrs&&z.attrs.key!=H.attrs.key){X=!0;break}if(X){for(var E=0,C=d.length;C>E;E++)if(d[E]&&d[E].attrs&&null!=d[E].attrs.key){var _=d[E].attrs.key;D[_]=D[_]?{action:N,index:E,from:D[_].index,element:f.nodes[D[_].index]||j.createElement("div")}:{action:A,index:E}}var G=[];for(var J in D)G.push(D[J]);var Y=G.sort(i),V=new Array(f.length);V.nodes=f.nodes.slice();for(var Q,E=0;Q=Y[E];E++){if(Q.action===T&&(s(f[Q.index].nodes,f[Q.index]),V.splice(Q.index,1)),Q.action===A){var W=j.createElement("div");W.key=d[Q.index].attrs.key,e.insertBefore(W,e.childNodes[Q.index]||null),V.splice(Q.index,0,{attrs:{key:d[Q.index].attrs.key},nodes:[W]}),V.nodes[Q.index]=W}Q.action===N&&(e.childNodes[Q.index]!==Q.element&&null!==Q.element&&e.insertBefore(Q.element,e.childNodes[Q.index]||null),V[Q.index]=f[Q.from],V.nodes[Q.index]=Q.element)}f=V}}for(var E=0,Z=0,C=d.length;C>E;E++){var te=o(e,n,f,h,d[E],f[Z],p,h+P||P,v,g,m);te!==t&&(te.nodes.intact||(M=!1),P+=te.$trusted?(te.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:F.call(te)===S?te.length:1,f[Z++]=te)}if(!M){for(var E=0,C=d.length;C>E;E++)null!=f[E]&&O.push.apply(O,f[E].nodes);for(var ne,E=0;ne=f.nodes[E];E++)null!=ne.parentNode&&O.indexOf(ne)<0&&s([ne],[f[E]]);d.length-1?f.controllers[le]:new(d.controller||$),_=d&&d.attrs&&d.attrs.key;if(d=0==re||f&&f.controllers&&f.controllers.indexOf(se)>-1?d.view(se):{tag:"placeholder"},"retain"===d.subtree)return f;_&&(d.attrs||(d.attrs={}),d.attrs.key=_),se.onunload&&ee.push({controller:se,handler:se.onunload}),oe.push(ie),ae.push(se)}if(!d.tag&&ae.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");d.attrs||(d.attrs={}),f.attrs||(f.attrs={});var ce=Object.keys(d.attrs),ue=ce.length>("key"in d.attrs?1:0);if((d.tag!=f.tag||ce.sort().join()!=Object.keys(f.attrs).sort().join()||d.attrs.id!=f.attrs.id||d.attrs.key!=f.attrs.key||"all"==r.redraw.strategy()&&(!f.configContext||f.configContext.retain!==!0)||"diff"==r.redraw.strategy()&&f.configContext&&f.configContext.retain===!1)&&(f.nodes.length&&s(f.nodes),f.configContext&&typeof f.configContext.onunload===L&&f.configContext.onunload(),f.controllers))for(var se,E=0;se=f.controllers[E];E++)typeof se.onunload===L&&se.onunload({preventDefault:$});if(F.call(d.tag)!=R)return;var ne,de=0===f.nodes.length;if(d.attrs.xmlns?g=d.attrs.xmlns:"svg"===d.tag?g="http://www.w3.org/2000/svg":"math"===d.tag&&(g="http://www.w3.org/1998/Math/MathML"),de){if(ne=d.attrs.is?g===t?j.createElement(d.tag,d.attrs.is):j.createElementNS(g,d.tag,d.attrs.is):g===t?j.createElement(d.tag):j.createElementNS(g,d.tag),f={tag:d.tag,attrs:ue?l(ne,d.tag,d.attrs,{},g):d.attrs,children:null!=d.children&&d.children.length>0?o(ne,d.tag,t,t,d.children,f.children,!0,0,d.attrs.contenteditable?ne:v,g,m):d.children,nodes:[ne]},ae.length){f.views=oe,f.controllers=ae;for(var se,E=0;se=ae[E];E++)if(se.onunload&&se.onunload.$old&&(se.onunload=se.onunload.$old),re&&se.onunload){var fe=se.onunload;se.onunload=$,se.onunload.$old=fe}}f.children&&!f.children.nodes&&(f.children.nodes=[]),"select"===d.tag&&"value"in d.attrs&&l(ne,d.tag,{value:d.attrs.value},{},g),e.insertBefore(ne,e.childNodes[h]||null)}else ne=f.nodes[0],ue&&l(ne,d.tag,d.attrs,f.attrs,g),f.children=o(ne,d.tag,t,t,d.children,f.children,!1,0,d.attrs.contenteditable?ne:v,g,m),f.nodes.intact=!0,ae.length&&(f.views=oe,f.controllers=ae),p===!0&&null!=ne&&e.insertBefore(ne,e.childNodes[h]||null);if(typeof d.attrs.config===L){var pe=f.configContext=f.configContext||{},he=function(e,t){return function(){return e.attrs.config.apply(e,t)}};m.push(he(d,[ne,!de,pe,f]))}}else if(typeof d!=L){var O;0===f.nodes.length?(d.$trusted?O=u(e,h,d):(O=[j.createTextNode(d)],e.nodeName.match(I)||e.insertBefore(O[0],e.childNodes[h]||null)),f="string number boolean".indexOf(typeof d)>-1?new d.constructor(d):d,f.nodes=O):f.valueOf()!==d.valueOf()||p===!0?(O=f.nodes,v&&v===j.activeElement||(d.$trusted?(s(O,f),O=u(e,h,d)):"textarea"===n?e.value=d:v?v.innerHTML=d:((1===O[0].nodeType||O.length>1)&&(s(f.nodes,f),O=[j.createTextNode(d)]),e.insertBefore(O[0],e.childNodes[h]||null),O[0].nodeValue=d)),f=new d.constructor(d),f.nodes=O):f.nodes.intact=!0}return f}function i(e,t){return e.action-t.action||e.index-t.index}function l(e,t,n,r,o){for(var a in n){var i=n[a],l=r[a];if(a in r&&l===i)"value"===a&&"input"===t&&e.value!=i&&(e.value=i);else{r[a]=i;try{if("config"===a||"key"==a)continue;if(typeof i===L&&0===a.indexOf("on"))e[a]=d(i,e);else if("style"===a&&null!=i&&F.call(i)===q){for(var s in i)(null==l||l[s]!==i[s])&&(e.style[s]=i[s]);for(var s in l)s in i||(e.style[s]="")}else null!=o?"href"===a?e.setAttributeNS("http://www.w3.org/1999/xlink","href",i):"className"===a?e.setAttribute("class",i):e.setAttribute(a,i):a in e&&"list"!==a&&"style"!==a&&"form"!==a&&"type"!==a&&"width"!==a&&"height"!==a?("input"!==t||e[a]!==i)&&(e[a]=i):e.setAttribute(a,i)}catch(c){if(c.message.indexOf("Invalid argument")<0)throw c}}}return r}function s(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&c(t[n])}0!=e.length&&(e.length=0)}function c(e){if(e.configContext&&typeof e.configContext.onunload===L&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers)for(var t,n=0;t=e.controllers[n];n++)typeof t.onunload===L&&t.onunload({preventDefault:$});if(e.children)if(F.call(e.children)===S)for(var r,n=0;r=e.children[n];n++)c(r);else e.children.tag&&c(e.children)}function u(e,t,n){var r=e.childNodes[t];if(r){var o=1!=r.nodeType,a=j.createElement("span");o?(e.insertBefore(a,r||null),a.insertAdjacentHTML("beforebegin",n),e.removeChild(a)):r.insertAdjacentHTML("beforebegin",n)}else e.insertAdjacentHTML("beforeend",n);for(var i=[];e.childNodes[t]!==r;)i.push(e.childNodes[t]),t++;return i}function d(e,t){return function(n){n=n||event,r.redraw.strategy("diff"),r.startComputation();try{return e.call(t,n)}finally{oe()}}}function f(e){var t=z.indexOf(e);return 0>t?z.push(e)-1:t}function p(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t}function h(e,t){var n=function(){return(e.controller||$).apply(this,t)||this},r=function(n){return arguments.length>1&&(t=t.concat([].slice.call(arguments,1))),e.view.apply(e,t?[n].concat(t):[n])};r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function v(){W&&(W(),W=null);for(var e,t=0;e=G[t];t++)if(Y[t]){var n=J[t].controller&&J[t].controller.$$args?[Y[t]].concat(J[t].controller.$$args):[Y[t]];r.render(e,J[t].view?J[t].view(Y[t],n):"")}Z&&(Z(),Z=null),V=null,Q=new Date,r.redraw.strategy("diff")}function g(e){return e.slice(le[r.route.mode].length)}function m(e,t,n){ae={};var o=n.indexOf("?");-1!==o&&(ae=k(n.substr(o+1,n.length)),n=n.substr(0,o));var a=Object.keys(t),i=a.indexOf(n);if(-1!==i)return r.mount(e,t[a[i]]),!0;for(var l in t){if(l===n)return r.mount(e,t[l]),!0;var s=new RegExp("^"+l.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(s.test(n))return n.replace(s,function(){for(var n=l.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),a=0,i=n.length;i>a;a++)ae[n[a].replace(/:|\./g,"")]=decodeURIComponent(o[a]);r.mount(e,t[l])}),!0}}function b(e){if(e=e||event,!e.ctrlKey&&!e.metaKey&&2!==e.which){e.preventDefault?e.preventDefault():e.returnValue=!1;for(var t=e.currentTarget||e.srcElement,n="pathname"===r.route.mode&&t.search?k(t.search.slice(1)):{};t&&"A"!=t.nodeName.toUpperCase();)t=t.parentNode;r.route(t[r.route.mode].slice(le[r.route.mode].length),n)}}function y(){"hash"!=r.route.mode&&A.hash?A.hash=A.hash:e.scrollTo(0,0)}function w(e,n){var r={},o=[];for(var a in e){var i=n?n+"["+a+"]":a,l=e[a],s=F.call(l),c=null===l?encodeURIComponent(i):s===q?w(l,i):s===S?l.reduce(function(e,t){return r[i]||(r[i]={}),r[i][t]?e:(r[i][t]=!0,e.concat(encodeURIComponent(i)+"="+encodeURIComponent(t)))},[]).join("&"):encodeURIComponent(i)+"="+encodeURIComponent(l);l!==t&&o.push(c)}return o.join("&")}function k(e){"?"===e.charAt(0)&&(e=e.substring(1));for(var t=e.split("&"),n={},r=0,o=t.length;o>r;r++){var a=t[r].split("="),i=decodeURIComponent(a[0]),l=2==a.length?decodeURIComponent(a[1]):null;null!=n[i]?(F.call(n[i])!==S&&(n[i]=[n[i]]),n[i].push(l)):n[i]=l}return n}function x(e){var n=f(e);s(e.childNodes,H[n]),H[n]=t}function E(e,t){var n=r.prop(t);return e.then(n),n.then=function(n,r){return E(e.then(n,r),t)},n}function C(e,t){function n(e){d=e||c,p.map(function(e){d===s&&e.resolve(f)||e.reject(f)})}function o(e,t,n,o){if((null!=f&&F.call(f)===q||typeof f===L)&&typeof e===L)try{var a=0;e.call(f,function(e){a++||(f=e,t())},function(e){a++||(f=e,n())})}catch(i){r.deferred.onerror(i),f=i,n()}else o()}function a(){var c;try{c=f&&f.then}catch(p){return r.deferred.onerror(p),f=p,d=l,a()}o(c,function(){d=i,a()},function(){d=l,a()},function(){try{d===i&&typeof e===L?f=e(f):d===l&&"function"==typeof t&&(f=t(f),d=i)}catch(a){return r.deferred.onerror(a),f=a,n()}f===u?(f=TypeError(),n()):o(c,function(){n(s)},n,function(){n(d===i&&s)})})}var i=1,l=2,s=3,c=4,u=this,d=0,f=0,p=[];u.promise={},u.resolve=function(e){return d||(f=e,d=i,a()),this},u.reject=function(e){return d||(f=e,d=l,a()),this},u.promise.then=function(e,t){var n=new C(e,t);return d===s?n.resolve(f):d===c?n.reject(f):p.push(n),n.promise}}function O(e){return e}function M(n){if(!n.dataType||"jsonp"!==n.dataType.toLowerCase()){var r=new e.XMLHttpRequest;if(r.open(n.method,n.url,!0,n.user,n.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?n.onload({type:"load",target:r}):n.onerror({type:"error",target:r}))},n.serialize===JSON.stringify&&n.data&&"GET"!==n.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),typeof n.config===L){var o=n.config(r,n);null!=o&&(r=o)}var a="GET"!==n.method&&n.data?n.data:"";if(a&&F.call(a)!=R&&a.constructor!=e.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return r.send(a),r}var i="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),l=j.createElement("script");e[i]=function(r){l.parentNode.removeChild(l),n.onload({type:"load",target:{responseText:r}}),e[i]=t},l.onerror=function(r){return l.parentNode.removeChild(l),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[i]=t,!1},l.onload=function(e){return!1},l.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+i+"&"+w(n.data||{}),j.body.appendChild(l)}function P(e,t,n){if("GET"===e.method&&"jsonp"!=e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=w(t);e.url=e.url+(o?r+o:"")}else e.data=n(t);return e}function T(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;ru;u++)a[u]()},r.trust=function(e){return e=new String(e),e.$trusted=!0,e},r.prop=function(e){return(null!=e&&F.call(e)===q||typeof e===L)&&typeof e.then===L?E(e):p(e)};var _,G=[],J=[],Y=[],V=null,Q=0,W=null,Z=null,ee=[],te=16;r.component=function(e){return h(e,[].slice.call(arguments,1))},r.mount=r.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var n=G.indexOf(e);0>n&&(n=G.length);for(var o,a=!1,i={preventDefault:function(){a=!0,W=Z=null}},l=0;o=ee[l];l++)o.handler.call(o.controller,i),o.controller.onunload=null;if(a)for(var o,l=0;o=ee[l];l++)o.controller.onunload=o.handler;else ee=[];if(Y[n]&&typeof Y[n].onunload===L&&Y[n].onunload(i),!a){r.redraw.strategy("all"),r.startComputation(),G[n]=e,arguments.length>2&&(t=subcomponent(t,[].slice.call(arguments,2)));var s=_=t=t||{controller:function(){}},c=t.controller||$,u=new c;return s===_&&(Y[n]=u,J[n]=t),oe(),Y[n]}};var ne=!1;r.redraw=function(t){ne||(ne=!0,V&&t!==!0?(N===e.requestAnimationFrame||new Date-Q>te)&&(V>0&&D(V),V=N(v,te)):(v(),V=N(function(){V=null},te)),ne=!1)},r.redraw.strategy=r.prop();var re=0;r.startComputation=function(){re++},r.endComputation=function(){re=Math.max(re-1,0),0===re&&r.redraw()};var oe=function(){"none"==r.redraw.strategy()?(re--,r.redraw.strategy("diff")):r.endComputation()};r.withAttr=function(e,t){return function(n){n=n||event;var r=n.currentTarget||this;t(e in r?r[e]:r.getAttribute(e))}};var ae,ie,le={pathname:"",hash:"#",search:"?"},se=$,ce=!1;return r.route=function(){if(0===arguments.length)return ie;if(3===arguments.length&&F.call(arguments[1])===R){var t=arguments[0],n=arguments[1],o=arguments[2];se=function(e){var a=ie=g(e);if(!m(t,o,a)){if(ce)throw new Error("Ensure the default route matches one of the routes defined in m.route");ce=!0,r.route(n,!0),ce=!1}};var a="hash"===r.route.mode?"onhashchange":"onpopstate";e[a]=function(){var e=A[r.route.mode];"pathname"===r.route.mode&&(e+=A.search),ie!=g(e)&&se(e)},W=y,e[a]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){var i=arguments[0],l=(arguments[1],arguments[2],arguments[3]);i.href=("pathname"!==r.route.mode?A.pathname:"")+le[r.route.mode]+l.attrs.href,i.addEventListener?(i.removeEventListener("click",b),i.addEventListener("click",b)):(i.detachEvent("onclick",b),i.attachEvent("onclick",b))}else if(F.call(arguments[0])===R){var s=ie;ie=arguments[0];var c=arguments[1]||{},u=ie.indexOf("?"),d=u>-1?k(ie.slice(u+1)):{};for(var f in c)d[f]=c[f];var p=w(d),h=u>-1?ie.slice(0,u):ie;p&&(ie=h+(-1===h.indexOf("?")?"?":"&")+p);var v=(3===arguments.length?arguments[2]:arguments[1])===!0||s===arguments[0];e.history.pushState?(W=y,Z=function(){e.history[v?"replaceState":"pushState"](null,j.title,le[r.route.mode]+ie)},se(le[r.route.mode]+ie)):(A[r.route.mode]=ie,se(le[r.route.mode]+ie))}},r.route.param=function(e){if(!ae)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return ae[e]},r.route.mode="search",r.route.buildQueryString=w,r.route.parseQueryString=k,r.deferred=function(){var e=new C;return e.promise=E(e.promise),e},r.deferred.onerror=function(e){if("[object Error]"===F.call(e)&&!e.constructor.toString().match(/ Error/))throw e},r.sync=function(e){function t(e,t){return function(r){return i[e]=r,t||(n="reject"),0===--a&&(o.promise(i),o[n](i)),r}}var n="resolve",o=r.deferred(),a=e.length,i=new Array(a);if(e.length>0)for(var l=0;l=t)e.animation.current={},e.render();else{var n=d.easeInOutCubic(t);for(var r in e.animation.current.anims){var o=e.animation.current.anims[r];o[1]=[l(o[0][0]*n,10),l(o[0][1]*n,10)]}for(var a in e.animation.current.fadings)e.animation.current.fadings[a].opacity=l(n,100);e.render(),u.requestAnimationFrame(function(){s(e)})}}}function c(e,t){var n={orientation:t.orientation,pieces:{}};for(var r in t.pieces)n.pieces[r]={role:t.pieces[r].role,color:t.pieces[r].color};var o=e(),a=i(n,t);if(Object.keys(a.anims).length>0||a.fadings.length>0){var l=t.animation.current.start;t.animation.current={start:(new Date).getTime(),duration:t.animation.duration,anims:a.anims,fadings:a.fadings},l||s(t)}else t.renderRAF();return o}var u=e("./util"),d={easeInOutCubic:function(e){return.5>e?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1}};t.exports=function(e,t,n){return function(){var r=[t].concat(Array.prototype.slice.call(arguments,0));if(t.render){if(t.animation.enabled&&!n)return c(u.partialApply(e,r),t);var o=e.apply(null,r);return t.renderRAF(),o}return e.apply(null,r)}}},{"./util":16}],5:[function(e,t,n){var r=e("./board");t.exports=function(e){return{set:e.set,toggleOrientation:e.toggleOrientation,getOrientation:function(){return e.data.orientation},getPieces:function(){return e.data.pieces},getMaterialDiff:function(){return r.getMaterialDiff(e.data)},getFen:e.getFen,dump:function(){return e.data},move:e.apiMove,setPieces:e.setPieces,setCheck:e.setCheck,playPremove:e.playPremove,cancelPremove:e.cancelPremove,cancelMove:e.cancelMove,stop:e.stop,explode:e.explode}}},{"./board":6}],6:[function(e,t,n){function r(e){setTimeout(e,1)}function o(e){e.orientation=P.opposite(e.orientation)}function a(e){e.lastMove=null,g(e,null),c(e)}function i(e,t){Object.keys(t).forEach(function(n){t[n]?e.pieces[n]=t[n]:delete e.pieces[n]}),e.movable.dropped=[]}function l(e,t){var n=t||e.turnColor;Object.keys(e.pieces).forEach(function(t){e.pieces[t].color===n&&"king"===e.pieces[t].role&&(e.check=t)})}function s(e,t,n){e.premovable.current=[t,n],r(P.partial(e.premovable.events.set,t,n))}function c(e){e.premovable.current&&(e.premovable.current=null,r(e.premovable.events.unset))}function u(e,t,n){if(e.autoCastle){var r=e.pieces[n];if("king"===r.role){var o=P.key2pos(t);if(5===o[0]&&(1===o[1]||8===o[1])){var a,i,l,s=P.key2pos(n);if(7===s[0]||8===s[0])a=P.pos2key([8,o[1]]),i=P.pos2key([6,o[1]]),l=P.pos2key([7,o[1]]);else{if(3!==s[0]&&1!==s[0])return;a=P.pos2key([1,o[1]]),i=P.pos2key([4,o[1]]),l=P.pos2key([3,o[1]])}delete e.pieces[t],delete e.pieces[n],delete e.pieces[a],e.pieces[l]={role:"king",color:r.color},e.pieces[i]={role:"rook",color:r.color}}}}}function d(e,t,n){var o=j(function(){if(t===n||!e.pieces[t])return!1;var o=e.pieces[n]&&e.pieces[n].color!==e.pieces[t].color?e.pieces[n]:null;return r(P.partial(e.events.move,t,n,o)),e.pieces[n]=e.pieces[t],delete e.pieces[t],e.lastMove=[t,n],e.check=null,u(e,t,n),r(e.events.change),!0},e)();return o&&(e.movable.dropped=[]),o}function f(e,t,n){var r=d(e,t,n);return r&&(e.movable.dests={},e.turnColor=P.opposite(e.turnColor)),r}function p(e,t,n){return d(e,t,n)}function h(e,t,n){n?b(e,t,n)?f(e,t,n)&&(g(e,null),r(P.partial(e.movable.events.after,t,n,{premove:!1,holdTime:A.stop()}))):w(e,t,n)?(s(e,t,n),g(e,null)):m(e,n)||y(e,n)?g(e,n):g(e,null):(g(e,null),"trash"===e.movable.dropOff&&(delete e.pieces[t],r(e.events.change)))}function v(e,t){e.selected?t?e.selected!==t&&h(e,e.selected,t):g(e,null):(m(e,t)||y(e,t))&&g(e,t),t&&r(P.partial(e.events.select,t))}function g(e,t){e.selected=t,e.premovable.dests=t&&y(e,t)?T(e.pieces,t,e.premovable.castle):null}function m(e,t){var n=e.pieces[t];return n&&("both"===e.movable.color||e.movable.color===n.color&&e.turnColor===n.color)}function b(e,t,n){return t!==n&&m(e,t)&&(e.movable.free||P.containsX(e.movable.dests[t],n))}function y(e,t){var n=e.pieces[t];return n&&e.premovable.enabled&&e.movable.color===n.color&&e.turnColor!==n.color}function w(e,t,n){return t!==n&&y(e,t)&&P.containsX(T(e.pieces,t,e.premovable.castle),n)}function k(e,t){var n=e.pieces[t];return n&&e.draggable.enabled&&("both"===e.movable.color||e.movable.color===n.color&&(e.turnColor===n.color||e.premovable.enabled))}function x(e){var t=e.premovable.current;if(t){var n=t[0],o=t[1];b(e,n,o)&&f(e,n,o)&&r(P.partial(e.movable.events.after,n,o,{premove:!0})),c(e)}}function E(e){c(e),v(e,null)}function C(e){e.movable.color=null,e.movable.dests={},E(e)}function O(e,t,n){if(n||e.bounds){n=n||e.bounds();var r=Math.ceil(8*((t[0]-n.left)/n.width));r="white"===e.orientation?r:9-r;var o=Math.ceil(8-8*((t[1]-n.top)/n.height));return o="white"===e.orientation?o:9-o,r>0&&9>r&&o>0&&9>o?P.pos2key([r,o]):void 0}}function M(e){var t={king:0,queen:0,rook:0,bishop:0,knight:0,pawn:0};for(var n in e.pieces){var r=e.pieces[n];t[r.role]+="white"===r.color?1:-1}var o={white:{},black:{}};for(var a in t){var i=t[a];i>0?o.white[a]=i:0>i&&(o.black[a]=-i)}return o}var P=e("./util"),T=e("./premove"),j=e("./anim"),A=e("./hold");t.exports={reset:a,toggleOrientation:o,setPieces:i,setCheck:l,selectSquare:v,setSelected:g,isDraggable:k,canMove:b,userMove:h,apiMove:p,playPremove:x,unsetPremove:c,cancelMove:E,stop:C,getKeyAtDomPos:O,getMaterialDiff:M}},{"./anim":4,"./hold":13,"./premove":14,"./util":16}],7:[function(e,t,n){var r=e("merge"),o=e("./board"),a=e("./fen");t.exports=function(e,t){t&&(t.movable&&t.movable.dests&&delete e.movable.dests,r.recursive(e,t),e.fen&&(e.pieces=a.read(e.fen),e.check=t.check,e.drawable.shapes=[],delete e.fen),e.check===!0&&o.setCheck(e),e.movable.dropped=[],e.selected&&o.setSelected(e,e.selected),(!e.animation.duration||e.animation.duration<10)&&(e.animation.enabled=!1))}},{"./board":6,"./fen":12,merge:2}],8:[function(e,t,n){var r=e("./board"),o=e("./data"),a=e("./fen"),i=e("./configure"),l=e("./anim"),s=e("./drag");t.exports=function(e){this.data=o(e),this.vm={exploding:!1},this.getFen=function(){return a.write(this.data.pieces)}.bind(this),this.set=l(i,this.data),this.toggleOrientation=l(r.toggleOrientation,this.data),this.setPieces=l(r.setPieces,this.data),this.selectSquare=l(r.selectSquare,this.data,!0),this.apiMove=l(r.apiMove,this.data),this.playPremove=l(r.playPremove,this.data),this.cancelPremove=l(r.unsetPremove,this.data,!0),this.setCheck=l(r.setCheck,this.data,!0),this.cancelMove=l(function(e){r.cancelMove(e),s.cancel(e)}.bind(this),this.data,!0),this.stop=l(function(e){r.stop(e),s.cancel(e)}.bind(this),this.data,!0),this.explode=function(e){this.data.render&&(this.vm.exploding=e,this.data.renderRAF(),setTimeout(function(){this.vm.exploding=!1,this.data.renderRAF()}.bind(this),200))}.bind(this)}},{"./anim":4,"./board":6,"./configure":7,"./data":9,"./drag":10,"./fen":12}],9:[function(e,t,n){var r=e("./fen"),o=e("./configure");t.exports=function(e){var t={pieces:r.read(r.initial),orientation:"white",turnColor:"white",check:null,lastMove:null,selected:null,coordinates:!0,render:null,renderRAF:null,element:null,bounds:null,autoCastle:!1,viewOnly:!1,minimalDom:!1,disableContextMenu:!1,highlight:{lastMove:!0,check:!0,dragOver:!0},animation:{enabled:!0,duration:200,current:{}},movable:{free:!0,color:"both",dests:{},dropOff:"revert",dropped:[],showDests:!0,events:{after:function(e,t,n){}}},premovable:{enabled:!0,showDests:!0,castle:!0,dests:[],current:null,events:{set:function(e,t){},unset:function(){}}},draggable:{enabled:!0,distance:2,squareTarget:!1,centerPiece:!0,showGhost:!0,current:{}},events:{change:function(){},move:function(e,t,n){},capture:function(e,t){},select:function(e){}},drawable:{enabled:!1,shapes:[],current:{}}};return o(t,e||{}),t}},{"./configure":7,"./fen":12}],10:[function(e,t,n){function r(e){return e?e.color+" "+e.role:""}function o(e,t){if(!(void 0!==t.button&&0!==t.button||t.touches&&t.touches.length>1)){t.stopPropagation(),t.preventDefault(),c=t.target;var n=e.selected,o=d.eventPosition(t),i=e.bounds(),l=u.getKeyAtDomPos(e,o,i),s=!!e.premovable.current;u.selectSquare(e,l);var p=e.selected===l;if(e.pieces[l]&&p&&u.isDraggable(e,l)){var h=e.element.querySelector("."+l).getBoundingClientRect();e.draggable.current={previouslySelected:n,orig:l,piece:r(e.pieces[l]),rel:o,epos:o,pos:[0,0],dec:e.draggable.centerPiece?[o[0]-(h.left+h.width/2),o[1]-(h.top+h.height/2)]:[0,0],bounds:i,started:!1},f.start()}else s&&u.unsetPremove(e);a(e)}}function a(e){d.requestAnimationFrame(function(){var t=e.draggable.current;t.orig&&(e.animation.current.start&&-1!==Object.keys(e.animation.current.anims).indexOf(t.orig)&&(e.animation.current={}),r(e.pieces[t.orig])!==t.piece?s(e):(!t.started&&d.distance(t.epos,t.rel)>=e.draggable.distance&&(t.started=!0),t.started&&(t.pos=[t.epos[0]-t.rel[0],t.epos[1]-t.rel[1]],t.over=u.getKeyAtDomPos(e,t.epos,t.bounds)))),e.render(),t.orig&&a(e)})}function i(e,t){t.touches&&t.touches.length>1||e.draggable.current.orig&&(e.draggable.current.epos=d.eventPosition(t))}function l(e,t){var n,r=e.draggable,o=r.current?r.current.orig:null;o&&(t&&"touchend"===t.type&&c!==t.target||(u.unsetPremove(e),r.current.started?(n=r.current.over,o!==n&&(e.movable.dropped=[o,n]),u.userMove(e,o,n)):r.current.previouslySelected===o&&u.setSelected(e,null),r.current={}))}function s(e){e.draggable.current.orig&&(e.draggable.current={},u.selectSquare(e,null))}var c,u=e("./board"),d=e("./util"),f=e("./hold");t.exports={start:o,move:i,end:l,cancel:s,processDrag:a}},{"./board":6,"./hold":13,"./util":16}],11:[function(e,t,n){function r(e,t){if(!(t.touches&&t.touches.length>1)){t.stopPropagation(),t.preventDefault(),f.cancelMove(e);var n=p.eventPosition(t),r=e.bounds(),a=f.getKeyAtDomPos(e,n,r);e.drawable.current={orig:a,over:a,epos:n,bounds:r},o(e)}}function o(e){p.requestAnimationFrame(function(){var t=e.drawable.current;t.orig&&(t.over=f.getKeyAtDomPos(e,t.epos,t.bounds)),e.render(),t.orig&&o(e)})}function a(e,t){e.drawable.current.orig&&(e.drawable.current.epos=p.eventPosition(t))}function i(e,t){var n=e.drawable,r=n.current.orig,o=n.current.over;r&&o&&(r===o?u(n,r):d(n,r,o),n.current={},e.render())}function l(e){e.drawable.current.orig&&(e.drawable.current={})}function s(e,t){0!==t.button||t.shiftKey||(e.drawable.shapes=[],e.render())}function c(e){return function(t){return!e(t)}}function u(e,t){var n=function(e){return 1===e.length&&e[0]===t},r=e.shapes.filter(n).length>0;r?e.shapes=e.shapes.filter(c(n)):e.shapes.push([t]); +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Chessground=e()}}(function(){var e;return function t(e,n,r){function o(i,s){if(!n[i]){if(!e[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;il;++l){var c=r[l],u=o(c);if("object"===u)for(var d in c){var f=e?a.clone(c[d]):c[d];i[d]=t?n(i[d],f):f}}return i}function o(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var a=function(e){return r(e===!0,!1,arguments)},i="merge";a.recursive=function(e){return r(e===!0,!0,arguments)},a.clone=function(e){var t,n,r=e,i=o(e);if("array"===i)for(r=[],n=e.length,t=0;n>t;++t)r[t]=a.clone(e[t]);else if("object"===i){r={};for(t in e)r[t]=a.clone(e[t])}return r},e?t.exports=a:window[i]=a}("object"==typeof t&&t&&"object"==typeof t.exports&&t.exports)},{}],3:[function(t,n,r){var o=function a(e,t){function n(e){j=e.document,A=e.location,D=e.cancelAnimationFrame||e.clearTimeout,N=e.requestAnimationFrame||e.setTimeout}function r(){var e,t=[].slice.call(arguments),n=!(null==t[1]||F.call(t[1])!==q||"tag"in t[1]||"view"in t[1]||"subtree"in t[1]),r=n?t[1]:{},o="class"in r?"class":"className",a={tag:"div",attrs:{}},i=[];if(F.call(t[0])!=R)throw new Error("selector in m(selector, attrs, children) should be a string");for(;e=K.exec(t[0]);)if(""===e[1]&&e[2])a.tag=e[2];else if("#"===e[1])a.attrs.id=e[2];else if("."===e[1])i.push(e[2]);else if("["===e[3][0]){var s=B.exec(e[3]);a.attrs[s[1]]=s[3]||(s[2]?"":!0)}var l=t.slice(n?2:1);a.children=1===l.length&&F.call(l[0])===S?l[0]:l;for(var c in r)r.hasOwnProperty(c)&&(c===o&&null!=r[c]&&""!==r[c]?(i.push(r[c]),a.attrs[c]=""):a.attrs[c]=r[c]);return i.length>0&&(a.attrs[o]=i.join(" ")),a}function o(e,n,a,c,d,f,p,h,v,g,m){try{(null==d||null==d.toString())&&(d="")}catch(b){d=""}if("retain"===d.subtree)return f;var y=F.call(f),w=F.call(d);if(null==f||y!==w){if(null!=f)if(a&&a.nodes){var k=h-c,x=k+(w===S?d:f.nodes).length;l(a.nodes.slice(k,x),a.slice(k,x))}else f.nodes&&l(f.nodes,f);f=new d.constructor,f.tag&&(f={}),f.nodes=[]}if(w===S){for(var E=0,C=d.length;C>E;E++)F.call(d[E])===S&&(d=d.concat.apply([],d),E--,C=d.length);for(var O=[],M=f.length===d.length,P=0,T=1,A=2,N=3,D={},K=!1,E=0;EE;E++)if(d[E]&&d[E].attrs&&null!=d[E].attrs.key){for(var U=0,C=d.length;C>U;U++)d[U]&&d[U].attrs&&null==d[U].attrs.key&&(d[U].attrs.key="__mithril__"+B++);break}if(K){var X=!1;if(d.length!=f.length)X=!0;else for(var z,H,E=0;z=f[E],H=d[E];E++)if(z.attrs&&H.attrs&&z.attrs.key!=H.attrs.key){X=!0;break}if(X){for(var E=0,C=d.length;C>E;E++)if(d[E]&&d[E].attrs&&null!=d[E].attrs.key){var _=d[E].attrs.key;D[_]=D[_]?{action:N,index:E,from:D[_].index,element:f.nodes[D[_].index]||j.createElement("div")}:{action:A,index:E}}var G=[];for(var J in D)G.push(D[J]);var Y=G.sort(i),V=new Array(f.length);V.nodes=f.nodes.slice();for(var Q,E=0;Q=Y[E];E++){if(Q.action===T&&(l(f[Q.index].nodes,f[Q.index]),V.splice(Q.index,1)),Q.action===A){var W=j.createElement("div");W.key=d[Q.index].attrs.key,e.insertBefore(W,e.childNodes[Q.index]||null),V.splice(Q.index,0,{attrs:{key:d[Q.index].attrs.key},nodes:[W]}),V.nodes[Q.index]=W}Q.action===N&&(e.childNodes[Q.index]!==Q.element&&null!==Q.element&&e.insertBefore(Q.element,e.childNodes[Q.index]||null),V[Q.index]=f[Q.from],V.nodes[Q.index]=Q.element)}f=V}}for(var E=0,Z=0,C=d.length;C>E;E++){var te=o(e,n,f,h,d[E],f[Z],p,h+P||P,v,g,m);te!==t&&(te.nodes.intact||(M=!1),P+=te.$trusted?(te.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:F.call(te)===S?te.length:1,f[Z++]=te)}if(!M){for(var E=0,C=d.length;C>E;E++)null!=f[E]&&O.push.apply(O,f[E].nodes);for(var ne,E=0;ne=f.nodes[E];E++)null!=ne.parentNode&&O.indexOf(ne)<0&&l([ne],[f[E]]);d.length-1?f.controllers[se]:new(d.controller||$),_=d&&d.attrs&&d.attrs.key;if(d=0==re||f&&f.controllers&&f.controllers.indexOf(le)>-1?d.view(le):{tag:"placeholder"},"retain"===d.subtree)return f;_&&(d.attrs||(d.attrs={}),d.attrs.key=_),le.onunload&&ee.push({controller:le,handler:le.onunload}),oe.push(ie),ae.push(le)}if(!d.tag&&ae.length)throw new Error("Component template must return a virtual element, not an array, string, etc.");d.attrs||(d.attrs={}),f.attrs||(f.attrs={});var ce=Object.keys(d.attrs),ue=ce.length>("key"in d.attrs?1:0);if((d.tag!=f.tag||ce.sort().join()!=Object.keys(f.attrs).sort().join()||d.attrs.id!=f.attrs.id||d.attrs.key!=f.attrs.key||"all"==r.redraw.strategy()&&(!f.configContext||f.configContext.retain!==!0)||"diff"==r.redraw.strategy()&&f.configContext&&f.configContext.retain===!1)&&(f.nodes.length&&l(f.nodes),f.configContext&&typeof f.configContext.onunload===L&&f.configContext.onunload(),f.controllers))for(var le,E=0;le=f.controllers[E];E++)typeof le.onunload===L&&le.onunload({preventDefault:$});if(F.call(d.tag)!=R)return;var ne,de=0===f.nodes.length;if(d.attrs.xmlns?g=d.attrs.xmlns:"svg"===d.tag?g="http://www.w3.org/2000/svg":"math"===d.tag&&(g="http://www.w3.org/1998/Math/MathML"),de){if(ne=d.attrs.is?g===t?j.createElement(d.tag,d.attrs.is):j.createElementNS(g,d.tag,d.attrs.is):g===t?j.createElement(d.tag):j.createElementNS(g,d.tag),f={tag:d.tag,attrs:ue?s(ne,d.tag,d.attrs,{},g):d.attrs,children:null!=d.children&&d.children.length>0?o(ne,d.tag,t,t,d.children,f.children,!0,0,d.attrs.contenteditable?ne:v,g,m):d.children,nodes:[ne]},ae.length){f.views=oe,f.controllers=ae;for(var le,E=0;le=ae[E];E++)if(le.onunload&&le.onunload.$old&&(le.onunload=le.onunload.$old),re&&le.onunload){var fe=le.onunload;le.onunload=$,le.onunload.$old=fe}}f.children&&!f.children.nodes&&(f.children.nodes=[]),"select"===d.tag&&"value"in d.attrs&&s(ne,d.tag,{value:d.attrs.value},{},g),e.insertBefore(ne,e.childNodes[h]||null)}else ne=f.nodes[0],ue&&s(ne,d.tag,d.attrs,f.attrs,g),f.children=o(ne,d.tag,t,t,d.children,f.children,!1,0,d.attrs.contenteditable?ne:v,g,m),f.nodes.intact=!0,ae.length&&(f.views=oe,f.controllers=ae),p===!0&&null!=ne&&e.insertBefore(ne,e.childNodes[h]||null);if(typeof d.attrs.config===L){var pe=f.configContext=f.configContext||{},he=function(e,t){return function(){return e.attrs.config.apply(e,t)}};m.push(he(d,[ne,!de,pe,f]))}}else if(typeof d!=L){var O;0===f.nodes.length?(d.$trusted?O=u(e,h,d):(O=[j.createTextNode(d)],e.nodeName.match(I)||e.insertBefore(O[0],e.childNodes[h]||null)),f="string number boolean".indexOf(typeof d)>-1?new d.constructor(d):d,f.nodes=O):f.valueOf()!==d.valueOf()||p===!0?(O=f.nodes,v&&v===j.activeElement||(d.$trusted?(l(O,f),O=u(e,h,d)):"textarea"===n?e.value=d:v?v.innerHTML=d:((1===O[0].nodeType||O.length>1)&&(l(f.nodes,f),O=[j.createTextNode(d)]),e.insertBefore(O[0],e.childNodes[h]||null),O[0].nodeValue=d)),f=new d.constructor(d),f.nodes=O):f.nodes.intact=!0}return f}function i(e,t){return e.action-t.action||e.index-t.index}function s(e,t,n,r,o){for(var a in n){var i=n[a],s=r[a];if(a in r&&s===i)"value"===a&&"input"===t&&e.value!=i&&(e.value=i);else{r[a]=i;try{if("config"===a||"key"==a)continue;if(typeof i===L&&0===a.indexOf("on"))e[a]=d(i,e);else if("style"===a&&null!=i&&F.call(i)===q){for(var l in i)(null==s||s[l]!==i[l])&&(e.style[l]=i[l]);for(var l in s)l in i||(e.style[l]="")}else null!=o?"href"===a?e.setAttributeNS("http://www.w3.org/1999/xlink","href",i):"className"===a?e.setAttribute("class",i):e.setAttribute(a,i):a in e&&"list"!==a&&"style"!==a&&"form"!==a&&"type"!==a&&"width"!==a&&"height"!==a?("input"!==t||e[a]!==i)&&(e[a]=i):e.setAttribute(a,i)}catch(c){if(c.message.indexOf("Invalid argument")<0)throw c}}}return r}function l(e,t){for(var n=e.length-1;n>-1;n--)if(e[n]&&e[n].parentNode){try{e[n].parentNode.removeChild(e[n])}catch(r){}t=[].concat(t),t[n]&&c(t[n])}0!=e.length&&(e.length=0)}function c(e){if(e.configContext&&typeof e.configContext.onunload===L&&(e.configContext.onunload(),e.configContext.onunload=null),e.controllers)for(var t,n=0;t=e.controllers[n];n++)typeof t.onunload===L&&t.onunload({preventDefault:$});if(e.children)if(F.call(e.children)===S)for(var r,n=0;r=e.children[n];n++)c(r);else e.children.tag&&c(e.children)}function u(e,t,n){var r=e.childNodes[t];if(r){var o=1!=r.nodeType,a=j.createElement("span");o?(e.insertBefore(a,r||null),a.insertAdjacentHTML("beforebegin",n),e.removeChild(a)):r.insertAdjacentHTML("beforebegin",n)}else e.insertAdjacentHTML("beforeend",n);for(var i=[];e.childNodes[t]!==r;)i.push(e.childNodes[t]),t++;return i}function d(e,t){return function(n){n=n||event,r.redraw.strategy("diff"),r.startComputation();try{return e.call(t,n)}finally{oe()}}}function f(e){var t=z.indexOf(e);return 0>t?z.push(e)-1:t}function p(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t}function h(e,t){var n=function(){return(e.controller||$).apply(this,t)||this},r=function(n){return arguments.length>1&&(t=t.concat([].slice.call(arguments,1))),e.view.apply(e,t?[n].concat(t):[n])};r.$original=e.view;var o={controller:n,view:r};return t[0]&&null!=t[0].key&&(o.attrs={key:t[0].key}),o}function v(){W&&(W(),W=null);for(var e,t=0;e=G[t];t++)if(Y[t]){var n=J[t].controller&&J[t].controller.$$args?[Y[t]].concat(J[t].controller.$$args):[Y[t]];r.render(e,J[t].view?J[t].view(Y[t],n):"")}Z&&(Z(),Z=null),V=null,Q=new Date,r.redraw.strategy("diff")}function g(e){return e.slice(se[r.route.mode].length)}function m(e,t,n){ae={};var o=n.indexOf("?");-1!==o&&(ae=k(n.substr(o+1,n.length)),n=n.substr(0,o));var a=Object.keys(t),i=a.indexOf(n);if(-1!==i)return r.mount(e,t[a[i]]),!0;for(var s in t){if(s===n)return r.mount(e,t[s]),!0;var l=new RegExp("^"+s.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(l.test(n))return n.replace(l,function(){for(var n=s.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),a=0,i=n.length;i>a;a++)ae[n[a].replace(/:|\./g,"")]=decodeURIComponent(o[a]);r.mount(e,t[s])}),!0}}function b(e){if(e=e||event,!e.ctrlKey&&!e.metaKey&&2!==e.which){e.preventDefault?e.preventDefault():e.returnValue=!1;for(var t=e.currentTarget||e.srcElement,n="pathname"===r.route.mode&&t.search?k(t.search.slice(1)):{};t&&"A"!=t.nodeName.toUpperCase();)t=t.parentNode;r.route(t[r.route.mode].slice(se[r.route.mode].length),n)}}function y(){"hash"!=r.route.mode&&A.hash?A.hash=A.hash:e.scrollTo(0,0)}function w(e,n){var r={},o=[];for(var a in e){var i=n?n+"["+a+"]":a,s=e[a],l=F.call(s),c=null===s?encodeURIComponent(i):l===q?w(s,i):l===S?s.reduce(function(e,t){return r[i]||(r[i]={}),r[i][t]?e:(r[i][t]=!0,e.concat(encodeURIComponent(i)+"="+encodeURIComponent(t)))},[]).join("&"):encodeURIComponent(i)+"="+encodeURIComponent(s);s!==t&&o.push(c)}return o.join("&")}function k(e){"?"===e.charAt(0)&&(e=e.substring(1));for(var t=e.split("&"),n={},r=0,o=t.length;o>r;r++){var a=t[r].split("="),i=decodeURIComponent(a[0]),s=2==a.length?decodeURIComponent(a[1]):null;null!=n[i]?(F.call(n[i])!==S&&(n[i]=[n[i]]),n[i].push(s)):n[i]=s}return n}function x(e){var n=f(e);l(e.childNodes,H[n]),H[n]=t}function E(e,t){var n=r.prop(t);return e.then(n),n.then=function(n,r){return E(e.then(n,r),t)},n}function C(e,t){function n(e){d=e||c,p.map(function(e){d===l&&e.resolve(f)||e.reject(f)})}function o(e,t,n,o){if((null!=f&&F.call(f)===q||typeof f===L)&&typeof e===L)try{var a=0;e.call(f,function(e){a++||(f=e,t())},function(e){a++||(f=e,n())})}catch(i){r.deferred.onerror(i),f=i,n()}else o()}function a(){var c;try{c=f&&f.then}catch(p){return r.deferred.onerror(p),f=p,d=s,a()}o(c,function(){d=i,a()},function(){d=s,a()},function(){try{d===i&&typeof e===L?f=e(f):d===s&&"function"==typeof t&&(f=t(f),d=i)}catch(a){return r.deferred.onerror(a),f=a,n()}f===u?(f=TypeError(),n()):o(c,function(){n(l)},n,function(){n(d===i&&l)})})}var i=1,s=2,l=3,c=4,u=this,d=0,f=0,p=[];u.promise={},u.resolve=function(e){return d||(f=e,d=i,a()),this},u.reject=function(e){return d||(f=e,d=s,a()),this},u.promise.then=function(e,t){var n=new C(e,t);return d===l?n.resolve(f):d===c?n.reject(f):p.push(n),n.promise}}function O(e){return e}function M(n){if(!n.dataType||"jsonp"!==n.dataType.toLowerCase()){var r=new e.XMLHttpRequest;if(r.open(n.method,n.url,!0,n.user,n.password),r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300?n.onload({type:"load",target:r}):n.onerror({type:"error",target:r}))},n.serialize===JSON.stringify&&n.data&&"GET"!==n.method&&r.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.deserialize===JSON.parse&&r.setRequestHeader("Accept","application/json, text/*"),typeof n.config===L){var o=n.config(r,n);null!=o&&(r=o)}var a="GET"!==n.method&&n.data?n.data:"";if(a&&F.call(a)!=R&&a.constructor!=e.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return r.send(a),r}var i="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),s=j.createElement("script");e[i]=function(r){s.parentNode.removeChild(s),n.onload({type:"load",target:{responseText:r}}),e[i]=t},s.onerror=function(r){return s.parentNode.removeChild(s),n.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),e[i]=t,!1},s.onload=function(e){return!1},s.src=n.url+(n.url.indexOf("?")>0?"&":"?")+(n.callbackKey?n.callbackKey:"callback")+"="+i+"&"+w(n.data||{}),j.body.appendChild(s)}function P(e,t,n){if("GET"===e.method&&"jsonp"!=e.dataType){var r=e.url.indexOf("?")<0?"?":"&",o=w(t);e.url=e.url+(o?r+o:"")}else e.data=n(t);return e}function T(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;ru;u++)a[u]()},r.trust=function(e){return e=new String(e),e.$trusted=!0,e},r.prop=function(e){return(null!=e&&F.call(e)===q||typeof e===L)&&typeof e.then===L?E(e):p(e)};var _,G=[],J=[],Y=[],V=null,Q=0,W=null,Z=null,ee=[],te=16;r.component=function(e){return h(e,[].slice.call(arguments,1))},r.mount=r.module=function(e,t){if(!e)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var n=G.indexOf(e);0>n&&(n=G.length);for(var o,a=!1,i={preventDefault:function(){a=!0,W=Z=null}},s=0;o=ee[s];s++)o.handler.call(o.controller,i),o.controller.onunload=null;if(a)for(var o,s=0;o=ee[s];s++)o.controller.onunload=o.handler;else ee=[];if(Y[n]&&typeof Y[n].onunload===L&&Y[n].onunload(i),!a){r.redraw.strategy("all"),r.startComputation(),G[n]=e,arguments.length>2&&(t=subcomponent(t,[].slice.call(arguments,2)));var l=_=t=t||{controller:function(){}},c=t.controller||$,u=new c;return l===_&&(Y[n]=u,J[n]=t),oe(),Y[n]}};var ne=!1;r.redraw=function(t){ne||(ne=!0,V&&t!==!0?(N===e.requestAnimationFrame||new Date-Q>te)&&(V>0&&D(V),V=N(v,te)):(v(),V=N(function(){V=null},te)),ne=!1)},r.redraw.strategy=r.prop();var re=0;r.startComputation=function(){re++},r.endComputation=function(){re=Math.max(re-1,0),0===re&&r.redraw()};var oe=function(){"none"==r.redraw.strategy()?(re--,r.redraw.strategy("diff")):r.endComputation()};r.withAttr=function(e,t){return function(n){n=n||event;var r=n.currentTarget||this;t(e in r?r[e]:r.getAttribute(e))}};var ae,ie,se={pathname:"",hash:"#",search:"?"},le=$,ce=!1;return r.route=function(){if(0===arguments.length)return ie;if(3===arguments.length&&F.call(arguments[1])===R){var t=arguments[0],n=arguments[1],o=arguments[2];le=function(e){var a=ie=g(e);if(!m(t,o,a)){if(ce)throw new Error("Ensure the default route matches one of the routes defined in m.route");ce=!0,r.route(n,!0),ce=!1}};var a="hash"===r.route.mode?"onhashchange":"onpopstate";e[a]=function(){var e=A[r.route.mode];"pathname"===r.route.mode&&(e+=A.search),ie!=g(e)&&le(e)},W=y,e[a]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){var i=arguments[0],s=(arguments[1],arguments[2],arguments[3]);i.href=("pathname"!==r.route.mode?A.pathname:"")+se[r.route.mode]+s.attrs.href,i.addEventListener?(i.removeEventListener("click",b),i.addEventListener("click",b)):(i.detachEvent("onclick",b),i.attachEvent("onclick",b))}else if(F.call(arguments[0])===R){var l=ie;ie=arguments[0];var c=arguments[1]||{},u=ie.indexOf("?"),d=u>-1?k(ie.slice(u+1)):{};for(var f in c)d[f]=c[f];var p=w(d),h=u>-1?ie.slice(0,u):ie;p&&(ie=h+(-1===h.indexOf("?")?"?":"&")+p);var v=(3===arguments.length?arguments[2]:arguments[1])===!0||l===arguments[0];e.history.pushState?(W=y,Z=function(){e.history[v?"replaceState":"pushState"](null,j.title,se[r.route.mode]+ie)},le(se[r.route.mode]+ie)):(A[r.route.mode]=ie,le(se[r.route.mode]+ie))}},r.route.param=function(e){if(!ae)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return ae[e]},r.route.mode="search",r.route.buildQueryString=w,r.route.parseQueryString=k,r.deferred=function(){var e=new C;return e.promise=E(e.promise),e},r.deferred.onerror=function(e){if("[object Error]"===F.call(e)&&!e.constructor.toString().match(/ Error/))throw e},r.sync=function(e){function t(e,t){return function(r){return i[e]=r,t||(n="reject"),0===--a&&(o.promise(i),o[n](i)),r}}var n="resolve",o=r.deferred(),a=e.length,i=new Array(a);if(e.length>0)for(var s=0;s=t)e.animation.current={},e.render();else{var n=d.easeInOutCubic(t);for(var r in e.animation.current.anims){var o=e.animation.current.anims[r];o[1]=[s(o[0][0]*n,10),s(o[0][1]*n,10)]}for(var a in e.animation.current.fadings)e.animation.current.fadings[a].opacity=s(n,100);e.render(),u.requestAnimationFrame(function(){l(e)})}}}function c(e,t){var n={orientation:t.orientation,pieces:{}};for(var r in t.pieces)n.pieces[r]={role:t.pieces[r].role,color:t.pieces[r].color};var o=e(),a=i(n,t);if(Object.keys(a.anims).length>0||a.fadings.length>0){var s=t.animation.current.start;t.animation.current={start:(new Date).getTime(),duration:t.animation.duration,anims:a.anims,fadings:a.fadings},s||l(t)}else t.renderRAF();return o}var u=e("./util"),d={easeInOutCubic:function(e){return.5>e?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1}};t.exports=function(e,t,n){return function(){var r=[t].concat(Array.prototype.slice.call(arguments,0));if(t.render){if(t.animation.enabled&&!n)return c(u.partialApply(e,r),t);var o=e.apply(null,r);return t.renderRAF(),o}return e.apply(null,r)}}},{"./util":16}],5:[function(e,t,n){var r=e("./board");t.exports=function(e){return{set:e.set,toggleOrientation:e.toggleOrientation,getOrientation:function(){return e.data.orientation},getPieces:function(){return e.data.pieces},getMaterialDiff:function(){return r.getMaterialDiff(e.data)},getFen:e.getFen,dump:function(){return e.data},move:e.apiMove,setPieces:e.setPieces,setCheck:e.setCheck,playPremove:e.playPremove,cancelPremove:e.cancelPremove,cancelMove:e.cancelMove,stop:e.stop,explode:e.explode}}},{"./board":6}],6:[function(e,t,n){function r(e){setTimeout(e,1)}function o(e){e.orientation=P.opposite(e.orientation)}function a(e){e.lastMove=null,g(e,null),c(e)}function i(e,t){Object.keys(t).forEach(function(n){t[n]?e.pieces[n]=t[n]:delete e.pieces[n]}),e.movable.dropped=[]}function s(e,t){var n=t||e.turnColor;Object.keys(e.pieces).forEach(function(t){e.pieces[t].color===n&&"king"===e.pieces[t].role&&(e.check=t)})}function l(e,t,n){e.premovable.current=[t,n],r(P.partial(e.premovable.events.set,t,n))}function c(e){e.premovable.current&&(e.premovable.current=null,r(e.premovable.events.unset))}function u(e,t,n){if(e.autoCastle){var r=e.pieces[n];if("king"===r.role){var o=P.key2pos(t);if(5===o[0]&&(1===o[1]||8===o[1])){var a,i,s,l=P.key2pos(n);if(7===l[0]||8===l[0])a=P.pos2key([8,o[1]]),i=P.pos2key([6,o[1]]),s=P.pos2key([7,o[1]]);else{if(3!==l[0]&&1!==l[0])return;a=P.pos2key([1,o[1]]),i=P.pos2key([4,o[1]]),s=P.pos2key([3,o[1]])}delete e.pieces[t],delete e.pieces[n],delete e.pieces[a],e.pieces[s]={role:"king",color:r.color},e.pieces[i]={role:"rook",color:r.color}}}}}function d(e,t,n){var o=j(function(){if(t===n||!e.pieces[t])return!1;var o=e.pieces[n]&&e.pieces[n].color!==e.pieces[t].color?e.pieces[n]:null;return r(P.partial(e.events.move,t,n,o)),e.pieces[n]=e.pieces[t],delete e.pieces[t],e.lastMove=[t,n],e.check=null,u(e,t,n),r(e.events.change),!0},e)();return o&&(e.movable.dropped=[]),o}function f(e,t,n){var r=d(e,t,n);return r&&(e.movable.dests={},e.turnColor=P.opposite(e.turnColor)),r}function p(e,t,n){return d(e,t,n)}function h(e,t,n){if(n)if(b(e,t,n)){if(f(e,t,n)){var o=A.stop();return g(e,null),r(P.partial(e.movable.events.after,t,n,{premove:!1,holdTime:o})),!0}}else w(e,t,n)?(l(e,t,n),g(e,null)):m(e,n)||y(e,n)?(g(e,n),A.start()):g(e,null);else A.cancel(),g(e,null),"trash"===e.movable.dropOff&&(delete e.pieces[t],r(e.events.change))}function v(e,t){e.selected?t?e.selected!==t?h(e,e.selected,t)&&(e.stats.dragged=!1):A.start():(g(e,null),A.cancel()):(m(e,t)||y(e,t))&&(g(e,t),A.start()),t&&r(P.partial(e.events.select,t))}function g(e,t){e.selected=t,e.premovable.dests=t&&y(e,t)?T(e.pieces,t,e.premovable.castle):null}function m(e,t){var n=e.pieces[t];return n&&("both"===e.movable.color||e.movable.color===n.color&&e.turnColor===n.color)}function b(e,t,n){return t!==n&&m(e,t)&&(e.movable.free||P.containsX(e.movable.dests[t],n))}function y(e,t){var n=e.pieces[t];return n&&e.premovable.enabled&&e.movable.color===n.color&&e.turnColor!==n.color}function w(e,t,n){return t!==n&&y(e,t)&&P.containsX(T(e.pieces,t,e.premovable.castle),n)}function k(e,t){var n=e.pieces[t];return n&&e.draggable.enabled&&("both"===e.movable.color||e.movable.color===n.color&&(e.turnColor===n.color||e.premovable.enabled))}function x(e){var t=e.premovable.current;if(t){var n=t[0],o=t[1];b(e,n,o)&&f(e,n,o)&&r(P.partial(e.movable.events.after,n,o,{premove:!0})),c(e)}}function E(e){c(e),v(e,null)}function C(e){e.movable.color=null,e.movable.dests={},E(e)}function O(e,t,n){if(n||e.bounds){n=n||e.bounds();var r=Math.ceil(8*((t[0]-n.left)/n.width));r="white"===e.orientation?r:9-r;var o=Math.ceil(8-8*((t[1]-n.top)/n.height));return o="white"===e.orientation?o:9-o,r>0&&9>r&&o>0&&9>o?P.pos2key([r,o]):void 0}}function M(e){var t={king:0,queen:0,rook:0,bishop:0,knight:0,pawn:0};for(var n in e.pieces){var r=e.pieces[n];t[r.role]+="white"===r.color?1:-1}var o={white:{},black:{}};for(var a in t){var i=t[a];i>0?o.white[a]=i:0>i&&(o.black[a]=-i)}return o}var P=e("./util"),T=e("./premove"),j=e("./anim"),A=e("./hold");t.exports={reset:a,toggleOrientation:o,setPieces:i,setCheck:s,selectSquare:v,setSelected:g,isDraggable:k,canMove:b,userMove:h,apiMove:p,playPremove:x,unsetPremove:c,cancelMove:E,stop:C,getKeyAtDomPos:O,getMaterialDiff:M}},{"./anim":4,"./hold":13,"./premove":14,"./util":16}],7:[function(e,t,n){var r=e("merge"),o=e("./board"),a=e("./fen");t.exports=function(e,t){t&&(t.movable&&t.movable.dests&&delete e.movable.dests,r.recursive(e,t),e.fen&&(e.pieces=a.read(e.fen),e.check=t.check,e.drawable.shapes=[],delete e.fen),e.check===!0&&o.setCheck(e),e.movable.dropped=[],e.selected&&o.setSelected(e,e.selected),(!e.animation.duration||e.animation.duration<10)&&(e.animation.enabled=!1))}},{"./board":6,"./fen":12,merge:2}],8:[function(e,t,n){var r=e("./board"),o=e("./data"),a=e("./fen"),i=e("./configure"),s=e("./anim"),l=e("./drag");t.exports=function(e){this.data=o(e),this.vm={exploding:!1},this.getFen=function(){return a.write(this.data.pieces)}.bind(this),this.set=s(i,this.data),this.toggleOrientation=s(r.toggleOrientation,this.data),this.setPieces=s(r.setPieces,this.data),this.selectSquare=s(r.selectSquare,this.data,!0),this.apiMove=s(r.apiMove,this.data),this.playPremove=s(r.playPremove,this.data),this.cancelPremove=s(r.unsetPremove,this.data,!0),this.setCheck=s(r.setCheck,this.data,!0),this.cancelMove=s(function(e){r.cancelMove(e),l.cancel(e)}.bind(this),this.data,!0),this.stop=s(function(e){r.stop(e),l.cancel(e)}.bind(this),this.data,!0),this.explode=function(e){this.data.render&&(this.vm.exploding=e,this.data.renderRAF(),setTimeout(function(){this.vm.exploding=!1,this.data.renderRAF()}.bind(this),200))}.bind(this)}},{"./anim":4,"./board":6,"./configure":7,"./data":9,"./drag":10,"./fen":12}],9:[function(e,t,n){var r=e("./fen"),o=e("./configure");t.exports=function(e){var t={pieces:r.read(r.initial),orientation:"white",turnColor:"white",check:null,lastMove:null,selected:null,coordinates:!0,render:null,renderRAF:null,element:null,bounds:null,autoCastle:!1,viewOnly:!1,minimalDom:!1,disableContextMenu:!1,highlight:{lastMove:!0,check:!0,dragOver:!0},animation:{enabled:!0,duration:200,current:{}},movable:{free:!0,color:"both",dests:{},dropOff:"revert",dropped:[],showDests:!0,events:{after:function(e,t,n){}}},premovable:{enabled:!0,showDests:!0,castle:!0,dests:[],current:null,events:{set:function(e,t){},unset:function(){}}},draggable:{enabled:!0,distance:3,squareTarget:!1,centerPiece:!0,showGhost:!0,current:{}},stats:{dragged:!0},events:{change:function(){},move:function(e,t,n){},capture:function(e,t){},select:function(e){}},drawable:{enabled:!1,shapes:[],current:{}}};return o(t,e||{}),t}},{"./configure":7,"./fen":12}],10:[function(e,t,n){function r(e){return e?e.color+e.role:""}function o(e,t){if(!(void 0!==t.button&&0!==t.button||t.touches&&t.touches.length>1)){t.stopPropagation(),t.preventDefault(),c=t.target;var n=e.selected,o=d.eventPosition(t),i=e.bounds(),s=u.getKeyAtDomPos(e,o,i),l=!!e.premovable.current;u.selectSquare(e,s);var f=e.selected===s;if(e.pieces[s]&&f&&u.isDraggable(e,s)){var p=e.element.querySelector("."+s).getBoundingClientRect();e.draggable.current={previouslySelected:n,orig:s,piece:r(e.pieces[s]),rel:o,epos:o,pos:[0,0],dec:e.draggable.centerPiece?[o[0]-(p.left+p.width/2),o[1]-(p.top+p.height/2)]:[0,0],bounds:i,started:e.stats.dragged}}else l&&u.unsetPremove(e);a(e)}}function a(e){d.requestAnimationFrame(function(){var t=e.draggable.current;t.orig&&(e.animation.current.start&&e.animation.current.anims[t.orig]&&(e.animation.current={}),r(e.pieces[t.orig])!==t.piece?l(e):(!t.started&&d.distance(t.epos,t.rel)>=e.draggable.distance&&(t.started=!0),t.started&&(t.pos=[t.epos[0]-t.rel[0],t.epos[1]-t.rel[1]],t.over=u.getKeyAtDomPos(e,t.epos,t.bounds)))),e.render(),t.orig&&a(e)})}function i(e,t){t.touches&&t.touches.length>1||e.draggable.current.orig&&(e.draggable.current.epos=d.eventPosition(t))}function s(e,t){var n,r=e.draggable,o=r.current?r.current.orig:null;o&&(t&&"touchend"===t.type&&c!==t.target||(u.unsetPremove(e),r.current.started?(n=r.current.over,o!==n&&(e.movable.dropped=[o,n]),u.userMove(e,o,n)&&(e.stats.dragged=!0)):r.current.previouslySelected===o&&u.setSelected(e,null),r.current={}))}function l(e){e.draggable.current.orig&&(e.draggable.current={},u.selectSquare(e,null))}var c,u=e("./board"),d=e("./util");t.exports={start:o,move:i,end:s,cancel:l,processDrag:a}},{"./board":6,"./util":16}],11:[function(e,t,n){function r(e,t){if(!(t.touches&&t.touches.length>1)){t.stopPropagation(),t.preventDefault(),f.cancelMove(e);var n=p.eventPosition(t),r=e.bounds(),a=f.getKeyAtDomPos(e,n,r);e.drawable.current={orig:a,over:a,epos:n,bounds:r},o(e)}}function o(e){p.requestAnimationFrame(function(){var t=e.drawable.current;t.orig&&(t.over=f.getKeyAtDomPos(e,t.epos,t.bounds)),e.render(),t.orig&&o(e)})}function a(e,t){e.drawable.current.orig&&(e.drawable.current.epos=p.eventPosition(t))}function i(e,t){var n=e.drawable,r=n.current.orig,o=n.current.over;r&&o&&(r===o?u(n,r):d(n,r,o),n.current={},e.render())}function s(e){e.drawable.current.orig&&(e.drawable.current={})}function l(e,t){0!==t.button||t.shiftKey||(e.drawable.shapes=[],e.render())}function c(e){return function(t){return!e(t); -}function d(e,t,n){var r=function(e){return 2===e.length&&(e[0]===t&&e[1]===n||e[1]===t&&e[0]===n)},o=e.shapes.filter(r).length>0;o?e.shapes=e.shapes.filter(c(r)):e.shapes.push([t,n])}var f=e("./board"),p=e("./util");t.exports={start:r,move:a,end:i,cancel:l,clear:s,processDraw:o}},{"./board":6,"./util":16}],12:[function(e,t,n){function r(e){"start"===e&&(e=i);var t={};return e.replace(/ .+$/,"").split("/").forEach(function(e,n){var r=0;e.split("").forEach(function(e){var o=parseInt(e);o?r+=o:(r++,t[a.pos2key([r,8-n])]={role:l[e.toLowerCase()],color:e===e.toLowerCase()?"black":"white"})})}),t}function o(e){return[8,7,6,5,4,3,2].reduce(function(e,t){return e.replace(new RegExp(Array(t+1).join("1"),"g"),t)},a.invRanks.map(function(t){return a.ranks.map(function(n){var r=e[a.pos2key([n,t])];if(r){var o=s[r.role];return"white"===r.color?o.toUpperCase():o}return"1"}).join("")}).join("/"))}var a=e("./util"),i="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",l={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},s={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};t.exports={initial:i,read:r,write:o}},{"./util":16}],13:[function(e,t,n){var r,o=function(){r=new Date},a=function(){r=null},i=function(){if(!r)return 0;var e=new Date-r;return r=null,e};t.exports={start:o,cancel:a,stop:i}},{}],14:[function(e,t,n){function r(e,t){return Math.abs(e-t)}function o(e,t,n,o,a){return r(t,o)<2&&("white"===e?a===n+1||2>=n&&a===n+2&&t===o:a===n-1||n>=7&&a===n-2&&t===o)}function a(e,t,n,o){var a=r(e,n),i=r(t,o);return 1===a&&2===i||2===a&&1===i}function i(e,t,n,o){return r(e,n)===r(t,o)}function l(e,t,n,r){return e===n||t===r}function s(e,t,n,r){return i(e,t,n,r)||l(e,t,n,r)}function c(e,t,n,o,a,i,l){return r(o,i)<2&&r(a,l)<2||n&&a===l&&a===("white"===e?1:8)&&(5===o&&(3===i||7===i)||f.containsX(t,i))}function u(e,t){return Object.keys(e).filter(function(n){var r=e[n];return r&&r.color===t&&"rook"===r.role}).map(function(e){return f.key2pos(e)[0]})}function d(e,t,n){var r,d=e[t],p=f.key2pos(t);switch(d.role){case"pawn":r=o.bind(null,d.color);break;case"knight":r=a;break;case"bishop":r=i;break;case"rook":r=l;break;case"queen":r=s;break;case"king":r=c.bind(null,d.color,u(e,d.color),n)}return f.allPos.filter(function(e){return(p[0]!==e[0]||p[1]!==e[1])&&r(p[0],p[1],e[0],e[1])}).map(f.pos2key)}var f=e("./util");t.exports=d},{"./util":16}],15:[function(e,t,n){function r(e){return(e?2:4)/512*p.width}function o(e){return(e?7:10)/512*p.width}function a(e){return e?.5:1}function i(){return 24/512*p.width}function l(e){var t=p.width/8;return[(e[0]-.5)*t,(8.5-e[1])*t]}function s(e,t){var n=l(e),o=r(t),i=p.width/16;return{tag:"circle",attrs:{stroke:g,"stroke-width":o,fill:"none",opacity:a(t),cx:n[0],cy:n[1],r:i-o/2}}}function c(e,t,n){var r=i(),s=l(e),c=l(t),u=c[0]-s[0],d=c[1]-s[1],f=Math.atan2(d,u),p=Math.cos(f)*r,h=Math.sin(f)*r;return{tag:"line",attrs:{stroke:g,"stroke-width":o(n),"stroke-linecap":"round","marker-end":"url(#arrowhead)",opacity:a(n),x1:s[0],y1:s[1],x2:c[0]-p,y2:c[1]-h}}}function u(e,t){return"white"===t?e:[9-e[0],9-e[1]]}function d(e){return function(t){return t.map(function(t){return u(v(t),e)})}}function f(e){var t=e.drawable.current;if(t.orig&&t.over){var n=d(e.orientation)(t.orig===t.over?[t.orig]:[t.orig,t.over]);return 1===n.length?s(n[0],!0):c(n[0],n[1],!0)}}var p,h=e("mithril"),v=e("./util").key2pos,g="#008800",m=h("defs",h("marker",{id:"arrowhead",orient:"auto",markerWidth:4,markerHeight:8,refX:2.05,refY:2.01},h("path",{d:"M0,0 V4 L3,2 Z",fill:g})));t.exports=function(e){if(e.data.bounds){var t=e.data.drawable.shapes.map(d(e.data.orientation));if((t.length||e.data.drawable.current.orig)&&(p||(p=e.data.bounds()),p.width===p.height))return{tag:"svg",children:[m,t.map(function(e){return 1===e.length?s(e[0],!1):2===e.length?c(e[0],e[1],!1):void 0}),f(e.data)]}}}},{"./util":16,mithril:3}],16:[function(e,t,n){function r(e){return y[e[0]-1]+e[1]}function o(e){return[y.indexOf(e[0])+1,parseInt(e[1])]}function a(e){return y[7-y.indexOf(e[0])]+(9-parseInt(e[1]))}function i(e){var t=[];for(var n in e)e[n]&&t.push(n);return t.join(" ")}function l(e){return"white"===e?"black":"white"}function s(e,t){return e&&(e[0]===t||e[1]===t)}function c(e,t){return e&&-1!==e.indexOf(t)}function u(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function d(){return"transform"in document.body.style?"transform":"webkitTransform"in document.body.style?"webkitTransform":"mozTransform"in document.body.style?"mozTransform":"oTransform"in document.body.style?"oTransform":"msTransform"}function f(){return b||(b=d()),b}function p(e){return"translate3d("+e[0]+"px,"+e[1]+"px,0)"}function h(e){return e.touches?[e.targetTouches[0].clientX,e.targetTouches[0].clientY]:[e.clientX,e.clientY]}function v(e,t){return e.bind.apply(e,[null].concat(t))}function g(){return v(arguments[0],Array.prototype.slice.call(arguments,1))}function m(e){return 2===e.buttons||2===e.button}var b,y="abcdefgh".split(""),w=[1,2,3,4,5,6,7,8],k=[8,7,6,5,4,3,2,1],x=function(){var e=[];return k.forEach(function(t){w.forEach(function(n){e.push([n,t])})}),e}(),E=x.slice().reverse(),C=x.map(r);t.exports={files:y,ranks:w,invRanks:k,allPos:x,invPos:E,allKeys:C,pos2key:r,key2pos:o,invertKey:a,classSet:i,opposite:l,translate:p,contains2:s,containsX:c,distance:u,eventPosition:h,partialApply:v,partial:g,transformProp:f,requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),isRightButton:m}},{}],17:[function(e,t,n){function r(e){return["cg-piece",e.role,e.color].join(" ")}function o(e,t,n){var o={style:{},"class":r(n)},a=e.data.draggable.current;if(a.orig!==t||0===a.pos[0]&&0===a.pos[1]){if(e.data.animation.current.anims){var i=e.data.animation.current.anims[t];i&&(o.style[g.transformProp()]=g.translate(i[1]))}}else o.style[g.transformProp()]=g.translate([a.pos[0]+a.dec[0],a.pos[1]+a.dec[1]]),o["class"]+=" dragging";return{tag:"div",attrs:o}}function a(e){return{tag:"div",attrs:{"class":r(e)+" ghost"}}}function i(e,t,n){var r=g.files[t[0]-1],i=t[1],l=r+i,s=e.data.pieces[l],c=e.data.highlight.dragOver&&e.data.draggable.current.over===l,u={"class":"cg-square "+l+" "+g.classSet({selected:e.data.selected===l,check:e.data.highlight.check&&e.data.check===l,"last-move":e.data.highlight.lastMove&&g.contains2(e.data.lastMove,l),"move-dest":(c||e.data.movable.showDests)&&g.containsX(e.data.movable.dests[e.data.selected],l),"premove-dest":(c||e.data.premovable.showDests)&&g.containsX(e.data.premovable.dests,l),"current-premove":g.contains2(e.data.premovable.current,l),"drag-over":c,occupied:!!s,exploding:e.vm.exploding&&-1!==e.vm.exploding.indexOf(l)}),style:{left:12.5*(n?t[0]-1:8-t[0])+"%",bottom:12.5*(n?t[1]-1:8-t[1])+"%"}};e.data.coordinates&&(t[1]===(n?1:8)&&(u["data-coord-x"]=r),t[0]===(n?8:1)&&(u["data-coord-y"]=i));var d=[];return s&&(d.push(o(e,l,s)),e.data.draggable.current.orig===l&&e.data.draggable.showGhost&&d.push(a(s))),{tag:"div",attrs:u,children:d}}function l(e,t){var n=g.key2pos(t.over),r="white"===e.data.orientation?n[0]:9-n[0],o="white"===e.data.orientation?n[1]:9-n[1];return{tag:"div",attrs:{id:"cg-square-target",style:{width:t.bounds.width/4+"px",height:t.bounds.height/4+"px",left:(r-1.5)*t.bounds.width/8+"px",top:(7.5-o)*t.bounds.height/8+"px"}}}}function s(e){return{tag:"div",attrs:{"class":"cg-square fading",style:{left:e.left,bottom:e.bottom,opacity:e.opacity}},children:[{tag:"div",attrs:{"class":r(e.piece)}}]}}function c(e,t){var n=[];e.data.lastMove&&e.data.lastMove.forEach(function(e){var r=g.key2pos(e);n.push({tag:"div",attrs:{"class":"cg-square last-move",style:{left:12.5*(t?r[0]-1:8-r[0])+"%",bottom:12.5*(t?r[1]-1:8-r[1])+"%"}}})});for(var o=Object.keys(e.data.pieces),a=0,i=o.length;i>a;a++){var l=o[a],s=g.key2pos(l),c={style:{left:12.5*(t?s[0]-1:8-s[0])+"%",bottom:12.5*(t?s[1]-1:8-s[1])+"%"},"class":r(e.data.pieces[l])};if(e.data.animation.current.anims){var u=e.data.animation.current.anims[l];u&&(c.style[g.transformProp()]=g.translate(u[1]))}n.push({tag:"div",attrs:c})}return n}function u(e){var t="white"===e.data.orientation;if(e.data.minimalDom)return c(e,t);for(var n=t?g.allPos:g.invPos,r=[],o=0,a=n.length;a>o;o++)r.push(i(e,n[o],t));return e.data.draggable.current.over&&e.data.draggable.squareTarget&&r.push(l(e,e.data.draggable.current)),e.data.animation.current.fadings&&e.data.animation.current.fadings.forEach(function(e){r.push(s(e))}),e.data.drawable.enabled&&r.push(m(e)),r}function d(e,t,n){return function(r){e.drawable.enabled&&r.shiftKey?n(e,r):e.drawable.enabled&&g.isRightButton(r)?n(e,r):e.viewOnly||t(e,r)}}function f(e,t,n){var r=e.data,o=d(r,h.start,v.start),a=d(r,h.move,v.move),i=d(r,h.end,v.end),l=g.partial(v.clear,r),s=["touchstart","mousedown"],c=["touchmove","mousemove"],u=["touchend","mouseup"];s.forEach(function(e){t.addEventListener(e,o)}),c.forEach(function(e){document.addEventListener(e,a)}),u.forEach(function(e){document.addEventListener(e,i)}),t.addEventListener("mousedown",l),n.onunload=function(){s.forEach(function(e){t.removeEventListener(e,o)}),c.forEach(function(e){document.removeEventListener(e,a)}),u.forEach(function(e){document.removeEventListener(e,i)}),t.removeEventListener("mousedown",l)}}function p(e){return{tag:"div",attrs:{"class":"cg-board orientation-"+e.data.orientation,config:function(t,n,r){n||((!e.data.viewOnly||e.data.drawable.enabled)&&f(e,t,r),e.data.render=function(){b.render(t,u(e))},e.data.renderRAF=function(){g.requestAnimationFrame(e.data.render)},e.data.bounds=t.getBoundingClientRect.bind(t),e.data.element=t,e.data.render())}},children:[]}}var h=e("./drag"),v=e("./draw"),g=e("./util"),m=e("./svg"),b=e("mithril");t.exports=function(e){return{tag:"div",attrs:{config:function(t,n){n||t.addEventListener("contextmenu",function(t){return e.data.disableContextMenu||e.data.drawable.enabled?(t.preventDefault(),!1):void 0})},"class":["cg-board-wrap",e.data.viewOnly?"view-only":"manipulable",e.data.minimalDom?"minimal-dom":"full-dom"].join(" ")},children:[p(e)]}}},{"./drag":10,"./draw":11,"./svg":15,"./util":16,mithril:3}]},{},[1])(1)}); \ No newline at end of file +}}function u(e,t){var n=function(e){return 1===e.length&&e[0]===t},r=e.shapes.filter(n).length>0;r?e.shapes=e.shapes.filter(c(n)):e.shapes.push([t])}function d(e,t,n){var r=function(e){return 2===e.length&&(e[0]===t&&e[1]===n||e[1]===t&&e[0]===n)},o=e.shapes.filter(r).length>0;o?e.shapes=e.shapes.filter(c(r)):e.shapes.push([t,n])}var f=e("./board"),p=e("./util");t.exports={start:r,move:a,end:i,cancel:s,clear:l,processDraw:o}},{"./board":6,"./util":16}],12:[function(e,t,n){function r(e){"start"===e&&(e=i);var t={};return e.replace(/ .+$/,"").split("/").forEach(function(e,n){var r=0;e.split("").forEach(function(e){var o=parseInt(e);o?r+=o:(r++,t[a.pos2key([r,8-n])]={role:s[e.toLowerCase()],color:e===e.toLowerCase()?"black":"white"})})}),t}function o(e){return[8,7,6,5,4,3,2].reduce(function(e,t){return e.replace(new RegExp(Array(t+1).join("1"),"g"),t)},a.invRanks.map(function(t){return a.ranks.map(function(n){var r=e[a.pos2key([n,t])];if(r){var o=l[r.role];return"white"===r.color?o.toUpperCase():o}return"1"}).join("")}).join("/"))}var a=e("./util"),i="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",s={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},l={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};t.exports={initial:i,read:r,write:o}},{"./util":16}],13:[function(e,t,n){var r,o=function(){r=new Date},a=function(){r=null},i=function(){if(!r)return 0;var e=new Date-r;return r=null,e};t.exports={start:o,cancel:a,stop:i}},{}],14:[function(e,t,n){function r(e,t){return Math.abs(e-t)}function o(e,t,n,o,a){return r(t,o)<2&&("white"===e?a===n+1||2>=n&&a===n+2&&t===o:a===n-1||n>=7&&a===n-2&&t===o)}function a(e,t,n,o){var a=r(e,n),i=r(t,o);return 1===a&&2===i||2===a&&1===i}function i(e,t,n,o){return r(e,n)===r(t,o)}function s(e,t,n,r){return e===n||t===r}function l(e,t,n,r){return i(e,t,n,r)||s(e,t,n,r)}function c(e,t,n,o,a,i,s){return r(o,i)<2&&r(a,s)<2||n&&a===s&&a===("white"===e?1:8)&&(5===o&&(3===i||7===i)||f.containsX(t,i))}function u(e,t){return Object.keys(e).filter(function(n){var r=e[n];return r&&r.color===t&&"rook"===r.role}).map(function(e){return f.key2pos(e)[0]})}function d(e,t,n){var r,d=e[t],p=f.key2pos(t);switch(d.role){case"pawn":r=o.bind(null,d.color);break;case"knight":r=a;break;case"bishop":r=i;break;case"rook":r=s;break;case"queen":r=l;break;case"king":r=c.bind(null,d.color,u(e,d.color),n)}return f.allPos.filter(function(e){return(p[0]!==e[0]||p[1]!==e[1])&&r(p[0],p[1],e[0],e[1])}).map(f.pos2key)}var f=e("./util");t.exports=d},{"./util":16}],15:[function(e,t,n){function r(e){return(e?2:4)/512*p.width}function o(e){return(e?7:10)/512*p.width}function a(e){return e?.5:1}function i(){return 24/512*p.width}function s(e){var t=p.width/8;return[(e[0]-.5)*t,(8.5-e[1])*t]}function l(e,t){var n=s(e),o=r(t),i=p.width/16;return{tag:"circle",attrs:{stroke:g,"stroke-width":o,fill:"none",opacity:a(t),cx:n[0],cy:n[1],r:i-o/2}}}function c(e,t,n){var r=i(),l=s(e),c=s(t),u=c[0]-l[0],d=c[1]-l[1],f=Math.atan2(d,u),p=Math.cos(f)*r,h=Math.sin(f)*r;return{tag:"line",attrs:{stroke:g,"stroke-width":o(n),"stroke-linecap":"round","marker-end":"url(#arrowhead)",opacity:a(n),x1:l[0],y1:l[1],x2:c[0]-p,y2:c[1]-h}}}function u(e,t){return"white"===t?e:[9-e[0],9-e[1]]}function d(e){return function(t){return t.map(function(t){return u(v(t),e)})}}function f(e){var t=e.drawable.current;if(t.orig&&t.over){var n=d(e.orientation)(t.orig===t.over?[t.orig]:[t.orig,t.over]);return 1===n.length?l(n[0],!0):c(n[0],n[1],!0)}}var p,h=e("mithril"),v=e("./util").key2pos,g="#008800",m=h("defs",h("marker",{id:"arrowhead",orient:"auto",markerWidth:4,markerHeight:8,refX:2.05,refY:2.01},h("path",{d:"M0,0 V4 L3,2 Z",fill:g})));t.exports=function(e){if(e.data.bounds){var t=e.data.drawable.shapes.map(d(e.data.orientation));if((t.length||e.data.drawable.current.orig)&&(p||(p=e.data.bounds()),p.width===p.height))return{tag:"svg",children:[m,t.map(function(e){return 1===e.length?l(e[0],!1):2===e.length?c(e[0],e[1],!1):void 0}),f(e.data)]}}}},{"./util":16,mithril:3}],16:[function(e,t,n){function r(e){return y[e[0]-1]+e[1]}function o(e){return[y.indexOf(e[0])+1,parseInt(e[1])]}function a(e){return y[7-y.indexOf(e[0])]+(9-parseInt(e[1]))}function i(e){var t=[];for(var n in e)e[n]&&t.push(n);return t.join(" ")}function s(e){return"white"===e?"black":"white"}function l(e,t){return e&&(e[0]===t||e[1]===t)}function c(e,t){return e&&-1!==e.indexOf(t)}function u(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function d(){return"transform"in document.body.style?"transform":"webkitTransform"in document.body.style?"webkitTransform":"mozTransform"in document.body.style?"mozTransform":"oTransform"in document.body.style?"oTransform":"msTransform"}function f(){return b||(b=d()),b}function p(e){return"translate3d("+e[0]+"px,"+e[1]+"px,0)"}function h(e){return e.touches?[e.targetTouches[0].clientX,e.targetTouches[0].clientY]:[e.clientX,e.clientY]}function v(e,t){return e.bind.apply(e,[null].concat(t))}function g(){return v(arguments[0],Array.prototype.slice.call(arguments,1))}function m(e){return 2===e.buttons||2===e.button}var b,y="abcdefgh".split(""),w=[1,2,3,4,5,6,7,8],k=[8,7,6,5,4,3,2,1],x=function(){var e=[];return k.forEach(function(t){w.forEach(function(n){e.push([n,t])})}),e}(),E=x.slice().reverse(),C=x.map(r);t.exports={files:y,ranks:w,invRanks:k,allPos:x,invPos:E,allKeys:C,pos2key:r,key2pos:o,invertKey:a,classSet:i,opposite:s,translate:p,contains2:l,containsX:c,distance:u,eventPosition:h,partialApply:v,partial:g,transformProp:f,requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),isRightButton:m}},{}],17:[function(e,t,n){function r(e){return["cg-piece",e.role,e.color].join(" ")}function o(e,t,n){var o={style:{},"class":r(n)},a=e.data.draggable.current;if(a.orig===t&&a.started)o.style[g.transformProp()]=g.translate([a.pos[0]+a.dec[0],a.pos[1]+a.dec[1]]),o["class"]+=" dragging";else if(e.data.animation.current.anims){var i=e.data.animation.current.anims[t];i&&(o.style[g.transformProp()]=g.translate(i[1]))}return{tag:"div",attrs:o}}function a(e){return{tag:"div",attrs:{"class":r(e)+" ghost"}}}function i(e,t,n){var r=g.files[t[0]-1],i=t[1],s=r+i,l=e.data.pieces[s],c=e.data.highlight.dragOver&&e.data.draggable.current.over===s,u={"class":"cg-square "+s+" "+g.classSet({selected:e.data.selected===s,check:e.data.highlight.check&&e.data.check===s,"last-move":e.data.highlight.lastMove&&g.contains2(e.data.lastMove,s),"move-dest":(c||e.data.movable.showDests)&&g.containsX(e.data.movable.dests[e.data.selected],s),"premove-dest":(c||e.data.premovable.showDests)&&g.containsX(e.data.premovable.dests,s),"current-premove":g.contains2(e.data.premovable.current,s),"drag-over":c,occupied:!!l,exploding:e.vm.exploding&&-1!==e.vm.exploding.indexOf(s)}),style:{left:12.5*(n?t[0]-1:8-t[0])+"%",bottom:12.5*(n?t[1]-1:8-t[1])+"%"}};e.data.coordinates&&(t[1]===(n?1:8)&&(u["data-coord-x"]=r),t[0]===(n?8:1)&&(u["data-coord-y"]=i));var d=[];return l&&(d.push(o(e,s,l)),e.data.draggable.current.orig===s&&e.data.draggable.showGhost&&d.push(a(l))),{tag:"div",attrs:u,children:d}}function s(e,t){var n=g.key2pos(t.over),r="white"===e.data.orientation?n[0]:9-n[0],o="white"===e.data.orientation?n[1]:9-n[1];return{tag:"div",attrs:{id:"cg-square-target",style:{width:t.bounds.width/4+"px",height:t.bounds.height/4+"px",left:(r-1.5)*t.bounds.width/8+"px",top:(7.5-o)*t.bounds.height/8+"px"}}}}function l(e){return{tag:"div",attrs:{"class":"cg-square fading",style:{left:e.left,bottom:e.bottom,opacity:e.opacity}},children:[{tag:"div",attrs:{"class":r(e.piece)}}]}}function c(e,t){var n=[];e.data.lastMove&&e.data.lastMove.forEach(function(e){var r=g.key2pos(e);n.push({tag:"div",attrs:{"class":"cg-square last-move",style:{left:12.5*(t?r[0]-1:8-r[0])+"%",bottom:12.5*(t?r[1]-1:8-r[1])+"%"}}})});for(var o=Object.keys(e.data.pieces),a=0,i=o.length;i>a;a++){var s=o[a],l=g.key2pos(s),c={style:{left:12.5*(t?l[0]-1:8-l[0])+"%",bottom:12.5*(t?l[1]-1:8-l[1])+"%"},"class":r(e.data.pieces[s])};if(e.data.animation.current.anims){var u=e.data.animation.current.anims[s];u&&(c.style[g.transformProp()]=g.translate(u[1]))}n.push({tag:"div",attrs:c})}return n}function u(e){var t="white"===e.data.orientation;if(e.data.minimalDom)return c(e,t);for(var n=t?g.allPos:g.invPos,r=[],o=0,a=n.length;a>o;o++)r.push(i(e,n[o],t));return e.data.draggable.current.over&&e.data.draggable.squareTarget&&r.push(s(e,e.data.draggable.current)),e.data.animation.current.fadings&&e.data.animation.current.fadings.forEach(function(e){r.push(l(e))}),e.data.drawable.enabled&&r.push(m(e)),r}function d(e,t,n){return function(r){e.drawable.enabled&&r.shiftKey?n(e,r):e.drawable.enabled&&g.isRightButton(r)?n(e,r):e.viewOnly||t(e,r)}}function f(e,t,n){var r=e.data,o=d(r,h.start,v.start),a=d(r,h.move,v.move),i=d(r,h.end,v.end),s=g.partial(v.clear,r),l=["touchstart","mousedown"],c=["touchmove","mousemove"],u=["touchend","mouseup"];l.forEach(function(e){t.addEventListener(e,o)}),c.forEach(function(e){document.addEventListener(e,a)}),u.forEach(function(e){document.addEventListener(e,i)}),t.addEventListener("mousedown",s),n.onunload=function(){l.forEach(function(e){t.removeEventListener(e,o)}),c.forEach(function(e){document.removeEventListener(e,a)}),u.forEach(function(e){document.removeEventListener(e,i)}),t.removeEventListener("mousedown",s)}}function p(e){return{tag:"div",attrs:{"class":"cg-board orientation-"+e.data.orientation,config:function(t,n,r){n||((!e.data.viewOnly||e.data.drawable.enabled)&&f(e,t,r),e.data.render=function(){b.render(t,u(e))},e.data.renderRAF=function(){g.requestAnimationFrame(e.data.render)},e.data.bounds=t.getBoundingClientRect.bind(t),e.data.element=t,e.data.render())}},children:[]}}var h=e("./drag"),v=e("./draw"),g=e("./util"),m=e("./svg"),b=e("mithril");t.exports=function(e){return{tag:"div",attrs:{config:function(t,n){n||t.addEventListener("contextmenu",function(t){return e.data.disableContextMenu||e.data.drawable.enabled?(t.preventDefault(),!1):void 0})},"class":["cg-board-wrap",e.data.viewOnly?"view-only":"manipulable",e.data.minimalDom?"minimal-dom":"full-dom"].join(" ")},children:[p(e)]}}},{"./drag":10,"./draw":11,"./svg":15,"./util":16,mithril:3}]},{},[1])(1)}); \ No newline at end of file diff --git a/ui/analyse/package.json b/ui/analyse/package.json index 7e7e1a991f..f1a1d5157a 100644 --- a/ui/analyse/package.json +++ b/ui/analyse/package.json @@ -29,7 +29,7 @@ "watchify": "~3.1.1" }, "dependencies": { - "chessground": "~2.2.1", + "chessground": "~2.4.0", "game": "file:../game", "mithril": "0.2.0" } diff --git a/ui/editor/package.json b/ui/editor/package.json index a4eea77b20..ad03a507ab 100644 --- a/ui/editor/package.json +++ b/ui/editor/package.json @@ -29,7 +29,7 @@ "watchify": "~3.1.1" }, "dependencies": { - "chessground": "~2.2.1", + "chessground": "~2.4.0", "lodash": "~3.7.0", "mithril": "0.2.0" } diff --git a/ui/lobby/package.json b/ui/lobby/package.json index b39d4875ed..83e55092c8 100644 --- a/ui/lobby/package.json +++ b/ui/lobby/package.json @@ -29,7 +29,7 @@ "watchify": "~3.1.1" }, "dependencies": { - "chessground": "2.2.1", + "chessground": "2.4.0", "lodash-node": "^2.4.1", "mithril": "0.2.0" } diff --git a/ui/opening/package.json b/ui/opening/package.json index 0578961598..3eb884814c 100644 --- a/ui/opening/package.json +++ b/ui/opening/package.json @@ -30,7 +30,7 @@ }, "dependencies": { "chessli.js": "file:../chessli", - "chessground": "~2.2.1", + "chessground": "~2.4.0", "lodash": "~3.7.0", "merge": "~1.2.0", "mithril": "0.2.0" diff --git a/ui/puzzle/package.json b/ui/puzzle/package.json index 675b6e5dd4..05161bf41b 100644 --- a/ui/puzzle/package.json +++ b/ui/puzzle/package.json @@ -30,7 +30,7 @@ }, "dependencies": { "chessli.js": "file:../chessli", - "chessground": "~2.2.1", + "chessground": "~2.4.0", "lodash": "~3.7.0", "merge": "~1.2.0", "mithril": "0.2.0" diff --git a/ui/round/package.json b/ui/round/package.json index 22f9c705cd..a92a885b53 100644 --- a/ui/round/package.json +++ b/ui/round/package.json @@ -29,7 +29,7 @@ "watchify": "~3.1.1" }, "dependencies": { - "chessground": "~2.2.1", + "chessground": "~2.4.0", "game": "file:../game", "mithril": "0.2.0" } diff --git a/ui/simul/package.json b/ui/simul/package.json index 60b103dad3..236b2760d3 100644 --- a/ui/simul/package.json +++ b/ui/simul/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "game": "file:../game", - "chessground": "~2.2.1", + "chessground": "~2.4.0", "lodash": "~3.7.0", "mithril": "0.2.0" } diff --git a/ui/tournament/package.json b/ui/tournament/package.json index 6f6695bb69..4b1394fdad 100644 --- a/ui/tournament/package.json +++ b/ui/tournament/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "game": "file:../game", - "chessground": "~2.2.1", + "chessground": "~2.4.0", "lodash": "~3.7.0", "mithril": "0.2.0" }