godash-diagrams 0.0.1 → 0.0.3
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/README.md +14 -0
- package/dist/godash-diagrams.auto.iife.js +4 -0
- package/dist/godash-diagrams.js +1011 -982
- package/dist/godash-diagrams.umd.cjs +3 -3
- package/package.json +10 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(qt,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(qt=typeof globalThis<"u"?globalThis:qt||self,lt(qt.GodashDiagrams={}))})(this,(function(qt){"use strict";var lt="@@__IMMUTABLE_INDEXED__@@";function X(r){return!!(r&&r[lt])}var gr="@@__IMMUTABLE_KEYED__@@";function R(r){return!!(r&&r[gr])}function Ur(r){return R(r)||X(r)}var Si="@@__IMMUTABLE_ITERABLE__@@";function F(r){return!!(r&&r[Si])}var j=function(t){return F(t)?t:D(t)},V=(function(r){function t(e){return R(e)?e:gt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(j),Mt=(function(r){function t(e){return X(e)?e:tt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(j),Ct=(function(r){function t(e){return F(e)&&!Ur(e)?e:jt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(j);j.Keyed=V,j.Indexed=Mt,j.Set=Ct;var $t=0,U=1,H=2,Hr=typeof Symbol=="function"&&Symbol.iterator,wi="@@iterator",mr=Hr||wi,w=function(t){this.next=t};w.prototype.toString=function(){return"[Iterator]"},w.KEYS=$t,w.VALUES=U,w.ENTRIES=H,w.prototype.inspect=w.prototype.toSource=function(){return this.toString()},w.prototype[mr]=function(){return this};function z(r,t,e,n){var i=r===$t?t:r===U?e:[t,e];return n?n.value=i:n={value:i,done:!1},n}function L(){return{value:void 0,done:!0}}function bi(r){return Array.isArray(r)?!0:!!Sr(r)}function Ii(r){return!!(r&&typeof r.next=="function")}function Kr(r){var t=Sr(r);return t&&t.call(r)}function Sr(r){var t=r&&(Hr&&r[Hr]||r[wi]);if(typeof t=="function")return t}function ks(r){var t=Sr(r);return t&&t===r.entries}function Bs(r){var t=Sr(r);return t&&t===r.keys}var Xt="delete",q=5,K=1<<q,P=K-1,S={};function Wr(){return{value:!1}}function Z(r){r&&(r.value=!0)}function Gr(){}function kt(r){return r.size===void 0&&(r.size=r.__iterate(qi)),r.size}function vt(r,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?kt(r)+t:t}function qi(){return!0}function wr(r,t,e){return(r===0&&!Oi(r)||e!==void 0&&r<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Vt(r,t){return Mi(r,t,0)}function br(r,t){return Mi(r,t,t)}function Mi(r,t,e){return r===void 0?e:Oi(r)?t===1/0?t:Math.max(0,t+r)|0:t===void 0||t===r?r:Math.min(t,r)|0}function Oi(r){return r<0||r===0&&1/r===-1/0}var Ei="@@__IMMUTABLE_RECORD__@@";function Ot(r){return!!(r&&r[Ei])}function nt(r){return F(r)||Ot(r)}var yt="@@__IMMUTABLE_ORDERED__@@";function it(r){return!!(r&&r[yt])}var Ti="@@__IMMUTABLE_SEQ__@@";function Yr(r){return!!(r&&r[Ti])}var Bt=Object.prototype.hasOwnProperty;function Ri(r){return Array.isArray(r)||typeof r=="string"?!0:r&&typeof r=="object"&&Number.isInteger(r.length)&&r.length>=0&&(r.length===0?Object.keys(r).length===1:r.hasOwnProperty(r.length-1))}var D=(function(r){function t(e){return e==null?Xr():nt(e)?e.toSeq():xs(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(n,i){var a=this._cache;if(a){for(var o=a.length,s=0;s!==o;){var u=a[i?o-++s:s++];if(n(u[1],u[0],this)===!1)break}return s}return this.__iterateUncached(n,i)},t.prototype.__iterator=function(n,i){var a=this._cache;if(a){var o=a.length,s=0;return new w(function(){if(s===o)return L();var u=a[i?o-++s:s++];return z(n,u[0],u[1])})}return this.__iteratorUncached(n,i)},t})(j),gt=(function(r){function t(e){return e==null?Xr().toKeyedSeq():F(e)?R(e)?e.toSeq():e.fromEntrySeq():Ot(e)?e.toSeq():Vr(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t})(D),tt=(function(r){function t(e){return e==null?Xr():F(e)?R(e)?e.entrySeq():e.toIndexedSeq():Ot(e)?e.toSeq().entrySeq():Ai(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t})(D),jt=(function(r){function t(e){return(F(e)&&!Ur(e)?e:tt(e)).toSetSeq()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t})(D);D.isSeq=Yr,D.Keyed=gt,D.Set=jt,D.Indexed=tt,D.prototype[Ti]=!0;var xt=(function(r){function t(e){this._array=e,this.size=e.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this.has(n)?this._array[vt(this,n)]:i},t.prototype.__iterate=function(n,i){for(var a=this._array,o=a.length,s=0;s!==o;){var u=i?o-++s:s++;if(n(a[u],u,this)===!1)break}return s},t.prototype.__iterator=function(n,i){var a=this._array,o=a.length,s=0;return new w(function(){if(s===o)return L();var u=i?o-++s:s++;return z(n,u,a[u])})},t})(tt),Jr=(function(r){function t(e){var n=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=n,this.size=n.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},t.prototype.has=function(n){return Bt.call(this._object,n)},t.prototype.__iterate=function(n,i){for(var a=this._object,o=this._keys,s=o.length,u=0;u!==s;){var f=o[i?s-++u:u++];if(n(a[f],f,this)===!1)break}return u},t.prototype.__iterator=function(n,i){var a=this._object,o=this._keys,s=o.length,u=0;return new w(function(){if(u===s)return L();var f=o[i?s-++u:u++];return z(n,f,a[f])})},t})(gt);Jr.prototype[yt]=!0;var js=(function(r){function t(e){this._collection=e,this.size=e.length||e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var a=this._collection,o=Kr(a),s=0;if(Ii(o))for(var u;!(u=o.next()).done&&n(u.value,s++,this)!==!1;);return s},t.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var a=this._collection,o=Kr(a);if(!Ii(o))return new w(L);var s=0;return new w(function(){var u=o.next();return u.done?u:z(n,s++,u.value)})},t})(tt),zi;function Xr(){return zi||(zi=new xt([]))}function Vr(r){var t=Zr(r);if(t)return t.fromEntrySeq();if(typeof r=="object")return new Jr(r);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+r)}function Ai(r){var t=Zr(r);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+r)}function xs(r){var t=Zr(r);if(t)return ks(r)?t.fromEntrySeq():Bs(r)?t.toSetSeq():t;if(typeof r=="object")return new Jr(r);throw new TypeError("Expected Array or collection object of values, or keyed object: "+r)}function Zr(r){return Ri(r)?new xt(r):bi(r)?new js(r):void 0}function Zt(){return this.__ensureOwner()}function Qt(){return this.__ownerID?this:this.__ensureOwner(new Gr)}var tr=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var n=t&65535,i=e&65535;return n*i+((t>>>16)*i+n*(e>>>16)<<16>>>0)|0};function Ir(r){return r>>>1&1073741824|r&3221225471}var Ls=Object.prototype.valueOf;function W(r){if(r==null)return Ci(r);if(typeof r.hashCode=="function")return Ir(r.hashCode(r));var t=Hs(r);if(t==null)return Ci(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return Ps(t);case"string":return t.length>Ks?Ns(t):Qr(t);case"object":case"function":return Fs(t);case"symbol":return Ds(t);default:if(typeof t.toString=="function")return Qr(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function Ci(r){return r===null?1108378658:1108378659}function Ps(r){if(r!==r||r===1/0)return 0;var t=r|0;for(t!==r&&(t^=r*4294967295);r>4294967295;)r/=4294967295,t^=r;return Ir(t)}function Ns(r){var t=ie[r];return t===void 0&&(t=Qr(r),ne===Ws&&(ne=0,ie={}),ne++,ie[r]=t),t}function Qr(r){for(var t=0,e=0;e<r.length;e++)t=31*t+r.charCodeAt(e)|0;return Ir(t)}function Ds(r){var t=ji[r];return t!==void 0||(t=Bi(),ji[r]=t),t}function Fs(r){var t;if(te&&(t=re.get(r),t!==void 0)||(t=r[Et],t!==void 0)||!ki&&(t=r.propertyIsEnumerable&&r.propertyIsEnumerable[Et],t!==void 0||(t=Us(r),t!==void 0)))return t;if(t=Bi(),te)re.set(r,t);else{if($i!==void 0&&$i(r)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(ki)Object.defineProperty(r,Et,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(r.propertyIsEnumerable!==void 0&&r.propertyIsEnumerable===r.constructor.prototype.propertyIsEnumerable)r.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},r.propertyIsEnumerable[Et]=t;else if(r.nodeType!==void 0)r[Et]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var $i=Object.isExtensible,ki=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Us(r){if(r&&r.nodeType>0)switch(r.nodeType){case 1:return r.uniqueID;case 9:return r.documentElement&&r.documentElement.uniqueID}}function Hs(r){return r.valueOf!==Ls&&typeof r.valueOf=="function"?r.valueOf(r):r}function Bi(){var r=++ee;return ee&1073741824&&(ee=0),r}var te=typeof WeakMap=="function",re;te&&(re=new WeakMap);var ji=Object.create(null),ee=0,Et="__immutablehash__";typeof Symbol=="function"&&(Et=Symbol(Et));var Ks=16,Ws=255,ne=0,ie={},qr=(function(r){function t(e,n){this._iter=e,this._useKeys=n,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this._iter.get(n,i)},t.prototype.has=function(n){return this._iter.has(n)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var n=this,i=ae(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},t.prototype.map=function(n,i){var a=this,o=Di(this,n,i);return this._useKeys||(o.valueSeq=function(){return a._iter.toSeq().map(n,i)}),o},t.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(o,s){return n(o,s,a)},i)},t.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},t})(gt);qr.prototype[yt]=!0;var xi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.includes=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var a=this,o=0;return i&&kt(this),this._iter.__iterate(function(s){return n(s,i?a.size-++o:o++,a)},i)},t.prototype.__iterator=function(n,i){var a=this,o=this._iter.__iterator(U,i),s=0;return i&&kt(this),new w(function(){var u=o.next();return u.done?u:z(n,i?a.size-++s:s++,u.value,u)})},t})(tt),Li=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.has=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(o){return n(o,o,a)},i)},t.prototype.__iterator=function(n,i){var a=this._iter.__iterator(U,i);return new w(function(){var o=a.next();return o.done?o:z(n,o.value,o.value,o)})},t})(jt),Pi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(n,i){var a=this;return this._iter.__iterate(function(o){if(o){Wi(o);var s=F(o);return n(s?o.get(1):o[1],s?o.get(0):o[0],a)}},i)},t.prototype.__iterator=function(n,i){var a=this._iter.__iterator(U,i);return new w(function(){for(;;){var o=a.next();if(o.done)return o;var s=o.value;if(s){Wi(s);var u=F(s);return z(n,u?s.get(0):s[0],u?s.get(1):s[1],o)}}})},t})(gt);xi.prototype.cacheResult=qr.prototype.cacheResult=Li.prototype.cacheResult=Pi.prototype.cacheResult=ue;function Ni(r){var t=at(r);return t._iter=r,t.size=r.size,t.flip=function(){return r},t.reverse=function(){var e=r.reverse.apply(this);return e.flip=function(){return r.reverse()},e},t.has=function(e){return r.includes(e)},t.includes=function(e){return r.has(e)},t.cacheResult=ue,t.__iterateUncached=function(e,n){var i=this;return r.__iterate(function(a,o){return e(o,a,i)!==!1},n)},t.__iteratorUncached=function(e,n){if(e===H){var i=r.__iterator(e,n);return new w(function(){var a=i.next();if(!a.done){var o=a.value[0];a.value[0]=a.value[1],a.value[1]=o}return a})}return r.__iterator(e===U?$t:U,n)},t}function Di(r,t,e){var n=at(r);return n.size=r.size,n.has=function(i){return r.has(i)},n.get=function(i,a){var o=r.get(i,S);return o===S?a:t.call(e,o,i,r)},n.__iterateUncached=function(i,a){var o=this;return r.__iterate(function(s,u,f){return i(t.call(e,s,u,f),u,o)!==!1},a)},n.__iteratorUncached=function(i,a){var o=r.__iterator(H,a);return new w(function(){var s=o.next();if(s.done)return s;var u=s.value,f=u[0];return z(i,f,t.call(e,u[1],f,r),s)})},n}function ae(r,t){var e=this,n=at(r);return n._iter=r,n.size=r.size,n.reverse=function(){return r},r.flip&&(n.flip=function(){var i=Ni(r);return i.reverse=function(){return r.flip()},i}),n.get=function(i,a){return r.get(t?i:-1-i,a)},n.has=function(i){return r.has(t?i:-1-i)},n.includes=function(i){return r.includes(i)},n.cacheResult=ue,n.__iterate=function(i,a){var o=this,s=0;return a&&kt(r),r.__iterate(function(u,f){return i(u,t?f:a?o.size-++s:s++,o)},!a)},n.__iterator=function(i,a){var o=0;a&&kt(r);var s=r.__iterator(H,!a);return new w(function(){var u=s.next();if(u.done)return u;var f=u.value;return z(i,t?f[0]:a?e.size-++o:o++,f[1],u)})},n}function Fi(r,t,e,n){var i=at(r);return n&&(i.has=function(a){var o=r.get(a,S);return o!==S&&!!t.call(e,o,a,r)},i.get=function(a,o){var s=r.get(a,S);return s!==S&&t.call(e,s,a,r)?s:o}),i.__iterateUncached=function(a,o){var s=this,u=0;return r.__iterate(function(f,c,h){if(t.call(e,f,c,h))return u++,a(f,n?c:u-1,s)},o),u},i.__iteratorUncached=function(a,o){var s=r.__iterator(H,o),u=0;return new w(function(){for(;;){var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];if(t.call(e,p,h,r))return z(a,n?h:u++,p,f)}})},i}function Gs(r,t,e){var n=J().asMutable();return r.__iterate(function(i,a){n.update(t.call(e,i,a,r),0,function(o){return o+1})}),n.asImmutable()}function Ys(r,t,e){var n=R(r),i=(it(r)?_t():J()).asMutable();r.__iterate(function(o,s){i.update(t.call(e,o,s,r),function(u){return u=u||[],u.push(n?[s,o]:o),u})});var a=se(r);return i.map(function(o){return M(r,a(o))}).asImmutable()}function Js(r,t,e){var n=R(r),i=[[],[]];r.__iterate(function(o,s){i[t.call(e,o,s,r)?1:0].push(n?[s,o]:o)});var a=se(r);return i.map(function(o){return M(r,a(o))})}function oe(r,t,e,n){var i=r.size;if(wr(t,e,i))return r;if(typeof i>"u"&&(t<0||e<0))return oe(r.toSeq().cacheResult(),t,e,n);var a=Vt(t,i),o=br(e,i),s=o-a,u;s===s&&(u=s<0?0:s);var f=at(r);return f.size=u===0?u:r.size&&u||void 0,!n&&Yr(r)&&u>=0&&(f.get=function(c,h){return c=vt(this,c),c>=0&&c<u?r.get(c+a,h):h}),f.__iterateUncached=function(c,h){var p=this;if(u===0)return 0;if(h)return this.cacheResult().__iterate(c,h);var _=0,d=!0,v=0;return r.__iterate(function(I,y){if(!(d&&(d=_++<a)))return v++,c(I,n?y:v-1,p)!==!1&&v!==u}),v},f.__iteratorUncached=function(c,h){if(u!==0&&h)return this.cacheResult().__iterator(c,h);if(u===0)return new w(L);var p=r.__iterator(c,h),_=0,d=0;return new w(function(){for(;_++<a;)p.next();if(++d>u)return L();var v=p.next();return n||c===U||v.done?v:c===$t?z(c,d-1,void 0,v):z(c,d-1,v.value[1],v)})},f}function Xs(r,t,e){var n=at(r);return n.__iterateUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterate(i,a);var s=0;return r.__iterate(function(u,f,c){return t.call(e,u,f,c)&&++s&&i(u,f,o)}),s},n.__iteratorUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterator(i,a);var s=r.__iterator(H,a),u=!0;return new w(function(){if(!u)return L();var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];return t.call(e,p,h,o)?i===H?f:z(i,h,p,f):(u=!1,L())})},n}function Ui(r,t,e,n){var i=at(r);return i.__iterateUncached=function(a,o){var s=this;if(o)return this.cacheResult().__iterate(a,o);var u=!0,f=0;return r.__iterate(function(c,h,p){if(!(u&&(u=t.call(e,c,h,p))))return f++,a(c,n?h:f-1,s)}),f},i.__iteratorUncached=function(a,o){var s=this;if(o)return this.cacheResult().__iterator(a,o);var u=r.__iterator(H,o),f=!0,c=0;return new w(function(){var h,p,_;do{if(h=u.next(),h.done)return n||a===U?h:a===$t?z(a,c++,void 0,h):z(a,c++,h.value[1],h);var d=h.value;p=d[0],_=d[1],f&&(f=t.call(e,_,p,s))}while(f);return a===H?h:z(a,p,_,h)})},i}var Vs=(function(r){function t(e){this._wrappedIterables=e.flatMap(function(n){return n._wrappedIterables?n._wrappedIterables:[n]}),this.size=this._wrappedIterables.reduce(function(n,i){if(n!==void 0){var a=i.size;if(a!==void 0)return n+a}},0),this[gr]=this._wrappedIterables[0][gr],this[lt]=this._wrappedIterables[0][lt],this[yt]=this._wrappedIterables[0][yt]}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(n,i);for(var a=0,o=R(this),s=o?H:U,u=this._wrappedIterables[a].__iterator(s,i),f=!0,c=0;f;){for(var h=u.next();h.done;){if(a++,a===this._wrappedIterables.length)return c;u=this._wrappedIterables[a].__iterator(s,i),h=u.next()}var p=o?n(h.value[1],h.value[0],this):n(h.value,c,this);f=p!==!1,c++}return c}},t.prototype.__iteratorUncached=function(n,i){var a=this;if(this._wrappedIterables.length===0)return new w(L);if(i)return this.cacheResult().__iterator(n,i);var o=0,s=this._wrappedIterables[o].__iterator(n,i);return new w(function(){for(var u=s.next();u.done;){if(o++,o===a._wrappedIterables.length)return u;s=a._wrappedIterables[o].__iterator(n,i),u=s.next()}return u})},t})(D);function Zs(r,t){var e=R(r),n=[r].concat(t).map(function(a){return F(a)?e&&(a=V(a)):a=e?Vr(a):Ai(Array.isArray(a)?a:[a]),a}).filter(function(a){return a.size!==0});if(n.length===0)return r;if(n.length===1){var i=n[0];if(i===r||e&&R(i)||X(r)&&X(i))return i}return new Vs(n)}function Hi(r,t,e){var n=at(r);return n.__iterateUncached=function(i,a){if(a)return this.cacheResult().__iterate(i,a);var o=0,s=!1;function u(f,c){f.__iterate(function(h,p){return(!t||c<t)&&F(h)?u(h,c+1):(o++,i(h,e?p:o-1,n)===!1&&(s=!0)),!s},a)}return u(r,0),o},n.__iteratorUncached=function(i,a){if(a)return this.cacheResult().__iterator(i,a);var o=r.__iterator(i,a),s=[],u=0;return new w(function(){for(;o;){var f=o.next();if(f.done!==!1){o=s.pop();continue}var c=f.value;if(i===H&&(c=c[1]),(!t||s.length<t)&&F(c))s.push(o),o=c.__iterator(i,a);else return e?f:z(i,u++,c,f)}return L()})},n}function Qs(r,t,e){var n=se(r);return r.toSeq().map(function(i,a){return n(t.call(e,i,a,r))}).flatten(!0)}function tu(r,t){var e=at(r);return e.size=r.size&&r.size*2-1,e.__iterateUncached=function(n,i){var a=this,o=0;return r.__iterate(function(s){return(!o||n(t,o++,a)!==!1)&&n(s,o++,a)!==!1},i),o},e.__iteratorUncached=function(n,i){var a=r.__iterator(U,i),o=0,s;return new w(function(){return(!s||o%2)&&(s=a.next(),s.done)?s:o%2?z(n,o++,t):z(n,o++,s.value,s)})},e}function Lt(r,t,e){t||(t=Gi);var n=R(r),i=0,a=r.toSeq().map(function(o,s){return[s,o,i++,e?e(o,s,r):o]}).valueSeq().toArray();return a.sort(function(o,s){return t(o[3],s[3])||o[2]-s[2]}).forEach(n?function(o,s){a[s].length=2}:function(o,s){a[s]=o[1]}),n?gt(a):X(r)?tt(a):jt(a)}function Mr(r,t,e){if(t||(t=Gi),e){var n=r.toSeq().map(function(i,a){return[i,e(i,a,r)]}).reduce(function(i,a){return Ki(t,i[1],a[1])?a:i});return n&&n[0]}return r.reduce(function(i,a){return Ki(t,i,a)?a:i})}function Ki(r,t,e){var n=r(e,t);return n===0&&e!==t&&(e==null||e!==e)||n>0}function Or(r,t,e,n){var i=at(r),a=new xt(e).map(function(o){return o.size});return i.size=n?a.max():a.min(),i.__iterate=function(o,s){for(var u=this.__iterator(U,s),f,c=0;!(f=u.next()).done&&o(f.value,c++,this)!==!1;);return c},i.__iteratorUncached=function(o,s){var u=e.map(function(h){return h=j(h),Kr(s?h.reverse():h)}),f=0,c=!1;return new w(function(){var h;return c||(h=u.map(function(p){return p.next()}),c=n?h.every(function(p){return p.done}):h.some(function(p){return p.done})),c?L():z(o,f++,t.apply(null,h.map(function(p){return p.value})))})},i}function M(r,t){return r===t?r:Yr(r)?t:r.constructor(t)}function Wi(r){if(r!==Object(r))throw new TypeError("Expected [K, V] tuple: "+r)}function se(r){return R(r)?V:X(r)?Mt:Ct}function at(r){return Object.create((R(r)?gt:X(r)?tt:jt).prototype)}function ue(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):D.prototype.cacheResult.call(this)}function Gi(r,t){return r===void 0&&t===void 0?0:r===void 0?1:t===void 0?-1:r>t?1:r<t?-1:0}function Yi(r){return!!(r&&typeof r.equals=="function"&&typeof r.hashCode=="function")}function G(r,t){if(r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1;if(typeof r.valueOf=="function"&&typeof t.valueOf=="function"){if(r=r.valueOf(),t=t.valueOf(),r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1}return!!(Yi(r)&&Yi(t)&&r.equals(t))}function Ji(r,t,e,n){return Dt(r,[t],e,n)}function Xi(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return Zi(this,r)}function Vi(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];if(typeof r!="function")throw new TypeError("Invalid merger function: "+r);return Zi(this,t,r)}function Zi(r,t,e){for(var n=[],i=0;i<t.length;i++){var a=V(t[i]);a.size!==0&&n.push(a)}return n.length===0?r:r.toSeq().size===0&&!r.__ownerID&&n.length===1?Ot(r)?r:r.constructor(n[0]):r.withMutations(function(o){for(var s=e?function(f,c){Ji(o,c,S,function(h){return h===S?f:e(h,f,c)})}:function(f,c){o.set(c,f)},u=0;u<n.length;u++)n[u].forEach(s)})}var ru=Object.prototype.toString;function eu(r){if(!r||typeof r!="object"||ru.call(r)!=="[object Object]")return!1;var t=Object.getPrototypeOf(r);if(t===null)return!0;for(var e=t,n=Object.getPrototypeOf(t);n!==null;)e=n,n=Object.getPrototypeOf(e);return e===t}function mt(r){return typeof r=="object"&&(nt(r)||Array.isArray(r)||eu(r))}function ot(r,t){t=t||0;for(var e=Math.max(0,r.length-t),n=new Array(e),i=0;i<e;i++)n[i]=r[i+t];return n}function Er(r){if(Array.isArray(r))return ot(r);var t={};for(var e in r)Bt.call(r,e)&&(t[e]=r[e]);return t}function fe(r,t,e){return ce(r,t,nu(e))}function ce(r,t,e){if(!mt(r))throw new TypeError("Cannot merge into non-data-structure value: "+r);if(nt(r))return typeof e=="function"&&r.mergeWith?r.mergeWith.apply(r,[e].concat(t)):r.merge?r.merge.apply(r,t):r.concat.apply(r,t);for(var n=Array.isArray(r),i=r,a=n?Mt:V,o=n?function(u){i===r&&(i=Er(i)),i.push(u)}:function(u,f){var c=Bt.call(i,f),h=c&&e?e(i[f],u,f):u;(!c||h!==i[f])&&(i===r&&(i=Er(i)),i[f]=h)},s=0;s<t.length;s++)a(t[s]).forEach(o);return i}function nu(r){function t(e,n,i){return mt(e)&&mt(n)&&iu(e,n)?ce(e,[n],t):r?r(e,n,i):n}return t}function iu(r,t){var e=D(r),n=D(t);return X(e)===X(n)&&R(e)===R(n)}function Qi(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return fe(this,r)}function ta(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return fe(this,t,r)}function he(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Dt(this,r,st(),function(n){return fe(n,t)})}function pe(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Dt(this,r,st(),function(n){return ce(n,t)})}function au(r,t,e){return Dt(r,t,S,function(){return e})}function _e(r,t){return au(this,r,t)}function de(r,t,e){return arguments.length===1?r(this):Ji(this,r,t,e)}function le(r,t,e){return Dt(this,r,t,e)}function ve(){return this.__altered}function rr(r){var t=this.asMutable();return r(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}var ra="@@__IMMUTABLE_MAP__@@";function ye(r){return!!(r&&r[ra])}function er(r,t){if(!r)throw new Error(t)}function Y(r){er(r!==1/0,"Cannot perform this action with an infinite size.")}var J=(function(r){function t(e){return e==null?st():ye(e)&&!it(e)?e:st().withMutations(function(n){var i=r(e);Y(i.size),i.forEach(function(a,o){return n.set(o,a)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},t.prototype.set=function(n,i){return ia(this,n,i)},t.prototype.remove=function(n){return ia(this,n,S)},t.prototype.deleteAll=function(n){var i=j(n);return i.size===0?this:this.withMutations(function(a){i.forEach(function(o){return a.remove(o)})})},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):st()},t.prototype.sort=function(n){return _t(Lt(this,n))},t.prototype.sortBy=function(n,i){return _t(Lt(this,i,n))},t.prototype.map=function(n,i){var a=this;return this.withMutations(function(o){o.forEach(function(s,u){o.set(u,n.call(i,s,u,a))})})},t.prototype.__iterator=function(n,i){return new ou(this,n,i)},t.prototype.__iterate=function(n,i){var a=this,o=0;return this._root&&this._root.iterate(function(s){return o++,n(s[1],s[0],a)},i),o},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?me(this.size,this._root,n,this.__hash):this.size===0?st():(this.__ownerID=n,this.__altered=!1,this)},t})(V);J.isMap=ye;var T=J.prototype;T[ra]=!0,T[Xt]=T.remove,T.removeAll=T.deleteAll,T.setIn=_e,T.removeIn=T.deleteIn=be,T.update=de,T.updateIn=le,T.merge=T.concat=Xi,T.mergeWith=Vi,T.mergeDeep=Qi,T.mergeDeepWith=ta,T.mergeIn=pe,T.mergeDeepIn=he,T.withMutations=rr,T.wasAltered=ve,T.asImmutable=Zt,T["@@transducer/init"]=T.asMutable=Qt,T["@@transducer/step"]=function(r,t){return r.set(t[0],t[1])},T["@@transducer/result"]=function(r){return r.asImmutable()};var nr=function(t,e){this.ownerID=t,this.entries=e};nr.prototype.get=function(t,e,n,i){for(var a=this.entries,o=0,s=a.length;o<s;o++)if(G(n,a[o][0]))return a[o][1];return i},nr.prototype.update=function(t,e,n,i,a,o,s){for(var u=a===S,f=this.entries,c=0,h=f.length;c<h&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===a:u)return this;if(Z(s),(u||!p)&&Z(o),!(u&&f.length===1)){if(!p&&!u&&f.length>=pu)return su(t,f,i,a);var _=t&&t===this.ownerID,d=_?f:ot(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,a]:d.push([i,a]),_?(this.entries=d,this):new nr(t,d)}};var Pt=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};Pt.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var a=1<<((t===0?e:e>>>t)&P),o=this.bitmap;return(o&a)===0?i:this.nodes[oa(o&a-1)].get(t+q,e,n,i)},Pt.prototype.update=function(t,e,n,i,a,o,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=1<<u,c=this.bitmap,h=(c&f)!==0;if(!h&&a===S)return this;var p=oa(c&f-1),_=this.nodes,d=h?_[p]:void 0,v=Se(d,t,e+q,n,i,a,o,s);if(v===d)return this;if(!h&&v&&_.length>=_u)return fu(t,_,c,u,v);if(h&&!v&&_.length===2&&aa(_[p^1]))return _[p^1];if(h&&v&&_.length===1&&aa(v))return v;var I=t&&t===this.ownerID,y=h?v?c:c^f:c|f,m=h?v?sa(_,p,v,I):hu(_,p,I):cu(_,p,v,I);return I?(this.bitmap=y,this.nodes=m,this):new Pt(t,y,m)};var ir=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};ir.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var a=(t===0?e:e>>>t)&P,o=this.nodes[a];return o?o.get(t+q,e,n,i):i},ir.prototype.update=function(t,e,n,i,a,o,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=a===S,c=this.nodes,h=c[u];if(f&&!h)return this;var p=Se(h,t,e+q,n,i,a,o,s);if(p===h)return this;var _=this.count;if(!h)_++;else if(!p&&(_--,_<du))return uu(t,c,_,u);var d=t&&t===this.ownerID,v=sa(c,u,p,d);return d?(this.count=_,this.nodes=v,this):new ir(t,_,v)};var Nt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n};Nt.prototype.get=function(t,e,n,i){for(var a=this.entries,o=0,s=a.length;o<s;o++)if(G(n,a[o][0]))return a[o][1];return i},Nt.prototype.update=function(t,e,n,i,a,o,s){n===void 0&&(n=W(i));var u=a===S;if(n!==this.keyHash)return u?this:(Z(s),Z(o),we(this,t,e,n,[i,a]));for(var f=this.entries,c=0,h=f.length;c<h&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===a:u)return this;if(Z(s),(u||!p)&&Z(o),u&&h===2)return new pt(t,this.keyHash,f[c^1]);var _=t&&t===this.ownerID,d=_?f:ot(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,a]:d.push([i,a]),_?(this.entries=d,this):new Nt(t,this.keyHash,d)};var pt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};pt.prototype.get=function(t,e,n,i){return G(n,this.entry[0])?this.entry[1]:i},pt.prototype.update=function(t,e,n,i,a,o,s){var u=a===S,f=G(i,this.entry[0]);if(f?a===this.entry[1]:u)return this;if(Z(s),u){Z(o);return}return f?t&&t===this.ownerID?(this.entry[1]=a,this):new pt(t,this.keyHash,[i,a]):(Z(o),we(this,t,e,W(i),[i,a]))},nr.prototype.iterate=Nt.prototype.iterate=function(r,t){for(var e=this.entries,n=0,i=e.length-1;n<=i;n++)if(r(e[t?i-n:n])===!1)return!1},Pt.prototype.iterate=ir.prototype.iterate=function(r,t){for(var e=this.nodes,n=0,i=e.length-1;n<=i;n++){var a=e[t?i-n:n];if(a&&a.iterate(r,t)===!1)return!1}},pt.prototype.iterate=function(r,t){return r(this.entry)};var ou=(function(r){function t(e,n,i){this._type=n,this._reverse=i,this._stack=e._root&&ea(e._root)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var n=this._type,i=this._stack;i;){var a=i.node,o=i.index++,s=void 0;if(a.entry){if(o===0)return ge(n,a.entry)}else if(a.entries){if(s=a.entries.length-1,o<=s)return ge(n,a.entries[this._reverse?s-o:o])}else if(s=a.nodes.length-1,o<=s){var u=a.nodes[this._reverse?s-o:o];if(u){if(u.entry)return ge(n,u.entry);i=this._stack=ea(u,i)}continue}i=this._stack=this._stack.__prev}return L()},t})(w);function ge(r,t){return z(r,t[0],t[1])}function ea(r,t){return{node:r,index:0,__prev:t}}function me(r,t,e,n){var i=Object.create(T);return i.size=r,i._root=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var na;function st(){return na||(na=me(0))}function ia(r,t,e){var n,i;if(r._root){var a=Wr(),o=Wr();if(n=Se(r._root,r.__ownerID,0,void 0,t,e,a,o),!o.value)return r;i=r.size+(a.value?e===S?-1:1:0)}else{if(e===S)return r;i=1,n=new nr(r.__ownerID,[[t,e]])}return r.__ownerID?(r.size=i,r._root=n,r.__hash=void 0,r.__altered=!0,r):n?me(i,n):st()}function Se(r,t,e,n,i,a,o,s){return r?r.update(t,e,n,i,a,o,s):a===S?r:(Z(s),Z(o),new pt(t,n,[i,a]))}function aa(r){return r.constructor===pt||r.constructor===Nt}function we(r,t,e,n,i){if(r.keyHash===n)return new Nt(t,n,[r.entry,i]);var a=(e===0?r.keyHash:r.keyHash>>>e)&P,o=(e===0?n:n>>>e)&P,s,u=a===o?[we(r,t,e+q,n,i)]:(s=new pt(t,n,i),a<o?[r,s]:[s,r]);return new Pt(t,1<<a|1<<o,u)}function su(r,t,e,n){r||(r=new Gr);for(var i=new pt(r,W(e),[e,n]),a=0;a<t.length;a++){var o=t[a];i=i.update(r,0,void 0,o[0],o[1])}return i}function uu(r,t,e,n){for(var i=0,a=0,o=new Array(e),s=0,u=1,f=t.length;s<f;s++,u<<=1){var c=t[s];c!==void 0&&s!==n&&(i|=u,o[a++]=c)}return new Pt(r,i,o)}function fu(r,t,e,n,i){for(var a=0,o=new Array(K),s=0;e!==0;s++,e>>>=1)o[s]=e&1?t[a++]:void 0;return o[n]=i,new ir(r,a+1,o)}function oa(r){return r-=r>>1&1431655765,r=(r&858993459)+(r>>2&858993459),r=r+(r>>4)&252645135,r+=r>>8,r+=r>>16,r&127}function sa(r,t,e,n){var i=n?r:ot(r);return i[t]=e,i}function cu(r,t,e,n){var i=r.length+1;if(n&&t+1===i)return r[t]=e,r;for(var a=new Array(i),o=0,s=0;s<i;s++)s===t?(a[s]=e,o=-1):a[s]=r[s+o];return a}function hu(r,t,e){var n=r.length-1;if(e&&t===n)return r.pop(),r;for(var i=new Array(n),a=0,o=0;o<n;o++)o===t&&(a=1),i[o]=r[o+a];return i}var pu=K/4,_u=K/2,du=K/4;function ua(r){if(Ri(r)&&typeof r!="string")return r;if(it(r))return r.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+r)}function ar(r){try{return typeof r=="string"?JSON.stringify(r):String(r)}catch{return JSON.stringify(r)}}function lu(r,t){return nt(r)?r.has(t):mt(r)&&Bt.call(r,t)}function fa(r,t,e){return nt(r)?r.get(t,e):lu(r,t)?typeof r.get=="function"?r.get(t):r[t]:e}function vu(r,t){if(!mt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+r);return r.remove(t)}if(!Bt.call(r,t))return r;var e=Er(r);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function yu(r,t,e){if(!mt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.set)throw new TypeError("Cannot update immutable value without .set() method: "+r);return r.set(t,e)}if(Bt.call(r,t)&&e===r[t])return r;var n=Er(r);return n[t]=e,n}function Dt(r,t,e,n){n||(n=e,e=void 0);var i=ca(nt(r),r,ua(t),0,e,n);return i===S?e:i}function ca(r,t,e,n,i,a){var o=t===S;if(n===e.length){var s=o?i:t,u=a(s);return u===s?t:u}if(!o&&!mt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,n).map(ar)+"]: "+t);var f=e[n],c=o?S:fa(t,f,S),h=ca(c===S?r:nt(c),c,e,n+1,i,a);return h===c?t:h===S?vu(t,f):yu(o?r?st():{}:t,f,h)}function gu(r,t){return Dt(r,t,function(){return S})}function be(r){return gu(this,r)}var ha="@@__IMMUTABLE_LIST__@@";function pa(r){return!!(r&&r[ha])}var Tr=(function(r){function t(e){var n=Rr();if(e==null)return n;if(pa(e))return e;var i=r(e),a=i.size;return a===0?n:(Y(a),a>0&&a<K?sr(0,a,q,null,new St(i.toArray())):n.withMutations(function(o){o.setSize(a),i.forEach(function(s,u){return o.set(u,s)})}))}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(n,i){if(n=vt(this,n),n>=0&&n<this.size){n+=this._origin;var a=da(this,n);return a&&a.array[n&P]}return i},t.prototype.set=function(n,i){return mu(this,n,i)},t.prototype.remove=function(n){return this.has(n)?n===0?this.shift():n===this.size-1?this.pop():this.splice(n,1):this},t.prototype.insert=function(n,i){return this.splice(n,0,i)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=q,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Rr()},t.prototype.push=function(){var n=arguments,i=this.size;return this.withMutations(function(a){wt(a,0,i+n.length);for(var o=0;o<n.length;o++)a.set(i+o,n[o])})},t.prototype.pop=function(){return wt(this,0,-1)},t.prototype.unshift=function(){var n=arguments;return this.withMutations(function(i){wt(i,-n.length);for(var a=0;a<n.length;a++)i.set(a,n[a])})},t.prototype.shift=function(){return wt(this,1)},t.prototype.shuffle=function(n){return n===void 0&&(n=Math.random),this.withMutations(function(i){for(var a=i.size,o,s;a;)o=Math.floor(n()*a--),s=i.get(o),i.set(o,i.get(a)),i.set(a,s)})},t.prototype.concat=function(){for(var n=arguments,i=[],a=0;a<arguments.length;a++){var o=n[a],s=r(typeof o!="string"&&bi(o)?o:[o]);s.size!==0&&i.push(s)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(u){i.forEach(function(f){return f.forEach(function(c){return u.push(c)})})})},t.prototype.setSize=function(n){return wt(this,0,n)},t.prototype.map=function(n,i){var a=this;return this.withMutations(function(o){for(var s=0;s<a.size;s++)o.set(s,n.call(i,o.get(s),s,a))})},t.prototype.slice=function(n,i){var a=this.size;return wr(n,i,a)?this:wt(this,Vt(n,a),br(i,a))},t.prototype.__iterator=function(n,i){var a=i?this.size:0,o=_a(this,i);return new w(function(){var s=o();return s===or?L():z(n,i?--a:a++,s)})},t.prototype.__iterate=function(n,i){for(var a=i?this.size:0,o=_a(this,i),s;(s=o())!==or&&n(s,i?--a:a++,this)!==!1;);return a},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?sr(this._origin,this._capacity,this._level,this._root,this._tail,n,this.__hash):this.size===0?Rr():(this.__ownerID=n,this.__altered=!1,this)},t})(Mt);Tr.isList=pa;var C=Tr.prototype;C[ha]=!0,C[Xt]=C.remove,C.merge=C.concat,C.setIn=_e,C.deleteIn=C.removeIn=be,C.update=de,C.updateIn=le,C.mergeIn=pe,C.mergeDeepIn=he,C.withMutations=rr,C.wasAltered=ve,C.asImmutable=Zt,C["@@transducer/init"]=C.asMutable=Qt,C["@@transducer/step"]=function(r,t){return r.push(t)},C["@@transducer/result"]=function(r){return r.asImmutable()};var St=function(t,e){this.array=t,this.ownerID=e};St.prototype.removeBefore=function(t,e,n){if((n&(1<<e+q)-1)===0||this.array.length===0)return this;var i=n>>>e&P;if(i>=this.array.length)return new St([],t);var a=i===0,o;if(e>0){var s=this.array[i];if(o=s&&s.removeBefore(t,e-q,n),o===s&&a)return this}if(a&&!o)return this;var u=Ft(this,t);if(!a)for(var f=0;f<i;f++)u.array[f]=void 0;return o&&(u.array[i]=o),u},St.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+q:K)||this.array.length===0)return this;var i=n-1>>>e&P;if(i>=this.array.length)return this;var a;if(e>0){var o=this.array[i];if(a=o&&o.removeAfter(t,e-q,n),a===o&&i===this.array.length-1)return this}var s=Ft(this,t);return s.array.splice(i+1),a&&(s.array[i]=a),s};var or={};function _a(r,t){var e=r._origin,n=r._capacity,i=ur(n),a=r._tail;return o(r._root,r._level,0);function o(f,c,h){return c===0?s(f,h):u(f,c,h)}function s(f,c){var h=c===i?a&&a.array:f&&f.array,p=c>e?0:e-c,_=n-c;return _>K&&(_=K),function(){if(p===_)return or;var d=t?--_:p++;return h&&h[d]}}function u(f,c,h){var p,_=f&&f.array,d=h>e?0:e-h>>c,v=(n-h>>c)+1;return v>K&&(v=K),function(){for(;;){if(p){var I=p();if(I!==or)return I;p=null}if(d===v)return or;var y=t?--v:d++;p=o(_&&_[y],c-q,h+(y<<c))}}}}function sr(r,t,e,n,i,a,o){var s=Object.create(C);return s.size=t-r,s._origin=r,s._capacity=t,s._level=e,s._root=n,s._tail=i,s.__ownerID=a,s.__hash=o,s.__altered=!1,s}function Rr(){return sr(0,0,q)}function mu(r,t,e){if(t=vt(r,t),t!==t)return r;if(t>=r.size||t<0)return r.withMutations(function(o){t<0?wt(o,t).set(0,e):wt(o,0,t+1).set(t,e)});t+=r._origin;var n=r._tail,i=r._root,a=Wr();return t>=ur(r._capacity)?n=Ie(n,r.__ownerID,0,t,e,a):i=Ie(i,r.__ownerID,r._level,t,e,a),a.value?r.__ownerID?(r._root=i,r._tail=n,r.__hash=void 0,r.__altered=!0,r):sr(r._origin,r._capacity,r._level,i,n):r}function Ie(r,t,e,n,i,a){var o=n>>>e&P,s=r&&o<r.array.length;if(!s&&i===void 0)return r;var u;if(e>0){var f=r&&r.array[o],c=Ie(f,t,e-q,n,i,a);return c===f?r:(u=Ft(r,t),u.array[o]=c,u)}return s&&r.array[o]===i?r:(a&&Z(a),u=Ft(r,t),i===void 0&&o===u.array.length-1?u.array.pop():u.array[o]=i,u)}function Ft(r,t){return t&&r&&t===r.ownerID?r:new St(r?r.array.slice():[],t)}function da(r,t){if(t>=ur(r._capacity))return r._tail;if(t<1<<r._level+q){for(var e=r._root,n=r._level;e&&n>0;)e=e.array[t>>>n&P],n-=q;return e}}function wt(r,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var n=r.__ownerID||new Gr,i=r._origin,a=r._capacity,o=i+t,s=e===void 0?a:e<0?a+e:i+e;if(o===i&&s===a)return r;if(o>=s)return r.clear();for(var u=r._level,f=r._root,c=0;o+c<0;)f=new St(f&&f.array.length?[void 0,f]:[],n),u+=q,c+=1<<u;c&&(o+=c,i+=c,s+=c,a+=c);for(var h=ur(a),p=ur(s);p>=1<<u+q;)f=new St(f&&f.array.length?[f]:[],n),u+=q;var _=r._tail,d=p<h?da(r,s-1):p>h?new St([],n):_;if(_&&p>h&&o<a&&_.array.length){f=Ft(f,n);for(var v=f,I=u;I>q;I-=q){var y=h>>>I&P;v=v.array[y]=Ft(v.array[y],n)}v.array[h>>>q&P]=_}if(s<a&&(d=d&&d.removeAfter(n,0,s)),o>=p)o-=p,s-=p,u=q,f=null,d=d&&d.removeBefore(n,0,o);else if(o>i||p<h){for(c=0;f;){var m=o>>>u&P;if(m!==p>>>u&P)break;m&&(c+=(1<<u)*m),u-=q,f=f.array[m]}f&&o>i&&(f=f.removeBefore(n,u,o-c)),f&&p<h&&(f=f.removeAfter(n,u,p-c)),c&&(o-=c,s-=c)}return r.__ownerID?(r.size=s-o,r._origin=o,r._capacity=s,r._level=u,r._root=f,r._tail=d,r.__hash=void 0,r.__altered=!0,r):sr(o,s,u,f,d)}function ur(r){return r<K?0:r-1>>>q<<q}function la(r){return ye(r)&&it(r)}var _t=(function(r){function t(e){return e==null?fr():la(e)?e:fr().withMutations(function(n){var i=V(e);Y(i.size),i.forEach(function(a,o){return n.set(o,a)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(n,i){var a=this._map.get(n);return a!==void 0?this._list.get(a)[1]:i},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):fr()},t.prototype.set=function(n,i){return ya(this,n,i)},t.prototype.remove=function(n){return ya(this,n,S)},t.prototype.__iterate=function(n,i){var a=this;return this._list.__iterate(function(o){return o&&n(o[1],o[0],a)},i)},t.prototype.__iterator=function(n,i){return this._list.fromEntrySeq().__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n),a=this._list.__ensureOwner(n);return n?qe(i,a,n,this.__hash):this.size===0?fr():(this.__ownerID=n,this.__altered=!1,this._map=i,this._list=a,this)},t})(J);_t.isOrderedMap=la,_t.prototype[yt]=!0,_t.prototype[Xt]=_t.prototype.remove;function qe(r,t,e,n){var i=Object.create(_t.prototype);return i.size=r?r.size:0,i._map=r,i._list=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var va;function fr(){return va||(va=qe(st(),Rr()))}function ya(r,t,e){var n=r._map,i=r._list,a=n.get(t),o=a!==void 0,s,u;if(e===S){if(!o)return r;i.size>=K&&i.size>=n.size*2?(u=i.filter(function(f,c){return f!==void 0&&a!==c}),s=u.toKeyedSeq().map(function(f){return f[0]}).flip().toMap(),r.__ownerID&&(s.__ownerID=u.__ownerID=r.__ownerID)):(s=n.remove(t),u=a===i.size-1?i.pop():i.set(a,void 0))}else if(o){if(e===i.get(a)[1])return r;s=n,u=i.set(a,[t,e])}else s=n.set(t,i.size),u=i.set(i.size,[t,e]);return r.__ownerID?(r.size=s.size,r._map=s,r._list=u,r.__hash=void 0,r.__altered=!0,r):qe(s,u)}var ga="@@__IMMUTABLE_STACK__@@";function Me(r){return!!(r&&r[ga])}var Oe=(function(r){function t(e){return e==null?zr():Me(e)?e:zr().pushAll(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(n,i){var a=this._head;for(n=vt(this,n);a&&n--;)a=a.next;return a?a.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,a=this._head,o=arguments.length-1;o>=0;o--)a={value:n[o],next:a};return this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):cr(i,a)},t.prototype.pushAll=function(n){if(n=r(n),n.size===0)return this;if(this.size===0&&Me(n))return n;Y(n.size);var i=this.size,a=this._head;return n.__iterate(function(o){i++,a={value:o,next:a}},!0),this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):cr(i,a)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):zr()},t.prototype.slice=function(n,i){if(wr(n,i,this.size))return this;var a=Vt(n,this.size),o=br(i,this.size);if(o!==this.size)return r.prototype.slice.call(this,n,i);for(var s=this.size-a,u=this._head;a--;)u=u.next;return this.__ownerID?(this.size=s,this._head=u,this.__hash=void 0,this.__altered=!0,this):cr(s,u)},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?cr(this.size,this._head,n,this.__hash):this.size===0?zr():(this.__ownerID=n,this.__altered=!1,this)},t.prototype.__iterate=function(n,i){var a=this;if(i)return new xt(this.toArray()).__iterate(function(u,f){return n(u,f,a)},i);for(var o=0,s=this._head;s&&n(s.value,o++,this)!==!1;)s=s.next;return o},t.prototype.__iterator=function(n,i){if(i)return new xt(this.toArray()).__iterator(n,i);var a=0,o=this._head;return new w(function(){if(o){var s=o.value;return o=o.next,z(n,a++,s)}return L()})},t})(Mt);Oe.isStack=Me;var N=Oe.prototype;N[ga]=!0,N.shift=N.pop,N.unshift=N.push,N.unshiftAll=N.pushAll,N.withMutations=rr,N.wasAltered=ve,N.asImmutable=Zt,N["@@transducer/init"]=N.asMutable=Qt,N["@@transducer/step"]=function(r,t){return r.unshift(t)},N["@@transducer/result"]=function(r){return r.asImmutable()};function cr(r,t,e,n){var i=Object.create(N);return i.size=r,i._head=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var ma;function zr(){return ma||(ma=cr(0))}function Sa(r,t,e,n,i,a){return Y(r.size),r.__iterate(function(o,s,u){i?(i=!1,e=o):e=t.call(n,e,o,s,u)},a),e}function Su(r,t){return t}function wu(r,t){return[t,r]}function Ee(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return!r.apply(this,t)}}function wa(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return-r.apply(this,t)}}function ba(r,t){return r<t?1:r>t?-1:0}function Ia(r,t){if(r===t)return!0;if(!F(t)||r.size!==void 0&&t.size!==void 0&&r.size!==t.size||r.__hash!==void 0&&t.__hash!==void 0&&r.__hash!==t.__hash||R(r)!==R(t)||X(r)!==X(t)||it(r)!==it(t))return!1;if(r.size===0&&t.size===0)return!0;var e=!Ur(r);if(it(r)){var n=r.entries();return t.every(function(u,f){var c=n.next().value;return c&&G(c[1],u)&&(e||G(c[0],f))})&&n.next().done}var i=!1;if(r.size===void 0)if(t.size===void 0)typeof r.cacheResult=="function"&&r.cacheResult();else{i=!0;var a=r;r=t,t=a}var o=!0,s=t.__iterate(function(u,f){if(e?!r.has(u):i?!G(u,r.get(f,S)):!G(r.get(f,S),u))return o=!1,!1});return o&&r.size===s}var bu=(function(r){function t(e,n,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,n,i);if(er(i!==0,"Cannot step a Range by 0"),er(e!==void 0,"You must define a start value when using Range"),er(n!==void 0,"You must define an end value when using Range"),i=Math.abs(i),n<e&&(i=-i),this._start=e,this._end=n,this._step=i,this.size=Math.max(0,Math.ceil((n-e)/i-1)+1),this.size===0){if(Te)return Te;Te=this}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},t.prototype.get=function(n,i){return this.has(n)?this._start+vt(this,n)*this._step:i},t.prototype.includes=function(n){var i=(n-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},t.prototype.slice=function(n,i){return wr(n,i,this.size)?this:(n=Vt(n,this.size),i=br(i,this.size),i<=n?new t(0,0):new t(this.get(n,this._end),this.get(i,this._end),this._step))},t.prototype.indexOf=function(n){var i=n-this._start;if(i%this._step===0){var a=i/this._step;if(a>=0&&a<this.size)return a}return-1},t.prototype.lastIndexOf=function(n){return this.indexOf(n)},t.prototype.__iterate=function(n,i){for(var a=this.size,o=this._step,s=i?this._start+(a-1)*o:this._start,u=0;u!==a&&n(s,i?a-++u:u++,this)!==!1;)s+=i?-o:o;return u},t.prototype.__iterator=function(n,i){var a=this.size,o=this._step,s=i?this._start+(a-1)*o:this._start,u=0;return new w(function(){if(u===a)return L();var f=s;return s+=i?-o:o,z(n,i?a-++u:u++,f)})},t.prototype.equals=function(n){return n instanceof t?this._start===n._start&&this._end===n._end&&this._step===n._step:Ia(this,n)},t})(tt),Te,qa="@@__IMMUTABLE_SET__@@";function Re(r){return!!(r&&r[qa])}var ut=(function(r){function t(e){return e==null?hr():Re(e)&&!it(e)?e:hr().withMutations(function(n){var i=r(e);Y(i.size),i.forEach(function(a){return n.add(a)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(V(n).keySeq())},t.intersect=function(n){return n=j(n).toArray(),n.length?k.intersect.apply(t(n.pop()),n):hr()},t.union=function(n){return n=j(n).toArray(),n.length?k.union.apply(t(n.pop()),n):hr()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return Ar(this,this._map.set(n,n))},t.prototype.remove=function(n){return Ar(this,this._map.remove(n))},t.prototype.clear=function(){return Ar(this,this._map.clear())},t.prototype.map=function(n,i){var a=this,o=!1,s=Ar(this,this._map.mapEntries(function(u){var f=u[1],c=n.call(i,f,f,a);return c!==f&&(o=!0),[c,c]},i));return o?s:this},t.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(a){return a.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(a){for(var o=0;o<n.length;o++)typeof n[o]=="string"?a.add(n[o]):r(n[o]).forEach(function(s){return a.add(s)})})},t.prototype.intersect=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(o){return r(o)});var a=[];return this.forEach(function(o){n.every(function(s){return s.includes(o)})||a.push(o)}),this.withMutations(function(o){a.forEach(function(s){o.remove(s)})})},t.prototype.subtract=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(o){return r(o)});var a=[];return this.forEach(function(o){n.some(function(s){return s.includes(o)})&&a.push(o)}),this.withMutations(function(o){a.forEach(function(s){o.remove(s)})})},t.prototype.sort=function(n){return _r(Lt(this,n))},t.prototype.sortBy=function(n,i){return _r(Lt(this,i,n))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(n,i){var a=this;return this._map.__iterate(function(o){return n(o,o,a)},i)},t.prototype.__iterator=function(n,i){return this._map.__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n);return n?this.__make(i,n):this.size===0?this.__empty():(this.__ownerID=n,this._map=i,this)},t})(Ct);ut.isSet=Re;var k=ut.prototype;k[qa]=!0,k[Xt]=k.remove,k.merge=k.concat=k.union,k.withMutations=rr,k.asImmutable=Zt,k["@@transducer/init"]=k.asMutable=Qt,k["@@transducer/step"]=function(r,t){return r.add(t)},k["@@transducer/result"]=function(r){return r.asImmutable()},k.__empty=hr,k.__make=Ma;function Ar(r,t){return r.__ownerID?(r.size=t.size,r._map=t,r):t===r._map?r:t.size===0?r.__empty():r.__make(t)}function Ma(r,t){var e=Object.create(k);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var Oa;function hr(){return Oa||(Oa=Ma(st()))}function Ea(r,t,e){for(var n=ua(t),i=0;i!==n.length;)if(r=fa(r,n[i++],S),r===S)return e;return r}function Ta(r,t){return Ea(this,r,t)}function Iu(r,t){return Ea(r,t,S)!==S}function qu(r){return Iu(this,r)}function Ra(){Y(this.size);var r={};return this.__iterate(function(t,e){r[e]=t}),r}function Cr(r){if(!r||typeof r!="object")return r;if(!F(r)){if(!mt(r))return r;r=D(r)}if(R(r)){var t={};return r.__iterate(function(n,i){t[i]=Cr(n)}),t}var e=[];return r.__iterate(function(n){e.push(Cr(n))}),e}function Mu(r){if(r.size===1/0)return 0;var t=it(r),e=R(r),n=t?1:0;return r.__iterate(e?t?function(i,a){n=31*n+za(W(i),W(a))|0}:function(i,a){n=n+za(W(i),W(a))|0}:t?function(i){n=31*n+W(i)|0}:function(i){n=n+W(i)|0}),Ou(r.size,n)}function Ou(r,t){return t=tr(t,3432918353),t=tr(t<<15|t>>>-15,461845907),t=tr(t<<13|t>>>-13,5),t=(t+3864292196|0)^r,t=tr(t^t>>>16,2246822507),t=tr(t^t>>>13,3266489909),t=Ir(t^t>>>16),t}function za(r,t){return r^t+2654435769+(r<<6)+(r>>2)|0}function Tt(r,t){var e=function(n){r.prototype[n]=t[n]};return Object.keys(t).forEach(e),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(e),r}j.Iterator=w,Tt(j,{toArray:function(){Y(this.size);var t=new Array(this.size||0),e=R(this),n=0;return this.__iterate(function(i,a){t[n++]=e?[a,i]:i}),t},toIndexedSeq:function(){return new xi(this)},toJS:function(){return Cr(this)},toKeyedSeq:function(){return new qr(this,!0)},toMap:function(){return J(this.toKeyedSeq())},toObject:Ra,toOrderedMap:function(){return _t(this.toKeyedSeq())},toOrderedSet:function(){return _r(R(this)?this.valueSeq():this)},toSet:function(){return ut(R(this)?this.valueSeq():this)},toSetSeq:function(){return new Li(this)},toSeq:function(){return X(this)?this.toIndexedSeq():R(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Oe(R(this)?this.valueSeq():this)},toList:function(){return Tr(R(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return this.size===0?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return M(this,Zs(this,t))},includes:function(t){return this.some(function(e){return G(e,t)})},entries:function(){return this.__iterator(H)},every:function(t,e){Y(this.size);var n=!0;return this.__iterate(function(i,a,o){if(!t.call(e,i,a,o))return n=!1,!1}),n},filter:function(t,e){return M(this,Fi(this,t,e,!0))},partition:function(t,e){return Js(this,t,e)},find:function(t,e,n){var i=this.findEntry(t,e);return i?i[1]:n},forEach:function(t,e){return Y(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Y(this.size),t=t!==void 0?""+t:",";var e="",n=!0;return this.__iterate(function(i){n?n=!1:e+=t,e+=i!=null?i.toString():""}),e},keys:function(){return this.__iterator($t)},map:function(t,e){return M(this,Di(this,t,e))},reduce:function(t,e,n){return Sa(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return Sa(this,t,e,n,arguments.length<2,!0)},reverse:function(){return M(this,ae(this,!0))},slice:function(t,e){return M(this,oe(this,t,e,!0))},some:function(t,e){Y(this.size);var n=!1;return this.__iterate(function(i,a,o){if(t.call(e,i,a,o))return n=!0,!1}),n},sort:function(t){return M(this,Lt(this,t))},values:function(){return this.__iterator(U)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(t,e){return kt(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return Gs(this,t,e)},equals:function(t){return Ia(this,t)},entrySeq:function(){var t=this;if(t._cache)return new xt(t._cache);var e=t.toSeq().map(wu).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Ee(t),e)},findEntry:function(t,e,n){var i=n;return this.__iterate(function(a,o,s){if(t.call(e,a,o,s))return i=[o,a],!1}),i},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(qi,null,t)},flatMap:function(t,e){return M(this,Qs(this,t,e))},flatten:function(t){return M(this,Hi(this,t,!0))},fromEntrySeq:function(){return new Pi(this)},get:function(t,e){return this.find(function(n,i){return G(i,t)},void 0,e)},getIn:Ta,groupBy:function(t,e){return Ys(this,t,e)},has:function(t){return this.get(t,S)!==S},hasIn:qu,isSubset:function(t){return t=typeof t.includes=="function"?t:j(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:j(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return G(e,t)})},keySeq:function(){return this.toSeq().map(Su).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Mr(this,t)},maxBy:function(t,e){return Mr(this,e,t)},min:function(t){return Mr(this,t?wa(t):ba)},minBy:function(t,e){return Mr(this,e?wa(e):ba,t)},rest:function(){return this.slice(1)},skip:function(t){return t===0?this:this.slice(Math.max(0,t))},skipLast:function(t){return t===0?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return M(this,Ui(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Ee(t),e)},sortBy:function(t,e){return M(this,Lt(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return M(this,Xs(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Ee(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Mu(this))}});var x=j.prototype;x[Si]=!0,x[mr]=x.values,x.toJSON=x.toArray,x.__toStringMapper=ar,x.inspect=x.toSource=function(){return this.toString()},x.chain=x.flatMap,x.contains=x.includes,Tt(V,{flip:function(){return M(this,Ni(this))},mapEntries:function(t,e){var n=this,i=0;return M(this,this.toSeq().map(function(a,o){return t.call(e,[o,a],i++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return M(this,this.toSeq().flip().map(function(i,a){return t.call(e,i,a,n)}).flip())}});var pr=V.prototype;pr[gr]=!0,pr[mr]=x.entries,pr.toJSON=Ra,pr.__toStringMapper=function(r,t){return ar(t)+": "+ar(r)},Tt(Mt,{toKeyedSeq:function(){return new qr(this,!1)},filter:function(t,e){return M(this,Fi(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return e===void 0?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return e===void 0?-1:e},reverse:function(){return M(this,ae(this,!1))},slice:function(t,e){return M(this,oe(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(e||0,0),n===0||n===2&&!e)return this;t=Vt(t,t<0?this.count():this.size);var i=this.slice(0,t);return M(this,n===1?i:i.concat(ot(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return M(this,Hi(this,t,!1))},get:function(t,e){return t=vt(this,t),t<0||this.size===1/0||this.size!==void 0&&t>this.size?e:this.find(function(n,i){return i===t},void 0,e)},has:function(t){return t=vt(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return M(this,tu(this,t))},interleave:function(){var t=[this].concat(ot(arguments)),e=Or(this.toSeq(),tt.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),M(this,n)},keySeq:function(){return bu(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return M(this,Ui(this,t,e,!1))},zip:function(){var t=[this].concat(ot(arguments));return M(this,Or(this,Aa,t))},zipAll:function(){var t=[this].concat(ot(arguments));return M(this,Or(this,Aa,t,!0))},zipWith:function(t){var e=ot(arguments);return e[0]=this,M(this,Or(this,t,e))}});var Ut=Mt.prototype;Ut[lt]=!0,Ut[yt]=!0,Tt(Ct,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Ht=Ct.prototype;Ht.has=x.includes,Ht.contains=Ht.includes,Ht.keys=Ht.values,Tt(gt,pr),Tt(tt,Ut),Tt(jt,Ht);function Aa(){return ot(arguments)}function Ca(r){return Re(r)&&it(r)}var _r=(function(r){function t(e){return e==null?ze():Ca(e)?e:ze().withMutations(function(n){var i=Ct(e);Y(i.size),i.forEach(function(a){return n.add(a)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(V(n).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t})(ut);_r.isOrderedSet=Ca;var Rt=_r.prototype;Rt[yt]=!0,Rt.zip=Ut.zip,Rt.zipWith=Ut.zipWith,Rt.zipAll=Ut.zipAll,Rt.__empty=ze,Rt.__make=$a;function $a(r,t){var e=Object.create(Rt);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var ka;function ze(){return ka||(ka=$a(fr()))}function Eu(r){if(Ot(r))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(nt(r))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(r===null||typeof r!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var A=function(t,e){var n;Eu(t);var i=function(s){var u=this;if(s instanceof i)return s;if(!(this instanceof i))return new i(s);if(!n){n=!0;var f=Object.keys(t),c=a._indices={};a._name=e,a._keys=f,a._defaultValues=t;for(var h=0;h<f.length;h++){var p=f[h];c[p]=h,a[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+Ce(this)+' with property "'+p+'" since that property name is part of the Record API.'):Tu(a,p)}}return this.__ownerID=void 0,this._values=Tr().withMutations(function(_){_.setSize(u._keys.length),V(s).forEach(function(d,v){_.set(u._indices[v],d===u._defaultValues[v]?void 0:d)})}),this},a=i.prototype=Object.create(O);return a.constructor=i,e&&(i.displayName=e),i};A.prototype.toString=function(){for(var t=Ce(this)+" { ",e=this._keys,n,i=0,a=e.length;i!==a;i++)n=e[i],t+=(i?", ":"")+n+": "+ar(this.get(n));return t+" }"},A.prototype.equals=function(t){return this===t||Ot(t)&&Kt(this).equals(Kt(t))},A.prototype.hashCode=function(){return Kt(this).hashCode()},A.prototype.has=function(t){return this._indices.hasOwnProperty(t)},A.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._indices[t],i=this._values.get(n);return i===void 0?this._defaultValues[t]:i},A.prototype.set=function(t,e){if(this.has(t)){var n=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(n!==this._values&&!this.__ownerID)return Ae(this,n)}return this},A.prototype.remove=function(t){return this.set(t)},A.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Ae(this,t)},A.prototype.wasAltered=function(){return this._values.wasAltered()},A.prototype.toSeq=function(){return Kt(this)},A.prototype.toJS=function(){return Cr(this)},A.prototype.entries=function(){return this.__iterator(H)},A.prototype.__iterator=function(t,e){return Kt(this).__iterator(t,e)},A.prototype.__iterate=function(t,e){return Kt(this).__iterate(t,e)},A.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?Ae(this,e,t):(this.__ownerID=t,this._values=e,this)},A.isRecord=Ot,A.getDescriptiveName=Ce;var O=A.prototype;O[Ei]=!0,O[Xt]=O.remove,O.deleteIn=O.removeIn=be,O.getIn=Ta,O.hasIn=x.hasIn,O.merge=Xi,O.mergeWith=Vi,O.mergeIn=pe,O.mergeDeep=Qi,O.mergeDeepWith=ta,O.mergeDeepIn=he,O.setIn=_e,O.update=de,O.updateIn=le,O.withMutations=rr,O.asMutable=Qt,O.asImmutable=Zt,O[mr]=O.entries,O.toJSON=O.toObject=x.toObject,O.inspect=O.toSource=function(){return this.toString()};function Ae(r,t,e){var n=Object.create(Object.getPrototypeOf(r));return n._values=t,n.__ownerID=e,n}function Ce(r){return r.constructor.displayName||r.constructor.name||"Record"}function Kt(r){return Vr(r._keys.map(function(t){return[t,r.get(t)]}))}function Tu(r,t){try{Object.defineProperty(r,t,{get:function(){return this.get(t)},set:function(e){er(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ru(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $e,Ba;function ja(){if(Ba)return $e;Ba=1;function r(t,e){for(var n=-1,i=e.length,a=t.length;++n<i;)t[a+n]=e[n];return t}return $e=r,$e}var ke,xa;function zu(){if(xa)return ke;xa=1;var r=typeof $r=="object"&&$r&&$r.Object===Object&&$r;return ke=r,ke}var Be,La;function je(){if(La)return Be;La=1;var r=zu(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return Be=e,Be}var xe,Pa;function kr(){if(Pa)return xe;Pa=1;var r=je(),t=r.Symbol;return xe=t,xe}var Le,Na;function Au(){if(Na)return Le;Na=1;var r=kr(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function a(o){var s=e.call(o,i),u=o[i];try{o[i]=void 0;var f=!0}catch{}var c=n.call(o);return f&&(s?o[i]=u:delete o[i]),c}return Le=a,Le}var Pe,Da;function Cu(){if(Da)return Pe;Da=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return Pe=e,Pe}var Ne,Fa;function Br(){if(Fa)return Ne;Fa=1;var r=kr(),t=Au(),e=Cu(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):e(s)}return Ne=o,Ne}var De,Ua;function jr(){if(Ua)return De;Ua=1;function r(t){return t!=null&&typeof t=="object"}return De=r,De}var Fe,Ha;function $u(){if(Ha)return Fe;Ha=1;var r=Br(),t=jr(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Fe=n,Fe}var Ue,Ka;function Wa(){if(Ka)return Ue;Ka=1;var r=$u(),t=jr(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,a=r((function(){return arguments})())?r:function(o){return t(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return Ue=a,Ue}var He,Ga;function bt(){if(Ga)return He;Ga=1;var r=Array.isArray;return He=r,He}var Ke,Ya;function ku(){if(Ya)return Ke;Ya=1;var r=kr(),t=Wa(),e=bt(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return Ke=i,Ke}var We,Ja;function Bu(){if(Ja)return We;Ja=1;var r=ja(),t=ku();function e(n,i,a,o,s){var u=-1,f=n.length;for(a||(a=t),s||(s=[]);++u<f;){var c=n[u];i>0&&a(c)?i>1?e(c,i-1,a,o,s):r(s,c):o||(s[s.length]=c)}return s}return We=e,We}var Ge,Xa;function ju(){if(Xa)return Ge;Xa=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return Ge=r,Ge}var Ye,Va;function xu(){if(Va)return Ye;Va=1;var r=ja(),t=Bu(),e=ju(),n=bt();function i(){var a=arguments.length;if(!a)return[];for(var o=Array(a-1),s=arguments[0],u=a;u--;)o[u-1]=arguments[u];return r(n(s)?e(s):[s],t(o,1))}return Ye=i,Ye}xu();var Je,Za;function Lu(){if(Za)return Je;Za=1;function r(t,e){return t!=null&&e in Object(t)}return Je=r,Je}var Xe,Qa;function xr(){if(Qa)return Xe;Qa=1;var r=Br(),t=jr(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Xe=n,Xe}var Ve,to;function Pu(){if(to)return Ve;to=1;var r=bt(),t=xr(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(r(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!e.test(a)||o!=null&&a in Object(o)}return Ve=i,Ve}var Ze,ro;function Qe(){if(ro)return Ze;ro=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Ze=r,Ze}var tn,eo;function Nu(){if(eo)return tn;eo=1;var r=Br(),t=Qe(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=r(s);return u==n||u==i||u==e||u==a}return tn=o,tn}var rn,no;function Du(){if(no)return rn;no=1;var r=je(),t=r["__core-js_shared__"];return rn=t,rn}var en,io;function Fu(){if(io)return en;io=1;var r=Du(),t=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function e(n){return!!t&&t in n}return en=e,en}var nn,ao;function Uu(){if(ao)return nn;ao=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return nn=e,nn}var an,oo;function Hu(){if(oo)return an;oo=1;var r=Nu(),t=Fu(),e=Qe(),n=Uu(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,f=s.hasOwnProperty,c=RegExp("^"+u.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(p){if(!e(p)||t(p))return!1;var _=r(p)?c:a;return _.test(n(p))}return an=h,an}var on,so;function Ku(){if(so)return on;so=1;function r(t,e){return t?.[e]}return on=r,on}var sn,uo;function fo(){if(uo)return sn;uo=1;var r=Hu(),t=Ku();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return sn=e,sn}var un,co;function Lr(){if(co)return un;co=1;var r=fo(),t=r(Object,"create");return un=t,un}var fn,ho;function Wu(){if(ho)return fn;ho=1;var r=Lr();function t(){this.__data__=r?r(null):{},this.size=0}return fn=t,fn}var cn,po;function Gu(){if(po)return cn;po=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return cn=r,cn}var hn,_o;function Yu(){if(_o)return hn;_o=1;var r=Lr(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(a){var o=this.__data__;if(r){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return hn=i,hn}var pn,lo;function Ju(){if(lo)return pn;lo=1;var r=Lr(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return pn=n,pn}var _n,vo;function Xu(){if(vo)return _n;vo=1;var r=Lr(),t="__lodash_hash_undefined__";function e(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?t:i,this}return _n=e,_n}var dn,yo;function Vu(){if(yo)return dn;yo=1;var r=Wu(),t=Gu(),e=Yu(),n=Ju(),i=Xu();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var f=o[s];this.set(f[0],f[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,dn=a,dn}var ln,go;function Zu(){if(go)return ln;go=1;function r(){this.__data__=[],this.size=0}return ln=r,ln}var vn,mo;function Qu(){if(mo)return vn;mo=1;function r(t,e){return t===e||t!==t&&e!==e}return vn=r,vn}var yn,So;function Pr(){if(So)return yn;So=1;var r=Qu();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return yn=t,yn}var gn,wo;function tf(){if(wo)return gn;wo=1;var r=Pr(),t=Array.prototype,e=t.splice;function n(i){var a=this.__data__,o=r(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():e.call(a,o,1),--this.size,!0}return gn=n,gn}var mn,bo;function rf(){if(bo)return mn;bo=1;var r=Pr();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return mn=t,mn}var Sn,Io;function ef(){if(Io)return Sn;Io=1;var r=Pr();function t(e){return r(this.__data__,e)>-1}return Sn=t,Sn}var wn,qo;function nf(){if(qo)return wn;qo=1;var r=Pr();function t(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}return wn=t,wn}var bn,Mo;function af(){if(Mo)return bn;Mo=1;var r=Zu(),t=tf(),e=rf(),n=ef(),i=nf();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var f=o[s];this.set(f[0],f[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,bn=a,bn}var In,Oo;function of(){if(Oo)return In;Oo=1;var r=fo(),t=je(),e=r(t,"Map");return In=e,In}var qn,Eo;function sf(){if(Eo)return qn;Eo=1;var r=Vu(),t=af(),e=of();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return qn=n,qn}var Mn,To;function uf(){if(To)return Mn;To=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Mn=r,Mn}var On,Ro;function Nr(){if(Ro)return On;Ro=1;var r=uf();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return On=t,On}var En,zo;function ff(){if(zo)return En;zo=1;var r=Nr();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return En=t,En}var Tn,Ao;function cf(){if(Ao)return Tn;Ao=1;var r=Nr();function t(e){return r(this,e).get(e)}return Tn=t,Tn}var Rn,Co;function hf(){if(Co)return Rn;Co=1;var r=Nr();function t(e){return r(this,e).has(e)}return Rn=t,Rn}var zn,$o;function pf(){if($o)return zn;$o=1;var r=Nr();function t(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}return zn=t,zn}var An,ko;function _f(){if(ko)return An;ko=1;var r=sf(),t=ff(),e=cf(),n=hf(),i=pf();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var f=o[s];this.set(f[0],f[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,An=a,An}var Cn,Bo;function df(){if(Bo)return Cn;Bo=1;var r=_f(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var f=n.apply(this,o);return a.cache=u.set(s,f)||u,f};return a.cache=new(e.Cache||r),a}return e.Cache=r,Cn=e,Cn}var $n,jo;function lf(){if(jo)return $n;jo=1;var r=df(),t=500;function e(n){var i=r(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return $n=e,$n}var kn,xo;function vf(){if(xo)return kn;xo=1;var r=lf(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,f){a.push(u?f.replace(e,"$1"):s||o)}),a});return kn=n,kn}var Bn,Lo;function yf(){if(Lo)return Bn;Lo=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=e(t[n],n,t);return a}return Bn=r,Bn}var jn,Po;function xn(){if(Po)return jn;Po=1;var r=kr(),t=yf(),e=bt(),n=xr(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(e(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return jn=o,jn}var Ln,No;function Pn(){if(No)return Ln;No=1;var r=xn();function t(e){return e==null?"":r(e)}return Ln=t,Ln}var Nn,Do;function gf(){if(Do)return Nn;Do=1;var r=bt(),t=Pu(),e=vf(),n=Pn();function i(a,o){return r(a)?a:t(a,o)?[a]:e(n(a))}return Nn=i,Nn}var Dn,Fo;function mf(){if(Fo)return Dn;Fo=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var a=typeof n;return i=i??r,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Dn=e,Dn}var Fn,Uo;function Sf(){if(Uo)return Fn;Uo=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Fn=t,Fn}var Un,Ho;function wf(){if(Ho)return Un;Ho=1;var r=xr();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Un=t,Un}var Hn,Ko;function bf(){if(Ko)return Hn;Ko=1;var r=gf(),t=Wa(),e=bt(),n=mf(),i=Sf(),a=wf();function o(s,u,f){u=r(u,s);for(var c=-1,h=u.length,p=!1;++c<h;){var _=a(u[c]);if(!(p=s!=null&&f(s,_)))break;s=s[_]}return p||++c!=h?p:(h=s==null?0:s.length,!!h&&i(h)&&n(_,h)&&(e(s)||t(s)))}return Hn=o,Hn}var Kn,Wo;function If(){if(Wo)return Kn;Wo=1;var r=Lu(),t=bf();function e(n,i){return n!=null&&t(n,i,r)}return Kn=e,Kn}If();var Wn,Go;function qf(){if(Go)return Wn;Go=1;var r=Math.max,t=Math.min;function e(n,i,a){return n>=t(i,a)&&n<r(i,a)}return Wn=e,Wn}var Gn,Yo;function Mf(){if(Yo)return Gn;Yo=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Gn=t,Gn}var Yn,Jo;function Of(){if(Jo)return Yn;Jo=1;var r=Mf(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Yn=e,Yn}var Jn,Xo;function Vo(){if(Xo)return Jn;Xo=1;var r=Of(),t=Qe(),e=xr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(f){if(typeof f=="number")return f;if(e(f))return n;if(t(f)){var c=typeof f.valueOf=="function"?f.valueOf():f;f=t(c)?c+"":c}if(typeof f!="string")return f===0?f:+f;f=r(f);var h=a.test(f);return h||o.test(f)?s(f.slice(2),h?2:8):i.test(f)?n:+f}return Jn=u,Jn}var Xn,Zo;function Qo(){if(Zo)return Xn;Zo=1;var r=Vo(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-t){var a=i<0?-1:1;return a*e}return i===i?i:0}return Xn=n,Xn}var Vn,ts;function Ef(){if(ts)return Vn;ts=1;var r=qf(),t=Qo(),e=Vo();function n(i,a,o){return a=t(a),o===void 0?(o=a,a=0):o=t(o),i=e(i),r(i,a,o)}return Vn=n,Vn}var Tf=Ef();const Rf=Ru(Tf);var Zn,rs;function Qn(){if(rs)return Zn;rs=1;var r=Qo();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Zn=t,Zn}var ti,es;function zf(){if(es)return ti;es=1;var r=Qn();function t(e){return typeof e=="number"&&e==r(e)}return ti=t,ti}zf();var ri,ns;function is(){if(ns)return ri;ns=1;function r(t,e,n){var i=-1,a=t.length;e<0&&(e=-e>a?0:a+e),n=n>a?a:n,n<0&&(n+=a),a=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(a);++i<a;)o[i]=t[i+e];return o}return ri=r,ri}var ei,as;function Af(){if(as)return ei;as=1;var r=is(),t=Qn();function e(n,i,a){return n&&n.length?(i=a||i===void 0?1:t(i),r(n,0,i<0?0:i)):[]}return ei=e,ei}Af();const dr="black",lr="white",rt=null;class os extends A({dimensions:19,moves:J()},"Board"){constructor(t=19,...e){super({dimensions:t,moves:J(e.map(n=>[n.coordinate,n.color]))})}toMap(t=null){const e={[dr]:dr,[lr]:lr,[rt]:rt},n=t||e;return Array(this.dimensions).fill(rt).map((i,a)=>Array(this.dimensions).fill(rt).map((o,s)=>{const u=this.moves.get(et(s,a),rt);return n[u]||e[u]}))}}function ss(...r){return Reflect.construct(os,r)}ss.prototype=os.prototype;class us extends A({x:0,y:0},"Coordinate"){constructor(t,e){super({x:t,y:e})}}function et(...r){return Reflect.construct(us,r)}et.prototype=us.prototype;class fs extends A({coordinate:et(),color:rt},"Move"){constructor(t,e){super({coordinate:t,color:e})}}function cs(...r){return Reflect.construct(fs,r)}cs.prototype=fs.prototype,et(4,4),et(6,6),et(9,9);function Cf(r,t){const{x:e,y:n}=t,i=a=>Rf(a,r.dimensions);return ut.of(et(e,n+1),et(e,n-1),et(e+1,n),et(e-1,n)).filter(a=>i(a.x)&&i(a.y))}function Dr(r,t,e){const n=e===void 0?r.moves.get(t,rt):e;return Cf(r,t).filter(i=>r.moves.get(i,rt)===n)}function hs(r,t){let e=ut(),n=ut.of(t);for(;!n.isEmpty();){const i=n.first(),a=Dr(r,i);e=e.add(i),n=n.rest().union(a.subtract(e))}return e}function ps(r){return r===dr?lr:r===lr?dr:rt}function $f(r,t){return hs(r,t).reduce((e,n)=>e.union(Dr(r,n,rt)),ut())}function ni(r,t){return $f(r,t).size}function _s(r,t){const e=ni(r.setIn(["moves",t.coordinate],t.color),t.coordinate)>0,n=Dr(r,t.coordinate,ps(t.color)).some(i=>ni(r,i)===1);return e||n}function kf(r,t){return r.setIn(["moves"],t.reduce((e,n)=>e.delete(n),r.moves))}function Bf(r,t){if(!_s(r,t))throw new Error("Not a valid position");if(r.moves.has(t.coordinate))throw new Error("There is already a stone there");const e=Dr(r,t.coordinate,ps(t.color)).reduce((n,i)=>n.union(ni(r,i)===1?hs(r,i):ut()),ut());return kf(r,e).setIn(["moves",t.coordinate],t.color)}const It={BLACK:dr,Board:ss,Coordinate:et,EMPTY:rt,Move:cs,WHITE:lr,addMove:Bf,isLegalMove:_s};bt();var ii,ds;function jf(){if(ds)return ii;ds=1;var r=Br(),t=bt(),e=jr(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return ii=i,ii}jf();var ai,ls;function xf(){if(ls)return ai;ls=1;function r(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}return ai=r,ai}var oi,vs;function Lf(){if(vs)return oi;vs=1;var r=xf(),t=xn(),e=Qn(),n=Pn();function i(a,o,s){return a=n(a),s=s==null?0:r(e(s),0,a.length),o=t(o),a.slice(s,s+o.length)==o}return oi=i,oi}Lf();var si,ys;function Pf(){if(ys)return si;ys=1;var r=is();function t(e,n,i){var a=e.length;return i=i===void 0?a:i,!n&&i>=a?e:r(e,n,i)}return si=t,si}var ui,gs;function Nf(){if(gs)return ui;gs=1;function r(t,e,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o<a;)if(e(t[o],o,t))return o;return-1}return ui=r,ui}var fi,ms;function Df(){if(ms)return fi;ms=1;function r(t){return t!==t}return fi=r,fi}var ci,Ss;function Ff(){if(Ss)return ci;Ss=1;function r(t,e,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===e)return i;return-1}return ci=r,ci}var hi,ws;function Uf(){if(ws)return hi;ws=1;var r=Nf(),t=Df(),e=Ff();function n(i,a,o){return a===a?e(i,a,o):r(i,t,o)}return hi=n,hi}var pi,bs;function Hf(){if(bs)return pi;bs=1;var r=Uf();function t(e,n){for(var i=-1,a=e.length;++i<a&&r(n,e[i],0)>-1;);return i}return pi=t,pi}var _i,Is;function Kf(){if(Is)return _i;Is=1;function r(t){return t.split("")}return _i=r,_i}var di,qs;function Wf(){if(qs)return di;qs=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+r+i+a+"]");function u(f){return s.test(f)}return di=u,di}var li,Ms;function Gf(){if(Ms)return li;Ms=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",o="["+r+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",f="(?:"+s+"|"+u+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",d=f+"?",v="["+a+"]?",I="(?:"+_+"(?:"+[c,h,p].join("|")+")"+v+d+")*",y=v+d+I,m="(?:"+[c+s+"?",s,h,p,o].join("|")+")",l=RegExp(u+"(?="+u+")|"+m+y,"g");function g(b){return b.match(l)||[]}return li=g,li}var vi,Os;function Yf(){if(Os)return vi;Os=1;var r=Kf(),t=Wf(),e=Gf();function n(i){return t(i)?e(i):r(i)}return vi=n,vi}var yi,Es;function Jf(){if(Es)return yi;Es=1;var r=xn(),t=Pf(),e=Hf(),n=Yf(),i=Pn(),a=/^\s+/;function o(s,u,f){if(s=i(s),s&&(f||u===void 0))return s.replace(a,"");if(!s||!(u=r(u)))return s;var c=n(s),h=e(c,n(u));return t(c,h).join("")}return yi=o,yi}Jf();const Q=It.BLACK,Ts=It.Board,vr=It.Coordinate,yr=It.EMPTY,zt=It.Move,ft=It.WHITE,Wt=It.addMove,Rs=It.isLegalMove;function Fr(r){return`
|
|
1
|
+
(function(qt,vt){typeof exports=="object"&&typeof module<"u"?vt(exports):typeof define=="function"&&define.amd?define(["exports"],vt):(qt=typeof globalThis<"u"?globalThis:qt||self,vt(qt.GodashDiagrams={}))})(this,(function(qt){"use strict";var vt="@@__IMMUTABLE_INDEXED__@@";function X(r){return!!(r&&r[vt])}var gr="@@__IMMUTABLE_KEYED__@@";function R(r){return!!(r&&r[gr])}function Ur(r){return R(r)||X(r)}var Ii="@@__IMMUTABLE_ITERABLE__@@";function F(r){return!!(r&&r[Ii])}var B=function(t){return F(t)?t:D(t)},V=(function(r){function t(e){return R(e)?e:mt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B),Mt=(function(r){function t(e){return X(e)?e:rt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B),Ct=(function(r){function t(e){return F(e)&&!Ur(e)?e:jt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B);B.Keyed=V,B.Indexed=Mt,B.Set=Ct;var $t=0,U=1,H=2,Hr=typeof Symbol=="function"&&Symbol.iterator,qi="@@iterator",mr=Hr||qi,S=function(t){this.next=t};S.prototype.toString=function(){return"[Iterator]"},S.KEYS=$t,S.VALUES=U,S.ENTRIES=H,S.prototype.inspect=S.prototype.toSource=function(){return this.toString()},S.prototype[mr]=function(){return this};function z(r,t,e,n){var i=r===$t?t:r===U?e:[t,e];return n?n.value=i:n={value:i,done:!1},n}function L(){return{value:void 0,done:!0}}function Mi(r){return Array.isArray(r)?!0:!!Sr(r)}function Oi(r){return!!(r&&typeof r.next=="function")}function Kr(r){var t=Sr(r);return t&&t.call(r)}function Sr(r){var t=r&&(Hr&&r[Hr]||r[qi]);if(typeof t=="function")return t}function ks(r){var t=Sr(r);return t&&t===r.entries}function Bs(r){var t=Sr(r);return t&&t===r.keys}var Xt="delete",M=5,K=1<<M,P=K-1,m={};function Wr(){return{value:!1}}function Z(r){r&&(r.value=!0)}function Gr(){}function kt(r){return r.size===void 0&&(r.size=r.__iterate(Ei)),r.size}function yt(r,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?kt(r)+t:t}function Ei(){return!0}function wr(r,t,e){return(r===0&&!Ri(r)||e!==void 0&&r<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Vt(r,t){return Ti(r,t,0)}function br(r,t){return Ti(r,t,t)}function Ti(r,t,e){return r===void 0?e:Ri(r)?t===1/0?t:Math.max(0,t+r)|0:t===void 0||t===r?r:Math.min(t,r)|0}function Ri(r){return r<0||r===0&&1/r===-1/0}var zi="@@__IMMUTABLE_RECORD__@@";function Ot(r){return!!(r&&r[zi])}function nt(r){return F(r)||Ot(r)}var gt="@@__IMMUTABLE_ORDERED__@@";function it(r){return!!(r&&r[gt])}var Ai="@@__IMMUTABLE_SEQ__@@";function Yr(r){return!!(r&&r[Ai])}var Bt=Object.prototype.hasOwnProperty;function Ci(r){return Array.isArray(r)||typeof r=="string"?!0:r&&typeof r=="object"&&Number.isInteger(r.length)&&r.length>=0&&(r.length===0?Object.keys(r).length===1:r.hasOwnProperty(r.length-1))}var D=(function(r){function t(e){return e==null?Xr():nt(e)?e.toSeq():xs(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(n,i){var o=this._cache;if(o){for(var a=o.length,s=0;s!==a;){var u=o[i?a-++s:s++];if(n(u[1],u[0],this)===!1)break}return s}return this.__iterateUncached(n,i)},t.prototype.__iterator=function(n,i){var o=this._cache;if(o){var a=o.length,s=0;return new S(function(){if(s===a)return L();var u=o[i?a-++s:s++];return z(n,u[0],u[1])})}return this.__iteratorUncached(n,i)},t})(B),mt=(function(r){function t(e){return e==null?Xr().toKeyedSeq():F(e)?R(e)?e.toSeq():e.fromEntrySeq():Ot(e)?e.toSeq():Vr(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t})(D),rt=(function(r){function t(e){return e==null?Xr():F(e)?R(e)?e.entrySeq():e.toIndexedSeq():Ot(e)?e.toSeq().entrySeq():ki(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t})(D),jt=(function(r){function t(e){return(F(e)&&!Ur(e)?e:rt(e)).toSetSeq()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t})(D);D.isSeq=Yr,D.Keyed=mt,D.Set=jt,D.Indexed=rt,D.prototype[Ai]=!0;var xt=(function(r){function t(e){this._array=e,this.size=e.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this.has(n)?this._array[yt(this,n)]:i},t.prototype.__iterate=function(n,i){for(var o=this._array,a=o.length,s=0;s!==a;){var u=i?a-++s:s++;if(n(o[u],u,this)===!1)break}return s},t.prototype.__iterator=function(n,i){var o=this._array,a=o.length,s=0;return new S(function(){if(s===a)return L();var u=i?a-++s:s++;return z(n,u,o[u])})},t})(rt),Jr=(function(r){function t(e){var n=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=n,this.size=n.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},t.prototype.has=function(n){return Bt.call(this._object,n)},t.prototype.__iterate=function(n,i){for(var o=this._object,a=this._keys,s=a.length,u=0;u!==s;){var f=a[i?s-++u:u++];if(n(o[f],f,this)===!1)break}return u},t.prototype.__iterator=function(n,i){var o=this._object,a=this._keys,s=a.length,u=0;return new S(function(){if(u===s)return L();var f=a[i?s-++u:u++];return z(n,f,o[f])})},t})(mt);Jr.prototype[gt]=!0;var js=(function(r){function t(e){this._collection=e,this.size=e.length||e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var o=this._collection,a=Kr(o),s=0;if(Oi(a))for(var u;!(u=a.next()).done&&n(u.value,s++,this)!==!1;);return s},t.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var o=this._collection,a=Kr(o);if(!Oi(a))return new S(L);var s=0;return new S(function(){var u=a.next();return u.done?u:z(n,s++,u.value)})},t})(rt),$i;function Xr(){return $i||($i=new xt([]))}function Vr(r){var t=Zr(r);if(t)return t.fromEntrySeq();if(typeof r=="object")return new Jr(r);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+r)}function ki(r){var t=Zr(r);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+r)}function xs(r){var t=Zr(r);if(t)return ks(r)?t.fromEntrySeq():Bs(r)?t.toSetSeq():t;if(typeof r=="object")return new Jr(r);throw new TypeError("Expected Array or collection object of values, or keyed object: "+r)}function Zr(r){return Ci(r)?new xt(r):Mi(r)?new js(r):void 0}function Zt(){return this.__ensureOwner()}function Qt(){return this.__ownerID?this:this.__ensureOwner(new Gr)}var tr=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var n=t&65535,i=e&65535;return n*i+((t>>>16)*i+n*(e>>>16)<<16>>>0)|0};function Ir(r){return r>>>1&1073741824|r&3221225471}var Ls=Object.prototype.valueOf;function W(r){if(r==null)return Bi(r);if(typeof r.hashCode=="function")return Ir(r.hashCode(r));var t=Hs(r);if(t==null)return Bi(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return Ps(t);case"string":return t.length>Ks?Ns(t):Qr(t);case"object":case"function":return Fs(t);case"symbol":return Ds(t);default:if(typeof t.toString=="function")return Qr(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function Bi(r){return r===null?1108378658:1108378659}function Ps(r){if(r!==r||r===1/0)return 0;var t=r|0;for(t!==r&&(t^=r*4294967295);r>4294967295;)r/=4294967295,t^=r;return Ir(t)}function Ns(r){var t=ie[r];return t===void 0&&(t=Qr(r),ne===Ws&&(ne=0,ie={}),ne++,ie[r]=t),t}function Qr(r){for(var t=0,e=0;e<r.length;e++)t=31*t+r.charCodeAt(e)|0;return Ir(t)}function Ds(r){var t=Pi[r];return t!==void 0||(t=Li(),Pi[r]=t),t}function Fs(r){var t;if(te&&(t=re.get(r),t!==void 0)||(t=r[Et],t!==void 0)||!xi&&(t=r.propertyIsEnumerable&&r.propertyIsEnumerable[Et],t!==void 0||(t=Us(r),t!==void 0)))return t;if(t=Li(),te)re.set(r,t);else{if(ji!==void 0&&ji(r)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(xi)Object.defineProperty(r,Et,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(r.propertyIsEnumerable!==void 0&&r.propertyIsEnumerable===r.constructor.prototype.propertyIsEnumerable)r.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},r.propertyIsEnumerable[Et]=t;else if(r.nodeType!==void 0)r[Et]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var ji=Object.isExtensible,xi=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Us(r){if(r&&r.nodeType>0)switch(r.nodeType){case 1:return r.uniqueID;case 9:return r.documentElement&&r.documentElement.uniqueID}}function Hs(r){return r.valueOf!==Ls&&typeof r.valueOf=="function"?r.valueOf(r):r}function Li(){var r=++ee;return ee&1073741824&&(ee=0),r}var te=typeof WeakMap=="function",re;te&&(re=new WeakMap);var Pi=Object.create(null),ee=0,Et="__immutablehash__";typeof Symbol=="function"&&(Et=Symbol(Et));var Ks=16,Ws=255,ne=0,ie={},qr=(function(r){function t(e,n){this._iter=e,this._useKeys=n,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this._iter.get(n,i)},t.prototype.has=function(n){return this._iter.has(n)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var n=this,i=oe(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},t.prototype.map=function(n,i){var o=this,a=Hi(this,n,i);return this._useKeys||(a.valueSeq=function(){return o._iter.toSeq().map(n,i)}),a},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a,s){return n(a,s,o)},i)},t.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},t})(mt);qr.prototype[gt]=!0;var Ni=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.includes=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this,a=0;return i&&kt(this),this._iter.__iterate(function(s){return n(s,i?o.size-++a:a++,o)},i)},t.prototype.__iterator=function(n,i){var o=this,a=this._iter.__iterator(U,i),s=0;return i&&kt(this),new S(function(){var u=a.next();return u.done?u:z(n,i?o.size-++s:s++,u.value,u)})},t})(rt),Di=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.has=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(U,i);return new S(function(){var a=o.next();return a.done?a:z(n,a.value,a.value,a)})},t})(jt),Fi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){if(a){Ji(a);var s=F(a);return n(s?a.get(1):a[1],s?a.get(0):a[0],o)}},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(U,i);return new S(function(){for(;;){var a=o.next();if(a.done)return a;var s=a.value;if(s){Ji(s);var u=F(s);return z(n,u?s.get(0):s[0],u?s.get(1):s[1],a)}}})},t})(mt);Ni.prototype.cacheResult=qr.prototype.cacheResult=Di.prototype.cacheResult=Fi.prototype.cacheResult=ue;function Ui(r){var t=ot(r);return t._iter=r,t.size=r.size,t.flip=function(){return r},t.reverse=function(){var e=r.reverse.apply(this);return e.flip=function(){return r.reverse()},e},t.has=function(e){return r.includes(e)},t.includes=function(e){return r.has(e)},t.cacheResult=ue,t.__iterateUncached=function(e,n){var i=this;return r.__iterate(function(o,a){return e(a,o,i)!==!1},n)},t.__iteratorUncached=function(e,n){if(e===H){var i=r.__iterator(e,n);return new S(function(){var o=i.next();if(!o.done){var a=o.value[0];o.value[0]=o.value[1],o.value[1]=a}return o})}return r.__iterator(e===U?$t:U,n)},t}function Hi(r,t,e){var n=ot(r);return n.size=r.size,n.has=function(i){return r.has(i)},n.get=function(i,o){var a=r.get(i,m);return a===m?o:t.call(e,a,i,r)},n.__iterateUncached=function(i,o){var a=this;return r.__iterate(function(s,u,f){return i(t.call(e,s,u,f),u,a)!==!1},o)},n.__iteratorUncached=function(i,o){var a=r.__iterator(H,o);return new S(function(){var s=a.next();if(s.done)return s;var u=s.value,f=u[0];return z(i,f,t.call(e,u[1],f,r),s)})},n}function oe(r,t){var e=this,n=ot(r);return n._iter=r,n.size=r.size,n.reverse=function(){return r},r.flip&&(n.flip=function(){var i=Ui(r);return i.reverse=function(){return r.flip()},i}),n.get=function(i,o){return r.get(t?i:-1-i,o)},n.has=function(i){return r.has(t?i:-1-i)},n.includes=function(i){return r.includes(i)},n.cacheResult=ue,n.__iterate=function(i,o){var a=this,s=0;return o&&kt(r),r.__iterate(function(u,f){return i(u,t?f:o?a.size-++s:s++,a)},!o)},n.__iterator=function(i,o){var a=0;o&&kt(r);var s=r.__iterator(H,!o);return new S(function(){var u=s.next();if(u.done)return u;var f=u.value;return z(i,t?f[0]:o?e.size-++a:a++,f[1],u)})},n}function Ki(r,t,e,n){var i=ot(r);return n&&(i.has=function(o){var a=r.get(o,m);return a!==m&&!!t.call(e,a,o,r)},i.get=function(o,a){var s=r.get(o,m);return s!==m&&t.call(e,s,o,r)?s:a}),i.__iterateUncached=function(o,a){var s=this,u=0;return r.__iterate(function(f,c,h){if(t.call(e,f,c,h))return u++,o(f,n?c:u-1,s)},a),u},i.__iteratorUncached=function(o,a){var s=r.__iterator(H,a),u=0;return new S(function(){for(;;){var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];if(t.call(e,p,h,r))return z(o,n?h:u++,p,f)}})},i}function Gs(r,t,e){var n=J().asMutable();return r.__iterate(function(i,o){n.update(t.call(e,i,o,r),0,function(a){return a+1})}),n.asImmutable()}function Ys(r,t,e){var n=R(r),i=(it(r)?_t():J()).asMutable();r.__iterate(function(a,s){i.update(t.call(e,a,s,r),function(u){return u=u||[],u.push(n?[s,a]:a),u})});var o=se(r);return i.map(function(a){return O(r,o(a))}).asImmutable()}function Js(r,t,e){var n=R(r),i=[[],[]];r.__iterate(function(a,s){i[t.call(e,a,s,r)?1:0].push(n?[s,a]:a)});var o=se(r);return i.map(function(a){return O(r,o(a))})}function ae(r,t,e,n){var i=r.size;if(wr(t,e,i))return r;if(typeof i>"u"&&(t<0||e<0))return ae(r.toSeq().cacheResult(),t,e,n);var o=Vt(t,i),a=br(e,i),s=a-o,u;s===s&&(u=s<0?0:s);var f=ot(r);return f.size=u===0?u:r.size&&u||void 0,!n&&Yr(r)&&u>=0&&(f.get=function(c,h){return c=yt(this,c),c>=0&&c<u?r.get(c+o,h):h}),f.__iterateUncached=function(c,h){var p=this;if(u===0)return 0;if(h)return this.cacheResult().__iterate(c,h);var _=0,d=!0,v=0;return r.__iterate(function(w,I){if(!(d&&(d=_++<o)))return v++,c(w,n?I:v-1,p)!==!1&&v!==u}),v},f.__iteratorUncached=function(c,h){if(u!==0&&h)return this.cacheResult().__iterator(c,h);if(u===0)return new S(L);var p=r.__iterator(c,h),_=0,d=0;return new S(function(){for(;_++<o;)p.next();if(++d>u)return L();var v=p.next();return n||c===U||v.done?v:c===$t?z(c,d-1,void 0,v):z(c,d-1,v.value[1],v)})},f}function Xs(r,t,e){var n=ot(r);return n.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=0;return r.__iterate(function(u,f,c){return t.call(e,u,f,c)&&++s&&i(u,f,a)}),s},n.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=r.__iterator(H,o),u=!0;return new S(function(){if(!u)return L();var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];return t.call(e,p,h,a)?i===H?f:z(i,h,p,f):(u=!1,L())})},n}function Wi(r,t,e,n){var i=ot(r);return i.__iterateUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterate(o,a);var u=!0,f=0;return r.__iterate(function(c,h,p){if(!(u&&(u=t.call(e,c,h,p))))return f++,o(c,n?h:f-1,s)}),f},i.__iteratorUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterator(o,a);var u=r.__iterator(H,a),f=!0,c=0;return new S(function(){var h,p,_;do{if(h=u.next(),h.done)return n||o===U?h:o===$t?z(o,c++,void 0,h):z(o,c++,h.value[1],h);var d=h.value;p=d[0],_=d[1],f&&(f=t.call(e,_,p,s))}while(f);return o===H?h:z(o,p,_,h)})},i}var Vs=(function(r){function t(e){this._wrappedIterables=e.flatMap(function(n){return n._wrappedIterables?n._wrappedIterables:[n]}),this.size=this._wrappedIterables.reduce(function(n,i){if(n!==void 0){var o=i.size;if(o!==void 0)return n+o}},0),this[gr]=this._wrappedIterables[0][gr],this[vt]=this._wrappedIterables[0][vt],this[gt]=this._wrappedIterables[0][gt]}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(n,i);for(var o=0,a=R(this),s=a?H:U,u=this._wrappedIterables[o].__iterator(s,i),f=!0,c=0;f;){for(var h=u.next();h.done;){if(o++,o===this._wrappedIterables.length)return c;u=this._wrappedIterables[o].__iterator(s,i),h=u.next()}var p=a?n(h.value[1],h.value[0],this):n(h.value,c,this);f=p!==!1,c++}return c}},t.prototype.__iteratorUncached=function(n,i){var o=this;if(this._wrappedIterables.length===0)return new S(L);if(i)return this.cacheResult().__iterator(n,i);var a=0,s=this._wrappedIterables[a].__iterator(n,i);return new S(function(){for(var u=s.next();u.done;){if(a++,a===o._wrappedIterables.length)return u;s=o._wrappedIterables[a].__iterator(n,i),u=s.next()}return u})},t})(D);function Zs(r,t){var e=R(r),n=[r].concat(t).map(function(o){return F(o)?e&&(o=V(o)):o=e?Vr(o):ki(Array.isArray(o)?o:[o]),o}).filter(function(o){return o.size!==0});if(n.length===0)return r;if(n.length===1){var i=n[0];if(i===r||e&&R(i)||X(r)&&X(i))return i}return new Vs(n)}function Gi(r,t,e){var n=ot(r);return n.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var a=0,s=!1;function u(f,c){f.__iterate(function(h,p){return(!t||c<t)&&F(h)?u(h,c+1):(a++,i(h,e?p:a-1,n)===!1&&(s=!0)),!s},o)}return u(r,0),a},n.__iteratorUncached=function(i,o){if(o)return this.cacheResult().__iterator(i,o);var a=r.__iterator(i,o),s=[],u=0;return new S(function(){for(;a;){var f=a.next();if(f.done!==!1){a=s.pop();continue}var c=f.value;if(i===H&&(c=c[1]),(!t||s.length<t)&&F(c))s.push(a),a=c.__iterator(i,o);else return e?f:z(i,u++,c,f)}return L()})},n}function Qs(r,t,e){var n=se(r);return r.toSeq().map(function(i,o){return n(t.call(e,i,o,r))}).flatten(!0)}function tu(r,t){var e=ot(r);return e.size=r.size&&r.size*2-1,e.__iterateUncached=function(n,i){var o=this,a=0;return r.__iterate(function(s){return(!a||n(t,a++,o)!==!1)&&n(s,a++,o)!==!1},i),a},e.__iteratorUncached=function(n,i){var o=r.__iterator(U,i),a=0,s;return new S(function(){return(!s||a%2)&&(s=o.next(),s.done)?s:a%2?z(n,a++,t):z(n,a++,s.value,s)})},e}function Lt(r,t,e){t||(t=Xi);var n=R(r),i=0,o=r.toSeq().map(function(a,s){return[s,a,i++,e?e(a,s,r):a]}).valueSeq().toArray();return o.sort(function(a,s){return t(a[3],s[3])||a[2]-s[2]}).forEach(n?function(a,s){o[s].length=2}:function(a,s){o[s]=a[1]}),n?mt(o):X(r)?rt(o):jt(o)}function Mr(r,t,e){if(t||(t=Xi),e){var n=r.toSeq().map(function(i,o){return[i,e(i,o,r)]}).reduce(function(i,o){return Yi(t,i[1],o[1])?o:i});return n&&n[0]}return r.reduce(function(i,o){return Yi(t,i,o)?o:i})}function Yi(r,t,e){var n=r(e,t);return n===0&&e!==t&&(e==null||e!==e)||n>0}function Or(r,t,e,n){var i=ot(r),o=new xt(e).map(function(a){return a.size});return i.size=n?o.max():o.min(),i.__iterate=function(a,s){for(var u=this.__iterator(U,s),f,c=0;!(f=u.next()).done&&a(f.value,c++,this)!==!1;);return c},i.__iteratorUncached=function(a,s){var u=e.map(function(h){return h=B(h),Kr(s?h.reverse():h)}),f=0,c=!1;return new S(function(){var h;return c||(h=u.map(function(p){return p.next()}),c=n?h.every(function(p){return p.done}):h.some(function(p){return p.done})),c?L():z(a,f++,t.apply(null,h.map(function(p){return p.value})))})},i}function O(r,t){return r===t?r:Yr(r)?t:r.constructor(t)}function Ji(r){if(r!==Object(r))throw new TypeError("Expected [K, V] tuple: "+r)}function se(r){return R(r)?V:X(r)?Mt:Ct}function ot(r){return Object.create((R(r)?mt:X(r)?rt:jt).prototype)}function ue(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):D.prototype.cacheResult.call(this)}function Xi(r,t){return r===void 0&&t===void 0?0:r===void 0?1:t===void 0?-1:r>t?1:r<t?-1:0}function Vi(r){return!!(r&&typeof r.equals=="function"&&typeof r.hashCode=="function")}function G(r,t){if(r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1;if(typeof r.valueOf=="function"&&typeof t.valueOf=="function"){if(r=r.valueOf(),t=t.valueOf(),r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1}return!!(Vi(r)&&Vi(t)&&r.equals(t))}function Zi(r,t,e,n){return Dt(r,[t],e,n)}function Qi(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return ro(this,r)}function to(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];if(typeof r!="function")throw new TypeError("Invalid merger function: "+r);return ro(this,t,r)}function ro(r,t,e){for(var n=[],i=0;i<t.length;i++){var o=V(t[i]);o.size!==0&&n.push(o)}return n.length===0?r:r.toSeq().size===0&&!r.__ownerID&&n.length===1?Ot(r)?r:r.constructor(n[0]):r.withMutations(function(a){for(var s=e?function(f,c){Zi(a,c,m,function(h){return h===m?f:e(h,f,c)})}:function(f,c){a.set(c,f)},u=0;u<n.length;u++)n[u].forEach(s)})}var ru=Object.prototype.toString;function eu(r){if(!r||typeof r!="object"||ru.call(r)!=="[object Object]")return!1;var t=Object.getPrototypeOf(r);if(t===null)return!0;for(var e=t,n=Object.getPrototypeOf(t);n!==null;)e=n,n=Object.getPrototypeOf(e);return e===t}function St(r){return typeof r=="object"&&(nt(r)||Array.isArray(r)||eu(r))}function at(r,t){t=t||0;for(var e=Math.max(0,r.length-t),n=new Array(e),i=0;i<e;i++)n[i]=r[i+t];return n}function Er(r){if(Array.isArray(r))return at(r);var t={};for(var e in r)Bt.call(r,e)&&(t[e]=r[e]);return t}function fe(r,t,e){return ce(r,t,nu(e))}function ce(r,t,e){if(!St(r))throw new TypeError("Cannot merge into non-data-structure value: "+r);if(nt(r))return typeof e=="function"&&r.mergeWith?r.mergeWith.apply(r,[e].concat(t)):r.merge?r.merge.apply(r,t):r.concat.apply(r,t);for(var n=Array.isArray(r),i=r,o=n?Mt:V,a=n?function(u){i===r&&(i=Er(i)),i.push(u)}:function(u,f){var c=Bt.call(i,f),h=c&&e?e(i[f],u,f):u;(!c||h!==i[f])&&(i===r&&(i=Er(i)),i[f]=h)},s=0;s<t.length;s++)o(t[s]).forEach(a);return i}function nu(r){function t(e,n,i){return St(e)&&St(n)&&iu(e,n)?ce(e,[n],t):r?r(e,n,i):n}return t}function iu(r,t){var e=D(r),n=D(t);return X(e)===X(n)&&R(e)===R(n)}function eo(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return fe(this,r)}function no(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return fe(this,t,r)}function he(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Dt(this,r,st(),function(n){return fe(n,t)})}function pe(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Dt(this,r,st(),function(n){return ce(n,t)})}function ou(r,t,e){return Dt(r,t,m,function(){return e})}function _e(r,t){return ou(this,r,t)}function de(r,t,e){return arguments.length===1?r(this):Zi(this,r,t,e)}function le(r,t,e){return Dt(this,r,t,e)}function ve(){return this.__altered}function rr(r){var t=this.asMutable();return r(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}var io="@@__IMMUTABLE_MAP__@@";function ye(r){return!!(r&&r[io])}function er(r,t){if(!r)throw new Error(t)}function Y(r){er(r!==1/0,"Cannot perform this action with an infinite size.")}var J=(function(r){function t(e){return e==null?st():ye(e)&&!it(e)?e:st().withMutations(function(n){var i=r(e);Y(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},t.prototype.set=function(n,i){return so(this,n,i)},t.prototype.remove=function(n){return so(this,n,m)},t.prototype.deleteAll=function(n){var i=B(n);return i.size===0?this:this.withMutations(function(o){i.forEach(function(a){return o.remove(a)})})},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):st()},t.prototype.sort=function(n){return _t(Lt(this,n))},t.prototype.sortBy=function(n,i){return _t(Lt(this,i,n))},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){a.forEach(function(s,u){a.set(u,n.call(i,s,u,o))})})},t.prototype.__iterator=function(n,i){return new au(this,n,i)},t.prototype.__iterate=function(n,i){var o=this,a=0;return this._root&&this._root.iterate(function(s){return a++,n(s[1],s[0],o)},i),a},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?me(this.size,this._root,n,this.__hash):this.size===0?st():(this.__ownerID=n,this.__altered=!1,this)},t})(V);J.isMap=ye;var T=J.prototype;T[io]=!0,T[Xt]=T.remove,T.removeAll=T.deleteAll,T.setIn=_e,T.removeIn=T.deleteIn=be,T.update=de,T.updateIn=le,T.merge=T.concat=Qi,T.mergeWith=to,T.mergeDeep=eo,T.mergeDeepWith=no,T.mergeIn=pe,T.mergeDeepIn=he,T.withMutations=rr,T.wasAltered=ve,T.asImmutable=Zt,T["@@transducer/init"]=T.asMutable=Qt,T["@@transducer/step"]=function(r,t){return r.set(t[0],t[1])},T["@@transducer/result"]=function(r){return r.asImmutable()};var nr=function(t,e){this.ownerID=t,this.entries=e};nr.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(G(n,o[a][0]))return o[a][1];return i},nr.prototype.update=function(t,e,n,i,o,a,s){for(var u=o===m,f=this.entries,c=0,h=f.length;c<h&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(Z(s),(u||!p)&&Z(a),!(u&&f.length===1)){if(!p&&!u&&f.length>=pu)return su(t,f,i,o);var _=t&&t===this.ownerID,d=_?f:at(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new nr(t,d)}};var Pt=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};Pt.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var o=1<<((t===0?e:e>>>t)&P),a=this.bitmap;return(a&o)===0?i:this.nodes[fo(a&o-1)].get(t+M,e,n,i)},Pt.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=1<<u,c=this.bitmap,h=(c&f)!==0;if(!h&&o===m)return this;var p=fo(c&f-1),_=this.nodes,d=h?_[p]:void 0,v=Se(d,t,e+M,n,i,o,a,s);if(v===d)return this;if(!h&&v&&_.length>=_u)return fu(t,_,c,u,v);if(h&&!v&&_.length===2&&uo(_[p^1]))return _[p^1];if(h&&v&&_.length===1&&uo(v))return v;var w=t&&t===this.ownerID,I=h?v?c:c^f:c|f,y=h?v?co(_,p,v,w):hu(_,p,w):cu(_,p,v,w);return w?(this.bitmap=I,this.nodes=y,this):new Pt(t,I,y)};var ir=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};ir.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var o=(t===0?e:e>>>t)&P,a=this.nodes[o];return a?a.get(t+M,e,n,i):i},ir.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=o===m,c=this.nodes,h=c[u];if(f&&!h)return this;var p=Se(h,t,e+M,n,i,o,a,s);if(p===h)return this;var _=this.count;if(!h)_++;else if(!p&&(_--,_<du))return uu(t,c,_,u);var d=t&&t===this.ownerID,v=co(c,u,p,d);return d?(this.count=_,this.nodes=v,this):new ir(t,_,v)};var Nt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n};Nt.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(G(n,o[a][0]))return o[a][1];return i},Nt.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=o===m;if(n!==this.keyHash)return u?this:(Z(s),Z(a),we(this,t,e,n,[i,o]));for(var f=this.entries,c=0,h=f.length;c<h&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(Z(s),(u||!p)&&Z(a),u&&h===2)return new pt(t,this.keyHash,f[c^1]);var _=t&&t===this.ownerID,d=_?f:at(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new Nt(t,this.keyHash,d)};var pt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};pt.prototype.get=function(t,e,n,i){return G(n,this.entry[0])?this.entry[1]:i},pt.prototype.update=function(t,e,n,i,o,a,s){var u=o===m,f=G(i,this.entry[0]);if(f?o===this.entry[1]:u)return this;if(Z(s),u){Z(a);return}return f?t&&t===this.ownerID?(this.entry[1]=o,this):new pt(t,this.keyHash,[i,o]):(Z(a),we(this,t,e,W(i),[i,o]))},nr.prototype.iterate=Nt.prototype.iterate=function(r,t){for(var e=this.entries,n=0,i=e.length-1;n<=i;n++)if(r(e[t?i-n:n])===!1)return!1},Pt.prototype.iterate=ir.prototype.iterate=function(r,t){for(var e=this.nodes,n=0,i=e.length-1;n<=i;n++){var o=e[t?i-n:n];if(o&&o.iterate(r,t)===!1)return!1}},pt.prototype.iterate=function(r,t){return r(this.entry)};var au=(function(r){function t(e,n,i){this._type=n,this._reverse=i,this._stack=e._root&&oo(e._root)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var n=this._type,i=this._stack;i;){var o=i.node,a=i.index++,s=void 0;if(o.entry){if(a===0)return ge(n,o.entry)}else if(o.entries){if(s=o.entries.length-1,a<=s)return ge(n,o.entries[this._reverse?s-a:a])}else if(s=o.nodes.length-1,a<=s){var u=o.nodes[this._reverse?s-a:a];if(u){if(u.entry)return ge(n,u.entry);i=this._stack=oo(u,i)}continue}i=this._stack=this._stack.__prev}return L()},t})(S);function ge(r,t){return z(r,t[0],t[1])}function oo(r,t){return{node:r,index:0,__prev:t}}function me(r,t,e,n){var i=Object.create(T);return i.size=r,i._root=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var ao;function st(){return ao||(ao=me(0))}function so(r,t,e){var n,i;if(r._root){var o=Wr(),a=Wr();if(n=Se(r._root,r.__ownerID,0,void 0,t,e,o,a),!a.value)return r;i=r.size+(o.value?e===m?-1:1:0)}else{if(e===m)return r;i=1,n=new nr(r.__ownerID,[[t,e]])}return r.__ownerID?(r.size=i,r._root=n,r.__hash=void 0,r.__altered=!0,r):n?me(i,n):st()}function Se(r,t,e,n,i,o,a,s){return r?r.update(t,e,n,i,o,a,s):o===m?r:(Z(s),Z(a),new pt(t,n,[i,o]))}function uo(r){return r.constructor===pt||r.constructor===Nt}function we(r,t,e,n,i){if(r.keyHash===n)return new Nt(t,n,[r.entry,i]);var o=(e===0?r.keyHash:r.keyHash>>>e)&P,a=(e===0?n:n>>>e)&P,s,u=o===a?[we(r,t,e+M,n,i)]:(s=new pt(t,n,i),o<a?[r,s]:[s,r]);return new Pt(t,1<<o|1<<a,u)}function su(r,t,e,n){r||(r=new Gr);for(var i=new pt(r,W(e),[e,n]),o=0;o<t.length;o++){var a=t[o];i=i.update(r,0,void 0,a[0],a[1])}return i}function uu(r,t,e,n){for(var i=0,o=0,a=new Array(e),s=0,u=1,f=t.length;s<f;s++,u<<=1){var c=t[s];c!==void 0&&s!==n&&(i|=u,a[o++]=c)}return new Pt(r,i,a)}function fu(r,t,e,n,i){for(var o=0,a=new Array(K),s=0;e!==0;s++,e>>>=1)a[s]=e&1?t[o++]:void 0;return a[n]=i,new ir(r,o+1,a)}function fo(r){return r-=r>>1&1431655765,r=(r&858993459)+(r>>2&858993459),r=r+(r>>4)&252645135,r+=r>>8,r+=r>>16,r&127}function co(r,t,e,n){var i=n?r:at(r);return i[t]=e,i}function cu(r,t,e,n){var i=r.length+1;if(n&&t+1===i)return r[t]=e,r;for(var o=new Array(i),a=0,s=0;s<i;s++)s===t?(o[s]=e,a=-1):o[s]=r[s+a];return o}function hu(r,t,e){var n=r.length-1;if(e&&t===n)return r.pop(),r;for(var i=new Array(n),o=0,a=0;a<n;a++)a===t&&(o=1),i[a]=r[a+o];return i}var pu=K/4,_u=K/2,du=K/4;function ho(r){if(Ci(r)&&typeof r!="string")return r;if(it(r))return r.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+r)}function or(r){try{return typeof r=="string"?JSON.stringify(r):String(r)}catch{return JSON.stringify(r)}}function lu(r,t){return nt(r)?r.has(t):St(r)&&Bt.call(r,t)}function po(r,t,e){return nt(r)?r.get(t,e):lu(r,t)?typeof r.get=="function"?r.get(t):r[t]:e}function vu(r,t){if(!St(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+r);return r.remove(t)}if(!Bt.call(r,t))return r;var e=Er(r);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function yu(r,t,e){if(!St(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.set)throw new TypeError("Cannot update immutable value without .set() method: "+r);return r.set(t,e)}if(Bt.call(r,t)&&e===r[t])return r;var n=Er(r);return n[t]=e,n}function Dt(r,t,e,n){n||(n=e,e=void 0);var i=_o(nt(r),r,ho(t),0,e,n);return i===m?e:i}function _o(r,t,e,n,i,o){var a=t===m;if(n===e.length){var s=a?i:t,u=o(s);return u===s?t:u}if(!a&&!St(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,n).map(or)+"]: "+t);var f=e[n],c=a?m:po(t,f,m),h=_o(c===m?r:nt(c),c,e,n+1,i,o);return h===c?t:h===m?vu(t,f):yu(a?r?st():{}:t,f,h)}function gu(r,t){return Dt(r,t,function(){return m})}function be(r){return gu(this,r)}var lo="@@__IMMUTABLE_LIST__@@";function vo(r){return!!(r&&r[lo])}var Tr=(function(r){function t(e){var n=Rr();if(e==null)return n;if(vo(e))return e;var i=r(e),o=i.size;return o===0?n:(Y(o),o>0&&o<K?sr(0,o,M,null,new wt(i.toArray())):n.withMutations(function(a){a.setSize(o),i.forEach(function(s,u){return a.set(u,s)})}))}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(n,i){if(n=yt(this,n),n>=0&&n<this.size){n+=this._origin;var o=go(this,n);return o&&o.array[n&P]}return i},t.prototype.set=function(n,i){return mu(this,n,i)},t.prototype.remove=function(n){return this.has(n)?n===0?this.shift():n===this.size-1?this.pop():this.splice(n,1):this},t.prototype.insert=function(n,i){return this.splice(n,0,i)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=M,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Rr()},t.prototype.push=function(){var n=arguments,i=this.size;return this.withMutations(function(o){bt(o,0,i+n.length);for(var a=0;a<n.length;a++)o.set(i+a,n[a])})},t.prototype.pop=function(){return bt(this,0,-1)},t.prototype.unshift=function(){var n=arguments;return this.withMutations(function(i){bt(i,-n.length);for(var o=0;o<n.length;o++)i.set(o,n[o])})},t.prototype.shift=function(){return bt(this,1)},t.prototype.shuffle=function(n){return n===void 0&&(n=Math.random),this.withMutations(function(i){for(var o=i.size,a,s;o;)a=Math.floor(n()*o--),s=i.get(a),i.set(a,i.get(o)),i.set(o,s)})},t.prototype.concat=function(){for(var n=arguments,i=[],o=0;o<arguments.length;o++){var a=n[o],s=r(typeof a!="string"&&Mi(a)?a:[a]);s.size!==0&&i.push(s)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(u){i.forEach(function(f){return f.forEach(function(c){return u.push(c)})})})},t.prototype.setSize=function(n){return bt(this,0,n)},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){for(var s=0;s<o.size;s++)a.set(s,n.call(i,a.get(s),s,o))})},t.prototype.slice=function(n,i){var o=this.size;return wr(n,i,o)?this:bt(this,Vt(n,o),br(i,o))},t.prototype.__iterator=function(n,i){var o=i?this.size:0,a=yo(this,i);return new S(function(){var s=a();return s===ar?L():z(n,i?--o:o++,s)})},t.prototype.__iterate=function(n,i){for(var o=i?this.size:0,a=yo(this,i),s;(s=a())!==ar&&n(s,i?--o:o++,this)!==!1;);return o},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?sr(this._origin,this._capacity,this._level,this._root,this._tail,n,this.__hash):this.size===0?Rr():(this.__ownerID=n,this.__altered=!1,this)},t})(Mt);Tr.isList=vo;var $=Tr.prototype;$[lo]=!0,$[Xt]=$.remove,$.merge=$.concat,$.setIn=_e,$.deleteIn=$.removeIn=be,$.update=de,$.updateIn=le,$.mergeIn=pe,$.mergeDeepIn=he,$.withMutations=rr,$.wasAltered=ve,$.asImmutable=Zt,$["@@transducer/init"]=$.asMutable=Qt,$["@@transducer/step"]=function(r,t){return r.push(t)},$["@@transducer/result"]=function(r){return r.asImmutable()};var wt=function(t,e){this.array=t,this.ownerID=e};wt.prototype.removeBefore=function(t,e,n){if((n&(1<<e+M)-1)===0||this.array.length===0)return this;var i=n>>>e&P;if(i>=this.array.length)return new wt([],t);var o=i===0,a;if(e>0){var s=this.array[i];if(a=s&&s.removeBefore(t,e-M,n),a===s&&o)return this}if(o&&!a)return this;var u=Ft(this,t);if(!o)for(var f=0;f<i;f++)u.array[f]=void 0;return a&&(u.array[i]=a),u},wt.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+M:K)||this.array.length===0)return this;var i=n-1>>>e&P;if(i>=this.array.length)return this;var o;if(e>0){var a=this.array[i];if(o=a&&a.removeAfter(t,e-M,n),o===a&&i===this.array.length-1)return this}var s=Ft(this,t);return s.array.splice(i+1),o&&(s.array[i]=o),s};var ar={};function yo(r,t){var e=r._origin,n=r._capacity,i=ur(n),o=r._tail;return a(r._root,r._level,0);function a(f,c,h){return c===0?s(f,h):u(f,c,h)}function s(f,c){var h=c===i?o&&o.array:f&&f.array,p=c>e?0:e-c,_=n-c;return _>K&&(_=K),function(){if(p===_)return ar;var d=t?--_:p++;return h&&h[d]}}function u(f,c,h){var p,_=f&&f.array,d=h>e?0:e-h>>c,v=(n-h>>c)+1;return v>K&&(v=K),function(){for(;;){if(p){var w=p();if(w!==ar)return w;p=null}if(d===v)return ar;var I=t?--v:d++;p=a(_&&_[I],c-M,h+(I<<c))}}}}function sr(r,t,e,n,i,o,a){var s=Object.create($);return s.size=t-r,s._origin=r,s._capacity=t,s._level=e,s._root=n,s._tail=i,s.__ownerID=o,s.__hash=a,s.__altered=!1,s}function Rr(){return sr(0,0,M)}function mu(r,t,e){if(t=yt(r,t),t!==t)return r;if(t>=r.size||t<0)return r.withMutations(function(a){t<0?bt(a,t).set(0,e):bt(a,0,t+1).set(t,e)});t+=r._origin;var n=r._tail,i=r._root,o=Wr();return t>=ur(r._capacity)?n=Ie(n,r.__ownerID,0,t,e,o):i=Ie(i,r.__ownerID,r._level,t,e,o),o.value?r.__ownerID?(r._root=i,r._tail=n,r.__hash=void 0,r.__altered=!0,r):sr(r._origin,r._capacity,r._level,i,n):r}function Ie(r,t,e,n,i,o){var a=n>>>e&P,s=r&&a<r.array.length;if(!s&&i===void 0)return r;var u;if(e>0){var f=r&&r.array[a],c=Ie(f,t,e-M,n,i,o);return c===f?r:(u=Ft(r,t),u.array[a]=c,u)}return s&&r.array[a]===i?r:(o&&Z(o),u=Ft(r,t),i===void 0&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Ft(r,t){return t&&r&&t===r.ownerID?r:new wt(r?r.array.slice():[],t)}function go(r,t){if(t>=ur(r._capacity))return r._tail;if(t<1<<r._level+M){for(var e=r._root,n=r._level;e&&n>0;)e=e.array[t>>>n&P],n-=M;return e}}function bt(r,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var n=r.__ownerID||new Gr,i=r._origin,o=r._capacity,a=i+t,s=e===void 0?o:e<0?o+e:i+e;if(a===i&&s===o)return r;if(a>=s)return r.clear();for(var u=r._level,f=r._root,c=0;a+c<0;)f=new wt(f&&f.array.length?[void 0,f]:[],n),u+=M,c+=1<<u;c&&(a+=c,i+=c,s+=c,o+=c);for(var h=ur(o),p=ur(s);p>=1<<u+M;)f=new wt(f&&f.array.length?[f]:[],n),u+=M;var _=r._tail,d=p<h?go(r,s-1):p>h?new wt([],n):_;if(_&&p>h&&a<o&&_.array.length){f=Ft(f,n);for(var v=f,w=u;w>M;w-=M){var I=h>>>w&P;v=v.array[I]=Ft(v.array[I],n)}v.array[h>>>M&P]=_}if(s<o&&(d=d&&d.removeAfter(n,0,s)),a>=p)a-=p,s-=p,u=M,f=null,d=d&&d.removeBefore(n,0,a);else if(a>i||p<h){for(c=0;f;){var y=a>>>u&P;if(y!==p>>>u&P)break;y&&(c+=(1<<u)*y),u-=M,f=f.array[y]}f&&a>i&&(f=f.removeBefore(n,u,a-c)),f&&p<h&&(f=f.removeAfter(n,u,p-c)),c&&(a-=c,s-=c)}return r.__ownerID?(r.size=s-a,r._origin=a,r._capacity=s,r._level=u,r._root=f,r._tail=d,r.__hash=void 0,r.__altered=!0,r):sr(a,s,u,f,d)}function ur(r){return r<K?0:r-1>>>M<<M}function mo(r){return ye(r)&&it(r)}var _t=(function(r){function t(e){return e==null?fr():mo(e)?e:fr().withMutations(function(n){var i=V(e);Y(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(n,i){var o=this._map.get(n);return o!==void 0?this._list.get(o)[1]:i},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):fr()},t.prototype.set=function(n,i){return wo(this,n,i)},t.prototype.remove=function(n){return wo(this,n,m)},t.prototype.__iterate=function(n,i){var o=this;return this._list.__iterate(function(a){return a&&n(a[1],a[0],o)},i)},t.prototype.__iterator=function(n,i){return this._list.fromEntrySeq().__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n),o=this._list.__ensureOwner(n);return n?qe(i,o,n,this.__hash):this.size===0?fr():(this.__ownerID=n,this.__altered=!1,this._map=i,this._list=o,this)},t})(J);_t.isOrderedMap=mo,_t.prototype[gt]=!0,_t.prototype[Xt]=_t.prototype.remove;function qe(r,t,e,n){var i=Object.create(_t.prototype);return i.size=r?r.size:0,i._map=r,i._list=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var So;function fr(){return So||(So=qe(st(),Rr()))}function wo(r,t,e){var n=r._map,i=r._list,o=n.get(t),a=o!==void 0,s,u;if(e===m){if(!a)return r;i.size>=K&&i.size>=n.size*2?(u=i.filter(function(f,c){return f!==void 0&&o!==c}),s=u.toKeyedSeq().map(function(f){return f[0]}).flip().toMap(),r.__ownerID&&(s.__ownerID=u.__ownerID=r.__ownerID)):(s=n.remove(t),u=o===i.size-1?i.pop():i.set(o,void 0))}else if(a){if(e===i.get(o)[1])return r;s=n,u=i.set(o,[t,e])}else s=n.set(t,i.size),u=i.set(i.size,[t,e]);return r.__ownerID?(r.size=s.size,r._map=s,r._list=u,r.__hash=void 0,r.__altered=!0,r):qe(s,u)}var bo="@@__IMMUTABLE_STACK__@@";function Me(r){return!!(r&&r[bo])}var Oe=(function(r){function t(e){return e==null?zr():Me(e)?e:zr().pushAll(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(n,i){var o=this._head;for(n=yt(this,n);o&&n--;)o=o.next;return o?o.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,o=this._head,a=arguments.length-1;a>=0;a--)o={value:n[a],next:o};return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):cr(i,o)},t.prototype.pushAll=function(n){if(n=r(n),n.size===0)return this;if(this.size===0&&Me(n))return n;Y(n.size);var i=this.size,o=this._head;return n.__iterate(function(a){i++,o={value:a,next:o}},!0),this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):cr(i,o)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):zr()},t.prototype.slice=function(n,i){if(wr(n,i,this.size))return this;var o=Vt(n,this.size),a=br(i,this.size);if(a!==this.size)return r.prototype.slice.call(this,n,i);for(var s=this.size-o,u=this._head;o--;)u=u.next;return this.__ownerID?(this.size=s,this._head=u,this.__hash=void 0,this.__altered=!0,this):cr(s,u)},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?cr(this.size,this._head,n,this.__hash):this.size===0?zr():(this.__ownerID=n,this.__altered=!1,this)},t.prototype.__iterate=function(n,i){var o=this;if(i)return new xt(this.toArray()).__iterate(function(u,f){return n(u,f,o)},i);for(var a=0,s=this._head;s&&n(s.value,a++,this)!==!1;)s=s.next;return a},t.prototype.__iterator=function(n,i){if(i)return new xt(this.toArray()).__iterator(n,i);var o=0,a=this._head;return new S(function(){if(a){var s=a.value;return a=a.next,z(n,o++,s)}return L()})},t})(Mt);Oe.isStack=Me;var N=Oe.prototype;N[bo]=!0,N.shift=N.pop,N.unshift=N.push,N.unshiftAll=N.pushAll,N.withMutations=rr,N.wasAltered=ve,N.asImmutable=Zt,N["@@transducer/init"]=N.asMutable=Qt,N["@@transducer/step"]=function(r,t){return r.unshift(t)},N["@@transducer/result"]=function(r){return r.asImmutable()};function cr(r,t,e,n){var i=Object.create(N);return i.size=r,i._head=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var Io;function zr(){return Io||(Io=cr(0))}function qo(r,t,e,n,i,o){return Y(r.size),r.__iterate(function(a,s,u){i?(i=!1,e=a):e=t.call(n,e,a,s,u)},o),e}function Su(r,t){return t}function wu(r,t){return[t,r]}function Ee(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return!r.apply(this,t)}}function Mo(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return-r.apply(this,t)}}function Oo(r,t){return r<t?1:r>t?-1:0}function Eo(r,t){if(r===t)return!0;if(!F(t)||r.size!==void 0&&t.size!==void 0&&r.size!==t.size||r.__hash!==void 0&&t.__hash!==void 0&&r.__hash!==t.__hash||R(r)!==R(t)||X(r)!==X(t)||it(r)!==it(t))return!1;if(r.size===0&&t.size===0)return!0;var e=!Ur(r);if(it(r)){var n=r.entries();return t.every(function(u,f){var c=n.next().value;return c&&G(c[1],u)&&(e||G(c[0],f))})&&n.next().done}var i=!1;if(r.size===void 0)if(t.size===void 0)typeof r.cacheResult=="function"&&r.cacheResult();else{i=!0;var o=r;r=t,t=o}var a=!0,s=t.__iterate(function(u,f){if(e?!r.has(u):i?!G(u,r.get(f,m)):!G(r.get(f,m),u))return a=!1,!1});return a&&r.size===s}var bu=(function(r){function t(e,n,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,n,i);if(er(i!==0,"Cannot step a Range by 0"),er(e!==void 0,"You must define a start value when using Range"),er(n!==void 0,"You must define an end value when using Range"),i=Math.abs(i),n<e&&(i=-i),this._start=e,this._end=n,this._step=i,this.size=Math.max(0,Math.ceil((n-e)/i-1)+1),this.size===0){if(Te)return Te;Te=this}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},t.prototype.get=function(n,i){return this.has(n)?this._start+yt(this,n)*this._step:i},t.prototype.includes=function(n){var i=(n-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},t.prototype.slice=function(n,i){return wr(n,i,this.size)?this:(n=Vt(n,this.size),i=br(i,this.size),i<=n?new t(0,0):new t(this.get(n,this._end),this.get(i,this._end),this._step))},t.prototype.indexOf=function(n){var i=n-this._start;if(i%this._step===0){var o=i/this._step;if(o>=0&&o<this.size)return o}return-1},t.prototype.lastIndexOf=function(n){return this.indexOf(n)},t.prototype.__iterate=function(n,i){for(var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;u!==o&&n(s,i?o-++u:u++,this)!==!1;)s+=i?-a:a;return u},t.prototype.__iterator=function(n,i){var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;return new S(function(){if(u===o)return L();var f=s;return s+=i?-a:a,z(n,i?o-++u:u++,f)})},t.prototype.equals=function(n){return n instanceof t?this._start===n._start&&this._end===n._end&&this._step===n._step:Eo(this,n)},t})(rt),Te,To="@@__IMMUTABLE_SET__@@";function Re(r){return!!(r&&r[To])}var ut=(function(r){function t(e){return e==null?hr():Re(e)&&!it(e)?e:hr().withMutations(function(n){var i=r(e);Y(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(V(n).keySeq())},t.intersect=function(n){return n=B(n).toArray(),n.length?k.intersect.apply(t(n.pop()),n):hr()},t.union=function(n){return n=B(n).toArray(),n.length?k.union.apply(t(n.pop()),n):hr()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return Ar(this,this._map.set(n,n))},t.prototype.remove=function(n){return Ar(this,this._map.remove(n))},t.prototype.clear=function(){return Ar(this,this._map.clear())},t.prototype.map=function(n,i){var o=this,a=!1,s=Ar(this,this._map.mapEntries(function(u){var f=u[1],c=n.call(i,f,f,o);return c!==f&&(a=!0),[c,c]},i));return a?s:this},t.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(o){return o.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(o){for(var a=0;a<n.length;a++)typeof n[a]=="string"?o.add(n[a]):r(n[a]).forEach(function(s){return o.add(s)})})},t.prototype.intersect=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.every(function(s){return s.includes(a)})||o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.subtract=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.some(function(s){return s.includes(a)})&&o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.sort=function(n){return _r(Lt(this,n))},t.prototype.sortBy=function(n,i){return _r(Lt(this,i,n))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(n,i){var o=this;return this._map.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){return this._map.__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n);return n?this.__make(i,n):this.size===0?this.__empty():(this.__ownerID=n,this._map=i,this)},t})(Ct);ut.isSet=Re;var k=ut.prototype;k[To]=!0,k[Xt]=k.remove,k.merge=k.concat=k.union,k.withMutations=rr,k.asImmutable=Zt,k["@@transducer/init"]=k.asMutable=Qt,k["@@transducer/step"]=function(r,t){return r.add(t)},k["@@transducer/result"]=function(r){return r.asImmutable()},k.__empty=hr,k.__make=Ro;function Ar(r,t){return r.__ownerID?(r.size=t.size,r._map=t,r):t===r._map?r:t.size===0?r.__empty():r.__make(t)}function Ro(r,t){var e=Object.create(k);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var zo;function hr(){return zo||(zo=Ro(st()))}function Ao(r,t,e){for(var n=ho(t),i=0;i!==n.length;)if(r=po(r,n[i++],m),r===m)return e;return r}function Co(r,t){return Ao(this,r,t)}function Iu(r,t){return Ao(r,t,m)!==m}function qu(r){return Iu(this,r)}function $o(){Y(this.size);var r={};return this.__iterate(function(t,e){r[e]=t}),r}function Cr(r){if(!r||typeof r!="object")return r;if(!F(r)){if(!St(r))return r;r=D(r)}if(R(r)){var t={};return r.__iterate(function(n,i){t[i]=Cr(n)}),t}var e=[];return r.__iterate(function(n){e.push(Cr(n))}),e}function Mu(r){if(r.size===1/0)return 0;var t=it(r),e=R(r),n=t?1:0;return r.__iterate(e?t?function(i,o){n=31*n+ko(W(i),W(o))|0}:function(i,o){n=n+ko(W(i),W(o))|0}:t?function(i){n=31*n+W(i)|0}:function(i){n=n+W(i)|0}),Ou(r.size,n)}function Ou(r,t){return t=tr(t,3432918353),t=tr(t<<15|t>>>-15,461845907),t=tr(t<<13|t>>>-13,5),t=(t+3864292196|0)^r,t=tr(t^t>>>16,2246822507),t=tr(t^t>>>13,3266489909),t=Ir(t^t>>>16),t}function ko(r,t){return r^t+2654435769+(r<<6)+(r>>2)|0}function Tt(r,t){var e=function(n){r.prototype[n]=t[n]};return Object.keys(t).forEach(e),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(e),r}B.Iterator=S,Tt(B,{toArray:function(){Y(this.size);var t=new Array(this.size||0),e=R(this),n=0;return this.__iterate(function(i,o){t[n++]=e?[o,i]:i}),t},toIndexedSeq:function(){return new Ni(this)},toJS:function(){return Cr(this)},toKeyedSeq:function(){return new qr(this,!0)},toMap:function(){return J(this.toKeyedSeq())},toObject:$o,toOrderedMap:function(){return _t(this.toKeyedSeq())},toOrderedSet:function(){return _r(R(this)?this.valueSeq():this)},toSet:function(){return ut(R(this)?this.valueSeq():this)},toSetSeq:function(){return new Di(this)},toSeq:function(){return X(this)?this.toIndexedSeq():R(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Oe(R(this)?this.valueSeq():this)},toList:function(){return Tr(R(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return this.size===0?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return O(this,Zs(this,t))},includes:function(t){return this.some(function(e){return G(e,t)})},entries:function(){return this.__iterator(H)},every:function(t,e){Y(this.size);var n=!0;return this.__iterate(function(i,o,a){if(!t.call(e,i,o,a))return n=!1,!1}),n},filter:function(t,e){return O(this,Ki(this,t,e,!0))},partition:function(t,e){return Js(this,t,e)},find:function(t,e,n){var i=this.findEntry(t,e);return i?i[1]:n},forEach:function(t,e){return Y(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Y(this.size),t=t!==void 0?""+t:",";var e="",n=!0;return this.__iterate(function(i){n?n=!1:e+=t,e+=i!=null?i.toString():""}),e},keys:function(){return this.__iterator($t)},map:function(t,e){return O(this,Hi(this,t,e))},reduce:function(t,e,n){return qo(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return qo(this,t,e,n,arguments.length<2,!0)},reverse:function(){return O(this,oe(this,!0))},slice:function(t,e){return O(this,ae(this,t,e,!0))},some:function(t,e){Y(this.size);var n=!1;return this.__iterate(function(i,o,a){if(t.call(e,i,o,a))return n=!0,!1}),n},sort:function(t){return O(this,Lt(this,t))},values:function(){return this.__iterator(U)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(t,e){return kt(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return Gs(this,t,e)},equals:function(t){return Eo(this,t)},entrySeq:function(){var t=this;if(t._cache)return new xt(t._cache);var e=t.toSeq().map(wu).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Ee(t),e)},findEntry:function(t,e,n){var i=n;return this.__iterate(function(o,a,s){if(t.call(e,o,a,s))return i=[a,o],!1}),i},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(Ei,null,t)},flatMap:function(t,e){return O(this,Qs(this,t,e))},flatten:function(t){return O(this,Gi(this,t,!0))},fromEntrySeq:function(){return new Fi(this)},get:function(t,e){return this.find(function(n,i){return G(i,t)},void 0,e)},getIn:Co,groupBy:function(t,e){return Ys(this,t,e)},has:function(t){return this.get(t,m)!==m},hasIn:qu,isSubset:function(t){return t=typeof t.includes=="function"?t:B(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:B(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return G(e,t)})},keySeq:function(){return this.toSeq().map(Su).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Mr(this,t)},maxBy:function(t,e){return Mr(this,e,t)},min:function(t){return Mr(this,t?Mo(t):Oo)},minBy:function(t,e){return Mr(this,e?Mo(e):Oo,t)},rest:function(){return this.slice(1)},skip:function(t){return t===0?this:this.slice(Math.max(0,t))},skipLast:function(t){return t===0?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return O(this,Wi(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Ee(t),e)},sortBy:function(t,e){return O(this,Lt(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return O(this,Xs(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Ee(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Mu(this))}});var j=B.prototype;j[Ii]=!0,j[mr]=j.values,j.toJSON=j.toArray,j.__toStringMapper=or,j.inspect=j.toSource=function(){return this.toString()},j.chain=j.flatMap,j.contains=j.includes,Tt(V,{flip:function(){return O(this,Ui(this))},mapEntries:function(t,e){var n=this,i=0;return O(this,this.toSeq().map(function(o,a){return t.call(e,[a,o],i++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return O(this,this.toSeq().flip().map(function(i,o){return t.call(e,i,o,n)}).flip())}});var pr=V.prototype;pr[gr]=!0,pr[mr]=j.entries,pr.toJSON=$o,pr.__toStringMapper=function(r,t){return or(t)+": "+or(r)},Tt(Mt,{toKeyedSeq:function(){return new qr(this,!1)},filter:function(t,e){return O(this,Ki(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return e===void 0?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return e===void 0?-1:e},reverse:function(){return O(this,oe(this,!1))},slice:function(t,e){return O(this,ae(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(e||0,0),n===0||n===2&&!e)return this;t=Vt(t,t<0?this.count():this.size);var i=this.slice(0,t);return O(this,n===1?i:i.concat(at(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return O(this,Gi(this,t,!1))},get:function(t,e){return t=yt(this,t),t<0||this.size===1/0||this.size!==void 0&&t>this.size?e:this.find(function(n,i){return i===t},void 0,e)},has:function(t){return t=yt(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return O(this,tu(this,t))},interleave:function(){var t=[this].concat(at(arguments)),e=Or(this.toSeq(),rt.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),O(this,n)},keySeq:function(){return bu(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return O(this,Wi(this,t,e,!1))},zip:function(){var t=[this].concat(at(arguments));return O(this,Or(this,Bo,t))},zipAll:function(){var t=[this].concat(at(arguments));return O(this,Or(this,Bo,t,!0))},zipWith:function(t){var e=at(arguments);return e[0]=this,O(this,Or(this,t,e))}});var Ut=Mt.prototype;Ut[vt]=!0,Ut[gt]=!0,Tt(Ct,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Ht=Ct.prototype;Ht.has=j.includes,Ht.contains=Ht.includes,Ht.keys=Ht.values,Tt(mt,pr),Tt(rt,Ut),Tt(jt,Ht);function Bo(){return at(arguments)}function jo(r){return Re(r)&&it(r)}var _r=(function(r){function t(e){return e==null?ze():jo(e)?e:ze().withMutations(function(n){var i=Ct(e);Y(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(V(n).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t})(ut);_r.isOrderedSet=jo;var Rt=_r.prototype;Rt[gt]=!0,Rt.zip=Ut.zip,Rt.zipWith=Ut.zipWith,Rt.zipAll=Ut.zipAll,Rt.__empty=ze,Rt.__make=xo;function xo(r,t){var e=Object.create(Rt);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var Lo;function ze(){return Lo||(Lo=xo(fr()))}function Eu(r){if(Ot(r))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(nt(r))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(r===null||typeof r!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var C=function(t,e){var n;Eu(t);var i=function(s){var u=this;if(s instanceof i)return s;if(!(this instanceof i))return new i(s);if(!n){n=!0;var f=Object.keys(t),c=o._indices={};o._name=e,o._keys=f,o._defaultValues=t;for(var h=0;h<f.length;h++){var p=f[h];c[p]=h,o[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+Ce(this)+' with property "'+p+'" since that property name is part of the Record API.'):Tu(o,p)}}return this.__ownerID=void 0,this._values=Tr().withMutations(function(_){_.setSize(u._keys.length),V(s).forEach(function(d,v){_.set(u._indices[v],d===u._defaultValues[v]?void 0:d)})}),this},o=i.prototype=Object.create(E);return o.constructor=i,e&&(i.displayName=e),i};C.prototype.toString=function(){for(var t=Ce(this)+" { ",e=this._keys,n,i=0,o=e.length;i!==o;i++)n=e[i],t+=(i?", ":"")+n+": "+or(this.get(n));return t+" }"},C.prototype.equals=function(t){return this===t||Ot(t)&&Kt(this).equals(Kt(t))},C.prototype.hashCode=function(){return Kt(this).hashCode()},C.prototype.has=function(t){return this._indices.hasOwnProperty(t)},C.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._indices[t],i=this._values.get(n);return i===void 0?this._defaultValues[t]:i},C.prototype.set=function(t,e){if(this.has(t)){var n=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(n!==this._values&&!this.__ownerID)return Ae(this,n)}return this},C.prototype.remove=function(t){return this.set(t)},C.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Ae(this,t)},C.prototype.wasAltered=function(){return this._values.wasAltered()},C.prototype.toSeq=function(){return Kt(this)},C.prototype.toJS=function(){return Cr(this)},C.prototype.entries=function(){return this.__iterator(H)},C.prototype.__iterator=function(t,e){return Kt(this).__iterator(t,e)},C.prototype.__iterate=function(t,e){return Kt(this).__iterate(t,e)},C.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?Ae(this,e,t):(this.__ownerID=t,this._values=e,this)},C.isRecord=Ot,C.getDescriptiveName=Ce;var E=C.prototype;E[zi]=!0,E[Xt]=E.remove,E.deleteIn=E.removeIn=be,E.getIn=Co,E.hasIn=j.hasIn,E.merge=Qi,E.mergeWith=to,E.mergeIn=pe,E.mergeDeep=eo,E.mergeDeepWith=no,E.mergeDeepIn=he,E.setIn=_e,E.update=de,E.updateIn=le,E.withMutations=rr,E.asMutable=Qt,E.asImmutable=Zt,E[mr]=E.entries,E.toJSON=E.toObject=j.toObject,E.inspect=E.toSource=function(){return this.toString()};function Ae(r,t,e){var n=Object.create(Object.getPrototypeOf(r));return n._values=t,n.__ownerID=e,n}function Ce(r){return r.constructor.displayName||r.constructor.name||"Record"}function Kt(r){return Vr(r._keys.map(function(t){return[t,r.get(t)]}))}function Tu(r,t){try{Object.defineProperty(r,t,{get:function(){return this.get(t)},set:function(e){er(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ru(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $e,Po;function No(){if(Po)return $e;Po=1;function r(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t}return $e=r,$e}var ke,Do;function zu(){if(Do)return ke;Do=1;var r=typeof $r=="object"&&$r&&$r.Object===Object&&$r;return ke=r,ke}var Be,Fo;function je(){if(Fo)return Be;Fo=1;var r=zu(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return Be=e,Be}var xe,Uo;function kr(){if(Uo)return xe;Uo=1;var r=je(),t=r.Symbol;return xe=t,xe}var Le,Ho;function Au(){if(Ho)return Le;Ho=1;var r=kr(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function o(a){var s=e.call(a,i),u=a[i];try{a[i]=void 0;var f=!0}catch{}var c=n.call(a);return f&&(s?a[i]=u:delete a[i]),c}return Le=o,Le}var Pe,Ko;function Cu(){if(Ko)return Pe;Ko=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return Pe=e,Pe}var Ne,Wo;function Br(){if(Wo)return Ne;Wo=1;var r=kr(),t=Au(),e=Cu(),n="[object Null]",i="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?i:n:o&&o in Object(s)?t(s):e(s)}return Ne=a,Ne}var De,Go;function jr(){if(Go)return De;Go=1;function r(t){return t!=null&&typeof t=="object"}return De=r,De}var Fe,Yo;function $u(){if(Yo)return Fe;Yo=1;var r=Br(),t=jr(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Fe=n,Fe}var Ue,Jo;function Xo(){if(Jo)return Ue;Jo=1;var r=$u(),t=jr(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,o=r((function(){return arguments})())?r:function(a){return t(a)&&n.call(a,"callee")&&!i.call(a,"callee")};return Ue=o,Ue}var He,Vo;function It(){if(Vo)return He;Vo=1;var r=Array.isArray;return He=r,He}var Ke,Zo;function ku(){if(Zo)return Ke;Zo=1;var r=kr(),t=Xo(),e=It(),n=r?r.isConcatSpreadable:void 0;function i(o){return e(o)||t(o)||!!(n&&o&&o[n])}return Ke=i,Ke}var We,Qo;function Bu(){if(Qo)return We;Qo=1;var r=No(),t=ku();function e(n,i,o,a,s){var u=-1,f=n.length;for(o||(o=t),s||(s=[]);++u<f;){var c=n[u];i>0&&o(c)?i>1?e(c,i-1,o,a,s):r(s,c):a||(s[s.length]=c)}return s}return We=e,We}var Ge,ta;function ju(){if(ta)return Ge;ta=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return Ge=r,Ge}var Ye,ra;function xu(){if(ra)return Ye;ra=1;var r=No(),t=Bu(),e=ju(),n=It();function i(){var o=arguments.length;if(!o)return[];for(var a=Array(o-1),s=arguments[0],u=o;u--;)a[u-1]=arguments[u];return r(n(s)?e(s):[s],t(a,1))}return Ye=i,Ye}xu();var Je,ea;function Lu(){if(ea)return Je;ea=1;function r(t,e){return t!=null&&e in Object(t)}return Je=r,Je}var Xe,na;function xr(){if(na)return Xe;na=1;var r=Br(),t=jr(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Xe=n,Xe}var Ve,ia;function Pu(){if(ia)return Ve;ia=1;var r=It(),t=xr(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(o,a){if(r(o))return!1;var s=typeof o;return s=="number"||s=="symbol"||s=="boolean"||o==null||t(o)?!0:n.test(o)||!e.test(o)||a!=null&&o in Object(a)}return Ve=i,Ve}var Ze,oa;function Qe(){if(oa)return Ze;oa=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Ze=r,Ze}var tn,aa;function Nu(){if(aa)return tn;aa=1;var r=Br(),t=Qe(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function a(s){if(!t(s))return!1;var u=r(s);return u==n||u==i||u==e||u==o}return tn=a,tn}var rn,sa;function Du(){if(sa)return rn;sa=1;var r=je(),t=r["__core-js_shared__"];return rn=t,rn}var en,ua;function Fu(){if(ua)return en;ua=1;var r=Du(),t=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function e(n){return!!t&&t in n}return en=e,en}var nn,fa;function Uu(){if(fa)return nn;fa=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return nn=e,nn}var on,ca;function Hu(){if(ca)return on;ca=1;var r=Nu(),t=Fu(),e=Qe(),n=Uu(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,u=a.toString,f=s.hasOwnProperty,c=RegExp("^"+u.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(p){if(!e(p)||t(p))return!1;var _=r(p)?c:o;return _.test(n(p))}return on=h,on}var an,ha;function Ku(){if(ha)return an;ha=1;function r(t,e){return t?.[e]}return an=r,an}var sn,pa;function _a(){if(pa)return sn;pa=1;var r=Hu(),t=Ku();function e(n,i){var o=t(n,i);return r(o)?o:void 0}return sn=e,sn}var un,da;function Lr(){if(da)return un;da=1;var r=_a(),t=r(Object,"create");return un=t,un}var fn,la;function Wu(){if(la)return fn;la=1;var r=Lr();function t(){this.__data__=r?r(null):{},this.size=0}return fn=t,fn}var cn,va;function Gu(){if(va)return cn;va=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return cn=r,cn}var hn,ya;function Yu(){if(ya)return hn;ya=1;var r=Lr(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(o){var a=this.__data__;if(r){var s=a[o];return s===t?void 0:s}return n.call(a,o)?a[o]:void 0}return hn=i,hn}var pn,ga;function Ju(){if(ga)return pn;ga=1;var r=Lr(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var o=this.__data__;return r?o[i]!==void 0:e.call(o,i)}return pn=n,pn}var _n,ma;function Xu(){if(ma)return _n;ma=1;var r=Lr(),t="__lodash_hash_undefined__";function e(n,i){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=r&&i===void 0?t:i,this}return _n=e,_n}var dn,Sa;function Vu(){if(Sa)return dn;Sa=1;var r=Wu(),t=Gu(),e=Yu(),n=Ju(),i=Xu();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,dn=o,dn}var ln,wa;function Zu(){if(wa)return ln;wa=1;function r(){this.__data__=[],this.size=0}return ln=r,ln}var vn,ba;function Qu(){if(ba)return vn;ba=1;function r(t,e){return t===e||t!==t&&e!==e}return vn=r,vn}var yn,Ia;function Pr(){if(Ia)return yn;Ia=1;var r=Qu();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return yn=t,yn}var gn,qa;function tf(){if(qa)return gn;qa=1;var r=Pr(),t=Array.prototype,e=t.splice;function n(i){var o=this.__data__,a=r(o,i);if(a<0)return!1;var s=o.length-1;return a==s?o.pop():e.call(o,a,1),--this.size,!0}return gn=n,gn}var mn,Ma;function rf(){if(Ma)return mn;Ma=1;var r=Pr();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return mn=t,mn}var Sn,Oa;function ef(){if(Oa)return Sn;Oa=1;var r=Pr();function t(e){return r(this.__data__,e)>-1}return Sn=t,Sn}var wn,Ea;function nf(){if(Ea)return wn;Ea=1;var r=Pr();function t(e,n){var i=this.__data__,o=r(i,e);return o<0?(++this.size,i.push([e,n])):i[o][1]=n,this}return wn=t,wn}var bn,Ta;function of(){if(Ta)return bn;Ta=1;var r=Zu(),t=tf(),e=rf(),n=ef(),i=nf();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,bn=o,bn}var In,Ra;function af(){if(Ra)return In;Ra=1;var r=_a(),t=je(),e=r(t,"Map");return In=e,In}var qn,za;function sf(){if(za)return qn;za=1;var r=Vu(),t=of(),e=af();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return qn=n,qn}var Mn,Aa;function uf(){if(Aa)return Mn;Aa=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Mn=r,Mn}var On,Ca;function Nr(){if(Ca)return On;Ca=1;var r=uf();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return On=t,On}var En,$a;function ff(){if($a)return En;$a=1;var r=Nr();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return En=t,En}var Tn,ka;function cf(){if(ka)return Tn;ka=1;var r=Nr();function t(e){return r(this,e).get(e)}return Tn=t,Tn}var Rn,Ba;function hf(){if(Ba)return Rn;Ba=1;var r=Nr();function t(e){return r(this,e).has(e)}return Rn=t,Rn}var zn,ja;function pf(){if(ja)return zn;ja=1;var r=Nr();function t(e,n){var i=r(this,e),o=i.size;return i.set(e,n),this.size+=i.size==o?0:1,this}return zn=t,zn}var An,xa;function _f(){if(xa)return An;xa=1;var r=sf(),t=ff(),e=cf(),n=hf(),i=pf();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,An=o,An}var Cn,La;function df(){if(La)return Cn;La=1;var r=_f(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var a=arguments,s=i?i.apply(this,a):a[0],u=o.cache;if(u.has(s))return u.get(s);var f=n.apply(this,a);return o.cache=u.set(s,f)||u,f};return o.cache=new(e.Cache||r),o}return e.Cache=r,Cn=e,Cn}var $n,Pa;function lf(){if(Pa)return $n;Pa=1;var r=df(),t=500;function e(n){var i=r(n,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return $n=e,$n}var kn,Na;function vf(){if(Na)return kn;Na=1;var r=lf(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(a,s,u,f){o.push(u?f.replace(e,"$1"):s||a)}),o});return kn=n,kn}var Bn,Da;function yf(){if(Da)return Bn;Da=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o}return Bn=r,Bn}var jn,Fa;function xn(){if(Fa)return jn;Fa=1;var r=kr(),t=yf(),e=It(),n=xr(),i=r?r.prototype:void 0,o=i?i.toString:void 0;function a(s){if(typeof s=="string")return s;if(e(s))return t(s,a)+"";if(n(s))return o?o.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return jn=a,jn}var Ln,Ua;function Pn(){if(Ua)return Ln;Ua=1;var r=xn();function t(e){return e==null?"":r(e)}return Ln=t,Ln}var Nn,Ha;function gf(){if(Ha)return Nn;Ha=1;var r=It(),t=Pu(),e=vf(),n=Pn();function i(o,a){return r(o)?o:t(o,a)?[o]:e(n(o))}return Nn=i,Nn}var Dn,Ka;function mf(){if(Ka)return Dn;Ka=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var o=typeof n;return i=i??r,!!i&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Dn=e,Dn}var Fn,Wa;function Sf(){if(Wa)return Fn;Wa=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Fn=t,Fn}var Un,Ga;function wf(){if(Ga)return Un;Ga=1;var r=xr();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Un=t,Un}var Hn,Ya;function bf(){if(Ya)return Hn;Ya=1;var r=gf(),t=Xo(),e=It(),n=mf(),i=Sf(),o=wf();function a(s,u,f){u=r(u,s);for(var c=-1,h=u.length,p=!1;++c<h;){var _=o(u[c]);if(!(p=s!=null&&f(s,_)))break;s=s[_]}return p||++c!=h?p:(h=s==null?0:s.length,!!h&&i(h)&&n(_,h)&&(e(s)||t(s)))}return Hn=a,Hn}var Kn,Ja;function If(){if(Ja)return Kn;Ja=1;var r=Lu(),t=bf();function e(n,i){return n!=null&&t(n,i,r)}return Kn=e,Kn}If();var Wn,Xa;function qf(){if(Xa)return Wn;Xa=1;var r=Math.max,t=Math.min;function e(n,i,o){return n>=t(i,o)&&n<r(i,o)}return Wn=e,Wn}var Gn,Va;function Mf(){if(Va)return Gn;Va=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Gn=t,Gn}var Yn,Za;function Of(){if(Za)return Yn;Za=1;var r=Mf(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Yn=e,Yn}var Jn,Qa;function ts(){if(Qa)return Jn;Qa=1;var r=Of(),t=Qe(),e=xr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function u(f){if(typeof f=="number")return f;if(e(f))return n;if(t(f)){var c=typeof f.valueOf=="function"?f.valueOf():f;f=t(c)?c+"":c}if(typeof f!="string")return f===0?f:+f;f=r(f);var h=o.test(f);return h||a.test(f)?s(f.slice(2),h?2:8):i.test(f)?n:+f}return Jn=u,Jn}var Xn,rs;function es(){if(rs)return Xn;rs=1;var r=ts(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-t){var o=i<0?-1:1;return o*e}return i===i?i:0}return Xn=n,Xn}var Vn,ns;function Ef(){if(ns)return Vn;ns=1;var r=qf(),t=es(),e=ts();function n(i,o,a){return o=t(o),a===void 0?(a=o,o=0):a=t(a),i=e(i),r(i,o,a)}return Vn=n,Vn}var Tf=Ef();const Rf=Ru(Tf);var Zn,is;function Qn(){if(is)return Zn;is=1;var r=es();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Zn=t,Zn}var ti,os;function zf(){if(os)return ti;os=1;var r=Qn();function t(e){return typeof e=="number"&&e==r(e)}return ti=t,ti}zf();var ri,as;function ss(){if(as)return ri;as=1;function r(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),n=n>o?o:n,n<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=Array(o);++i<o;)a[i]=t[i+e];return a}return ri=r,ri}var ei,us;function Af(){if(us)return ei;us=1;var r=ss(),t=Qn();function e(n,i,o){return n&&n.length?(i=o||i===void 0?1:t(i),r(n,0,i<0?0:i)):[]}return ei=e,ei}Af();const dr="black",lr="white",Q=null;class fs extends C({dimensions:19,moves:J()},"Board"){constructor(t=19,...e){super({dimensions:t,moves:J(e.map(n=>[n.coordinate,n.color]))})}toMap(t=null){const e={[dr]:dr,[lr]:lr,[Q]:Q},n=t||e;return Array(this.dimensions).fill(Q).map((i,o)=>Array(this.dimensions).fill(Q).map((a,s)=>{const u=this.moves.get(et(s,o),Q);return n[u]||e[u]}))}}function cs(...r){return Reflect.construct(fs,r)}cs.prototype=fs.prototype;class hs extends C({x:0,y:0},"Coordinate"){constructor(t,e){super({x:t,y:e})}}function et(...r){return Reflect.construct(hs,r)}et.prototype=hs.prototype;class ps extends C({coordinate:et(),color:Q},"Move"){constructor(t,e){super({coordinate:t,color:e})}}function _s(...r){return Reflect.construct(ps,r)}_s.prototype=ps.prototype,et(4,4),et(6,6),et(9,9);function Cf(r,t){const{x:e,y:n}=t,i=o=>Rf(o,r.dimensions);return ut.of(et(e,n+1),et(e,n-1),et(e+1,n),et(e-1,n)).filter(o=>i(o.x)&&i(o.y))}function Dr(r,t,e){const n=e===void 0?r.moves.get(t,Q):e;return Cf(r,t).filter(i=>r.moves.get(i,Q)===n)}function ds(r,t){let e=ut(),n=ut.of(t);for(;!n.isEmpty();){const i=n.first(),o=Dr(r,i);e=e.add(i),n=n.rest().union(o.subtract(e))}return e}function ni(r){return r===dr?lr:r===lr?dr:Q}function $f(r,t){return ds(r,t).reduce((e,n)=>e.union(Dr(r,n,Q)),ut())}function ii(r,t){return $f(r,t).size}function ls(r,t){const e=ii(r.setIn(["moves",t.coordinate],t.color),t.coordinate)>0,n=Dr(r,t.coordinate,ni(t.color)).some(i=>ii(r,i)===1);return e||n}function kf(r,t){return r.setIn(["moves"],t.reduce((e,n)=>e.delete(n),r.moves))}function Bf(r,t){if(!ls(r,t))throw new Error("Not a valid position");if(r.moves.has(t.coordinate))throw new Error("There is already a stone there");const e=Dr(r,t.coordinate,ni(t.color)).reduce((n,i)=>n.union(ii(r,i)===1?ds(r,i):ut()),ut());return kf(r,e).setIn(["moves",t.coordinate],t.color)}function jf(r,t,e,n=!1){const i=r.moves.get(t,Q);if(!n&&ni(i)===e)throw new Error("There is already a stone there. Pass force=true to override.");return r.setIn(["moves",t],e)}const dt={BLACK:dr,Board:cs,Coordinate:et,EMPTY:Q,Move:_s,WHITE:lr,addMove:Bf,isLegalMove:ls,placeStone:jf};It();var oi,vs;function xf(){if(vs)return oi;vs=1;var r=Br(),t=It(),e=jr(),n="[object String]";function i(o){return typeof o=="string"||!t(o)&&e(o)&&r(o)==n}return oi=i,oi}xf();var ai,ys;function Lf(){if(ys)return ai;ys=1;function r(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}return ai=r,ai}var si,gs;function Pf(){if(gs)return si;gs=1;var r=Lf(),t=xn(),e=Qn(),n=Pn();function i(o,a,s){return o=n(o),s=s==null?0:r(e(s),0,o.length),a=t(a),o.slice(s,s+a.length)==a}return si=i,si}Pf();var ui,ms;function Nf(){if(ms)return ui;ms=1;var r=ss();function t(e,n,i){var o=e.length;return i=i===void 0?o:i,!n&&i>=o?e:r(e,n,i)}return ui=t,ui}var fi,Ss;function Df(){if(Ss)return fi;Ss=1;function r(t,e,n,i){for(var o=t.length,a=n+(i?1:-1);i?a--:++a<o;)if(e(t[a],a,t))return a;return-1}return fi=r,fi}var ci,ws;function Ff(){if(ws)return ci;ws=1;function r(t){return t!==t}return ci=r,ci}var hi,bs;function Uf(){if(bs)return hi;bs=1;function r(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}return hi=r,hi}var pi,Is;function Hf(){if(Is)return pi;Is=1;var r=Df(),t=Ff(),e=Uf();function n(i,o,a){return o===o?e(i,o,a):r(i,t,a)}return pi=n,pi}var _i,qs;function Kf(){if(qs)return _i;qs=1;var r=Hf();function t(e,n){for(var i=-1,o=e.length;++i<o&&r(n,e[i],0)>-1;);return i}return _i=t,_i}var di,Ms;function Wf(){if(Ms)return di;Ms=1;function r(t){return t.split("")}return di=r,di}var li,Os;function Gf(){if(Os)return li;Os=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="\\u200d",s=RegExp("["+a+r+i+o+"]");function u(f){return s.test(f)}return li=u,li}var vi,Es;function Yf(){if(Es)return vi;Es=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="["+r+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",f="(?:"+s+"|"+u+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",d=f+"?",v="["+o+"]?",w="(?:"+_+"(?:"+[c,h,p].join("|")+")"+v+d+")*",I=v+d+w,y="(?:"+[c+s+"?",s,h,p,a].join("|")+")",l=RegExp(u+"(?="+u+")|"+y+I,"g");function g(A){return A.match(l)||[]}return vi=g,vi}var yi,Ts;function Jf(){if(Ts)return yi;Ts=1;var r=Wf(),t=Gf(),e=Yf();function n(i){return t(i)?e(i):r(i)}return yi=n,yi}var gi,Rs;function Xf(){if(Rs)return gi;Rs=1;var r=xn(),t=Nf(),e=Kf(),n=Jf(),i=Pn(),o=/^\s+/;function a(s,u,f){if(s=i(s),s&&(f||u===void 0))return s.replace(o,"");if(!s||!(u=r(u)))return s;var c=n(s),h=e(c,n(u));return t(c,h).join("")}return gi=a,gi}Xf();const tt=dt.BLACK,mi=dt.Board,vr=dt.Coordinate,yr=dt.EMPTY,zt=dt.Move,ft=dt.WHITE,Wt=dt.addMove,zs=dt.isLegalMove,Vf=dt.placeStone;function Fr(r){return`
|
|
2
2
|
<div style="background: #fee2e2; color: #991b1b; padding: 1rem; border-radius: 4px;">${r}</div>
|
|
3
|
-
`}function gi(r,t,e){const n=r.dimensions,i=t??n,a=e??n,o=30,s=o,u=o*.4,f=n===a,c=n===i,h=(f?a-1:a)*o+s*2,p=(c?i-1:i)*o+s*2;let _=`<svg width="${h}" height="${p}" xmlns="http://www.w3.org/2000/svg">`;_+=`<rect width="${h}" height="${p}" fill="#dcb35c"/>`;const d=a<n,v=i<n,I=s+(d?a:a-1)*o,y=s+(v?i:i-1)*o;for(let l=0;l<a;l++){const g=s+l*o;_+=`<line x1="${g}" y1="${s}" x2="${g}" y2="${y}" stroke="#000" stroke-width="1"/>`}for(let l=0;l<i;l++){const g=s+l*o;_+=`<line x1="${s}" y1="${g}" x2="${I}" y2="${g}" stroke="#000" stroke-width="1"/>`}const m=[];n===9?m.push([2,2],[2,6],[4,4],[6,2],[6,6]):n===13?m.push([3,3],[3,9],[6,6],[9,3],[9,9]):n===19&&m.push([3,3],[3,9],[3,15],[9,3],[9,9],[9,15],[15,3],[15,9],[15,15]);for(const[l,g]of m)if(l<i&&g<a){const b=s+g*o,B=s+l*o;_+=`<circle cx="${b}" cy="${B}" r="3" fill="#000"/>`}for(let l=0;l<i;l++)for(let g=0;g<a;g++){const b=r.moves.get(vr(l,g),yr);if(b!==yr){const B=s+g*o,$=s+l*o;b===Q?_+=`<circle cx="${B}" cy="${$}" r="${u}" fill="#000" stroke="#000" stroke-width="1"/>`:b===ft&&(_+=`<circle cx="${B}" cy="${$}" r="${u}" fill="#fff" stroke="#000" stroke-width="1"/>`)}}return _+="</svg>",_}class ct extends Error{constructor(t){super(t),this.name="ValidationError"}}function zs(r,t){const e={};let n=null,i=!1;for(let a=t;a<r.length;a++){const o=r[a].trim();if(o==="")continue;const s=o.indexOf(":");if(s>0){const u=o.substring(0,s).trim(),f=o.substring(s+1).trim();e[u]=f,n=u,i=f===""}else n&&i&&(Array.isArray(e[n])?e[n].push(o):e[n]=[o])}return e}function mi(r,t={}){const{allowEmpty:e=!1,validateCharacters:n=!0}=t;let i=1;for(;i<r.length&&r[i].trim()==="";)i++;if(i>=r.length)throw new ct("No board definition or options found");const a=[];let o=i;for(let y=i;y<r.length;y++){const m=r[y];if(m.trim()===""){o=y;break}if(m.indexOf(":")>0){o=y;break}a.push(m),o=y+1}const s=zs(r,o);let u;if(s.size){const y=s.size;if(Array.isArray(y))throw new ct("Size option cannot have multiple values");const m=parseInt(y,10);if(isNaN(m)||m<=1||m>19)throw new ct("Size must be a positive integer greater than 1 and less than or equal to 19");u=m}if(a.length===0){if(!e)throw new ct("Board definition is required");if(!u)throw new ct('Empty board requires a "size" option');return{board:Ts(u),rowCount:u,columnCount:u,configStartIndex:o,otherMarks:{}}}const f=a.map(y=>y.replace(/\s/g,"").length),c=f[0];if(!f.every(y=>y===c))throw new ct("All board rows must have the same number of non-space characters");const h=a.length,p=a[0].replace(/\s/g,"").length,_=h===p;if(u&&(h>u||p>u))throw new ct(`Board dimensions (${h}x${p}) exceed specified size (${u})`);if(!_&&!u)throw new ct(`Rectangle boards require a "size" option (found ${h}x${p} board)`);u||(u=h);const d=[],v={};for(let y=0;y<a.length;y++){const m=a[y];let l=0;for(let g=0;g<m.length;g++){const b=m[g];if(b===" ")continue;const B=/^[.+XOxo]$/.test(b);if(n&&!B)throw new ct(`Invalid board character '${b}' at row ${y+1}, col ${l+1}. Valid characters: . or + (empty), X or x (black stone), O or o (white stone)`);let $=yr;b==="X"||b==="x"?$=Q:b==="O"||b==="o"?$=ft:b==="."||b==="+"?$=yr:n||(v[b]||(v[b]=[]),v[b].push(vr(y,l))),$!==yr&&d.push(zt(vr(y,l),$)),l++}}return{board:Ts(u,...d),rowCount:h,columnCount:p,configStartIndex:o,otherMarks:v}}const ht={Success:"success",Failure:"failure",Incomplete:"incomplete"};class As{parsedBoard;element;constructor(t,e){this.element=t,this.parsedBoard=mi(e,{})}render(){const t=this.element,{board:e,rowCount:n,columnCount:i}=this.parsedBoard,a=gi(e,n,i);t.innerHTML=a}}class Cs{parsedBoard;element;toPlay;sequenceTree;result;currentTree;playedMoves;currentBoard;isBlackTurn;constructor(t,e){this.element=t;const n=mi(e,{allowEmpty:!1,validateCharacters:!1});for(const[l,g]of Object.entries(n.otherMarks))if(g.length>1)throw new Error(`Mark '${l}' appears at multiple coordinates. Each mark must be unique.`);const i=zs(e,n.configStartIndex),a=i.black,o=i.white,s=a?Array.isArray(a)?a:a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],u=o?Array.isArray(o)?o:o.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],f=new Set(u),c=s.filter(l=>f.has(l));if(c.length>0)throw new Error(`Marks cannot appear in both black and white: ${c.join(", ")}`);const h=new Set(Object.keys(n.otherMarks));for(const l of s)if(!h.has(l))throw new Error(`Black mark '${l}' does not appear in the board`);for(const l of u)if(!h.has(l))throw new Error(`White mark '${l}' does not appear in the board`);const p=i["to-play"],_=p?(Array.isArray(p)?p[0]:p).toLowerCase():"";if(_&&_!=="black"&&_!=="white")throw new Error(`Invalid to-play value '${_}'. Must be 'black' or 'white'`);this.toPlay=_==="white"?ft:Q;let d=n.board;for(const l of s){const g=n.otherMarks[l];for(const b of g)d=Wt(d,zt(b,Q))}for(const l of u){const g=n.otherMarks[l];for(const b of g)d=Wt(d,zt(b,ft))}this.parsedBoard={...n,board:d},this.result=ht.Incomplete,this.currentTree=J(),this.playedMoves=[],this.currentBoard=d,this.isBlackTurn=this.toPlay===Q;const v=(l,g)=>{const b=l.split(">").map(E=>E.trim()).filter(E=>E.length>0);for(const E of b)if(!n.otherMarks[E])throw new Error(`${g} '${l}': mark '${E}' does not appear in the board`);let B=d,$=this.toPlay;for(let E=0;E<b.length;E++){const dt=b[E],At=n.otherMarks[dt][0],Yt=zt(At,$);if(!Rs(B,Yt))throw new Error(`${g} '${l}': move ${E+1} (${dt}) is illegal`);try{B=Wt(B,Yt)}catch(Jt){const rc=Jt instanceof Error?Jt.message:String(Jt);throw new Error(`${g} '${l}': move ${E+1} (${dt}) failed - ${rc}`)}$=$===Q?ft:Q}},I=i.solutions,y=[];if(I){const l=Array.isArray(I)?I:[I];for(const g of l)v(g,"Solution"),y.push({sequence:g,isSolution:!0})}const m=i.sequences;if(m){const l=Array.isArray(m)?m:[m];for(const g of l)v(g,"Sequence"),y.push({sequence:g,isSolution:!1})}this.sequenceTree=J();for(const{sequence:l,isSolution:g}of y){const b=l.split(">").map(E=>E.trim()).filter(E=>E.length>0),B=[];for(const E of b)B.push(n.otherMarks[E][0]);let $=J();for(let E=B.length-1;E>=0;E--){const dt=B[E],Gt=E===B.length-1;let At;Gt?At=g?ht.Success:ht.Failure:At=ht.Incomplete;const Yt={result:At,children:$};$=J().set(dt,Yt)}this.sequenceTree=this.mergeSequenceTrees(this.sequenceTree,$)}this.currentTree=this.sequenceTree}mergeSequenceTrees(t,e){return e.reduce((n,i,a)=>{const o=n.get(a);if(o){const s=this.mergeSequenceTrees(o.children,i.children),c={result:s.size>0?ht.Incomplete:o.result,children:s};return n.set(a,c)}else return n.set(a,i)},t)}handleUserMove(t){const e=this.currentTree.get(t),n=this.isBlackTurn?Q:ft,i=zt(t,n);if(this.playedMoves.push(i),this.currentBoard=Wt(this.currentBoard,i),this.isBlackTurn=!this.isBlackTurn,!e){this.result!==ht.Success&&(this.result=ht.Failure),this.currentTree=J(),this.render();return}this.currentTree=e.children,this.result=e.result,this.render(),e.children.size>0&&setTimeout(()=>this.playComputerResponse(),500)}playComputerResponse(){const t=Array.from(this.currentTree.entries());if(t.length===0)return;const e=Math.floor(Math.random()*t.length),[n,i]=t[e],a=this.isBlackTurn?Q:ft,o=zt(n,a);this.playedMoves.push(o),this.currentBoard=Wt(this.currentBoard,o),this.isBlackTurn=!this.isBlackTurn,this.currentTree=i.children,this.result=i.result,this.render()}reset(){this.currentTree=this.sequenceTree,this.playedMoves=[],this.currentBoard=this.parsedBoard.board,this.isBlackTurn=this.toPlay===Q,this.result=ht.Incomplete,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard;let a=gi(this.currentBoard,e,n);const o=`reset-${Math.random().toString(36).substr(2,9)}`,s="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;";a+='<div style="margin-top: 1rem; display: flex; align-items: center;">',a+=`<button id="${o}" style="${s}">Reset</button>`,this.result===ht.Success?a+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #155724;">Success!</span>':this.result===ht.Failure&&(a+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #721c24;">Incorrect</span>'),a+="</div>",t.innerHTML=a;const u=t.querySelector("svg");u&&(u.style.cursor="pointer",u.addEventListener("click",c=>{const h=c,p=u.getBoundingClientRect(),_=h.clientX-p.left,d=h.clientY-p.top,v=30,I=v,y=Math.round((_-I)/v),m=Math.round((d-I)/v);if(m>=0&&m<e&&y>=0&&y<n){const l=vr(m,y);this.handleUserMove(l)}}));const f=document.getElementById(o);f&&f.addEventListener("click",()=>this.reset())}}class $s{parsedBoard;element;currentBoard;initialBoard;history;currentMoveIndex;isBlackTurn;constructor(t,e){this.element=t,this.parsedBoard=mi(e,{allowEmpty:!0}),this.initialBoard=this.parsedBoard.board,this.currentBoard=this.parsedBoard.board,this.history=[],this.currentMoveIndex=-1,this.isBlackTurn=!0}rebuildBoard(){let t=this.initialBoard;for(let e=0;e<=this.currentMoveIndex;e++){const n=this.history[e];n.type==="move"&&(t=Wt(t,n.move))}if(this.currentBoard=t,this.currentMoveIndex===-1)this.isBlackTurn=!0;else{const e=this.history[this.currentMoveIndex],n=e.type==="move"?e.move.color:e.color;this.isBlackTurn=n===ft}}undo(){this.currentMoveIndex>=0&&(this.currentMoveIndex--,this.rebuildBoard(),this.render())}redo(){this.currentMoveIndex<this.history.length-1&&(this.currentMoveIndex++,this.rebuildBoard(),this.render())}pass(){this.history=this.history.slice(0,this.currentMoveIndex+1);const t=this.isBlackTurn?Q:ft;this.history.push({type:"pass",color:t}),this.currentMoveIndex++,this.isBlackTurn=!this.isBlackTurn,this.render()}reset(){this.history=[],this.currentMoveIndex=-1,this.currentBoard=this.initialBoard,this.isBlackTurn=!0,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard,i=gi(this.currentBoard,e,n),a=`turn-info-${Math.random().toString(36).substr(2,9)}`,o=`undo-${Math.random().toString(36).substr(2,9)}`,s=`redo-${Math.random().toString(36).substr(2,9)}`,u=`pass-${Math.random().toString(36).substr(2,9)}`,f=`reset-${Math.random().toString(36).substr(2,9)}`;let c='<div class="freeplay-container">';c+=`<div id="${a}" style="margin-bottom: 1rem; padding: 0.5rem; font-weight: 600; font-size: 1.1rem;">${this.isBlackTurn?"Black":"White"} to play</div>`,c+=i;const h="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;",p="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #f0f0f0; cursor: not-allowed; font-size: 0.9rem; color: #999;";c+='<div style="margin-top: 1rem;">',c+=`<button id="${o}" style="${this.currentMoveIndex>=0?h:p}" ${this.currentMoveIndex<0?"disabled":""}>← Undo</button>`,c+=`<button id="${s}" style="${this.currentMoveIndex<this.history.length-1?h:p}" ${this.currentMoveIndex>=this.history.length-1?"disabled":""}>Redo →</button>`,c+=`<button id="${u}" style="${h}">Pass</button>`,c+=`<button id="${f}" style="${h}">Reset</button>`,c+="</div>",c+="</div>",t.innerHTML=c;const _=t.querySelector("svg"),d=document.getElementById(o),v=document.getElementById(s),I=document.getElementById(u),y=document.getElementById(f);_&&(_.style.cursor="pointer",_.addEventListener("click",m=>{const l=m,g=_.getBoundingClientRect(),b=l.clientX-g.left,B=l.clientY-g.top,$=30,E=$,dt=Math.round((b-E)/$),Gt=Math.round((B-E)/$);if(Gt>=0&&Gt<e&&dt>=0&&dt<n){const At=vr(Gt,dt),Yt=this.isBlackTurn?Q:ft,Jt=zt(At,Yt);Rs(this.currentBoard,Jt)&&(this.history=this.history.slice(0,this.currentMoveIndex+1),this.history.push({type:"move",move:Jt}),this.currentMoveIndex++,this.rebuildBoard(),this.render())}})),d&&d.addEventListener("click",()=>this.undo()),v&&v.addEventListener("click",()=>this.redo()),I&&I.addEventListener("click",()=>this.pass()),y&&y.addEventListener("click",()=>this.reset())}}const Xf={static:As,freeplay:$s,problem:Cs},Vf="0.0.0",Zf=".godash-diagram";function Qf(r,t){const e=t.split(`
|
|
4
|
-
`);if(e.length===0){r.innerHTML=Fr("Empty diagram source");return}const n=e[0].trim();try{let i;switch(n){case"static":i=new As(r,e);break;case"freeplay":i=new $s(r,e);break;case"problem":i=new Cs(r,e);break;default:r.innerHTML=Fr(`Unsupported diagram type "${n}". Supported types: ${Object.keys(
|
|
3
|
+
`}function Si(r,t,e){const n=r.dimensions,i=t??n,o=e??n,a=30,s=a,u=a*.4,f=n===o,c=n===i,h=(f?o-1:o)*a+s*2,p=(c?i-1:i)*a+s*2;let _=`<svg width="${h}" height="${p}" xmlns="http://www.w3.org/2000/svg">`;_+=`<rect width="${h}" height="${p}" fill="#dcb35c"/>`;const d=o<n,v=i<n,w=s+(d?o:o-1)*a,I=s+(v?i:i-1)*a;for(let l=0;l<o;l++){const g=s+l*a;_+=`<line x1="${g}" y1="${s}" x2="${g}" y2="${I}" stroke="#000" stroke-width="1"/>`}for(let l=0;l<i;l++){const g=s+l*a;_+=`<line x1="${s}" y1="${g}" x2="${w}" y2="${g}" stroke="#000" stroke-width="1"/>`}const y=[];n===9?y.push([2,2],[2,6],[4,4],[6,2],[6,6]):n===13?y.push([3,3],[3,9],[6,6],[9,3],[9,9]):n===19&&y.push([3,3],[3,9],[3,15],[9,3],[9,9],[9,15],[15,3],[15,9],[15,15]);for(const[l,g]of y)if(l<i&&g<o){const A=s+g*a,q=s+l*a;_+=`<circle cx="${A}" cy="${q}" r="3" fill="#000"/>`}for(let l=0;l<i;l++)for(let g=0;g<o;g++){const A=r.moves.get(vr(l,g),yr);if(A!==yr){const q=s+g*a,x=s+l*a;A===tt?_+=`<circle cx="${q}" cy="${x}" r="${u}" fill="#000" stroke="#000" stroke-width="1"/>`:A===ft&&(_+=`<circle cx="${q}" cy="${x}" r="${u}" fill="#fff" stroke="#000" stroke-width="1"/>`)}}return _+="</svg>",_}class ct extends Error{constructor(t){super(t),this.name="ValidationError"}}function wi(r,t){const e={};let n=null,i=!1;for(let o=t;o<r.length;o++){const a=r[o].trim();if(a==="")continue;const s=a.indexOf(":");if(s>0){const u=a.substring(0,s).trim(),f=a.substring(s+1).trim();e[u]=f,n=u,i=f===""}else n&&i&&(Array.isArray(e[n])?e[n].push(a):e[n]=[a])}return e}function bi(r,t={}){const{allowEmpty:e=!1,validateCharacters:n=!0,ignoreRules:i=!1}=t;let o=1;for(;o<r.length&&r[o].trim()==="";)o++;if(o>=r.length)throw new ct("No board definition or options found");const a=[];let s=o;for(let y=o;y<r.length;y++){const l=r[y];if(l.trim()===""){s=y;break}if(l.indexOf(":")>0){s=y;break}a.push(l),s=y+1}const u=wi(r,s);let f;if(u.size){const y=u.size;if(Array.isArray(y))throw new ct("Size option cannot have multiple values");const l=parseInt(y,10);if(isNaN(l)||l<=1||l>19)throw new ct("Size must be a positive integer greater than 1 and less than or equal to 19");f=l}if(a.length===0){if(!e)throw new ct("Board definition is required");if(!f)throw new ct('Empty board requires a "size" option');return{board:mi(f),rowCount:f,columnCount:f,configStartIndex:s,otherMarks:{}}}const c=a.map(y=>y.replace(/\s/g,"").length),h=c[0];if(!c.every(y=>y===h))throw new ct("All board rows must have the same number of non-space characters");const p=a.length,_=a[0].replace(/\s/g,"").length,d=p===_;if(f&&(p>f||_>f))throw new ct(`Board dimensions (${p}x${_}) exceed specified size (${f})`);if(!d&&!f)throw new ct(`Rectangle boards require a "size" option (found ${p}x${_} board)`);f||(f=p);const v=[],w={};for(let y=0;y<a.length;y++){const l=a[y];let g=0;for(let A=0;A<l.length;A++){const q=l[A];if(q===" ")continue;const x=/^[.+XOxo]$/.test(q);if(n&&!x)throw new ct(`Invalid board character '${q}' at row ${y+1}, col ${g+1}. Valid characters: . or + (empty), X or x (black stone), O or o (white stone)`);let b=yr;q==="X"||q==="x"?b=tt:q==="O"||q==="o"?b=ft:q==="."||q==="+"?b=yr:n||(w[q]||(w[q]=[]),w[q].push(vr(y,g))),b!==yr&&v.push(zt(vr(y,g),b)),g++}}let I;if(i){I=mi(f);for(const y of v)I=Vf(I,y.coordinate,y.color)}else I=mi(f,...v);return{board:I,rowCount:p,columnCount:_,configStartIndex:s,otherMarks:w}}const ht={Success:"success",Failure:"failure",Incomplete:"incomplete"};class As{parsedBoard;element;constructor(t,e){this.element=t;let n=1;for(;n<e.length&&e[n].trim()==="";)n++;let i=n;for(let u=n;u<e.length;u++){const f=e[u];if(f.trim()===""||f.indexOf(":")>0){i=u;break}}const a=wi(e,i)["ignore-rules"],s=a==="true"||a==="1";this.parsedBoard=bi(e,{ignoreRules:s})}render(){const t=this.element,{board:e,rowCount:n,columnCount:i}=this.parsedBoard,o=Si(e,n,i);t.innerHTML=o}}class Cs{parsedBoard;element;toPlay;sequenceTree;result;currentTree;playedMoves;currentBoard;isBlackTurn;constructor(t,e){this.element=t;const n=bi(e,{allowEmpty:!1,validateCharacters:!1});for(const[l,g]of Object.entries(n.otherMarks))if(g.length>1)throw new Error(`Mark '${l}' appears at multiple coordinates. Each mark must be unique.`);const i=wi(e,n.configStartIndex),o=i.black,a=i.white,s=o?Array.isArray(o)?o:o.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],u=a?Array.isArray(a)?a:a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],f=new Set(u),c=s.filter(l=>f.has(l));if(c.length>0)throw new Error(`Marks cannot appear in both black and white: ${c.join(", ")}`);const h=new Set(Object.keys(n.otherMarks));for(const l of s)if(!h.has(l))throw new Error(`Black mark '${l}' does not appear in the board`);for(const l of u)if(!h.has(l))throw new Error(`White mark '${l}' does not appear in the board`);const p=i["to-play"],_=p?(Array.isArray(p)?p[0]:p).toLowerCase():"";if(_&&_!=="black"&&_!=="white")throw new Error(`Invalid to-play value '${_}'. Must be 'black' or 'white'`);this.toPlay=_==="white"?ft:tt;let d=n.board;for(const l of s){const g=n.otherMarks[l];for(const A of g)d=Wt(d,zt(A,tt))}for(const l of u){const g=n.otherMarks[l];for(const A of g)d=Wt(d,zt(A,ft))}this.parsedBoard={...n,board:d},this.result=ht.Incomplete,this.currentTree=J(),this.playedMoves=[],this.currentBoard=d,this.isBlackTurn=this.toPlay===tt;const v=(l,g)=>{const A=l.split(">").map(b=>b.trim()).filter(b=>b.length>0);for(const b of A)if(!n.otherMarks[b])throw new Error(`${g} '${l}': mark '${b}' does not appear in the board`);let q=d,x=this.toPlay;for(let b=0;b<A.length;b++){const lt=A[b],At=n.otherMarks[lt][0],Yt=zt(At,x);if(!zs(q,Yt))throw new Error(`${g} '${l}': move ${b+1} (${lt}) is illegal`);try{q=Wt(q,Yt)}catch(Jt){const nc=Jt instanceof Error?Jt.message:String(Jt);throw new Error(`${g} '${l}': move ${b+1} (${lt}) failed - ${nc}`)}x=x===tt?ft:tt}},w=i.solutions,I=[];if(w){const l=Array.isArray(w)?w:[w];for(const g of l)v(g,"Solution"),I.push({sequence:g,isSolution:!0})}const y=i.sequences;if(y){const l=Array.isArray(y)?y:[y];for(const g of l)v(g,"Sequence"),I.push({sequence:g,isSolution:!1})}this.sequenceTree=J();for(const{sequence:l,isSolution:g}of I){const A=l.split(">").map(b=>b.trim()).filter(b=>b.length>0),q=[];for(const b of A)q.push(n.otherMarks[b][0]);let x=J();for(let b=q.length-1;b>=0;b--){const lt=q[b],Gt=b===q.length-1;let At;Gt?At=g?ht.Success:ht.Failure:At=ht.Incomplete;const Yt={result:At,children:x};x=J().set(lt,Yt)}this.sequenceTree=this.mergeSequenceTrees(this.sequenceTree,x)}this.currentTree=this.sequenceTree}mergeSequenceTrees(t,e){return e.reduce((n,i,o)=>{const a=n.get(o);if(a){const s=this.mergeSequenceTrees(a.children,i.children),c={result:s.size>0?ht.Incomplete:a.result,children:s};return n.set(o,c)}else return n.set(o,i)},t)}handleUserMove(t){const e=this.currentTree.get(t),n=this.isBlackTurn?tt:ft,i=zt(t,n);if(this.playedMoves.push(i),this.currentBoard=Wt(this.currentBoard,i),this.isBlackTurn=!this.isBlackTurn,!e){this.result!==ht.Success&&(this.result=ht.Failure),this.currentTree=J(),this.render();return}this.currentTree=e.children,this.result=e.result,this.render(),e.children.size>0&&setTimeout(()=>this.playComputerResponse(),500)}playComputerResponse(){const t=Array.from(this.currentTree.entries());if(t.length===0)return;const e=Math.floor(Math.random()*t.length),[n,i]=t[e],o=this.isBlackTurn?tt:ft,a=zt(n,o);this.playedMoves.push(a),this.currentBoard=Wt(this.currentBoard,a),this.isBlackTurn=!this.isBlackTurn,this.currentTree=i.children,this.result=i.result,this.render()}reset(){this.currentTree=this.sequenceTree,this.playedMoves=[],this.currentBoard=this.parsedBoard.board,this.isBlackTurn=this.toPlay===tt,this.result=ht.Incomplete,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard;let o=Si(this.currentBoard,e,n);const a=`reset-${Math.random().toString(36).substr(2,9)}`,s="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;";o+='<div style="margin-top: 1rem; display: flex; align-items: center;">',o+=`<button id="${a}" style="${s}">Reset</button>`,this.result===ht.Success?o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #155724;">Success!</span>':this.result===ht.Failure&&(o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #721c24;">Incorrect</span>'),o+="</div>",t.innerHTML=o;const u=t.querySelector("svg");u&&(u.style.cursor="pointer",u.addEventListener("click",c=>{const h=c,p=u.getBoundingClientRect(),_=h.clientX-p.left,d=h.clientY-p.top,v=30,w=v,I=Math.round((_-w)/v),y=Math.round((d-w)/v);if(y>=0&&y<e&&I>=0&&I<n){const l=vr(y,I);this.handleUserMove(l)}}));const f=document.getElementById(a);f&&f.addEventListener("click",()=>this.reset())}}class $s{parsedBoard;element;currentBoard;initialBoard;history;currentMoveIndex;isBlackTurn;constructor(t,e){this.element=t,this.parsedBoard=bi(e,{allowEmpty:!0}),this.initialBoard=this.parsedBoard.board,this.currentBoard=this.parsedBoard.board,this.history=[],this.currentMoveIndex=-1,this.isBlackTurn=!0}rebuildBoard(){let t=this.initialBoard;for(let e=0;e<=this.currentMoveIndex;e++){const n=this.history[e];n.type==="move"&&(t=Wt(t,n.move))}if(this.currentBoard=t,this.currentMoveIndex===-1)this.isBlackTurn=!0;else{const e=this.history[this.currentMoveIndex],n=e.type==="move"?e.move.color:e.color;this.isBlackTurn=n===ft}}undo(){this.currentMoveIndex>=0&&(this.currentMoveIndex--,this.rebuildBoard(),this.render())}redo(){this.currentMoveIndex<this.history.length-1&&(this.currentMoveIndex++,this.rebuildBoard(),this.render())}pass(){this.history=this.history.slice(0,this.currentMoveIndex+1);const t=this.isBlackTurn?tt:ft;this.history.push({type:"pass",color:t}),this.currentMoveIndex++,this.isBlackTurn=!this.isBlackTurn,this.render()}reset(){this.history=[],this.currentMoveIndex=-1,this.currentBoard=this.initialBoard,this.isBlackTurn=!0,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard,i=Si(this.currentBoard,e,n),o=`turn-info-${Math.random().toString(36).substr(2,9)}`,a=`undo-${Math.random().toString(36).substr(2,9)}`,s=`redo-${Math.random().toString(36).substr(2,9)}`,u=`pass-${Math.random().toString(36).substr(2,9)}`,f=`reset-${Math.random().toString(36).substr(2,9)}`;let c='<div class="freeplay-container">';c+=`<div id="${o}" style="margin-bottom: 1rem; padding: 0.5rem; font-weight: 600; font-size: 1.1rem;">${this.isBlackTurn?"Black":"White"} to play</div>`,c+=i;const h="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;",p="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #f0f0f0; cursor: not-allowed; font-size: 0.9rem; color: #999;";c+='<div style="margin-top: 1rem;">',c+=`<button id="${a}" style="${this.currentMoveIndex>=0?h:p}" ${this.currentMoveIndex<0?"disabled":""}>← Undo</button>`,c+=`<button id="${s}" style="${this.currentMoveIndex<this.history.length-1?h:p}" ${this.currentMoveIndex>=this.history.length-1?"disabled":""}>Redo →</button>`,c+=`<button id="${u}" style="${h}">Pass</button>`,c+=`<button id="${f}" style="${h}">Reset</button>`,c+="</div>",c+="</div>",t.innerHTML=c;const _=t.querySelector("svg"),d=document.getElementById(a),v=document.getElementById(s),w=document.getElementById(u),I=document.getElementById(f);_&&(_.style.cursor="pointer",_.addEventListener("click",y=>{const l=y,g=_.getBoundingClientRect(),A=l.clientX-g.left,q=l.clientY-g.top,x=30,b=x,lt=Math.round((A-b)/x),Gt=Math.round((q-b)/x);if(Gt>=0&&Gt<e&<>=0&<<n){const At=vr(Gt,lt),Yt=this.isBlackTurn?tt:ft,Jt=zt(At,Yt);zs(this.currentBoard,Jt)&&(this.history=this.history.slice(0,this.currentMoveIndex+1),this.history.push({type:"move",move:Jt}),this.currentMoveIndex++,this.rebuildBoard(),this.render())}})),d&&d.addEventListener("click",()=>this.undo()),v&&v.addEventListener("click",()=>this.redo()),w&&w.addEventListener("click",()=>this.pass()),I&&I.addEventListener("click",()=>this.reset())}}const Zf={static:As,freeplay:$s,problem:Cs},Qf="0.0.0",tc=".godash-diagram";function rc(r,t){const e=t.split(`
|
|
4
|
+
`);if(e.length===0){r.innerHTML=Fr("Empty diagram source");return}const n=e[0].trim();try{let i;switch(n){case"static":i=new As(r,e);break;case"freeplay":i=new $s(r,e);break;case"problem":i=new Cs(r,e);break;default:r.innerHTML=Fr(`Unsupported diagram type "${n}". Supported types: ${Object.keys(Zf).join(", ")}`);return}i.render()}catch(i){i instanceof ct?r.innerHTML=Fr(i.message):r.innerHTML=Fr(i instanceof Error?i.message:String(i))}}function ec(r,t){const e=r??tc,n=document.querySelectorAll(e);if(n.length===0)throw new Error(`No elements found for selector: ${e}`);n.forEach(i=>{const o=t?.diagramSource??i.textContent??"";rc(i,o)})}qt.init=ec,qt.version=Qf,Object.defineProperty(qt,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "godash-diagrams",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A diagramming library for Go, inspired by Mermaid, and built on Godash",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "duckpunch",
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
"url": "git+https://github.com/duckpunch/godash-diagrams.git"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://duckpunch.github.io/godash-diagrams/",
|
|
15
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"go",
|
|
17
|
+
"baduk",
|
|
18
|
+
"weiqi",
|
|
19
|
+
"diagram",
|
|
20
|
+
"mermaid",
|
|
21
|
+
"godash"
|
|
22
|
+
],
|
|
16
23
|
"type": "module",
|
|
17
24
|
"main": "./dist/godash-diagrams.umd.cjs",
|
|
18
25
|
"module": "./dist/godash-diagrams.js",
|
|
@@ -29,7 +36,7 @@
|
|
|
29
36
|
],
|
|
30
37
|
"scripts": {
|
|
31
38
|
"dev": "vite",
|
|
32
|
-
"build": "tsc -p tsconfig.build.json && vite build",
|
|
39
|
+
"build": "tsc -p tsconfig.build.json && vite build && vite build --config vite.config.auto.ts",
|
|
33
40
|
"build:demo": "vite build --config vite.config.demo.ts",
|
|
34
41
|
"preview": "vite preview"
|
|
35
42
|
},
|