-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
12 lines (12 loc) · 243 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=23)}([function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){"use strict";function t(){}function n(e,n){var r,o,i,a,s=j;for(a=arguments.length;a-- >2;)B.push(arguments[a]);for(n&&null!=n.children&&(B.length||B.push(n.children),delete n.children);B.length;)if((o=B.pop())&&void 0!==o.pop)for(a=o.length;a--;)B.push(o[a]);else"boolean"==typeof o&&(o=null),(i="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o+="":"string"!=typeof o&&(i=!1)),i&&r?s[s.length-1]+=o:s===j?s=[o]:s.push(o),r=i;var l=new t;return l.nodeName=e,l.children=s,l.attributes=null==n?void 0:n,l.key=null==n?void 0:n.key,void 0!==O.vnode&&O.vnode(l),l}function o(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){return n(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function a(e){!e.__d&&(e.__d=!0)&&1==q.push(e)&&(O.debounceRendering||R)(s)}function s(){var e,t=q;for(q=[];e=t.pop();)e.__d&&T(e)}function l(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&u(e,t.nodeName):n||e._componentConstructor===t.nodeName}function u(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function c(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function h(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function d(e){var t=e.parentNode;t&&t.removeChild(e)}function f(e,t,n,o,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||i)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==(void 0===o?"undefined":r(o))){if("string"!=typeof n)for(var a in n)a in o||(e.style[a]="");for(var a in o)e.style[a]="number"==typeof o[a]&&!1===N.test(a)?o[a]+"px":o[a]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,v,s):e.removeEventListener(t,v,s),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!i&&t in e)p(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var l=i&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?l?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(l?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function p(e,t,n){try{e[t]=n}catch(e){}}function v(e){return this.__l[e.type](O.event&&O.event(e)||e)}function g(){for(var e;e=L.pop();)O.afterMount&&O.afterMount(e),e.componentDidMount&&e.componentDidMount()}function m(e,t,n,r,o,i){I++||(z=null!=o&&void 0!==o.ownerSVGElement,W=null!=e&&!("__preactattr_"in e));var a=y(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--I||(W=!1,i||g()),a}function y(e,t,n,r,o){var i=e,a=z;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),w(e,!0))),i.__preactattr_=!0,i;var s=t.nodeName;if("function"==typeof s)return A(e,t,n,r);if(z="svg"===s||"foreignObject"!==s&&z,s+="",(!e||!u(e,s))&&(i=h(s,z),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),w(e,!0)}var l=i.firstChild,c=i.__preactattr_,d=t.children;if(null==c){c=i.__preactattr_={};for(var f=i.attributes,p=f.length;p--;)c[f[p].name]=f[p].value}return!W&&d&&1===d.length&&"string"==typeof d[0]&&null!=l&&void 0!==l.splitText&&null==l.nextSibling?l.nodeValue!=d[0]&&(l.nodeValue=d[0]):(d&&d.length||null!=l)&&b(i,d,n,r,W||null!=c.dangerouslySetInnerHTML),_(i,t.attributes,c),z=a,i}function b(e,t,n,r,o){var i,a,s,u,c,h=e.childNodes,f=[],p={},v=0,g=0,m=h.length,b=0,k=t?t.length:0;if(0!==m)for(var _=0;_<m;_++){var x=h[_],C=x.__preactattr_,S=k&&C?x._component?x._component.__k:C.key:null;null!=S?(v++,p[S]=x):(C||(void 0!==x.splitText?!o||x.nodeValue.trim():o))&&(f[b++]=x)}if(0!==k)for(var _=0;_<k;_++){u=t[_],c=null;var S=u.key;if(null!=S)v&&void 0!==p[S]&&(c=p[S],p[S]=void 0,v--);else if(!c&&g<b)for(i=g;i<b;i++)if(void 0!==f[i]&&l(a=f[i],u,o)){c=a,f[i]=void 0,i===b-1&&b--,i===g&&g++;break}c=y(c,u,n,r),s=h[_],c&&c!==e&&c!==s&&(null==s?e.appendChild(c):c===s.nextSibling?d(s):e.insertBefore(c,s))}if(v)for(var _ in p)void 0!==p[_]&&w(p[_],!1);for(;g<=b;)void 0!==(c=f[b--])&&w(c,!1)}function w(e,t){var n=e._component;n?P(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||d(e),k(e))}function k(e){for(e=e.lastChild;e;){var t=e.previousSibling;w(e,!0),e=t}}function _(e,t,n){var r;for(r in n)t&&null!=t[r]||null==n[r]||f(e,r,n[r],n[r]=void 0,z);for(r in t)"children"===r||"innerHTML"===r||r in n&&t[r]===("value"===r||"checked"===r?e[r]:n[r])||f(e,r,n[r],n[r]=t[r],z)}function x(e){var t=e.constructor.name;(F[t]||(F[t]=[])).push(e)}function C(e,t,n){var r,o=F[e.name];if(e.prototype&&e.prototype.render?(r=new e(t,n),E.call(r,t,n)):(r=new E(t,n),r.constructor=e,r.render=S),o)for(var i=o.length;i--;)if(o[i].constructor===e){r.__b=o[i].__b,o.splice(i,1);break}return r}function S(e,t,n){return this.constructor(e,n)}function M(e,t,n,r,o){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||o?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.__c||(e.__c=e.context),e.context=r),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===O.syncComponentUpdates&&e.base?a(e):T(e,1,o)),e.__r&&e.__r(e))}function T(e,t,n,r){if(!e.__x){var i,a,s,l=e.props,u=e.state,h=e.context,d=e.__p||l,f=e.__s||u,p=e.__c||h,v=e.base,y=e.__b,b=v||y,k=e._component,_=!1;if(v&&(e.props=d,e.state=f,e.context=p,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(l,u,h)?_=!0:e.componentWillUpdate&&e.componentWillUpdate(l,u,h),e.props=l,e.state=u,e.context=h),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!_){i=e.render(l,u,h),e.getChildContext&&(h=o(o({},h),e.getChildContext()));var x,S,A=i&&i.nodeName;if("function"==typeof A){var E=c(i);a=k,a&&a.constructor===A&&E.key==a.__k?M(a,E,1,h,!1):(x=a,e._component=a=C(A,E,h),a.__b=a.__b||y,a.__u=e,M(a,E,0,h,!1),T(a,1,n,!0)),S=a.base}else s=b,x=k,x&&(s=e._component=null),(b||1===t)&&(s&&(s._component=null),S=m(s,i,h,n||!v,b&&b.parentNode,!0));if(b&&S!==b&&a!==k){var D=b.parentNode;D&&S!==D&&(D.replaceChild(S,b),x||(b._component=null,w(b,!1)))}if(x&&P(x),e.base=S,S&&!r){for(var B=e,j=e;j=j.__u;)(B=j).base=S;S._component=B,S._componentConstructor=B.constructor}}if(!v||n?L.unshift(e):_||(e.componentDidUpdate&&e.componentDidUpdate(d,f,p),O.afterUpdate&&O.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);I||r||g()}}function A(e,t,n,r){for(var o=e&&e._component,i=o,a=e,s=o&&e._componentConstructor===t.nodeName,l=s,u=c(t);o&&!l&&(o=o.__u);)l=o.constructor===t.nodeName;return o&&l&&(!r||o._component)?(M(o,u,3,n,r),e=o.base):(i&&!s&&(P(i),e=a=null),o=C(t.nodeName,u,n),e&&!o.__b&&(o.__b=e,a=null),M(o,u,1,n,r),e=o.base,a&&e!==a&&(a._component=null,w(a,!1))),e}function P(e){O.beforeUnmount&&O.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?P(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,d(t),x(e),k(t)),e.__r&&e.__r(null)}function E(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}function D(e,t,n){return m(n,e,{},!1,t,!1)}var O={},B=[],j=[],R="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,N=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,q=[],L=[],I=0,z=!1,W=!1,F={};o(E.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,"function"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),a(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),T(this,2)},render:function(){}});var V={h:n,createElement:n,cloneElement:i,Component:E,render:D,rerender:s,options:O};e.exports=V}()},function(e,t,n){(function(e){var r=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=0;t.linebreak="win32"===e.platform?"\r\n":"\n",t.noop=function(){},t.getId=function(){return++o},t.hash=function(e){var t=0,n=void 0;if(0==e.length)return t;for(var r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t&=t;return t},t.floorEven=function(e){var t=Math.floor(e);return t%2==0?t:t-1},t.equals=function(e,n){if(e===n)return!0;if(null==e||null==n)return e==n;var r=Object.prototype.toString.call(e);if(r!==Object.prototype.toString.call(n))return!1;var o="[object Array]"===r,i="[object Object]"===r;if(o){if(e.length!==n.length)return!1;for(var a=0;a<e.length;a++)if(!t.equals(e[a],n[a]))return!1;return!0}if(i){var s=Object.keys(e);if(s.length!==Object.keys(n).length)return!1;for(var l=0;l<s.length;l++){var u=s[l];if(!(u in n))return!1;if(!t.equals(e[u],n[u]))return!1}return!0}return!1},t.shallowEquals=function(e,t){return null==e||null==t?e===t:e===t||e.length===t.length&&e.every(function(e,n){return e==t[n]})},t.vertexEquals=function(e,t){var n=r(e,2),o=n[0],i=n[1],a=r(t,2),s=a[0],l=a[1];return o===s&&i===l},t.lexicalCompare=function(e,n){return e.length&&n.length?e[0]<n[0]?-1:e[0]>n[0]?1:t.lexicalCompare(e.slice(1),n.slice(1)):e.length-n.length},t.normalizeEndings=function(e){return e.replace(/\r\n|\n\r|\r/g,"\n")},t.markdown=function(e){return n(24)(t.normalizeEndings(e.trim()).replace(/\n/g," \n"))},t.htmlify=function(e){var t="\\b(https?|ftps?):\\/\\/[^\\s<]+[^<.,:;\"')\\]\\s](\\/\\B|\\b)",n="\\b[a-hj-zA-HJ-Z][1-9][0-9]?\\b",r="("+[t,"\\b[^\\s@<]+@[^\\s@<]+\\b",n,"\\B#\\d+\\b"].join("|")+")";return e=e.replace(new RegExp(r,"g"),function(e){return new RegExp(t).test(e)?'<a href="'+e+'" class="external">'+e+"</a>":new RegExp("\\b[^\\s@<]+@[^\\s@<]+\\b").test(e)?'<a href="mailto:'+e+'" class="external">'+e+"</a>":new RegExp("\\B#\\d+\\b").test(e)?'<a href="#" class="movenumber">'+e+"</a>":new RegExp(n).test(e)?'<span class="coord">'+e+"</span>":void 0})},t.popupMenu=function(e,t,r){var o=n(2),i=o.remote,a=i.require("./setting"),s=+a.get("app.zoom_factor");i.Menu.buildFromTemplate(e).popup(i.getCurrentWindow(),{x:Math.round(t*s),y:Math.round(r*s),async:!0})}}).call(t,n(10))},function(e,t,n){var r=n(26),o=n(0),i=o.h,a=o.render,s=n(1),l=s.noop,u={opacity:0,pointerEvents:"none"},c={getName:function(){return"Sabaki"},getVersion:function(){return"web"},getPath:function(){return""}};e.exports={app:c,ipcRenderer:{on:l,send:l},clipboard:{readText:function(){return prompt("Please paste contents here:")},writeText:function(e){var t=a(i("a",{href:"#",style:u,onClick:function(t){t.preventDefault(),r(e)}}),document.body);t.click(),t.remove()}},shell:{openExternal:function(e){var t=a(i("a",{href:e,target:"_blank",style:u}),document.body);t.click(),t.remove()}},remote:{app:c,require:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return"./setting"===e?n(27):{}}),getCurrentWindow:function(){return{show:l,close:l,on:l,isMaximized:l,isMinimized:l,isFullScreen:l,setFullScreen:l,setMenuBarVisibility:l,setAutoHideMenuBar:l,setProgressBar:l,setContentSize:l,getContentSize:function(){return[0,0]},webContents:{setAudioMuted:l}}},Menu:n(28)}}},function(e,t,n){var r,o,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=void 0===n?"undefined":i(n);if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n))e.push(a.apply(null,n));else if("object"===r)for(var o in n)s.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}var s={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=a:"object"===i(n(19))&&n(19)?(r=[],void 0!==(o=function(){return a}.apply(t,r))&&(e.exports=o)):window.classNames=a}()},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var o=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(8),a=n(1),s=n(7),l=s.sgf;t.new=function(){return{id:a.getId(),nodes:[],subtrees:[],current:null,parent:null}},t.clone=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=Object.assign(t.new(),{current:e.current,parent:n}),i=!0,a=!1,s=void 0;try{for(var l,u=e.nodes[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var c=l.value,h={};for(var d in c)"board"!==d&&(Array.isArray(c[d])?h[d]=[].concat(r(c[d])):h[d]=c[d]);o.nodes.push(h)}}catch(e){a=!0,s=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw s}}var f=!0,p=!1,v=void 0;try{for(var g,m=e.subtrees[Symbol.iterator]();!(f=(g=m.next()).done);f=!0){var y=g.value;o.subtrees.push(t.clone(y,o))}}catch(e){p=!0,v=e}finally{try{!f&&m.return&&m.return()}finally{if(p)throw v}}return o},t.getRoot=function(e){for(;null!==e.parent;)e=e.parent;return e},t.getRootProperty=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=t.getRoot(e).nodes[0];if(!o)return r;var i="";return n in o&&(i=o[n][0]),""===i?r:i},t.getHeight=function(e){var n=0,r=!0,o=!1,i=void 0;try{for(var a,s=e.subtrees[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;n=Math.max(t.getHeight(l),n)}}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n+e.nodes.length},t.getCurrentHeight=function(e){var n=e.nodes.length;return 0!==e.subtrees.length&&(n+=t.getCurrentHeight(e.subtrees[e.current])),n},t.getTreesRecursive=function(e){var n=[e],o=!0,i=!1,a=void 0;try{for(var s,l=e.subtrees[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value;n.push.apply(n,r(t.getTreesRecursive(u)))}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}return n},t.getLevel=function(e,n){return n+(e.parent?t.getLevel(e.parent,e.parent.nodes.length):0)},t.getSection=function(e,n){if(n<0)return[];if(n<e.nodes.length)return[[e,n]];var o=[],i=!0,a=!1,s=void 0;try{for(var l,u=e.subtrees[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var c=l.value;o.push.apply(o,r(t.getSection(c,n-e.nodes.length)))}}catch(e){a=!0,s=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw s}}return o},t.navigate=function(e,n,r){if(n+r>=0&&n+r<e.nodes.length)return[e,n+r];if(n+r<0&&null!=e.parent){var o=e.parent,i=n+r+1;return t.navigate(o,o.nodes.length-1,i)}if(n+r>=e.nodes.length&&0!==e.subtrees.length){var a=e.subtrees[e.current],s=n+r-e.nodes.length;return t.navigate(a,0,s)}return null},t.makeHorizontalNavigator=function(e,n){var r=t.getRoot(e),o=t.getLevel(e,n,r),i=t.getSection(r,o),a=i.map(function(e){return e[0]}).indexOf(e);return{navigate:function(e){a+e>=0&&a+e<i.length?a+=e:a+e>=i.length?(e=a+e-i.length,i=t.getSection(r,++o),a=0,0!=i.length&&this.navigate(e)):a+e<0&&(e=a+e+1,i=t.getSection(r,--o),a=i.length-1,0!=i.length&&this.navigate(e))},value:function(){return a<i.length&&a>=0?i[a]:null},next:function(){return this.navigate(1),this.value()},prev:function(){return this.navigate(-1),this.value()}}},t.split=function(e,n){if(n<0||n>=e.nodes.length-1)return e;var r=e.nodes.slice(0,n+1);e.nodes=e.nodes.slice(n+1);var o=t.new();return o.nodes=r,o.subtrees=[e],o.parent=e.parent,o.current=0,e.parent=o,o.parent&&(o.parent.subtrees[o.parent.subtrees.indexOf(e)]=o),o},t.reduce=function(e){var t;if(1!=e.subtrees.length)return e;(t=e.nodes).push.apply(t,r(e.subtrees[0].nodes)),e.current=e.subtrees[0].current,e.subtrees=e.subtrees[0].subtrees;var n=!0,o=!1,i=void 0;try{for(var a,s=e.subtrees[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.parent=e}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return e},t.onCurrentTrack=function(e){return!e.parent||e.parent.subtrees[e.parent.current]==e&&t.onCurrentTrack(e.parent)},t.onMainTrack=function(e){return!e.parent||e.parent.subtrees[0]==e&&t.onMainTrack(e.parent)},t.getMatrixDict=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;n||(n=[].concat(r(Array(t.getHeight(e)))).map(function(e){return[]}));for(var s=!0;s;){s=!1;for(var l=0;l<Math.min(e.nodes.length+1,n.length-a);l++)if(!(i>=n[a+l].length-(l===e.nodes.length))){s=!0,i++;break}}for(var u=0;u<e.nodes.length;u++)n[a+u].length=i+1,n[a+u][i]=[e,u],o[e.id+"-"+u]=[i,a+u];for(var c=0;c<e.subtrees.length;c++){var h=e.subtrees[c];t.getMatrixDict(h,n,o,i+c,a+e.nodes.length)}return[n,o]},t.getMatrixWidth=function(e,t){var n=[].concat(r(Array(10))).map(function(t,n){return n+e-4}).filter(function(e){return e>=0&&e<t.length}),o=Math.min.apply(Math,r(n.map(function(e){for(var n=0;n<t[e].length;n++)if(null!=t[e][n])return n;return 0})));return[Math.max.apply(Math,r(n.map(function(e){return t[e].length})))-o,o]},t.getBoard=function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(n>=e.nodes.length)return null;var s=e.nodes[n],u=null,c=null;if(!a){var h=t.navigate(e,n,-1);if(h){var d;a=h[0].nodes[h[1]].board||(d=t).getBoard.apply(d,r(h))}else{var f=[19,19];"SZ"in s&&(f=s.SZ[0].toString(),f=f.includes(":")?f.split(":"):[f,f],f=f.map(function(e){return+e})),a=new(Function.prototype.bind.apply(i,[null].concat(r(f))))}}var p={B:1,W:-1};for(var v in p)if(v in s){u=l.point2vertex(s[v][0]),c=a.makeMove(p[v],u);break}c||(c=a.clone()),p={AW:-1,AE:0,AB:1};for(var g in p)if(g in s){var m=!0,y=!1,b=void 0;try{for(var w,k=s[g][Symbol.iterator]();!(m=(w=k.next()).done);m=!0){var _=w.value,x=!0,C=!1,S=void 0;try{for(var M,T=l.compressed2list(_)[Symbol.iterator]();!(x=(M=T.next()).done);x=!0){var A=M.value;c.hasVertex(A)&&c.set(A,p[g])}}catch(e){C=!0,S=e}finally{try{!x&&T.return&&T.return()}finally{if(C)throw S}}}}catch(e){y=!0,b=e}finally{try{!m&&k.return&&k.return()}finally{if(y)throw b}}}null!=u&&(c.markups[u]=["point",""]),p={CR:"circle",MA:"cross",SQ:"square",TR:"triangle"};for(var P in p)if(P in s){var E=!0,D=!1,O=void 0;try{for(var B,j=s[P][Symbol.iterator]();!(E=(B=j.next()).done);E=!0){var R=B.value,N=!0,q=!1,L=void 0;try{for(var I,z=l.compressed2list(R)[Symbol.iterator]();!(N=(I=z.next()).done);N=!0){var W=I.value;c.markups[W]=[p[P],""]}}catch(e){q=!0,L=e}finally{try{!N&&z.return&&z.return()}finally{if(q)throw L}}}}catch(e){D=!0,O=e}finally{try{!E&&j.return&&j.return()}finally{if(D)throw O}}}if("LB"in s){var F=!0,V=!1,G=void 0;try{for(var U,H=s.LB[Symbol.iterator]();!(F=(U=H.next()).done);F=!0){var Y=U.value,$=Y.indexOf(":"),K=Y.slice(0,$),X=Y.slice($+1);c.markups[l.point2vertex(K)]=["label",X]}}catch(e){V=!0,G=e}finally{try{!F&&H.return&&H.return()}finally{if(V)throw G}}}if("L"in s)for(var Z=0;Z<s.L.length;Z++){var J=s.L[Z],Q="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[Z];if(null==Q)return;c.markups[l.point2vertex(J)]=["label",Q]}for(var ee=["AR","LN"],te=0;te<ee.length;te++){var ne=ee[te];if(ne in s){var re=!0,oe=!1,ie=void 0;try{for(var ae,se=s[ne][Symbol.iterator]();!(re=(ae=se.next()).done);re=!0){var le=ae.value,ue=le.indexOf(":"),ce=[le.slice(0,ue),le.slice(ue+1)].map(l.point2vertex),he=o(ce,2),de=he[0],fe=he[1];c.lines.push([de,fe,"AR"===ne])}}catch(e){oe=!0,ie=e}finally{try{!re&&se.return&&se.return()}finally{if(oe)throw ie}}}}var pe=function(e,t){var n=void 0,r=void 0;if("B"in e)n=l.point2vertex(e.B[0]),r=1;else{if(!("W"in e))return;n=l.point2vertex(e.W[0]),r=-1}if(c.hasVertex(n)&&!(n in c.ghosts)){var o=[];"child"===t?(o.push("ghost_"+r),"BM"in e?o.push("badmove"):"DO"in e?o.push("doubtfulmove"):"IT"in e?o.push("interestingmove"):"TE"in e&&o.push("goodmove")):"sibling"===t&&o.push("siblingghost_"+r),c.ghosts[n]=o}};if(n===e.nodes.length-1){var ve=!0,ge=!1,me=void 0;try{for(var ye,be=e.subtrees[Symbol.iterator]();!(ve=(ye=be.next()).done);ve=!0){var we=ye.value;0!==we.nodes.length&&pe(we.nodes[0],"child")}}catch(e){ge=!0,me=e}finally{try{!ve&&be.return&&be.return()}finally{if(ge)throw me}}}else n<e.nodes.length-1&&pe(e.nodes[n+1],"child");if(0===n&&e.parent){var ke=!0,_e=!1,xe=void 0;try{for(var Ce,Se=e.parent.subtrees[Symbol.iterator]();!(ke=(Ce=Se.next()).done);ke=!0){var Me=Ce.value;0!=Me.nodes.length&&pe(Me.nodes[0],"sibling")}}catch(e){_e=!0,xe=e}finally{try{!ke&&Se.return&&Se.return()}finally{if(_e)throw xe}}}return s.board=c,c},t.getJson=function(e){return JSON.stringify(e,function(e,t){return["id","board","parent","current"].includes(e)?void 0:t})},t.fromJson=function(e){var t=JSON.parse(e);return t.parent=null,function e(t){t.id=a.getId(),t.subtrees.length>0&&(t.current=0);for(var n=0;n<t.subtrees.length;n++)t.subtrees[n].parent=t,e(t.subtrees[n]);return t}(t)},t.getHash=function(e){return a.hash(e.nodes.map(t.getJson).join("-")+"-"+e.subtrees.map(t.getHash).join("-"))},t.getMatrixHash=function(e){return a.hash(e.id+"-"+e.nodes.length+"-"+e.subtrees.map(t.getMatrixHash).join("-"))}},function(e,t,n){var r=n(1),o=r.noop;e.exports={readFile:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,n=new FileReader;n.onload=function(e){return t(null,e.target.result)},n.readAsText(e)},readFileSync:function(){return""},writeFileSync:o,mkdirSync:o,accessSync:o}},function(e,t){e.exports=function(){}},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var o=n(5),i=n(9),a=i.extname,s=n(12),l=n(35),u=n(36),c={sgf:s,ngf:l,gib:u};t=e.exports=c;var h=Object.keys(c).map(function(e){return c[e].meta}),d=h.map(function(e){return e.extensions}).reduce(function(e,t){return[].concat(r(e),r(t))},[]);t.meta=[{name:"Game Records",extensions:d}].concat(r(h)),t.getModuleByExtension=function(e){return c[Object.keys(c).find(function(t){return c[t].meta.extensions.includes(e.toLowerCase())})]||s},t.parseFile=function(e,n,r){var i=a(e.name).slice(1),s=t.getModuleByExtension(i);o.readFile(e,function(e,t){r({trees:s.parse(t,n)})})}},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1),l="ABCDEFGHJKLMNOPQRSTUVWXYZ",u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:19,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:19,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;o(this,e),this.width=t,this.height=n,this.captures=a?a.slice():[0,0],this.arrangement=[],this.markups={},this.ghosts={},this.lines=[];for(var s=0;s<this.height;s++)this.arrangement[s]=s in i?[].concat(r(i[s])):Array(this.width).fill(0)}return a(e,[{key:"get",value:function(e){var t=i(e,2),n=t[0],r=t[1];return this.arrangement[r]?this.arrangement[r][n]:void 0}},{key:"set",value:function(e,t){var n=i(e,2),r=n[0],o=n[1];return this.arrangement[o][r]=t,this}},{key:"clone",value:function(){return new e(this.width,this.height,this.arrangement,this.captures)}},{key:"diff",value:function(e){for(var t=[],n=0;n<this.width;n++)for(var r=0;r<this.height;r++){var o=e.get([n,r]);this.get([n,r])!==o&&t.push([n,r])}return t}},{key:"hasVertex",value:function(e){var t=i(e,2),n=t[0],r=t[1];return 0<=n&&n<this.width&&0<=r&&r<this.height}},{key:"clear",value:function(){var e=this;this.arrangement=this.arrangement.map(function(t){return Array(e.width).fill(0)})}},{key:"isSquare",value:function(){return this.width===this.height}},{key:"getDistance",value:function(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}},{key:"getDistanceToGround",value:function(e){return this.getCanonicalVertex(e)[0]}},{key:"getCanonicalVertex",value:function(e){if(!this.hasVertex(e))return[-1,-1];var t=[this.width,this.height];return e.map(function(e,n){return Math.min(e,t[n]-e-1)}).sort(function(e,t){return e-t})}},{key:"getNeighbors",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!n&&!this.hasVertex(e))return[];var r=i(e,2),o=r[0],a=r[1],s=[[o-1,a],[o+1,a],[o,a-1],[o,a+1]];return n?s:s.filter(function(e){return t.hasVertex(e)})}},{key:"getConnectedComponent",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t instanceof Array){var o=t;t=function(e){return o.includes(n.get(e))}}else if("number"==typeof t){var i=t;t=function(e){return n.get(e)===i}}if(!this.hasVertex(e))return[];r||(r=[e]);var a=!0,l=!1,u=void 0;try{for(var c,h=this.getNeighbors(e)[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;(function(e){t(e)&&(r.some(function(t){return s.vertexEquals(e,t)})||(r.push(e),n.getConnectedComponent(e,t,r)))})(d)}}catch(e){l=!0,u=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw u}}return r}},{key:"getChain",value:function(e){return this.getConnectedComponent(e,this.get(e))}},{key:"hasLiberties",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.get(e);if(!this.hasVertex(e)||0===r)return!1;if(e in n)return!1;var o=this.getNeighbors(e);return!!o.some(function(e){return 0===t.get(e)})||(n[e]=!0,o.filter(function(e){return t.get(e)===r}).some(function(e){return t.hasLiberties(e,n)}))}},{key:"getLiberties",value:function(e){var t=this;if(!this.hasVertex(e)||0===this.get(e))return[];var n=this.getChain(e),o=[],i={},a=!0,s=!1,l=void 0;try{for(var u,c=n[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var h=u.value,d=this.getNeighbors(h).filter(function(e){return 0===t.get(e)});o.push.apply(o,r(d.filter(function(e){return!(e in i)}))),d.forEach(function(e){return i[e]=!0})}}catch(e){s=!0,l=e}finally{try{!a&&c.return&&c.return()}finally{if(s)throw l}}return o}},{key:"getRelatedChains",value:function(e){var t=this;return this.hasVertex(e)&&0!==this.get(e)?this.getConnectedComponent(e,[this.get(e),0]).filter(function(n){return t.get(n)===t.get(e)}):[]}},{key:"getAreaMap",value:function(){for(var e=this,t=[].concat(r(Array(this.height))).map(function(t){return Array(e.width).fill(null)}),n=0;n<this.width;n++)for(var o=0;o<this.height;o++){var a=[n,o];if(null==t[o][n])if(0===this.get(a)){var s=this.getChain(a),l=0,u=1,c=!0,h=!1,d=void 0;try{for(var f,p=s[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var v=f.value;if(0===u)break;var g=!0,m=!1,y=void 0;try{for(var b,w=this.getNeighbors(v)[Symbol.iterator]();!(g=(b=w.next()).done);g=!0){var k=b.value;if(0===u)break;if(0!==this.get(k)){var _=i(k,2),x=_[0],C=_[1];0===l?l=t[C][x]=this.get(k):l!==this.get(k)&&(u=0)}}}catch(e){m=!0,y=e}finally{try{!g&&w.return&&w.return()}finally{if(m)throw y}}}}catch(e){h=!0,d=e}finally{try{!c&&p.return&&p.return()}finally{if(h)throw d}}var S=!0,M=!1,T=void 0;try{for(var A,P=s[Symbol.iterator]();!(S=(A=P.next()).done);S=!0){var E=A.value,D=i(E,2),O=D[0],B=D[1];t[B][O]=l*u}}catch(e){M=!0,T=e}finally{try{!S&&P.return&&P.return()}finally{if(M)throw T}}}else t[o][n]=this.get(a)}return t}},{key:"getAreaEstimateMap",value:function(){for(var e=this,t=this.getAreaMap(),n=this.getNearestNeighborMap(1),r=this.getNearestNeighborMap(-1),o=this.getInfluenceMap(1),a=this.getInfluenceMap(-1),s=0;s<this.width;s++)for(var l=0;l<this.height;l++)if(0===t[l][s]){var u=Math.sign(r[l][s]-n[l][s]);(u>0&&n[l][s]>6||u<0&&r[l][s]>6||u>0&&Math.round(o[l][s])<2||u<0&&Math.round(a[l][s])<2)&&(u=0),t[l][s]=u}for(var c=0;c<this.width;c++)for(var h=0;h<this.height;h++){(function(n){var r=e.getNeighbors([c,n]);if(0===r.length)return"continue";var o=i(r[0],2),a=o[0],s=o[1],l=0===t[n][c]?t[s][a]:0;r.every(function(e){var n=i(e,2),r=n[0],o=n[1];return t[o][r]===l})&&(t[n][c]=l)})(h)}return t}},{key:"getNearestNeighborMap",value:function(e){for(var t=this,n=[].concat(r(Array(this.height))).map(function(e){return Array(t.width).fill(1/0)}),o=1/0,i=function(r,i){var a=[r,i];t.get(a)===e?o=0:0===t.get(a)?o++:o=1/0,n[i][r]=o=Math.min(o,n[i][r])},a=0;a<this.height;a++){o=1/0;for(var s=0;s<this.width;s++){var l=1/0;i(s,a),l=o;for(var u=a+1;u<this.height;u++)i(s,u);o=l;for(var c=a-1;c>=0;c--)i(s,c);o=l}}for(var h=this.height-1;h>=0;h--){o=1/0;for(var d=this.width-1;d>=0;d--){var f=1/0;i(d,h),f=o;for(var p=h+1;p<this.height;p++)i(d,p);o=f;for(var v=h-1;v>=0;v--)i(d,v);o=f}}return n}},{key:"getInfluenceMap",value:function(e){for(var t=this,n=[].concat(r(Array(this.height))).map(function(e){return Array(t.width).fill(0)}),o=[this.width,this.height],a=[],l=function(e){return t.hasVertex(e)?e:e.map(function(e,t){return e<0?-e-1:e>=o[t]?2*o[t]-e-1:e})},u=function(r,o){for(var a=r.map(function(e){return[e,0]}),u=[];a.length>0;){var c=a.shift(),h=i(c,2),d=h[0],f=h[1],p=l(d),v=i(p,2),g=v[0],m=v[1];n[m][g]+=t.hasVertex(d)?1.5/(f/o*6+1):2;var y=!0,b=!1,w=void 0;try{for(var k,_=t.getNeighbors(d,!0)[Symbol.iterator]();!(y=(k=_.next()).done);y=!0){var x=k.value;(function(n){if(f+1>o||t.get(n)===-e||u.some(function(e){return s.vertexEquals(n,e)}))return"continue";u.push(n),a.push([n,f+1])})(x)}}catch(e){b=!0,w=e}finally{try{!y&&_.return&&_.return()}finally{if(b)throw w}}}},c=0;c<this.width;c++)for(var h=0;h<this.height;h++){(function(n){var r=[c,n];if(t.get(r)!==e||a.some(function(e){return s.vertexEquals(r,e)}))return"continue";var o=t.getChain(r);o.forEach(function(e){return a.push(e)}),u(o,6)})(h)}return n}},{key:"getScore",value:function(e){for(var t={area:[0,0],territory:[0,0],captures:this.captures},n=0;n<this.width;n++)for(var r=0;r<this.height;r++){var o=e[r][n];if(0!==o){var i=o>0?0:1;t.area[i]++,0===this.get([n,r])&&t.territory[i]++}}return t}},{key:"vertex2coord",value:function(e){return this.hasVertex(e)?l[e[0]]+(this.height-e[1]):null}},{key:"coord2vertex",value:function(e){return[l.indexOf(e[0].toUpperCase()),this.height-+e.substr(1)]}},{key:"isValid",value:function(){for(var e={},t=0;t<this.width;t++)for(var n=0;n<this.height;n++){var r=[t,n];if(!(0===this.get(r)||r in e)){if(!this.hasLiberties(r))return!1;this.getChain(r).forEach(function(t){return e[t]=!0})}}return!0}},{key:"makeMove",value:function(e,t){var n=this.clone();if(0===e||!this.hasVertex(t))return n;e=e>0?1:-1,n.set(t,e);var r=n.getNeighbors(t).filter(function(t){return n.get(t)===-e&&!n.hasLiberties(t)}),o=!0,i=!1,a=void 0;try{for(var s,l=r[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value;if(0!==n.get(u)){var c=!0,h=!1,d=void 0;try{for(var f,p=n.getChain(u)[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var v=f.value;n.set(v,0),n.captures[(1-e)/2]++}}catch(e){h=!0,d=e}finally{try{!c&&p.return&&p.return()}finally{if(h)throw d}}}}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}if(n.set(t,e),0===r.length&&!n.hasLiberties(t)){var g=!0,m=!1,y=void 0;try{for(var b,w=n.getChain(t)[Symbol.iterator]();!(g=(b=w.next()).done);g=!0){var k=b.value;n.set(k,0),n.captures[(e+1)/2]++}}catch(e){m=!0,y=e}finally{try{!g&&w.return&&w.return()}finally{if(m)throw y}}}return n}},{key:"getHandicapPlacement",value:function(e){if(Math.min(this.width,this.height)<6||e<2)return[];var t=this.width>=13?3:2,n=this.height>=13?3:2,r=this.width-t-1,o=this.height-n-1,i=[[t,o],[r,n],[t,n],[r,o]],a=(this.width-1)/2,s=(this.height-1)/2;return this.width%2!=0&&this.height%2!=0?(5===e&&i.push([a,s]),i.push([t,s],[r,s]),7===e&&i.push([a,s]),i.push([a,n],[a,o],[a,s])):this.width%2!=0?i.push([a,n],[a,o]):this.height%2!=0&&i.push([t,s],[r,s]),i.slice(0,e)}},{key:"generateAscii",value:function(){var e=this,t=[],n=s.linebreak,r=function(t){var n=i(t,2),r=n[0],o=n[1],a=4+2*e.width;return a+a*o+1+2*r+1};t.push("+");for(var o=0;o<this.width;o++)t.push("-","-");t.push("-","+",n);for(var a=0;a<this.height;a++){t.push("|");for(var l=0;l<this.width;l++)t.push(" ",".");t.push(" ","|",n)}t.push("+");for(var u=0;u<this.width;u++)t.push("-","-");t.push("-","+",n),this.getHandicapPlacement(9).forEach(function(e){return t[r(e)]=","});for(var c={plain:["O",null,"X"],circle:["W","C","B"],square:["@","S","#"],triangle:["Q","T","Y"],cross:["P","M","Z"],label:null},h=0;h<this.width;h++)for(var d=0;d<this.height;d++){var f=[h,d],p=r(f),v=this.get(f);if(this.markups[f]&&this.markups[f][0]in c){var g=i(this.markups[f],2),m=g[0],y=g[1];"label"!==m?t[p]=c[m][v+1]:0===v&&1===y.length&&isNaN(parseFloat(y))&&(t[p]=y.toLowerCase())}else 0!==v&&(t[p]=c.plain[v+1])}t=t.join("");var b=!0,w=!1,k=void 0;try{for(var _,x=this.lines[Symbol.iterator]();!(b=(_=x.next()).done);b=!0){var C=_.value,S=i(C,3),M=S[0],T=S[1],A=S[2];t+="{"+(A?"AR":"LN")+" "+this.vertex2coord(M)+" "+this.vertex2coord(T)+"}"+n}}catch(e){w=!0,k=e}finally{try{!b&&x.return&&x.return()}finally{if(w)throw k}}return(n+t.trim()).split(n).map(function(e){return"$$ "+e}).join(n)}},{key:"getPositionHash",value:function(){return s.hash(JSON.stringify(this.arrangement))}},{key:"getHash",value:function(){return s.hash(JSON.stringify([this.getPositionHash(),this.captures,this.markups,this.ghosts,this.lines]))}}]),e}();e.exports=u},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return o.exec(e).slice(1)};t.resolve=function(){for(var t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a=i>=0?arguments[i]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,o="/"===a.charAt(0))}return t=n(r(t.split("/"),function(e){return!!e}),!o).join("/"),(o?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),i="/"===a(e,-1);return e=n(r(e.split("/"),function(e){return!!e}),!o).join("/"),e||o||(e="."),e&&i&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var o=r(e.split("/")),i=r(n.split("/")),a=Math.min(o.length,i.length),s=a,l=0;l<a;l++)if(o[l]!==i[l]){s=l;break}for(var u=[],l=s;l<o.length;l++)u.push("..");return u=u.concat(i.slice(s)),u.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},t.basename=function(e,t){var n=i(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){return i(e)[3]};var a="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(t,n(10))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(h===clearTimeout)return clearTimeout(e);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function a(){v&&f&&(v=!1,f.length?p=f.concat(p):g=-1,p.length&&s())}function s(){if(!v){var e=o(a);v=!0;for(var t=p.length;t;){for(f=p,p=[];++g<t;)f&&f[g].run();g=-1,t=p.length}f=null,v=!1,i(e)}}function l(e,t){this.fun=e,this.array=t}function u(){}var c,h,d=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(e){h=r}}();var f,p=[],v=!1,g=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new l(e,t)),1!==p.length||v||o(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=u,d.addListener=u,d.once=u,d.off=u,d.removeListener=u,d.removeAllListeners=u,d.emit=u,d.prependListener=u,d.prependOnceListener=u,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(3),h=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.onCloseButtonClick=function(){return sabaki.setMode("play")},e}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return e.mode!==this.props.mode||e.mode===e.type}},{key:"render",value:function(e){var t=e.children,n=e.type,r=e.mode,o=e.class;return l("section",{id:n,class:c(void 0===o?"":o,{bar:!0,current:n===r})},t,l("a",{class:"close",href:"#",onClick:this.onCloseButtonClick}))}}]),t}(u);e.exports=h},function(e,t,n){function r(e){for(var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.noop,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0],f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,p=n(14),v=d[0],g=a.new(),m=void 0,y=void 0,b=void 0;v<e.length;){var w=o(e[v],2),k=w[0],_=w[1];if("parenthesis"===k&&"("===_)break;if("parenthesis"===k&&")"===_)return g;if("semicolon"===k)m={},g.nodes.push(m);else if("prop_ident"===k)""!==(b=_.split("").filter(function(e){return e.toUpperCase()===e}).join(""))&&(b in m||(m[b]=[]),y=m[b]);else if("c_value_type"===k){if(_=t.unescapeString(_.substr(1,_.length-2)),null!==h)if("CA"===b&&_!==u&&p.encodingExists(_)){h=_;for(var x in m)c.includes(x)&&(m[x]=m[x].map(function(e){return p.decode(i.from(e,"binary"),h)}))}else if(c.includes(b)&&h!==u){var C=p.decode(i.from(_,"binary"),h);_=C}y.push(_)}d[0]=++v}for(;v<e.length;){var S=o(e[v],2),M=S[0],T=S[1];if("parenthesis"===M&&"("===T){d[0]=v+1;var A=r(e,l,h,d,f+Math.min(g.subtrees.length,1));A.nodes.length>0&&(A.parent=g,g.subtrees.push(A),g.current=0),v=d[0]}else if("parenthesis"===M&&")"===T){d[0]=v,l({progress:v/e.length});break}v++}return g}var o=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(13),a=(n(5),n(4)),s=n(1),l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",u="ISO-8859-1",c=["C","N","AN","BR","BT","CP","DT","EV","GN","ON","OT","PB","PC","PW","RE","RO","RU","SO","US","WR","WT","GC"];t.meta={name:"Smart Game Format",extensions:["sgf"]},t.tokenize=function(e){e=s.normalizeEndings(e);for(var t=[],n={ignore:/^\s+/,parenthesis:/^(\(|\))/,semicolon:/^;/,prop_ident:/^[A-Za-z]+/,c_value_type:/^\[([^\\\]]|\\[^])*\]/};e.length>0;){var r=null,o=1;for(var i in n){var a=n[i].exec(e);if(a){var l=a[0];o=l.length,r=[i,l];break}}r&&"ignore"!==r[0]&&t.push(r),e=e.substr(o)}return t},t.parseTokens=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,o=r(e,t,n);return o.subtrees.forEach(function(e){return e.parent=null}),o.subtrees},t.parse=function(e,r){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t.tokenize(e),a=o?null:u;if(!o){var l=!1,c=!0,h=!1,d=void 0;try{for(var f,p=i[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var v=f.value;if(s.vertexEquals(v,["prop_ident","CA"])){l=!0;break}}}catch(e){h=!0,d=e}finally{try{!c&&p.return&&p.return()}finally{if(h)throw d}}if(!l){var g=n(15),m=g.detect(e);m.confidence>.2&&(a=m.encoding)}}return t.parseTokens(i,r,a)},t.parseFile=function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]},t.string2dates=function(e){if(!e.match(/^(\d{4}(-\d{1,2}(-\d{1,2})?)?(\s*,\s*(\d{4}|(\d{4}-)?\d{1,2}(-\d{1,2})?))*)?$/))return null;if(""===e.trim())return[];for(var t=e.split(",").map(function(e){return e.trim().split("-")}),n=1;n<t.length;n++){var r=t[n],o=t[n-1];4!==r[0].length&&(1===r.length&&3===o.length&&r.unshift(o[1]),r.unshift(o[0]))}return t.map(function(e){return e.map(function(e){return+e})})},t.dates2string=function(e){if(0===e.length)return"";for(var t=[e[0].slice()],n=1;n<e.length;n++){for(var r=e[n],o=e[n-1],i=0,a=0;a<r.length&&(r[a]===o[a]&&i===a);a++)i++;t.push(r.slice(i))}return t.map(function(e){return e.map(function(e){return e>9?""+e:"0"+e}).join("-")}).join(",")},t.point2vertex=function(e){return 2!==e.length?[-1,-1]:e.split("").map(function(e){return l.indexOf(e)})},t.vertex2point=function(e){var t=o(e,2),n=t[0],r=t[1];return Math.min(n,r)<0||Math.max(n,r)>=l.length?"":l[n]+l[r]},t.compressed2list=function(e){var n=e.indexOf(":");if(n<0)return[t.point2vertex(e)];for(var r=t.point2vertex(e.slice(0,n)),o=t.point2vertex(e.slice(n+1)),i=[],a=Math.min(r[0],o[0]);a<=Math.max(r[0],o[0]);a++)for(var s=Math.min(r[1],o[1]);s<=Math.max(r[1],o[1]);s++)i.push([a,s]);return i},t.stringify=function(e){if("[object Array]"===Object.prototype.toString.call(e))return t.stringify({nodes:[],subtrees:e});var n="",r=!0,o=!1,i=void 0;try{for(var a,l=e.nodes[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;n+=";";for(var c in u)c.toUpperCase()===c&&(n+=c+"["+u[c].map(t.escapeString).join("][")+"]");n+=s.linebreak}}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}var h=!0,d=!1,f=void 0;try{for(var p,v=e.subtrees[Symbol.iterator]();!(h=(p=v.next()).done);h=!0){var g=p.value;n+="("+t.stringify(g)+")"}}catch(e){d=!0,f=e}finally{try{!h&&v.return&&v.return()}finally{if(d)throw f}}return n},t.escapeString=function(e){return e.toString().replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\n\n+/g,"\n\n").replace(/\n/g,s.linebreak)},t.unescapeString=function(e){var t=[],n=!1;e=s.normalizeEndings(e);for(var r=0;r<e.length;r++)n?("\n"!==e[r]&&t.push(e[r]),n=!1):"\\"!==e[r]?t.push(e[r]):"\\"===e[r]&&(n=!0);return t.join("")}},function(e,t){e.exports={from:function(e){return e}}},function(e,t){e.exports={encodingExists:function(){return!1},decode:function(e){return e}}},function(e,t){e.exports={detect:function(){return{confidence:1,encoding:"utf8"}}}},function(e,t){e.exports=[]},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(3),h=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"render",value:function(e){var t=e.type,n=e.show,r=e.children;return l("section",{id:t,class:c({drawer:!0,show:n})},r)}}]),t}(u);e.exports=h},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function i(e){return"object"===(void 0===e?"undefined":s(e))&&null!==e}function a(e){return void 0===e}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),u=n.slice(),o=u.length,l=0;l<o;l++)u[l].apply(this,s);return!0},n.prototype.addListener=function(e,t){var o;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(o=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&o>0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var o=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(7),a=i.sgf,s=null,l=function(e){return function(t){return t[0]===e[0]&&t[1]===e[1]}};t.getSymmetries=function(e){var t=o(e,2),n=t[0],i=t[1],a=function(e){var t=o(e,2),n=t[0],r=t[1];return[[n,r],[-n,r],[n,-r],[-n,-r]]};return[].concat(r(a([n,i])),r(a([i,n])))},t.getBoardSymmetries=function(e,n){var r=e.width-1,i=e.height-1,a=function(e,t){return(e%t+t)%t};return t.getSymmetries(n).map(function(e){var t=o(e,2),n=t[0],s=t[1];return[a(n,r),a(s,i)]})},t.readShapes=function(e){for(var t=a.parse(e,function(){},!0)[0],n=[],i=0;i<t.subtrees.length;i++)!function(e){var i=t.subtrees[e].nodes[0],s=i.MA.map(function(e){return[].concat(r(a.point2vertex(e)),[i.AB.includes(e)?1:-1])}),l=["AW","CR","AB"].map(function(e,t){return(i[e]||[]).map(function(e){return[].concat(r(a.point2vertex(e)),[t-1])})}).reduce(function(e,t){return[].concat(r(e),r(t))},[]),u={};if("C"in i){var c=!0,h=!1,d=void 0;try{for(var f,p=i.C[0].trim().split(", ").map(function(e){return e.split(": ")})[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var v=f.value,g=o(v,2),m=g[0],y=g[1];u[m]=y}}catch(e){h=!0,d=e}finally{try{!c&&p.return&&p.return()}finally{if(h)throw d}}}n.push(Object.assign({name:i.N[0],anchors:s,vertices:l},u))}(i);return n},t.cornerMatch=function(e,n){var i=Array(8).fill(!0),a=Array(8).fill(!0),s=!0,l=!1,u=void 0;try{for(var c,h=e[Symbol.iterator]();!(s=(c=h.next()).done);s=!0){for(var d=c.value,f=o(d,3),p=f[0],v=f[1],g=f[2],m=t.getBoardSymmetries(n,[p,v]),y=0;y<i.length;y++)i[y]&&n.get(m[y])!==g&&(i[y]=!1),a[y]&&n.get(m[y])!==-g&&(a[y]=!1);if(!i.includes(!0)&&!a.includes(!0))return null}}catch(e){l=!0,u=e}finally{try{!s&&h.return&&h.return()}finally{if(l)throw u}}var b=[].concat(r(i),r(a)).indexOf(!0);return b<8?[b,!1]:[b-8,!0]},t.shapeMatch=function(e,n,r){if(!n.hasVertex(r))return null;var i=n.get(r);if(0===i)return null;var a=l(r),s=!0,u=!1,c=void 0;try{for(var h,d=e.anchors[Symbol.iterator]();!(s=(h=d.next()).done);s=!0){var f=h.value,p=Array(8).fill(!0),v=0;if((null==e.size||n.width===n.height&&n.width===+e.size)&&("corner"!==e.type||t.getBoardSymmetries(n,f.slice(0,2)).some(a))){var g=!0,m=!1,y=void 0;try{for(var b,w=e.vertices[Symbol.iterator]();!(g=(b=w.next()).done);g=!0){for(var k=b.value,_=o(k,3),x=_[0],C=_[1],S=_[2],M=[x-f[0],C-f[1]],T=t.getSymmetries(M),A=0;A<T.length;A++)if(p[A]){var P=[r[0]+T[A][0],r[1]+T[A][1]];n.hasVertex(P)&&n.get(P)===S*i*f[2]||(p[A]=!1)}if((v=p.indexOf(!0))<0)break}}catch(e){m=!0,y=e}finally{try{!g&&w.return&&w.return()}finally{if(m)throw y}}if(v>=0)return[v,i!==f[2]]}}}catch(e){u=!0,c=e}finally{try{!s&&d.return&&d.return()}finally{if(u)throw c}}return null},t.getMoveInterpretation=function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.shapes,a=void 0===i?null:i;if(!e.hasVertex(r))return"Pass";var u=e.get(r),c=e.getNeighbors(r);if(c.some(function(t){return e.get(t)===-u&&1===e.getLiberties(t).length}))return"Atari";var h=c.filter(function(t){return e.get(t)===u});if(h.length===c.length)return"Fill";if(h.length>=2)return"Connect";null==a&&(null==s&&(s=t.readShapes(n(42))),a=s);var d=!0,f=!1,p=void 0;try{for(var v,g=a[Symbol.iterator]();!(d=(v=g.next()).done);d=!0){var m=v.value;if(t.shapeMatch(m,e,r))return m.name}}catch(e){f=!0,p=e}finally{try{!d&&g.return&&g.return()}finally{if(f)throw p}}var y=l(r);if(y([(e.width-1)/2,(e.height-1)/2]))return"Tengen";var b=e.getCanonicalVertex(r).map(function(e){return e+1});return!l(b)([4,4])&&e.getHandicapPlacement(9).some(y)?"Hoshi":b[1]<=6?b.join("-")+" point":null}},function(e,t,n){var r=n(0),o=r.h,i=r.render,a=n(1),s={opacity:0,pointerEvents:"none"},l=i(o("input",{type:"file",style:s}),document.body);t.showMessageBox=function(e){var t=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:["OK"]),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.length<=1?(alert(e),0):confirm(e)?0:n},t.showOpenDialog=function(e,t){var n=l.cloneNode();l.parentNode.replaceChild(n,l),l=n,l.multiple=e.properties.includes("multiSelections"),l.value="",l.addEventListener("change",function(e){t({result:e.currentTarget.files})}),l.click()},t.showSaveDialog=function(e,t){var n=e.type,r=e.name,a=e.content,l="data:"+n+";charset=utf-8,"+encodeURIComponent(a),u=i(o("a",{href:l,style:s,download:r}),document.body);u.click(),u.remove()},t.showInputBox=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.noop,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.noop;sabaki.setState({inputBoxText:e,showInputBox:!0,onInputBoxSubmit:t,onInputBoxCancel:n})},t.closeInputBox=function(){var e=sabaki.state.onInputBoxCancel,t=void 0===e?a.noop:e;sabaki.setState({showInputBox:!1}),t()}},function(e,t){function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e){var t=u(e,2),n=t[0],r=t[1];return[[n-1,r],[n+1,r],[n,r-1],[n,r+1]]}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;null==n&&(n=[t]),null==i&&(i=e.get(t));for(var a=r(t),s=0;s<a.length;s++){var l=a[s];e.get(l)!==i||n.some(c(l))||(n.push(l),o(e,l,n,i))}return n}function i(e,t){return!r(t).some(h(e,e.get(t)))}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;null==o&&(o=e.get(t));for(var i=r(t),s=[],l=0;l<i.length;l++){var u=i[l],h=e.get(u);if(0===h)return!0;h===o&&s.push(u)}n.push(t);for(var d=0;d<s.length;d++){var f=s[d];if(!n.some(c(f))&&a(e,f,n,o))return!0}return!1}function s(e,t,s){var l=r(s),u=!1,c=!1;if(l.every(h(e,t,void 0)))return null;if(e.set(s,t),!a(e,s)){if(!l.some(h(e,-t)))return e.set(s,0),null;i(e,s)?c=!0:u=!0}for(var d=[],f=0,p=0;p<l.length;p++){var v=l[p];if(e.get(v)===-t&&!a(e,v)){var g=o(e,v);d.push.apply(d,n(g)),f++;for(var m=0;m<g.length;m++)e.set(g[m],0)}}if(c&&f<=1){for(var y=0;y<d.length;y++)e.set(d[y],-t);return e.set(s,0),null}return u&&0===d.length?(e.set(s,0),null):d}function l(e){for(var t=0;t<e.width;t++)for(var n=0;n<e.height;n++){var o=[t,n];if(0===e.get(o)){for(var i=r(o),a=0,s=!0,l=1;l<i.length;l++){var u=i[l],c=e.get(u);if(null!=c&&c!==a){if(0!==a){s=!1;break}a=c}}s&&e.set(o,a)}}return e}var u=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e){return function(t){return t[0]===e[0]&&t[1]===e[1]}},h=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(t){return n.includes(e.get(t))}};t.guess=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,a=e.clone();if(r){t.getFloatingStones(a).forEach(function(e){return a.set(e,0)})}for(var s=t.getProbabilityMap(a,i),l=[],h=[],d=0;d<e.width;d++)for(var f=0;f<e.height;f++){var p=[d,f],v=e.get(p);if(0!==v&&!l.some(c(p))){var g=o(e,p),m=g.map(function(e){var t=u(e,2),n=t[0],r=t[1];return s[r][n]}).reduce(function(e,t){return e+t})/g.length,y=m<.5?-1:m>.5?1:0;y===-v&&h.push.apply(h,n(g)),l.push(p)}}if(!r)return h;l.length=0;var b=[],w=!0,k=!1,_=void 0;try{for(var x,C=h[Symbol.iterator]();!(w=(x=C.next()).done);w=!0){var S=x.value;if(!l.some(c(S))){var M=e.getRelatedChains(S);M.filter(function(e){return h.some(c(e))}).length/M.length>.5&&b.push.apply(b,n(M)),l.push.apply(l,n(M))}}}catch(e){k=!0,_=e}finally{try{!w&&C.return&&C.return()}finally{if(k)throw _}}return b},t.getFloatingStones=function(e){for(var t=e.getAreaMap(),r=[],i=[],a=function(t){return-1===e.get(t)},s=function(t){return 1===e.get(t)},l=function(e){return r.push(e)},u=0;u<e.width;u++)for(var h=0;h<e.height;h++){(function(h){var d=[u,h];if(0!==t[h][u]||r.some(c(d)))return"continue";var f=e.getConnectedComponent(d,[0,-1]),p=e.getConnectedComponent(d,[0,1]),v=f.filter(a),g=p.filter(s),m=f.filter(function(e){return!v.some(c(e))&&!p.some(c(e))}),y=p.filter(function(e){return!g.some(c(e))&&!f.some(c(e))}),b=0,w=void 0,k=void 0;y.length<=1&&g.length<=v.length&&(b--,w=p,k=g),m.length<=1&&v.length<=g.length&&(b++,w=f,k=v),0===b&&(w=o(e,d),k=[]),w.forEach(l),i.push.apply(i,n(k))})(h)}return i},t.playTillEnd=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0;e=e.clone();for(var o=[],i=[],a=0;a<e.width;a++)for(var l=0;l<e.height;l++)0===e.get([a,l])&&o.push([a,l]);for(var u=[!1,!1];r>0&&o.length>0&&u.includes(!1);){for(var c=!1;o.length>0;){var h=Math.floor(Math.random()*o.length),d=o[h],f=s(e,t,d);if(o.splice(h,1),null!=f){o.push.apply(o,n(f)),u[-t>0?0:1]=!1,c=!0;break}i.push(d)}u[t>0?0:1]=!c,o.push.apply(o,i),i.length=0,t=-t,r--}return e},t.getProbabilityMap=function(e,r){for(var o=[].concat(n(Array(e.height))).map(function(t){return Array(e.width).fill(0)}),i=[].concat(n(Array(e.height))).map(function(t){return Array(e.width).fill(0)}),a=[].concat(n(Array(e.height))).map(function(t){return Array(e.width).fill(.5)}),s=0;s<r;s++)for(var u=Math.sign(Math.random()-.5),c=l(t.playTillEnd(e,u)),h=0;h<c.width;h++)for(var d=0;d<c.height;d++){var f=c.get([h,d]);f<0?i[d][h]++:f>0&&o[d][h]++}for(var p=0;p<e.width;p++)for(var v=0;v<e.height;v++)o[v][p]+i[v][p]!==0&&(a[v][p]=o[v][p]/(o[v][p]+i[v][p]));return a}},function(e,t,n){(function(e){function t(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),c=n(18),h=n(2),d=h.ipcRenderer,f=h.remote,p=f.app,v=(f.Menu,n(0)),g=v.h,m=v.render,y=v.Component,b=n(3),w=n(6),k=n(29),_=n(6),x=n(37),C=n(43),S=n(52),M=n(53),T=n(54),A=n(8),P=n(20),E=n(22),D=n(21),O=n(7),B=n(4),j=n(16),R=n(1),N=f.require("./setting"),q=O.sgf,L=n(55),I=function(h){function v(){o(this,v);var e=i(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));window.sabaki=e;var t=B.new();return t.nodes.push({}),e.state={mode:"play",openDrawer:null,busy:!1,fullScreen:!1,showMenuBar:null,zoomFactor:null,representedFilename:null,gameTrees:[t],treePosition:[t,0],undoable:!1,undoText:"Undo",selectedTool:"stone_1",scoringMethod:null,findText:"",findVertex:null,deadStones:[],blockedGuesses:[],highlightVertices:[],showCoordinates:null,showMoveColorization:null,showNextMoves:null,showSiblings:null,fuzzyStonePlacement:null,animatedStonePlacement:null,animatedVertex:null,consoleLog:[],showConsole:N.get("view.show_leftsidebar"),leftSidebarWidth:N.get("view.leftsidebar_width"),showGameGraph:N.get("view.show_graph"),showCommentBox:N.get("view.show_comments"),sidebarWidth:N.get("view.sidebar_width"),graphGridSize:null,graphNodeSize:null,engines:null,attachedEngines:[null,null],engineCommands:[[],[]],generatingMoves:!1,preferencesTab:"general",showInputBox:!1,inputBoxText:"",onInputBoxSubmit:R.noop,onInputBoxCancel:R.noop,infoOverlayText:"",showInfoOverlay:!1},e.events=new c,e.appName=p.getName(),e.version=p.getVersion(),e.window=f.getCurrentWindow(),e.treeHash=e.generateTreeHash(),e.attachedEngineControllers=[null,null],e.engineBoards=[null,null],e.modules={Board:A,boardmatcher:P,deadstones:E,dialog:D,fileformats:O,gametree:B,gtp:j,helper:R,setting:N,sound:L},N.events.on("change",function(t){var n=t.key;return e.updateSettingState(n)}),e.updateSettingState(),e}return a(v,h),l(v,[{key:"componentDidMount",value:function(){var e=this;window.addEventListener("contextmenu",function(e){e.preventDefault()}),window.addEventListener("load",function(){e.events.emit("ready"),e.window.show()}),d.on("load-file",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];setTimeout(function(){return e.loadFile.apply(e,r)},N.get("app.loadgame_delay"))}),this.window.on("focus",function(){N.get("file.show_reload_warning")&&e.askForReload(),d.send("build-menu",e.state.busy)}),this.window.on("resize",function(){clearTimeout(e.resizeId),e.resizeId=setTimeout(function(){if(!e.window.isMaximized()&&!e.window.isMinimized()&&!e.window.isFullScreen()){var t=e.window.getContentSize(),n=s(t,2),r=n[0],o=n[1];N.set("window.width",r).set("window.height",o)}},1e3)});var t=n(16);!function t(n){var r=!0,o=!1,i=void 0;try{for(var a,s=n[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;!function(n){"click"in n&&d.on("menu-click-"+n.id,function(){e.state.showMenuBar||e.window.setMenuBarVisibility(!1),D.closeInputBox(),n.click()}),"submenu"in n&&t(n.submenu)}(l)}}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}}(t);var r=!0,o=!1,i=void 0;try{for(var a,l=document.querySelectorAll("#main main, #graph")[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){a.value.addEventListener("wheel",function(t){t.preventDefault(),null==e.residueDeltaY&&(e.residueDeltaY=0),e.residueDeltaY+=t.deltaY,Math.abs(e.residueDeltaY)>=N.get("game.navigation_sensitivity")&&(e.goStep(Math.sign(e.residueDeltaY)),e.residueDeltaY=0)})}}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}document.body.addEventListener("dragover",function(e){return e.preventDefault()}),document.body.addEventListener("drop",function(t){t.preventDefault(),0!==t.dataTransfer.files.length&&e.loadFile(t.dataTransfer.files[0])}),document.addEventListener("keyup",function(t){27===t.keyCode&&(e.state.generatingMoves?e.stopGeneratingMoves():null!=e.state.openDrawer?e.closeDrawer():"play"!==e.state.mode?e.setMode("play"):e.state.fullScreen&&e.setState({fullScreen:!1}))}),document.addEventListener("keydown",function(t){["input","textarea"].indexOf(document.activeElement.tagName.toLowerCase())>=0||(36==t.keyCode?e.goToBeginning():35==t.keyCode?e.goToEnd():38==t.keyCode?e.goStep(-1):40==t.keyCode?e.goStep(1):37==t.keyCode?e.goToSiblingVariation(-1):39==t.keyCode&&e.goToSiblingVariation(1))}),window.addEventListener("beforeunload",function(e){e.returnValue=" "}),this.newFile()}},{key:"componentDidUpdate",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n(9),i=o.basename,a=this.appName,l=this.state,u=l.representedFilename,c=l.gameTrees,h=s(l.treePosition,1);h[0];if(u&&(a=i(u)),c.length>1&&(a+=" — Game "+(this.inferredState.gameIndex+1)),u&&"darwin"!=e.platform&&(a+=" — "+this.appName),document.title!==a&&(document.title=a),r.fullScreen!==this.state.fullScreen&&(this.state.fullScreen&&this.flashInfoOverlay("Press Esc to exit full screen mode"),this.window.setFullScreen(this.state.fullScreen)),r.showMenuBar!==this.state.showMenuBar&&(this.state.showMenuBar||this.flashInfoOverlay("Press Alt to show menu bar"),this.window.setMenuBarVisibility(this.state.showMenuBar),this.window.setAutoHideMenuBar(!this.state.showMenuBar)),r.showLeftSidebar!==this.state.showLeftSidebar||r.showSidebar!==this.state.showSidebar){var d=this.window.getContentSize(),f=s(d,2),p=f[0],v=f[1],g=0;r.showSidebar!==this.state.showSidebar&&(g+=this.state.sidebarWidth*(this.state.showSidebar?1:-1)),r.showLeftSidebar!==this.state.showLeftSidebar&&(g+=this.state.leftSidebarWidth*(this.state.showLeftSidebar?1:-1)),this.window.isMaximized()||this.window.isMinimized()||this.window.isFullScreen()||this.window.setContentSize(p+g,v)}r.zoomFactor!==this.state.zoomFactor&&this.window.webContents.setZoomFactor(this.state.zoomFactor)}},{key:"updateSettingState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t={"app.zoom_factor":"zoomFactor","view.show_menubar":"showMenuBar","view.show_coordinates":"showCoordinates","view.show_move_colorization":"showMoveColorization","view.show_next_moves":"showNextMoves","view.show_siblings":"showSiblings","view.fuzzy_stone_placement":"fuzzyStonePlacement","view.animated_stone_placement":"animatedStonePlacement","graph.grid_size":"graphGridSize","graph.node_size":"graphNodeSize","engines.list":"engines","scoring.method":"scoringMethod"};if(null!=e)e in t&&(d.send("build-menu",this.state.busy),this.setState(r({},t[e],N.get(e))));else for(var n in t)this.updateSettingState(n)}},{key:"setSidebarWidth",value:function(e){this.setState({sidebarWidth:e},function(){return window.dispatchEvent(new Event("resize"))})}},{key:"setLeftSidebarWidth",value:function(e){this.setState({leftSidebarWidth:e},function(){return window.dispatchEvent(new Event("resize"))})}},{key:"setMode",value:function(e){var r={mode:e};if(["scoring","estimator"].includes(e)){var o=n(22),i=o.guess,a=this.state.treePosition,s=N.get("score.estimator_iterations"),l=i(B.getBoard.apply(B,t(a)),"scoring"===e,s);Object.assign(r,{deadStones:l})}this.setState(r),this.events.emit("modeChange")}},{key:"openDrawer",value:function(e){this.setState({openDrawer:e})}},{key:"closeDrawer",value:function(){document.activeElement.blur(),this.openDrawer(null)}},{key:"setBusy",value:function(e){this.setState({busy:e})}},{key:"showInfoOverlay",value:function(e){this.setState({infoOverlayText:e,showInfoOverlay:!0})}},{key:"hideInfoOverlay",value:function(){this.setState({showInfoOverlay:!1})}},{key:"flashInfoOverlay",value:function(e){var t=this;this.showInfoOverlay(e),setTimeout(function(){return t.hideInfoOverlay()},N.get("infooverlay.duration"))}},{key:"getEmptyGameTree",value:function(){var e=N.get("game.default_handicap"),t=N.get("game.default_board_size").toString().split(":").map(function(e){return+e}),n=[t[0],t.slice(-1)[0]],r=n[0],o=n[1],i=new A(r,o).getHandicapPlacement(e).map(q.vertex2point),a=r===o?r.toString():r+":"+o,s=i.length>0?"HA["+e+"]AB["+i.join("][")+"]":"",l=new Date,u=q.dates2string([[l.getFullYear(),l.getMonth()+1,l.getDate()]]);return q.parse("\n (;GM[1]FF[4]CA[UTF-8]AP["+this.appName+":"+this.version+"]\n KM["+N.get("game.default_komi")+"]\n SZ["+a+"]DT["+u+"]\n "+s+")\n ")[0]}},{key:"newFile",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.playSound,r=void 0!==n&&n,o=t.showInfo,i=void 0!==o&&o,a=t.suppressAskForSave;(void 0!==a&&a||this.askForSave())&&(i&&"info"===this.state.openDrawer&&this.closeDrawer(),this.setMode("play"),this.clearUndoPoint(),this.detachEngines(),this.setState(this.state,function(){var t=e.getEmptyGameTree();e.setState({openDrawer:i?"info":null,gameTrees:[t],treePosition:[t,0],representedFilename:null}),e.treeHash=e.generateTreeHash(),e.fileHash=e.generateFileHash(),r&&L.playNewGame()}))}},{key:"loadFile",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.suppressAskForSave;if(void 0!==i&&i||this.askForSave()){if(!r)return void D.showOpenDialog({properties:["openFile"],filters:[].concat(t(O.meta),[{name:"All Files",extensions:["*"]}])},function(t){var n=t.result;n&&(r=n[0]),r&&e.loadFile(r,{suppressAskForSave:!0})});var a=n(9),s=a.extname,l=s(r.name).slice(1);u.readFile(r,function(t,n){e.loadContent(n,l,{suppressAskForSave:!0,callback:function(t){t||(e.setState({representedFilename:r.name}),e.fileHash=e.generateFileHash(),N.get("game.goto_end_after_loading")&&e.goToEnd())}})})}}},{key:"loadContent",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.suppressAskForSave,i=void 0!==o&&o,a=r.ignoreEncoding,s=void 0!==a&&a,l=r.callback,u=void 0===l?R.noop:l;(i||this.askForSave())&&(this.setBusy(!0),"gamechooser"!==this.state.openDrawer&&this.closeDrawer(),this.setMode("play"),setTimeout(function(){var r=-1,o=!1,i=[];try{if(i=O.getModuleByExtension(t).parse(e,function(e){e.progress-r<.1||(n.window.setProgressBar(e.progress),r=e.progress)},s),0==i.length)throw!0}catch(e){D.showMessageBox("This file is unreadable.","warning"),o=!0}0!=i.length&&(n.clearUndoPoint(),n.detachEngines(),n.setState({representedFilename:null,gameTrees:i,treePosition:[i[0],0]}),n.treeHash=n.generateTreeHash(),n.fileHash=n.generateFileHash()),n.setBusy(!1),i.length>1&&setTimeout(function(){n.openDrawer("gamechooser")},N.get("gamechooser.show_delay")),n.window.setProgressBar(-1),u(o),o||n.events.emit("fileLoad")},N.get("app.loadgame_delay")))}},{key:"saveFile",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return D.showSaveDialog({type:"application/x-go-sgf",name:this.state.representedFilename||"game.sgf",content:this.getSGF()}),this.treeHash=this.generateTreeHash(),this.fileHash=this.generateFileHash(),!0}},{key:"getSGF",value:function(){var e=this.state.gameTrees,t=!0,n=!1,r=void 0;try{for(var o,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;Object.assign(a.nodes[0],{AP:[this.appName+":"+this.version],CA:["UTF-8"]})}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}return q.stringify(e)}},{key:"generateTreeHash",value:function(){return this.state.gameTrees.map(function(e){return B.getHash(e)}).join("")}},{key:"generateFileHash",value:function(){}},{key:"askForSave",value:function(){if(this.generateTreeHash()!==this.treeHash){var e=D.showMessageBox("Your changes will be lost if you close this file without saving. Do you want to continue?","warning",["Save","Don’t Save","Cancel"],2);if(0===e)return!0;if(2===e)return!1}return!0}},{key:"askForReload",value:function(){}},{key:"clickVertex",value:function(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.button,i=void 0===o?0:o,a=r.ctrlKey,l=void 0!==a&&a,u=r.x,c=void 0===u?0:u,h=r.y,d=void 0===h?0:h;this.closeDrawer();var f=s(this.state.treePosition,2),p=f[0],v=f[1],g=B.getBoard(p,v),m=p.nodes[v];if("string"==typeof e&&(e=g.coord2vertex(e)),["play","autoplay"].includes(this.state.mode))0===i?0===g.get(e)?this.makeMove(e,{sendToEngine:!0}):e in g.markups&&"point"===g.markups[e][0]&&N.get("edit.click_currentvertex_to_remove")&&this.removeNode(p,v):2===i&&e in g.markups&&"point"===g.markups[e][0]&&this.openCommentMenu(p,v,{x:c,y:d});else if("edit"===this.state.mode){if(l){var y=g.vertex2coord(e),b=m.C?m.C[0]:"";return void(m.C=""!==b?[b.trim()+" "+y]:[y])}var w=this.state.selectedTool;if(2===i)if(["stone_1","stone_-1"].includes(w))w="stone_1"===w?"stone_-1":"stone_1";else if(["number","label"].includes(w)){var k=function(){return D.showInputBox("Enter label text",function(t){var r=t.value;n.useTool("label",e,r)})},_=[{label:"&Edit Label",click:k}];return void R.popupMenu(_,c,d)}["line","arrow"].includes(w)?this.editVertexData&&this.editVertexData[0]===w?(this.useTool(w,e,this.editVertexData[1]),this.editVertexData=null):(this.useTool(w,e),this.editVertexData=[w,e]):(this.useTool(w,e),this.editVertexData=null)}else if(["scoring","estimator"].includes(this.state.mode)){if(0!==i||0===g.get(e))return;var x=this.state,C=x.mode,S=x.deadStones,M=S.some(function(t){return R.vertexEquals(t,e)}),T="estimator"===C?g.getChain(e):g.getRelatedChains(e);S=M?S.filter(function(e){return!T.some(function(t){return R.vertexEquals(e,t)})}):[].concat(t(S),t(T)),this.setState({deadStones:S})}else if("find"===this.state.mode){if(0!==i)return;R.vertexEquals(this.state.findVertex||[-1,-1],e)?this.setState({findVertex:null}):(this.setState({findVertex:e}),this.findMove(1,{vertex:e,text:this.state.findText}))}else if("guess"===this.state.mode){if(0!==i)return;var A=B.navigate.apply(B,t(this.state.treePosition).concat([1]));if(!A)return this.setMode("play");var P=A[0].nodes[A[1]];if(!("B"in P||"W"in P))return this.setMode("play");var E=q.point2vertex(P["B"in P?"B":"W"][0]),O=B.getBoard.apply(B,t(this.state.treePosition));if(!O.hasVertex(E))return this.setMode("play");if(R.vertexEquals(e,E))this.makeMove(e,{player:"B"in P?1:-1});else{if(0!==O.get(e)||this.state.blockedGuesses.some(function(t){return R.vertexEquals(t,e)}))return;for(var j=[],L=e.map(function(e,t){return Math.abs(e-E[t])}).reduce(function(e,t,n){var r=s(e,2),o=r[0],i=r[1];return t>o?[t,n]:[o,i]},[-1/0,-1]),I=s(L,2),z=I[1],W=0;W<O.width;W++)for(var F=0;F<O.height;F++){var V=0===z?W:F;Math.abs(V-e[z])<Math.abs(V-E[z])&&j.push([W,F])}var G=this.state.blockedGuesses;G.push.apply(G,j),this.setState({blockedGuesses:G})}}this.events.emit("vertexClick")}},{key:"makeMove",value:function(e){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.player,a=void 0===i?null:i,l=o.clearUndoPoint,u=void 0===l||l,c=o.sendToEngine,h=void 0!==c&&c;["play","autoplay","guess"].includes(this.state.mode)||(this.closeDrawer(),this.setMode("play"));var d=s(this.state.treePosition,2),f=d[0],p=d[1],v=B.getBoard(f,p);"string"==typeof e&&(e=v.coord2vertex(e));var g=!v.hasVertex(e);if(g||0===v.get(e)){var m=B.navigate(f,p,-1);a||(a=this.inferredState.currentPlayer);var y=a>0?"B":"W",b=!1,w=!1,k=!1,_=!0;if(!g){if(m&&N.get("game.show_ko_warning")){var x=v.makeMove(a,e).getPositionHash();if((k=m[0].nodes[m[1]].board.getPositionHash()==x)&&0!=D.showMessageBox(["You are about to play a move which repeats a previous board position.","This is invalid in some rulesets. Do you want to play anyway?"].join("\n"),"info",["Play Anyway","Don’t Play"],1))return}var C=v.getNeighbors(e);if(b=C.some(function(e){return v.get(e)==-a&&1==v.getLiberties(e).length}),(w=!b&&C.filter(function(e){return v.get(e)==a}).every(function(e){return 1==v.getLiberties(e).length})&&0==C.filter(function(e){return 0==v.get(e)}).length)&&N.get("game.show_suicide_warning")&&0!=D.showMessageBox(["You are about to play a suicide move.","This is invalid in some rulesets. Do you want to play anyway?"].join("\n"),"info",["Play Anyway","Don’t Play"],1))return;this.setState({animatedVertex:e})}var S=void 0;if(0===f.subtrees.length&&f.nodes.length-1===p){var M={};M[y]=[q.vertex2point(e)],f.nodes.push(M),S=[f,f.nodes.length-1]}else{if(p!==f.nodes.length-1){var T=f.nodes[p+1];y in T&&R.vertexEquals(q.point2vertex(T[y][0]),e)&&(S=[f,p+1],_=!1)}else{var A=f.subtrees.filter(function(t){return t.nodes.length>0&&y in t.nodes[0]&&R.vertexEquals(q.point2vertex(t.nodes[0][y][0]),e)});A.length>0&&(S=[A[0],0],_=!1)}if(_){var P=null==f.parent,E=B.split(f,p),O=B.new(),j=r({},y,[q.vertex2point(e)]);if(O.nodes=[j],O.parent=E,E.subtrees.push(O),E.current=E.subtrees.length-1,P){var I=this.state.gameTrees;I[I.indexOf(f)]=E}S=[O,0]}}if(this.setCurrentTreePosition.apply(this,t(S)),g)L.playPass();else{var z=N.get("sound.capture_delay_min");z+=Math.floor(Math.random()*(N.get("sound.capture_delay_max")-z)),(b||w)&&L.playCapture(z),L.playPachi()}_&&u&&this.clearUndoPoint();var W=!1;if(g&&_&&m){var F=f.nodes[p],V="B"===y?"W":"B";V in F&&""===F[V][0]&&(W=!0,this.setMode("scoring"))}if(this.events.emit("moveMake",{pass:g,capture:b,suicide:w,ko:k,enterScoring:W}),h&&this.attachedEngineControllers.some(function(e){return null!=e})){var G=g?a:null;setTimeout(function(){return n.startGeneratingMoves({passPlayer:G})},N.get("gtp.move_delay"))}}}},{key:"makeResign",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.player,r=void 0===n?null:n,o=e.setUndoPoint,i=void 0===o||o,a=this.inferredState,s=a.rootTree,l=a.currentPlayer;null==r&&(r=l);var u=r>0?"W":"B",c=s.nodes[0];i&&this.setUndoPoint("Undo Resignation"),c.RE=[u+"+Resign"],this.makeMove([-1,-1],{player:r,clearUndoPoint:!1}),this.makeMainVariation.apply(this,t(this.state.treePosition).concat([{setUndoPoint:!1}])),this.events.emit("resign",{player:r})}},{key:"useTool",value:function(e,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=s(this.state.treePosition,2),a=i[0],l=i[1],u=this.inferredState,c=u.currentPlayer,h=u.gameIndex,d=B.getBoard(a,l),f=a.nodes[l];"string"==typeof n&&(n=d.coord2vertex(n));var p={cross:"MA",triangle:"TR",circle:"CR",square:"SQ",number:"LB",label:"LB"};if(["stone_-1","stone_1"].includes(e))!function(){if("B"in f||"W"in f||B.navigate(a,l,1)){var o=null==a.parent,i=B.split(a,l);if(i==a&&0==i.subtrees.length||(a=B.new(),a.parent=i,i.subtrees.push(a)),f={PL:c>0?["B"]:["W"]},l=a.nodes.length,a.nodes.push(f),o){r.state.gameTrees[h]=i}}var s="stone_1"===e?1:-1,u=d.get(n),p=["AW","AE","AB"],v=q.vertex2point(n),g=!0,m=!1,y=void 0;try{for(var b,w=p[Symbol.iterator]();!(g=(b=w.next()).done);g=!0){var k=b.value;k in f&&(f[k].some(function(e){return e.includes(":")})&&(f[k]=f[k].map(function(e){return q.compressed2list(e).map(q.vertex2point)}).reduce(function(e,n){return[].concat(t(e),[n])})),f[k]=f[k].filter(function(e){return e!==v}),0===f[k].length&&delete f[k])}}catch(e){m=!0,y=e}finally{try{!g&&w.return&&w.return()}finally{if(m)throw y}}var _=u!==s?p[s+1]:"AE";_ in f?f[_].push(v):f[_]=[v]}();else if(["line","arrow"].includes(e)){var v=o;if(!v||R.vertexEquals(n,v))return;var g=d.lines.findIndex(function(e){return R.equals(e.slice(0,2),[n,v])});-1===g&&(g=d.lines.findIndex(function(e){return R.equals(e.slice(0,2),[v,n])}))>=0&&"line"!==e&&d.lines[g][2]&&(g=-1),g>=0?d.lines.splice(g,1):d.lines.push([n,v,"arrow"===e]),f.LN=[],f.AR=[];var m=!0,y=!1,b=void 0;try{for(var w,k=d.lines[Symbol.iterator]();!(m=(w=k.next()).done);m=!0){var _=w.value,x=s(_,3),C=x[0],S=x[1],M=x[2],T=[C,S].map(q.vertex2point),A=s(T,2),P=A[0],E=A[1];P!==E&&f[M?"AR":"LN"].push([P,E].join(":"))}}catch(e){y=!0,b=e}finally{try{!m&&k.return&&k.return()}finally{if(y)throw b}}0===f.LN.length&&delete f.LN,0===f.AR.length&&delete f.AR}else{if("number"===e)if(n in d.markups&&"label"===d.markups[n][0])delete d.markups[n];else{var D=f.LB?f.LB.map(function(e){return parseFloat(e.substr(3))}).filter(function(e){return!isNaN(e)}).sort(function(e,t){return e-t}).filter(function(e,t,n){return 0===t||e!==n[t-1]}).concat([null]).findIndex(function(e,t){return t+1!==e})+1:1;o=D.toString(),d.markups[n]=[e,D.toString()]}else if("label"===e){var O=o;if(null!=O&&""===O.trim()||null==O&&n in d.markups&&"label"===d.markups[n][0])delete d.markups[n];else{if(null==O){var j="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N=Math.max(f.LB?f.LB.filter(function(e){return 4===e.length}).map(function(e){return j.indexOf(e[3])}).filter(function(e){return e>=0}).sort(function(e,t){return e-t}).filter(function(e,t,n){return 0===t||e!==n[t-1]}).concat([null]).findIndex(function(e,t){return t!==e}):0,f.L?f.L.length:0);O=j[Math.min(N,j.length-1)],o=O}d.markups[n]=[e,O]}}else n in d.markups&&d.markups[n][0]===e?delete d.markups[n]:d.markups[n]=[e,""];delete f.L;for(var L in p)delete f[p[L]];for(var I=0;I<d.width;I++)for(var z=0;z<d.height;z++){var W=[I,z];if(W in d.markups){var F=p[d.markups[W][0]],V=q.vertex2point(W);"LB"===F&&(V+=":"+d.markups[W][1]),F in f?f[F].push(V):f[F]=[V]}}}this.clearUndoPoint(),this.setCurrentTreePosition(a,l),this.events.emit("toolUse",{tool:e,vertex:n,argument:o})}},{key:"setUndoPoint",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Undo",t=s(this.state.treePosition,2),n=t[0],r=t[1],o=B.clone(B.getRoot(n)),i=B.getLevel(n,r);this.undoData=[o,i],this.setState({undoable:!0,undoText:e})}},{key:"clearUndoPoint",value:function(){this.undoData=null,this.setState({undoable:!1})}},{key:"undo",value:function(){var e=this;this.state.undoable&&this.undoData&&(this.setBusy(!0),setTimeout(function(){var n=s(e.undoData,2),r=n[0],o=n[1],i=e.state,a=i.treePosition;i.gameTrees[e.inferredState.gameIndex]=r,a=B.navigate(r,0,o),e.setCurrentTreePosition.apply(e,t(a)),e.clearUndoPoint(),e.setBusy(!1)},N.get("edit.undo_delay")))}},{key:"setCurrentTreePosition",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.clearUndoPoint,o=void 0===r||r;if(!["scoring","estimator"].includes(this.state.mode)){for(var i=e;null!=i.parent;)i.parent.current=i.parent.subtrees.indexOf(i),i=i.parent;o&&i!==B.getRoot(this.state.treePosition[0])&&this.clearUndoPoint(),this.setState({blockedGuesses:[],highlightVertices:[],treePosition:[e,t]}),this.events.emit("navigate")}}},{key:"goStep",value:function(e){var n=B.navigate.apply(B,t(this.state.treePosition).concat([e]));n&&this.setCurrentTreePosition.apply(this,t(n))}},{key:"goToMoveNumber",value:function(e){if(e=+e,!isNaN(e)){e<0&&(e=0);var n=this.state.treePosition,r=B.getRoot.apply(B,t(n));n=B.navigate(r,0,Math.round(e)),n?this.setCurrentTreePosition.apply(this,t(n)):this.goToEnd()}}},{key:"goToNextFork",value:function(){var e=s(this.state.treePosition,2),t=e[0];if(e[1]!==t.nodes.length-1)this.setCurrentTreePosition(t,t.nodes.length-1);else if(0!==t.subtrees.length){var n=t.subtrees[t.current];this.setCurrentTreePosition(n,n.nodes.length-1)}}},{key:"goToPreviousFork",value:function(){var e=s(this.state.treePosition,2),t=e[0],n=e[1];null==t.parent||0===t.parent.nodes.length?0!=n&&this.setCurrentTreePosition(t,0):this.setCurrentTreePosition(t.parent,t.parent.nodes.length-1)}},{key:"goToComment",value:function(e){for(var n=this.state.treePosition;;){if("break"===function(){if(!(n=B.navigate.apply(B,t(n).concat([e]))))return"break";var r=n[0].nodes[n[1]];return N.get("sgf.comment_properties").some(function(e){return e in r})?"break":void 0}())break}n&&this.setCurrentTreePosition.apply(this,t(n))}},{key:"goToBeginning",value:function(){this.setCurrentTreePosition(B.getRoot.apply(B,t(this.state.treePosition)),0)}},{key:"goToEnd",value:function(){var e=B.getRoot.apply(B,t(this.state.treePosition)),n=B.navigate(e,0,B.getCurrentHeight(e)-1);this.setCurrentTreePosition.apply(this,t(n))}},{key:"goToSiblingVariation",value:function(e){var t=s(this.state.treePosition,2),n=t[0];t[1];if(n.parent){e=e<0?-1:1;var r=n.parent.subtrees.length,o=(n.parent.current+r+e)%r;this.setCurrentTreePosition(n.parent.subtrees[o],0)}}},{key:"goToMainVariation",value:function(){for(var e=this.state.treePosition,n=B.getRoot.apply(B,t(e));0!==n.subtrees.length;)n.current=0,n=n.subtrees[0];if(B.onMainTrack.apply(B,t(e)))this.setCurrentTreePosition.apply(this,t(e));else{for(var r=s(e,1),o=r[0];!B.onMainTrack(o);)o=o.parent;this.setCurrentTreePosition(o,o.nodes.length-1)}}},{key:"goToSiblingGame",value:function(e){var t=this.state,n=t.gameTrees,r=t.treePosition,o=s(r,1),i=o[0],a=n.indexOf(B.getRoot(i)),l=Math.max(0,Math.min(n.length-1,a+e));this.setCurrentTreePosition(n[l],0)}},{key:"findPosition",value:function(e,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:R.noop;e=isNaN(e)?1:e>=0?1:-1,this.setBusy(!0),setTimeout(function(){for(var i=r.state.treePosition,a=B.makeHorizontalNavigator.apply(B,t(i));;){if(!(i=e>=0?a.next():a.prev())){var s=r.inferredState.rootTree;if(1===e)i=[s,0];else{var l=B.getSection(s,B.getHeight(s)-1);i=l[l.length-1]}a=B.makeHorizontalNavigator.apply(B,t(i))}if(R.vertexEquals(i,r.state.treePosition)||n.apply(void 0,t(i)))break}r.setCurrentTreePosition.apply(r,t(i)),r.setBusy(!1),o()},N.get("find.delay"))}},{key:"findHotspot",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.noop;this.findPosition(e,function(e,t){return"HO"in e.nodes[t]},t)}},{key:"findMove",value:function(e,t){var n=t.vertex,r=void 0===n?null:n,o=t.text,i=void 0===o?"":o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:R.noop;if(null!=r||""!==i.trim()){var s=r?q.vertex2point(r):null;this.findPosition(e,function(e,t){var n=e.nodes[t],r=function(e,t){return e in n&&n[e][0].toLowerCase().includes(t.toLowerCase())};return(!s||["B","W"].some(function(e){return r(e,s)}))&&(!i||r("C",i)||r("N",i))},a)}}},{key:"getGameInfo",value:function(e){var t=B.getRoot(e),n=B.getRootProperty(t,"KM");n=null==n||isNaN(n)?null:+n;var r=B.getRootProperty(t,"SZ");if(null==r)r=[19,19];else{var o=r.toString().split(":");r=[+o[0],+o[o.length-1]]}var i=~~B.getRootProperty(t,"HA",0);1===(i=Math.max(1,Math.min(9,i)))&&(i=0);var a=["B","W"].map(function(t){return B.getRootProperty(e,"P"+t)||B.getRootProperty(e,t+"T")}),s=["BR","WR"].map(function(e){return B.getRootProperty(t,e)});return{playerNames:a,playerRanks:s,blackName:a[0],blackRank:s[0],whiteName:a[1],whiteRank:s[1],gameName:B.getRootProperty(t,"GN"),eventName:B.getRootProperty(t,"EV"),date:B.getRootProperty(t,"DT"),result:B.getRootProperty(t,"RE"),komi:n,handicap:i,size:r}}},{key:"setGameInfo",value:function(e,t){var n=B.getRoot(e),r=n.nodes[0];if("size"in t)if(t.size){var o=t.size;o=o.map(function(e,t){return isNaN(e)||!e?19:Math.min(25,Math.max(3,e))}),o=o[0]===o[1]?o[0]:o.join(":"),N.set("game.default_board_size",o),r.SZ=[o]}else delete r.SZ;var i={blackName:"PB",blackRank:"BR",whiteName:"PW",whiteRank:"WR",gameName:"GN",eventName:"EV",date:"DT",result:"RE",komi:"KM",handicap:"HA"};for(var a in i)if(a in t){var s=t[a];if(s&&""!==s.toString().trim()){if("komi"===a)isNaN(s)&&(s=0),N.set("game.default_komi",s);else if("handicap"===a){var l=B.getBoard(n,0),u=l.getHandicapPlacement(+s);if(s=u.length,N.set("game.default_handicap",s),s<=1){delete r[i[a]],delete r.AB;continue}r.AB=u.map(q.vertex2point)}r[i[a]]=[s]}else delete r[i[a]]}}},{key:"getPlayer",value:function(e,t){var n=e.nodes[t];return"PL"in n?"W"==n.PL[0]?-1:1:"B"in n||"HA"in n&&+n.HA[0]>=1?-1:1}},{key:"setPlayer",value:function(e,t,n){var r=e.nodes[t];("B"in r||"HA"in r&&+r.HA[0]>=1?-1:+("W"in r))===n||0===n?delete r.PL:r.PL=[n>0?"B":"W"],this.clearUndoPoint()}},{key:"getComment",value:function(e,t){var n=e.nodes[t];return{title:"N"in n?n.N[0].trim():null,comment:"C"in n?n.C[0]:null,hotspot:"HO"in n,moveAnnotation:"BM"in n?"BM":"TE"in n?"TE":"DO"in n?"DO":"IT"in n?"IT":null,positionAnnotation:"UC"in n?"UC":"GW"in n?"GW":"DM"in n?"DM":"GB"in n?"GB":null}}},{key:"setComment",value:function(e,t,n){for(var r=e.nodes[t],o=[["title","N"],["comment","C"]],i=0;i<o.length;i++){var a=o[i],l=s(a,2),u=l[0],c=l[1];u in n&&(n[u]&&""!==n[u].trim()?r[c]=[n[u]]:delete r[c])}"hotspot"in n&&(n.hotspot?r.HO=[1]:delete r.HO);var h=function(e){return e.forEach(function(e){return delete r[e]})};if("moveAnnotation"in n){var d={BM:1,DO:"",IT:"",TE:1};h(Object.keys(d)),null!=n.moveAnnotation&&(r[n.moveAnnotation]=[d[n.moveAnnotation]])}if("positionAnnotation"in n){var f={UC:1,GW:1,GB:1,DM:1};h(Object.keys(f)),null!=n.positionAnnotation&&(r[n.positionAnnotation]=[f[n.positionAnnotation]])}this.clearUndoPoint()}},{key:"copyVariation",value:function(e,t){var n=B.clone(e);0!=t&&B.split(n,t-1),this.copyVariationData=n}},{key:"cutVariation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.setUndoPoint;(void 0===r||r)&&this.setUndoPoint("Undo Cut Variation"),this.copyVariation(e,t),this.removeNode(e,t,{suppressConfirmation:!0,setUndoPoint:!1})}},{key:"pasteVariation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.setUndoPoint,o=void 0===r||r;if(null!=this.copyVariationData){o&&this.setUndoPoint("Undo Paste Variation"),this.closeDrawer(),this.setMode("play");var i=!e.parent,a=e.nodes.length,s=B.split(e,t),l=B.clone(this.copyVariationData);if(l.parent=s,s.subtrees.push(l),i){var u=this.state.gameTrees;u[this.inferredState.gameIndex]=s,this.setState({gameTrees:u})}1===s.subtrees.length?(B.reduce(s),this.setCurrentTreePosition(s,a)):this.setCurrentTreePosition(l,0)}}},{key:"flattenVariation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.setUndoPoint;(void 0===r||r)&&this.setUndoPoint("Undo Flatten"),this.closeDrawer(),this.setMode("play");var o=this.state.gameTrees,i=this.inferredState,a=i.rootTree,s=i.gameIndex,l=B.getBoard(e,t),u=a.nodes[0],c=["BR","BT","DT","EV","GN","GC","PB","PW","RE","SO","WT","WR"],h=B.clone(e);0!==t&&B.split(h,t-1);var d=h.nodes[0];d.AB=[],d.AW=[],delete d.AE,delete d.B,delete d.W,h.parent=null,c.forEach(function(e){return e in u?d[e]=u[e]:null});for(var f=0;f<l.width;f++)for(var p=0;p<l.height;p++){var v=l.get([f,p]);0!=v&&d[v>0?"AB":"AW"].push(q.vertex2point([f,p]))}0===d.AB.length&&delete d.AB,0===d.AW.length&&delete d.AW,o[s]=h,this.setState({gameTrees:o}),this.setCurrentTreePosition(h,0,{clearUndoPoint:!1})}},{key:"makeMainVariation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.setUndoPoint;(void 0===r||r)&&this.setUndoPoint("Restore Main Variation"),this.closeDrawer(),this.setMode("play");for(var o=e;null!=o.parent;)o.parent.subtrees.splice(o.parent.subtrees.indexOf(o),1),o.parent.subtrees.unshift(o),o.parent.current=0,o=o.parent;for(o=e;0!==o.subtrees.length;){var i=o.subtrees.splice(o.current,1),a=s(i,1),l=a[0];o.subtrees.unshift(l),o.current=0,o=l}this.setCurrentTreePosition(e,t)}},{key:"shiftVariation",value:function(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=o.setUndoPoint,a=void 0===i||i;if(e.parent){a&&this.setUndoPoint("Undo Shift Variation"),this.closeDrawer(),this.setMode("play");var s=e.parent.subtrees,l=s.length,u=s.indexOf(e),c=((u+r)%l+l)%l;s.splice(u,1),s.splice(c,0,e),this.setCurrentTreePosition.apply(this,t(this.state.treePosition))}}},{key:"removeNode",value:function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.suppressConfirmation,i=void 0!==o&&o,a=r.setUndoPoint,s=void 0===a||a;if(!e.parent&&0===n)return void D.showMessageBox("The root node cannot be removed.","warning");if(!0===i||!N.get("edit.show_removenode_warning")||1!==D.showMessageBox("Do you really want to remove this node?","warning",["Remove Node","Cancel"],1)){s&&this.setUndoPoint("Undo Remove Node"),this.closeDrawer(),this.setMode("play");var l=B.navigate(e,n,-1);if(0!==n)e.nodes.splice(n,e.nodes.length),e.current=null,e.subtrees.length=0;else{var u=e.parent,c=u.subtrees.indexOf(e);u.subtrees.splice(c,1),u.current>=1&&u.current--,B.reduce(u)}l||(l=this.state.treePosition),this.setCurrentTreePosition.apply(this,t(l))}}},{key:"removeOtherVariations",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.suppressConfirmation,o=void 0!==r&&r,i=n.setUndoPoint,a=void 0===i||i;if(!0===o||!N.get("edit.show_removeothervariations_warning")||1!=D.showMessageBox("Do you really want to remove all other variations?","warning",["Remove Variations","Cancel"],1)){a&&this.setUndoPoint("Undo Remove Other Variations"),this.closeDrawer(),this.setMode("play");for(var s=e;0!=s.subtrees.length;)s.subtrees=[s.subtrees[s.current]],s.current=0,s=s.subtrees[0];for(s=e;null!=s.parent;)s.parent.subtrees=[s],s.parent.current=0,s=s.parent;this.setCurrentTreePosition(e,t)}}},{key:"openNodeMenu",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("scoring"!==this.state.mode){var o=[{label:"C&opy Variation",click:function(){return n.copyVariation(e,t)}},{label:"C&ut Variation",click:function(){return n.cutVariation(e,t)}},{label:"&Paste Variation",click:function(){return n.pasteVariation(e,t)}},{type:"separator"},{label:"Make &Main Variation",click:function(){return n.makeMainVariation(e,t)}},{label:"Shift &Left",click:function(){return n.shiftVariation(e,t,-1)}},{label:"Shift Ri&ght",click:function(){return n.shiftVariation(e,t,1)}},{type:"separator"},{label:"&Flatten",click:function(){return n.flattenVariation(e,t)}},{label:"&Remove Node",click:function(){return n.removeNode(e,t)}},{label:"Remove &Other Variations",click:function(){return n.removeOtherVariations(e,t)}}];R.popupMenu(o,r.x,r.y)}}},{key:"openCommentMenu",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e.nodes[t],i=[{label:"&Clear Annotations",click:function(){n.setComment(e,t,{positionAnnotation:null,moveAnnotation:null})}},{type:"separator"},{label:"Good for &Black",type:"checkbox",data:{positionAnnotation:"GB"}},{label:"&Unclear Position",type:"checkbox",data:{positionAnnotation:"UC"}},{label:"&Even Position",type:"checkbox",data:{positionAnnotation:"DM"}},{label:"Good for &White",type:"checkbox",data:{positionAnnotation:"GW"}}];("B"in o||"W"in o)&&i.push({type:"separator"},{label:"&Good Move",type:"checkbox",data:{moveAnnotation:"TE"}},{label:"&Interesting Move",type:"checkbox",data:{moveAnnotation:"IT"}},{label:"&Doubtful Move",type:"checkbox",data:{moveAnnotation:"DO"}},{label:"B&ad Move",type:"checkbox",data:{moveAnnotation:"BM"}}),i.push({type:"separator"},{label:"&Hotspot",type:"checkbox",data:{hotspot:!0}});var a=!0,l=!1,u=void 0;try{for(var c,h=i[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;(function(r){if(!("data"in r))return"continue";var i=Object.keys(r.data),a=s(i,1),l=a[0],u="hotspot"===l?"HO":r.data[l];r.checked=u in o,r.checked&&(r.data[l]=null),r.click=function(){return n.setComment(e,t,r.data)}})(d)}}catch(e){l=!0,u=e}finally{try{!a&&h.return&&h.return()}finally{if(l)throw u}}R.popupMenu(i,r.x,r.y)}},{key:"attachEngines",value:function(){for(var e=this,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=this.state,a=i.engineCommands,s=i.attachedEngines;if(R.vertexEquals([].concat(r).reverse(),s))return this.attachedEngineControllers.reverse(),this.engineBoards.reverse(),void this.setState({engineCommands:a.reverse(),attachedEngines:r});for(var l=function(e){return new j.Command(null,e)},u=0;u<s.length;u++)!function(n){if(s[n]!=r[n]){e.attachedEngineControllers[n]&&e.attachedEngineControllers[n].stop();try{var o=r[n]?new j.Controller(r[n]):null;e.attachedEngineControllers[n]=o,e.engineBoards[n]=null,e.sendGTPCommand(o,l("name")),e.sendGTPCommand(o,l("version")),e.sendGTPCommand(o,l("protocol_version")),e.sendGTPCommand(o,l("list_commands"),function(e){var t=e.response;a[n]=t.content.split("\n")}),o.on("stderr",function(r){var i=r.content;e.setState(function(e){return{consoleLog:[].concat(t(e.consoleLog),[[0===n?1:-1,o.name,null,new j.Response(null,i,!1,!0)]])}})}),e.setState({engineCommands:a})}catch(t){e.attachedEngineControllers[n]=null,r[n]=null}}}(u);this.setState({attachedEngines:r}),this.syncEngines()}},{key:"detachEngines",value:function(){}},{key:"suspendEngines",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,o=this.attachedEngineControllers[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var i=r.value;null!=i&&i.stop()}}catch(e){t=!0,n=e}finally{try{!e&&o.return&&o.return()}finally{if(t)throw n}}this.engineBoards=[null,null]}},{key:"sendGTPCommand",value:function(e,t){arguments.length>2&&void 0!==arguments[2]?arguments[2]:R.noop}},{key:"syncEngines",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.passPlayer}},{key:"startGeneratingMoves",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.passPlayer,e.followUp}},{key:"stopGeneratingMoves",value:function(){}},{key:"render",value:function(e,n){var o=B.getRoot.apply(B,t(n.treePosition)),i=void 0,a=void 0;if(["scoring","estimator"].includes(n.mode)){i=B.getBoard.apply(B,t(n.treePosition)).clone();var s=!0,l=!1,u=void 0;try{for(var c,h=n.deadStones[Symbol.iterator]();!(s=(c=h.next()).done);s=!0){var d=c.value,f=i.get(d);0!==f&&(i.captures[f>0?1:0]++,i.set(d,0))}}catch(e){l=!0,u=e}finally{try{!s&&h.return&&h.return()}finally{if(l)throw u}}a="estimator"===n.mode?i.getAreaEstimateMap():i.getAreaMap()}return this.inferredState={showSidebar:n.showGameGraph||n.showCommentBox,showLeftSidebar:n.showConsole,rootTree:o,gameIndex:n.gameTrees.indexOf(o),gameInfo:this.getGameInfo(o),currentPlayer:this.getPlayer.apply(this,t(n.treePosition)),scoreBoard:i,areaMap:a},n=Object.assign(n,this.inferredState),g("section",{class:b(r({leftsidebar:n.showLeftSidebar,sidebar:n.showSidebar},n.mode,!0))},g(w),g(k,n),g(_,n),g(x,n),g(C,n),g(S,{text:n.inputBoxText,show:n.showInputBox,onSubmit:n.onInputBoxSubmit,onCancel:n.onInputBoxCancel}),g(M,{show:n.busy}),g(T,{text:n.infoOverlayText,show:n.showInfoOverlay}))}}]),v}(y);m(g(I),document.body)}).call(t,n(10))},function(e,t,n){(function(r){var o,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};(function(){function r(e){this.tokens=[],this.tokens.links={},this.options=e||p.defaults,this.rules=v.normal,this.options.gfm&&(this.options.tables?this.rules=v.tables:this.rules=v.gfm)}function a(e,t){if(this.options=t||p.defaults,this.links=e,this.rules=g.normal,this.renderer=this.options.renderer||new s,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=g.breaks:this.rules=g.gfm:this.options.pedantic&&(this.rules=g.pedantic)}function s(e){this.options=e||{}}function l(e){this.tokens=[],this.token=null,this.options=e||p.defaults,this.options.renderer=this.options.renderer||new s,this.renderer=this.options.renderer,this.renderer.options=this.options}function u(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function c(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function h(e,t){return e=e.source,t=t||"",function n(r,o){return r?(o=o.source||o,o=o.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,o),n):new RegExp(e,t)}}function d(){}function f(e){for(var t,n,r=1;r<arguments.length;r++){t=arguments[r];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function p(e,t,n){if(n||"function"==typeof t){n||(n=t,t=null),t=f({},p.defaults,t||{});var o,i,a=t.highlight,s=0;try{o=r.lex(e,t)}catch(e){return n(e)}i=o.length;var c=function(e){if(e)return t.highlight=a,n(e);var r;try{r=l.parse(o,t)}catch(t){e=t}return t.highlight=a,e?n(e):n(null,r)};if(!a||a.length<3)return c();if(delete t.highlight,!i)return c();for(;s<o.length;s++)!function(e){"code"!==e.type?--i||c():a(e.text,e.lang,function(t,n){return t?c(t):null==n||n===e.text?--i||c():(e.text=n,e.escaped=!0,void(--i||c()))})}(o[s])}else try{return t&&(t=f({},p.defaults,t)),l.parse(r.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(t||p.defaults).silent)return"<p>An error occured:</p><pre>"+u(e.message+"",!0)+"</pre>";throw e}}var v={newline:/^\n+/,code:d,fences:d,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:d,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:d,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};v.bullet=/(?:[*+-]|\d+\.)/,v.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,v.item=h(v.item,"gm")(/bull/g,v.bullet)(),v.list=h(v.list)(/bull/g,v.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+v.def.source+")")(),v.blockquote=h(v.blockquote)("def",v.def)(),v._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",v.html=h(v.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,v._tag)(),v.paragraph=h(v.paragraph)("hr",v.hr)("heading",v.heading)("lheading",v.lheading)("blockquote",v.blockquote)("tag","<"+v._tag)("def",v.def)(),v.normal=f({},v),v.gfm=f({},v.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),v.gfm.paragraph=h(v.paragraph)("(?!","(?!"+v.gfm.fences.source.replace("\\1","\\2")+"|"+v.list.source.replace("\\1","\\3")+"|")(),v.tables=f({},v.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),r.rules=v,r.lex=function(e,t){return new r(t).lex(e)},r.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},r.prototype.token=function(e,t,n){for(var r,o,i,a,s,l,u,c,h,e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),l={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},c=0;c<l.align.length;c++)/^ *-+: *$/.test(l.align[c])?l.align[c]="right":/^ *:-+: *$/.test(l.align[c])?l.align[c]="center":/^ *:-+ *$/.test(l.align[c])?l.align[c]="left":l.align[c]=null;for(c=0;c<l.cells.length;c++)l.cells[c]=l.cells[c].split(/ *\| */);this.tokens.push(l)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,t,!0),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),a=i[2],this.tokens.push({type:"list_start",ordered:a.length>1}),i=i[0].match(this.rules.item),r=!1,h=i.length,c=0;c<h;c++)l=i[c],u=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(u-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+u+"}","gm"),"")),this.options.smartLists&&c!==h-1&&(s=v.bullet.exec(i[c+1])[0],a===s||a.length>1&&s.length>1||(e=i.slice(c+1).join("\n")+e,c=h-1)),o=r||/\n\n(?!\s*$)/.test(l),c!==h-1&&(r="\n"===l.charAt(l.length-1),o||(o=r)),this.tokens.push({type:o?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(!n&&t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),this.tokens.links[i[1].toLowerCase()]={href:i[2],title:i[3]};else if(t&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),l={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c<l.align.length;c++)/^ *-+: *$/.test(l.align[c])?l.align[c]="right":/^ *:-+: *$/.test(l.align[c])?l.align[c]="center":/^ *:-+ *$/.test(l.align[c])?l.align[c]="left":l.align[c]=null;for(c=0;c<l.cells.length;c++)l.cells[c]=l.cells[c].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(t&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var g={escape:d,autolink:d,url:d,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};g._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,g._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,g.link=h(g.link)("inside",g._inside)("href",g._href)(),g.reflink=h(g.reflink)("inside",g._inside)(),g.normal=f({},g),g.pedantic=f({},g.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),g.gfm=f({},g.normal),g.breaks=f({},g.gfm,{br:h(g.br)("{2,}","*")(),text:h(g.gfm.text)("{2,}","*")()}),a.rules=g,a.output=function(e,t,n){return new a(t,n).output(e)},a.prototype.output=function(e){for(var t,r,o,i,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(r=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),o=this.mangle("mailto:")+r):(r=u(i[1]),o=r),a+=this.renderer.link(o,null,r);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(u(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e)){var s=n(1);e=e.substring(i[0].length),a+=this.renderer.text(s.htmlify(u(this.smartypants(i[0]))))}else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),r=u(i[1]),o=r,a+=this.renderer.link(o,null,r);return a},a.prototype.outputLink=function(e,t){var n=u(t.href),r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},a.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},a.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,o=0;o<r;o++)t=e.charCodeAt(o),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},s.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+u(t,!0)+'">'+(n?e:u(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:u(e,!0))+"\n</code></pre>"},s.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},s.prototype.html=function(e){return e},s.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},s.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},s.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},s.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},s.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},s.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},s.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},s.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},s.prototype.strong=function(e){return"<strong>"+e+"</strong>"},s.prototype.em=function(e){return"<em>"+e+"</em>"},s.prototype.codespan=function(e){return"<code>"+e+"</code>"},s.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},s.prototype.del=function(e){return"<del>"+e+"</del>"},s.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(c(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return""}var o='<a href="'+e+'" class="external"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>"},s.prototype.image=function(e,t,n){return this.link(e,t,n)},s.prototype.text=function(e){return e},l.parse=function(e,t,n){return new l(t,n).parse(e)},l.prototype.parse=function(e){this.inline=new a(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},l.prototype.next=function(){return this.token=this.tokens.pop()},l.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},l.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},l.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,o="",i="";for(n="",e=0;e<this.token.header.length;e++)({header:!0,align:this.token.align[e]}),n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(o+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});i+=this.renderer.tablerow(n)}return this.renderer.table(o,i);case"blockquote_start":for(var i="";"blockquote_end"!==this.next().type;)i+=this.tok();return this.renderer.blockquote(i);case"list_start":for(var i="",a=this.token.ordered;"list_end"!==this.next().type;)i+=this.tok();return this.renderer.list(i,a);case"list_item_start":for(var i="";"list_item_end"!==this.next().type;)i+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(i);case"loose_item_start":for(var i="";"list_item_end"!==this.next().type;)i+=this.tok();return this.renderer.listitem(i);case"html":var s=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(s);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},d.exec=d,p.options=p.setOptions=function(e){return f(p.defaults,e),p},p.defaults={gfm:!0,tables:!1,breaks:!0,pedantic:!1,sanitize:!0,sanitizer:null,mangle:!0,smartLists:!0,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!0,headerPrefix:"commentsheader-",renderer:new s,xhtml:!0},p.Parser=l,p.parser=l.parse,p.Renderer=s,p.Lexer=r,p.lexer=r.lex,p.InlineLexer=a,p.inlineLexer=a.output,p.parse=p,void 0!==e&&"object"===i(t)?e.exports=p:void 0!==(o=function(){return p}.call(t,n,t,e))&&(e.exports=o)}).call(function(){return this||("undefined"!=typeof window?window:r)}())}).call(t,n(25))},function(e,t){var n,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}e.exports=n},function(e,t,n){"use strict";e.exports=function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";var n=document.getSelection(),r=!1;n.rangeCount>0&&(r=n.getRangeAt(0)),document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=e.length;var o=!1;try{o=document.execCommand("copy")}catch(e){}return document.body.removeChild(t),r&&(n.removeAllRanges(),n.addRange(r)),o}},function(e,t,n){var r=n(18),o=(n(5),n(9),n(2)),i=(o.app,{}),a={"app.startup_check_updates":!0,"app.startup_check_updates_delay":3e3,"app.loadgame_delay":100,"app.hide_busy_delay":200,"app.zoom_factor":1,"autoplay.sec_per_move":1,"autoplay.max_sec_per_move":99,"autoscroll.max_interval":200,"autoscroll.min_interval":50,"autoscroll.diff":10,"cleanmarkup.cross":!0,"cleanmarkup.triangle":!0,"cleanmarkup.square":!0,"cleanmarkup.circle":!0,"cleanmarkup.line":!0,"cleanmarkup.arrow":!0,"cleanmarkup.label":!0,"cleanmarkup.comments":!1,"cleanmarkup.annotations":!1,"cleanmarkup.hotspots":!1,"comments.show_move_interpretation":!0,"console.blocked_commands":["boardsize","clear_board","play","genmove","undo","fixed_handicap","place_free_handicap","set_free_handicap","loadsgf","komi"],"console.max_history_count":100,"debug.dev_tools":!1,"edit.click_currentvertex_to_remove":!0,"edit.show_removenode_warning":!0,"edit.show_removeothervariations_warning":!0,"edit.undo_delay":100,"engines.list":[],"file.show_reload_warning":!0,"find.delay":100,"game.default_board_size":19,"game.default_komi":6.5,"game.default_handicap":0,"game.goto_end_after_loading":!1,"game.navigation_sensitivity":40,"game.show_ko_warning":!0,"game.show_suicide_warning":!0,"gamechooser.show_delay":100,"gamechooser.thumbnail_size":153,"graph.delay":200,"graph.edge_color":"#eee","graph.edge_inactive_color":"#777","graph.edge_size":2,"graph.edge_inactive_size":1,"graph.grid_size":26,"graph.node_active_color":"#f76047","graph.node_bookmark_color":"#c678dd","graph.node_color":"#eee","graph.node_inactive_color":"#777","graph.node_comment_color":"#6bb1ff","graph.node_inactive_bookmark_color":"#643d6f","graph.node_inactive_comment_color":"#365980","graph.node_size":6,"gtp.attach_delay":300,"gtp.move_delay":300,"score.estimator_iterations":30,"setting.overwrite.v0.16.0":["console.blocked_commands","window.minheight"],"setting.overwrite.v0.17.1":["graph.collapse_tokens_count"],"setting.overwrite.v0.19.0_1":["window.minheight","graph.delay"],"setting.overwrite.v0.19.1":["app.startup_check_updates_delay"],"setting.overwrite.v0.19.3":["graph.grid_size","graph.node_size"],"setting.overwrite.v0.30.0-beta":["graph.delay","console.max_history_count","window.minheight","window.minwidth"],"scoring.method":"territory","sgf.comment_properties":["C","N","UC","GW","DM","GB","BM","TE","DO","IT"],"sound.capture_delay_max":500,"sound.capture_delay_min":300,"sound.enable":!0,"theme.custom_whitestones":null,"theme.custom_blackstones":null,"theme.custom_background":null,"theme.current":null,"view.properties_height":50,"view.properties_minheight":20,"view.animated_stone_placement":!0,"view.fuzzy_stone_placement":!0,"view.show_menubar":!0,"view.show_leftsidebar":!1,"view.show_comments":!0,"view.show_coordinates":!1,"view.show_graph":!0,"view.show_move_colorization":!0,"view.show_next_moves":!0,"view.show_siblings":!0,"view.leftsidebar_width":250,"view.leftsidebar_minwidth":100,"view.sidebar_width":280,"view.sidebar_minwidth":100,"infooverlay.duration":2e3,"window.height":604,"window.minheight":440,"window.minwidth":526,"window.width":564};t.events=new r,t.events.setMaxListeners(100),t.load=function(){i=null!=localStorage.settings?JSON.parse(localStorage.settings):{};for(var e in a)e in i||(i[e]=a[e]);for(var n in i)if(0==n.indexOf("setting.overwrite.")){var r=i[n];if(r.length){for(var o=0;o<r.length;o++)i[r[o]]=a[r[o]];i[n]=[]}}return t.save()},t.loadThemes=function(){return{}},t.save=function(){return localStorage.settings=JSON.stringify(i),t},t.get=function(e){return e in i?i[e]:e in a?a[e]:null},t.set=function(e,n){return i[e]=n,t.save(),t.events.emit("change",{key:e}),t},t.getThemes=function(){return t.loadThemes(),null},t.load()},function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){document.getElementById("popupmenu-overlay").remove()}function i(e,t,n){var r=l(e,document.body).childNodes[0],o=r.getBoundingClientRect(),i=o.width,a=o.height,s=document.body.getBoundingClientRect(),u=s.width,c=s.height;r.style.left=(t+i<=u?t:Math.max(0,t-i))+"px",r.style.top=(n+a<=c?n:Math.max(0,n-a))+"px"}var a=n(0),s=a.h,l=a.render,u=n(3);t.buildFromTemplate=function(e){return{popup:function(t,n){var a=n.x,l=n.y;return i(s("section",{id:"popupmenu-overlay",onClick:function(){return o()}},s("ul",{class:"popupmenu"},e.map(function(e){return s("li",{class:u(r({checked:e.checked},e.type,e.type)),onClick:function(){return e.click&&e.click()}},e.label&&e.label.replace(/&/g,""))}))),a,l)}}},l(s("style",{},"\n #popupmenu-overlay {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n z-index: 1000;\n }\n\n .popupmenu {\n position: absolute;\n padding: 3px 0;\n max-height: calc(100% - 6px);\n max-width: 100%;\n overflow: auto;\n background: rgba(0, 0, 0, .9);\n box-shadow: 0 5px 10px rgba(0, 0, 0, .5);\n color: white;\n list-style: none;\n }\n .popupmenu li:not(.separator) {\n position: relative;\n display: block;\n height: 1em;\n padding: 7px 30px;\n line-height: 1em;\n }\n .popupmenu li.checked::before {\n content: '';\n position: absolute;\n width: 1em;\n height: 1em;\n left: 9px;\n top: 7px;\n background: url('./node_modules/octicons/build/svg/check.svg') left top/contain no-repeat;\n filter: invert(100%);\n -webkit-filter: invert(100%);\n }\n .popupmenu li.separator {\n height: 2px;\n margin: 3px 0;\n background: rgba(255, 255, 255, .3);\n }\n .popupmenu li:not(.separator):hover {\n background-color: #0050C0;\n }\n .popupmenu li:not(.separator):active {\n background-color: #0030A0;\n }\n"),document.body)},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=u.h,h=u.Component,d=n(30),f=n(31),p=n(32),v=n(6),g=n(6),m=n(33),y=n(34),b=n(4),w=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleTogglePlayer=function(){var t;return(t=sabaki).setPlayer.apply(t,r(e.props.treePosition).concat([-e.props.currentPlayer]))},e.handleToolButtonClick=function(e){sabaki.setState({selectedTool:e.tool})},e.handleFindButtonClick=function(t){return sabaki.findMove(t.step,{vertex:e.props.findVertex,text:e.props.findText})},e.handleGobanResize=e.handleGobanResize.bind(e),e.handleGobanVertexClick=e.handleGobanVertexClick.bind(e),e.handleGobanLineDraw=e.handleGobanLineDraw.bind(e),e}return a(t,e),l(t,[{key:"componentDidMount",value:function(){var e=this;document.addEventListener("keydown",function(t){17===t.keyCode&&"edit"===e.props.mode&&e.setState({gobanCrosshair:!0})}),document.addEventListener("keyup",function(t){17===t.keyCode&&"edit"===e.props.mode&&e.setState({gobanCrosshair:!1})})}},{key:"handleGobanResize",value:function(){if(null!=this.mainElement){this.mainElement.style.width="",this.mainElement.style.height="";var e=window.getComputedStyle(this.mainElement),t=e.width,n=e.height;t=parseFloat(t),n=parseFloat(n),t%2!=0&&t++,n%2!=0&&n++,this.setState({width:t,height:n})}}},{key:"handleGobanVertexClick",value:function(e){sabaki.clickVertex(e.vertex,e)}},{key:"handleGobanLineDraw",value:function(e){var t=s(e.line,2),n=t[0],r=t[1];sabaki.useTool(this.props.selectedTool,n,r),sabaki.editVertexData=null}},{key:"render",value:function(e,t){var n=this,o=e.mode,i=e.treePosition,a=e.rootTree,l=e.currentPlayer,u=e.gameInfo,h=e.attachedEngines,w=e.deadStones,k=e.scoringMethod,_=e.scoreBoard,x=e.areaMap,C=e.blockedGuesses,S=e.highlightVertices,M=e.showCoordinates,T=e.showMoveColorization,A=e.showNextMoves,P=e.showSiblings,E=e.fuzzyStonePlacement,D=e.animatedStonePlacement,O=e.animatedVertex,B=e.undoable,j=e.undoText,R=e.selectedTool,N=e.findText,q=e.findVertex,L=e.showLeftSidebar,I=e.showSidebar,z=e.sidebarWidth,W=e.leftSidebarWidth,F=t.width,V=t.height,G=t.gobanCrosshair,U=s(i,2),H=U[0],Y=U[1],$=b.getBoard(H,Y),K=H.nodes[Y],X=+b.getRootProperty(a,"KM",0),Z=void 0;if(["scoring","estimator"].includes(o))Z=x;else if("guess"===o){Z=[].concat(r(Array($.height))).map(function(e){return Array($.width).fill(0)});var J=!0,Q=!1,ee=void 0;try{for(var te,ne=C[Symbol.iterator]();!(J=(te=ne.next()).done);J=!0){var re=te.value,oe=s(re,2),ie=oe[0],ae=oe[1];Z[ae][ie]=1}}catch(e){Q=!0,ee=e}finally{try{!J&&ne.return&&ne.return()}finally{if(Q)throw ee}}}return c("section",{id:"main",style:{left:L?W:null,right:I?z:null}},c("main",{ref:function(e){return n.mainElement=e},style:{width:F,height:V}},c(d,{board:$,highlightVertices:q&&"find"===o?[q]:S,paintMap:Z,dimmedStones:["scoring","estimator"].includes(o)?w:[],crosshair:G,showCoordinates:M,showMoveColorization:T,showNextMoves:"guess"!==o&&A,showSiblings:"guess"!==o&&P,fuzzyStonePlacement:E,animatedStonePlacement:D,animatedVertex:O,drawLineMode:"edit"===o&&["arrow","line"].includes(R)?R:null,onBeforeResize:this.handleGobanResize,onVertexClick:this.handleGobanVertexClick,onLineDraw:this.handleGobanLineDraw})),c("section",{id:"bar"},c(f,{mode:o,attachedEngines:h,playerNames:u.playerNames,playerRanks:u.playerRanks,playerCaptures:$.captures,currentPlayer:l,showHotspot:"HO"in K,undoable:B,undoText:j,onCurrentPlayerClick:this.handleTogglePlayer}),c(p,{mode:o,selectedTool:R,onToolButtonClick:this.handleToolButtonClick}),c(v,{mode:o,treePosition:i}),c(g,{mode:o,treePosition:i}),c(m,{type:"scoring",mode:o,method:k,scoreBoard:_,areaMap:x,komi:X},"Please select dead stones."),c(m,{type:"estimator",mode:o,method:k,scoreBoard:_,areaMap:x,komi:X},"Toggle group status."),c(y,{mode:o,findText:N,onButtonClick:this.handleFindButtonClick})))}}]),t}(h);e.exports=w},function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var l=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),h=c.h,d=c.Component,f=n(3),p=n(1),v=function(e){return[].concat(s(Array(e))).map(function(e,t){return t})},g=function(e){return Math.floor(Math.random()*e)},m=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.sign,n=e.hoshi,r=e.shift,o=e.highlight,i=e.paint,a=e.dimmed,s=e.animate,l=e.label,u=e.markupType,c=e.ghostTypes;return t!==this.props.sign||o!==this.props.highlight||c!==this.props.ghostTypes||u!==this.props.markupType||l!==this.props.label||r!==this.props.shift||s!==this.props.animate||i!==this.props.paint||a!==this.props.dimmed||n!==this.props.hoshi}},{key:"render",value:function(e){var t,n=l(e.position,2),o=n[0],i=n[1],a=e.shift,s=e.random,u=e.sign,c=e.highlight,d=e.paint,v=e.dimmed,g=e.hoshi,m=e.animate,y=e.markupType,b=e.label,w=e.ghostTypes,k=e.onMouseDown,_=void 0===k?p.noop:k,x=e.onMouseUp,C=void 0===x?p.noop:x,S=e.onMouseMove,M=void 0===S?p.noop:S,T=(t={},r(t,"pos_"+o+"-"+i,!0),r(t,"shift_"+a,!0),r(t,"random_"+s,!0),r(t,"sign_"+u,!0),r(t,"paint_"+d,!!d),r(t,y,!!y),r(t,"dimmed",v),r(t,"hoshi",g),r(t,"animate",m),r(t,"smalllabel",b.length>=3),t),A=!0,P=!1,E=void 0;try{for(var D,O=w[Symbol.iterator]();!(A=(D=O.next()).done);A=!0){T[D.value]=!0}}catch(e){P=!0,E=e}finally{try{!A&&O.return&&O.return()}finally{if(P)throw E}}return h("li",{"data-vertex":o+"-"+i,class:f(T),onMouseDown:_,onMouseUp:C,onMouseMove:M},h("div",{class:"stone"},h("img",{src:"./img/goban/blank.svg"}),h("span",{title:b})),h("div",{class:"paint"}),c&&h("div",{class:"highlight"}))}}]),t}(d),y=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){for(var t in e)if(e[t]!==this.props[t])return!0;return!1}},{key:"render",value:function(e){var t,n=e.v1,o=e.v2,i=e.type,a=e.temporary,s=e.showCoordinates,u=e.fieldSize;if(!p.vertexEquals(n,o)){var c=[n,o].map(function(e){return e.map(function(e){return(s?e+1:e)*u})}),d=l(c,2),v=d[0],g=d[1],m=v.map(function(e,t){return g[t]-e}),y=l(m,2),b=y[0],w=y[1],k=v.map(function(e,t){return(e+g[t]+u)/2}),_=l(k,2),x=_[0],C=_[1],S=180*Math.atan2(w,b)/Math.PI,M=Math.sqrt(b*b+w*w);return h("hr",{class:f((t={},r(t,i,!0),r(t,"temporary",a),t)),style:{width:M,transform:"\n translate("+(x-M/2)+"px, "+C+"px)\n rotate("+S+"deg)\n "}})}}}]),t}(d),b=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return e.rangeX.length!==this.props.rangeX.length}},{key:"render",value:function(e){var t=e.rangeX;return h("ol",{class:"coordx"},t.map(function(e){return h("li",{},"ABCDEFGHJKLMNOPQRSTUVWXYZ"[e])}))}}]),t}(d),w=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return e.rangeY.length!==this.props.rangeY.length}},{key:"render",value:function(e){var t=e.rangeY;return h("ol",{class:"coordy"},t.map(function(e){return h("li",{},t.length-e)}))}}]),t}(d),k=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.componentWillReceiveProps(e),n.handleVertexMouseUp=n.handleVertexMouseUp.bind(n),n.handleVertexMouseDown=n.handleVertexMouseDown.bind(n),n.handleVertexMouseMove=n.handleVertexMouseMove.bind(n),n}return a(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this;document.addEventListener("mouseup",function(){e.mouseDown=!1,e.state.temporaryLine&&e.setState({temporaryLine:null})});var t=window.getComputedStyle(this.element),n=t.borderLeftWidth,r=t.borderTopWidth,o=t.borderRightWidth,i=t.borderBottomWidth,a=t.paddingLeft,s=t.paddingTop,l=t.paddingRight,u=t.paddingBottom;this.setState({borderLeftWidth:parseFloat(n),borderTopWidth:parseFloat(r),borderRightWidth:parseFloat(o),borderBottomWidth:parseFloat(i),paddingLeft:parseFloat(a),paddingTop:parseFloat(s),paddingRight:parseFloat(l),paddingBottom:parseFloat(u)}),window.addEventListener("resize",function(){e.resize()}),this.resize()}},{key:"shouldComponentUpdate",value:function(e,t){for(var n in e)if(!["board","highlightVertices","dimmedStones","paintMap"].includes(n)&&e[n]!==this.props[n])return!0;for(var r in t)if(t[r]!==this.state[r])return!0;return e.board.getHash()!==this.props.board.getHash()||!p.equals(e.highlightVertices,this.props.highlightVertices)||!p.equals(e.dimmedStones,this.props.dimmedStones)||!p.equals(e.paintMap,this.props.paintMap)}},{key:"componentWillReceiveProps",value:function(e){var t=this,n=e.board,r=e.animatedVertex,o=function(e){return[e.width,e.height]};if(this.props&&p.vertexEquals(o(n),o(this.props.board))){if(r&&(!this.props.animatedVertex||!p.vertexEquals(r,this.props.animatedVertex))){var i=l(r,2),a=i[0],s=i[1],u=this.state.shifts;u[s][a]=g(9),this.readjustShifts(u,r),this.setState({shifts:u,animatedVertex:r}),setTimeout(function(){return t.setState({animatedVertex:null})},200)}}else{var c=v(n.width),h=v(n.height),d=n.getHandicapPlacement(9),f=h.map(function(e){return c.map(function(e){return g(9)})});this.readjustShifts(f),this.setState({rangeX:c,rangeY:h,hoshis:d,randomizer:h.map(function(e){return c.map(function(e){return g(5)})}),shifts:f},function(){return t.resize()})}}},{key:"componentDidUpdate",value:function(e){e.showCoordinates!==this.props.showCoordinates&&this.resize()}},{key:"resize",value:function(){if(this.element&&this.element.parentElement){var e=this.props,t=e.board,n=e.showCoordinates,r=e.onBeforeResize;(void 0===r?p.noop:r)();var o=window.getComputedStyle(this.element.parentElement),i=o.width,a=o.height;i=parseFloat(i),a=parseFloat(a);var s=t.width,l=t.height;n&&(s+=2,l+=2);var u=p.floorEven(i-this.state.paddingLeft-this.state.paddingRight-this.state.borderLeftWidth-this.state.borderRightWidth),c=p.floorEven(a-this.state.paddingTop-this.state.paddingBottom-this.state.borderTopWidth-this.state.borderBottomWidth),h=p.floorEven(Math.min(u/s,c/l,150)),d=h*s,f=h*l;this.setState({width:d+i-u,height:f+a-c,marginLeft:-(d+i-u)/2,marginTop:-(f+a-c)/2,innerWidth:d,innerHeight:f,innerMarginLeft:-d/2,innerMarginTop:-f/2,fieldSize:h})}}},{key:"readjustShifts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null==t){for(var n=[],r=0;r<e.length;r++)for(var o=0;o<e[0].length;o++)n.push.apply(n,s(this.readjustShifts(e,[o,r])));return n}var i=l(t,2),a=i[0],u=i[1],c=e[u][a],h=[[[1,5,8],[a-1,u],[3,7,6]],[[2,5,6],[a,u-1],[4,7,8]],[[3,7,6],[a+1,u],[1,5,8]],[[4,7,8],[a,u+1],[2,5,6]]],d=[],f=!0,p=!1,v=void 0;try{for(var g,m=h[Symbol.iterator]();!(f=(g=m.next()).done);f=!0){var y=g.value,b=l(y,3),w=b[0],k=l(b[1],2),_=k[0],x=k[1],C=b[2];w.includes(c)&&(e[x]&&C.includes(e[x][_])&&(e[x][_]=0,d.push([_,x])))}}catch(e){p=!0,v=e}finally{try{!f&&m.return&&m.return()}finally{if(p)throw v}}return d}},{key:"handleVertexMouseDown",value:function(e){var t=e.currentTarget;this.mouseDown=!0,this.startVertex=t.dataset.vertex.split("-").map(function(e){return+e})}},{key:"handleVertexMouseUp",value:function(e){if(this.mouseDown){var t=this.props,n=t.onVertexClick,r=void 0===n?p.noop:n,o=t.onLineDraw,i=void 0===o?p.noop:o,a=e.currentTarget;this.mouseDown=!1,e.vertex=a.dataset.vertex.split("-").map(function(e){return+e}),e.line=this.state.temporaryLine,null==e.x&&(e.x=e.clientX),null==e.y&&(e.y=e.clientY),e.line?i(e):r(e)}}},{key:"handleVertexMouseMove",value:function(e){var t=this.props,n=t.drawLineMode,r=t.onVertexMouseMove,o=void 0===r?p.noop:r,i=e.currentTarget;if(o(Object.assign(e,{mouseDown:this.mouseDown,startVertex:this.startVertex,vertex:i.dataset.vertex.split("-").map(function(e){return+e})})),n&&e.mouseDown&&0===e.button){var a=[e.startVertex,e.vertex];p.equals(a,this.state.temporaryLine)||this.setState({temporaryLine:a})}}},{key:"render",value:function(e,t){var n=this,r=e.board,o=e.paintMap,i=e.highlightVertices,a=void 0===i?[]:i,u=e.dimmedStones,c=void 0===u?[]:u,d=e.crosshair,v=void 0!==d&&d,g=e.showCoordinates,k=void 0!==g&&g,_=e.showMoveColorization,x=void 0===_||_,C=e.showNextMoves,S=void 0===C||C,M=e.showSiblings,T=void 0===M||M,A=e.fuzzyStonePlacement,P=void 0===A||A,E=e.animatedStonePlacement,D=void 0===E||E,O=e.drawLineMode,B=void 0===O?null:O,j=t.fieldSize,R=t.rangeY,N=t.rangeX,q=t.temporaryLine,L=t.animatedVertex,I=L?[L].concat(s(r.getNeighbors(L))):[],z=!!B&&!!q;return h("section",{ref:function(e){return n.element=e},id:"goban",class:f({goban:!0,crosshair:v,coordinates:k,movecolorization:x,variations:S,siblings:T,fuzzy:P,animation:D})},h("style",{},"\n #goban {\n font-size: "+j+"px;\n width: "+t.width+"px;\n height: "+t.height+"px;\n margin-left: "+t.marginLeft+"px;\n margin-top: "+t.marginTop+"px;\n }\n #goban > div {\n width: "+t.innerWidth+"px;\n height: "+t.innerHeight+"px;\n margin-left: "+t.innerMarginLeft+"px;\n margin-top: "+t.innerMarginTop+"px;\n }\n #goban > div > ol > li {\n width: "+j+"px;\n height: "+j+"px;\n }\n #goban > div > ol:not(.coordy) {\n height: "+j+"px;\n line-height: "+j+"px;\n margin-left: "+(k?j:0)+"px;\n }\n #goban > div > ol.coordy {\n width: "+j+"px;\n top: "+j+"px;\n line-height: "+j+"px;\n }\n #goban > div > ol.coordy:last-child {\n left: "+j*(r.width+1)+"px;\n }\n "),h("div",{},h(w,{rangeY:R}),h(b,{rangeX:N}),R.map(function(e){return h("ol",{class:"row"},N.map(function(t){var i=r.get([t,e]),s=r.markups[[t,e]]||[null,""],u=l(s,2),d=u[0],f=u[1],v=function(n){return p.vertexEquals(n,[t,e])};return h(m,{position:[t,e],shift:n.state.shifts[e][t],random:n.state.randomizer[e][t],sign:i,paint:o&&o[e]&&o[e][t],dimmed:c.some(v),highlight:a.some(v),hoshi:n.state.hoshis.some(v),animate:I.some(v),smalllabel:f.length>=3,markupType:d,label:f,ghostTypes:r.ghosts[[t,e]]||[],onMouseUp:n.handleVertexMouseUp,onMouseDown:n.handleVertexMouseDown,onMouseMove:n.handleVertexMouseMove})}))}),h(b,{rangeX:N}),h(w,{rangeY:R})),r.lines.map(function(e){var t=l(e,3),n=t[0],r=t[1],o=t[2];return z&&(p.equals([n,r],q)||(!o||"line"===B)&&p.equals([r,n],q))?void(z=!1):h(y,{v1:n,v2:r,showCoordinates:k,fieldSize:j,type:o?"arrow":"line"})}),z&&h(y,{temporary:!0,v1:q[0],v2:q[1],showCoordinates:k,fieldSize:j,type:B}))}}]),t}(d);e.exports=k},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=s.shell,u=s.clipboard,c=s.remote,h=(n(2).remote.Menu,n(0)),d=h.h,f=h.Component,p=n(3),v=n(1),g=c.require("./setting"),m=function(e){return g.set(e,!g.get(e))},y=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleCurrentPlayerClick=function(){return e.props.onCurrentPlayerClick},e.handleUndoButtonClick=function(){return sabaki.undo()},e.handleMenuClick=function(){var t=[{label:"About "+sabaki.appName+"…",click:function(){return l.openExternal("http://sabaki.yichuanshen.de")}},{type:"separator"},{label:"New File",click:function(){return sabaki.newFile({playSound:!0,showInfo:!0})}},{label:"Open File…",click:function(){return sabaki.loadFile()}},{label:"Download SGF",click:function(){return sabaki.saveFile(sabaki.state.representedFilename)}},{label:"Load SGF from Clipboard",click:function(){var e=u.readText();null!=e&&sabaki.loadContent(e,"sgf",{ignoreEncoding:!0})}},{label:"Copy SGF to Clipboard",click:function(){return u.writeText(sabaki.getSGF())}},{type:"separator"},{label:"Show &Coordinates",checked:g.get("view.show_coordinates"),click:function(){return m("view.show_coordinates")}},{label:"Show Move Colori&zation",checked:g.get("view.show_move_colorization"),click:function(){return m("view.show_move_colorization")}},{label:"Show &Next Moves",checked:g.get("view.show_next_moves"),click:function(){return m("view.show_next_moves")}},{label:"Show &Sibling Variations",checked:g.get("view.show_siblings"),click:function(){return m("view.show_siblings")}},{label:"&Manage Games…",click:function(){return sabaki.openDrawer("gamechooser")}},{type:"separator"},{label:"&Pass",click:function(){return sabaki.makeMove([-1,-1],{sendToEngine:!0})}},{label:"&Resign",click:function(){return sabaki.makeResign()}},{type:"separator"},{label:"Es&timate",click:function(){return sabaki.setMode("estimator")}},{label:"&Score",click:function(){return sabaki.setMode("scoring")}},{label:"&Edit",click:function(){return sabaki.setMode("edit")}},{label:"&Find",click:function(){return sabaki.setMode("find")}},{type:"separator"},{label:"&Info",click:function(){return sabaki.openDrawer("info")}}],n=e.menuButtonElement.getBoundingClientRect(),r=n.left,o=n.top;v.popupMenu(t,r,o)},e}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return e.mode!==this.props.mode||"play"===e.mode}},{key:"render",value:function(e){var t=this,n=e.mode,r=e.attachedEngines,o=e.playerNames,i=e.playerRanks,a=e.playerCaptures,s=e.currentPlayer,l=e.showHotspot,u=e.undoable,c=e.undoText,h=e.onCurrentPlayerClick,f=void 0===h?v.noop:h,g=function(e){return{opacity:0===a[e]?0:.7}},m=Array(r.length).fill(!1);return r.forEach(function(e,t){null!=e&&(o[t]=e.name,i[t]="Engine",m[t]=!0)}),d("header",{class:p({undoable:u,hotspot:l,current:"play"===n})},d("span",{id:"player_1"},d("span",{class:"captures",style:g(0)},a[0])," ",d("span",{class:p("name",{engine:m[0]}),title:i[0]},o[0]||"Black")),d("span",{id:"player_-1"},d("span",{class:p("name",{engine:m[1]}),title:i[1]},o[1]||"White")," ",d("span",{class:"captures",style:g(1)},a[1])),d("img",{src:"./img/ui/player_"+s+".svg",class:"current-player",height:22,title:"Change Player",onClick:f}),d("div",{class:"hotspot",title:"Hotspot"}),d("a",{class:"undo",title:c,onClick:this.handleUndoButtonClick},d("img",{src:"./node_modules/octicons/build/svg/mail-reply.svg",height:21})),d("a",{ref:function(e){return t.menuButtonElement=e},id:"headermenu",onClick:this.handleMenuClick},d("img",{src:"./node_modules/octicons/build/svg/three-bars.svg",height:21})))}}]),t}(f);e.exports=y},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=u.h,h=u.Component,d=n(3),f=n(11),p=n(1),v=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={stoneTool:1},e.handleToolButtonClick=e.handleToolButtonClick.bind(e),e}return a(t,e),l(t,[{key:"componentWillReceiveProps",value:function(e){var t=e.selectedTool;t!==this.props.selectedTool&&0===t.indexOf("stone")&&this.setState({stoneTool:+t.replace("stone_","")})}},{key:"shouldComponentUpdate",value:function(e){return e.mode!==this.props.mode||"edit"===e.mode}},{key:"handleToolButtonClick",value:function(e){var t=this.props,n=t.selectedTool,r=t.onToolButtonClick,o=void 0===r?p.noop:r;e.tool=e.currentTarget.dataset.id,0===e.tool.indexOf("stone")&&0===n.indexOf("stone")&&(e.tool="stone_"+-this.state.stoneTool,this.setState(function(e){return{stoneTool:-e.stoneTool}})),o(e)}},{key:"renderButton",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return c("li",{class:d({selected:n})},c("a",{title:e,href:"#","data-id":t,onClick:this.handleToolButtonClick},c("img",{src:"./img/edit/"+t+".svg"})))}},{key:"render",value:function(e,t){var n=this,o=e.selectedTool,i=t.stoneTool,a=function(e){return s(e,2)[1].replace(/_-?1$/,"")===o.replace(/_-?1$/,"")};return c(f,Object.assign({type:"edit"},this.props),c("ul",{},[["Stone Tool","stone_"+i],["Cross Tool","cross"],["Triangle Tool","triangle"],["Square Tool","square"],["Circle Tool","circle"],["Line Tool","line"],["Arrow Tool","arrow"],["Label Tool","label"],["Number Tool","number"]].map(function(e){return n.renderButton.apply(n,r(e).concat([a(e)]))})))}}]),t}(h);e.exports=v},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(11),h=(n(1),function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleButtonClick=function(){return sabaki.openDrawer("score")},e}return i(t,e),a(t,[{key:"render",value:function(e){var t=e.type,n=e.children,r=e.method,o=e.areaMap,i=e.scoreBoard,a=e.komi,s=i?i.getScore(o):{area:[],territory:[],captures:[]},u="area"===r?s.area[0]-s.area[1]-a:s.territory[0]-s.territory[1]+s.captures[0]-s.captures[1]-a,h=u>0?"B+"+u:u<0?"W+"+-u:"Draw";return l(c,Object.assign({type:t},this.props),l("button",{onClick:this.handleButtonClick},"Details",l("strong",{},h)),n)}}]),t}(u));e.exports=h},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(11),h=n(1),d=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleChange=function(e){sabaki.setState({findText:e.currentTarget.value})},e.handleButtonClick=function(t){t.preventDefault();var n=t.currentTarget.classList.contains("next")?1:-1,r=e.props.onButtonClick,o=void 0===r?h.noop:r;t.step=n,o(t)},e}return i(t,e),a(t,[{key:"render",value:function(e){var t=e.findText;return l(c,Object.assign({type:"find"},this.props),l("form",{},l("input",{type:"text",placeholder:"Find",value:t,onInput:this.handleChange}),l("button",{class:"next",onClick:this.handleButtonClick},l("img",{src:"./node_modules/octicons/build/svg/chevron-down.svg",height:20,alt:"Next"})),l("button",{class:"prev",onClick:this.handleButtonClick},l("img",{src:"./node_modules/octicons/build/svg/chevron-up.svg",height:20,alt:"Previous"}))))}}]),t}(u);e.exports=d},function(e,t,n){var r=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=n(13),i=(n(5),n(12)),a=n(4),s=n(8);t.meta={name:"wBaduk NGF",extensions:["ngf"]},t.parse=function(e){var t=n(14),l=n(15),u=e.split("\n"),c=u.slice(0,12).join(),h="utf8",d=l.detect(c);d.confidence>.2&&(h=d.encoding),e=t.decode(o.from(e,"binary"),h);var f=e.split("\n"),p=a.new(),v={};p.nodes.push(v),v.CA=["UTF-8"],v.FF=[4],v.GM=[1],v.SZ=[19];var g=Math.floor(parseFloat(f[1])),m=Math.floor(parseFloat(f[5])),y=f[2].split(" ")[0],b=f[3].split(" ")[0],w=f[8].slice(0,8),k=Math.floor(parseFloat(f[7]));Number.isNaN(g)&&(g=19),Number.isNaN(m)&&(m=0),Number.isNaN(k)&&(k=0);var _=f[2].trim().split(" ");if(_.length>1){var x=_[_.length-1];x=x.replace("DP","p").replace("K","k").replace("D","d"),v.WR=[x]}var C=f[3].trim().split(" ");if(C.length>1){var S=C[C.length-1];S=S.replace("DP","p").replace("K","k").replace("D","d"),v.BR=[S]}0===m&&k===Math.floor(k)&&(k+=.5);var M="",T="";if(f[10].includes("resign")&&(T="R"),f[10].includes("time")&&(T="T"),(f[10].includes("hite win")||f[10].includes("lack lose"))&&(M="W"),(f[10].includes("lack win")||f[10].includes("hite lose"))&&(M="B"),""===T){var A=null,P=f[10].split(" "),E=!0,D=!1,O=void 0;try{for(var B,j=P[Symbol.iterator]();!(E=(B=j.next()).done);E=!0){var R=B.value,N=parseFloat(R);!1===Number.isNaN(N)&&(A=N)}}catch(e){D=!0,O=e}finally{try{!E&&j.return&&j.return()}finally{if(D)throw O}}null!==A&&(T=A.toString())}if(""!==M&&(v.RE=[M+"+"+T]),v.SZ=[g],m>=2){v.HA=[m],v.AB=[];var q=new s(g,g),L=q.getHandicapPlacement(m),I=!0,z=!1,W=void 0;try{for(var F,V=L[Symbol.iterator]();!(I=(F=V.next()).done);I=!0){var G=F.value,U=r(G,2),H=U[0],Y=U[1],$=i.vertex2point([H,Y]);v.AB.push($)}}catch(e){z=!0,W=e}finally{try{!I&&V.return&&V.return()}finally{if(z)throw W}}}if(k&&(v.KM=[k]),8===w.length){for(var K=!0,X=0;X<8;X++){var Z=parseFloat(w.charAt(X));Number.isNaN(Z)&&(K=!1)}if(K){var J="";J+=w.slice(0,4),J+="-"+w.slice(4,6),J+="-"+w.slice(6,8),v.DT=[J]}}v.PW=[y],v.PB=[b];for(var Q=0;Q<f.length;Q++){var ee=f[Q].trim();if(ee.length>=7&&"PM"===ee.slice(0,2)){var te=ee.charAt(4);if("B"===te||"W"===te){var ne=ee.charCodeAt(5)-66,re=ee.charCodeAt(6)-66,oe=i.vertex2point([ne,re]),ie={};p.nodes.push(ie),ie[te]=[oe]}}}return[p]},t.parseFile=function(e){}},function(e,t,n){function r(e,t){var n={3:"B+R",4:"W+R",7:"B+T",8:"W+T"};if(void 0!==n[e])return n[e];if(0===e||1===e){return(0===e?"B":"W")+"+"+(t/10).toString()}return""}function o(e,t,n){var o="",i=t.exec(e);if(i){var a=parseFloat(i[1]);if(i=n.exec(e)){o=r(a,parseFloat(i[1]))}}return o}function i(e){var t="",n="",r=e.split("(");return 2===r.length&&r[1].indexOf(")")===r[1].length-1&&(t=r[0].trim(),n=r[1].slice(0,r[1].length-1)),""===t?[e,""]:[t,n]}var a=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=n(13),l=(n(5),n(12)),u=n(4),c=n(8);t.meta={name:"Tygem GIB",extensions:["gib"]},t.parse=function(e){var t=n(14),r=n(15),h="utf8",d=r.detect(e);d.confidence>.2&&(h=d.encoding),e=t.decode(s.from(e,"binary"),h);var f=e.split("\n"),p=u.new(),v={};p.nodes.push(v),v.CA=["UTF-8"],v.FF=[4],v.GM=[1],v.SZ=[19];for(var g=void 0,m=void 0,y=0;y<f.length;y++){var b=f[y].trim();if(b.startsWith("\\[GAMEBLACKNAME=")&&b.endsWith("\\]")){var w=b.slice(16,-2),k=i(w),_=a(k,2),x=_[0],C=_[1];x&&(v.PB=[x]),C&&(v.BR=[C])}else if(b.startsWith("\\[GAMEWHITENAME=")&&b.endsWith("\\]")){var S=b.slice(16,-2),M=i(S),T=a(M,2),A=T[0],P=T[1];A&&(v.PW=[A]),P&&(v.WR=[P])}else if(b.startsWith("\\[GAMEINFOMAIN=")){if(void 0===v.RE){var E=o(b,/GRLT:(\d+),/,/ZIPSU:(\d+),/);""!==E&&(v.RE=[E])}if(void 0===v.KM&&(g=/GONGJE:(\d+),/,m=g.exec(b))){var D=parseFloat(m[1])/10;v.KM=[D]}}else if(b.startsWith("\\[GAMETAG=")){if(void 0===v.DT&&(g=/C(\d\d\d\d):(\d\d):(\d\d)/,(m=g.exec(b))&&(v.DT=[m[1]+"-"+m[2]+"-"+m[3]])),void 0===v.RE){var O=o(b,/,W(\d+),/,/,Z(\d+),/);""!==O&&(v.RE=[O])}if(void 0===v.KM&&(g=/,G(\d+),/,m=g.exec(b))){var B=parseFloat(m[1])/10;v.KM=[B]}}else if("INI"===b.slice(0,3)){var j=b.split(" "),R=0,N=Math.floor(parseFloat(j[3]));if(!1===Number.isNaN(N)&&(R=N),R>=2&&R<=9){v.HA=[R],v.AB=[];var q=new c,L=q.getHandicapPlacement(R),I=!0,z=!1,W=void 0;try{for(var F,V=L[Symbol.iterator]();!(I=(F=V.next()).done);I=!0){var G=F.value,U=a(G,2),H=U[0],Y=U[1],$=l.vertex2point([H,Y]);v.AB.push($)}}catch(e){z=!0,W=e}finally{try{!I&&V.return&&V.return()}finally{if(z)throw W}}}}else if("STO"===b.slice(0,3)){var K=b.split(" ");if(K.length<6)continue;var X=void 0;X="1"===K[3]?"B":"W";var Z=Math.floor(parseFloat(K[4])),J=Math.floor(parseFloat(K[5]));if(Number.isNaN(Z)||Number.isNaN(J))continue;var Q=l.vertex2point([Z,J]),ee={};p.nodes.push(ee),ee[X]=[Q]}}return[p]},t.parseFile=function(e){}},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=u.remote,h=n(0),d=h.h,f=h.Component,p=n(4),v=(n(1),c.require("./setting")),g=n(38),m=n(39),y=n(40),b=v.get("view.sidebar_minwidth"),w=v.get("view.properties_minheight"),k=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.state={sidebarSplit:v.get("view.properties_height"),sidebarSplitTransition:!0},n.handleGraphNodeClick=function(e){var t=e.button,n=e.treePosition,o=e.x,i=e.y;if(0===t){var a;(a=sabaki).setCurrentTreePosition.apply(a,r(n))}else{var s;(s=sabaki).openNodeMenu.apply(s,r(n).concat([{x:o,y:i}]))}},n.handleVerticalResizerMouseDown=function(e){var t=e.button,r=e.x,o=e.y;0===t&&(n.oldSidebarWidth=n.props.sidebarWidth,n.oldMousePosition=[r,o],n.verticalResizerMouseDown=!0)},n.handleHorizontalResizerMouseDown=function(e){0===e.button&&(n.horizontalResizerMouseDown=!0)},n.handleSliderChange=function(e){var t=e.percent,r=Math.round((n.state.treeHeight-1)*t);sabaki.goToMoveNumber(r)},n.handleStartAutoscrolling=function(e){var t=e.step,r=v.get("autoscroll.min_interval"),o=v.get("autoscroll.diff");!function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;sabaki.goStep(t),clearTimeout(n.autoscrollId),n.autoscrollId=setTimeout(function(){return e(Math.max(r,i-o))},i)}(v.get("autoscroll.max_interval"))},n.handleStopAutoscrolling=function(){clearTimeout(n.autoscrollId)},n.handleCommentInput=function(e){var t;(t=sabaki).setComment.apply(t,r(n.props.treePosition).concat([e]))},n.componentWillReceiveProps(e),n}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){return e.showSidebar!=this.props.showSidebar||e.showSidebar}},{key:"componentWillReceiveProps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.treePosition,n=e.rootTree;this.props&&t===this.props.treePosition||this.setState({treeHeight:p.getHeight(n)})}},{key:"componentDidMount",value:function(){var e=this;document.addEventListener("mouseup",function(){(e.verticalResizerMouseDown||e.horizontalResizerMouseDown)&&(e.verticalResizerMouseDown=!1,e.horizontalResizerMouseDown=!1,v.set("view.properties_height",e.state.sidebarSplit),v.set("view.sidebar_width",e.props.sidebarWidth),e.setState({sidebarSplitTransition:!1}),window.dispatchEvent(new Event("resize")))}),document.addEventListener("mousemove",function(t){if(e.verticalResizerMouseDown){t.preventDefault();var n=e.props.sidebarWidth,r=[t.clientX,t.clientY].map(function(t,n){return t-e.oldMousePosition[n]});n=Math.max(b,e.oldSidebarWidth-r[0]),sabaki.setSidebarWidth(n)}else if(e.horizontalResizerMouseDown){t.preventDefault();var o=Math.min(100-w,Math.max(w,100-100*t.clientY/e.element.offsetHeight));e.setState({sidebarSplit:o,sidebarSplitTransition:!1})}})}},{key:"render",value:function(e,t){var n=this,r=e.mode,o=e.treePosition,i=(e.rootTree,e.showGameGraph),a=e.showCommentBox,l=e.sidebarWidth,u=e.graphGridSize,c=e.graphNodeSize,h=t.treeHeight,f=t.sidebarSplit,v=t.sidebarSplitTransition,b=s(o,2),w=b[0],k=b[1],_=w.nodes[k],x=p.getLevel(w,k);return d("section",{ref:function(e){return n.element=e},id:"sidebar",style:{width:l}},d("div",{class:"verticalresizer",onMouseDown:this.handleVerticalResizerMouseDown}),d(g,{showSlider:i,text:x,percent:x/(h-1)*100,height:i?a?100-f:100:0,onChange:this.handleSliderChange,onStartAutoscrolling:this.handleStartAutoscrolling,onStopAutoscrolling:this.handleStopAutoscrolling}),d(m,{treePosition:o,showGameGraph:i,viewportWidth:l,height:i?a?100-f:100:0,gridSize:u,nodeSize:c,onNodeClick:this.handleGraphNodeClick}),d(y,{mode:r,treePosition:o,showCommentBox:a,moveAnnotation:"BM"in _?[-1,_.BM[0]]:"DO"in _?[0,1]:"IT"in _?[1,1]:"TE"in _?[2,_.TE[0]]:[null,1],positionAnnotation:"UC"in _?[-2,_.UC[0]]:"GW"in _?[-1,_.GW[0]]:"DM"in _?[0,_.DM[0]]:"GB"in _?[1,_.GB[0]]:[null,1],title:"N"in _?_.N[0].trim():"",comment:"C"in _?_.C[0]:"",height:a?i?f:100:0,sidebarSplitTransition:v,onResizerMouseDown:this.handleHorizontalResizerMouseDown,onCommentInput:this.handleCommentInput}))}}]),t}(f);e.exports=k},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=s.remote,u=n(0),c=u.h,h=u.Component,d=n(1),f=l.require("./setting"),p=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleSliderAreaMouseDown=function(t){0===t.button&&(e.sliderAreaMouseDown=!0,document.dispatchEvent(new MouseEvent("mousemove",t)))},e.handleButtonMouseDown=function(t){if(0===t.button){var n=t.currentTarget.className,r=e.props.onStartAutoscrolling,o=void 0===r?d.noop:r;e.buttonMouseDown=n,o({step:"prev"===n?-1:1})}},e}return i(t,e),a(t,[{key:"componentDidMount",value:function(){var e=this;document.addEventListener("mouseup",function(){if(e.sliderAreaMouseDown=!1,null!=e.buttonMouseDown){var t=e.buttonMouseDown,n=e.props.onStopAutoscrolling,r=void 0===n?d.noop:n;e.buttonMouseDown=null,r({step:"prev"===t?-1:1})}}),document.addEventListener("mousemove",function(t){if(e.sliderAreaMouseDown){var n=e.props.onChange,r=void 0===n?d.noop:n,o=e.slidingAreaElement,i=o.offsetTop,a=o.offsetHeight;r({percent:Math.min(1,Math.max(0,(t.clientY-i)/a))})}})}},{key:"shouldComponentUpdate",value:function(e){var t=e.showSlider,n=e.height;return t&&(n!==this.props.height||this.sliderAreaMouseDown||this.buttonMouseDown||!this.dirty)}},{key:"componentWillReceiveProps",value:function(){var e=this;this.dirty=!0,clearTimeout(this.renderId),this.renderId=setTimeout(function(){e.dirty=!1,e.setState(e.state)},f.get("graph.delay"))}},{key:"render",value:function(e){var t=this,n=e.height,r=e.text,o=e.percent;return c("section",{id:"slider",style:{height:n+"%"}},c("a",{href:"#",class:"prev",onMouseDown:this.handleButtonMouseDown},"▲"),c("a",{href:"#",class:"next",onMouseDown:this.handleButtonMouseDown},"▼"),c("div",{ref:function(e){return t.slidingAreaElement=e},class:"inner",onMouseDown:this.handleSliderAreaMouseDown},c("span",{style:{top:o+"%"}},r)))}}]),t}(h);e.exports=p},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=n(2),u=l.remote,c=n(0),h=c.h,d=c.Component,f=n(3),p=n(4),v=n(1),g=u.require("./setting"),m=["graph.delay","graph.animation_duration","sgf.comment_properties","graph.edge_color","graph.edge_inactive_color","graph.edge_size","graph.edge_inactive_size","graph.node_color","graph.node_inactive_color","graph.node_active_color","graph.node_bookmark_color","graph.node_comment_color","graph.node_inactive_bookmark_color","graph.node_inactive_comment_color"].map(function(e){return g.get(e)}),y=s(m,14),b=y[0],w=(y[1],y[2]),k=y[3],_=y[4],x=y[5],C=y[6],S=y[7],M=y[8],T=y[9],A=y[10],P=y[11],E=y[12],D=y[13],O=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={hover:!1},e.handleMouseMove=function(t){if(e.element){var n=t.clientX,r=t.clientY,o=e.props,i=o.position,a=s(o.mouseShift,2),l=a[0],u=a[1],c=o.gridSize,h=[n+l,r+u],d=!1;h.every(function(e,t){return Math.ceil(i[t]-c/2)<=e&&e<=Math.floor(i[t]+c/2)-1})&&(d=!0),d!==e.state.hover&&e.setState({hover:d})}},e}return i(t,e),a(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousemove",this.handleMouseMove)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousemove",this.handleMouseMove)}},{key:"shouldComponentUpdate",value:function(e,t){var n=e.type,r=e.fill,o=e.nodeSize,i=e.gridSize,a=t.hover;return n!==this.props.type||r!==this.props.fill||o!==this.props.nodeSize||i!==this.props.gridSize||a!==this.state.hover}},{key:"render",value:function(e,t){var n=this,r=s(e.position,2),o=r[0],i=r[1],a=e.type,l=e.fill,u=e.nodeSize,c=t.hover;return h("path",{ref:function(e){return n.element=e},d:function(){var e=2*u;if("square"===a)return"M "+(o-u)+" "+(i-u)+"\n h "+e+" v "+e+" h "+-e+" v "+-e;if("circle"===a)return"M "+o+" "+i+" m "+-u+" 0\n a "+u+" "+u+" 0 1 0 "+e+" 0\n a "+u+" "+u+" 0 1 0 "+-e+" 0";if("diamond"===a){var t=Math.round(Math.sqrt(2)*u);return"M "+o+" "+(i-t)+"\n L "+(o-t)+" "+i+" L "+o+" "+(i+t)+"\n L "+(o+t)+" "+i+" L "+o+" "+(i-t)}return""}(),class:f({hover:c}),fill:l})}}]),t}(d),B=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.positionAbove,n=e.positionBelow,r=e.current,o=e.length,i=e.gridSize;return o!==this.props.length||r!==this.props.current||i!==this.props.gridSize||!v.vertexEquals(t,this.props.positionAbove)||!v.vertexEquals(n,this.props.positionBelow)}},{key:"render",value:function(e){var t=s(e.positionAbove,2),n=t[0],r=t[1],o=s(e.positionBelow,2),i=o[0],a=o[1],l=e.length,u=e.gridSize,c=e.current,d=void 0;return d=n===i?n+","+r+" "+n+","+(a+l):n+","+r+" "+(i-u)+","+(a-u)+"\n "+i+","+a+" "+i+","+(a+l),h("polyline",{points:d,fill:"none",stroke:c?k:_,"stroke-width":c?x:C})}}]),t}(d),j=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={cameraPosition:[-e.gridSize,-e.gridSize],viewportSize:[e.viewportWidth,e.height],viewportPosition:[0,0],matrixDict:null},n.mousePosition=[-100,-100],n.matrixDictHash=null,n.matrixDictCache={},n.handleNodeClick=n.handleNodeClick.bind(n),n.handleGraphMouseDown=n.handleGraphMouseDown.bind(n),n}return i(t,e),a(t,[{key:"componentDidMount",value:function(){var e=this;document.addEventListener("mousemove",function(t){if(e.svgElement){var n=t.clientX,r=t.clientY,o=t.movementX,i=t.movementY,a=e.state,l=s(a.cameraPosition,2),u=l[0],c=l[1],h=s(a.viewportPosition,2),d=h[0],f=h[1];0===e.mouseDown?e.drag=!0:(o=0,i=0,e.drag=!1),e.mousePosition=[n-d,r-f],e.drag&&(t.preventDefault(),e.setState({cameraPosition:[u-o,c-i]}))}}),document.addEventListener("mouseup",function(){e.mouseDown=null}),window.addEventListener("resize",function(){clearTimeout(e.remeasureId),e.remeasureId=setTimeout(function(){return e.remeasure()},500)}),this.remeasure(),this.componentWillReceiveProps()}},{key:"shouldComponentUpdate",value:function(e){var t=e.showGameGraph;return e.height!==this.props.height||t&&!this.dirty}},{key:"componentWillReceiveProps",value:function(){var e=this;(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).treePosition!==this.props.treePosition&&(this.dirty=!0,clearTimeout(this.renderId),this.renderId=setTimeout(function(){return e.updateCameraPosition()},b))}},{key:"componentDidUpdate",value:function(e){var t=this,n=e.height,r=e.showGameGraph;n!==this.props.height&&setTimeout(function(){return t.remeasure()},200),r!==this.props.showGameGraph&&setTimeout(function(){return t.updateCameraPosition()},200)}},{key:"getMatrixDict",value:function(e){var t=p.getMatrixHash(e);return t!==this.matrixDictHash&&(this.matrixDictHash=t,this.matrixDictCache=p.getMatrixDict(e)),this.matrixDictCache}},{key:"updateCameraPosition",value:function(){var e=this.props,t=e.gridSize,n=s(e.treePosition,2),r=n[0],o=n[1],i=r.id+"-"+o,a=this.getMatrixDict(p.getRoot(r)),l=s(a,2),u=l[0],c=l[1],h=s(c[i],2),d=h[0],f=h[1],v=p.getMatrixWidth(f,u),g=s(v,2),m=g[0],y=g[1],b=1===m?0:1-2*(d-y)/(m-1),w=(m-1)*t/2;w=Math.min(w,this.state.viewportSize[0]/2-t),this.dirty=!1,this.setState({matrixDict:[u,c],cameraPosition:[d*t+b*w-this.state.viewportSize[0]/2,f*t-this.state.viewportSize[1]/2].map(function(e){return Math.round(e)})})}},{key:"remeasure",value:function(){if(this.props.showGameGraph){var e=this.element.getBoundingClientRect(),t=e.left,n=e.top,r=e.width,o=e.height;this.setState({viewportSize:[r,o],viewportPosition:[t,n]})}}},{key:"handleGraphMouseDown",value:function(e){this.mouseDown=e.button}},{key:"handleNodeClick",value:function(e){if(this.drag)return void(this.drag=!1);var t=this.props,n=t.onNodeClick,r=void 0===n?v.noop:n,o=t.gridSize,i=this.state,a=s(i.matrixDict,1),l=a[0],u=s(i.cameraPosition,2),c=u[0],h=u[1],d=s(this.mousePosition,2),f=d[0],p=d[1],g=[f+c,p+h].map(function(e){return Math.round(e/o)}),m=s(g,2),y=m[0],b=m[1];l[b]&&l[b][y]&&(e.treePosition=l[b][y],r(e))}},{key:"renderNodes",value:function(e,t){var n=this,r=e.gridSize,o=e.nodeSize,i=s(t.matrixDict,2),a=i[0],l=i[1],u=s(t.cameraPosition,2),c=u[0],d=u[1],f=s(t.viewportSize,2),g=f[0],m=f[1],y=s(t.viewportPosition,2),b=y[0],k=y[1],_=[],x=[],C=[c,d].map(function(e){return Math.max(Math.ceil(e/r)-2,0)}),j=s(C,2),R=j[0],N=j[1],q=[c,d].map(function(e,t){return(e+[g,m][t])/r+2}),L=s(q,2),I=L[0],z=L[1];N-=3,z+=3;for(var W=[],F=[],V=[],G=R;G<=I;G++){for(var U=[],H=N;H<=z;H++){(function(e){if(null==a[e]||null==a[e][G])return"continue";var t=s(a[e][G],2),i=t[0],u=t[1],f=i.nodes[u],g=void 0;F.includes(i.id)?g=!0:V.includes(i.id)?g=!1:i.parent?F.includes(i.parent.id)?i.parent.subtrees[i.parent.current]!==i?(g=!1,V.push(i.id)):(g=!0,F.push(i.id)):V.includes(i.parent.id)?(g=!1,V.push(i.id)):(g=p.onCurrentTrack(i),g?F.push(i.id):V.push(i.id)):(g=!0,F.push(i.id));var m=S;m=g?v.vertexEquals(n.props.treePosition,[i,u])?T:"HO"in f?A:w.some(function(e){return e in f})?P:S:"HO"in f?E:w.some(function(e){return e in f})?D:M;var y=G*r,_=e*r;if(U.push(h(O,{key:e,mouseShift:[c-b,d-k],position:[y,_],type:"B"in f&&""===f.B[0]||"W"in f&&""===f.W[0]?"square":"B"in f||"W"in f?"circle":"diamond",fill:m,nodeSize:o,gridSize:r})),!W.includes(i.id)){var C=void 0,j=void 0;if(0===u&&i.parent){var R=p.navigate(i,u,-1),N=s(R,2),q=N[0],L=N[1],I=s(l[q.id+"-"+L],2),z=I[0],H=I[1];C=[z*r,H*r],j=[y,_]}else{var Y=s(l[i.id+"-0"],2),$=Y[0],K=Y[1];C=[$*r,K*r],j=C}null!=C&&null!=j&&(x[g?"push":"unshift"](h(B,{key:i.id,positionAbove:C,positionBelow:j,length:(i.nodes.length-1)*r,current:g,gridSize:r})),W.push(i.id))}if(u===i.nodes.length-1){var X=!0,Z=!1,J=void 0;try{for(var Q,ee=i.subtrees[Symbol.iterator]();!(X=(Q=ee.next()).done);X=!0){var te=Q.value,ne=g&&i.subtrees[i.current]===te,re=s(l[te.id+"-0"],2),oe=re[0],ie=re[1];x[ne?"push":"unshift"](h(B,{key:te.id,positionAbove:[y,_],positionBelow:[oe*r,ie*r],length:(te.nodes.length-1)*r,current:ne,gridSize:r})),W.push(te.id)}}catch(e){Z=!0,J=e}finally{try{!X&&ee.return&&ee.return()}finally{if(Z)throw J}}}})(H)}U.length>0&&_.push(h("g",{key:G},U))}return[h("g",{},x),h("g",{},_)]}},{key:"render",value:function(e,t){var n=this,r=e.height,o=(e.treePosition,e.showGameGraph),i=t.matrixDict,a=t.viewportSize,l=s(t.cameraPosition,2),u=l[0],c=l[1];return h("section",{ref:function(e){return n.element=e},id:"graph"},h("style",{},"\n #graph {\n height: "+r+"%;\n }\n #graph svg > * {\n transform: translate("+-u+"px, "+-c+"px);\n }\n "),o&&i&&a&&h("svg",{ref:function(e){return n.svgElement=e},width:a[0],height:a[1],onClick:this.handleNodeClick,onContextMenu:this.handleNodeClick,onMouseDown:this.handleGraphMouseDown,onMouseUp:this.handleGraphMouseUp},this.renderNodes(this.props,this.state)))}}]),t}(d);e.exports=j},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=u.remote,h=n(0),d=h.h,f=h.Component,p=n(3),v=n(41),g=n(20),m=n(4),y=n(1),b=c.require("./setting"),w=n(7),k=w.sgf,_=n(8),x=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleEditButtonClick=function(){return sabaki.setMode("edit")},e}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.treePosition,n=e.moveAnnotation,r=e.positionAnnotation,o=e.title,i=s(t,2),a=i[0],l=i[1];return o!==this.props.title||!a.parent&&0===l||0===a.subtrees.length&&l===a.nodes.length-1||t!==this.props.treePosition||!y.vertexEquals(n,this.props.moveAnnotation)||!y.vertexEquals(r,this.props.positionAnnotation)}},{key:"getCurrentMoveInterpretation",value:function(){var e=this.props,t=s(e.treePosition,2),n=t[0],o=t[1],i=e.board,a=n.nodes[o];if(!n.parent&&0===o){var l=[];if("EV"in a&&l.push(a.EV[0]),"GN"in a&&l.push(a.GN[0]),""!==(l=l.filter(function(e){return""!==e.trim()}).join(" — ")))return l;var u=new Date;if(25===u.getDate()&&3===u.getMonth())return"Happy Birthday, Sabaki!"}if(0===n.subtrees.length&&o===n.nodes.length-1&&m.onMainTrack(n)){var c=m.getRoot(n).nodes[0];if("RE"in c&&""!==c.RE[0].trim())return"Result: "+c.RE[0]}var h=m.navigate(n,o,-1);if(h){var d=h[0].nodes[h[1]].board||m.getBoard.apply(m,r(h));if(!y.vertexEquals(d.captures,i.captures))return"Take"}var f=void 0;if("B"in a&&""!==a.B[0])f=k.point2vertex(a.B[0]);else{if(!("W"in a&&""!==a.W[0]))return"W"in a||"B"in a?"Pass":"";f=k.point2vertex(a.W[0])}return g.getMoveInterpretation(i,f)||""}},{key:"render",value:function(e){var t=s(e.moveAnnotation,2),n=t[0],r=t[1],o=s(e.positionAnnotation,2),i=o[0],a=o[1],l=e.title,u={"-1":["Bad move","badmove"],0:["Doubtful move","doubtfulmove"],1:["Interesting move","interestingmove"],2:["Good move","goodmove"]};if(r>1)for(var c in u)u[c][0]="Very "+u[c][0].toLowerCase();var h={"-1":["Good for white","white"],0:["Even position","balance"],1:["Good for black","black"],"-2":["Unclear position","unclear"]};if(a>1)for(var f in h)h[f][0]="Very "+h[f][0].toLowerCase();var v=b.get("comments.show_move_interpretation");return d("p",{class:p({header:!0,movestatus:null!==n,positionstatus:null!==i})},d("img",{width:16,height:16,class:"positionstatus",title:i in h?h[i][0]:"",src:i in h?"./img/ui/"+h[i][1]+".svg":""}),d("img",{width:16,height:16,class:"movestatus",title:n in u?u[n][0]:"",src:n in u?"./img/ui/"+u[n][1]+".svg":""}),d("img",{src:"./node_modules/octicons/build/svg/pencil.svg",class:"edit-button",title:"Edit",width:16,height:16,onClick:this.handleEditButtonClick}),d("span",{},""!==l?l:v?this.getCurrentMoveInterpretation():""))}}]),t}(f),C=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.board;return e.comment!==this.props.comment||t.width!==this.props.board.width||t.height!==this.props.board.height}},{key:"render",value:function(e){var t=this,n=e.board,r=e.comment;return d("div",{ref:function(e){return t.element=e},class:"comment"},d(v,{tag:"div",board:n,dangerouslySetInnerHTML:{__html:y.markdown(r)}}))}}]),t}(f),S=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.state={board:new _},n.handleCommentInput=function(){var e=n.props.onCommentInput;(void 0===e?y.noop:e)({title:n.titleInputElement.value,comment:n.textareaElement.value})},n.handleMenuButtonClick=function(){var e,t=n.menuButtonElement.getBoundingClientRect(),o=t.left,i=t.bottom;(e=sabaki).openCommentMenu.apply(e,r(n.props.treePosition).concat([{x:Math.round(o),y:Math.round(i)}]))},n}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.showCommentBox;return e.height!==this.props.height||t&&!this.dirty}},{key:"componentWillReceiveProps",value:function(e){var t=this,n=e.treePosition;if("edit"!==e.mode){this.dirty=!0;var o=n!==this.props.treePosition;clearTimeout(this.updateId),this.updateId=setTimeout(function(){t.dirty=!1,o?(t.setState({board:m.getBoard.apply(m,r(t.props.treePosition))}),"edit"===t.props.mode&&(t.element.scrollTop=0,o&&(t.textareaElement.scrollTop=0)),t.element.scrollTop=0):t.setState(t.state)},b.get("graph.delay"))}}},{key:"render",value:function(e,t){var n=this,r=e.treePosition,o=e.height,i=e.sidebarSplitTransition,a=e.moveAnnotation,s=e.positionAnnotation,l=e.title,u=e.comment,c=e.onResizerMouseDown,h=void 0===c?y.noop:c,f=e.onLinkClick,p=void 0===f?y.noop:f,v=e.onCoordinateMouseEnter,g=void 0===v?y.noop:v,m=e.onCoordinateMouseLeave,b=void 0===m?y.noop:m,w=t.board;return d("section",{ref:function(e){return n.element=e},id:"properties",style:{transition:i?null:"none",height:o+"%"}},d("div",{class:"horizontalresizer",onMouseDown:h}),d("div",{class:"inner"},d(x,{board:w,treePosition:r,moveAnnotation:a,positionAnnotation:s,title:l}),d(C,{board:w,comment:u,onLinkClick:p,onCoordinateMouseEnter:g,onCoordinateMouseLeave:b})),d("div",{class:"edit"},d("div",{class:"header"},d("img",{ref:function(e){return n.menuButtonElement=e},src:"./node_modules/octicons/build/svg/chevron-down.svg",width:16,height:16,onClick:this.handleMenuButtonClick}),d("div",{},d("input",{ref:function(e){return n.titleInputElement=e},type:"text",name:"title",value:l,placeholder:"Title",onInput:this.handleCommentInput}))),d("textarea",{ref:function(e){return n.textareaElement=e},placeholder:"Comment",value:u,onInput:this.handleCommentInput})))}}]),t}(f);e.exports=S},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=s.shell,u=n(0),c=u.h,h=u.Component,d=(n(4),n(1),function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e=this,t=!0,n=!1,r=void 0;try{for(var o,i=this.element.querySelectorAll("a")[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){o.value.addEventListener("click",function(e){var t=e.currentTarget;if(t.classList.contains("external"))e.preventDefault(),l.openExternal(t.href);else if(t.classList.contains("movenumber")){e.preventDefault();var n=+t.innerText.slice(1);sabaki.setUndoPoint("Go Back"),sabaki.goToMainVariation(),sabaki.goToMoveNumber(n)}})}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}var a=!0,s=!1,u=void 0;try{for(var c,h=this.element.querySelectorAll(".coord")[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;!function(t){t.addEventListener("mouseenter",function(n){var r=e.props.board,o=r.coord2vertex(t.innerText);sabaki.setState({highlightVertices:[o]})}),t.addEventListener("mouseleave",function(e){sabaki.setState({highlightVertices:[]})})}(d)}}catch(e){s=!0,u=e}finally{try{!a&&h.return&&h.return()}finally{if(s)throw u}}}},{key:"render",value:function(e){var t=this,n=e.tag;return c(n,Object.assign({ref:function(e){return t.element=e}},this.props))}}]),t}(h));e.exports=d},function(e,t){e.exports="(;GM[1]AP[Sabaki:0.30.0]CA[UTF-8]SZ[19]\n(;AB[dd][kc][qd]N[Low Chinese opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][lc][mc][nc][oc][pc][qc][rc][sc][ad][bd][cd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][pd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[kc][dd][qd]\n)(;AB[dd][kd][qd]N[High Chinese opening]AE[so]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][oc][pc][qc][rc][sc][ad][bd][cd][ed][fd][gd][hd][id][jd][ld][md][nd][od][pd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[dd][kd][qd]\n)(;AB[dd][pc][qe]N[Orthodox opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][oc][qc][rc][sc][ad][bd][cd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][pd][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][re][se][af][bf][cf][df][ef][ff][gf][hf][if][jf][kf][lf][mf][nf][of][pf][qf][rf][sf]MA[pc][dd][qe]\n)(;AB[cd][pc][qe]N[Orthodox opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][oc][qc][rc][sc][ad][bd][dd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][pd][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][re][se][af][bf][cf][df][ef][ff][gf][hf][if][jf][kf][lf][mf][nf][of][pf][qf][rf][sf]MA[pc][cd][qe]\n)(;AB[dc][nc][jd]AW[pd]N[Kobayashi opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][ec][fc][gc][hc][ic][jc][kc][lc][mc][oc][pc][qc][rc][sc][ad][bd][cd][dd][ed][fd][gd][hd][id][kd][ld][md][nd][od][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[dc][nc][jd][pd]\n)(;AB[cd][nc][ic]AW[pd]N[Small Chinese opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][jc][kc][lc][mc][oc][pc][qc][rc][sc][ad][bd][dd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[ic][nc][cd][pd]\n)(;AB[cd][hc][nc]AW[pd]N[Micro Chinese opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][ic][jc][kc][lc][mc][oc][pc][qc][rc][sc][ad][bd][dd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[hc][nc][cd][pd]\n)(;AB[pd][jd][dd]N[Sanrensei opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][oc][pc][qc][rc][sc][ad][bd][cd][ed][fd][gd][hd][id][kd][ld][md][nd][od][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[dd][jd][pd]\n)(;AB[dd][pd]N[Nirensei opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][oc][pc][qc][rc][sc][ad][bd][cd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][qd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][se]MA[dd][pd]\n)(;AB[qd][pq][cp][pe]AW[dc][oc][qo]N[Shūsaku opening]C[size: 19, type: corner]CR[aa][ba][ca][da][ea][fa][ga][ha][ia][ja][ka][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][eb][fb][gb][hb][ib][jb][kb][lb][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][ec][fc][gc][hc][ic][jc][kc][lc][mc][nc][pc][qc][rc][sc][ad][bd][cd][dd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][pd][rd][sd][ae][be][ce][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][qe][re][se][af][bf][cf][df][ef][ff][gf][hf][if][jf][kf][lf][mf][nf][of][pf][qf][rf][sf][ag][bg][cg][dg][eg][fg][gg][hg][ig][jg][kg][lg][mg][ng][og][pg][qg][rg][sg][ah][bh][ch][dh][eh][fh][gh][hh][ih][jh][kh][lh][mh][nh][oh][ph][qh][rh][sh][ai][bi][ci][di][ei][fi][gi][hi][ii][ji][ki][li][mi][ni][oi][pi][qi][ri][si][aj][bj][cj][dj][ej][fj][gj][hj][ij][jj][kj][lj][mj][nj][oj][pj][qj][rj][sj][ak][bk][ck][dk][ek][fk][gk][hk][ik][jk][kk][lk][mk][nk][ok][pk][qk][rk][sk][al][bl][cl][dl][el][fl][gl][hl][il][jl][kl][ll][ml][nl][ol][pl][ql][rl][sl][am][bm][cm][dm][em][fm][gm][hm][im][jm][km][lm][mm][nm][om][pm][qm][rm][sm][an][bn][cn][dn][en][fn][gn][hn][in][jn][kn][ln][mn][nn][on][pn][qn][rn][sn][ao][bo][co][do][eo][fo][go][ho][io][jo][ko][lo][mo][no][oo][po][ro][so][ap][bp][dp][ep][fp][gp][hp][ip][jp][kp][lp][mp][np][op][pp][qp][rp][sp][aq][bq][cq][dq][eq][fq][gq][hq][iq][jq][kq][lq][mq][nq][oq][qq][rq][sq][ar][br][cr][dr][er][fr][gr][hr][ir][jr][kr][lr][mr][nr][or][pr][qr][rr][sr][as][bs][cs][ds][es][fs][gs][hs][is][js][ks][ls][ms][ns][os][ps][qs][rs][ss]MA[dc][oc][qd][pe][qo][cp][pq]\n)(;AE[oc][qd]AB[qc]N[3-3 point]C[type: corner]CR[qa][ra][sa][qb][rb][sb][rc][sc]MA[qc]\n)(;AW[qd]AB[oc]N[Low approach]C[type: corner]CR[na][nb][nc][nd][ne][oa][ob][od][oe][pa][pb][pc][pd][pe][qa][qb][qc][qe][ra][rb][rc][rd][re][sa][sb][sc][sd][se]MA[oc]\n)(;AW[pd]AB[nc]N[Low approach]C[type: corner]CR[ma][mb][mc][md][me][na][nb][nd][ne][oa][ob][oc][od][oe][pa][pb][pc][pe][qa][qb][qc][qd][qe][ra][rb][rc][rd][re][sa][sb][sc][sd][se]MA[nc]\n)(;AW[qd]AB[od]N[High approach]C[type: corner]CR[na][nb][nc][nd][ne][oa][ob][oc][oe][pa][pb][pc][pd][pe][qa][qb][qc][qe][ra][rb][rc][rd][re][sa][sb][sc][sd][se]MA[od]\n)(;AW[pd]AB[nd]N[High approach]C[type: corner]CR[ma][mb][mc][md][me][na][nb][nc][ne][oa][ob][oc][od][oe][pa][pb][pc][pe][qa][qb][qc][qd][qe][ra][rb][rc][rd][re][sa][sb][sc][sd][se]MA[nd]\n)(;AB[oc][qd]N[Low enclosure]C[type: corner]CR[na][oa][pa][qa][ra][sa][nb][ob][pb][qb][rb][sb][nc][pc][qc][rc][sc][nd][od][pd][rd][sd][ne][oe][pe][qe][re][se]MA[oc][qd]\n)(;AB[nc][pd]N[Low enclosure]C[type: corner]CR[ma][na][oa][pa][qa][ra][sa][mb][nb][ob][pb][qb][rb][sb][mc][oc][pc][qc][rc][sc][md][nd][od][qd][rd][sd][me][ne][oe][pe][qe][re][se]MA[nc][pd]\n)(;AB[od][qd]N[High enclosure]C[type: corner]CR[na][oa][pa][qa][ra][sa][nb][ob][pb][qb][rb][sb][nc][oc][pc][qc][rc][sc][nd][pd][rd][sd][ne][oe][pe][qe][re][se]MA[od][qd]\n)(;AB[nd][pd]N[High enclosure]C[type: corner]CR[ma][na][oa][pa][qa][ra][sa][mb][nb][ob][pb][qb][rb][sb][mc][nc][oc][pc][qc][rc][sc][md][od][qd][rd][sd][me][ne][oe][pe][qe][re][se]MA[nd][pd]\n)(;AB[nc][qd]N[Low enclosure]C[type: corner]CR[ma][na][oa][pa][qa][ra][sa][mb][nb][ob][pb][qb][rb][sb][mc][oc][pc][qc][rc][sc][md][nd][od][pd][rd][sd][me][ne][oe][pe][qe][re][se]MA[nc][qd]\n)(;AB[mc][pd]N[Low enclosure]C[type: corner]CR[la][ma][na][oa][pa][qa][ra][sa][lb][mb][nb][ob][pb][qb][rb][sb][lc][nc][oc][pc][qc][rc][sc][ld][md][nd][od][qd][rd][sd][le][me][ne][oe][pe][qe][re][se]MA[mc][pd]\n)(;AB[nd][qd]N[High enclosure]C[type: corner]CR[ma][na][oa][pa][qa][ra][sa][mb][nb][ob][pb][qb][rb][sb][mc][nc][oc][pc][qc][rc][sc][md][od][pd][rd][sd][me][ne][oe][pe][qe][re][se]MA[nd][qd]\n)(;AB[md][pd]N[High enclosure]C[type: corner]CR[la][ma][na][oa][pa][qa][ra][sa][lb][mb][nb][ob][pb][qb][rb][sb][lc][mc][nc][oc][pc][qc][rc][sc][ld][nd][od][qd][rd][sd][le][me][ne][oe][pe][qe][re][se]MA[md][pd]\n)(;AB[dd][de][ef][ff][fd]N[Mouth shape]CR[ec][ed][fe][ge]MA[dd][fd][de][ef][ff]\n)(;AB[dd][de][fd][ff]N[Table shape]MA[dd][fd][de][ff]CR[ed][ee][fe][ge]\n)(;AB[dd][ed][df][fg]N[Tippy table]CR[de][ee][ef][ff]MA[fg]\n)(;AB[dd][ed][df][ef]N[Bamboo joint]MA[dd][ed][df][ef]CR[de][ee]\n)(;AB[dd][de][fd][ge]N[Trapezium]CR[ed][gd][ee][fe][ff]MA[fd][ge]\n)(;AB[dd][ce][ee][df]N[Diamond]MA[dd][ce][ee][df]CR[de]\n)(;AB[dd][ee][fd]N[Tiger’s mouth]CR[ec][ed]MA[dd][fd][ee]\n)(;AB[dd][de][ed]N[Empty triangle]MA[dd][ed][de]CR[ee]\n)(;AB[dd][ed][ee]AW[de]N[Turn]MA[dd][ee]\n)(;AB[dd][de]N[Stretch]MA[dd][de]\n)(;AB[dd][ee]N[Diagonal]MA[dd][ee]CR[ed][de]\n)(;AB[dd]AW[ed][cd]N[Wedge]CR[dc][de]MA[dd]\n)(;AB[dd][ee]AW[ed]N[Hane]MA[dd][ee]CR[de]\n)(;AB[dd][ee]AW[ed][de]N[Cut]MA[dd][ee]\n)(;AB[dd][fd][ff][df]N[Square]MA[dd][fd][df][ff]CR[ee]\n)(;AB[dd][fe][df][fg]N[Parallelogram]MA[dd][fe][df][fg]CR[ee][ef]\n)(;AB[dd][df][fe]N[Dog’s head]MA[dd][fe][df]CR[ed][de][ee][ef]\n)(;AB[dd][df][ge]N[Horse’s head]MA[dd][ge][df]CR[ed][de][ee][fe][ef]\n)(;AB[dd]AW[ed]N[Attachment]CR[dc][ec][de][ee]MA[dd]\n)(;AB[dd][fd]N[One-point jump]MA[dd][fd]CR[ed]\n)(;AB[dd][fe][eg]N[Big bulge]MA[dd][fe][eg]CR[ee][ef]\n)(;AB[dd][fe]N[Small knight]MA[dd][fe]CR[ed][ee]\n)(;AB[dd][gd]N[Two-point jump]MA[dd][gd]CR[ed][fd]\n)(;AB[dd][ge]N[Large knight]MA[dd][ge]CR[ed][fd][ee][fe]\n)(;AB[dd]AW[ee]N[Shoulder hit]CR[cc][dc][ec][cd][ed][ce][de]MA[dd]\n)(;AB[dd][ff]N[Diagonal jump]MA[dd][ff]CR[ed][de][ee][fe][ef]\n))"},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(4),h=n(44),d=n(47),f=n(6),p=n(48),v=n(6),g=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleScoreSubmit=function(t){var n=t.resultString;e.props.rootTree.nodes[0].RE=[n],sabaki.closeDrawer(),setTimeout(function(){return sabaki.setMode("play")},500)},e.handleGameSelect=function(e){var t=e.selectedTree;sabaki.closeDrawer(),sabaki.setMode("play"),sabaki.setCurrentTreePosition(t,0)},e.handleGameTreesChange=function(t){var n=t.gameTrees,r=e.props,o=(r.gameTrees,r.gameIndex),i=r.rootTree;if(!n.includes(i)){var a;0===n.length&&(n=[sabaki.getEmptyGameTree()]);var s=Math.min(Math.max(o-1,0),n.length-1),l=[n[s],0];(a=sabaki).setCurrentTreePosition.apply(a,l)}sabaki.setState({gameTrees:n})},e}return i(t,e),a(t,[{key:"render",value:function(e){var t=e.mode,n=e.openDrawer,r=e.gameTrees,o=e.gameIndex,i=e.treePosition,a=(e.rootTree,e.gameInfo),s=e.currentPlayer,u=e.scoringMethod,g=e.scoreBoard,m=e.areaMap,y=e.engines,b=e.attachedEngines,w=e.graphGridSize,k=e.preferencesTab;return l("section",{},l(h,{show:"info"===n,engines:b,treePosition:i,gameInfo:a,currentPlayer:s}),l(f,{show:"preferences"===n,tab:k,engines:y,graphGridSize:w}),l(p,{show:"gamechooser"===n,gameTrees:r,gameIndex:o,onItemClick:this.handleGameSelect,onChange:this.handleGameTreesChange}),l(v,{show:"cleanmarkup"===n,treePosition:i}),l(d,{show:"score"===n,estimating:"estimator"===t,areaMap:m,board:g,method:u,komi:+c.getRootProperty(i[0],"KM",0),onSubmitButtonClick:this.handleScoreSubmit}))}}]),t}(u);e.exports=g},function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),h=c.remote,d=n(0),f=d.h,p=d.Component,v=(n(3),n(45)),g=n(17),m=(n(4),n(1)),y=h.require("./setting"),b=n(7),w=b.sgf,k=function(e){function t(){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),u(t,[{key:"render",value:function(e){var t=e.title,n=e.children;return f("li",{},f("label",{},f("span",{},t+":"),n[0]),n.slice(1))}}]),t}(p),_=function(e){function t(){i(this,t);var e=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleSubmitButtonClick=function(t){var n;t.preventDefault();var r=l(e.props.treePosition,2),i=r[0],a=(r[1],!i.parent&&1===i.nodes.length&&0===i.subtrees.length),s=["blackName","blackRank","whiteName","whiteRank","gameName","eventName","date","result","komi"],u=s.reduce(function(t,n){return t[n]=Array.isArray(e.state[n])&&e.state[n].every(function(e){return null==e})?null:e.state[n],t},{});a&&(u.handicap=e.state.handicap,u.size=e.state.size),sabaki.setGameInfo(e.props.treePosition[0],u),sabaki.closeDrawer(),(n=sabaki).attachEngines.apply(n,o(e.state.engines)),sabaki.setState(sabaki.state,function(){var t=e.props.currentPlayer>0?0:1;null!=sabaki.attachedEngineControllers[t]&&sabaki.startGeneratingMoves()})},e.handleCancelButtonClick=function(e){e.preventDefault(),sabaki.closeDrawer()},e.handleBoardWidthFocus=function(){e.combinedSizeFields=e.state.size[0]===e.state.size[1]},e.handleBoardWidthChange=function(t){var n=t.currentTarget.value;""===n&&(n=null),e.setState(function(t){var r=l(t.size,2),o=r[1];return{size:[n,e.combinedSizeFields?n:o]}})},e.handleBoardHeightChange=function(t){var n=t.currentTarget.value;""===n&&(n=null),e.setState(function(e){return{size:[l(e.size,1)[0],n]}})},e.handleSizeSwapButtonClick=function(){e.setState(function(e){return{size:e.size.reverse()}})},e.handleSwapPlayers=function(){e.setState(function(e){var t=e.engines,n=e.blackName,r=e.blackRank,o=e.whiteName,i=e.whiteRank;return{engines:(t||[null,null]).reverse(),blackName:o,whiteName:n,blackRank:i,whiteRank:r}})},e.handleDateInputChange=function(t){e.setState({date:t.currentTarget.value}),e.markDates()},e.handleDateInputFocus=function(){e.pikaday.show()},e.handleDateInputBlur=function(){setTimeout(function(){e.elementInPikaday(document.activeElement)||e.pikaday.hide()},50)},e.handleShowResultClick=function(){e.setState({showResult:!0})},e.handleInputChange=["blackRank","blackName","whiteRank","whiteName","gameName","eventName","komi","result","handicap"].reduce(function(t,n){return t[n]=function(t){var o=t.currentTarget;e.setState(r({},n,""===o.value?null:o.value))},t},{}),e.handleEngineMenuClick=[0,1].map(function(t){return function(n){var i=y.get("engines.list"),a=["blackName","whiteName"][t],s=null==e.state.engines[t]?null==e.state[a]:e.state[a]===e.state.engines[t].name.trim(),l=[{label:"Manual",type:"checkbox",checked:null==e.state.engines[t],click:function(){var n=e.state.engines;null!=n[t]&&(n[t]=null,e.setState(r({engines:n},a,s?null:e.state[a])))}},{type:"separator"}].concat(o(i.map(function(n){return{label:n.name.trim()||"(Unnamed Engine)",type:"checkbox",checked:n===e.state.engines[t],click:function(){var o=e.state.engines;o[t]=n,e.setState(r({engines:o},a,s?n.name.trim():e.state[a]))}}})),[i.length>0&&{type:"separator"},{label:"Manage Engines…",click:function(){sabaki.setState({preferencesTab:"engines"}),sabaki.openDrawer("preferences")}}]).filter(function(e){return!!e}),u=n.currentTarget.getBoundingClientRect(),c=u.left,h=u.bottom;m.popupMenu(l,c,h)}}),e}return s(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){var t=e.gameInfo,n=e.engines,r=e.show;!this.props.show&&r&&this.setState(Object.assign({},t,{engines:[].concat(o(n)),showResult:!t.result||""===t.result.trim()}))}},{key:"componentDidMount",value:function(){this.preparePikaday()}},{key:"shouldComponentUpdate",value:function(e){var t=e.show;return t!==this.props.show||t}},{key:"markDates",value:function(){var e=(w.string2dates(this.state.date||"")||[]).filter(function(e){return 3===e.length}),t=!0,n=!1,r=void 0;try{for(var o,i=this.pikaday.el.querySelectorAll(".pika-button")[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;!function(t){var n=+t.dataset.pikaYear,r=+t.dataset.pikaMonth,o=+t.dataset.pikaDay;t.parentElement.classList.toggle("is-multi-selected",e.some(function(e){return m.shallowEquals(e,[n,r+1,o])}))}(a)}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}}},{key:"adjustPikadayPosition",value:function(){var e=this.dateInputElement.getBoundingClientRect(),t=e.left,n=e.top,r=this.pikaday.el,o=r.getBoundingClientRect(),i=o.height;r.style.position="absolute",r.style.left=Math.round(t)+"px",r.style.top=Math.round(n-i)+"px"}},{key:"elementInPikaday",value:function(e){for(;e.parentElement;){if(e===this.pikaday.el)return!0;e=e.parentElement}return!1}},{key:"preparePikaday",value:function(){var e=this;this.pikaday=new v({position:"top left",firstDay:1,yearRange:6,keyboardInput:!1,onOpen:function(){if(e.pikaday){var t=(w.string2dates(e.state.date||"")||[]).filter(function(e){return 3===e.length});t.length>0?e.pikaday.setDate(t[0].join("-"),!0):e.pikaday.gotoToday(),e.adjustPikadayPosition()}},onDraw:function(){e.pikaday&&e.pikaday.isVisible()&&(e.adjustPikadayPosition(),e.markDates(),e.dateInputElement.focus())},onSelect:function(t){if(e.pikaday){var n=w.string2dates(e.state.date||"")||[];t=[t.getFullYear(),t.getMonth()+1,t.getDate()],n.some(function(e){return m.shallowEquals(e,t)})?n=n.filter(function(e){return!m.shallowEquals(e,t)}):n.push(t),e.setState({date:w.dates2string(n.sort(m.lexicalCompare))}),e.markDates()}}}),document.removeEventListener("keydown",this.pikaday._onKeyChange),this.pikaday.hide(),document.body.appendChild(this.pikaday.el),document.body.addEventListener("click",function(t){e.pikaday.isVisible()&&document.activeElement!==e.dateInputElement&&t.target!==e.dateInputElement&&!e.elementInPikaday(t.target)&&e.pikaday.hide()}),window.addEventListener("resize",function(){return e.adjustPikadayPosition()})}},{key:"render",value:function(e,t){var n=this,r=e.treePosition,i=e.currentPlayer,a=e.show,s=t.showResult,u=void 0!==s&&s,c=(t.engines,t.blackName),h=void 0===c?null:c,d=t.blackRank,p=void 0===d?null:d,v=t.whiteName,y=void 0===v?null:v,b=t.whiteRank,w=void 0===b?null:b,_=t.gameName,x=void 0===_?null:_,C=t.eventName,S=void 0===C?null:C,M=t.date,T=void 0===M?null:M,A=t.result,P=void 0===A?null:A,E=t.komi,D=void 0===E?null:E,O=t.handicap,B=void 0===O?0:O,j=t.size,R=void 0===j?[null,null]:j,N=l(r,2),q=N[0],L=(N[1],!q.parent&&1===q.nodes.length&&0===q.subtrees.length);return f(g,{type:"info",show:a},f("form",{},f("section",{},f("span",{},!1," ",f("input",{type:"text",name:"rank_1",placeholder:"Rank",value:p,onInput:this.handleInputChange.blackRank}),f("input",{type:"text",name:"name_1",placeholder:"Black",value:h,onInput:this.handleInputChange.blackName})),f("img",{class:"current-player",src:"./img/ui/player_"+i+".svg",height:31,title:"Swap",onClick:this.handleSwapPlayers}),f("span",{},f("input",{type:"text",name:"name_-1",placeholder:"White",value:y,onInput:this.handleInputChange.whiteName}),f("input",{type:"text",name:"rank_-1",placeholder:"Rank",value:w,onInput:this.handleInputChange.whiteRank})," ",!1)),f("ul",{},f(k,{title:"Name"},f("input",{type:"text",placeholder:"(Unnamed)",value:x,onInput:this.handleInputChange.gameName})),f(k,{title:"Event"},f("input",{type:"text",placeholder:"None",value:S,onInput:this.handleInputChange.eventName})),f(k,{title:"Date"},f("input",{ref:function(e){return n.dateInputElement=e},type:"text",placeholder:"None",value:T,onFocus:this.handleDateInputFocus,onBlur:this.handleDateInputBlur,onInput:this.handleDateInputChange})),f(k,{title:"Komi"},f("input",{type:"number",name:"komi",step:.5,placeholder:0,value:null==D?"":D,onInput:this.handleInputChange.komi})),f(k,{title:"Result"},u?f("input",{type:"text",placeholder:"None",value:P,onInput:this.handleInputChange.result}):f("button",{type:"button",onClick:this.handleShowResultClick},"Show")),f(k,{title:"Handicap"},f("select",{selectedIndex:Math.max(0,B-1),disabled:!L,onChange:this.handleInputChange.handicap},f("option",{value:0},"No stones"),[].concat(o(Array(8))).map(function(e,t){return f("option",{value:t+2},t+2+" stones")}))),f(k,{title:"Board Size"},f("input",{type:"number",name:"size-width",placeholder:19,max:25,min:3,value:R[0],disabled:!L,onFocus:this.handleBoardWidthFocus,onInput:this.handleBoardWidthChange})," ",f("span",{title:"Swap",style:{cursor:L?"pointer":"default"},onClick:L?this.handleSizeSwapButtonClick:m.noop},"×")," ",f("input",{type:"number",name:"size-height",placeholder:19,max:25,min:3,value:R[1],disabled:!L,onInput:this.handleBoardHeightChange}))),f("p",{},f("button",{type:"submit",onClick:this.handleSubmitButtonClick},"OK")," ",f("button",{type:"reset",onClick:this.handleCancelButtonClick},"Cancel"))))}}]),t}(p);e.exports=_},function(e,t,n){var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};/*!
* Pikaday
*
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
*/
!function(i,a){"use strict";var s;if("object"===o(t)){try{s=n(16)}catch(e){}e.exports=a(s)}else void 0!==(r=function(e){try{s=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}()}catch(e){}return a(s)}.call(t,n,t,e))&&(e.exports=r)}(0,function(e){"use strict";var t="function"==typeof e,n=!!window.addEventListener,r=window.document,i=window.setTimeout,a=function(e,t,r,o){n?e.addEventListener(t,r,!!o):e.attachEvent("on"+t,r)},s=function(e,t,r,o){n?e.removeEventListener(t,r,!!o):e.detachEvent("on"+t,r)},l=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},u=function(e,t){return-1!==(" "+e.className+" ").indexOf(" "+t+" ")},c=function(e,t){u(e,t)||(e.className=""===e.className?t:e.className+" "+t)},h=function(e,t){e.className=l((" "+e.className+" ").replace(" "+t+" "," "))},d=function(e){return/Array/.test(Object.prototype.toString.call(e))},f=function(e){return/Date/.test(Object.prototype.toString.call(e))&&!isNaN(e.getTime())},p=function(e){var t=e.getDay();return 0===t||6===t},v=function(e){return e%4==0&&e%100!=0||e%400==0},g=function(e,t){return[31,v(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},m=function(e){f(e)&&e.setHours(0,0,0,0)},y=function(e,t){return e.getTime()===t.getTime()},b=function e(t,n,r){var i,a;for(i in n)a=void 0!==t[i],a&&"object"===o(n[i])&&null!==n[i]&&void 0===n[i].nodeName?f(n[i])?r&&(t[i]=new Date(n[i].getTime())):d(n[i])?r&&(t[i]=n[i].slice(0)):t[i]=e({},n[i],r):!r&&a||(t[i]=n[i]);return t},w=function(e,t,n){var o;r.createEvent?(o=r.createEvent("HTMLEvents"),o.initEvent(t,!0,!1),o=b(o,n),e.dispatchEvent(o)):r.createEventObject&&(o=r.createEventObject(),o=b(o,n),e.fireEvent("on"+t,o))},k=function(e){return e.month<0&&(e.year-=Math.ceil(Math.abs(e.month)/12),e.month+=12),e.month>11&&(e.year+=Math.floor(Math.abs(e.month)/12),e.month-=12),e},_={field:null,bound:void 0,position:"bottom left",reposition:!0,format:"YYYY-MM-DD",toString:null,parse:null,defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,pickWholeWeek:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,enableSelectionDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,blurFieldOnSelect:!0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},theme:null,events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null,keyboardInput:!0},x=function(e,t,n){for(t+=e.firstDay;t>=7;)t-=7;return n?e.i18n.weekdaysShort[t]:e.i18n.weekdays[t]},C=function(e){var t=[],n="false";if(e.isEmpty){if(!e.showDaysInNextAndPreviousMonths)return'<td class="is-empty"></td>';t.push("is-outside-current-month"),e.enableSelectionDaysInNextAndPreviousMonths||t.push("is-selection-disabled")}return e.isDisabled&&t.push("is-disabled"),e.isToday&&t.push("is-today"),e.isSelected&&(t.push("is-selected"),n="true"),e.hasEvent&&t.push("has-event"),e.isInRange&&t.push("is-inrange"),e.isStartRange&&t.push("is-startrange"),e.isEndRange&&t.push("is-endrange"),'<td data-day="'+e.day+'" class="'+t.join(" ")+'" aria-selected="'+n+'"><button class="pika-button pika-day" type="button" data-pika-year="'+e.year+'" data-pika-month="'+e.month+'" data-pika-day="'+e.day+'">'+e.day+"</button></td>"},S=function(e,t,n){var r=new Date(n,0,1);return'<td class="pika-week">'+Math.ceil(((new Date(n,t,e)-r)/864e5+r.getDay()+1)/7)+"</td>"},M=function(e,t,n,r){return'<tr class="pika-row'+(n?" pick-whole-week":"")+(r?" is-selected":"")+'">'+(t?e.reverse():e).join("")+"</tr>"},T=function(e){return"<tbody>"+e.join("")+"</tbody>"},A=function(e){var t,n=[];for(e.showWeekNumber&&n.push("<th></th>"),t=0;t<7;t++)n.push('<th scope="col"><abbr title="'+x(e,t)+'">'+x(e,t,!0)+"</abbr></th>");return"<thead><tr>"+(e.isRTL?n.reverse():n).join("")+"</tr></thead>"},P=function(e,t,n,r,o,i){var a,s,l,u,c,h=e._o,f=n===h.minYear,p=n===h.maxYear,v='<div id="'+i+'" class="pika-title" role="heading" aria-live="assertive">',g=!0,m=!0;for(l=[],a=0;a<12;a++)l.push('<option value="'+(n===o?a-t:12+a-t)+'"'+(a===r?' selected="selected"':"")+(f&&a<h.minMonth||p&&a>h.maxMonth?'disabled="disabled"':"")+">"+h.i18n.months[a]+"</option>");for(u='<div class="pika-label">'+h.i18n.months[r]+'<select class="pika-select pika-select-month" tabindex="-1">'+l.join("")+"</select></div>",d(h.yearRange)?(a=h.yearRange[0],s=h.yearRange[1]+1):(a=n-h.yearRange,s=1+n+h.yearRange),l=[];a<s&&a<=h.maxYear;a++)a>=h.minYear&&l.push('<option value="'+a+'"'+(a===n?' selected="selected"':"")+">"+a+"</option>");return c='<div class="pika-label">'+n+h.yearSuffix+'<select class="pika-select pika-select-year" tabindex="-1">'+l.join("")+"</select></div>",h.showMonthAfterYear?v+=c+u:v+=u+c,f&&(0===r||h.minMonth>=r)&&(g=!1),p&&(11===r||h.maxMonth<=r)&&(m=!1),0===t&&(v+='<button class="pika-prev'+(g?"":" is-disabled")+'" type="button">'+h.i18n.previousMonth+"</button>"),t===e._o.numberOfMonths-1&&(v+='<button class="pika-next'+(m?"":" is-disabled")+'" type="button">'+h.i18n.nextMonth+"</button>"),v+="</div>"},E=function(e,t,n){return'<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="'+n+'">'+A(e)+T(t)+"</table>"},D=function(o){var s=this,l=s.config(o);s._onMouseDown=function(e){if(s._v){e=e||window.event;var t=e.target||e.srcElement;if(t)if(u(t,"is-disabled")||(!u(t,"pika-button")||u(t,"is-empty")||u(t.parentNode,"is-disabled")?u(t,"pika-prev")?s.prevMonth():u(t,"pika-next")&&s.nextMonth():(s.setDate(new Date(t.getAttribute("data-pika-year"),t.getAttribute("data-pika-month"),t.getAttribute("data-pika-day"))),l.bound&&i(function(){s.hide(),l.blurFieldOnSelect&&l.field&&l.field.blur()},100))),u(t,"pika-select"))s._c=!0;else{if(!e.preventDefault)return e.returnValue=!1,!1;e.preventDefault()}}},s._onChange=function(e){e=e||window.event;var t=e.target||e.srcElement;t&&(u(t,"pika-select-month")?s.gotoMonth(t.value):u(t,"pika-select-year")&&s.gotoYear(t.value))},s._onKeyChange=function(e){if(e=e||window.event,s.isVisible())switch(e.keyCode){case 13:case 27:l.field&&l.field.blur();break;case 37:e.preventDefault(),s.adjustDate("subtract",1);break;case 38:s.adjustDate("subtract",7);break;case 39:s.adjustDate("add",1);break;case 40:s.adjustDate("add",7)}},s._onInputChange=function(n){var r;n.firedBy!==s&&(l.parse?r=l.parse(l.field.value,l.format):t?(r=e(l.field.value,l.format,l.formatStrict),r=r&&r.isValid()?r.toDate():null):r=new Date(Date.parse(l.field.value)),f(r)&&s.setDate(r),s._v||s.show())},s._onInputFocus=function(){s.show()},s._onInputClick=function(){s.show()},s._onInputBlur=function(){var e=r.activeElement;do{if(u(e,"pika-single"))return}while(e=e.parentNode);s._c||(s._b=i(function(){s.hide()},50)),s._c=!1},s._onClick=function(e){e=e||window.event;var t=e.target||e.srcElement,r=t;if(t){!n&&u(t,"pika-select")&&(t.onchange||(t.setAttribute("onchange","return;"),a(t,"change",s._onChange)));do{if(u(r,"pika-single")||r===l.trigger)return}while(r=r.parentNode);s._v&&t!==l.trigger&&r!==l.trigger&&s.hide()}},s.el=r.createElement("div"),s.el.className="pika-single"+(l.isRTL?" is-rtl":"")+(l.theme?" "+l.theme:""),a(s.el,"mousedown",s._onMouseDown,!0),a(s.el,"touchend",s._onMouseDown,!0),a(s.el,"change",s._onChange),l.keyboardInput&&a(r,"keydown",s._onKeyChange),l.field&&(l.container?l.container.appendChild(s.el):l.bound?r.body.appendChild(s.el):l.field.parentNode.insertBefore(s.el,l.field.nextSibling),a(l.field,"change",s._onInputChange),l.defaultDate||(t&&l.field.value?l.defaultDate=e(l.field.value,l.format).toDate():l.defaultDate=new Date(Date.parse(l.field.value)),l.setDefaultDate=!0));var c=l.defaultDate;f(c)?l.setDefaultDate?s.setDate(c,!0):s.gotoDate(c):s.gotoDate(new Date),l.bound?(this.hide(),s.el.className+=" is-bound",a(l.trigger,"click",s._onInputClick),a(l.trigger,"focus",s._onInputFocus),a(l.trigger,"blur",s._onInputBlur)):this.show()};return D.prototype={config:function(e){this._o||(this._o=b({},_,!0));var t=b(this._o,e,!0);t.isRTL=!!t.isRTL,t.field=t.field&&t.field.nodeName?t.field:null,t.theme="string"==typeof t.theme&&t.theme?t.theme:null,t.bound=!!(void 0!==t.bound?t.field&&t.bound:t.field),t.trigger=t.trigger&&t.trigger.nodeName?t.trigger:t.field,t.disableWeekends=!!t.disableWeekends,t.disableDayFn="function"==typeof t.disableDayFn?t.disableDayFn:null;var n=parseInt(t.numberOfMonths,10)||1;if(t.numberOfMonths=n>4?4:n,f(t.minDate)||(t.minDate=!1),f(t.maxDate)||(t.maxDate=!1),t.minDate&&t.maxDate&&t.maxDate<t.minDate&&(t.maxDate=t.minDate=!1),t.minDate&&this.setMinDate(t.minDate),t.maxDate&&this.setMaxDate(t.maxDate),d(t.yearRange)){var r=(new Date).getFullYear()-10;t.yearRange[0]=parseInt(t.yearRange[0],10)||r,t.yearRange[1]=parseInt(t.yearRange[1],10)||r}else t.yearRange=Math.abs(parseInt(t.yearRange,10))||_.yearRange,t.yearRange>100&&(t.yearRange=100);return t},toString:function(n){return n=n||this._o.format,f(this._d)?this._o.toString?this._o.toString(this._d,n):t?e(this._d).format(n):this._d.toDateString():""},getMoment:function(){return t?e(this._d):null},setMoment:function(n,r){t&&e.isMoment(n)&&this.setDate(n.toDate(),r)},getDate:function(){return f(this._d)?new Date(this._d.getTime()):null},setDate:function(e,t){if(!e)return this._d=null,this._o.field&&(this._o.field.value="",w(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof e&&(e=new Date(Date.parse(e))),f(e)){var n=this._o.minDate,r=this._o.maxDate;f(n)&&e<n?e=n:f(r)&&e>r&&(e=r),this._d=new Date(e.getTime()),m(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),w(this._o.field,"change",{firedBy:this})),t||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(e){var t=!0;if(f(e)){if(this.calendars){var n=new Date(this.calendars[0].year,this.calendars[0].month,1),r=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),o=e.getTime();r.setMonth(r.getMonth()+1),r.setDate(r.getDate()-1),t=o<n.getTime()||r.getTime()<o}t&&(this.calendars=[{month:e.getMonth(),year:e.getFullYear()}],"right"===this._o.mainCalendar&&(this.calendars[0].month+=1-this._o.numberOfMonths)),this.adjustCalendars()}},adjustDate:function(e,t){var n,r=this.getDate()||new Date,o=24*parseInt(t)*60*60*1e3;"add"===e?n=new Date(r.valueOf()+o):"subtract"===e&&(n=new Date(r.valueOf()-o)),this.setDate(n)},adjustCalendars:function(){this.calendars[0]=k(this.calendars[0]);for(var e=1;e<this._o.numberOfMonths;e++)this.calendars[e]=k({month:this.calendars[0].month+e,year:this.calendars[0].year});this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(e){isNaN(e)||(this.calendars[0].month=parseInt(e,10),this.adjustCalendars())},nextMonth:function(){this.calendars[0].month++,this.adjustCalendars()},prevMonth:function(){this.calendars[0].month--,this.adjustCalendars()},gotoYear:function(e){isNaN(e)||(this.calendars[0].year=parseInt(e,10),this.adjustCalendars())},setMinDate:function(e){e instanceof Date?(m(e),this._o.minDate=e,this._o.minYear=e.getFullYear(),this._o.minMonth=e.getMonth()):(this._o.minDate=_.minDate,this._o.minYear=_.minYear,this._o.minMonth=_.minMonth,this._o.startRange=_.startRange),this.draw()},setMaxDate:function(e){e instanceof Date?(m(e),this._o.maxDate=e,this._o.maxYear=e.getFullYear(),this._o.maxMonth=e.getMonth()):(this._o.maxDate=_.maxDate,this._o.maxYear=_.maxYear,this._o.maxMonth=_.maxMonth,this._o.endRange=_.endRange),this.draw()},setStartRange:function(e){this._o.startRange=e},setEndRange:function(e){this._o.endRange=e},draw:function(e){if(this._v||e){var t,n=this._o,r=n.minYear,o=n.maxYear,a=n.minMonth,s=n.maxMonth,l="";this._y<=r&&(this._y=r,!isNaN(a)&&this._m<a&&(this._m=a)),this._y>=o&&(this._y=o,!isNaN(s)&&this._m>s&&(this._m=s)),t="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var u=0;u<n.numberOfMonths;u++)l+='<div class="pika-lendar">'+P(this,u,this.calendars[u].year,this.calendars[u].month,this.calendars[0].year,t)+this.render(this.calendars[u].year,this.calendars[u].month,t)+"</div>";this.el.innerHTML=l,n.bound&&"hidden"!==n.field.type&&i(function(){n.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),n.bound&&n.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var e,t,n,o,i,a,s,l,u,c;if(!this._o.container){if(this.el.style.position="absolute",e=this._o.trigger,t=e,n=this.el.offsetWidth,o=this.el.offsetHeight,i=window.innerWidth||r.documentElement.clientWidth,a=window.innerHeight||r.documentElement.clientHeight,s=window.pageYOffset||r.body.scrollTop||r.documentElement.scrollTop,"function"==typeof e.getBoundingClientRect)c=e.getBoundingClientRect(),l=c.left+window.pageXOffset,u=c.bottom+window.pageYOffset;else for(l=t.offsetLeft,u=t.offsetTop+t.offsetHeight;t=t.offsetParent;)l+=t.offsetLeft,u+=t.offsetTop;(this._o.reposition&&l+n>i||this._o.position.indexOf("right")>-1&&l-n+e.offsetWidth>0)&&(l=l-n+e.offsetWidth),(this._o.reposition&&u+o>a+s||this._o.position.indexOf("top")>-1&&u-o-e.offsetHeight>0)&&(u=u-o-e.offsetHeight),this.el.style.left=l+"px",this.el.style.top=u+"px"}},render:function(e,t,n){var r=this._o,o=new Date,i=g(e,t),a=new Date(e,t,1).getDay(),s=[],l=[];m(o),r.firstDay>0&&(a-=r.firstDay)<0&&(a+=7);for(var u=0===t?11:t-1,c=11===t?0:t+1,h=0===t?e-1:e,d=11===t?e+1:e,v=g(h,u),b=i+a,w=b;w>7;)w-=7;b+=7-w;for(var k=!1,_=0,x=0;_<b;_++){var T=new Date(e,t,_-a+1),A=!!f(this._d)&&y(T,this._d),P=y(T,o),D=-1!==r.events.indexOf(T.toDateString()),O=_<a||_>=i+a,B=_-a+1,j=t,R=e,N=r.startRange&&y(r.startRange,T),q=r.endRange&&y(r.endRange,T),L=r.startRange&&r.endRange&&r.startRange<T&&T<r.endRange,I=r.minDate&&T<r.minDate||r.maxDate&&T>r.maxDate||r.disableWeekends&&p(T)||r.disableDayFn&&r.disableDayFn(T);O&&(_<a?(B=v+B,j=u,R=h):(B-=i,j=c,R=d));var z={day:B,month:j,year:R,hasEvent:D,isSelected:A,isToday:P,isDisabled:I,isEmpty:O,isStartRange:N,isEndRange:q,isInRange:L,showDaysInNextAndPreviousMonths:r.showDaysInNextAndPreviousMonths,enableSelectionDaysInNextAndPreviousMonths:r.enableSelectionDaysInNextAndPreviousMonths};r.pickWholeWeek&&A&&(k=!0),l.push(C(z)),7==++x&&(r.showWeekNumber&&l.unshift(S(_-a,t,e)),s.push(M(l,r.isRTL,r.pickWholeWeek,k)),l=[],x=0,k=!1)}return E(r,s,n)},isVisible:function(){return this._v},show:function(){this.isVisible()||(this._v=!0,this.draw(),h(this.el,"is-hidden"),this._o.bound&&(a(r,"click",this._onClick),this.adjustPosition()),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var e=this._v;!1!==e&&(this._o.bound&&s(r,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",c(this.el,"is-hidden"),this._v=!1,void 0!==e&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){var e=this._o;this.hide(),s(this.el,"mousedown",this._onMouseDown,!0),s(this.el,"touchend",this._onMouseDown,!0),s(this.el,"change",this._onChange),e.keyboardInput&&s(r,"keydown",this._onKeyChange),e.field&&(s(e.field,"change",this._onInputChange),e.bound&&(s(e.trigger,"click",this._onInputClick),s(e.trigger,"focus",this._onInputFocus),s(e.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},D})},function(e,t){function n(e){throw new Error("Cannot find module '"+e+"'.")}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=46},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=s.remote,u=n(0),c=u.h,h=u.Component,d=n(3),f=n(17),p=n(1),v=l.require("./setting"),g=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"render",value:function(e){var t=e.method,n=e.score,r=e.komi,o=e.sign,i=o>0?0:1,a="area"===t?n.area[i]:n.territory[i]+n.captures[i];return o<0&&(a+=r),c("tr",{},c("th",{},c("img",{src:"./img/goban/stone_"+o+".png",alt:o>0?"Black":"White",width:24,height:24})),c("td",{class:d({disabled:"territory"===t})},n.area[i]),c("td",{class:d({disabled:"area"===t})},n.territory[i]),c("td",{class:d({disabled:"area"===t})},n.captures[i]),c("td",{},o<0?r:"-"),c("td",{},a))}}]),t}(h),m=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleTerritoryButtonClick=function(){return v.set("scoring.method","territory")},e.handleAreaButtonClick=function(){return v.set("scoring.method","area")},e.handleCloseButtonClick=function(){return sabaki.closeDrawer()},e.handleSubmitButtonClick=function(t){t.preventDefault();var n=e.props.onSubmitButtonClick,r=void 0===n?p.noop:n;t.resultString=e.resultString,r(t)},e}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return null!=e.areaMap}},{key:"render",value:function(e){var t=e.show,n=e.estimating,r=e.method,o=e.areaMap,i=e.board,a=e.komi;isNaN(a)&&(a=0);var s=i?i.getScore(o):{area:[],territory:[],captures:[]},l="area"===r?s.area[0]-s.area[1]-a:s.territory[0]-s.territory[1]+s.captures[0]-s.captures[1]-a;return this.resultString=l>0?"B+"+l:l<0?"W+"+-l:"Draw",c(f,{type:"score",show:t},c("h2",{},"Score"),c("ul",{class:"tabs"},c("li",{class:d({current:"area"===r})},c("a",{href:"#",onClick:this.handleAreaButtonClick},"Area")),c("li",{class:d({current:"territory"===r})},c("a",{href:"#",onClick:this.handleTerritoryButtonClick},"Territory"))),c("table",{},c("thead",{},c("tr",{},c("th"),c("th",{disabled:"territory"===r},"Area"),c("th",{disabled:"area"===r},"Territory"),c("th",{disabled:"area"===r},"Captures"),c("th",{},"Komi"),c("th",{},"Total"))),c("tbody",{},c(g,{method:r,score:s,komi:a,sign:1}),c(g,{method:r,score:s,komi:a,sign:-1}))),c("form",{},c("p",{},"Result: ",c("span",{class:"result"},this.resultString)," ",!n&&c("button",{type:"submit",onClick:this.handleSubmitButtonClick},"Update Result")," ",c("button",{type:"reset",onClick:this.handleCloseButtonClick},"Close"))))}}]),t}(h);e.exports=m},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=u.remote,h=n(0),d=h.h,f=h.Component,p=n(3),v=n(49),g=n(17),m=n(21),y=n(7),b=n(4),w=n(1),k=c.require("./setting"),_=y.sgf,x=k.get("gamechooser.thumbnail_size"),C=x+12+20,S=function(e){var t=b.navigate(e,0,30);return t||(t=b.navigate(e,0,b.getCurrentHeight(e)-1)),b.getBoard.apply(b,a(t))},M=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=["Click","ContextMenu","DragStart","DragOver"],i=!0,a=!1,s=void 0;try{for(var l,u=n[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var c=l.value;!function(t){e["handle"+t]=function(n){var r=e.props["on"+t];n.tree=e.props.tree,r&&r(n)}}(c)}}catch(e){a=!0,s=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw s}}return e}return i(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){for(var t in e)if(e[t]!==this.props[t])return!0;return!1}},{key:"render",value:function(e){var t=this,n=e.tree,r=e.left,o=e.top,i=e.draggable,a=e.showThumbnail,s=e.insertBefore,l=e.insertAfter,u=sabaki.getGameInfo(n),c=u.gameName,h=u.eventName,f=u.blackName,g=u.blackRank,m=u.whiteName,y=u.whiteRank,b=c||h||"";return d("li",{ref:function(e){return t.element=e},class:p({insertbefore:s,insertafter:l}),style:{left:r,top:o}},d("div",{draggable:i,onClick:this.handleClick,onContextMenu:this.handleContextMenu,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver},d("span",{title:b},b),d(v,{board:S(n),maxSize:x,visible:a}),d("span",{class:"black",title:g},f||"Black"),d("span",{class:"white",title:y},m||"White")))}}]),t}(f),T=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.itemElements={},e.state={scrollTop:0,insertBefore:-1,animation:!1,filterText:""},e.handleFilterTextChange=function(t){return e.setState({filterText:t.currentTarget.value.trim()})},e.handleCloseButtonClick=function(){return sabaki.closeDrawer()},e.handleListScroll=function(t){e.setState({scrollTop:t.currentTarget.scrollTop})},e.handleItemContextMenu=function(t){var n=[{label:"&Remove Game",click:function(){if(1!==m.showMessageBox("Do you really want to remove this game permanently?","warning",["Remove Game","Cancel"],1)){var n=e.props,r=n.gameTrees,o=n.onChange,i=void 0===o?w.noop:o,a=r.indexOf(t.tree);i({gameTrees:r.filter(function(e,t){return t!==a})})}}},{label:"Remove &Other Games",click:function(){if(1!==m.showMessageBox("Do you really want to remove all other games permanently?","warning",["Remove Games","Cancel"],1)){var n=e.props.onChange;(void 0===n?w.noop:n)({gameTrees:[t.tree]})}}}];w.popupMenu(n,t.clientX,t.clientY)},e.handleItemDragStart=function(t){e.dragData=e.props.gameTrees.indexOf(t.tree)},e.handleItemDragOver=function(t){if(null!=e.dragData){t.preventDefault();var n=t.currentTarget,r=e.props.gameTrees.indexOf(t.tree),o=t.clientX,i=n.getBoundingClientRect(),a=i.left,s=i.width,l=a+s/2;o<=l-10?e.setState({insertBefore:r}):o>=l+10&&e.setState({insertBefore:r+1})}},e.handleItemDrop=function(t){var n=e.props,r=n.gameTrees,o=n.onChange,i=void 0===o?w.noop:o,a=e.state.insertBefore,l=r.slice();if(!(null==e.dragData||a<0)){a>e.dragData&&a--;var u=l.splice(e.dragData,1),c=s(u,1),h=c[0];l.splice(a,0,h),e.dragData=null,e.setState({insertBefore:-1}),i({gameTrees:l})}},e.handleCancelDrag=function(){e.dragData=null,e.setState({insertBefore:-1})},e.handleItemClick=function(t){var n=e.props.gameTrees,r=e.props.onItemClick,o=void 0===r?w.noop:r,i=n.indexOf(t.tree);t.selectedTree=t.tree,t.selectedIndex=i,o(t)},e.handleAddButtonClick=function(t){var n=[{label:"Add &New Game",click:function(){var t=sabaki.getEmptyGameTree(),n=e.props,r=n.gameTrees,o=n.onChange;(void 0===o?w.noop:o)({gameTrees:[].concat(a(r),[t])})}},{label:"Add &Existing Files…",click:function(){m.showOpenDialog({properties:["openFile","multiSelections"],filters:[].concat(a(y.meta),[{name:"All Files",extensions:["*"]}])},function(t){var n=t.result,r=e.props.onChange,o=void 0===r?w.noop:r;if(sabaki.setBusy(!0),n)try{var i=!0,s=!1,l=void 0;try{for(var u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var h=u.value;y.parseFile(h,w.noop,function(t){var n=t.trees;o({gameTrees:[].concat(a(e.props.gameTrees),a(n))})})}}catch(e){s=!0,l=e}finally{try{!i&&c.return&&c.return()}finally{if(s)throw l}}}catch(e){m.showMessageBox("Some files are unreadable.","warning")}sabaki.setBusy(!1)})}}],r=t.currentTarget,o=r.getBoundingClientRect(),i=o.left,s=o.bottom;w.popupMenu(n,i,s)},e.handleSortButtonClick=function(t){var r=n(50),o=[{label:"&Black Player",property:"PB"},{label:"&White Player",property:"PW"},{label:"Black R&ank",property:"BR"},{label:"White Ran&k",property:"WR"},{label:"Game &Name",property:"GN"},{label:"Game &Event",property:"EV"},{label:"&Date",property:"DT"},{type:"separator"},{label:"&Reverse",property:"-1"}],i=!0,a=!1,l=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var h=u.value;!function(t){var n=t.property;delete t.property,t.click=function(){sabaki.setBusy(!0);var t=e.props,o=t.gameTrees,i=t.onChange,a=void 0===i?w.noop:i;o=o.map(function(e,t){return[e,t]}).sort(function(e,t){var o=s(e,2),i=o[0],a=o[1],l=s(t,2),u=l[0],c=l[1],h=void 0,d="-1"===n?[c,a]:[i,u].map(function(e){return n in e.nodes[0]?e.nodes[0][n][0]:""}),f=s(d,2),p=f[0],v=f[1];if(["BR","WR"].includes(n)){var g=[p,v].map(function(e){return(e.includes("k")?-1:e.includes("p")?10:1)*parseFloat(e)}).map(function(e){return isNaN(e)?-1/0:e}),m=s(g,2);p=m[0],v=m[1]}else if("DT"===n){var y=[p,v].map(function(e){return _.string2dates(e)}).map(function(e){return e?_.dates2string(e.sort(w.lexicalCompare)):""}),b=s(y,2);p=b[0],v=b[1]}return h=["GN","EV"].includes(n)?r({insensitive:!0})(p,v):p<v?-1:+(p!==v),0!==h?h:a-c}).map(function(e){return e[0]}),a({gameTrees:o}),sabaki.setBusy(!1)}}(h)}}catch(e){a=!0,l=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw l}}var d=t.currentTarget,f=d.getBoundingClientRect(),p=f.left,v=f.bottom;w.popupMenu(o,p,v)},e}return i(t,e),l(t,[{key:"componentDidMount",value:function(){var e=this;window.addEventListener("resize",function(){return e.resize()}),this.resize(),this.forceUpdate()}},{key:"shouldComponentUpdate",value:function(e,t){var n=e.show;return t.animation!==this.state.animation||n||n!==this.props.show}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.scrollTop!==t.scrollTop&&this.state.scrollTop!==this.gamesListElement.scrollTop&&(this.gamesListElement.scrollTop=this.state.scrollTop,this.setState({scrollTop:this.gamesListElement.scrollTop})),this.props.show&&e.gameTrees.length!==this.props.gameTrees.length&&(this.gamesListElement.scrollTop=this.gamesListElement.scrollHeight,this.setState({scrollTop:this.gamesListElement.scrollTop})),!e.show&&this.props.show){var r=this.shownGameTrees.findIndex(function(e){return s(e,2)[1]===n.props.gameIndex}),o=0;r>=0&&(o=283*this.getRowFromIndex(r)),this.gamesListElement.scrollTop=o,this.setState({scrollTop:this.gamesListElement.scrollTop})}if(e.show!==this.props.show){var i=document.getElementById("goban").getBoundingClientRect(),a=document.getElementById("gamechooser").getBoundingClientRect(),l=this.itemElements[this.props.gameIndex],u=null!=l?l.querySelector("svg"):null;if(null!=l&&null!=u){var c=l.querySelector("svg").getBoundingClientRect(),h=c.width,d=c.height,f=c.left,p=c.top,v={left:f-a.left,top:p-a.top,width:h,height:d},g=this.props.show?"reverse":"normal";this.setState({animation:[v,i,g]}),setTimeout(function(){return n.setState({animation:null})},600)}}}},{key:"resize",value:function(){var e=this.gamesListElement.offsetWidth-28,t=this.gamesListElement.offsetHeight,n=Math.floor(e/C);this.setState({innerWidth:e,height:t,rowCount:n})}},{key:"getRowFromIndex",value:function(e){return(e-e%this.state.rowCount)/this.state.rowCount}},{key:"render",value:function(e,t){var n=this,r=e.show,o=e.gameTrees,i=e.gameIndex,a=t.filterText,l=t.animation,u=t.scrollTop,c=t.insertBefore,h=t.rowCount,f=t.innerWidth,p=t.height,m=Math.floor(f/h);return this.shownGameTrees=o.map(function(e,t){return[e,t]}).filter(function(e){var t=s(e,1),n=t[0],r=sabaki.getGameInfo(n);return Object.keys(r).map(function(e){return r[e]}).join(" ").toLowerCase().includes(a.toLowerCase())}),d("div",{onDrop:this.handleCancelDrag},d("style",{},"\n #gamechooser .games-list .placeholder {\n height: "+(283*(this.getRowFromIndex(this.shownGameTrees.length-1)+1)+20)+"px;\n }\n\n #gamechooser .games-list li {\n width: "+(m-20)+"px;\n }\n ",l&&"\n #gamechooser-animation {\n animation: gamechooser-animation .5s "+l[2]+" forwards;\n }\n\n @keyframes gamechooser-animation {\n from {\n transform: translate("+l[0].left+"px, "+l[0].top+"px);\n opacity: 1;\n }\n to {\n transform: translate("+l[1].left+"px, "+l[1].top+"px)\n scale("+l[1].width/l[0].width+",\n "+l[1].height/l[0].height+");\n opacity: 0;\n }\n }\n "),d(g,{type:"gamechooser",show:r},d("h2",{},"Manage Games"),d("input",{type:"search",name:"filter",placeholder:"Filter",value:a,onInput:this.handleFilterTextChange}),d("div",{ref:function(e){return n.gamesListElement=e},class:"games-list",onScroll:this.handleListScroll,onDrop:this.handleItemDrop},d("div",{class:"placeholder"}),d("ol",{},this.shownGameTrees.map(function(e,t){var r=s(e,2),o=r[0],f=r[1],v=n.getRowFromIndex(t),g=283*v+10,y=(t-v*h)*m+10;if(f===i||!(g+566<=u||g-283>=u+p))return d(M,{ref:function(e){null!=e&&(n.itemElements[f]=e.element)},key:o.id,tree:o,top:g,left:y,draggable:""===a,showThumbnail:f!==i||!l,insertBefore:c===f,insertAfter:t===n.shownGameTrees.length-1&&c===f+1,onClick:n.handleItemClick,onContextMenu:n.handleItemContextMenu,onDragStart:n.handleItemDragStart,onDragOver:n.handleItemDragOver})}))),d("p",{},d("button",{type:"button",class:"dropdown",onClick:this.handleAddButtonClick},"Add"),d("button",{type:"button",class:"dropdown",onClick:this.handleSortButtonClick},"Sort By"),d("button",{type:"button",onClick:this.handleCloseButtonClick},"Close"))),d("div",{id:"gamechooser-animation",style:l?{}:{opacity:0,pointerEvents:"none"}},d(v,{board:S(o[i]),maxSize:x})))}}]),t}(f);e.exports=T},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=u.h,h=u.Component,d=function(e){return[].concat(a(Array(e))).map(function(e,t){return t})},f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.board,n=e.maxSize;return e.visible!==this.props.visible||n!==this.props.maxSize||t.getPositionHash()!==this.props.board.getPositionHash()}},{key:"render",value:function(e){var t=e.board,n=e.maxSize,r=e.visible,o=void 0===r||r,i=(n-1)/Math.max(t.width,t.height),a=i/2,l=d(t.width),u=d(t.height);return c("svg",{width:i*t.width+1,height:i*t.height+1,style:{visibility:o?"visible":"hidden"}},t.getHandicapPlacement(9).map(function(e){var t=s(e,2),n=t[0],r=t[1];return c("circle",{cx:n*i+a+1,cy:r*i+a+1,r:2,fill:"#5E2E0C"})}),l.map(function(e){return u.map(function(n){return 0!==t.get([e,n])&&c("circle",{cx:e*i+a+1,cy:n*i+a+2,r:a,fill:"rgba(0, 0, 0, .5)"})})}),l.map(function(e){return u.map(function(n){return 0!==t.get([e,n])&&c("circle",{cx:e*i+a+1,cy:n*i+a+1,r:a,fill:t.get([e,n])<0?"white":"black"})})}))}}]),t}(h);e.exports=f},function(e,t,n){(function(e){var n,r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){"use strict";function i(e){function t(e){return e.toLocaleLowerCase?e.toLocaleLowerCase():e.toLowerCase()}function n(e){return e.replace(h,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0")}function r(e,t){return(!e.match(a)||1===t)&&parseFloat(e)||e.replace(s," ").replace(l,"")||0}e=e||{};var o=e.desc?-1:1,i=-o,a=/^0/,s=/\s+/g,l=/^\s+|\s+$/g,u=/[^\x00-\x80]/,c=/^0x[0-9a-f]+$/i,h=/(0x[\da-fA-F]+|(^[\+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|\d+)/g,d=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,f=e.insensitive?function(e){return t(""+e).replace(l,"")}:function(e){return(""+e).replace(l,"")};return function(e,t){var a=f(e),s=f(t);if(!a&&!s)return 0;if(!a&&s)return i;if(a&&!s)return o;var l=n(a),h=n(s),p=parseInt(a.match(c),16)||1!==l.length&&Date.parse(a),v=parseInt(s.match(c),16)||p&&s.match(d)&&Date.parse(s)||null;if(v){if(p<v)return i;if(p>v)return o}for(var g=l.length,m=h.length,y=0,b=Math.max(g,m);y<b;y++){var w=r(l[y]||"",g),k=r(h[y]||"",m);if(isNaN(w)!==isNaN(k))return isNaN(w)?o:i;if(u.test(w+k)&&w.localeCompare){var _=w.localeCompare(k);if(_>0)return o;if(_<0)return i;if(y===b-1)return 0}else{if(w<k)return i;if(w>k)return o}}return 0}}"object"===o(t)&&"object"===o(e)?e.exports=i:(n=[],void 0!==(r=function(){return i}.apply(t,n))&&(e.exports=r))}()}).call(t,n(51)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(3),h=n(1),d=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={value:""},e.handleInput=function(t){return e.setState({value:t.currentTarget.value})},e.stopPropagation=function(e){return e.stopPropagation()},e.handleKeyUp=function(t){if(e.props.show)if(27===t.keyCode)t.stopPropagation(),e.cancel();else if(13==t.keyCode){t.stopPropagation(),sabaki.setState({showInputBox:!1});var n=e.props.onSubmit,r=void 0===n?h.noop:n;r(e.state)}},e.cancel=e.cancel.bind(e),e}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.show,n=e.text,r=e.onSubmit,o=e.onCancel;return t!==this.props.show||n!==this.props.text||r!==this.props.onSubmit||o!==this.props.onCancel}},{key:"componentWillReceiveProps",value:function(e){e.show&&!this.props.show&&this.setState({value:""})}},{key:"componentDidUpdate",value:function(e){!e.show&&this.props.show&&this.inputElement.focus()}},{key:"cancel",value:function(){if(this.props.show){document.activeElement===this.inputElement&&this.inputElement.blur();var e=this.props.onCancel,t=void 0===e?h.noop:e;sabaki.setState({showInputBox:!1}),t()}}},{key:"render",value:function(e,t){var n=this,r=e.show,o=e.text,i=t.value;return l("section",{id:"input-box",class:c({show:r}),onClick:this.cancel},l("div",{class:"inner",onClick:this.stopPropagation},l("input",{ref:function(e){return n.inputElement=e},type:"text",name:"input",value:i,placeholder:o,onInput:this.handleInput,onKeyUp:this.handleKeyUp,onBlur:this.cancel})))}}]),t}(u);e.exports=d},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=s.remote,u=s.ipcRenderer,c=n(0),h=c.h,d=c.Component,f=l.require("./setting"),p=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"componentWillReceiveProps",value:function(e){var t=this,n=e.show;if(n!==this.props.show)if(clearTimeout(this.busyId),n)u.send("build-menu",!0),this.setState({show:!0}),document.activeElement.blur();else{u.send("build-menu");var r=f.get("app.hide_busy_delay");this.busyId=setTimeout(function(){return t.setState({show:!1})},r)}}},{key:"render",value:function(e,t){var n=t.show;return h("section",{id:"busy",style:{display:n?"block":"none"}})}}]),t}(d);e.exports=p},function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),l=s.h,u=s.Component,c=n(3),h=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.text,n=e.show;return t!==this.props.text||n!==this.props.show}},{key:"render",value:function(e){var t=e.text,n=e.show;return l("section",{id:"info-overlay",class:c({show:n})},t)}}]),t}(u);e.exports=h},function(e,t){var n=-1,r=-1,o=Object.keys(new Int8Array(5)).map(function(e){return new Audio("./data/capture"+e+".mp3")}),i=Object.keys(new Int8Array(5)).map(function(e){return new Audio("./data/"+e+".mp3")}),a=new Audio("./data/newgame.mp3"),s=new Audio("./data/pass.mp3");t.playPachi=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=n;t===n;)t=Math.floor(Math.random()*i.length);n=t,setTimeout(function(){return i[t].play()},e)},t.playCapture=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=r;t===r;)t=Math.floor(Math.random()*o.length);r=t,setTimeout(function(){return o[t].play()},e)},t.playPass=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout(function(){return s.play()},e)},t.playNewGame=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout(function(){return a.play()},e)}}]);
//# sourceMappingURL=bundle.js.map