@lichess-org/chessground 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autoPieces.js +5 -7
- package/dist/autoPieces.js.map +1 -1
- package/dist/board.js +9 -14
- package/dist/board.js.map +1 -1
- package/dist/chessground.min.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -4
- package/dist/config.js.map +1 -1
- package/dist/drag.js +1 -2
- package/dist/drag.js.map +1 -1
- package/dist/draw.js +1 -2
- package/dist/draw.js.map +1 -1
- package/dist/premove.js +134 -64
- package/dist/premove.js.map +1 -1
- package/dist/render.js +4 -6
- package/dist/render.js.map +1 -1
- package/dist/state.d.ts +1 -1
- package/dist/svg.js +8 -15
- package/dist/svg.js.map +1 -1
- package/dist/util.d.ts +7 -1
- package/dist/util.js +32 -18
- package/dist/util.js.map +1 -1
- package/package.json +1 -1
- package/src/board.ts +2 -0
- package/src/config.ts +1 -0
- package/src/premove.ts +209 -136
- package/src/state.ts +1 -1
- package/src/util.ts +41 -20
package/dist/autoPieces.js
CHANGED
|
@@ -13,20 +13,18 @@ export function render(state, autoPieceEl) {
|
|
|
13
13
|
syncShapes(autoPieceShapes, autoPieceEl, shape => renderShape(state, shape, state.dom.bounds()));
|
|
14
14
|
}
|
|
15
15
|
export function renderResized(state) {
|
|
16
|
-
var _a;
|
|
17
16
|
const asWhite = whitePov(state), posToTranslate = posToTranslateFromBounds(state.dom.bounds());
|
|
18
|
-
let el =
|
|
17
|
+
let el = state.dom.elements.autoPieces?.firstChild;
|
|
19
18
|
while (el) {
|
|
20
19
|
translateAndScale(el, posToTranslate(key2pos(el.cgKey), asWhite), el.cgScale);
|
|
21
20
|
el = el.nextSibling;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
function renderShape(state, { shape, hash }, bounds) {
|
|
25
|
-
var _a, _b, _c;
|
|
26
24
|
const orig = shape.orig;
|
|
27
|
-
const role =
|
|
28
|
-
const color =
|
|
29
|
-
const scale =
|
|
25
|
+
const role = shape.piece?.role;
|
|
26
|
+
const color = shape.piece?.color;
|
|
27
|
+
const scale = shape.piece?.scale;
|
|
30
28
|
const pieceEl = createEl('piece', `${role} ${color}`);
|
|
31
29
|
pieceEl.setAttribute('cgHash', hash);
|
|
32
30
|
pieceEl.cgKey = orig;
|
|
@@ -34,5 +32,5 @@ function renderShape(state, { shape, hash }, bounds) {
|
|
|
34
32
|
translateAndScale(pieceEl, posToTranslateFromBounds(bounds)(key2pos(orig), whitePov(state)), scale);
|
|
35
33
|
return pieceEl;
|
|
36
34
|
}
|
|
37
|
-
const hash = (autoPiece) =>
|
|
35
|
+
const hash = (autoPiece) => [autoPiece.orig, autoPiece.piece?.role, autoPiece.piece?.color, autoPiece.piece?.scale].join(',');
|
|
38
36
|
//# sourceMappingURL=autoPieces.js.map
|
package/dist/autoPieces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoPieces.js","sourceRoot":"","sources":["../src/autoPieces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,IAAI,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAuB,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,KAAY,EAAE,WAAwB;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClF,MAAM,eAAe,GAAoB,UAAU,CAAC,GAAG,CAAC,CAAC,CAAY,EAAE,EAAE;QACvE,OAAO;YACL,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACb,OAAO,EAAE,KAAK;SACf,CAAC;IAC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AAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
package/dist/board.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pos2key, key2pos, opposite, distanceSq, allPos, computeSquareCenter, queenDir, knightDir, } from './util.js';
|
|
1
|
+
import { pos2key, key2pos, opposite, distanceSq, allPos, computeSquareCenter, queenDir, knightDir, samePos, } from './util.js';
|
|
2
2
|
import { premove } from './premove.js';
|
|
3
3
|
export function callUserFunction(f, ...args) {
|
|
4
4
|
if (f)
|
|
@@ -216,12 +216,9 @@ function isMovable(state, orig) {
|
|
|
216
216
|
(state.movable.color === 'both' ||
|
|
217
217
|
(state.movable.color === piece.color && state.turnColor === piece.color)));
|
|
218
218
|
}
|
|
219
|
-
export const canMove = (state, orig, dest) =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
isMovable(state, orig) &&
|
|
223
|
-
(state.movable.free || !!((_b = (_a = state.movable.dests) === null || _a === void 0 ? void 0 : _a.get(orig)) === null || _b === void 0 ? void 0 : _b.includes(dest)));
|
|
224
|
-
};
|
|
219
|
+
export const canMove = (state, orig, dest) => orig !== dest &&
|
|
220
|
+
isMovable(state, orig) &&
|
|
221
|
+
(state.movable.free || !!state.movable.dests?.get(orig)?.includes(dest));
|
|
225
222
|
function canDrop(state, orig, dest) {
|
|
226
223
|
const piece = state.pieces.get(orig);
|
|
227
224
|
return (!!piece &&
|
|
@@ -236,12 +233,9 @@ function isPremovable(state, orig) {
|
|
|
236
233
|
state.movable.color === piece.color &&
|
|
237
234
|
state.turnColor !== piece.color);
|
|
238
235
|
}
|
|
239
|
-
const canPremove = (state, orig, dest) =>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
isPremovable(state, orig) &&
|
|
243
|
-
((_b = (_a = state.premovable.customDests) === null || _a === void 0 ? void 0 : _a.get(orig)) !== null && _b !== void 0 ? _b : premove(state, orig)).includes(dest);
|
|
244
|
-
};
|
|
236
|
+
const canPremove = (state, orig, dest) => orig !== dest &&
|
|
237
|
+
isPremovable(state, orig) &&
|
|
238
|
+
(state.premovable.customDests?.get(orig) ?? premove(state, orig)).includes(dest);
|
|
245
239
|
function canPredrop(state, orig, dest) {
|
|
246
240
|
const piece = state.pieces.get(orig);
|
|
247
241
|
const destPiece = state.pieces.get(dest);
|
|
@@ -319,7 +313,8 @@ export function getKeyAtDomPos(pos, asWhite, bounds) {
|
|
|
319
313
|
}
|
|
320
314
|
export function getSnappedKeyAtDomPos(orig, pos, asWhite, bounds) {
|
|
321
315
|
const origPos = key2pos(orig);
|
|
322
|
-
const validSnapPos = allPos.filter(pos2 =>
|
|
316
|
+
const validSnapPos = allPos.filter(pos2 => samePos(origPos, pos2) ||
|
|
317
|
+
queenDir(origPos[0], origPos[1], pos2[0], pos2[1]) ||
|
|
323
318
|
knightDir(origPos[0], origPos[1], pos2[0], pos2[1]));
|
|
324
319
|
const validSnapCenters = validSnapPos.map(pos2 => computeSquareCenter(pos2key(pos2), asWhite, bounds));
|
|
325
320
|
const validSnapDistances = validSnapCenters.map(pos2 => distanceSq(pos, pos2));
|
package/dist/board.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board.js","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,QAAQ,EACR,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,UAAU,gBAAgB,CAC9B,CAAgB,EAChB,GAAG,IAAmB;IAEtB,IAAI,CAAC;QAAE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,WA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OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CACtD,CAAC;IACF,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACvG,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/E,MAAM,CAAC,EAAE,gBAAgB,CAAC,GAAG,kBAAkB,CAAC,MAAM,CACpD,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAC5C,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAC3B,CAAC;IACF,OAAO,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAgB,EAAW,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,OAAO,CAAC"}
|
package/dist/chessground.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Fe=["white","black"];var G=["a","b","c","d","e","f","g","h"],$=["1","2","3","4","5","6","7","8"];var ze=[...$].reverse(),ne=Array.prototype.concat(...G.map(e=>$.map(o=>e+o))),S=e=>ne[8*e[0]+e[1]],g=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49];var te=ne.map(g);function $e(e){let o,r=()=>(o===void 0&&(o=e()),o);return r.clear=()=>{o=void 0},r}var Ie=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;let o=performance.now()-e;return e=void 0,o}}},I=e=>e==="white"?"black":"white",V=(e,o)=>{let r=e[0]-o[0],n=e[1]-o[1];return r*r+n*n},Z=(e,o)=>e.role===o.role&&e.color===o.color,L=e=>(o,r)=>[(r?o[0]:7-o[0])*e.width/8,(r?7-o[1]:o[1])*e.height/8],x=(e,o)=>{e.style.transform=`translate(${o[0]}px,${o[1]}px)`},ve=(e,o,r=1)=>{e.style.transform=`translate(${o[0]}px,${o[1]}px) scale(${r})`},X=(e,o)=>{e.style.visibility=o?"visible":"hidden"},T=e=>{if(e.clientX||e.clientX===0)return[e.clientX,e.clientY];if(e.targetTouches?.[0])return[e.targetTouches[0].clientX,e.targetTouches[0].clientY]},ie=e=>e.button===2,k=(e,o)=>{let r=document.createElement(e);return o&&(r.className=o),r};function ae(e,o,r){let n=g(e);return o||(n[0]=7-n[0],n[1]=7-n[1]),[r.left+r.width*n[0]/8+r.width/16,r.top+r.height*(7-n[1])/8+r.height/16]}var q=(e,o)=>Math.abs(e-o),ce=(e,o,r,n)=>{let t=q(e,r),i=q(o,n);return t===1&&i===2||t===2&&i===1},ye=(e,o,r,n)=>e===r||o===n,Se=(e,o,r,n)=>q(e,r)===q(o,n),je=(e,o,r,n)=>ye(e,o,r,n)||Se(e,o,r,n),Ue=(e,o,r,n)=>{let t=r-e,i=n-o;if(t&&i&&Math.abs(t)!==Math.abs(i))return[];let a=t===0?0:t>0?1:-1,c=i===0?0:i>0?1:-1,l=[],s=e+a,u=o+c;for(;s!==r||u!==n;)l.push([s,u]),s+=a,u+=c;return l.map(d=>S(d))};var we=(e,o,r,n,t,i)=>Ue(e,o,r,n).filter(a=>t.get(a)?.color===i),Ze=(e,o,r,n,t,i,a)=>{let c=we(e,o,r,n,t,i);if(!c.length)return!0;if(c.length>1||!a||c[0]!==a[1])return!1;let l=a[1],s=g(a[0]),u=g(l),d=t.get(l);return d.role==="pawn"&&q(s[1],u[1])===2&&[1,-1].some(p=>{let v=t.get(S([u[0]+p,u[1]]));return v?.role==="pawn"&&v.color===I(d.color)})},Uo=(e,o,r)=>(n,t,i,a)=>{let c=o==="white"?1:-1;return q(n,i)===1?a===t+c:n===i&&(a===t+c||a===t+2*c&&(o==="white"?t<=1:t>=6))&&(r||!we(n,t,i,a+c,e,o).length)},Zo=(e,o,r,n)=>ce(e,o,r,n),Xe=(e,o,r,n)=>(t,i,a,c)=>Se(t,i,a,c)&&(r||Ze(t,i,a,c,e,o,n)),Ye=(e,o,r,n)=>(t,i,a,c)=>ye(t,i,a,c)&&(r||Ze(t,i,a,c,e,o,n)),Xo=(e,o,r,n)=>(t,i,a,c)=>Xe(e,o,r,n)(t,i,a,c)||Ye(e,o,r,n)(t,i,a,c),Yo=(e,o,r,n,t)=>(i,a,c,l)=>q(i,c)<2&&q(a,l)<2||t&&a===l&&a===(o==="white"?0:7)&&(i===4&&(c===2&&n.includes(0)||c===6&&n.includes(7))||n.includes(c))&&(r||we(i,a,c>i?7:1,l,e,o).every(s=>e.get(s).role==="rook")),Qo=(e,o)=>{let r=o==="white"?"1":"8",n=[];for(let[t,i]of e)t[1]===r&&i.color===o&&i.role==="rook"&&n.push(g(t)[0]);return n};function Pe(e,o){let r=e.pieces,n=e.premovable.castle,t=!!e.premovable.premoveThroughFriendlies,i=r.get(o);if(!i)return[];let a=g(o),c=i.role,l=c==="pawn"?Uo(r,i.color,t):c==="knight"?Zo:c==="bishop"?Xe(r,i.color,t,e.lastMove):c==="rook"?Ye(r,i.color,t,e.lastMove):c==="queen"?Xo(r,i.color,t,e.lastMove):Yo(r,i.color,t,Qo(r,i.color),n);return te.filter(s=>(a[0]!==s[0]||a[1]!==s[1])&&l(a[0],a[1],s[0],s[1])).map(S)}function M(e,...o){e&&setTimeout(()=>e(...o),1)}function Qe(e){e.orientation=I(e.orientation),e.animation.current=e.draggable.current=e.selected=void 0}function _e(e,o){for(let[r,n]of o)n?e.pieces.set(r,n):e.pieces.delete(r)}function Je(e,o){if(e.check=void 0,o===!0&&(o=e.turnColor),o)for(let[r,n]of e.pieces)n.role==="king"&&n.color===o&&(e.check=r)}function _o(e,o,r,n){K(e),e.premovable.current=[o,r],M(e.premovable.events.set,o,r,n)}function C(e){e.premovable.current&&(e.premovable.current=void 0,M(e.premovable.events.unset))}function Jo(e,o,r){C(e),e.predroppable.current={role:o,key:r},M(e.predroppable.events.set,o,r)}function K(e){let o=e.predroppable;o.current&&(o.current=void 0,M(o.events.unset))}function er(e,o,r){if(!e.autoCastle)return!1;let n=e.pieces.get(o);if(!n||n.role!=="king")return!1;let t=g(o),i=g(r);if(t[1]!==0&&t[1]!==7||t[1]!==i[1])return!1;t[0]===4&&!e.pieces.has(r)&&(i[0]===6?r=S([7,i[1]]):i[0]===2&&(r=S([0,i[1]])));let a=e.pieces.get(r);return!a||a.color!==n.color||a.role!=="rook"?!1:(e.pieces.delete(o),e.pieces.delete(r),t[0]<i[0]?(e.pieces.set(S([6,i[1]]),n),e.pieces.set(S([5,i[1]]),a)):(e.pieces.set(S([2,i[1]]),n),e.pieces.set(S([3,i[1]]),a)),!0)}function Me(e,o,r){let n=e.pieces.get(o),t=e.pieces.get(r);if(o===r||!n)return!1;let i=t&&t.color!==n.color?t:void 0;return r===e.selected&&P(e),M(e.events.move,o,r,i),er(e,o,r)||(e.pieces.set(r,n),e.pieces.delete(o)),e.lastMove=[o,r],e.check=void 0,M(e.events.change),i||!0}function se(e,o,r,n){if(e.pieces.has(r))if(n)e.pieces.delete(r);else return!1;return M(e.events.dropNewPiece,o,r),e.pieces.set(r,o),e.lastMove=[r],e.check=void 0,M(e.events.change),e.movable.dests=void 0,e.turnColor=I(e.turnColor),!0}function eo(e,o,r){let n=Me(e,o,r);return n&&(e.movable.dests=void 0,e.turnColor=I(e.turnColor),e.animation.current=void 0),n}function xe(e,o,r){if(de(e,o,r)){let n=eo(e,o,r);if(n){let t=e.hold.stop();P(e);let i={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:t};return n!==!0&&(i.captured=n),M(e.movable.events.after,o,r,i),!0}}else if(rr(e,o,r))return _o(e,o,r,{ctrlKey:e.stats.ctrlKey}),P(e),!0;return P(e),!1}function le(e,o,r,n){let t=e.pieces.get(o);t&&(or(e,o,r)||n)?(e.pieces.delete(o),se(e,t,r,n),M(e.movable.events.afterNewPiece,t.role,r,{premove:!1,predrop:!1})):t&&nr(e,o,r)?Jo(e,t.role,r):(C(e),K(e)),e.pieces.delete(o),P(e)}function Q(e,o,r){if(M(e.events.select,o),e.selected){if(e.selected===o&&!e.draggable.enabled){P(e),e.hold.cancel();return}else if((e.selectable.enabled||r)&&e.selected!==o&&xe(e,e.selected,o)){e.stats.dragged=!1;return}}(e.selectable.enabled||e.draggable.enabled)&&(oo(e,o)||De(e,o))&&(ke(e,o),e.hold.start())}function ke(e,o){e.selected=o,De(e,o)?e.premovable.customDests||(e.premovable.dests=Pe(e,o)):e.premovable.dests=void 0}function P(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function oo(e,o){let r=e.pieces.get(o);return!!r&&(e.movable.color==="both"||e.movable.color===r.color&&e.turnColor===r.color)}var de=(e,o,r)=>o!==r&&oo(e,o)&&(e.movable.free||!!e.movable.dests?.get(o)?.includes(r));function or(e,o,r){let n=e.pieces.get(o);return!!n&&(o===r||!e.pieces.has(r))&&(e.movable.color==="both"||e.movable.color===n.color&&e.turnColor===n.color)}function De(e,o){let r=e.pieces.get(o);return!!r&&e.premovable.enabled&&e.movable.color===r.color&&e.turnColor!==r.color}var rr=(e,o,r)=>o!==r&&De(e,o)&&(e.premovable.customDests?.get(o)??Pe(e,o)).includes(r);function nr(e,o,r){let n=e.pieces.get(o),t=e.pieces.get(r);return!!n&&(!t||t.color!==e.movable.color)&&e.predroppable.enabled&&(n.role!=="pawn"||r[1]!=="1"&&r[1]!=="8")&&e.movable.color===n.color&&e.turnColor!==n.color}function ro(e,o){let r=e.pieces.get(o);return!!r&&e.draggable.enabled&&(e.movable.color==="both"||e.movable.color===r.color&&(e.turnColor===r.color||e.premovable.enabled))}function no(e){let o=e.premovable.current;if(!o)return!1;let r=o[0],n=o[1],t=!1;if(de(e,r,n)){let i=eo(e,r,n);if(i){let a={premove:!0};i!==!0&&(a.captured=i),M(e.movable.events.after,r,n,a),t=!0}}return C(e),t}function to(e,o){let r=e.predroppable.current,n=!1;if(!r)return!1;if(o(r)){let t={role:r.role,color:e.movable.color};se(e,t,r.key)&&(M(e.movable.events.afterNewPiece,r.role,r.key,{premove:!1,predrop:!0}),n=!0)}return K(e),n}function _(e){C(e),K(e),P(e)}function Ce(e){e.movable.color=e.movable.dests=e.animation.current=void 0,_(e)}function E(e,o,r){let n=Math.floor(8*(e[0]-r.left)/r.width);o||(n=7-n);let t=7-Math.floor(8*(e[1]-r.top)/r.height);return o||(t=7-t),n>=0&&n<8&&t>=0&&t<8?S([n,t]):void 0}function io(e,o,r,n){let t=g(e),i=te.filter(s=>je(t[0],t[1],s[0],s[1])||ce(t[0],t[1],s[0],s[1])),c=i.map(s=>ae(S(s),r,n)).map(s=>V(o,s)),[,l]=c.reduce((s,u,d)=>s[0]<u?s:[u,d],[c[0],0]);return S(i[l])}var b=e=>e.orientation==="white";var Ee="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",tr={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},ir={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};function ue(e){e==="start"&&(e=Ee);let o=new Map,r=7,n=0;for(let t of e)switch(t){case" ":case"[":return o;case"/":if(--r,r<0)return o;n=0;break;case"~":{let i=o.get(S([n-1,r]));i&&(i.promoted=!0);break}default:{let i=t.charCodeAt(0);if(i<57)n+=i-48;else{let a=t.toLowerCase();o.set(S([n,r]),{role:tr[a],color:t===a?"black":"white"}),++n}}}return o}function ao(e){return ze.map(o=>G.map(r=>{let n=e.get(r+o);if(n){let t=ir[n.role];return n.color==="white"&&(t=t.toUpperCase()),n.promoted&&(t+="~"),t}else return"1"}).join("")).join("/").replace(/1{2,}/g,o=>o.length.toString())}function Ae(e,o){o.animation&&(Ne(e.animation,o.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function pe(e,o){if(o.movable?.dests&&(e.movable.dests=void 0),o.drawable?.autoShapes&&(e.drawable.autoShapes=[]),Ne(e,o),o.fen&&(e.pieces=ue(o.fen),e.drawable.shapes=o.drawable?.shapes||[]),"check"in o&&Je(e,o.check||!1),"lastMove"in o&&!o.lastMove?e.lastMove=void 0:o.lastMove&&(e.lastMove=o.lastMove),e.selected&&ke(e,e.selected),Ae(e,o),!e.movable.rookCastle&&e.movable.dests){let r=e.movable.color==="white"?"1":"8",n="e"+r,t=e.movable.dests.get(n),i=e.pieces.get(n);if(!t||!i||i.role!=="king")return;e.movable.dests.set(n,t.filter(a=>!(a==="a"+r&&t.includes("c"+r))&&!(a==="h"+r&&t.includes("g"+r))))}}function Ne(e,o){for(let r in o)r==="__proto__"||r==="constructor"||!Object.prototype.hasOwnProperty.call(o,r)||(Object.prototype.hasOwnProperty.call(e,r)&&co(e[r])&&co(o[r])?Ne(e[r],o[r]):e[r]=o[r])}function co(e){if(typeof e!="object"||e===null)return!1;let o=Object.getPrototypeOf(e);return o===Object.prototype||o===null}var O=(e,o)=>o.animation.enabled?lr(e,o):R(e,o);function R(e,o){let r=e(o);return o.dom.redraw(),r}var He=(e,o)=>({key:e,pos:g(e),piece:o}),cr=(e,o)=>o.sort((r,n)=>V(e.pos,r.pos)-V(e.pos,n.pos))[0];function sr(e,o){let r=new Map,n=[],t=new Map,i=[],a=[],c=new Map,l,s,u;for(let[d,p]of e)c.set(d,He(d,p));for(let d of ne)l=o.pieces.get(d),s=c.get(d),l?s?Z(l,s.piece)||(i.push(s),a.push(He(d,l))):a.push(He(d,l)):s&&i.push(s);for(let d of a)s=cr(d,i.filter(p=>Z(d.piece,p.piece))),s&&(u=[s.pos[0]-d.pos[0],s.pos[1]-d.pos[1]],r.set(d.key,u.concat(u)),n.push(s.key));for(let d of i)n.includes(d.key)||t.set(d.key,d.piece);return{anims:r,fadings:t}}function so(e,o){let r=e.animation.current;if(r===void 0){e.dom.destroyed||e.dom.redrawNow();return}let n=1-(o-r.start)*r.frequency;if(n<=0)e.animation.current=void 0,e.dom.redrawNow();else{let t=dr(n);for(let i of r.plan.anims.values())i[2]=i[0]*t,i[3]=i[1]*t;e.dom.redrawNow(!0),requestAnimationFrame((i=performance.now())=>so(e,i))}}function lr(e,o){let r=new Map(o.pieces),n=e(o),t=sr(r,o);if(t.anims.size||t.fadings.size){let i=o.animation.current&&o.animation.current.start;o.animation.current={start:performance.now(),frequency:1/o.animation.duration,plan:t},i||so(o,performance.now())}else o.dom.redraw();return n}var dr=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1;var ur=["green","red","blue","yellow"];function lo(e,o){if(o.touches&&o.touches.length>1)return;o.stopPropagation(),o.preventDefault(),o.ctrlKey?P(e):_(e);let r=T(o),n=E(r,b(e),e.dom.bounds());n&&(e.drawable.current={orig:n,pos:r,brush:pr(o),snapToValidMove:e.drawable.defaultSnapToValidMove},uo(e))}function uo(e){requestAnimationFrame(()=>{let o=e.drawable.current;if(o){let r=E(o.pos,b(e),e.dom.bounds());r||(o.snapToValidMove=!1);let n=o.snapToValidMove?io(o.orig,o.pos,b(e),e.dom.bounds()):r;n!==o.mouseSq&&(o.mouseSq=n,o.dest=n!==o.orig?n:void 0,e.dom.redrawNow()),uo(e)}})}function po(e,o){e.drawable.current&&(e.drawable.current.pos=T(o))}function fo(e){let o=e.drawable.current;o&&(o.mouseSq&&fr(e.drawable,o),Te(e))}function Te(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}function go(e){e.drawable.shapes.length&&(e.drawable.shapes=[],e.dom.redraw(),mo(e.drawable))}function pr(e){let o=(e.shiftKey||e.ctrlKey)&&ie(e),r=e.altKey||e.metaKey||e.getModifierState?.("AltGraph");return ur[(o?1:0)+(r?2:0)]}function fr(e,o){let r=t=>t.orig===o.orig&&t.dest===o.dest,n=e.shapes.find(r);n&&(e.shapes=e.shapes.filter(t=>!r(t))),(!n||n.brush!==o.brush)&&e.shapes.push({orig:o.orig,dest:o.dest,brush:o.brush}),mo(e)}function mo(e){e.onChange&&e.onChange(e.shapes)}function bo(e,o){if(!(e.trustAllEvents||o.isTrusted)||o.buttons!==void 0&&o.buttons>1||o.touches&&o.touches.length>1)return;let r=e.dom.bounds(),n=T(o),t=E(n,b(e),r);if(!t)return;let i=e.pieces.get(t),a=e.selected;if(!a&&e.drawable.enabled&&(e.drawable.eraseOnClick||!i||i.color!==e.turnColor)&&go(e),o.cancelable!==!1&&(!o.touches||e.blockTouchScroll||i||a||mr(e,n)))o.preventDefault();else if(o.touches)return;let c=!!e.premovable.current,l=!!e.predroppable.current;e.stats.ctrlKey=o.ctrlKey,e.selected&&de(e,e.selected,t)?O(d=>Q(d,t),e):Q(e,t);let s=e.selected===t,u=wo(e,t);if(i&&u&&s&&ro(e,t)){e.draggable.current={orig:t,piece:i,origPos:n,pos:n,started:e.draggable.autoDistance&&e.stats.dragged,element:u,previouslySelected:a,originTarget:o.target,keyHasChanged:!1},u.cgDragging=!0,u.classList.add("dragging");let d=e.dom.elements.ghost;d&&(d.className=`ghost ${i.color} ${i.role}`,x(d,L(r)(g(t),b(e))),X(d,!0)),qe(e)}else c&&C(e),l&&K(e);e.dom.redraw()}function mr(e,o){let r=b(e),n=e.dom.bounds(),t=Math.pow(n.width/8,2);for(let i of e.pieces.keys()){let a=ae(i,r,n);if(V(a,o)<=t)return!0}return!1}function ho(e,o,r,n){let t="a0";e.pieces.set(t,o),e.dom.redraw();let i=T(r);e.draggable.current={orig:t,piece:o,origPos:i,pos:i,started:!0,element:()=>wo(e,t),originTarget:r.target,newPiece:!0,force:!!n,keyHasChanged:!1},qe(e)}function qe(e){requestAnimationFrame(()=>{let o=e.draggable.current;if(!o)return;e.animation.current?.plan.anims.has(o.orig)&&(e.animation.current=void 0);let r=e.pieces.get(o.orig);if(!r||!Z(r,o.piece))F(e);else if(!o.started&&V(o.pos,o.origPos)>=Math.pow(e.draggable.distance,2)&&(o.started=!0),o.started){if(typeof o.element=="function"){let t=o.element();if(!t)return;t.cgDragging=!0,t.classList.add("dragging"),o.element=t}let n=e.dom.bounds();x(o.element,[o.pos[0]-n.left-n.width/16,o.pos[1]-n.top-n.height/16]),o.keyHasChanged||=o.orig!==E(o.pos,b(e),n)}qe(e)})}function vo(e,o){e.draggable.current&&(!o.touches||o.touches.length<2)&&(e.draggable.current.pos=T(o))}function yo(e,o){let r=e.draggable.current;if(!r)return;if(o.type==="touchend"&&o.cancelable!==!1&&o.preventDefault(),o.type==="touchend"&&r.originTarget!==o.target&&!r.newPiece){e.draggable.current=void 0;return}C(e),K(e);let n=T(o)||r.pos,t=E(n,b(e),e.dom.bounds());t&&r.started&&r.orig!==t?r.newPiece?le(e,r.orig,t,r.force):(e.stats.ctrlKey=o.ctrlKey,xe(e,r.orig,t)&&(e.stats.dragged=!0)):r.newPiece?e.pieces.delete(r.orig):e.draggable.deleteOnDropOff&&!t&&(e.pieces.delete(r.orig),M(e.events.change)),(r.orig===r.previouslySelected||r.keyHasChanged)&&(r.orig===t||!t)?P(e):e.selectable.enabled||P(e),So(e),e.draggable.current=void 0,e.dom.redraw()}function F(e){let o=e.draggable.current;o&&(o.newPiece&&e.pieces.delete(o.orig),e.draggable.current=void 0,P(e),So(e),e.dom.redraw())}function So(e){let o=e.dom.elements;o.ghost&&X(o.ghost,!1)}function wo(e,o){let r=e.dom.elements.board.firstChild;for(;r;){if(r.cgKey===o&&r.tagName==="PIECE")return r;r=r.nextSibling}}function Mo(e,o){e.exploding={stage:1,keys:o},e.dom.redraw(),setTimeout(()=>{Po(e,2),setTimeout(()=>Po(e,void 0),120)},120)}function Po(e,o){e.exploding&&(o?e.exploding.stage=o:e.exploding=void 0,e.dom.redraw())}function xo(e,o){function r(){Qe(e),o()}return{set(n){n.orientation&&n.orientation!==e.orientation&&r(),Ae(e,n),(n.fen?O:R)(t=>pe(t,n),e)},state:e,getFen:()=>ao(e.pieces),toggleOrientation:r,setPieces(n){O(t=>_e(t,n),e)},selectSquare(n,t){n?O(i=>Q(i,n,t),e):e.selected&&(P(e),e.dom.redraw())},move(n,t){O(i=>Me(i,n,t),e)},newPiece(n,t){O(i=>se(i,n,t),e)},playPremove(){if(e.premovable.current){if(O(no,e))return!0;e.dom.redraw()}return!1},playPredrop(n){if(e.predroppable.current){let t=to(e,n);return e.dom.redraw(),t}return!1},cancelPremove(){R(C,e)},cancelPredrop(){R(K,e)},cancelMove(){R(n=>{_(n),F(n)},e)},stop(){R(n=>{Ce(n),F(n)},e)},explode(n){Mo(e,n)},setAutoShapes(n){R(t=>t.drawable.autoShapes=n,e)},setShapes(n){R(t=>t.drawable.shapes=n.slice(),e)},getKeyAtDomPos(n){return E(n,b(e),e.dom.bounds())},redrawAll:o,dragNewPiece(n,t,i){ho(e,n,t,i)},destroy(){Ce(e),e.dom.unbind&&e.dom.unbind(),e.dom.destroyed=!0}}}function ko(){return{pieces:ue(Ee),orientation:"white",turnColor:"white",coordinates:!0,coordinatesOnSquares:!1,ranksPosition:"right",autoCastle:!0,viewOnly:!1,disableContextMenu:!1,addPieceZIndex:!1,blockTouchScroll:!1,pieceKey:!1,trustAllEvents:!1,highlight:{lastMove:!0,check:!0},animation:{enabled:!0,duration:200},movable:{free:!0,color:"both",showDests:!0,events:{},rookCastle:!0},premovable:{enabled:!0,showDests:!0,castle:!0,events:{}},predroppable:{enabled:!1,events:{}},draggable:{enabled:!0,distance:3,autoDistance:!0,showGhost:!0,deleteOnDropOff:!1},dropmode:{active:!1},selectable:{enabled:!0},stats:{dragged:!("ontouchstart"in window)},events:{},drawable:{enabled:!0,visible:!0,defaultSnapToValidMove:!0,eraseOnClick:!0,shapes:[],autoShapes:[],brushes:{green:{key:"g",color:"#15781B",opacity:1,lineWidth:10},red:{key:"r",color:"#882020",opacity:1,lineWidth:10},blue:{key:"b",color:"#003088",opacity:1,lineWidth:10},yellow:{key:"y",color:"#e68f00",opacity:1,lineWidth:10},paleBlue:{key:"pb",color:"#003088",opacity:.4,lineWidth:15},paleGreen:{key:"pg",color:"#15781B",opacity:.4,lineWidth:15},paleRed:{key:"pr",color:"#882020",opacity:.4,lineWidth:15},paleGrey:{key:"pgr",color:"#4a4a4a",opacity:.35,lineWidth:15},purple:{key:"purple",color:"#68217a",opacity:.65,lineWidth:10},pink:{key:"pink",color:"#ee2080",opacity:.5,lineWidth:10},white:{key:"white",color:"white",opacity:1,lineWidth:10}},prevSvgHash:""},hold:Ie()}}var Do={hilitePrimary:{key:"hilitePrimary",color:"#3291ff",opacity:1,lineWidth:1},hiliteWhite:{key:"hiliteWhite",color:"#ffffff",opacity:1,lineWidth:1}};function Eo(){let e=h("defs"),o=w(h("filter"),{id:"cg-filter-blur"});return o.appendChild(w(h("feGaussianBlur"),{stdDeviation:"0.019"})),e.appendChild(o),e}function Ao(e,o,r){let n=e.drawable,t=n.current,i=t&&t.mouseSq?t:void 0,a=new Map,c=e.dom.bounds(),l=n.autoShapes.filter(p=>!p.piece);for(let p of n.shapes.concat(l).concat(i?[i]:[])){if(!p.dest)continue;let v=a.get(p.dest)??new Set,y=me(ge(g(p.orig),e.orientation),c),f=me(ge(g(p.dest),e.orientation),c);v.add(Re(y,f)),a.set(p.dest,v)}let s=n.shapes.concat(l).map(p=>({shape:p,current:!1,hash:Co(p,Oe(p.dest,a),!1,c)}));i&&s.push({shape:i,current:!0,hash:Co(i,Oe(i.dest,a),!0,c)});let u=s.map(p=>p.hash).join(";");if(u===e.drawable.prevSvgHash)return;e.drawable.prevSvgHash=u;let d=o.querySelector("defs");hr(n,s,d),vr(s,o.querySelector("g"),r.querySelector("g"),p=>wr(e,p,n.brushes,a,c))}function hr(e,o,r){let n=new Map,t;for(let c of o.filter(l=>l.shape.dest&&l.shape.brush))t=No(e.brushes[c.shape.brush],c.shape.modifiers),c.shape.modifiers?.hilite&&n.set(fe(t).key,fe(t)),n.set(t.key,t);let i=new Set,a=r.firstElementChild;for(;a;)i.add(a.getAttribute("cgKey")),a=a.nextElementSibling;for(let[c,l]of n.entries())i.has(c)||r.appendChild(xr(l))}function vr(e,o,r,n){let t=new Map;for(let i of e)t.set(i.hash,!1);for(let i of[o,r]){let a=[],c=i.firstElementChild,l;for(;c;)l=c.getAttribute("cgHash"),t.has(l)?t.set(l,!0):a.push(c),c=c.nextElementSibling;for(let s of a)i.removeChild(s)}for(let i of e.filter(a=>!t.get(a.hash)))for(let a of n(i))a.isCustom?r.appendChild(a.el):o.appendChild(a.el)}function Co({orig:e,dest:o,brush:r,piece:n,modifiers:t,customSvg:i,label:a},c,l,s){return[s.width,s.height,l,e,o,r,c&&"-",n&&yr(n),t&&Sr(t),i&&`custom-${Ko(i.html)},${i.center?.[0]??"o"}`,a&&`label-${Ko(a.text)}`].filter(u=>u).join(",")}function yr(e){return[e.color,e.role,e.scale].filter(o=>o).join(",")}function Sr(e){return[e.lineWidth,e.hilite&&"*"].filter(o=>o).join(",")}function Ko(e){let o=0;for(let r=0;r<e.length;r++)o=(o<<5)-o+e.charCodeAt(r)>>>0;return o.toString()}function wr(e,{shape:o,current:r,hash:n},t,i,a){let c=me(ge(g(o.orig),e.orientation),a),l=o.dest?me(ge(g(o.dest),e.orientation),a):c,s=o.brush&&No(t[o.brush],o.modifiers),u=i.get(o.dest),d=[];if(s){let p=w(h("g"),{cgHash:n});d.push({el:p}),c[0]!==l[0]||c[1]!==l[1]?p.appendChild(Mr(o,s,c,l,r,Oe(o.dest,i))):p.appendChild(Pr(t[o.brush],c,r,a))}if(o.label){let p=o.label;p.fill??=o.brush&&t[o.brush].color;let v=o.brush?void 0:"tr";d.push({el:kr(p,n,c,l,u,v),isCustom:!0})}if(o.customSvg){let p=o.customSvg.center??"orig",[v,y]=p==="label"?To(c,l,u).map(W=>W-.5):p==="dest"?l:c,f=w(h("g"),{transform:`translate(${v},${y})`,cgHash:n});f.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${o.customSvg.html}</svg>`,d.push({el:f,isCustom:!0})}return d}function Pr(e,o,r,n){let t=Dr(),i=(n.width+n.height)/(4*Math.max(n.width,n.height));return w(h("circle"),{stroke:e.color,"stroke-width":t[r?0:1],fill:"none",opacity:Ho(e,r),cx:o[0],cy:o[1],r:i-t[1]/2})}function fe(e){return["#ffffff","#fff","white"].includes(e.color)?Do.hilitePrimary:Do.hiliteWhite}function Mr(e,o,r,n,t,i){function a(s){let u=Kr(i&&!t),d=n[0]-r[0],p=n[1]-r[1],v=Math.atan2(p,d),y=Math.cos(v)*u,f=Math.sin(v)*u;return w(h("line"),{stroke:s?fe(o).color:o.color,"stroke-width":Cr(o,t)+(s?.04:0),"stroke-linecap":"round","marker-end":`url(#arrowhead-${s?fe(o).key:o.key})`,opacity:e.modifiers?.hilite?1:Ho(o,t),x1:r[0],y1:r[1],x2:n[0]-y,y2:n[1]-f})}if(!e.modifiers?.hilite)return a(!1);let c=h("g"),l=w(h("g"),{filter:"url(#cg-filter-blur)"});return l.appendChild(Er(r,n)),l.appendChild(a(!0)),c.appendChild(l),c.appendChild(a(!1)),c}function xr(e){let o=w(h("marker"),{id:"arrowhead-"+e.key,orient:"auto",overflow:"visible",markerWidth:4,markerHeight:4,refX:e.key.startsWith("hilite")?1.86:2.05,refY:2});return o.appendChild(w(h("path"),{d:"M0,0 V4 L3,2 Z",fill:e.color})),o.setAttribute("cgKey",e.key),o}function kr(e,o,r,n,t,i){let c=.4*.75**e.text.length,l=To(r,n,t),s=i==="tr"?.4:0,u=w(h("g"),{transform:`translate(${l[0]+s},${l[1]-s})`,cgHash:o});u.appendChild(w(h("circle"),{r:.4/2,"fill-opacity":i?1:.8,"stroke-opacity":i?1:.7,"stroke-width":.03,fill:e.fill??"#666",stroke:"white"}));let d=w(h("text"),{"font-size":c,"font-family":"Noto Sans","text-anchor":"middle",fill:"white",y:.13*.75**e.text.length});return d.innerHTML=e.text,u.appendChild(d),u}function ge(e,o){return o==="white"?e:[7-e[0],7-e[1]]}function Oe(e,o){return(e&&o.has(e)&&o.get(e).size>1)===!0}function h(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function w(e,o){for(let r in o)Object.prototype.hasOwnProperty.call(o,r)&&e.setAttribute(r,o[r]);return e}function No(e,o){return o?{color:e.color,opacity:Math.round(e.opacity*10)/10,lineWidth:Math.round(o.lineWidth||e.lineWidth),key:[e.key,o.lineWidth].filter(r=>r).join("")}:e}function Dr(){return[3/64,4/64]}function Cr(e,o){return(e.lineWidth||10)*(o?.85:1)/64}function Ho(e,o){return(e.opacity||1)*(o?.9:1)}function Kr(e){return(e?20:10)/64}function me(e,o){let r=Math.min(1,o.width/o.height),n=Math.min(1,o.height/o.width);return[(e[0]-3.5)*r,(3.5-e[1])*n]}function Er(e,o){let r={from:[Math.floor(Math.min(e[0],o[0])),Math.floor(Math.min(e[1],o[1]))],to:[Math.ceil(Math.max(e[0],o[0])),Math.ceil(Math.max(e[1],o[1]))]};return w(h("rect"),{x:r.from[0],y:r.from[1],width:r.to[0]-r.from[0],height:r.to[1]-r.from[1],fill:"none",stroke:"none"})}function Re(e,o,r=!0){let n=Math.atan2(o[1]-e[1],o[0]-e[0])+Math.PI;return r?(Math.round(n*8/Math.PI)+16)%16:n}function Ar(e,o){return Math.sqrt([e[0]-o[0],e[1]-o[1]].reduce((r,n)=>r+n*n,0))}function To(e,o,r){let n=Ar(e,o),t=Re(e,o,!1);if(r&&(n-=33/64,r.size>1)){n-=10/64;let i=Re(e,o);(r.has((i+1)%16)||r.has((i+15)%16))&&i&1&&(n-=.4)}return[e[0]-Math.cos(t)*n,e[1]-Math.sin(t)*n].map(i=>i+.5)}function qo(e,o){e.innerHTML="",e.classList.add("cg-wrap");for(let l of Fe)e.classList.toggle("orientation-"+l,o.orientation===l);e.classList.toggle("manipulable",!o.viewOnly);let r=k("cg-container");e.appendChild(r);let n=k("cg-board");r.appendChild(n);let t,i,a;if(o.drawable.visible&&(t=w(h("svg"),{class:"cg-shapes",viewBox:"-4 -4 8 8",preserveAspectRatio:"xMidYMid slice"}),t.appendChild(Eo()),t.appendChild(h("g")),i=w(h("svg"),{class:"cg-custom-svgs",viewBox:"-3.5 -3.5 8 8",preserveAspectRatio:"xMidYMid slice"}),i.appendChild(h("g")),a=k("cg-auto-pieces"),r.appendChild(t),r.appendChild(i),r.appendChild(a)),o.coordinates){let l=o.orientation==="black"?" black":"",s=o.ranksPosition==="left"?" left":"";if(o.coordinatesOnSquares){let u=o.orientation==="white"?d=>d+1:d=>8-d;G.forEach((d,p)=>r.appendChild(Be($.map(v=>d+v),"squares rank"+u(p)+l+s)))}else r.appendChild(Be($,"ranks"+l+s)),r.appendChild(Be(G,"files"+l))}let c;return o.draggable.enabled&&o.draggable.showGhost&&(c=k("piece","ghost"),X(c,!1),r.appendChild(c)),{board:n,container:r,wrap:e,ghost:c,svg:t,customSvg:i,autoPieces:a}}function Be(e,o){let r=k("coords",o),n;for(let t of e)n=k("coord"),n.textContent=t,r.appendChild(n);return r}function Oo(e,o){if(!e.dropmode.active)return;C(e),K(e);let r=e.dropmode.piece;if(r){e.pieces.set("a0",r);let n=T(o),t=n&&E(n,b(e),e.dom.bounds());t&&le(e,"a0",t)}e.dom.redraw()}function Bo(e,o){let r=e.dom.elements.board;if("ResizeObserver"in window&&new ResizeObserver(o).observe(e.dom.elements.wrap),(e.disableContextMenu||e.drawable.enabled)&&r.addEventListener("contextmenu",t=>t.preventDefault()),e.viewOnly)return;let n=Hr(e);r.addEventListener("touchstart",n,{passive:!1}),r.addEventListener("mousedown",n,{passive:!1})}function Vo(e,o){let r=[];if("ResizeObserver"in window||r.push(J(document.body,"chessground.resize",o)),!e.viewOnly){let n=Ro(e,vo,po),t=Ro(e,yo,fo);for(let a of["touchmove","mousemove"])r.push(J(document,a,n));for(let a of["touchend","mouseup"])r.push(J(document,a,t));let i=()=>e.dom.bounds.clear();r.push(J(document,"scroll",i,{capture:!0,passive:!0})),r.push(J(window,"resize",i,{passive:!0}))}return()=>r.forEach(n=>n())}function J(e,o,r,n){return e.addEventListener(o,r,n),()=>e.removeEventListener(o,r,n)}var Hr=e=>o=>{e.draggable.current?F(e):e.drawable.current?Te(e):o.shiftKey||ie(o)?e.drawable.enabled&&lo(e,o):e.viewOnly||(e.dropmode.active?Oo(e,o):bo(e,o))},Ro=(e,o,r)=>n=>{e.drawable.current?e.drawable.enabled&&r(e,n):e.viewOnly||o(e,n)};function Go(e){let o=b(e),r=L(e.dom.bounds()),n=e.dom.elements.board,t=e.pieces,i=e.animation.current,a=i?i.plan.anims:new Map,c=i?i.plan.fadings:new Map,l=e.draggable.current,s=qr(e),u=new Set,d=new Set,p=new Map,v=new Map,y,f,W,z,D,j,be,A,he,oe;for(f=n.firstChild;f;){if(y=f.cgKey,Wo(f))if(W=t.get(y),D=a.get(y),j=c.get(y),z=f.cgPiece,f.cgDragging&&(!l||l.orig!==y)&&(f.classList.remove("dragging"),x(f,r(g(y),o)),f.cgDragging=!1),!j&&f.cgFading&&(f.cgFading=!1,f.classList.remove("fading")),W){if(D&&f.cgAnimating&&z===ee(W)){let m=g(y);m[0]+=D[2],m[1]+=D[3],f.classList.add("anim"),x(f,r(m,o))}else f.cgAnimating&&(f.cgAnimating=!1,f.classList.remove("anim"),x(f,r(g(y),o)),e.addPieceZIndex&&(f.style.zIndex=Ve(g(y),o)));z===ee(W)&&(!j||!f.cgFading)?u.add(y):j&&z===ee(j)?(f.classList.add("fading"),f.cgFading=!0):Le(p,z,f)}else Le(p,z,f);else if(zo(f)){let m=f.className;s.get(y)===m?d.add(y):Le(v,m,f)}f=f.nextSibling}for(let[m,U]of s)if(!d.has(m)){he=v.get(U),oe=he&&he.pop();let N=r(g(m),o);if(oe)oe.cgKey=m,x(oe,N);else{let H=k("square",U);H.cgKey=m,x(H,N),n.insertBefore(H,n.firstChild)}}for(let[m,U]of t)if(D=a.get(m),!u.has(m))if(be=p.get(ee(U)),A=be&&be.pop(),A){A.cgKey=m,A.cgFading&&(A.classList.remove("fading"),A.cgFading=!1);let N=g(m);e.addPieceZIndex&&(A.style.zIndex=Ve(N,o)),D&&(A.cgAnimating=!0,A.classList.add("anim"),N[0]+=D[2],N[1]+=D[3]),x(A,r(N,o))}else{let N=ee(U),H=k("piece",N),re=g(m);H.cgPiece=N,H.cgKey=m,D&&(H.cgAnimating=!0,re[0]+=D[2],re[1]+=D[3]),x(H,r(re,o)),e.addPieceZIndex&&(H.style.zIndex=Ve(re,o)),n.appendChild(H)}for(let m of p.values())Lo(e,m);for(let m of v.values())Lo(e,m)}function Fo(e){let o=b(e),r=L(e.dom.bounds()),n=e.dom.elements.board.firstChild;for(;n;)(Wo(n)&&!n.cgAnimating||zo(n))&&x(n,r(g(n.cgKey),o)),n=n.nextSibling}function Ge(e){let o=e.dom.elements.wrap.getBoundingClientRect(),r=e.dom.elements.container,n=o.height/o.width,t=Math.floor(o.width*window.devicePixelRatio/8)*8/window.devicePixelRatio,i=t*n;r.style.width=t+"px",r.style.height=i+"px",e.dom.bounds.clear(),e.addDimensionsCssVarsTo?.style.setProperty("---cg-width",t+"px"),e.addDimensionsCssVarsTo?.style.setProperty("---cg-height",i+"px")}var Wo=e=>e.tagName==="PIECE",zo=e=>e.tagName==="SQUARE";function Lo(e,o){for(let r of o)e.dom.elements.board.removeChild(r)}function Ve(e,o){let n=e[1];return`${o?10-n:3+n}`}var ee=e=>`${e.color} ${e.role}`;function qr(e){let o=new Map;if(e.lastMove&&e.highlight.lastMove)for(let t of e.lastMove)B(o,t,"last-move");if(e.check&&e.highlight.check&&B(o,e.check,"check"),e.selected&&(B(o,e.selected,"selected"),e.movable.showDests)){let t=e.movable.dests?.get(e.selected);if(t)for(let a of t)B(o,a,"move-dest"+(e.pieces.has(a)?" oc":""));let i=e.premovable.customDests?.get(e.selected)??e.premovable.dests;if(i)for(let a of i)B(o,a,"premove-dest"+(e.pieces.has(a)?" oc":""))}let r=e.premovable.current;if(r)for(let t of r)B(o,t,"current-premove");else e.predroppable.current&&B(o,e.predroppable.current.key,"current-premove");let n=e.exploding;if(n)for(let t of n.keys)B(o,t,"exploding"+n.stage);return e.highlight.custom&&e.highlight.custom.forEach((t,i)=>{B(o,i,t)}),o}function B(e,o,r){let n=e.get(o);n?e.set(o,`${n} ${r}`):e.set(o,r)}function Le(e,o,r){let n=e.get(o);n?n.push(r):e.set(o,[r])}function $o(e,o,r){let n=new Map,t=[];for(let c of e)n.set(c.hash,!1);let i=o.firstElementChild,a;for(;i;)a=i.getAttribute("cgHash"),n.has(a)?n.set(a,!0):t.push(i),i=i.nextElementSibling;for(let c of t)o.removeChild(c);for(let c of e)n.get(c.hash)||o.appendChild(r(c))}function Io(e,o){let n=e.drawable.autoShapes.filter(t=>t.piece).map(t=>({shape:t,hash:Rr(t),current:!1}));$o(n,o,t=>Or(e,t,e.dom.bounds()))}function jo(e){let o=b(e),r=L(e.dom.bounds()),n=e.dom.elements.autoPieces?.firstChild;for(;n;)ve(n,r(g(n.cgKey),o),n.cgScale),n=n.nextSibling}function Or(e,{shape:o,hash:r},n){let t=o.orig,i=o.piece?.role,a=o.piece?.color,c=o.piece?.scale,l=k("piece",`${i} ${a}`);return l.setAttribute("cgHash",r),l.cgKey=t,l.cgScale=c,ve(l,L(n)(g(t),b(e)),c),l}var Rr=e=>[e.orig,e.piece?.role,e.piece?.color,e.piece?.scale].join(",");function Bn({el:e,config:o}){return Vr(e,o)}function Vr(e,o){let r=ko();pe(r,o||{});function n(){let t="dom"in r?r.dom.unbind:void 0,i=qo(e,r),a=$e(()=>i.board.getBoundingClientRect()),c=u=>{Go(s),i.autoPieces&&Io(s,i.autoPieces),!u&&i.svg&&Ao(s,i.svg,i.customSvg)},l=()=>{Ge(s),Fo(s),i.autoPieces&&jo(s)},s=r;return s.dom={elements:i,bounds:a,redraw:Lr(c),redrawNow:c,unbind:t},s.drawable.prevSvgHash="",Ge(s),c(!1),Bo(s,l),t||(s.dom.unbind=Vo(s,l)),s.events.insert&&s.events.insert(i),s}return xo(n(),n)}function Lr(e){let o=!1;return()=>{o||(o=!0,requestAnimationFrame(()=>{e(),o=!1}))}}export{Vr as Chessground,Bn as initModule};
|
|
1
|
+
var _e=["white","black"];var F=["a","b","c","d","e","f","g","h"],I=["1","2","3","4","5","6","7","8"];var Je=[...I].reverse(),se=F.flatMap(e=>I.map(o=>e+o)),m=e=>se[8*e[0]+e[1]],f=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49];var ce=se.map(f);function eo(e){let o,r=()=>(o===void 0&&(o=e()),o);return r.clear=()=>{o=void 0},r}var oo=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;let o=performance.now()-e;return e=void 0,o}}},j=e=>e==="white"?"black":"white",V=(e,o)=>(e[0]-o[0])**2+(e[1]-o[1])**2,G=(e,o)=>e.role===o.role&&e.color===o.color,ro=(e,o)=>e[0]===o[0]&&e[1]===o[1],L=e=>(o,r)=>[(r?o[0]:7-o[0])*e.width/8,(r?7-o[1]:o[1])*e.height/8],k=(e,o)=>{e.style.transform=`translate(${o[0]}px,${o[1]}px)`},De=(e,o,r=1)=>{e.style.transform=`translate(${o[0]}px,${o[1]}px) scale(${r})`},Y=(e,o)=>{e.style.visibility=o?"visible":"hidden"},T=e=>{if(e.clientX||e.clientX===0)return[e.clientX,e.clientY];if(e.targetTouches?.[0])return[e.targetTouches[0].clientX,e.targetTouches[0].clientY]},le=e=>e.button===2,C=(e,o)=>{let r=document.createElement(e);return o&&(r.className=o),r};function de(e,o,r){let n=f(e);return o||(n[0]=7-n[0],n[1]=7-n[1]),[r.left+r.width*n[0]/8+r.width/16,r.top+r.height*(7-n[1])/8+r.height/16]}var K=(e,o)=>Math.abs(e-o),_=(e,o,r,n)=>K(e,r)*K(o,n)===2,ue=(e,o,r,n)=>e===r!=(o===n),pe=(e,o,r,n)=>K(e,r)===K(o,n)&&e!==r,fe=(e,o,r,n)=>ue(e,o,r,n)||pe(e,o,r,n),Ke=(e,o,r,n)=>Math.max(K(e,r),K(o,n))===1,xe=(e,o,r,n,t)=>K(e,r)===1&&n===o+(t?1:-1),Ee=(e,o,r,n,t)=>{let i=t?1:-1;return e===r&&(n===o+i||n===o+2*i&&(t?o<=1:o>=6))},Q=(e,o,r,n)=>{let t=r-e,i=n-o;if(t&&i&&Math.abs(t)!==Math.abs(i))return[];let a=Math.sign(t),c=Math.sign(i),l=[],s=e+a,p=o+c;for(;s!==r||p!==n;)l.push([s,p]),s+=a,p+=c;return l.map(d=>m(d))},no=e=>{let o=f(e),r=[];return o[0]>0&&r.push([o[0]-1,o[1]]),o[0]<7&&r.push([o[0]+1,o[1]]),r.map(m)},J=(e,o)=>{let r=f(e);return r[1]+=o,m(r)};var U=e=>e.friendlies.has(m(e.pos2)),tr=e=>e.enemies.has(m(e.pos2)),to=(e,o,r)=>Q(...e,...o).some(n=>r.has(n)),io=(e,o,r)=>{let n=r.enemies.get(e);if(n?.role!=="pawn")return!1;let t=n.color==="white"?1:-1,i=f(e),a=f(o);return Ee(...i,...a,n.color==="white")&&!to(i,[a[0],a[1]+t],r.allPieces)},ir=(e,o,r)=>{let n=r.enemies.get(e);return n?.role==="pawn"&&xe(...f(e),...f(o),n.color==="white")&&(r.friendlies.has(o)||me(J(o,n.color==="white"?-1:1),r.friendlies,r.enemies,r.lastMove))},ar=e=>[...e.enemies.keys()].some(o=>io(o,m(e.pos2),e)),Ae=(e,o)=>{let r=e.pos2;return[...e.enemies].some(([n,t])=>{let i=f(n);return!o?.includes(t.role)&&(t.role==="pawn"&&xe(...i,...r,t.color==="white")||t.role==="knight"&&_(...i,...r)||t.role==="bishop"&&pe(...i,...r)||t.role==="rook"&&ue(...i,...r)||t.role==="queen"&&fe(...i,...r)||t.role==="king"&&Ke(...i,...r))&&(!["bishop","rook","queen"].includes(t.role)||!to(i,r,e.allPieces))})},ge=e=>U(e)&&(me(m(e.pos2),e.friendlies,e.enemies,e.lastMove)||Ae(e)),me=(e,o,r,n)=>{if(!n||e!==n[1])return!1;let t=f(n[0]),i=f(n[1]);return o.get(n[1]).role==="pawn"&&K(t[1],i[1])===2&&[1,-1].some(c=>r.get(m([i[0]+c,i[1]]))?.role==="pawn")},sr=e=>{if(e.unrestrictedPremoves)return!0;let o=Q(...e.pos1,...e.pos2),r=o.filter(n=>e.friendlies.has(n));return!r.length||r.length===1&&me(r[0],e.friendlies,e.enemies,e.lastMove)&&!o.includes(J(r[0],e.color==="white"?-1:1))},cr=e=>{if(e.unrestrictedPremoves)return!0;let o=Q(...e.pos1,...e.pos2),r=o.filter(s=>e.enemies.has(s));if(r.length>1)return!1;if(!r.length)return!0;let n=r[0],t=e.enemies.get(n);if(!t||t.role!=="pawn")return!0;let i=t.color==="white"?1:-1,a=J(n,i),c=[...no(a).filter(s=>ir(n,s,e)),...[a,J(a,i)].filter(s=>io(n,s,e))],l=[...o,m(e.pos1)];return c.some(s=>!l.includes(s))},Ne=e=>sr(e)&&cr(e),lr=e=>{let o=e.color==="white"?1:-1;return K(e.pos1[0],e.pos2[0])>1?!1:K(e.pos1[0],e.pos2[0])?e.pos2[1]!==e.pos1[1]+o?!1:e.unrestrictedPremoves||tr(e)?!0:U(e)?Ae(e):ar(e)||me(m([e.pos2[0],e.pos2[1]+o]),e.friendlies,e.enemies,e.lastMove)||Ae(e,["pawn"]):Ee(...e.pos1,...e.pos2,e.color==="white")&&Ne({...e,pos2:[e.pos2[0],e.pos2[1]+o]})},dr=e=>_(...e.pos1,...e.pos2)&&(e.unrestrictedPremoves||!U(e)||ge(e)),ao=e=>pe(...e.pos1,...e.pos2)&&Ne(e)&&(e.unrestrictedPremoves||!U(e)||ge(e)),so=e=>ue(...e.pos1,...e.pos2)&&Ne(e)&&(e.unrestrictedPremoves||!U(e)||ge(e)),ur=e=>ao(e)||so(e),pr=e=>Ke(...e.pos1,...e.pos2)&&(e.unrestrictedPremoves||!U(e)||ge(e))||e.canCastle&&e.pos1[1]===e.pos2[1]&&e.pos1[1]===(e.color==="white"?0:7)&&(e.pos1[0]===4&&(e.pos2[0]===2&&e.rookFilesFriendlies.includes(0)||e.pos2[0]===6&&e.rookFilesFriendlies.includes(7))||e.rookFilesFriendlies.includes(e.pos2[0]))&&(e.unrestrictedPremoves||Q(...e.pos1,e.pos2[0]>e.pos1[0]?7:1,e.pos2[1]).map(o=>e.allPieces.get(o)).every(o=>!o||G(o,{role:"rook",color:e.color}))),fr={pawn:lr,knight:dr,bishop:ao,rook:so,queen:ur,king:pr};function He(e,o){let r=e.pieces,n=e.premovable.castle,t=!!e.premovable.unrestrictedPremoves,i=r.get(o);if(!i||i.color===e.turnColor)return[];let a=i.color,c=new Map([...r].filter(([u,b])=>b.color===a)),l=new Map([...r].filter(([u,b])=>b.color===j(a))),s=f(o),p=fr[i.role],d={pos1:s,allPieces:r,friendlies:c,enemies:l,unrestrictedPremoves:t,color:a,canCastle:n,rookFilesFriendlies:Array.from(r).filter(([u,b])=>u[1]===(a==="white"?"1":"8")&&b.color===a&&b.role==="rook").map(([u])=>f(u)[0]),lastMove:e.lastMove};return ce.filter(u=>p({...d,pos2:u})).map(m)}function M(e,...o){e&&setTimeout(()=>e(...o),1)}function co(e){e.orientation=j(e.orientation),e.animation.current=e.draggable.current=e.selected=void 0}function lo(e,o){for(let[r,n]of o)n?e.pieces.set(r,n):e.pieces.delete(r)}function uo(e,o){if(e.check=void 0,o===!0&&(o=e.turnColor),o)for(let[r,n]of e.pieces)n.role==="king"&&n.color===o&&(e.check=r)}function gr(e,o,r,n){E(e),e.premovable.current=[o,r],M(e.premovable.events.set,o,r,n)}function x(e){e.premovable.current&&(e.premovable.current=void 0,M(e.premovable.events.unset))}function mr(e,o,r){x(e),e.predroppable.current={role:o,key:r},M(e.predroppable.events.set,o,r)}function E(e){let o=e.predroppable;o.current&&(o.current=void 0,M(o.events.unset))}function br(e,o,r){if(!e.autoCastle)return!1;let n=e.pieces.get(o);if(!n||n.role!=="king")return!1;let t=f(o),i=f(r);if(t[1]!==0&&t[1]!==7||t[1]!==i[1])return!1;t[0]===4&&!e.pieces.has(r)&&(i[0]===6?r=m([7,i[1]]):i[0]===2&&(r=m([0,i[1]])));let a=e.pieces.get(r);return!a||a.color!==n.color||a.role!=="rook"?!1:(e.pieces.delete(o),e.pieces.delete(r),t[0]<i[0]?(e.pieces.set(m([6,i[1]]),n),e.pieces.set(m([5,i[1]]),a)):(e.pieces.set(m([2,i[1]]),n),e.pieces.set(m([3,i[1]]),a)),!0)}function qe(e,o,r){let n=e.pieces.get(o),t=e.pieces.get(r);if(o===r||!n)return!1;let i=t&&t.color!==n.color?t:void 0;return r===e.selected&&P(e),M(e.events.move,o,r,i),br(e,o,r)||(e.pieces.set(r,n),e.pieces.delete(o)),e.lastMove=[o,r],e.check=void 0,M(e.events.change),i||!0}function be(e,o,r,n){if(e.pieces.has(r))if(n)e.pieces.delete(r);else return!1;return M(e.events.dropNewPiece,o,r),e.pieces.set(r,o),e.lastMove=[r],e.check=void 0,M(e.events.change),e.movable.dests=void 0,e.turnColor=j(e.turnColor),!0}function po(e,o,r){let n=qe(e,o,r);return n&&(e.movable.dests=void 0,e.turnColor=j(e.turnColor),e.animation.current=void 0),n}function Te(e,o,r){if(ve(e,o,r)){let n=po(e,o,r);if(n){let t=e.hold.stop();P(e);let i={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:t};return n!==!0&&(i.captured=n),M(e.movable.events.after,o,r,i),!0}}else if(vr(e,o,r))return gr(e,o,r,{ctrlKey:e.stats.ctrlKey}),P(e),!0;return P(e),!1}function he(e,o,r,n){let t=e.pieces.get(o);t&&(hr(e,o,r)||n)?(e.pieces.delete(o),be(e,t,r,n),M(e.movable.events.afterNewPiece,t.role,r,{premove:!1,predrop:!1})):t&&yr(e,o,r)?mr(e,t.role,r):(x(e),E(e)),e.pieces.delete(o),P(e)}function oe(e,o,r){if(M(e.events.select,o),e.selected){if(e.selected===o&&!e.draggable.enabled){P(e),e.hold.cancel();return}else if((e.selectable.enabled||r)&&e.selected!==o&&Te(e,e.selected,o)){e.stats.dragged=!1;return}}(e.selectable.enabled||e.draggable.enabled)&&(fo(e,o)||Oe(e,o))&&(Be(e,o),e.hold.start())}function Be(e,o){e.selected=o,Oe(e,o)?e.premovable.customDests||(e.premovable.dests=He(e,o)):e.premovable.dests=void 0}function P(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function fo(e,o){let r=e.pieces.get(o);return!!r&&(e.movable.color==="both"||e.movable.color===r.color&&e.turnColor===r.color)}var ve=(e,o,r)=>o!==r&&fo(e,o)&&(e.movable.free||!!e.movable.dests?.get(o)?.includes(r));function hr(e,o,r){let n=e.pieces.get(o);return!!n&&(o===r||!e.pieces.has(r))&&(e.movable.color==="both"||e.movable.color===n.color&&e.turnColor===n.color)}function Oe(e,o){let r=e.pieces.get(o);return!!r&&e.premovable.enabled&&e.movable.color===r.color&&e.turnColor!==r.color}var vr=(e,o,r)=>o!==r&&Oe(e,o)&&(e.premovable.customDests?.get(o)??He(e,o)).includes(r);function yr(e,o,r){let n=e.pieces.get(o),t=e.pieces.get(r);return!!n&&(!t||t.color!==e.movable.color)&&e.predroppable.enabled&&(n.role!=="pawn"||r[1]!=="1"&&r[1]!=="8")&&e.movable.color===n.color&&e.turnColor!==n.color}function go(e,o){let r=e.pieces.get(o);return!!r&&e.draggable.enabled&&(e.movable.color==="both"||e.movable.color===r.color&&(e.turnColor===r.color||e.premovable.enabled))}function mo(e){let o=e.premovable.current;if(!o)return!1;let r=o[0],n=o[1],t=!1;if(ve(e,r,n)){let i=po(e,r,n);if(i){let a={premove:!0};i!==!0&&(a.captured=i),M(e.movable.events.after,r,n,a),t=!0}}return x(e),t}function bo(e,o){let r=e.predroppable.current,n=!1;if(!r)return!1;if(o(r)){let t={role:r.role,color:e.movable.color};be(e,t,r.key)&&(M(e.movable.events.afterNewPiece,r.role,r.key,{premove:!1,predrop:!0}),n=!0)}return E(e),n}function re(e){x(e),E(e),P(e)}function Re(e){e.movable.color=e.movable.dests=e.animation.current=void 0,re(e)}function A(e,o,r){let n=Math.floor(8*(e[0]-r.left)/r.width);o||(n=7-n);let t=7-Math.floor(8*(e[1]-r.top)/r.height);return o||(t=7-t),n>=0&&n<8&&t>=0&&t<8?m([n,t]):void 0}function ho(e,o,r,n){let t=f(e),i=ce.filter(s=>ro(t,s)||fe(t[0],t[1],s[0],s[1])||_(t[0],t[1],s[0],s[1])),c=i.map(s=>de(m(s),r,n)).map(s=>V(o,s)),[,l]=c.reduce((s,p,d)=>s[0]<p?s:[p,d],[c[0],0]);return m(i[l])}var v=e=>e.orientation==="white";var Le="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",Sr={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},wr={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};function ye(e){e==="start"&&(e=Le);let o=new Map,r=7,n=0;for(let t of e)switch(t){case" ":case"[":return o;case"/":if(--r,r<0)return o;n=0;break;case"~":{let i=o.get(m([n-1,r]));i&&(i.promoted=!0);break}default:{let i=t.charCodeAt(0);if(i<57)n+=i-48;else{let a=t.toLowerCase();o.set(m([n,r]),{role:Sr[a],color:t===a?"black":"white"}),++n}}}return o}function vo(e){return Je.map(o=>F.map(r=>{let n=e.get(r+o);if(n){let t=wr[n.role];return n.color==="white"&&(t=t.toUpperCase()),n.promoted&&(t+="~"),t}else return"1"}).join("")).join("/").replace(/1{2,}/g,o=>o.length.toString())}function Fe(e,o){o.animation&&(Ge(e.animation,o.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function Se(e,o){if(o.movable?.dests&&(e.movable.dests=void 0),o.drawable?.autoShapes&&(e.drawable.autoShapes=[]),Ge(e,o),o.fen&&(e.pieces=ye(o.fen),e.drawable.shapes=o.drawable?.shapes||[]),"check"in o&&uo(e,o.check||!1),"lastMove"in o&&!o.lastMove?e.lastMove=void 0:o.lastMove&&(e.lastMove=o.lastMove),e.selected&&Be(e,e.selected),Fe(e,o),!e.movable.rookCastle&&e.movable.dests){let r=e.movable.color==="white"?"1":"8",n="e"+r,t=e.movable.dests.get(n),i=e.pieces.get(n);if(!t||!i||i.role!=="king")return;e.movable.dests.set(n,t.filter(a=>!(a==="a"+r&&t.includes("c"+r))&&!(a==="h"+r&&t.includes("g"+r))))}}function Ge(e,o){for(let r in o)r==="__proto__"||r==="constructor"||!Object.prototype.hasOwnProperty.call(o,r)||(Object.prototype.hasOwnProperty.call(e,r)&&yo(e[r])&&yo(o[r])?Ge(e[r],o[r]):e[r]=o[r])}function yo(e){if(typeof e!="object"||e===null)return!1;let o=Object.getPrototypeOf(e);return o===Object.prototype||o===null}var B=(e,o)=>o.animation.enabled?Cr(e,o):O(e,o);function O(e,o){let r=e(o);return o.dom.redraw(),r}var We=(e,o)=>({key:e,pos:f(e),piece:o}),Mr=(e,o)=>o.sort((r,n)=>V(e.pos,r.pos)-V(e.pos,n.pos))[0];function kr(e,o){let r=new Map,n=[],t=new Map,i=[],a=[],c=new Map,l,s,p;for(let[d,u]of e)c.set(d,We(d,u));for(let d of se)l=o.pieces.get(d),s=c.get(d),l?s?G(l,s.piece)||(i.push(s),a.push(We(d,l))):a.push(We(d,l)):s&&i.push(s);for(let d of a)s=Mr(d,i.filter(u=>G(d.piece,u.piece))),s&&(p=[s.pos[0]-d.pos[0],s.pos[1]-d.pos[1]],r.set(d.key,p.concat(p)),n.push(s.key));for(let d of i)n.includes(d.key)||t.set(d.key,d.piece);return{anims:r,fadings:t}}function So(e,o){let r=e.animation.current;if(r===void 0){e.dom.destroyed||e.dom.redrawNow();return}let n=1-(o-r.start)*r.frequency;if(n<=0)e.animation.current=void 0,e.dom.redrawNow();else{let t=Dr(n);for(let i of r.plan.anims.values())i[2]=i[0]*t,i[3]=i[1]*t;e.dom.redrawNow(!0),requestAnimationFrame((i=performance.now())=>So(e,i))}}function Cr(e,o){let r=new Map(o.pieces),n=e(o),t=kr(r,o);if(t.anims.size||t.fadings.size){let i=o.animation.current&&o.animation.current.start;o.animation.current={start:performance.now(),frequency:1/o.animation.duration,plan:t},i||So(o,performance.now())}else o.dom.redraw();return n}var Dr=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1;var Kr=["green","red","blue","yellow"];function wo(e,o){if(o.touches&&o.touches.length>1)return;o.stopPropagation(),o.preventDefault(),o.ctrlKey?P(e):re(e);let r=T(o),n=A(r,v(e),e.dom.bounds());n&&(e.drawable.current={orig:n,pos:r,brush:xr(o),snapToValidMove:e.drawable.defaultSnapToValidMove},Po(e))}function Po(e){requestAnimationFrame(()=>{let o=e.drawable.current;if(o){let r=A(o.pos,v(e),e.dom.bounds());r||(o.snapToValidMove=!1);let n=o.snapToValidMove?ho(o.orig,o.pos,v(e),e.dom.bounds()):r;n!==o.mouseSq&&(o.mouseSq=n,o.dest=n!==o.orig?n:void 0,e.dom.redrawNow()),Po(e)}})}function Mo(e,o){e.drawable.current&&(e.drawable.current.pos=T(o))}function ko(e){let o=e.drawable.current;o&&(o.mouseSq&&Er(e.drawable,o),ze(e))}function ze(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}function Co(e){e.drawable.shapes.length&&(e.drawable.shapes=[],e.dom.redraw(),Do(e.drawable))}function xr(e){let o=(e.shiftKey||e.ctrlKey)&&le(e),r=e.altKey||e.metaKey||e.getModifierState?.("AltGraph");return Kr[(o?1:0)+(r?2:0)]}function Er(e,o){let r=t=>t.orig===o.orig&&t.dest===o.dest,n=e.shapes.find(r);n&&(e.shapes=e.shapes.filter(t=>!r(t))),(!n||n.brush!==o.brush)&&e.shapes.push({orig:o.orig,dest:o.dest,brush:o.brush}),Do(e)}function Do(e){e.onChange&&e.onChange(e.shapes)}function Ko(e,o){if(!(e.trustAllEvents||o.isTrusted)||o.buttons!==void 0&&o.buttons>1||o.touches&&o.touches.length>1)return;let r=e.dom.bounds(),n=T(o),t=A(n,v(e),r);if(!t)return;let i=e.pieces.get(t),a=e.selected;if(!a&&e.drawable.enabled&&(e.drawable.eraseOnClick||!i||i.color!==e.turnColor)&&Co(e),o.cancelable!==!1&&(!o.touches||e.blockTouchScroll||i||a||Nr(e,n)))o.preventDefault();else if(o.touches)return;let c=!!e.premovable.current,l=!!e.predroppable.current;e.stats.ctrlKey=o.ctrlKey,e.selected&&ve(e,e.selected,t)?B(d=>oe(d,t),e):oe(e,t);let s=e.selected===t,p=Ho(e,t);if(i&&p&&s&&go(e,t)){e.draggable.current={orig:t,piece:i,origPos:n,pos:n,started:e.draggable.autoDistance&&e.stats.dragged,element:p,previouslySelected:a,originTarget:o.target,keyHasChanged:!1},p.cgDragging=!0,p.classList.add("dragging");let d=e.dom.elements.ghost;d&&(d.className=`ghost ${i.color} ${i.role}`,k(d,L(r)(f(t),v(e))),Y(d,!0)),$e(e)}else c&&x(e),l&&E(e);e.dom.redraw()}function Nr(e,o){let r=v(e),n=e.dom.bounds(),t=Math.pow(n.width/8,2);for(let i of e.pieces.keys()){let a=de(i,r,n);if(V(a,o)<=t)return!0}return!1}function xo(e,o,r,n){let t="a0";e.pieces.set(t,o),e.dom.redraw();let i=T(r);e.draggable.current={orig:t,piece:o,origPos:i,pos:i,started:!0,element:()=>Ho(e,t),originTarget:r.target,newPiece:!0,force:!!n,keyHasChanged:!1},$e(e)}function $e(e){requestAnimationFrame(()=>{let o=e.draggable.current;if(!o)return;e.animation.current?.plan.anims.has(o.orig)&&(e.animation.current=void 0);let r=e.pieces.get(o.orig);if(!r||!G(r,o.piece))W(e);else if(!o.started&&V(o.pos,o.origPos)>=Math.pow(e.draggable.distance,2)&&(o.started=!0),o.started){if(typeof o.element=="function"){let t=o.element();if(!t)return;t.cgDragging=!0,t.classList.add("dragging"),o.element=t}let n=e.dom.bounds();k(o.element,[o.pos[0]-n.left-n.width/16,o.pos[1]-n.top-n.height/16]),o.keyHasChanged||=o.orig!==A(o.pos,v(e),n)}$e(e)})}function Eo(e,o){e.draggable.current&&(!o.touches||o.touches.length<2)&&(e.draggable.current.pos=T(o))}function Ao(e,o){let r=e.draggable.current;if(!r)return;if(o.type==="touchend"&&o.cancelable!==!1&&o.preventDefault(),o.type==="touchend"&&r.originTarget!==o.target&&!r.newPiece){e.draggable.current=void 0;return}x(e),E(e);let n=T(o)||r.pos,t=A(n,v(e),e.dom.bounds());t&&r.started&&r.orig!==t?r.newPiece?he(e,r.orig,t,r.force):(e.stats.ctrlKey=o.ctrlKey,Te(e,r.orig,t)&&(e.stats.dragged=!0)):r.newPiece?e.pieces.delete(r.orig):e.draggable.deleteOnDropOff&&!t&&(e.pieces.delete(r.orig),M(e.events.change)),(r.orig===r.previouslySelected||r.keyHasChanged)&&(r.orig===t||!t)?P(e):e.selectable.enabled||P(e),No(e),e.draggable.current=void 0,e.dom.redraw()}function W(e){let o=e.draggable.current;o&&(o.newPiece&&e.pieces.delete(o.orig),e.draggable.current=void 0,P(e),No(e),e.dom.redraw())}function No(e){let o=e.dom.elements;o.ghost&&Y(o.ghost,!1)}function Ho(e,o){let r=e.dom.elements.board.firstChild;for(;r;){if(r.cgKey===o&&r.tagName==="PIECE")return r;r=r.nextSibling}}function To(e,o){e.exploding={stage:1,keys:o},e.dom.redraw(),setTimeout(()=>{qo(e,2),setTimeout(()=>qo(e,void 0),120)},120)}function qo(e,o){e.exploding&&(o?e.exploding.stage=o:e.exploding=void 0,e.dom.redraw())}function Bo(e,o){function r(){co(e),o()}return{set(n){n.orientation&&n.orientation!==e.orientation&&r(),Fe(e,n),(n.fen?B:O)(t=>Se(t,n),e)},state:e,getFen:()=>vo(e.pieces),toggleOrientation:r,setPieces(n){B(t=>lo(t,n),e)},selectSquare(n,t){n?B(i=>oe(i,n,t),e):e.selected&&(P(e),e.dom.redraw())},move(n,t){B(i=>qe(i,n,t),e)},newPiece(n,t){B(i=>be(i,n,t),e)},playPremove(){if(e.premovable.current){if(B(mo,e))return!0;e.dom.redraw()}return!1},playPredrop(n){if(e.predroppable.current){let t=bo(e,n);return e.dom.redraw(),t}return!1},cancelPremove(){O(x,e)},cancelPredrop(){O(E,e)},cancelMove(){O(n=>{re(n),W(n)},e)},stop(){O(n=>{Re(n),W(n)},e)},explode(n){To(e,n)},setAutoShapes(n){O(t=>t.drawable.autoShapes=n,e)},setShapes(n){O(t=>t.drawable.shapes=n.slice(),e)},getKeyAtDomPos(n){return A(n,v(e),e.dom.bounds())},redrawAll:o,dragNewPiece(n,t,i){xo(e,n,t,i)},destroy(){Re(e),e.dom.unbind&&e.dom.unbind(),e.dom.destroyed=!0}}}function Oo(){return{pieces:ye(Le),orientation:"white",turnColor:"white",coordinates:!0,coordinatesOnSquares:!1,ranksPosition:"right",autoCastle:!0,viewOnly:!1,disableContextMenu:!1,addPieceZIndex:!1,blockTouchScroll:!1,pieceKey:!1,trustAllEvents:!1,highlight:{lastMove:!0,check:!0},animation:{enabled:!0,duration:200},movable:{free:!0,color:"both",showDests:!0,events:{},rookCastle:!0},premovable:{enabled:!0,showDests:!0,castle:!0,events:{}},predroppable:{enabled:!1,events:{}},draggable:{enabled:!0,distance:3,autoDistance:!0,showGhost:!0,deleteOnDropOff:!1},dropmode:{active:!1},selectable:{enabled:!0},stats:{dragged:!("ontouchstart"in window)},events:{},drawable:{enabled:!0,visible:!0,defaultSnapToValidMove:!0,eraseOnClick:!0,shapes:[],autoShapes:[],brushes:{green:{key:"g",color:"#15781B",opacity:1,lineWidth:10},red:{key:"r",color:"#882020",opacity:1,lineWidth:10},blue:{key:"b",color:"#003088",opacity:1,lineWidth:10},yellow:{key:"y",color:"#e68f00",opacity:1,lineWidth:10},paleBlue:{key:"pb",color:"#003088",opacity:.4,lineWidth:15},paleGreen:{key:"pg",color:"#15781B",opacity:.4,lineWidth:15},paleRed:{key:"pr",color:"#882020",opacity:.4,lineWidth:15},paleGrey:{key:"pgr",color:"#4a4a4a",opacity:.35,lineWidth:15},purple:{key:"purple",color:"#68217a",opacity:.65,lineWidth:10},pink:{key:"pink",color:"#ee2080",opacity:.5,lineWidth:10},white:{key:"white",color:"white",opacity:1,lineWidth:10}},prevSvgHash:""},hold:oo()}}var Ro={hilitePrimary:{key:"hilitePrimary",color:"#3291ff",opacity:1,lineWidth:1},hiliteWhite:{key:"hiliteWhite",color:"#ffffff",opacity:1,lineWidth:1}};function Fo(){let e=y("defs"),o=w(y("filter"),{id:"cg-filter-blur"});return o.appendChild(w(y("feGaussianBlur"),{stdDeviation:"0.019"})),e.appendChild(o),e}function Go(e,o,r){let n=e.drawable,t=n.current,i=t&&t.mouseSq?t:void 0,a=new Map,c=e.dom.bounds(),l=n.autoShapes.filter(u=>!u.piece);for(let u of n.shapes.concat(l).concat(i?[i]:[])){if(!u.dest)continue;let b=a.get(u.dest)??new Set,S=Me(Pe(f(u.orig),e.orientation),c),g=Me(Pe(f(u.dest),e.orientation),c);b.add(je(S,g)),a.set(u.dest,b)}let s=n.shapes.concat(l).map(u=>({shape:u,current:!1,hash:Vo(u,Ie(u.dest,a),!1,c)}));i&&s.push({shape:i,current:!0,hash:Vo(i,Ie(i.dest,a),!0,c)});let p=s.map(u=>u.hash).join(";");if(p===e.drawable.prevSvgHash)return;e.drawable.prevSvgHash=p;let d=o.querySelector("defs");qr(n,s,d),Tr(s,o.querySelector("g"),r.querySelector("g"),u=>Rr(e,u,n.brushes,a,c))}function qr(e,o,r){let n=new Map,t;for(let c of o.filter(l=>l.shape.dest&&l.shape.brush))t=Wo(e.brushes[c.shape.brush],c.shape.modifiers),c.shape.modifiers?.hilite&&n.set(we(t).key,we(t)),n.set(t.key,t);let i=new Set,a=r.firstElementChild;for(;a;)i.add(a.getAttribute("cgKey")),a=a.nextElementSibling;for(let[c,l]of n.entries())i.has(c)||r.appendChild(Fr(l))}function Tr(e,o,r,n){let t=new Map;for(let i of e)t.set(i.hash,!1);for(let i of[o,r]){let a=[],c=i.firstElementChild,l;for(;c;)l=c.getAttribute("cgHash"),t.has(l)?t.set(l,!0):a.push(c),c=c.nextElementSibling;for(let s of a)i.removeChild(s)}for(let i of e.filter(a=>!t.get(a.hash)))for(let a of n(i))a.isCustom?r.appendChild(a.el):o.appendChild(a.el)}function Vo({orig:e,dest:o,brush:r,piece:n,modifiers:t,customSvg:i,label:a},c,l,s){return[s.width,s.height,l,e,o,r,c&&"-",n&&Br(n),t&&Or(t),i&&`custom-${Lo(i.html)},${i.center?.[0]??"o"}`,a&&`label-${Lo(a.text)}`].filter(p=>p).join(",")}function Br(e){return[e.color,e.role,e.scale].filter(o=>o).join(",")}function Or(e){return[e.lineWidth,e.hilite&&"*"].filter(o=>o).join(",")}function Lo(e){let o=0;for(let r=0;r<e.length;r++)o=(o<<5)-o+e.charCodeAt(r)>>>0;return o.toString()}function Rr(e,{shape:o,current:r,hash:n},t,i,a){let c=Me(Pe(f(o.orig),e.orientation),a),l=o.dest?Me(Pe(f(o.dest),e.orientation),a):c,s=o.brush&&Wo(t[o.brush],o.modifiers),p=i.get(o.dest),d=[];if(s){let u=w(y("g"),{cgHash:n});d.push({el:u}),c[0]!==l[0]||c[1]!==l[1]?u.appendChild(Lr(o,s,c,l,r,Ie(o.dest,i))):u.appendChild(Vr(t[o.brush],c,r,a))}if(o.label){let u=o.label;u.fill??=o.brush&&t[o.brush].color;let b=o.brush?void 0:"tr";d.push({el:Gr(u,n,c,l,p,b),isCustom:!0})}if(o.customSvg){let u=o.customSvg.center??"orig",[b,S]=u==="label"?$o(c,l,p).map(z=>z-.5):u==="dest"?l:c,g=w(y("g"),{transform:`translate(${b},${S})`,cgHash:n});g.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${o.customSvg.html}</svg>`,d.push({el:g,isCustom:!0})}return d}function Vr(e,o,r,n){let t=Wr(),i=(n.width+n.height)/(4*Math.max(n.width,n.height));return w(y("circle"),{stroke:e.color,"stroke-width":t[r?0:1],fill:"none",opacity:zo(e,r),cx:o[0],cy:o[1],r:i-t[1]/2})}function we(e){return["#ffffff","#fff","white"].includes(e.color)?Ro.hilitePrimary:Ro.hiliteWhite}function Lr(e,o,r,n,t,i){function a(s){let p=$r(i&&!t),d=n[0]-r[0],u=n[1]-r[1],b=Math.atan2(u,d),S=Math.cos(b)*p,g=Math.sin(b)*p;return w(y("line"),{stroke:s?we(o).color:o.color,"stroke-width":zr(o,t)+(s?.04:0),"stroke-linecap":"round","marker-end":`url(#arrowhead-${s?we(o).key:o.key})`,opacity:e.modifiers?.hilite?1:zo(o,t),x1:r[0],y1:r[1],x2:n[0]-S,y2:n[1]-g})}if(!e.modifiers?.hilite)return a(!1);let c=y("g"),l=w(y("g"),{filter:"url(#cg-filter-blur)"});return l.appendChild(Ir(r,n)),l.appendChild(a(!0)),c.appendChild(l),c.appendChild(a(!1)),c}function Fr(e){let o=w(y("marker"),{id:"arrowhead-"+e.key,orient:"auto",overflow:"visible",markerWidth:4,markerHeight:4,refX:e.key.startsWith("hilite")?1.86:2.05,refY:2});return o.appendChild(w(y("path"),{d:"M0,0 V4 L3,2 Z",fill:e.color})),o.setAttribute("cgKey",e.key),o}function Gr(e,o,r,n,t,i){let c=.4*.75**e.text.length,l=$o(r,n,t),s=i==="tr"?.4:0,p=w(y("g"),{transform:`translate(${l[0]+s},${l[1]-s})`,cgHash:o});p.appendChild(w(y("circle"),{r:.4/2,"fill-opacity":i?1:.8,"stroke-opacity":i?1:.7,"stroke-width":.03,fill:e.fill??"#666",stroke:"white"}));let d=w(y("text"),{"font-size":c,"font-family":"Noto Sans","text-anchor":"middle",fill:"white",y:.13*.75**e.text.length});return d.innerHTML=e.text,p.appendChild(d),p}function Pe(e,o){return o==="white"?e:[7-e[0],7-e[1]]}function Ie(e,o){return(e&&o.has(e)&&o.get(e).size>1)===!0}function y(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function w(e,o){for(let r in o)Object.prototype.hasOwnProperty.call(o,r)&&e.setAttribute(r,o[r]);return e}function Wo(e,o){return o?{color:e.color,opacity:Math.round(e.opacity*10)/10,lineWidth:Math.round(o.lineWidth||e.lineWidth),key:[e.key,o.lineWidth].filter(r=>r).join("")}:e}function Wr(){return[3/64,4/64]}function zr(e,o){return(e.lineWidth||10)*(o?.85:1)/64}function zo(e,o){return(e.opacity||1)*(o?.9:1)}function $r(e){return(e?20:10)/64}function Me(e,o){let r=Math.min(1,o.width/o.height),n=Math.min(1,o.height/o.width);return[(e[0]-3.5)*r,(3.5-e[1])*n]}function Ir(e,o){let r={from:[Math.floor(Math.min(e[0],o[0])),Math.floor(Math.min(e[1],o[1]))],to:[Math.ceil(Math.max(e[0],o[0])),Math.ceil(Math.max(e[1],o[1]))]};return w(y("rect"),{x:r.from[0],y:r.from[1],width:r.to[0]-r.from[0],height:r.to[1]-r.from[1],fill:"none",stroke:"none"})}function je(e,o,r=!0){let n=Math.atan2(o[1]-e[1],o[0]-e[0])+Math.PI;return r?(Math.round(n*8/Math.PI)+16)%16:n}function jr(e,o){return Math.sqrt([e[0]-o[0],e[1]-o[1]].reduce((r,n)=>r+n*n,0))}function $o(e,o,r){let n=jr(e,o),t=je(e,o,!1);if(r&&(n-=33/64,r.size>1)){n-=10/64;let i=je(e,o);(r.has((i+1)%16)||r.has((i+15)%16))&&i&1&&(n-=.4)}return[e[0]-Math.cos(t)*n,e[1]-Math.sin(t)*n].map(i=>i+.5)}function Io(e,o){e.innerHTML="",e.classList.add("cg-wrap");for(let l of _e)e.classList.toggle("orientation-"+l,o.orientation===l);e.classList.toggle("manipulable",!o.viewOnly);let r=C("cg-container");e.appendChild(r);let n=C("cg-board");r.appendChild(n);let t,i,a;if(o.drawable.visible&&(t=w(y("svg"),{class:"cg-shapes",viewBox:"-4 -4 8 8",preserveAspectRatio:"xMidYMid slice"}),t.appendChild(Fo()),t.appendChild(y("g")),i=w(y("svg"),{class:"cg-custom-svgs",viewBox:"-3.5 -3.5 8 8",preserveAspectRatio:"xMidYMid slice"}),i.appendChild(y("g")),a=C("cg-auto-pieces"),r.appendChild(t),r.appendChild(i),r.appendChild(a)),o.coordinates){let l=o.orientation==="black"?" black":"",s=o.ranksPosition==="left"?" left":"";if(o.coordinatesOnSquares){let p=o.orientation==="white"?d=>d+1:d=>8-d;F.forEach((d,u)=>r.appendChild(Ue(I.map(b=>d+b),"squares rank"+p(u)+l+s)))}else r.appendChild(Ue(I,"ranks"+l+s)),r.appendChild(Ue(F,"files"+l))}let c;return o.draggable.enabled&&o.draggable.showGhost&&(c=C("piece","ghost"),Y(c,!1),r.appendChild(c)),{board:n,container:r,wrap:e,ghost:c,svg:t,customSvg:i,autoPieces:a}}function Ue(e,o){let r=C("coords",o),n;for(let t of e)n=C("coord"),n.textContent=t,r.appendChild(n);return r}function jo(e,o){if(!e.dropmode.active)return;x(e),E(e);let r=e.dropmode.piece;if(r){e.pieces.set("a0",r);let n=T(o),t=n&&A(n,v(e),e.dom.bounds());t&&he(e,"a0",t)}e.dom.redraw()}function Zo(e,o){let r=e.dom.elements.board;if("ResizeObserver"in window&&new ResizeObserver(o).observe(e.dom.elements.wrap),(e.disableContextMenu||e.drawable.enabled)&&r.addEventListener("contextmenu",t=>t.preventDefault()),e.viewOnly)return;let n=Zr(e);r.addEventListener("touchstart",n,{passive:!1}),r.addEventListener("mousedown",n,{passive:!1})}function Xo(e,o){let r=[];if("ResizeObserver"in window||r.push(ne(document.body,"chessground.resize",o)),!e.viewOnly){let n=Uo(e,Eo,Mo),t=Uo(e,Ao,ko);for(let a of["touchmove","mousemove"])r.push(ne(document,a,n));for(let a of["touchend","mouseup"])r.push(ne(document,a,t));let i=()=>e.dom.bounds.clear();r.push(ne(document,"scroll",i,{capture:!0,passive:!0})),r.push(ne(window,"resize",i,{passive:!0}))}return()=>r.forEach(n=>n())}function ne(e,o,r,n){return e.addEventListener(o,r,n),()=>e.removeEventListener(o,r,n)}var Zr=e=>o=>{e.draggable.current?W(e):e.drawable.current?ze(e):o.shiftKey||le(o)?e.drawable.enabled&&wo(e,o):e.viewOnly||(e.dropmode.active?jo(e,o):Ko(e,o))},Uo=(e,o,r)=>n=>{e.drawable.current?e.drawable.enabled&&r(e,n):e.viewOnly||o(e,n)};function _o(e){let o=v(e),r=L(e.dom.bounds()),n=e.dom.elements.board,t=e.pieces,i=e.animation.current,a=i?i.plan.anims:new Map,c=i?i.plan.fadings:new Map,l=e.draggable.current,s=Yr(e),p=new Set,d=new Set,u=new Map,b=new Map,S,g,z,$,D,Z,ke,N,Ce,ie;for(g=n.firstChild;g;){if(S=g.cgKey,Jo(g))if(z=t.get(S),D=a.get(S),Z=c.get(S),$=g.cgPiece,g.cgDragging&&(!l||l.orig!==S)&&(g.classList.remove("dragging"),k(g,r(f(S),o)),g.cgDragging=!1),!Z&&g.cgFading&&(g.cgFading=!1,g.classList.remove("fading")),z){if(D&&g.cgAnimating&&$===te(z)){let h=f(S);h[0]+=D[2],h[1]+=D[3],g.classList.add("anim"),k(g,r(h,o))}else g.cgAnimating&&(g.cgAnimating=!1,g.classList.remove("anim"),k(g,r(f(S),o)),e.addPieceZIndex&&(g.style.zIndex=Ze(f(S),o)));$===te(z)&&(!Z||!g.cgFading)?p.add(S):Z&&$===te(Z)?(g.classList.add("fading"),g.cgFading=!0):Xe(u,$,g)}else Xe(u,$,g);else if(er(g)){let h=g.className;s.get(S)===h?d.add(S):Xe(b,h,g)}g=g.nextSibling}for(let[h,X]of s)if(!d.has(h)){Ce=b.get(X),ie=Ce&&Ce.pop();let H=r(f(h),o);if(ie)ie.cgKey=h,k(ie,H);else{let q=C("square",X);q.cgKey=h,k(q,H),n.insertBefore(q,n.firstChild)}}for(let[h,X]of t)if(D=a.get(h),!p.has(h))if(ke=u.get(te(X)),N=ke&&ke.pop(),N){N.cgKey=h,N.cgFading&&(N.classList.remove("fading"),N.cgFading=!1);let H=f(h);e.addPieceZIndex&&(N.style.zIndex=Ze(H,o)),D&&(N.cgAnimating=!0,N.classList.add("anim"),H[0]+=D[2],H[1]+=D[3]),k(N,r(H,o))}else{let H=te(X),q=C("piece",H),ae=f(h);q.cgPiece=H,q.cgKey=h,D&&(q.cgAnimating=!0,ae[0]+=D[2],ae[1]+=D[3]),k(q,r(ae,o)),e.addPieceZIndex&&(q.style.zIndex=Ze(ae,o)),n.appendChild(q)}for(let h of u.values())Yo(e,h);for(let h of b.values())Yo(e,h)}function Qo(e){let o=v(e),r=L(e.dom.bounds()),n=e.dom.elements.board.firstChild;for(;n;)(Jo(n)&&!n.cgAnimating||er(n))&&k(n,r(f(n.cgKey),o)),n=n.nextSibling}function Ye(e){let o=e.dom.elements.wrap.getBoundingClientRect(),r=e.dom.elements.container,n=o.height/o.width,t=Math.floor(o.width*window.devicePixelRatio/8)*8/window.devicePixelRatio,i=t*n;r.style.width=t+"px",r.style.height=i+"px",e.dom.bounds.clear(),e.addDimensionsCssVarsTo?.style.setProperty("---cg-width",t+"px"),e.addDimensionsCssVarsTo?.style.setProperty("---cg-height",i+"px")}var Jo=e=>e.tagName==="PIECE",er=e=>e.tagName==="SQUARE";function Yo(e,o){for(let r of o)e.dom.elements.board.removeChild(r)}function Ze(e,o){let n=e[1];return`${o?10-n:3+n}`}var te=e=>`${e.color} ${e.role}`;function Yr(e){let o=new Map;if(e.lastMove&&e.highlight.lastMove)for(let t of e.lastMove)R(o,t,"last-move");if(e.check&&e.highlight.check&&R(o,e.check,"check"),e.selected&&(R(o,e.selected,"selected"),e.movable.showDests)){let t=e.movable.dests?.get(e.selected);if(t)for(let a of t)R(o,a,"move-dest"+(e.pieces.has(a)?" oc":""));let i=e.premovable.customDests?.get(e.selected)??e.premovable.dests;if(i)for(let a of i)R(o,a,"premove-dest"+(e.pieces.has(a)?" oc":""))}let r=e.premovable.current;if(r)for(let t of r)R(o,t,"current-premove");else e.predroppable.current&&R(o,e.predroppable.current.key,"current-premove");let n=e.exploding;if(n)for(let t of n.keys)R(o,t,"exploding"+n.stage);return e.highlight.custom&&e.highlight.custom.forEach((t,i)=>{R(o,i,t)}),o}function R(e,o,r){let n=e.get(o);n?e.set(o,`${n} ${r}`):e.set(o,r)}function Xe(e,o,r){let n=e.get(o);n?n.push(r):e.set(o,[r])}function or(e,o,r){let n=new Map,t=[];for(let c of e)n.set(c.hash,!1);let i=o.firstElementChild,a;for(;i;)a=i.getAttribute("cgHash"),n.has(a)?n.set(a,!0):t.push(i),i=i.nextElementSibling;for(let c of t)o.removeChild(c);for(let c of e)n.get(c.hash)||o.appendChild(r(c))}function rr(e,o){let n=e.drawable.autoShapes.filter(t=>t.piece).map(t=>({shape:t,hash:Qr(t),current:!1}));or(n,o,t=>_r(e,t,e.dom.bounds()))}function nr(e){let o=v(e),r=L(e.dom.bounds()),n=e.dom.elements.autoPieces?.firstChild;for(;n;)De(n,r(f(n.cgKey),o),n.cgScale),n=n.nextSibling}function _r(e,{shape:o,hash:r},n){let t=o.orig,i=o.piece?.role,a=o.piece?.color,c=o.piece?.scale,l=C("piece",`${i} ${a}`);return l.setAttribute("cgHash",r),l.cgKey=t,l.cgScale=c,De(l,L(n)(f(t),v(e)),c),l}var Qr=e=>[e.orig,e.piece?.role,e.piece?.color,e.piece?.scale].join(",");function Jn({el:e,config:o}){return en(e,o)}function en(e,o){let r=Oo();Se(r,o||{});function n(){let t="dom"in r?r.dom.unbind:void 0,i=Io(e,r),a=eo(()=>i.board.getBoundingClientRect()),c=p=>{_o(s),i.autoPieces&&rr(s,i.autoPieces),!p&&i.svg&&Go(s,i.svg,i.customSvg)},l=()=>{Ye(s),Qo(s),i.autoPieces&&nr(s)},s=r;return s.dom={elements:i,bounds:a,redraw:on(c),redrawNow:c,unbind:t},s.drawable.prevSvgHash="",Ye(s),c(!1),Zo(s,l),t||(s.dom.unbind=Xo(s,l)),s.events.insert&&s.events.insert(i),s}return Bo(n(),n)}function on(e){let o=!1;return()=>{o||(o=!0,requestAnimationFrame(()=>{e(),o=!1}))}}export{en as Chessground,Jn as initModule};
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -9,17 +9,16 @@ export function applyAnimation(state, config) {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export function configure(state, config) {
|
|
12
|
-
var _a, _b, _c;
|
|
13
12
|
// don't merge destinations and autoShapes. Just override.
|
|
14
|
-
if (
|
|
13
|
+
if (config.movable?.dests)
|
|
15
14
|
state.movable.dests = undefined;
|
|
16
|
-
if (
|
|
15
|
+
if (config.drawable?.autoShapes)
|
|
17
16
|
state.drawable.autoShapes = [];
|
|
18
17
|
deepMerge(state, config);
|
|
19
18
|
// if a fen was provided, replace the pieces
|
|
20
19
|
if (config.fen) {
|
|
21
20
|
state.pieces = fenRead(config.fen);
|
|
22
|
-
state.drawable.shapes =
|
|
21
|
+
state.drawable.shapes = config.drawable?.shapes || [];
|
|
23
22
|
}
|
|
24
23
|
// apply config values that could be undefined yet meaningful
|
|
25
24
|
if ('check' in config)
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AA8F3C,MAAM,UAAU,cAAc,CAAC,KAAoB,EAAE,MAAc;IACjE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,oCAAoC;QACpC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,EAAE;YAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;IAC5E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAoB,EAAE,MAAc;IAC5D,0DAA0D;IAC1D,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK;QAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3D,IAAI,MAAM,CAAC,QAAQ,EAAE,UAAU;QAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,GAAG,EAAE,CAAC;IAEhE,SAAS,CAAC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AAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC"}
|
package/dist/drag.js
CHANGED
|
@@ -97,12 +97,11 @@ export function dragNewPiece(s, piece, e, force) {
|
|
|
97
97
|
}
|
|
98
98
|
function processDrag(s) {
|
|
99
99
|
requestAnimationFrame(() => {
|
|
100
|
-
var _a;
|
|
101
100
|
const cur = s.draggable.current;
|
|
102
101
|
if (!cur)
|
|
103
102
|
return;
|
|
104
103
|
// cancel animations while dragging
|
|
105
|
-
if (
|
|
104
|
+
if (s.animation.current?.plan.anims.has(cur.orig))
|
|
106
105
|
s.animation.current = undefined;
|
|
107
106
|
// if moving piece is gone, cancel
|
|
108
107
|
const origPiece = s.pieces.get(cur.orig);
|
package/dist/drag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag.js","sourceRoot":"","sources":["../src/drag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAgBjC,MAAM,UAAU,KAAK,CAAC,CAAQ,EAAE,CAAgB;IAC9C,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,SAAS,CAAC;QAAE,OAAO,CAAC,4CAA4C;IAC5F,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC;QAAE,OAAO,CAAC,2BAA2B;IACjF,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,gCAAgC;IAC/E,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,EAC3B,QAAQ,GAAG,IAAI,CAAC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AAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAQ;IAClC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;IACzB,IAAI,CAAC,CAAC,KAAK;QAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAQ,EAAE,GAAW;IAC9C,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;IACzC,OAAO,EAAE,EAAE,CAAC;QACV,IAAK,EAAmB,CAAC,KAAK,KAAK,GAAG,IAAK,EAAmB,CAAC,OAAO,KAAK,OAAO;YAChF,OAAO,EAAkB,CAAC;QAC5B,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC;IACtB,CAAC;IACD,OAAO;AACT,CAAC"}
|
package/dist/draw.js
CHANGED
|
@@ -65,9 +65,8 @@ export function clear(state) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
function eventBrush(e) {
|
|
68
|
-
var _a;
|
|
69
68
|
const modA = (e.shiftKey || e.ctrlKey) && isRightButton(e);
|
|
70
|
-
const modB = e.altKey || e.metaKey ||
|
|
69
|
+
const modB = e.altKey || e.metaKey || e.getModifierState?.('AltGraph');
|
|
71
70
|
return brushes[(modA ? 1 : 0) + (modB ? 2 : 0)];
|
|
72
71
|
}
|
|
73
72
|
function addShape(drawable, cur) {
|
package/dist/draw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.js","sourceRoot":"","sources":["../src/draw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AA6DzD,MAAM,OAAO,GAAoB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