text: /****************************************************************************
   * Copyright 2018 EPAM Systems
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *    http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   ***************************************************************************/
  !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.ketcher=t()}}(function(){var t;return function(){function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};e[a][0].call(c.exports,function(t){return o(e[a][1][t]||t)},c,c.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}return t}()({1:[function(t,e,r){(function(t,r){function n(){for(;i.next;){i=i.next;var t=i.task;i.task=void 0;var e=i.domain;e&&(i.domain=void 0,e.enter());try{t()}catch(t){if(l)throw e&&e.exit(),setTimeout(n,0),e&&e.enter(),t;setTimeout(function(){throw t},0)}e&&e.exit()}s=!1}function o(e){a=a.next={task:e,domain:l&&t.domain,next:null},s||(s=!0,u())}var i={task:void 0,next:null},a=i,s=!1,u=void 0,l=!1;if(void 0!==t&&t.nextTick)l=!0,u=function(){t.nextTick(n)};else if("function"==typeof r)u="undefined"!=typeof window?r.bind(window,n):function(){r(n)};else if("undefined"!=typeof MessageChannel){var c=new MessageChannel;c.port1.onmessage=n,u=function(){c.port2.postMessage(0)}}else u=function(){setTimeout(n,0)};e.exports=o}).call(this,t("_process"),t("timers").setImmediate)},{_process:491,timers:518}],2:[function(e,r,n){!function(){"use strict";function e(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o))t.push(e.apply(null,o));else if("object"===i)for(var a in o)n.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}var n={}.hasOwnProperty;void 0!==r&&r.exports?r.exports=e:"function"==typeof t&&"object"==typeof t.amd&&t.amd?t("classnames",[],function(){return e}):window.classNames=e}()},{}],3:[function(t,e,r){e.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],4:[function(t,e,r){var n=t("./_wks")("unscopables"),o=Array.prototype;void 0==o[n]&&t("./_hide")(o,n,{}),e.exports=function(t){o[n][t]=!0}},{"./_hide":37,"./_wks":110}],5:[function(t,e,r){"use strict";var n=t("./_string-at")(!0);e.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},{"./_string-at":90}],6:[function(t,e,r){e.exports=function(t,e,r,n){if(!(t instanceof e)||void 0!==n&&n in t)throw TypeError(r+": incorrect invocation!");return t}},{}],7:[function(t,e,r){var n=t("./_is-object");e.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},{"./_is-object":46}],8:[function(t,e,r){"use strict";var n=t("./_to-object"),o=t("./_to-absolute-index"),i=t("./_to-length");e.exports=[].copyWithin||function(t,e){var r=n(this),a=i(r.length),s=o(t,a),u=o(e,a),l=arguments.length>2?arguments[2]:void 0,c=Math.min((void 0===l?a:o(l,a))-u,a-s),f=1;for(u<s&&s<u+c&&(f=-1,u+=c-1,s+=c-1);c-- >0;)u in r?r[s]=r[u]:delete r[s],s+=f,u+=f;return r}},{"./_to-absolute-index":95,"./_to-length":99,"./_to-object":100}],9:[function(t,e,r){"use strict";var n=t("./_to-object"),o=t("./_to-absolute-index"),i=t("./_to-length");e.exports=function(t){for(var e=n(this),r=i(e.length),a=arguments.length,s=o(a>1?arguments[1]:void 0,r),u=a>2?arguments[2]:void 0,l=void 0===u?r:o(u,r);l>s;)e[s++]=t;return e}},{"./_to-absolute-index":95,"./_to-length":99,"./_to-object":100}],10:[function(t,e,r){var n=t("./_to-iobject"),o=t("./_to-length"),i=t("./_to-absolute-index");e.exports=function(t){return function(e,r,a){var s,u=n(e),l=o(u.length),c=i(a,l);if(t&&r!=r){for(;l>c;)if((s=u[c++])!=s)return!0}else for(;l>c;c++)if((t||c in u)&&u[c]===r)return t||c||0;return!t&&-1}}},{"./_to-absolute-index":95,"./_to-iobject":98,"./_to-length":99}],11:[function(t,e,r){var n=t("./_ctx"),o=t("./_iobject"),i=t("./_to-object"),a=t("./_to-length"),s=t("./_array-species-create");e.exports=function(t,e){var r=1==t,u=2==t,l=3==t,c=4==t,f=6==t,d=5==t||f,p=e||s;return function(e,s,h){for(var m,g,v=i(e),b=o(v),y=n(s,h,3),_=a(b.length),x=0,w=r?p(e,_):u?p(e,0):void 0;_>x;x++)if((d||x in b)&&(m=b[x],g=y(m,x,v),t))if(r)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return x;case 2:w.push(m)}else if(c)return!1;return f?-1:l||c?c:w}}},{"./_array-species-create":13,"./_ctx":22,"./_iobject":42,"./_to-length":99,"./_to-object":100}],12:[function(t,e,r){var n=t("./_is-object"),o=t("./_is-array"),i=t("./_wks")("species");e.exports=function(t){var e;return o(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!o(e.prototype)||(e=void 0),n(e)&&null===(e=e[i])&&(e=void 0)),void 0===e?Array:e}},{"./_is-array":44,"./_is-object":46,"./_wks":110}],13:[function(t,e,r){var n=t("./_array-species-constructor");e.exports=function(t,e){return new(n(t))(e)}},{"./_array-species-constructor":12}],14:[function(t,e,r){"use strict";var n=t("./_a-function"),o=t("./_is-object"),i=t("./_invoke"),a=[].slice,s={},u=function(t,e,r){if(!(e in s)){for(var n=[],o=0;o<e;o++)n[o]="a["+o+"]";s[e]=Function("F,a","return new F("+n.join(",")+")")}return s[e](t,r)};e.exports=Function.bind||function(t){var e=n(this),r=a.call(arguments,1),s=function(){var n=r.concat(a.call(arguments));return this instanceof s?u(e,n.length,n):i(e,n,t)};return o(e.prototype)&&(s.prototype=e.prototype),s}},{"./_a-function":3,"./_invoke":41,"./_is-object":46}],15:[function(t,e,r){var n=t("./_cof"),o=t("./_wks")("toStringTag"),i="Arguments"==n(function(){return arguments}()),a=function(t,e){try{return t[e]}catch(t){}};e.exports=function(t){var e,r,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=a(e=Object(t),o))?r:i?n(e):"Object"==(s=n(e))&&"function"==typeof e.callee?"Arguments":s}},{"./_cof":16,"./_wks":110}],16:[function(t,e,r){var n={}.toString;e.exports=function(t){return n.call(t).slice(8,-1)}},{}],17:[function(t,e,r){"use strict";var n=t("./_object-dp").f,o=t("./_object-create"),i=t("./_redefine-all"),a=t("./_ctx"),s=t("./_an-instance"),u=t("./_for-of"),l=t("./_iter-define"),c=t("./_iter-step"),f=t("./_set-species"),d=t("./_descriptors"),p=t("./_meta").fastKey,h=t("./_validate-collection"),m=d?"_s":"size",g=function(t,e){var r,n=p(e);if("F"!==n)return t._i[n];for(r=t._f;r;r=r.n)if(r.k==e)return r};e.exports={getConstructor:function(t,e,r,l){var c=t(function(t,n){s(t,c,e,"_i"),t._t=e,t._i=o(null),t._f=void 0,t._l=void 0,t[m]=0,void 0!=n&&u(n,r,t[l],t)});return i(c.prototype,{clear:function(){for(var t=h(this,e),r=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];t._f=t._l=void 0,t[m]=0},delete:function(t){var r=h(this,e),n=g(r,t);if(n){var o=n.n,i=n.p;delete r._i[n.i],n.r=!0,i&&(i.n=o),o&&(o.p=i),r._f==n&&(r._f=o),r._l==n&&(r._l=i),r[m]--}return!!n},forEach:function(t){h(this,e);for(var r,n=a(t,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(t){return!!g(h(this,e),t)}}),d&&n(c.prototype,"size",{get:function(){return h(this,e)[m]}}),c},def:function(t,e,r){var n,o,i=g(t,e);return i?i.v=r:(t._l=i={i:o=p(e,!0),k:e,v:r,p:n=t._l,n:void 0,r:!1},t._f||(t._f=i),n&&(n.n=i),t[m]++,"F"!==o&&(t._i[o]=i)),t},getEntry:g,setStrong:function(t,e,r){l(t,e,function(t,r){this._t=h(t,e),this._k=r,this._l=void 0},function(){for(var t=this,e=t._k,r=t._l;r&&r.r;)r=r.p;return t._t&&(t._l=r=r?r.n:t._t._f)?"keys"==e?c(0,r.k):"values"==e?c(0,r.v):c(0,[r.k,r.v]):(t._t=void 0,c(1))},r?"entries":"values",!r,!0),f(e)}}},{"./_an-instance":6,"./_ctx":22,"./_descriptors":24,"./_for-of":33,"./_iter-define":50,"./_iter-step":52,"./_meta":59,"./_object-create":63,"./_object-dp":64,"./_redefine-all":79,"./_set-species":85,"./_validate-collection":107}],18:[function(t,e,r){"use strict";var n=t("./_redefine-all"),o=t("./_meta").getWeak,i=t("./_an-object"),a=t("./_is-object"),s=t("./_an-instance"),u=t("./_for-of"),l=t("./_array-methods"),c=t("./_has"),f=t("./_validate-collection"),d=l(5),p=l(6),h=0,m=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},v=function(t,e){return d(t.a,function(t){return t[0]===e})};g.prototype={get:function(t){var e=v(this,t);if(e)return e[1]},has:function(t){return!!v(this,t)},set:function(t,e){var r=v(this,t);r?r[1]=e:this.a.push([t,e])},delete:function(t){var e=p(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},e.exports={getConstructor:function(t,e,r,i){var l=t(function(t,n){s(t,l,e,"_i"),t._t=e,t._i=h++,t._l=void 0,void 0!=n&&u(n,r,t[i],t)});return n(l.prototype,{delete:function(t){if(!a(t))return!1;var r=o(t);return!0===r?m(f(this,e)).delete(t):r&&c(r,this._i)&&delete r[this._i]},has:function(t){if(!a(t))return!1;var r=o(t);return!0===r?m(f(this,e)).has(t):r&&c(r,this._i)}}),l},def:function(t,e,r){var n=o(i(e),!0);return!0===n?m(t).set(e,r):n[t._i]=r,t},ufstore:m}},{"./_an-instance":6,"./_an-object":7,"./_array-methods":11,"./_for-of":33,"./_has":36,"./_is-object":46,"./_meta":59,"./_redefine-all":79,"./_validate-collection":107}],19:[function(t,e,r){"use strict";var n=t("./_global"),o=t("./_export"),i=t("./_redefine"),a=t("./_redefine-all"),s=t("./_meta"),u=t("./_for-of"),l=t("./_an-instance"),c=t("./_is-object"),f=t("./_fails"),d=t("./_iter-detect"),p=t("./_set-to-string-tag"),h=t("./_inherit-if-required");e.exports=function(t,e,r,m,g,v){var b=n[t],y=b,_=g?"set":"add",x=y&&y.prototype,w={},S=function(t){var e=x[t];i(x,t,"delete"==t?function(t){return!(v&&!c(t))&&e.call(this,0===t?0:t)}:"has"==t?function(t){return!(v&&!c(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return v&&!c(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,r){return e.call(this,0===t?0:t,r),this})};if("function"==typeof y&&(v||x.forEach&&!f(function(){(new y).entries().next()}))){var O=new y,A=O[_](v?{}:-0,1)!=O,E=f(function(){O.has(1)}),j=d(function(t){new y(t)}),P=!v&&f(function(){for(var t=new y,e=5;e--;)t[_](e,e);return!t.has(-0)});j||(y=e(function(e,r){l(e,y,t);var n=h(new b,e,y);return void 0!=r&&u(r,g,n[_],n),n}),y.prototype=x,x.constructor=y),(E||P)&&(S("delete"),S("has"),g&&S("get")),(P||A)&&S(_),v&&x.clear&&delete x.clear}else y=m.getConstructor(e,t,g,_),a(y.prototype,r),s.NEED=!0;return p(y,t),w[t]=y,o(o.G+o.W+o.F*(y!=b),w),v||m.setStrong(y,t,g),y}},{"./_an-instance":6,"./_export":28,"./_fails":30,"./_for-of":33,"./_global":35,"./_inherit-if-required":40,"./_is-object":46,"./_iter-detect":51,"./_meta":59,"./_redefine":80,"./_redefine-all":79,"./_set-to-string-tag":86}],20:[function(t,e,r){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},{}],21:[function(t,e,r){"use strict";var n=t("./_object-dp"),o=t("./_property-desc");e.exports=function(t,e,r){e in t?n.f(t,e,o(0,r)):t[e]=r}},{"./_object-dp":64,"./_property-desc":78}],22:[function(t,e,r){var n=t("./_a-function");e.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},{"./_a-function":3}],23:[function(t,e,r){e.exports=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t}},{}],24:[function(t,e,r){e.exports=!t("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":30}],25:[function(t,e,r){var n=t("./_is-object"),o=t("./_global").document,i=n(o)&&n(o.createElement);e.exports=function(t){return i?o.createElement(t):{}}},{"./_global":35,"./_is-object":46}],26:[function(t,e,r){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],27:[function(t,e,r){var n=t("./_object-keys"),o=t("./_object-gops"),i=t("./_object-pie");e.exports=function(t){var e=n(t),r=o.f;if(r)for(var a,s=r(t),u=i.f,l=0;s.length>l;)u.call(t,a=s[l++])&&e.push(a);return e}},{"./_object-gops":69,"./_object-keys":72,"./_object-pie":73}],28:[function(t,e,r){var n=t("./_global"),o=t("./_core"),i=t("./_hide"),a=t("./_redefine"),s=t("./_ctx"),u=function(t,e,r){var l,c,f,d,p=t&u.F,h=t&u.G,m=t&u.S,g=t&u.P,v=t&u.B,b=h?n:m?n[e]||(n[e]={}):(n[e]||{}).prototype,y=h?o:o[e]||(o[e]={}),_=y.prototype||(y.prototype={});h&&(r=e);for(l in r)c=!p&&b&&void 0!==b[l],f=(c?b:r)[l],d=v&&c?s(f,n):g&&"function"==typeof f?s(Function.call,f):f,b&&a(b,l,f,t&u.U),y[l]!=f&&i(y,l,d),g&&_[l]!=f&&(_[l]=f)};n.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},{"./_core":20,"./_ctx":22,"./_global":35,"./_hide":37,"./_redefine":80}],29:[function(t,e,r){var n=t("./_wks")("match");e.exports=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[n]=!1,!"/./"[t](e)}catch(t){}}return!0}},{"./_wks":110}],30:[function(t,e,r){e.exports=function(t){try{return!!t()}catch(t){return!0}}},{}],31:[function(t,e,r){"use strict";t("./es6.regexp.exec");var n=t("./_redefine"),o=t("./_hide"),i=t("./_fails"),a=t("./_defined"),s=t("./_wks"),u=t("./_regexp-exec"),l=s("species"),c=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();e.exports=function(t,e,r){var d=s(t),p=!i(function(){var e={};return e[d]=function(){return 7},7!=""[t](e)}),h=p?!i(function(){var e=!1,r=/a/;return r.exec=function(){return e=!0,null},"split"===t&&(r.constructor={},r.constructor[l]=function(){return r}),r[d](""),!e}):void 0;if(!p||!h||"replace"===t&&!c||"split"===t&&!f){var m=/./[d],g=r(a,d,""[t],function(t,e,r,n,o){return e.exec===u?p&&!o?{done:!0,value:m.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),v=g[0],b=g[1];n(String.prototype,t,v),o(RegExp.prototype,d,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)})}}},{"./_defined":23,"./_fails":30,"./_hide":37,"./_redefine":80,"./_regexp-exec":82,"./_wks":110,"./es6.regexp.exec":162}],32:[function(t,e,r){"use strict";var n=t("./_an-object");e.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},{"./_an-object":7}],33:[function(t,e,r){var n=t("./_ctx"),o=t("./_iter-call"),i=t("./_is-array-iter"),a=t("./_an-object"),s=t("./_to-length"),u=t("./core.get-iterator-method"),l={},c={},r=e.exports=function(t,e,r,f,d){var p,h,m,g,v=d?function(){return t}:u(t),b=n(r,f,e?2:1),y=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(i(v)){for(p=s(t.length);p>y;y++)if((g=e?b(a(h=t[y])[0],h[1]):b(t[y]))===l||g===c)return g}else for(m=v.call(t);!(h=m.next()).done;)if((g=o(m,b,h.value,e))===l||g===c)return g};r.BREAK=l,r.RETURN=c},{"./_an-object":7,"./_ctx":22,"./_is-array-iter":43,"./_iter-call":48,"./_to-length":99,"./core.get-iterator-method":111}],34:[function(t,e,r){e.exports=t("./_shared")("native-function-to-string",Function.toString)},{"./_shared":88}],35:[function(t,e,r){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],36:[function(t,e,r){var n={}.hasOwnProperty;e.exports=function(t,e){return n.call(t,e)}},{}],37:[function(t,e,r){var n=t("./_object-dp"),o=t("./_property-desc");e.exports=t("./_descriptors")?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},{"./_descriptors":24,"./_object-dp":64,"./_property-desc":78}],38:[function(t,e,r){var n=t("./_global").document;e.exports=n&&n.documentElement},{"./_global":35}],39:[function(t,e,r){e.exports=!t("./_descriptors")&&!t("./_fails")(function(){return 7!=Object.defineProperty(t("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":24,"./_dom-create":25,"./_fails":30}],40:[function(t,e,r){var n=t("./_is-object"),o=t("./_set-proto").set;e.exports=function(t,e,r){var i,a=e.constructor;return a!==r&&"function"==typeof a&&(i=a.prototype)!==r.prototype&&n(i)&&o&&o(t,i),t}},{"./_is-object":46,"./_set-proto":84}],41:[function(t,e,r){e.exports=function(t,e,r){var n=void 0===r;switch(e.length){case 0:return n?t():t.call(r);case 1:return n?t(e[0]):t.call(r,e[0]);case 2:return n?t(e[0],e[1]):t.call(r,e[0],e[1]);case 3:return n?t(e[0],e[1],e[2]):t.call(r,e[0],e[1],e[2]);case 4:return n?t(e[0],e[1],e[2],e[3]):t.call(r,e[0],e[1],e[2],e[3])}return t.apply(r,e)}},{}],42:[function(t,e,r){var n=t("./_cof");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},{"./_cof":16}],43:[function(t,e,r){var n=t("./_iterators"),o=t("./_wks")("iterator"),i=Array.prototype;e.exports=function(t){return void 0!==t&&(n.Array===t||i[o]===t)}},{"./_iterators":53,"./_wks":110}],44:[function(t,e,r){var n=t("./_cof");e.exports=Array.isArray||function(t){return"Array"==n(t)}},{"./_cof":16}],45:[function(t,e,r){var n=t("./_is-object"),o=Math.floor;e.exports=function(t){return!n(t)&&isFinite(t)&&o(t)===t}},{"./_is-object":46}],46:[function(t,e,r){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],47:[function(t,e,r){var n=t("./_is-object"),o=t("./_cof"),i=t("./_wks")("match");e.exports=function(t){var e;return n(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},{"./_cof":16,"./_is-object":46,"./_wks":110}],48:[function(t,e,r){var n=t("./_an-object");e.exports=function(t,e,r,o){try{return o?e(n(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&n(i.call(t)),e}}},{"./_an-object":7}],49:[function(t,e,r){"use strict";var n=t("./_object-create"),o=t("./_property-desc"),i=t("./_set-to-string-tag"),a={};t("./_hide")(a,t("./_wks")("iterator"),function(){return this}),e.exports=function(t,e,r){t.prototype=n(a,{next:o(1,r)}),i(t,e+" Iterator")}},{"./_hide":37,"./_object-create":63,"./_property-desc":78,"./_set-to-string-tag":86,"./_wks":110}],50:[function(t,e,r){"use strict";var n=t("./_library"),o=t("./_export"),i=t("./_redefine"),a=t("./_hide"),s=t("./_iterators"),u=t("./_iter-create"),l=t("./_set-to-string-tag"),c=t("./_object-gpo"),f=t("./_wks")("iterator"),d=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(t,e,r,h,m,g,v){u(r,e,h);var b,y,_,x=function(t){if(!d&&t in A)return A[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},w=e+" Iterator",S="values"==m,O=!1,A=t.prototype,E=A[f]||A["@@iterator"]||m&&A[m],j=E||x(m),P=m?S?x("entries"):j:void 0,T="Array"==e?A.entries||E:E;if(T&&(_=c(T.call(new t)))!==Object.prototype&&_.next&&(l(_,w,!0),n||"function"==typeof _[f]||a(_,f,p)),S&&E&&"values"!==E.name&&(O=!0,j=function(){return E.call(this)}),n&&!v||!d&&!O&&A[f]||a(A,f,j),s[e]=j,s[w]=p,m)if(b={values:S?j:x("values"),keys:g?j:x("keys"),entries:P},v)for(y in b)y in A||i(A,y,b[y]);else o(o.P+o.F*(d||O),e,b);return b}},{"./_export":28,"./_hide":37,"./_iter-create":49,"./_iterators":53,"./_library":54,"./_object-gpo":70,"./_redefine":80,"./_set-to-string-tag":86,"./_wks":110}],51:[function(t,e,r){var n=t("./_wks")("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}e.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i=[7],a=i[n]();a.next=function(){return{done:r=!0}},i[n]=function(){return a},t(i)}catch(t){}return r}},{"./_wks":110}],52:[function(t,e,r){e.exports=function(t,e){return{value:e,done:!!t}}},{}],53:[function(t,e,r){e.exports={}},{}],54:[function(t,e,r){e.exports=!1},{}],55:[function(t,e,r){var n=Math.expm1;e.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:n},{}],56:[function(t,e,r){var n=t("./_math-sign"),o=Math.pow,i=o(2,-52),a=o(2,-23),s=o(2,127)*(2-a),u=o(2,-126),l=function(t){return t+1/i-1/i};e.exports=Math.fround||function(t){var e,r,o=Math.abs(t),c=n(t);return o<u?c*l(o/u/a)*u*a:(e=(1+a/i)*o,r=e-(e-o),r>s||r!=r?c*(1/0):c*r)}},{"./_math-sign":58}],57:[function(t,e,r){e.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},{}],58:[function(t,e,r){e.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},{}],59:[function(t,e,r){var n=t("./_uid")("meta"),o=t("./_is-object"),i=t("./_has"),a=t("./_object-dp").f,s=0,u=Object.isExtensible||function(){return!0},l=!t("./_fails")(function(){return u(Object.preventExtensions({}))}),c=function(t){a(t,n,{value:{i:"O"+ ++s,w:{}}})},f=function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,n)){if(!u(t))return"F";if(!e)return"E";c(t)}return t[n].i},d=function(t,e){if(!i(t,n)){if(!u(t))return!0;if(!e)return!1;c(t)}return t[n].w},p=function(t){return l&&h.NEED&&u(t)&&!i(t,n)&&c(t),t},h=e.exports={KEY:n,NEED:!1,fastKey:f,getWeak:d,onFreeze:p}},{"./_fails":30,"./_has":36,"./_is-object":46,"./_object-dp":64,"./_uid":105}],60:[function(t,e,r){var n=t("./_global"),o=t("./_task").set,i=n.MutationObserver||n.WebKitMutationObserver,a=n.process,s=n.Promise,u="process"==t("./_cof")(a);e.exports=function(){var t,e,r,l=function(){var n,o;for(u&&(n=a.domain)&&n.exit();t;){o=t.fn,t=t.next;try{o()}catch(n){throw t?r():e=void 0,n}}e=void 0,n&&n.enter()};if(u)r=function(){a.nextTick(l)};else if(!i||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var c=s.resolve(void 0);r=function(){c.then(l)}}else r=function(){o.call(n,l)};else{var f=!0,d=document.createTextNode("");new i(l).observe(d,{characterData:!0}),r=function(){d.data=f=!f}}return function(n){var o={fn:n,next:void 0};e&&(e.next=o),t||(t=o,r()),e=o}}},{"./_cof":16,"./_global":35,"./_task":94}],61:[function(t,e,r){"use strict";function n(t){var e,r;this.promise=new t(function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n}),this.resolve=o(e),this.reject=o(r)}var o=t("./_a-function");e.exports.f=function(t){return new n(t)}},{"./_a-function":3}],62:[function(t,e,r){"use strict";var n=t("./_descriptors"),o=t("./_object-keys"),i=t("./_object-gops"),a=t("./_object-pie"),s=t("./_to-object"),u=t("./_iobject"),l=Object.assign;e.exports=!l||t("./_fails")(function(){var t={},e={},r=Symbol(),n="abcdefghijklmnopqrst";return t[r]=7,n.split("").forEach(function(t){e[t]=t}),7!=l({},t)[r]||Object.keys(l({},e)).join("")!=n})?function(t,e){for(var r=s(t),l=arguments.length,c=1,f=i.f,d=a.f;l>c;)for(var p,h=u(arguments[c++]),m=f?o(h).concat(f(h)):o(h),g=m.length,v=0;g>v;)p=m[v++],n&&!d.call(h,p)||(r[p]=h[p]);return r}:l},{"./_descriptors":24,"./_fails":30,"./_iobject":42,"./_object-gops":69,"./_object-keys":72,"./_object-pie":73,"./_to-object":100}],63:[function(t,e,r){var n=t("./_an-object"),o=t("./_object-dps"),i=t("./_enum-bug-keys"),a=t("./_shared-key")("IE_PROTO"),s=function(){},u=function(){var e,r=t("./_dom-create")("iframe"),n=i.length;for(r.style.display="none",t("./_html").appendChild(r),r.src="javascript:",e=r.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;n--;)delete u.prototype[i[n]];return u()};e.exports=Object.create||function(t,e){var r;return null!==t?(s.prototype=n(t),r=new s,s.prototype=null,r[a]=t):r=u(),void 0===e?r:o(r,e)}},{"./_an-object":7,"./_dom-create":25,"./_enum-bug-keys":26,"./_html":38,"./_object-dps":65,"./_shared-key":87}],64:[function(t,e,r){var n=t("./_an-object"),o=t("./_ie8-dom-define"),i=t("./_to-primitive"),a=Object.defineProperty;r.f=t("./_descriptors")?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return a(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},{"./_an-object":7,"./_descriptors":24,"./_ie8-dom-define":39,"./_to-primitive":101}],65:[function(t,e,r){var n=t("./_object-dp"),o=t("./_an-object"),i=t("./_object-keys");e.exports=t("./_descriptors")?Object.defineProperties:function(t,e){o(t);for(var r,a=i(e),s=a.length,u=0;s>u;)n.f(t,r=a[u++],e[r]);return t}},{"./_an-object":7,"./_descriptors":24,"./_object-dp":64,"./_object-keys":72}],66:[function(t,e,r){var n=t("./_object-pie"),o=t("./_property-desc"),i=t("./_to-iobject"),a=t("./_to-primitive"),s=t("./_has"),u=t("./_ie8-dom-define"),l=Object.getOwnPropertyDescriptor;r.f=t("./_descriptors")?l:function(t,e){if(t=i(t),e=a(e,!0),u)try{return l(t,e)}catch(t){}if(s(t,e))return o(!n.f.call(t,e),t[e])}},{"./_descriptors":24,"./_has":36,"./_ie8-dom-define":39,"./_object-pie":73,"./_property-desc":78,"./_to-iobject":98,"./_to-primitive":101}],67:[function(t,e,r){var n=t("./_to-iobject"),o=t("./_object-gopn").f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(t){try{return o(t)}catch(t){return a.slice()}};e.exports.f=function(t){return a&&"[object Window]"==i.call(t)?s(t):o(n(t))}},{"./_object-gopn":68,"./_to-iobject":98}],68:[function(t,e,r){var n=t("./_object-keys-internal"),o=t("./_enum-bug-keys").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},{"./_enum-bug-keys":26,"./_object-keys-internal":71}],69:[function(t,e,r){r.f=Object.getOwnPropertySymbols},{}],70:[function(t,e,r){var n=t("./_has"),o=t("./_to-object"),i=t("./_shared-key")("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(t){return t=o(t),n(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},{"./_has":36,"./_shared-key":87,"./_to-object":100}],71:[function(t,e,r){var n=t("./_has"),o=t("./_to-iobject"),i=t("./_array-includes")(!1),a=t("./_shared-key")("IE_PROTO");e.exports=function(t,e){var r,s=o(t),u=0,l=[];for(r in s)r!=a&&n(s,r)&&l.push(r);for(;e.length>u;)n(s,r=e[u++])&&(~i(l,r)||l.push(r));return l}},{"./_array-includes":10,"./_has":36,"./_shared-key":87,"./_to-iobject":98}],72:[function(t,e,r){var n=t("./_object-keys-internal"),o=t("./_enum-bug-keys");e.exports=Object.keys||function(t){return n(t,o)}},{"./_enum-bug-keys":26,"./_object-keys-internal":71}],73:[function(t,e,r){r.f={}.propertyIsEnumerable},{}],74:[function(t,e,r){var n=t("./_descriptors"),o=t("./_object-keys"),i=t("./_to-iobject"),a=t("./_object-pie").f;e.exports=function(t){return function(e){for(var r,s=i(e),u=o(s),l=u.length,c=0,f=[];l>c;)r=u[c++],n&&!a.call(s,r)||f.push(t?[r,s[r]]:s[r]);return f}}},{"./_descriptors":24,"./_object-keys":72,"./_object-pie":73,"./_to-iobject":98}],75:[function(t,e,r){var n=t("./_object-gopn"),o=t("./_object-gops"),i=t("./_an-object"),a=t("./_global").Reflect;e.exports=a&&a.ownKeys||function(t){var e=n.f(i(t)),r=o.f;return r?e.concat(r(t)):e}},{"./_an-object":7,"./_global":35,"./_object-gopn":68,"./_object-gops":69}],76:[function(t,e,r){e.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],77:[function(t,e,r){var n=t("./_an-object"),o=t("./_is-object"),i=t("./_new-promise-capability");e.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},{"./_an-object":7,"./_is-object":46,"./_new-promise-capability":61}],78:[function(t,e,r){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],79:[function(t,e,r){var n=t("./_redefine");e.exports=function(t,e,r){for(var o in e)n(t,o,e[o],r);return t}},{"./_redefine":80}],80:[function(t,e,r){var n=t("./_global"),o=t("./_hide"),i=t("./_has"),a=t("./_uid")("src"),s=t("./_function-to-string"),u=(""+s).split("toString");t("./_core").inspectSource=function(t){return s.call(t)},(e.exports=function(t,e,r,s){var l="function"==typeof r;l&&(i(r,"name")||o(r,"name",e)),t[e]!==r&&(l&&(i(r,a)||o(r,a,t[e]?""+t[e]:u.join(String(e)))),t===n?t[e]=r:s?t[e]?t[e]=r:o(t,e,r):(delete t[e],o(t,e,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},{"./_core":20,"./_function-to-string":34,"./_global":35,"./_has":36,"./_hide":37,"./_uid":105}],81:[function(t,e,r){"use strict";var n=t("./_classof"),o=RegExp.prototype.exec;e.exports=function(t,e){var r=t.exec;if("function"==typeof r){var i=r.call(t,e);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==n(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},{"./_classof":15}],82:[function(t,e,r){"use strict";var n=t("./_flags"),o=RegExp.prototype.exec,i=String.prototype.replace,a=o,s=function(){var t=/a/,e=/b*/g;return o.call(t,"a"),o.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),u=void 0!==/()??/.exec("")[1];(s||u)&&(a=function(t){var e,r,a,l,c=this;return u&&(r=new RegExp("^"+c.source+"$(?!\\s)",n.call(c))),s&&(e=c.lastIndex),a=o.call(c,t),s&&a&&(c.lastIndex=c.global?a.index+a[0].length:e),u&&a&&a.length>1&&i.call(a[0],r,function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(a[l]=void 0)}),a}),e.exports=a},{"./_flags":32}],83:[function(t,e,r){e.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},{}],84:[function(t,e,r){var n=t("./_is-object"),o=t("./_an-object"),i=function(t,e){if(o(t),!n(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,r,n){try{n=t("./_ctx")(Function.call,t("./_object-gopd").f(Object.prototype,"__proto__").set,2),n(e,[]),r=!(e instanceof Array)}catch(t){r=!0}return function(t,e){return i(t,e),r?t.__proto__=e:n(t,e),t}}({},!1):void 0),check:i}},{"./_an-object":7,"./_ctx":22,"./_is-object":46,"./_object-gopd":66}],85:[function(t,e,r){"use strict";var n=t("./_global"),o=t("./_object-dp"),i=t("./_descriptors"),a=t("./_wks")("species");e.exports=function(t){var e=n[t];i&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},{"./_descriptors":24,"./_global":35,"./_object-dp":64,"./_wks":110}],86:[function(t,e,r){var n=t("./_object-dp").f,o=t("./_has"),i=t("./_wks")("toStringTag");e.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},{"./_has":36,"./_object-dp":64,"./_wks":110}],87:[function(t,e,r){var n=t("./_shared")("keys"),o=t("./_uid");e.exports=function(t){return n[t]||(n[t]=o(t))}},{"./_shared":88,"./_uid":105}],88:[function(t,e,r){var n=t("./_core"),o=t("./_global"),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(e.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:t("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},{"./_core":20,"./_global":35,"./_library":54}],89:[function(t,e,r){var n=t("./_an-object"),o=t("./_a-function"),i=t("./_wks")("species");e.exports=function(t,e){var r,a=n(t).constructor;return void 0===a||void 0==(r=n(a)[i])?e:o(r)}},{"./_a-function":3,"./_an-object":7,"./_wks":110}],90:[function(t,e,r){var n=t("./_to-integer"),o=t("./_defined");e.exports=function(t){return function(e,r){var i,a,s=String(o(e)),u=n(r),l=s.length;return u<0||u>=l?t?"":void 0:(i=s.charCodeAt(u),i<55296||i>56319||u+1===l||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):i:t?s.slice(u,u+2):a-56320+(i-55296<<10)+65536)}}},{"./_defined":23,"./_to-integer":97}],91:[function(t,e,r){var n=t("./_is-regexp"),o=t("./_defined");e.exports=function(t,e,r){if(n(e))throw TypeError("String#"+r+" doesn't accept regex!");return String(o(t))}},{"./_defined":23,"./_is-regexp":47}],92:[function(t,e,r){var n=t("./_to-length"),o=t("./_string-repeat"),i=t("./_defined");e.exports=function(t,e,r,a){var s=String(i(t)),u=s.length,l=void 0===r?" ":String(r),c=n(e);if(c<=u||""==l)return s;var f=c-u,d=o.call(l,Math.ceil(f/l.length));return d.length>f&&(d=d.slice(0,f)),a?d+s:s+d}},{"./_defined":23,"./_string-repeat":93,"./_to-length":99}],93:[function(t,e,r){"use strict";var n=t("./_to-integer"),o=t("./_defined");e.exports=function(t){var e=String(o(this)),r="",i=n(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(e+=e))1&i&&(r+=e);return r}},{"./_defined":23,"./_to-integer":97}],
  94:[function(t,e,r){var n,o,i,a=t("./_ctx"),s=t("./_invoke"),u=t("./_html"),l=t("./_dom-create"),c=t("./_global"),f=c.process,d=c.setImmediate,p=c.clearImmediate,h=c.MessageChannel,m=c.Dispatch,g=0,v={},b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};d&&p||(d=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return v[++g]=function(){s("function"==typeof t?t:Function(t),e)},n(g),g},p=function(t){delete v[t]},"process"==t("./_cof")(f)?n=function(t){f.nextTick(a(b,t,1))}:m&&m.now?n=function(t){m.now(a(b,t,1))}:h?(o=new h,i=o.port2,o.port1.onmessage=y,n=a(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(t){c.postMessage(t+"","*")},c.addEventListener("message",y,!1)):n="onreadystatechange"in l("script")?function(t){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),b.call(t)}}:function(t){setTimeout(a(b,t,1),0)}),e.exports={set:d,clear:p}},{"./_cof":16,"./_ctx":22,"./_dom-create":25,"./_global":35,"./_html":38,"./_invoke":41}],95:[function(t,e,r){var n=t("./_to-integer"),o=Math.max,i=Math.min;e.exports=function(t,e){return t=n(t),t<0?o(t+e,0):i(t,e)}},{"./_to-integer":97}],96:[function(t,e,r){var n=t("./_to-integer"),o=t("./_to-length");e.exports=function(t){if(void 0===t)return 0;var e=n(t),r=o(e);if(e!==r)throw RangeError("Wrong length!");return r}},{"./_to-integer":97,"./_to-length":99}],97:[function(t,e,r){var n=Math.ceil,o=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?o:n)(t)}},{}],98:[function(t,e,r){var n=t("./_iobject"),o=t("./_defined");e.exports=function(t){return n(o(t))}},{"./_defined":23,"./_iobject":42}],99:[function(t,e,r){var n=t("./_to-integer"),o=Math.min;e.exports=function(t){return t>0?o(n(t),9007199254740991):0}},{"./_to-integer":97}],100:[function(t,e,r){var n=t("./_defined");e.exports=function(t){return Object(n(t))}},{"./_defined":23}],101:[function(t,e,r){var n=t("./_is-object");e.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":46}],102:[function(t,e,r){"use strict";if(t("./_descriptors")){var n=t("./_library"),o=t("./_global"),i=t("./_fails"),a=t("./_export"),s=t("./_typed"),u=t("./_typed-buffer"),l=t("./_ctx"),c=t("./_an-instance"),f=t("./_property-desc"),d=t("./_hide"),p=t("./_redefine-all"),h=t("./_to-integer"),m=t("./_to-length"),g=t("./_to-index"),v=t("./_to-absolute-index"),b=t("./_to-primitive"),y=t("./_has"),_=t("./_classof"),x=t("./_is-object"),w=t("./_to-object"),S=t("./_is-array-iter"),O=t("./_object-create"),A=t("./_object-gpo"),E=t("./_object-gopn").f,j=t("./core.get-iterator-method"),P=t("./_uid"),T=t("./_wks"),C=t("./_array-methods"),k=t("./_array-includes"),M=t("./_species-constructor"),R=t("./es6.array.iterator"),N=t("./_iterators"),I=t("./_iter-detect"),B=t("./_set-species"),L=t("./_array-fill"),D=t("./_array-copy-within"),F=t("./_object-dp"),G=t("./_object-gopd"),z=F.f,H=G.f,W=o.RangeError,U=o.TypeError,V=o.Uint8Array,q=Array.prototype,K=u.ArrayBuffer,Y=u.DataView,$=C(0),X=C(2),Z=C(3),Q=C(4),J=C(5),tt=C(6),et=k(!0),rt=k(!1),nt=R.values,ot=R.keys,it=R.entries,at=q.lastIndexOf,st=q.reduce,ut=q.reduceRight,lt=q.join,ct=q.sort,ft=q.slice,dt=q.toString,pt=q.toLocaleString,ht=T("iterator"),mt=T("toStringTag"),gt=P("typed_constructor"),vt=P("def_constructor"),bt=s.CONSTR,yt=s.TYPED,_t=s.VIEW,xt=C(1,function(t,e){return Et(M(t,t[vt]),e)}),wt=i(function(){return 1===new V(new Uint16Array([1]).buffer)[0]}),St=!!V&&!!V.prototype.set&&i(function(){new V(1).set({})}),Ot=function(t,e){var r=h(t);if(r<0||r%e)throw W("Wrong offset!");return r},At=function(t){if(x(t)&&yt in t)return t;throw U(t+" is not a typed array!")},Et=function(t,e){if(!(x(t)&&gt in t))throw U("It is not a typed array constructor!");return new t(e)},jt=function(t,e){return Pt(M(t,t[vt]),e)},Pt=function(t,e){for(var r=0,n=e.length,o=Et(t,n);n>r;)o[r]=e[r++];return o},Tt=function(t,e,r){z(t,e,{get:function(){return this._d[r]}})},Ct=function(t){var e,r,n,o,i,a,s=w(t),u=arguments.length,c=u>1?arguments[1]:void 0,f=void 0!==c,d=j(s);if(void 0!=d&&!S(d)){for(a=d.call(s),n=[],e=0;!(i=a.next()).done;e++)n.push(i.value);s=n}for(f&&u>2&&(c=l(c,arguments[2],2)),e=0,r=m(s.length),o=Et(this,r);r>e;e++)o[e]=f?c(s[e],e):s[e];return o},kt=function(){for(var t=0,e=arguments.length,r=Et(this,e);e>t;)r[t]=arguments[t++];return r},Mt=!!V&&i(function(){pt.call(new V(1))}),Rt=function(){return pt.apply(Mt?ft.call(At(this)):At(this),arguments)},Nt={copyWithin:function(t,e){return D.call(At(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return Q(At(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return L.apply(At(this),arguments)},filter:function(t){return jt(this,X(At(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return J(At(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(At(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){$(At(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return rt(At(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return et(At(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return lt.apply(At(this),arguments)},lastIndexOf:function(t){return at.apply(At(this),arguments)},map:function(t){return xt(At(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return st.apply(At(this),arguments)},reduceRight:function(t){return ut.apply(At(this),arguments)},reverse:function(){for(var t,e=this,r=At(e).length,n=Math.floor(r/2),o=0;o<n;)t=e[o],e[o++]=e[--r],e[r]=t;return e},some:function(t){return Z(At(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return ct.call(At(this),t)},subarray:function(t,e){var r=At(this),n=r.length,o=v(t,n);return new(M(r,r[vt]))(r.buffer,r.byteOffset+o*r.BYTES_PER_ELEMENT,m((void 0===e?n:v(e,n))-o))}},It=function(t,e){return jt(this,ft.call(At(this),t,e))},Bt=function(t){At(this);var e=Ot(arguments[1],1),r=this.length,n=w(t),o=m(n.length),i=0;if(o+e>r)throw W("Wrong length!");for(;i<o;)this[e+i]=n[i++]},Lt={entries:function(){return it.call(At(this))},keys:function(){return ot.call(At(this))},values:function(){return nt.call(At(this))}},Dt=function(t,e){return x(t)&&t[yt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Ft=function(t,e){return Dt(t,e=b(e,!0))?f(2,t[e]):H(t,e)},Gt=function(t,e,r){return!(Dt(t,e=b(e,!0))&&x(r)&&y(r,"value"))||y(r,"get")||y(r,"set")||r.configurable||y(r,"writable")&&!r.writable||y(r,"enumerable")&&!r.enumerable?z(t,e,r):(t[e]=r.value,t)};bt||(G.f=Ft,F.f=Gt),a(a.S+a.F*!bt,"Object",{getOwnPropertyDescriptor:Ft,defineProperty:Gt}),i(function(){dt.call({})})&&(dt=pt=function(){return lt.call(this)});var zt=p({},Nt);p(zt,Lt),d(zt,ht,Lt.values),p(zt,{slice:It,set:Bt,constructor:function(){},toString:dt,toLocaleString:Rt}),Tt(zt,"buffer","b"),Tt(zt,"byteOffset","o"),Tt(zt,"byteLength","l"),Tt(zt,"length","e"),z(zt,mt,{get:function(){return this[yt]}}),e.exports=function(t,e,r,u){u=!!u;var l=t+(u?"Clamped":"")+"Array",f="get"+t,p="set"+t,h=o[l],v=h||{},b=h&&A(h),y=!h||!s.ABV,w={},S=h&&h.prototype,j=function(t,r){var n=t._d;return n.v[f](r*e+n.o,wt)},P=function(t,r,n){var o=t._d;u&&(n=(n=Math.round(n))<0?0:n>255?255:255&n),o.v[p](r*e+o.o,n,wt)},T=function(t,e){z(t,e,{get:function(){return j(this,e)},set:function(t){return P(this,e,t)},enumerable:!0})};y?(h=r(function(t,r,n,o){c(t,h,l,"_d");var i,a,s,u,f=0,p=0;if(x(r)){if(!(r instanceof K||"ArrayBuffer"==(u=_(r))||"SharedArrayBuffer"==u))return yt in r?Pt(h,r):Ct.call(h,r);i=r,p=Ot(n,e);var v=r.byteLength;if(void 0===o){if(v%e)throw W("Wrong length!");if((a=v-p)<0)throw W("Wrong length!")}else if((a=m(o)*e)+p>v)throw W("Wrong length!");s=a/e}else s=g(r),a=s*e,i=new K(a);for(d(t,"_d",{b:i,o:p,l:a,e:s,v:new Y(i)});f<s;)T(t,f++)}),S=h.prototype=O(zt),d(S,"constructor",h)):i(function(){h(1)})&&i(function(){new h(-1)})&&I(function(t){new h,new h(null),new h(1.5),new h(t)},!0)||(h=r(function(t,r,n,o){c(t,h,l);var i;return x(r)?r instanceof K||"ArrayBuffer"==(i=_(r))||"SharedArrayBuffer"==i?void 0!==o?new v(r,Ot(n,e),o):void 0!==n?new v(r,Ot(n,e)):new v(r):yt in r?Pt(h,r):Ct.call(h,r):new v(g(r))}),$(b!==Function.prototype?E(v).concat(E(b)):E(v),function(t){t in h||d(h,t,v[t])}),h.prototype=S,n||(S.constructor=h));var C=S[ht],k=!!C&&("values"==C.name||void 0==C.name),M=Lt.values;d(h,gt,!0),d(S,yt,l),d(S,_t,!0),d(S,vt,h),(u?new h(1)[mt]==l:mt in S)||z(S,mt,{get:function(){return l}}),w[l]=h,a(a.G+a.W+a.F*(h!=v),w),a(a.S,l,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*i(function(){v.of.call(h,1)}),l,{from:Ct,of:kt}),"BYTES_PER_ELEMENT"in S||d(S,"BYTES_PER_ELEMENT",e),a(a.P,l,Nt),B(l),a(a.P+a.F*St,l,{set:Bt}),a(a.P+a.F*!k,l,Lt),n||S.toString==dt||(S.toString=dt),a(a.P+a.F*i(function(){new h(1).slice()}),l,{slice:It}),a(a.P+a.F*(i(function(){return[1,2].toLocaleString()!=new h([1,2]).toLocaleString()})||!i(function(){S.toLocaleString.call([1,2])})),l,{toLocaleString:Rt}),N[l]=k?C:M,n||k||d(S,ht,M)}}else e.exports=function(){}},{"./_an-instance":6,"./_array-copy-within":8,"./_array-fill":9,"./_array-includes":10,"./_array-methods":11,"./_classof":15,"./_ctx":22,"./_descriptors":24,"./_export":28,"./_fails":30,"./_global":35,"./_has":36,"./_hide":37,"./_is-array-iter":43,"./_is-object":46,"./_iter-detect":51,"./_iterators":53,"./_library":54,"./_object-create":63,"./_object-dp":64,"./_object-gopd":66,"./_object-gopn":68,"./_object-gpo":70,"./_property-desc":78,"./_redefine-all":79,"./_set-species":85,"./_species-constructor":89,"./_to-absolute-index":95,"./_to-index":96,"./_to-integer":97,"./_to-length":99,"./_to-object":100,"./_to-primitive":101,"./_typed":104,"./_typed-buffer":103,"./_uid":105,"./_wks":110,"./core.get-iterator-method":111,"./es6.array.iterator":117}],103:[function(t,e,r){"use strict";function n(t,e,r){var n,o,i,a=new Array(r),s=8*r-e-1,u=(1<<s)-1,l=u>>1,c=23===e?D(2,-24)-D(2,-77):0,f=0,d=t<0||0===t&&1/t<0?1:0;for(t=L(t),t!=t||t===I?(o=t!=t?1:0,n=u):(n=F(G(t)/z),t*(i=D(2,-n))<1&&(n--,i*=2),t+=n+l>=1?c/i:c*D(2,1-l),t*i>=2&&(n++,i/=2),n+l>=u?(o=0,n=u):n+l>=1?(o=(t*i-1)*D(2,e),n+=l):(o=t*D(2,l-1)*D(2,e),n=0));e>=8;a[f++]=255&o,o/=256,e-=8);for(n=n<<e|o,s+=e;s>0;a[f++]=255&n,n/=256,s-=8);return a[--f]|=128*d,a}function o(t,e,r){var n,o=8*r-e-1,i=(1<<o)-1,a=i>>1,s=o-7,u=r-1,l=t[u--],c=127&l;for(l>>=7;s>0;c=256*c+t[u],u--,s-=8);for(n=c&(1<<-s)-1,c>>=-s,s+=e;s>0;n=256*n+t[u],u--,s-=8);if(0===c)c=1-a;else{if(c===i)return n?NaN:l?-I:I;n+=D(2,e),c-=a}return(l?-1:1)*n*D(2,c-e)}function i(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function a(t){return[255&t]}function s(t){return[255&t,t>>8&255]}function u(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function l(t){return n(t,52,8)}function c(t){return n(t,23,4)}function f(t,e,r){E(t[T],e,{get:function(){return this[r]}})}function d(t,e,r,n){var o=+r,i=O(o);if(i+e>t[W])throw N(C);var a=t[H]._b,s=i+t[U],u=a.slice(s,s+e);return n?u:u.reverse()}function p(t,e,r,n,o,i){var a=+r,s=O(a);if(s+e>t[W])throw N(C);for(var u=t[H]._b,l=s+t[U],c=n(+o),f=0;f<e;f++)u[l+f]=c[i?f:e-f-1]}var h=t("./_global"),m=t("./_descriptors"),g=t("./_library"),v=t("./_typed"),b=t("./_hide"),y=t("./_redefine-all"),_=t("./_fails"),x=t("./_an-instance"),w=t("./_to-integer"),S=t("./_to-length"),O=t("./_to-index"),A=t("./_object-gopn").f,E=t("./_object-dp").f,j=t("./_array-fill"),P=t("./_set-to-string-tag"),T="prototype",C="Wrong index!",k=h.ArrayBuffer,M=h.DataView,R=h.Math,N=h.RangeError,I=h.Infinity,B=k,L=R.abs,D=R.pow,F=R.floor,G=R.log,z=R.LN2,H=m?"_b":"buffer",W=m?"_l":"byteLength",U=m?"_o":"byteOffset";if(v.ABV){if(!_(function(){k(1)})||!_(function(){new k(-1)})||_(function(){return new k,new k(1.5),new k(NaN),"ArrayBuffer"!=k.name})){k=function(t){return x(this,k),new B(O(t))};for(var V,q=k[T]=B[T],K=A(B),Y=0;K.length>Y;)(V=K[Y++])in k||b(k,V,B[V]);g||(q.constructor=k)}var $=new M(new k(2)),X=M[T].setInt8;$.setInt8(0,2147483648),$.setInt8(1,2147483649),!$.getInt8(0)&&$.getInt8(1)||y(M[T],{setInt8:function(t,e){X.call(this,t,e<<24>>24)},setUint8:function(t,e){X.call(this,t,e<<24>>24)}},!0)}else k=function(t){x(this,k,"ArrayBuffer");var e=O(t);this._b=j.call(new Array(e),0),this[W]=e},M=function(t,e,r){x(this,M,"DataView"),x(t,k,"DataView");var n=t[W],o=w(e);if(o<0||o>n)throw N("Wrong offset!");if(r=void 0===r?n-o:S(r),o+r>n)throw N("Wrong length!");this[H]=t,this[U]=o,this[W]=r},m&&(f(k,"byteLength","_l"),f(M,"buffer","_b"),f(M,"byteLength","_l"),f(M,"byteOffset","_o")),y(M[T],{getInt8:function(t){return d(this,1,t)[0]<<24>>24},getUint8:function(t){return d(this,1,t)[0]},getInt16:function(t){var e=d(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=d(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return i(d(this,4,t,arguments[1]))},getUint32:function(t){return i(d(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return o(d(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return o(d(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){p(this,1,t,a,e)},setUint8:function(t,e){p(this,1,t,a,e)},setInt16:function(t,e){p(this,2,t,s,e,arguments[2])},setUint16:function(t,e){p(this,2,t,s,e,arguments[2])},setInt32:function(t,e){p(this,4,t,u,e,arguments[2])},setUint32:function(t,e){p(this,4,t,u,e,arguments[2])},setFloat32:function(t,e){p(this,4,t,c,e,arguments[2])},setFloat64:function(t,e){p(this,8,t,l,e,arguments[2])}});P(k,"ArrayBuffer"),P(M,"DataView"),b(M[T],v.VIEW,!0),r.ArrayBuffer=k,r.DataView=M},{"./_an-instance":6,"./_array-fill":9,"./_descriptors":24,"./_fails":30,"./_global":35,"./_hide":37,"./_library":54,"./_object-dp":64,"./_object-gopn":68,"./_redefine-all":79,"./_set-to-string-tag":86,"./_to-index":96,"./_to-integer":97,"./_to-length":99,"./_typed":104}],104:[function(t,e,r){for(var n,o=t("./_global"),i=t("./_hide"),a=t("./_uid"),s=a("typed_array"),u=a("view"),l=!(!o.ArrayBuffer||!o.DataView),c=l,f=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(n=o[d[f++]])?(i(n.prototype,s,!0),i(n.prototype,u,!0)):c=!1;e.exports={ABV:l,CONSTR:c,TYPED:s,VIEW:u}},{"./_global":35,"./_hide":37,"./_uid":105}],105:[function(t,e,r){var n=0,o=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+o).toString(36))}},{}],106:[function(t,e,r){var n=t("./_global"),o=n.navigator;e.exports=o&&o.userAgent||""},{"./_global":35}],107:[function(t,e,r){var n=t("./_is-object");e.exports=function(t,e){if(!n(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},{"./_is-object":46}],108:[function(t,e,r){var n=t("./_global"),o=t("./_core"),i=t("./_library"),a=t("./_wks-ext"),s=t("./_object-dp").f;e.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:n.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},{"./_core":20,"./_global":35,"./_library":54,"./_object-dp":64,"./_wks-ext":109}],109:[function(t,e,r){r.f=t("./_wks")},{"./_wks":110}],110:[function(t,e,r){var n=t("./_shared")("wks"),o=t("./_uid"),i=t("./_global").Symbol,a="function"==typeof i;(e.exports=function(t){return n[t]||(n[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=n},{"./_global":35,"./_shared":88,"./_uid":105}],111:[function(t,e,r){var n=t("./_classof"),o=t("./_wks")("iterator"),i=t("./_iterators");e.exports=t("./_core").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[n(t)]}},{"./_classof":15,"./_core":20,"./_iterators":53,"./_wks":110}],112:[function(t,e,r){var n=t("./_export");n(n.P,"Array",{copyWithin:t("./_array-copy-within")}),t("./_add-to-unscopables")("copyWithin")},{"./_add-to-unscopables":4,"./_array-copy-within":8,"./_export":28}],113:[function(t,e,r){var n=t("./_export");n(n.P,"Array",{fill:t("./_array-fill")}),t("./_add-to-unscopables")("fill")},{"./_add-to-unscopables":4,"./_array-fill":9,"./_export":28}],114:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_array-methods")(6),i="findIndex",a=!0;i in[]&&Array(1)[i](function(){a=!1}),n(n.P+n.F*a,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")(i)},{"./_add-to-unscopables":4,"./_array-methods":11,"./_export":28}],115:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_array-methods")(5),i=!0;"find"in[]&&Array(1).find(function(){i=!1}),n(n.P+n.F*i,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")("find")},{"./_add-to-unscopables":4,"./_array-methods":11,"./_export":28}],116:[function(t,e,r){"use strict";var n=t("./_ctx"),o=t("./_export"),i=t("./_to-object"),a=t("./_iter-call"),s=t("./_is-array-iter"),u=t("./_to-length"),l=t("./_create-property"),c=t("./core.get-iterator-method");o(o.S+o.F*!t("./_iter-detect")(function(t){Array.from(t)}),"Array",{from:function(t){var e,r,o,f,d=i(t),p="function"==typeof this?this:Array,h=arguments.length,m=h>1?arguments[1]:void 0,g=void 0!==m,v=0,b=c(d);if(g&&(m=n(m,h>2?arguments[2]:void 0,2)),void 0==b||p==Array&&s(b))for(e=u(d.length),r=new p(e);e>v;v++)l(r,v,g?m(d[v],v):d[v]);else for(f=b.call(d),r=new p;!(o=f.next()).done;v++)l(r,v,g?a(f,m,[o.value,v],!0):o.value);return r.length=v,r}})},{"./_create-property":21,"./_ctx":22,"./_export":28,"./_is-array-iter":43,"./_iter-call":48,"./_iter-detect":51,"./_to-length":99,"./_to-object":100,"./core.get-iterator-method":111}],117:[function(t,e,r){"use strict";var n=t("./_add-to-unscopables"),o=t("./_iter-step"),i=t("./_iterators"),a=t("./_to-iobject");e.exports=t("./_iter-define")(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):"keys"==e?o(0,r):"values"==e?o(0,t[r]):o(0,[r,t[r]])},"values"),i.Arguments=i.Array,n("keys"),n("values"),n("entries")},{"./_add-to-unscopables":4,"./_iter-define":50,"./_iter-step":52,"./_iterators":53,"./_to-iobject":98}],118:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_create-property");n(n.S+n.F*t("./_fails")(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,r=new("function"==typeof this?this:Array)(e);e>t;)o(r,t,arguments[t++]);return r.length=e,r}})},{"./_create-property":21,"./_export":28,"./_fails":30}],119:[function(t,e,r){var n=t("./_object-dp").f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||t("./_descriptors")&&n(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},{"./_descriptors":24,"./_object-dp":64}],120:[function(t,e,r){"use strict";var n=t("./_collection-strong"),o=t("./_validate-collection");e.exports=t("./_collection")("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=n.getEntry(o(this,"Map"),t);return e&&e.v},set:function(t,e){return n.def(o(this,"Map"),0===t?0:t,e)}},n,!0)},{"./_collection":19,"./_collection-strong":17,"./_validate-collection":107}],121:[function(t,e,r){var n=t("./_export"),o=t("./_math-log1p"),i=Math.sqrt,a=Math.acosh;n(n.S+n.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},{"./_export":28,"./_math-log1p":57}],122:[function(t,e,r){function n(t){return isFinite(t=+t)&&0!=t?t<0?-n(-t):Math.log(t+Math.sqrt(t*t+1)):t}var o=t("./_export"),i=Math.asinh;o(o.S+o.F*!(i&&1/i(0)>0),"Math",{asinh:n})},{"./_export":28}],123:[function(t,e,r){var n=t("./_export"),o=Math.atanh;n(n.S+n.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},{"./_export":28}],124:[function(t,e,r){var n=t("./_export"),o=t("./_math-sign");n(n.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},{"./_export":28,"./_math-sign":58}],125:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{"./_export":28}],126:[function(t,e,r){var n=t("./_export"),o=Math.exp;n(n.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},{"./_export":28}],127:[function(t,e,r){var n=t("./_export"),o=t("./_math-expm1");n(n.S+n.F*(o!=Math.expm1),"Math",{expm1:o})},{"./_export":28,"./_math-expm1":55}],128:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{fround:t("./_math-fround")})},{"./_export":28,"./_math-fround":56}],129:[function(t,e,r){var n=t("./_export"),o=Math.abs;n(n.S,"Math",{hypot:function(t,e){for(var r,n,i=0,a=0,s=arguments.length,u=0;a<s;)r=o(arguments[a++]),u<r?(n=u/r,i=i*n*n+1,u=r):r>0?(n=r/u,i+=n*n):i+=r;return u===1/0?1/0:u*Math.sqrt(i)}})},{"./_export":28}],130:[function(t,e,r){var n=t("./_export"),o=Math.imul;n(n.S+n.F*t("./_fails")(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(t,e){var r=+t,n=+e,o=65535&r,i=65535&n;return 0|o*i+((65535&r>>>16)*i+o*(65535&n>>>16)<<16>>>0)}})},{"./_export":28,"./_fails":30}],131:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},{"./_export":28}],132:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{log1p:t("./_math-log1p")})},{"./_export":28,"./_math-log1p":57}],133:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},{"./_export":28}],134:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{sign:t("./_math-sign")})},{"./_export":28,"./_math-sign":58}],135:[function(t,e,r){var n=t("./_export"),o=t("./_math-expm1"),i=Math.exp;n(n.S+n.F*t("./_fails")(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},{"./_export":28,"./_fails":30,"./_math-expm1":55}],136:[function(t,e,r){var n=t("./_export"),o=t("./_math-expm1"),i=Math.exp;n(n.S,"Math",{tanh:function(t){var e=o(t=+t),r=o(-t);return e==1/0?1:r==1/0?-1:(e-r)/(i(t)+i(-t))}})},{"./_export":28,"./_math-expm1":55}],137:[function(t,e,r){var n=t("./_export");n(n.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},{"./_export":28}],138:[function(t,e,r){var n=t("./_export");n(n.S,"Number",{EPSILON:Math.pow(2,-52)})},{"./_export":28}],139:[function(t,e,r){var n=t("./_export"),o=t("./_global").isFinite;n(n.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},{"./_export":28,"./_global":35}],140:[function(t,e,r){var n=t("./_export");n(n.S,"Number",{isInteger:t("./_is-integer")})},{"./_export":28,"./_is-integer":45}],141:[function(t,e,r){var n=t("./_export");n(n.S,"Number",{isNaN:function(t){return t!=t}})},{"./_export":28}],142:[function(t,e,r){var n=t("./_export"),o=t("./_is-integer"),i=Math.abs;n(n.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},{"./_export":28,"./_is-integer":45}],143:[function(t,e,r){var n=t("./_export");n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{"./_export":28}],144:[function(t,e,r){var n=t("./_export");n(n.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{"./_export":28}],145:[function(t,e,r){var n=t("./_export");n(n.S+n.F,"Object",{assign:t("./_object-assign")})},{"./_export":28,"./_object-assign":62}],146:[function(t,e,r){var n=t("./_export");n(n.S,"Object",{is:t("./_same-value")})},{"./_export":28,"./_same-value":83}],147:[function(t,e,r){var n=t("./_export");n(n.S,"Object",{setPrototypeOf:t("./_set-proto").set})},{"./_export":28,"./_set-proto":84}],148:[function(t,e,r){"use strict";var n,o,i,a,s=t("./_library"),u=t("./_global"),l=t("./_ctx"),c=t("./_classof"),f=t("./_export"),d=t("./_is-object"),p=t("./_a-function"),h=t("./_an-instance"),m=t("./_for-of"),g=t("./_species-constructor"),v=t("./_task").set,b=t("./_microtask")(),y=t("./_new-promise-capability"),_=t("./_perform"),x=t("./_user-agent"),w=t("./_promise-resolve"),S=u.TypeError,O=u.process,A=O&&O.versions,E=A&&A.v8||"",j=u.Promise,P="process"==c(O),T=function(){},C=o=y.f,k=!!function(){try{var e=j.resolve(1),r=(e.constructor={})[t("./_wks")("species")]=function(t){t(T,T)};return(P||"function"==typeof PromiseRejectionEvent)&&e.then(T)instanceof r&&0!==E.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),M=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},R=function(t,e){if(!t._n){t._n=!0;var r=t._c;b(function(){for(var n=t._v,o=1==t._s,i=0;r.length>i;)!function(e){var r,i,a,s=o?e.ok:e.fail,u=e.resolve,l=e.reject,c=e.domain;try{s?(o||(2==t._h&&B(t),t._h=1),!0===s?r=n:(c&&c.enter(),r=s(n),c&&(c.exit(),a=!0)),r===e.promise?l(S("Promise-chain cycle")):(i=M(r))?i.call(r,u,l):u(r)):l(n)}catch(t){c&&!a&&c.exit(),l(t)}}(r[i++]);t._c=[],t._n=!1,e&&!t._h&&N(t)})}},N=function(t){v.call(u,function(){var e,r,n,o=t._v,i=I(t);if(i&&(e=_(function(){P?O.emit("unhandledRejection",o,t):(r=u.onunhandledrejection)?r({promise:t,reason:o}):(n=u.console)&&n.error&&n.error("Unhandled promise rejection",o)}),t._h=P||I(t)?2:1),t._a=void 0,i&&e.e)throw e.v})},I=function(t){return 1!==t._h&&0===(t._a||t._c).length},B=function(t){v.call(u,function(){var e;P?O.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},L=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),R(e,!0))},D=function(t){var e,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw S("Promise can't be resolved itself");(e=M(t))?b(function(){var n={_w:r,_d:!1};try{e.call(t,l(D,n,1),l(L,n,1))}catch(t){L.call(n,t)}}):(r._v=t,r._s=1,R(r,!1))}catch(t){L.call({_w:r,_d:!1},t)}}};k||(j=function(t){h(this,j,"Promise","_h"),p(t),n.call(this);try{t(l(D,this,1),l(L,this,1))}catch(t){L.call(this,t)}},n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},n.prototype=t("./_redefine-all")(j.prototype,{then:function(t,e){var r=C(g(this,j));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=P?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&R(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new n;this.promise=t,this.resolve=l(D,t,1),this.reject=l(L,t,1)},y.f=C=function(t){return t===j||t===a?new i(t):o(t)}),f(f.G+f.W+f.F*!k,{Promise:j}),t("./_set-to-string-tag")(j,"Promise"),t("./_set-species")("Promise"),a=t("./_core").Promise,f(f.S+f.F*!k,"Promise",{reject:function(t){var e=C(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(s||!k),"Promise",{resolve:function(t){return w(s&&this===a?j:this,t)}}),f(f.S+f.F*!(k&&t("./_iter-detect")(function(t){j.all(t).catch(T)})),"Promise",{all:function(t){var e=this,r=C(e),n=r.resolve,o=r.reject,i=_(function(){var r=[],i=0,a=1;m(t,!1,function(t){var s=i++,u=!1;r.push(void 0),a++,e.resolve(t).then(function(t){u||(u=!0,r[s]=t,--a||n(r))},o)}),--a||n(r)});return i.e&&o(i.v),r.promise},race:function(t){var e=this,r=C(e),n=r.reject,o=_(function(){m(t,!1,function(t){e.resolve(t).then(r.resolve,n)})});return o.e&&n(o.v),r.promise}})},{"./_a-function":3,"./_an-instance":6,"./_classof":15,"./_core":20,"./_ctx":22,"./_export":28,"./_for-of":33,"./_global":35,"./_is-object":46,"./_iter-detect":51,"./_library":54,"./_microtask":60,"./_new-promise-capability":61,"./_perform":76,"./_promise-resolve":77,"./_redefine-all":79,"./_set-species":85,"./_set-to-string-tag":86,"./_species-constructor":89,"./_task":94,"./_user-agent":106,"./_wks":110}],149:[function(t,e,r){var n=t("./_export"),o=t("./_a-function"),i=t("./_an-object"),a=(t("./_global").Reflect||{}).apply,s=Function.apply;n(n.S+n.F*!t("./_fails")(function(){a(function(){})}),"Reflect",{apply:function(t,e,r){var n=o(t),u=i(r);return a?a(n,e,u):s.call(n,e,u)}})},{"./_a-function":3,"./_an-object":7,"./_export":28,"./_fails":30,"./_global":35}],150:[function(t,e,r){var n=t("./_export"),o=t("./_object-create"),i=t("./_a-function"),a=t("./_an-object"),s=t("./_is-object"),u=t("./_fails"),l=t("./_bind"),c=(t("./_global").Reflect||{}).construct,f=u(function(){function t(){}return!(c(function(){},[],t)instanceof t)}),d=!u(function(){c(function(){})});n(n.S+n.F*(f||d),"Reflect",{construct:function(t,e){i(t),a(e);var r=arguments.length<3?t:i(arguments[2]);if(d&&!f)return c(t,e,r);if(t==r){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return n.push.apply(n,e),new(l.apply(t,n))}var u=r.prototype,p=o(s(u)?u:Object.prototype),h=Function.apply.call(t,p,e);return s(h)?h:p}})},{"./_a-function":3,"./_an-object":7,"./_bind":14,"./_export":28,"./_fails":30,"./_global":35,"./_is-object":46,"./_object-create":63}],151:[function(t,e,r){var n=t("./_object-dp"),o=t("./_export"),i=t("./_an-object"),a=t("./_to-primitive");o(o.S+o.F*t("./_fails")(function(){Reflect.defineProperty(n.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,r){i(t),e=a(e,!0),i(r);try{return n.f(t,e,r),!0}catch(t){return!1}}})},{"./_an-object":7,"./_export":28,"./_fails":30,"./_object-dp":64,"./_to-primitive":101}],152:[function(t,e,r){var n=t("./_export"),o=t("./_object-gopd").f,i=t("./_an-object");n(n.S,"Reflect",{deleteProperty:function(t,e){var r=o(i(t),e);return!(r&&!r.configurable)&&delete t[e]}})},{"./_an-object":7,"./_export":28,"./_object-gopd":66}],153:[function(t,e,r){var n=t("./_object-gopd"),o=t("./_export"),i=t("./_an-object");o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return n.f(i(t),e)}})},{"./_an-object":7,"./_export":28,"./_object-gopd":66}],154:[function(t,e,r){var n=t("./_export"),o=t("./_object-gpo"),i=t("./_an-object");n(n.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},{"./_an-object":7,"./_export":28,"./_object-gpo":70}],155:[function(t,e,r){function n(t,e){var r,s,c=arguments.length<3?t:arguments[2];return l(t)===c?t[e]:(r=o.f(t,e))?a(r,"value")?r.value:void 0!==r.get?r.get.call(c):void 0:u(s=i(t))?n(s,e,c):void 0}var o=t("./_object-gopd"),i=t("./_object-gpo"),a=t("./_has"),s=t("./_export"),u=t("./_is-object"),l=t("./_an-object");s(s.S,"Reflect",{get:n})},{"./_an-object":7,"./_export":28,"./_has":36,"./_is-object":46,"./_object-gopd":66,"./_object-gpo":70}],156:[function(t,e,r){var n=t("./_export");n(n.S,"Reflect",{has:function(t,e){return e in t}})},{"./_export":28}],157:[function(t,e,r){var n=t("./_export"),o=t("./_an-object"),i=Object.isExtensible;n(n.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},{"./_an-object":7,"./_export":28}],158:[function(t,e,r){var n=t("./_export");n(n.S,"Reflect",{ownKeys:t("./_own-keys")})},{"./_export":28,"./_own-keys":75}],159:[function(t,e,r){var n=t("./_export"),o=t("./_an-object"),i=Object.preventExtensions;n(n.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},{"./_an-object":7,"./_export":28}],160:[function(t,e,r){var n=t("./_export"),o=t("./_set-proto");o&&n(n.S,"Reflect",{setPrototypeOf:function(t,e){o.check(t,e);try{return o.set(t,e),!0}catch(t){return!1}}})},{"./_export":28,"./_set-proto":84}],161:[function(t,e,r){function n(t,e,r){var u,d,p=arguments.length<4?t:arguments[3],h=i.f(c(t),e);if(!h){if(f(d=a(t)))return n(d,e,r,p);h=l(0)}if(s(h,"value")){if(!1===h.writable||!f(p))return!1;if(u=i.f(p,e)){if(u.get||u.set||!1===u.writable)return!1;u.value=r,o.f(p,e,u)}else o.f(p,e,l(0,r));return!0}return void 0!==h.set&&(h.set.call(p,r),!0)}var o=t("./_object-dp"),i=t("./_object-gopd"),a=t("./_object-gpo"),s=t("./_has"),u=t("./_export"),l=t("./_property-desc"),c=t("./_an-object"),f=t("./_is-object");u(u.S,"Reflect",{set:n})},{"./_an-object":7,"./_export":28,"./_has":36,"./_is-object":46,"./_object-dp":64,"./_object-gopd":66,"./_object-gpo":70,"./_property-desc":78}],162:[function(t,e,r){"use strict";var n=t("./_regexp-exec");t("./_export")({target:"RegExp",proto:!0,forced:n!==/./.exec},{exec:n})},{"./_export":28,"./_regexp-exec":82}],163:[function(t,e,r){
  t("./_descriptors")&&"g"!=/./g.flags&&t("./_object-dp").f(RegExp.prototype,"flags",{configurable:!0,get:t("./_flags")})},{"./_descriptors":24,"./_flags":32,"./_object-dp":64}],164:[function(t,e,r){"use strict";var n=t("./_an-object"),o=t("./_to-length"),i=t("./_advance-string-index"),a=t("./_regexp-exec-abstract");t("./_fix-re-wks")("match",1,function(t,e,r,s){return[function(r){var n=t(this),o=void 0==r?void 0:r[e];return void 0!==o?o.call(r,n):new RegExp(r)[e](String(n))},function(t){var e=s(r,t,this);if(e.done)return e.value;var u=n(t),l=String(this);if(!u.global)return a(u,l);var c=u.unicode;u.lastIndex=0;for(var f,d=[],p=0;null!==(f=a(u,l));){var h=String(f[0]);d[p]=h,""===h&&(u.lastIndex=i(l,o(u.lastIndex),c)),p++}return 0===p?null:d}]})},{"./_advance-string-index":5,"./_an-object":7,"./_fix-re-wks":31,"./_regexp-exec-abstract":81,"./_to-length":99}],165:[function(t,e,r){"use strict";var n=t("./_an-object"),o=t("./_to-object"),i=t("./_to-length"),a=t("./_to-integer"),s=t("./_advance-string-index"),u=t("./_regexp-exec-abstract"),l=Math.max,c=Math.min,f=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,p=/\$([$&`']|\d\d?)/g,h=function(t){return void 0===t?t:String(t)};t("./_fix-re-wks")("replace",2,function(t,e,r,m){function g(t,e,n,i,a,s){var u=n+t.length,l=i.length,c=p;return void 0!==a&&(a=o(a),c=d),r.call(s,c,function(r,o){var s;switch(o.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(u);case"<":s=a[o.slice(1,-1)];break;default:var c=+o;if(0===c)return r;if(c>l){var d=f(c/10);return 0===d?r:d<=l?void 0===i[d-1]?o.charAt(1):i[d-1]+o.charAt(1):r}s=i[c-1]}return void 0===s?"":s})}return[function(n,o){var i=t(this),a=void 0==n?void 0:n[e];return void 0!==a?a.call(n,i,o):r.call(String(i),n,o)},function(t,e){var o=m(r,t,this,e);if(o.done)return o.value;var f=n(t),d=String(this),p="function"==typeof e;p||(e=String(e));var v=f.global;if(v){var b=f.unicode;f.lastIndex=0}for(var y=[];;){var _=u(f,d);if(null===_)break;if(y.push(_),!v)break;""===String(_[0])&&(f.lastIndex=s(d,i(f.lastIndex),b))}for(var x="",w=0,S=0;S<y.length;S++){_=y[S];for(var O=String(_[0]),A=l(c(a(_.index),d.length),0),E=[],j=1;j<_.length;j++)E.push(h(_[j]));var P=_.groups;if(p){var T=[O].concat(E,A,d);void 0!==P&&T.push(P);var C=String(e.apply(void 0,T))}else C=g(O,d,A,E,P,e);A>=w&&(x+=d.slice(w,A)+C,w=A+O.length)}return x+d.slice(w)}]})},{"./_advance-string-index":5,"./_an-object":7,"./_fix-re-wks":31,"./_regexp-exec-abstract":81,"./_to-integer":97,"./_to-length":99,"./_to-object":100}],166:[function(t,e,r){"use strict";var n=t("./_an-object"),o=t("./_same-value"),i=t("./_regexp-exec-abstract");t("./_fix-re-wks")("search",1,function(t,e,r,a){return[function(r){var n=t(this),o=void 0==r?void 0:r[e];return void 0!==o?o.call(r,n):new RegExp(r)[e](String(n))},function(t){var e=a(r,t,this);if(e.done)return e.value;var s=n(t),u=String(this),l=s.lastIndex;o(l,0)||(s.lastIndex=0);var c=i(s,u);return o(s.lastIndex,l)||(s.lastIndex=l),null===c?-1:c.index}]})},{"./_an-object":7,"./_fix-re-wks":31,"./_regexp-exec-abstract":81,"./_same-value":83}],167:[function(t,e,r){"use strict";var n=t("./_is-regexp"),o=t("./_an-object"),i=t("./_species-constructor"),a=t("./_advance-string-index"),s=t("./_to-length"),u=t("./_regexp-exec-abstract"),l=t("./_regexp-exec"),c=t("./_fails"),f=Math.min,d=[].push,p="length",h=!c(function(){RegExp(4294967295,"y")});t("./_fix-re-wks")("split",2,function(t,e,r,c){var m;return m="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[p]||2!="ab".split(/(?:ab)*/)[p]||4!=".".split(/(.?)(.?)/)[p]||".".split(/()()/)[p]>1||"".split(/.?/)[p]?function(t,e){var o=String(this);if(void 0===t&&0===e)return[];if(!n(t))return r.call(o,t,e);for(var i,a,s,u=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,h=void 0===e?4294967295:e>>>0,m=new RegExp(t.source,c+"g");(i=l.call(m,o))&&!((a=m.lastIndex)>f&&(u.push(o.slice(f,i.index)),i[p]>1&&i.index<o[p]&&d.apply(u,i.slice(1)),s=i[0][p],f=a,u[p]>=h));)m.lastIndex===i.index&&m.lastIndex++;return f===o[p]?!s&&m.test("")||u.push(""):u.push(o.slice(f)),u[p]>h?u.slice(0,h):u}:"0".split(void 0,0)[p]?function(t,e){return void 0===t&&0===e?[]:r.call(this,t,e)}:r,[function(r,n){var o=t(this),i=void 0==r?void 0:r[e];return void 0!==i?i.call(r,o,n):m.call(String(o),r,n)},function(t,e){var n=c(m,t,this,e,m!==r);if(n.done)return n.value;var l=o(t),d=String(this),p=i(l,RegExp),g=l.unicode,v=(l.ignoreCase?"i":"")+(l.multiline?"m":"")+(l.unicode?"u":"")+(h?"y":"g"),b=new p(h?l:"^(?:"+l.source+")",v),y=void 0===e?4294967295:e>>>0;if(0===y)return[];if(0===d.length)return null===u(b,d)?[d]:[];for(var _=0,x=0,w=[];x<d.length;){b.lastIndex=h?x:0;var S,O=u(b,h?d:d.slice(x));if(null===O||(S=f(s(b.lastIndex+(h?0:x)),d.length))===_)x=a(d,x,g);else{if(w.push(d.slice(_,x)),w.length===y)return w;for(var A=1;A<=O.length-1;A++)if(w.push(O[A]),w.length===y)return w;x=_=S}}return w.push(d.slice(_)),w}]})},{"./_advance-string-index":5,"./_an-object":7,"./_fails":30,"./_fix-re-wks":31,"./_is-regexp":47,"./_regexp-exec":82,"./_regexp-exec-abstract":81,"./_species-constructor":89,"./_to-length":99}],168:[function(t,e,r){"use strict";var n=t("./_collection-strong"),o=t("./_validate-collection");e.exports=t("./_collection")("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return n.def(o(this,"Set"),t=0===t?0:t,t)}},n)},{"./_collection":19,"./_collection-strong":17,"./_validate-collection":107}],169:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_string-at")(!1);n(n.P,"String",{codePointAt:function(t){return o(this,t)}})},{"./_export":28,"./_string-at":90}],170:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_to-length"),i=t("./_string-context"),a="".endsWith;n(n.P+n.F*t("./_fails-is-regexp")("endsWith"),"String",{endsWith:function(t){var e=i(this,t,"endsWith"),r=arguments.length>1?arguments[1]:void 0,n=o(e.length),s=void 0===r?n:Math.min(o(r),n),u=String(t);return a?a.call(e,u,s):e.slice(s-u.length,s)===u}})},{"./_export":28,"./_fails-is-regexp":29,"./_string-context":91,"./_to-length":99}],171:[function(t,e,r){var n=t("./_export"),o=t("./_to-absolute-index"),i=String.fromCharCode,a=String.fromCodePoint;n(n.S+n.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,r=[],n=arguments.length,a=0;n>a;){if(e=+arguments[a++],o(e,1114111)!==e)throw RangeError(e+" is not a valid code point");r.push(e<65536?i(e):i(55296+((e-=65536)>>10),e%1024+56320))}return r.join("")}})},{"./_export":28,"./_to-absolute-index":95}],172:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_string-context");n(n.P+n.F*t("./_fails-is-regexp")("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},{"./_export":28,"./_fails-is-regexp":29,"./_string-context":91}],173:[function(t,e,r){var n=t("./_export"),o=t("./_to-iobject"),i=t("./_to-length");n(n.S,"String",{raw:function(t){for(var e=o(t.raw),r=i(e.length),n=arguments.length,a=[],s=0;r>s;)a.push(String(e[s++])),s<n&&a.push(String(arguments[s]));return a.join("")}})},{"./_export":28,"./_to-iobject":98,"./_to-length":99}],174:[function(t,e,r){var n=t("./_export");n(n.P,"String",{repeat:t("./_string-repeat")})},{"./_export":28,"./_string-repeat":93}],175:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_to-length"),i=t("./_string-context"),a="".startsWith;n(n.P+n.F*t("./_fails-is-regexp")("startsWith"),"String",{startsWith:function(t){var e=i(this,t,"startsWith"),r=o(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return a?a.call(e,n,r):e.slice(r,r+n.length)===n}})},{"./_export":28,"./_fails-is-regexp":29,"./_string-context":91,"./_to-length":99}],176:[function(t,e,r){"use strict";var n=t("./_global"),o=t("./_has"),i=t("./_descriptors"),a=t("./_export"),s=t("./_redefine"),u=t("./_meta").KEY,l=t("./_fails"),c=t("./_shared"),f=t("./_set-to-string-tag"),d=t("./_uid"),p=t("./_wks"),h=t("./_wks-ext"),m=t("./_wks-define"),g=t("./_enum-keys"),v=t("./_is-array"),b=t("./_an-object"),y=t("./_is-object"),_=t("./_to-object"),x=t("./_to-iobject"),w=t("./_to-primitive"),S=t("./_property-desc"),O=t("./_object-create"),A=t("./_object-gopn-ext"),E=t("./_object-gopd"),j=t("./_object-gops"),P=t("./_object-dp"),T=t("./_object-keys"),C=E.f,k=P.f,M=A.f,R=n.Symbol,N=n.JSON,I=N&&N.stringify,B=p("_hidden"),L=p("toPrimitive"),D={}.propertyIsEnumerable,F=c("symbol-registry"),G=c("symbols"),z=c("op-symbols"),H=Object.prototype,W="function"==typeof R&&!!j.f,U=n.QObject,V=!U||!U.prototype||!U.prototype.findChild,q=i&&l(function(){return 7!=O(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(t,e,r){var n=C(H,e);n&&delete H[e],k(t,e,r),n&&t!==H&&k(H,e,n)}:k,K=function(t){var e=G[t]=O(R.prototype);return e._k=t,e},Y=W&&"symbol"==typeof R.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof R},$=function(t,e,r){return t===H&&$(z,e,r),b(t),e=w(e,!0),b(r),o(G,e)?(r.enumerable?(o(t,B)&&t[B][e]&&(t[B][e]=!1),r=O(r,{enumerable:S(0,!1)})):(o(t,B)||k(t,B,S(1,{})),t[B][e]=!0),q(t,e,r)):k(t,e,r)},X=function(t,e){b(t);for(var r,n=g(e=x(e)),o=0,i=n.length;i>o;)$(t,r=n[o++],e[r]);return t},Z=function(t,e){return void 0===e?O(t):X(O(t),e)},Q=function(t){var e=D.call(this,t=w(t,!0));return!(this===H&&o(G,t)&&!o(z,t))&&(!(e||!o(this,t)||!o(G,t)||o(this,B)&&this[B][t])||e)},J=function(t,e){if(t=x(t),e=w(e,!0),t!==H||!o(G,e)||o(z,e)){var r=C(t,e);return!r||!o(G,e)||o(t,B)&&t[B][e]||(r.enumerable=!0),r}},tt=function(t){for(var e,r=M(x(t)),n=[],i=0;r.length>i;)o(G,e=r[i++])||e==B||e==u||n.push(e);return n},et=function(t){for(var e,r=t===H,n=M(r?z:x(t)),i=[],a=0;n.length>a;)!o(G,e=n[a++])||r&&!o(H,e)||i.push(G[e]);return i};W||(R=function(){if(this instanceof R)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(r){this===H&&e.call(z,r),o(this,B)&&o(this[B],t)&&(this[B][t]=!1),q(this,t,S(1,r))};return i&&V&&q(H,t,{configurable:!0,set:e}),K(t)},s(R.prototype,"toString",function(){return this._k}),E.f=J,P.f=$,t("./_object-gopn").f=A.f=tt,t("./_object-pie").f=Q,j.f=et,i&&!t("./_library")&&s(H,"propertyIsEnumerable",Q,!0),h.f=function(t){return K(p(t))}),a(a.G+a.W+a.F*!W,{Symbol:R});for(var rt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;rt.length>nt;)p(rt[nt++]);for(var ot=T(p.store),it=0;ot.length>it;)m(ot[it++]);a(a.S+a.F*!W,"Symbol",{for:function(t){return o(F,t+="")?F[t]:F[t]=R(t)},keyFor:function(t){if(!Y(t))throw TypeError(t+" is not a symbol!");for(var e in F)if(F[e]===t)return e},useSetter:function(){V=!0},useSimple:function(){V=!1}}),a(a.S+a.F*!W,"Object",{create:Z,defineProperty:$,defineProperties:X,getOwnPropertyDescriptor:J,getOwnPropertyNames:tt,getOwnPropertySymbols:et});var at=l(function(){j.f(1)});a(a.S+a.F*at,"Object",{getOwnPropertySymbols:function(t){return j.f(_(t))}}),N&&a(a.S+a.F*(!W||l(function(){var t=R();return"[null]"!=I([t])||"{}"!=I({a:t})||"{}"!=I(Object(t))})),"JSON",{stringify:function(t){for(var e,r,n=[t],o=1;arguments.length>o;)n.push(arguments[o++]);if(r=e=n[1],(y(e)||void 0!==t)&&!Y(t))return v(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!Y(e))return e}),n[1]=e,I.apply(N,n)}}),R.prototype[L]||t("./_hide")(R.prototype,L,R.prototype.valueOf),f(R,"Symbol"),f(Math,"Math",!0),f(n.JSON,"JSON",!0)},{"./_an-object":7,"./_descriptors":24,"./_enum-keys":27,"./_export":28,"./_fails":30,"./_global":35,"./_has":36,"./_hide":37,"./_is-array":44,"./_is-object":46,"./_library":54,"./_meta":59,"./_object-create":63,"./_object-dp":64,"./_object-gopd":66,"./_object-gopn":68,"./_object-gopn-ext":67,"./_object-gops":69,"./_object-keys":72,"./_object-pie":73,"./_property-desc":78,"./_redefine":80,"./_set-to-string-tag":86,"./_shared":88,"./_to-iobject":98,"./_to-object":100,"./_to-primitive":101,"./_uid":105,"./_wks":110,"./_wks-define":108,"./_wks-ext":109}],177:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_typed"),i=t("./_typed-buffer"),a=t("./_an-object"),s=t("./_to-absolute-index"),u=t("./_to-length"),l=t("./_is-object"),c=t("./_global").ArrayBuffer,f=t("./_species-constructor"),d=i.ArrayBuffer,p=i.DataView,h=o.ABV&&c.isView,m=d.prototype.slice,g=o.VIEW;n(n.G+n.W+n.F*(c!==d),{ArrayBuffer:d}),n(n.S+n.F*!o.CONSTR,"ArrayBuffer",{isView:function(t){return h&&h(t)||l(t)&&g in t}}),n(n.P+n.U+n.F*t("./_fails")(function(){return!new d(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(a(this),t);for(var r=a(this).byteLength,n=s(t,r),o=s(void 0===e?r:e,r),i=new(f(this,d))(u(o-n)),l=new p(this),c=new p(i),h=0;n<o;)c.setUint8(h++,l.getUint8(n++));return i}}),t("./_set-species")("ArrayBuffer")},{"./_an-object":7,"./_export":28,"./_fails":30,"./_global":35,"./_is-object":46,"./_set-species":85,"./_species-constructor":89,"./_to-absolute-index":95,"./_to-length":99,"./_typed":104,"./_typed-buffer":103}],178:[function(t,e,r){t("./_typed-array")("Float32",4,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],179:[function(t,e,r){t("./_typed-array")("Float64",8,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],180:[function(t,e,r){t("./_typed-array")("Int16",2,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],181:[function(t,e,r){t("./_typed-array")("Int32",4,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],182:[function(t,e,r){t("./_typed-array")("Int8",1,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],183:[function(t,e,r){t("./_typed-array")("Uint16",2,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],184:[function(t,e,r){t("./_typed-array")("Uint32",4,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],185:[function(t,e,r){t("./_typed-array")("Uint8",1,function(t){return function(e,r,n){return t(this,e,r,n)}})},{"./_typed-array":102}],186:[function(t,e,r){t("./_typed-array")("Uint8",1,function(t){return function(e,r,n){return t(this,e,r,n)}},!0)},{"./_typed-array":102}],187:[function(t,e,r){"use strict";var n,o=t("./_global"),i=t("./_array-methods")(0),a=t("./_redefine"),s=t("./_meta"),u=t("./_object-assign"),l=t("./_collection-weak"),c=t("./_is-object"),f=t("./_validate-collection"),d=t("./_validate-collection"),p=!o.ActiveXObject&&"ActiveXObject"in o,h=s.getWeak,m=Object.isExtensible,g=l.ufstore,v=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},b={get:function(t){if(c(t)){var e=h(t);return!0===e?g(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return l.def(f(this,"WeakMap"),t,e)}},y=e.exports=t("./_collection")("WeakMap",v,b,l,!0,!0);d&&p&&(n=l.getConstructor(v,"WeakMap"),u(n.prototype,b),s.NEED=!0,i(["delete","has","get","set"],function(t){var e=y.prototype,r=e[t];a(e,t,function(e,o){if(c(e)&&!m(e)){this._f||(this._f=new n);var i=this._f[t](e,o);return"set"==t?this:i}return r.call(this,e,o)})}))},{"./_array-methods":11,"./_collection":19,"./_collection-weak":18,"./_global":35,"./_is-object":46,"./_meta":59,"./_object-assign":62,"./_redefine":80,"./_validate-collection":107}],188:[function(t,e,r){"use strict";var n=t("./_collection-weak"),o=t("./_validate-collection");t("./_collection")("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return n.def(o(this,"WeakSet"),t,!0)}},n,!1,!0)},{"./_collection":19,"./_collection-weak":18,"./_validate-collection":107}],189:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_array-includes")(!0);n(n.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")("includes")},{"./_add-to-unscopables":4,"./_array-includes":10,"./_export":28}],190:[function(t,e,r){var n=t("./_export"),o=t("./_object-to-array")(!0);n(n.S,"Object",{entries:function(t){return o(t)}})},{"./_export":28,"./_object-to-array":74}],191:[function(t,e,r){var n=t("./_export"),o=t("./_own-keys"),i=t("./_to-iobject"),a=t("./_object-gopd"),s=t("./_create-property");n(n.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,r,n=i(t),u=a.f,l=o(n),c={},f=0;l.length>f;)void 0!==(r=u(n,e=l[f++]))&&s(c,e,r);return c}})},{"./_create-property":21,"./_export":28,"./_object-gopd":66,"./_own-keys":75,"./_to-iobject":98}],192:[function(t,e,r){var n=t("./_export"),o=t("./_object-to-array")(!1);n(n.S,"Object",{values:function(t){return o(t)}})},{"./_export":28,"./_object-to-array":74}],193:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_string-pad"),i=t("./_user-agent"),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);n(n.P+n.F*a,"String",{padEnd:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},{"./_export":28,"./_string-pad":92,"./_user-agent":106}],194:[function(t,e,r){"use strict";var n=t("./_export"),o=t("./_string-pad"),i=t("./_user-agent"),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);n(n.P+n.F*a,"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},{"./_export":28,"./_string-pad":92,"./_user-agent":106}],195:[function(t,e,r){for(var n=t("./es6.array.iterator"),o=t("./_object-keys"),i=t("./_redefine"),a=t("./_global"),s=t("./_hide"),u=t("./_iterators"),l=t("./_wks"),c=l("iterator"),f=l("toStringTag"),d=u.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=o(p),m=0;m<h.length;m++){var g,v=h[m],b=p[v],y=a[v],_=y&&y.prototype;if(_&&(_[c]||s(_,c,d),_[f]||s(_,f,v),u[v]=d,b))for(g in n)_[g]||i(_,g,n[g],!0)}},{"./_global":35,"./_hide":37,"./_iterators":53,"./_object-keys":72,"./_redefine":80,"./_wks":110,"./es6.array.iterator":117}],196:[function(t,e,r){var n=t("./_export"),o=t("./_task");n(n.G+n.B,{setImmediate:o.set,clearImmediate:o.clear})},{"./_export":28,"./_task":94}],197:[function(t,e,r){var n=t("./_global"),o=t("./_export"),i=t("./_user-agent"),a=[].slice,s=/MSIE .\./.test(i),u=function(t){return function(e,r){var n=arguments.length>2,o=!!n&&a.call(arguments,2);return t(n?function(){("function"==typeof e?e:Function(e)).apply(this,o)}:e,r)}};o(o.G+o.B+o.F*s,{setTimeout:u(n.setTimeout),setInterval:u(n.setInterval)})},{"./_export":28,"./_global":35,"./_user-agent":106}],198:[function(e,r,n){var o=o||function(t){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,r=function(){return t.URL||t.webkitURL||t},n=e.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,i=function(t){var e=new MouseEvent("click");t.dispatchEvent(e)},a=t.webkitRequestFileSystem,s=t.requestFileSystem||a||t.mozRequestFileSystem,u=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},l=0,c=function(e){var n=function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()};t.chrome?n():setTimeout(n,500)},f=function(t,e,r){e=[].concat(e);for(var n=e.length;n--;){var o=t["on"+e[n]];if("function"==typeof o)try{o.call(t,r||t)}catch(t){u(t)}}},d=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},p=function(e,u,p){p||(e=d(e));var h,m,g,v=this,b=e.type,y=!1,_=function(){f(v,"writestart progress write writeend".split(" "))},x=function(){if(!y&&h||(h=r().createObjectURL(e)),m)m.location.href=h;else{void 0==t.open(h,"_blank")&&"undefined"!=typeof safari&&(t.location.href=h)}v.readyState=v.DONE,_(),c(h)},w=function(t){return function(){if(v.readyState!==v.DONE)return t.apply(this,arguments)}},S={create:!0,exclusive:!1};return v.readyState=v.INIT,u||(u="download"),o?(h=r().createObjectURL(e),n.href=h,n.download=u,void setTimeout(function(){i(n),_(),c(h),v.readyState=v.DONE})):(t.chrome&&b&&"application/octet-stream"!==b&&(g=e.slice||e.webkitSlice,e=g.call(e,0,e.size,"application/octet-stream"),y=!0),a&&"download"!==u&&(u+=".download"),("application/octet-stream"===b||a)&&(m=t),s?(l+=e.size,void s(t.TEMPORARY,l,w(function(t){t.root.getDirectory("saved",S,w(function(t){var r=function(){t.getFile(u,S,w(function(t){t.createWriter(w(function(r){r.onwriteend=function(e){m.location.href=t.toURL(),v.readyState=v.DONE,f(v,"writeend",e),c(t)},r.onerror=function(){var t=r.error;t.code!==t.ABORT_ERR&&x()},"writestart progress write abort".split(" ").forEach(function(t){r["on"+t]=v["on"+t]}),r.write(e),v.abort=function(){r.abort(),v.readyState=v.DONE},v.readyState=v.WRITING}),x)}),x)};t.getFile(u,{create:!1},w(function(t){t.remove(),r()}),w(function(t){t.code===t.NOT_FOUND_ERR?r():x()}))}),x)}),x)):void x())},h=p.prototype,m=function(t,e,r){return new p(t,e,r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,r){return r||(t=d(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(h.abort=function(){var t=this;t.readyState=t.DONE,f(t,"abort")},h.readyState=h.INIT=0,h.WRITING=1,h.DONE=2,h.error=h.onwritestart=h.onprogress=h.onwrite=h.onabort=h.onerror=h.onwriteend=null,m)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==r&&r.exports?r.exports.saveAs=o:void 0!==t&&null!==t&&null!=t.amd&&t([],function(){return o})},{}],199:[function(t,e,r){var n={};e.exports=n,n.createElement=function(t){return document.createElement(t)},n.createText=function(t){return document.createTextNode(t)},n.style=function(t,e){t.style.cssText=e},n.append=function(t,e){t.appendChild(e)},n.remove=function(t,e){t.removeChild(e)}},{}],200:[function(t,e,r){var n=t("promise"),o=t("./dom"),i=t("./ruler"),a=function(t,e){e=e||{weight:"normal"},this.family=t,this.style=e.style||"normal",this.variant=e.variant||"normal",this.weight=e.weight||"normal",this.stretch=e.stretch||"stretch",this.featureSettings=e.featureSettings||"normal"};e.exports=a,a.HAS_WEBKIT_FALLBACK_BUG=null,a.DEFAULT_TIMEOUT=3e3,a.getUserAgent=function(){return window.navigator.userAgent},a.hasWebKitFallbackBug=function(){if(null===a.HAS_WEBKIT_FALLBACK_BUG){var t=/AppleWeb[kK]it\/([0-9]+)(?:\.([0-9]+))/.exec(a.getUserAgent());a.HAS_WEBKIT_FALLBACK_BUG=!!t&&(parseInt(t[1],10)<536||536===parseInt(t[1],10)&&parseInt(t[2],10)<=11)}return a.HAS_WEBKIT_FALLBACK_BUG},a.prototype.getStyle=function(){return"font-style:"+this.style+";font-variant:"+this.variant+";font-weight:"+this.weight+";font-stretch:"+this.stretch+";font-feature-settings:"+this.featureSettings+";-moz-font-feature-settings:"+this.featureSettings+";-webkit-font-feature-settings:"+this.featureSettings+";"},a.prototype.check=function(t,e){var r=t||"BESbswy",s=e||a.DEFAULT_TIMEOUT,u=this.getStyle(),l=o.createElement("div"),c=new i(r),f=new i(r),d=new i(r),p=-1,h=-1,m=-1,g=-1,v=-1,b=-1,y=this;return c.setFont('"Times New Roman", sans-serif',u),f.setFont("serif",u),d.setFont("monospace",u),o.append(l,c.getElement()),o.append(l,f.getElement()),o.append(l,d.getElement()),o.append(document.body,l),g=c.getWidth(),v=f.getWidth(),b=d.getWidth(),new n(function(t,e){function r(){null!==l.parentNode&&o.remove(document.body,l)}function n(){-1!==p&&-1!==h&&-1!==m&&p===h&&h===m&&(a.hasWebKitFallbackBug()?p===g&&h===g&&m===g||p===v&&h===v&&m===v||p===b&&h===b&&m===b||(r(),t(y)):(r(),t(y)))}setTimeout(function(){r(),e(y)},s),c.onResize(function(t){p=t,n()}),c.setFont(y.family+",sans-serif",u),f.onResize(function(t){h=t,n()}),f.setFont(y.family+",serif",u),d.onResize(function(t){m=t,n()}),d.setFont(y.family+",monospace",u)})}},{"./dom":199,"./ruler":201,promise:492}],201:[function(t,e,r){var n=t("./dom"),o=function(t){var e="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;";this.element=n.createElement("div"),this.element.setAttribute("aria-hidden","true"),n.append(this.element,n.createText(t)),this.collapsible=n.createElement("span"),this.expandable=n.createElement("span"),this.collapsibleInner=n.createElement("span"),this.expandableInner=n.createElement("span"),this.lastOffsetWidth=-1,n.style(this.collapsible,e),n.style(this.expandable,e),n.style(this.expandableInner,e),n.style(this.collapsibleInner,"display:inline-block;width:200%;height:200%;"),n.append(this.collapsible,this.collapsibleInner),n.append(this.expandable,this.expandableInner),n.append(this.element,this.collapsible),n.append(this.element,this.expandable)};e.exports=o,o.prototype.getElement=function(){return this.element},o.prototype.setFont=function(t,e){n.style(this.element,"min-width:20px;min-height:20px;display:inline-block;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font-size:100px;font-family:"+t+";"+e)},o.prototype.getWidth=function(){return this.element.offsetWidth},o.prototype.setWidth=function(t){this.element.style.width=t+"px"},o.prototype.reset=function(){var t=this.getWidth(),e=t+100;return this.expandableInner.style.width=e+"px",this.expandable.scrollLeft=e,this.collapsible.scrollLeft=this.collapsible.scrollWidth+100,this.lastOffsetWidth!==t&&(this.lastOffsetWidth=t,!0)},o.prototype.onScroll=function(t){this.reset()&&null!==this.element.parentNode&&t(this.lastOffsetWidth)},o.prototype.onResize=function(t){var e=this;this.collapsible.addEventListener("scroll",function(){e.onScroll(t)},!1),this.expandable.addEventListener("scroll",function(){e.onScroll(t)},!1),this.reset()}},{"./dom":199}],202:[function(t,e,r){"use strict";function n(t,e,r,n,o){var i=this.validateSchema(t,o,e,r);return!i.valid&&n instanceof Function&&n(i),i.valid}function o(t,e,r,n,o,i){if(!e.properties||void 0===e.properties[o])if(!1===e.additionalProperties)i.addError({name:"additionalProperties",argument:o,message:"additionalProperty "+JSON.stringify(o)+" exists in instance when not allowed"});else{var a=e.additionalProperties||{},s=this.validateSchema(t[o],a,r,n.makeChild(a,o));s.instance!==i.instance[o]&&(i.instance[o]=s.instance),i.importErrors(s)}}function i(t,e,r){var n,o=r.length;for(n=e+1,o;n<o;n++)if(a.deepCompareStrict(t,r[n]))return!1;return!0}var a=t("./helpers"),s=a.ValidatorResult,u=a.SchemaError,l={};l.ignoreProperties={id:!0,default:!0,description:!0,title:!0,exclusiveMinimum:!0,exclusiveMaximum:!0,additionalItems:!0,$schema:!0,$ref:!0,extends:!0};var c=l.validators={};c.type=function(t,e,r,n){if(void 0===t)return null;var o=new s(t,e,r,n),i=Array.isArray(e.type)?e.type:[e.type];if(!i.some(this.testType.bind(this,t,e,r,n))){var a=i.map(function(t){return t.id&&"<"+t.id+">"||t+""});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o},c.anyOf=function(t,e,r,o){if(void 0===t)return null;var i=new s(t,e,r,o),a=new s(t,e,r,o);if(!Array.isArray(e.anyOf))throw new u("anyOf must be an array");if(!e.anyOf.some(n.bind(this,t,r,o,function(t){a.importErrors(t)}))){var l=e.anyOf.map(function(t,e){return t.id&&"<"+t.id+">"||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+e+"]"});r.nestedErrors&&i.importErrors(a),i.addError({name:"anyOf",argument:l,message:"is not any of "+l.join(",")})}return i},c.allOf=function(t,e,r,n){if(void 0===t)return null;if(!Array.isArray(e.allOf))throw new u("allOf must be an array");var o=new s(t,e,r,n),i=this;return e.allOf.forEach(function(e,a){var s=i.validateSchema(t,e,r,n);if(!s.valid){var u=e.id&&"<"+e.id+">"||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+a+"]";o.addError({name:"allOf",argument:{id:u,length:s.errors.length,valid:s},message:"does not match allOf schema "+u+" with "+s.errors.length+" error[s]:"}),o.importErrors(s)}}),o},c.oneOf=function(t,e,r,o){if(void 0===t)return null;if(!Array.isArray(e.oneOf))throw new u("oneOf must be an array");var i=new s(t,e,r,o),a=new s(t,e,r,o),l=e.oneOf.filter(n.bind(this,t,r,o,function(t){a.importErrors(t)})).length,c=e.oneOf.map(function(t,e){return t.id&&"<"+t.id+">"||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+e+"]"});return 1!==l&&(r.nestedErrors&&i.importErrors(a),i.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),i},c.properties=function(t,e,r,n){if(void 0!==t&&t instanceof Object){var o=new s(t,e,r,n),i=e.properties||{};for(var a in i){var u=(t||void 0)&&t[a],l=this.validateSchema(u,i[a],r,n.makeChild(i[a],a));l.instance!==o.instance[a]&&(o.instance[a]=l.instance),o.importErrors(l)}return o}},c.patternProperties=function(t,e,r,n){if(void 0!==t&&this.types.object(t)){var i=new s(t,e,r,n),a=e.patternProperties||{};for(var u in t){var l=!0;for(var c in a){if(new RegExp(c).test(u)){l=!1;var f=this.validateSchema(t[u],a[c],r,n.makeChild(a[c],u));f.instance!==i.instance[u]&&(i.instance[u]=f.instance),i.importErrors(f)}}l&&o.call(this,t,e,r,n,u,i)}return i}},c.additionalProperties=function(t,e,r,n){if(void 0!==t&&this.types.object(t)){if(e.patternProperties)return null;var i=new s(t,e,r,n);for(var a in t)o.call(this,t,e,r,n,a,i);return i}},c.minProperties=function(t,e,r,n){if(!t||"object"!=typeof t)return null;var o=new s(t,e,r,n);return Object.keys(t).length>=e.minProperties||o.addError({name:"minProperties",argument:e.minProperties,message:"does not meet minimum property length of "+e.minProperties}),o},c.maxProperties=function(t,e,r,n){if(!t||"object"!=typeof t)return null;var o=new s(t,e,r,n);return Object.keys(t).length<=e.maxProperties||o.addError({name:"maxProperties",argument:e.maxProperties,message:"does not meet maximum property length of "+e.maxProperties}),o},c.items=function(t,e,r,n){if(!Array.isArray(t))return null;var o=this,i=new s(t,e,r,n);return void 0!==t&&e.items?(t.every(function(t,a){var s=Array.isArray(e.items)?e.items[a]||e.additionalItems:e.items;if(void 0===s)return!0;if(!1===s)return i.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(t,s,r,n.makeChild(s,a));return u.instance!==i.instance[a]&&(i.instance[a]=u.instance),i.importErrors(u),!0}),i):i},c.minimum=function(t,e,r,n){if("number"!=typeof t)return null;var o=new s(t,e,r,n),i=!0;return i=e.exclusiveMinimum&&!0===e.exclusiveMinimum?t>e.minimum:t>=e.minimum,i||o.addError({name:"minimum",argument:e.minimum,message:"must have a minimum value of "+e.minimum}),o},c.maximum=function(t,e,r,n){if("number"!=typeof t)return null;var o,i=new s(t,e,r,n);return o=e.exclusiveMaximum&&!0===e.exclusiveMaximum?t<e.maximum:t<=e.maximum,o||i.addError({name:"maximum",argument:e.maximum,message:"must have a maximum value of "+e.maximum}),i},c.divisibleBy=function(t,e,r,n){if("number"!=typeof t)return null;if(0==e.divisibleBy)throw new u("divisibleBy cannot be zero");var o=new s(t,e,r,n);return t/e.divisibleBy%1&&o.addError({name:"divisibleBy",argument:e.divisibleBy,message:"is not divisible by (multiple of) "+JSON.stringify(e.divisibleBy)}),o},c.multipleOf=function(t,e,r,n){if("number"!=typeof t)return null;if(0==e.multipleOf)throw new u("multipleOf cannot be zero");var o=new s(t,e,r,n);return t/e.multipleOf%1&&o.addError({name:"multipleOf",argument:e.multipleOf,message:"is not a multiple of (divisible by) "+JSON.stringify(e.multipleOf)}),o},c.required=function(t,e,r,n){var o=new s(t,e,r,n);return void 0===t&&!0===e.required?o.addError({name:"required",message:"is required"}):t&&"object"==typeof t&&Array.isArray(e.required)&&e.required.forEach(function(e){void 0===t[e]&&o.addError({name:"required",argument:e,message:"requires property "+JSON.stringify(e)})}),o},c.pattern=function(t,e,r,n){if("string"!=typeof t)return null;var o=new s(t,e,r,n);return t.match(e.pattern)||o.addError({name:"pattern",
  argument:e.pattern,message:"does not match pattern "+JSON.stringify(e.pattern)}),o},c.format=function(t,e,r,n){var o=new s(t,e,r,n);return o.disableFormat||a.isFormat(t,e.format,this)||o.addError({name:"format",argument:e.format,message:"does not conform to the "+JSON.stringify(e.format)+" format"}),o},c.minLength=function(t,e,r,n){if("string"!=typeof t)return null;var o=new s(t,e,r,n);return t.length>=e.minLength||o.addError({name:"minLength",argument:e.minLength,message:"does not meet minimum length of "+e.minLength}),o},c.maxLength=function(t,e,r,n){if("string"!=typeof t)return null;var o=new s(t,e,r,n);return t.length<=e.maxLength||o.addError({name:"maxLength",argument:e.maxLength,message:"does not meet maximum length of "+e.maxLength}),o},c.minItems=function(t,e,r,n){if(!Array.isArray(t))return null;var o=new s(t,e,r,n);return t.length>=e.minItems||o.addError({name:"minItems",argument:e.minItems,message:"does not meet minimum length of "+e.minItems}),o},c.maxItems=function(t,e,r,n){if(!Array.isArray(t))return null;var o=new s(t,e,r,n);return t.length<=e.maxItems||o.addError({name:"maxItems",argument:e.maxItems,message:"does not meet maximum length of "+e.maxItems}),o},c.uniqueItems=function(t,e,r,n){function o(t,e,r){for(var n=e+1;n<r.length;n++)if(a.deepCompareStrict(t,r[n]))return!1;return!0}var i=new s(t,e,r,n);return Array.isArray(t)?(t.every(o)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i):i},c.uniqueItems=function(t,e,r,n){if(!Array.isArray(t))return null;var o=new s(t,e,r,n);return t.every(i)||o.addError({name:"uniqueItems",message:"contains duplicate item"}),o},c.dependencies=function(t,e,r,n){if(!t||"object"!=typeof t)return null;var o=new s(t,e,r,n);for(var i in e.dependencies)if(void 0!==t[i]){var a=e.dependencies[i],u=n.makeChild(a,i);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach(function(e){void 0===t[e]&&o.addError({name:"dependencies",argument:u.propertyPath,message:"property "+e+" not found, required by "+u.propertyPath})});else{var l=this.validateSchema(t,a,r,u);o.instance!==l.instance&&(o.instance=l.instance),l&&l.errors.length&&(o.addError({name:"dependencies",argument:u.propertyPath,message:"does not meet dependency required by "+u.propertyPath}),o.importErrors(l))}}return o},c.enum=function(t,e,r,n){if(!Array.isArray(e.enum))throw new u("enum expects an array",e);if(void 0===t)return null;var o=new s(t,e,r,n);return e.enum.some(a.deepCompareStrict.bind(null,t))||o.addError({name:"enum",argument:e.enum,message:"is not one of enum values: "+e.enum.join(",")}),o},c.not=c.disallow=function(t,e,r,n){var o=this;if(void 0===t)return null;var i=new s(t,e,r,n),a=e.not||e.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach(function(a){if(o.testType(t,e,r,n,a)){var s=a&&a.id&&"<"+a.id+">"||a;i.addError({name:"not",argument:s,message:"is of prohibited type "+s})}}),i):null},e.exports=l},{"./helpers":203}],203:[function(t,e,r){"use strict";function n(t,e){return e+": "+t.toString()+"\n"}function o(t,e,r,n){"object"==typeof r?e[n]=s(t[n],r):-1===t.indexOf(r)&&e.push(r)}function i(t,e,r){e[r]=t[r]}function a(t,e,r,n){"object"==typeof e[n]&&e[n]&&t[n]?r[n]=s(t[n],e[n]):r[n]=e[n]}function s(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(o.bind(null,t,n))):(t&&"object"==typeof t&&Object.keys(t).forEach(i.bind(null,t,n)),Object.keys(e).forEach(a.bind(null,t,e,n))),n}function u(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}var l=t("url"),c=r.ValidationError=function(t,e,r,n,o,i){n&&(this.property=n),t&&(this.message=t),r&&(r.id?this.schema=r.id:this.schema=r),e&&(this.instance=e),this.name=o,this.argument=i,this.stack=this.toString()};c.prototype.toString=function(){return this.property+" "+this.message};var f=r.ValidatorResult=function(t,e,r,n){this.instance=t,this.schema=e,this.propertyPath=n.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.disableFormat=r&&!0===r.disableFormat};f.prototype.addError=function(t){var e;if("string"==typeof t)e=new c(t,this.instance,this.schema,this.propertyPath);else{if(!t)throw new Error("Missing error detail");if(!t.message)throw new Error("Missing error message");if(!t.name)throw new Error("Missing validator type");e=new c(t.message,this.instance,this.schema,this.propertyPath,t.name,t.argument)}if(this.throwError)throw e;return this.errors.push(e),e},f.prototype.importErrors=function(t){"string"==typeof t||t&&t.validatorType?this.addError(t):t&&t.errors&&Array.prototype.push.apply(this.errors,t.errors)},f.prototype.toString=function(t){return this.errors.map(n).join("")},Object.defineProperty(f.prototype,"valid",{get:function(){return!this.errors.length}});var d=r.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),Error.captureStackTrace(this,t)};d.prototype=Object.create(Error.prototype,{constructor:{value:d,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var p=r.SchemaContext=function(t,e,r,n,o){this.schema=t,this.options=e,this.propertyPath=r,this.base=n,this.schemas=o};p.prototype.resolve=function(t){return l.resolve(this.base,t)},p.prototype.makeChild=function(t,e){var r=void 0===e?this.propertyPath:this.propertyPath+m(e),n=l.resolve(this.base,t.id||""),o=new p(t,this.options,r,n,Object.create(this.schemas));return t.id&&!o.schemas[n]&&(o.schemas[n]=t),o};var h=r.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(t){return"string"==typeof t&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch(t){e=!1}return e},style:/\s*(.+?):\s*([^;]+);?/g,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};h.regexp=h.regex,h.pattern=h.regex,h.ipv4=h["ip-address"],r.isFormat=function(t,e,r){if("string"==typeof t&&void 0!==h[e]){if(h[e]instanceof RegExp)return h[e].test(t);if("function"==typeof h[e])return h[e](t)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[e])return r.customFormats[e](t);return!0};var m=r.makeSuffix=function(t){return t=t.toString(),t.match(/[.\s\[\]]/)||t.match(/^[\d]/)?t.match(/^\d+$/)?"["+t+"]":"["+JSON.stringify(t)+"]":"."+t};r.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(e instanceof Array)return r instanceof Array&&(e.length===r.length&&e.every(function(n,o){return t(e[o],r[o])}));if("object"==typeof e){if(!e||!r)return e===r;var n=Object.keys(e),o=Object.keys(r);return n.length===o.length&&n.every(function(n){return t(e[n],r[n])})}return e===r},e.exports.deepMerge=s,r.objectGetPath=function(t,e){for(var r,n=e.split("/").slice(1);"string"==typeof(r=n.shift());){var o=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in t))return;t=t[o]}return t},r.encodePath=function(t){return t.map(u).join("")}},{url:519}],204:[function(t,e,r){"use strict";var n=e.exports.Validator=t("./validator");e.exports.ValidatorResult=t("./helpers").ValidatorResult,e.exports.ValidationError=t("./helpers").ValidationError,e.exports.SchemaError=t("./helpers").SchemaError,e.exports.validate=function(t,e,r){return(new n).validate(t,e,r)}},{"./helpers":203,"./validator":205}],205:[function(t,e,r){"use strict";function n(t){var e="string"==typeof t?t:t.$ref;return"string"==typeof e&&e}var o=t("url"),i=t("./attribute"),a=t("./helpers"),s=a.ValidatorResult,u=a.SchemaError,l=a.SchemaContext,c=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(f),this.attributes=Object.create(i.validators)};c.prototype.customFormats={},c.prototype.schemas=null,c.prototype.types=null,c.prototype.attributes=null,c.prototype.unresolvedRefs=null,c.prototype.addSchema=function(t,e){if(!t)return null;var r=e||t.id;return this.addSubSchema(r,t),r&&(this.schemas[r]=t),this.schemas[r]},c.prototype.addSubSchema=function(t,e){if(e&&"object"==typeof e){if(e.$ref){var r=o.resolve(t,e.$ref);return void(void 0===this.schemas[r]&&(this.schemas[r]=null,this.unresolvedRefs.push(r)))}var n=e.id&&o.resolve(t,e.id),i=n||t;if(n){if(this.schemas[n]){if(!a.deepCompareStrict(this.schemas[n],e))throw new Error("Schema <"+e+"> already exists with different definition");return this.schemas[n]}this.schemas[n]=e;var s=n.replace(/^([^#]*)#$/,"$1");this.schemas[s]=e}return this.addSubSchemaArray(i,e.items instanceof Array?e.items:[e.items]),this.addSubSchemaArray(i,e.extends instanceof Array?e.extends:[e.extends]),this.addSubSchema(i,e.additionalItems),this.addSubSchemaObject(i,e.properties),this.addSubSchema(i,e.additionalProperties),this.addSubSchemaObject(i,e.definitions),this.addSubSchemaObject(i,e.patternProperties),this.addSubSchemaObject(i,e.dependencies),this.addSubSchemaArray(i,e.disallow),this.addSubSchemaArray(i,e.allOf),this.addSubSchemaArray(i,e.anyOf),this.addSubSchemaArray(i,e.oneOf),this.addSubSchema(i,e.not),this.schemas[n]}},c.prototype.addSubSchemaArray=function(t,e){if(e instanceof Array)for(var r=0;r<e.length;r++)this.addSubSchema(t,e[r])},c.prototype.addSubSchemaObject=function(t,e){if(e&&"object"==typeof e)for(var r in e)this.addSubSchema(t,e[r])},c.prototype.setSchemas=function(t){this.schemas=t},c.prototype.getSchema=function(t){return this.schemas[t]},c.prototype.validate=function(t,e,r,n){r||(r={});var i=r.propertyName||"instance",a=o.resolve(r.base||"/",e.id||"");if(n||(n=new l(e,r,i,a,Object.create(this.schemas)),n.schemas[a]||(n.schemas[a]=e)),e){var s=this.validateSchema(t,e,r,n);if(!s)throw new Error("Result undefined");return s}throw new u("no schema specified",e)},c.prototype.validateSchema=function(t,e,r,o){var c=new s(t,e,r,o);if(!e)throw new Error("schema is undefined");if(e.extends)if(e.extends instanceof Array){var f={schema:e,ctx:o};e.extends.forEach(this.schemaTraverser.bind(this,f)),e=f.schema,f.schema=null,f.ctx=null,f=null}else e=a.deepMerge(e,this.superResolve(e.extends,o));var d;if(d=n(e)){var p=this.resolve(e,d,o),h=new l(p.subschema,r,o.propertyPath,p.switchSchema,o.schemas);return this.validateSchema(t,p.subschema,r,h)}var m=r&&r.skipAttributes||[];for(var g in e)if(!i.ignoreProperties[g]&&m.indexOf(g)<0){var v=null,b=this.attributes[g];if(b)v=b.call(this,t,e,r,o);else if(!1===r.allowUnknownAttributes)throw new u("Unsupported attribute: "+g,e);v&&c.importErrors(v)}if("function"==typeof r.rewrite){var y=r.rewrite.call(this,t,e,r,o);c.instance=y}return c},c.prototype.schemaTraverser=function(t,e){t.schema=a.deepMerge(t.schema,this.superResolve(e,t.ctx))},c.prototype.superResolve=function(t,e){var r;return(r=n(t))?this.resolve(t,r,e).subschema:t},c.prototype.resolve=function(t,e,r){if(e=r.resolve(e),r.schemas[e])return{subschema:r.schemas[e],switchSchema:e};var n=o.parse(e),i=n&&n.hash,s=i&&i.length&&e.substr(0,e.length-i.length);if(!s||!r.schemas[s])throw new u("no such schema <"+e+">",t);var l=a.objectGetPath(r.schemas[s],i.substr(1));if(void 0===l)throw new u("no such schema "+i+" located in <"+s+">",t);return{subschema:l,switchSchema:e}},c.prototype.testType=function(t,e,r,n,o){if("function"==typeof this.types[o])return this.types[o].call(this,t);if(o&&"object"==typeof o){var i=this.validateSchema(t,o,r,n);return void 0===i||!(i&&i.errors.length)}return!0};var f=c.prototype.types={};f.string=function(t){return"string"==typeof t},f.number=function(t){return"number"==typeof t&&isFinite(t)},f.integer=function(t){return"number"==typeof t&&t%1==0},f.boolean=function(t){return"boolean"==typeof t},f.array=function(t){return t instanceof Array},f.null=function(t){return null===t},f.date=function(t){return t instanceof Date},f.any=function(t){return!0},f.object=function(t){return t&&"object"==typeof t&&!(t instanceof Array)&&!(t instanceof Date)},e.exports=c},{"./attribute":202,"./helpers":203,url:519}],206:[function(t,e,r){var n=t("./_getNative"),o=t("./_root"),i=n(o,"DataView");e.exports=i},{"./_getNative":329,"./_root":383}],207:[function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var o=t("./_hashClear"),i=t("./_hashDelete"),a=t("./_hashGet"),s=t("./_hashHas"),u=t("./_hashSet");n.prototype.clear=o,n.prototype.delete=i,n.prototype.get=a,n.prototype.has=s,n.prototype.set=u,e.exports=n},{"./_hashClear":339,"./_hashDelete":340,"./_hashGet":341,"./_hashHas":342,"./_hashSet":343}],208:[function(t,e,r){function n(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var o=t("./_baseCreate"),i=t("./_baseLodash"),a=4294967295;n.prototype=o(i.prototype),n.prototype.constructor=n,e.exports=n},{"./_baseCreate":239,"./_baseLodash":263}],209:[function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var o=t("./_listCacheClear"),i=t("./_listCacheDelete"),a=t("./_listCacheGet"),s=t("./_listCacheHas"),u=t("./_listCacheSet");n.prototype.clear=o,n.prototype.delete=i,n.prototype.get=a,n.prototype.has=s,n.prototype.set=u,e.exports=n},{"./_listCacheClear":357,"./_listCacheDelete":358,"./_listCacheGet":359,"./_listCacheHas":360,"./_listCacheSet":361}],210:[function(t,e,r){function n(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}var o=t("./_baseCreate"),i=t("./_baseLodash");n.prototype=o(i.prototype),n.prototype.constructor=n,e.exports=n},{"./_baseCreate":239,"./_baseLodash":263}],211:[function(t,e,r){var n=t("./_getNative"),o=t("./_root"),i=n(o,"Map");e.exports=i},{"./_getNative":329,"./_root":383}],212:[function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}var o=t("./_mapCacheClear"),i=t("./_mapCacheDelete"),a=t("./_mapCacheGet"),s=t("./_mapCacheHas"),u=t("./_mapCacheSet");n.prototype.clear=o,n.prototype.delete=i,n.prototype.get=a,n.prototype.has=s,n.prototype.set=u,e.exports=n},{"./_mapCacheClear":362,"./_mapCacheDelete":363,"./_mapCacheGet":364,"./_mapCacheHas":365,"./_mapCacheSet":366}],213:[function(t,e,r){var n=t("./_getNative"),o=t("./_root"),i=n(o,"Promise");e.exports=i},{"./_getNative":329,"./_root":383}],214:[function(t,e,r){var n=t("./_getNative"),o=t("./_root"),i=n(o,"Set");e.exports=i},{"./_getNative":329,"./_root":383}],215:[function(t,e,r){function n(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new o;++e<r;)this.add(t[e])}var o=t("./_MapCache"),i=t("./_setCacheAdd"),a=t("./_setCacheHas");n.prototype.add=n.prototype.push=i,n.prototype.has=a,e.exports=n},{"./_MapCache":212,"./_setCacheAdd":384,"./_setCacheHas":385}],216:[function(t,e,r){function n(t){var e=this.__data__=new o(t);this.size=e.size}var o=t("./_ListCache"),i=t("./_stackClear"),a=t("./_stackDelete"),s=t("./_stackGet"),u=t("./_stackHas"),l=t("./_stackSet");n.prototype.clear=i,n.prototype.delete=a,n.prototype.get=s,n.prototype.has=u,n.prototype.set=l,e.exports=n},{"./_ListCache":209,"./_stackClear":391,"./_stackDelete":392,"./_stackGet":393,"./_stackHas":394,"./_stackSet":395}],217:[function(t,e,r){var n=t("./_root"),o=n.Symbol;e.exports=o},{"./_root":383}],218:[function(t,e,r){var n=t("./_root"),o=n.Uint8Array;e.exports=o},{"./_root":383}],219:[function(t,e,r){var n=t("./_getNative"),o=t("./_root"),i=n(o,"WeakMap");e.exports=i},{"./_getNative":329,"./_root":383}],220:[function(t,e,r){function n(t,e){return t.set(e[0],e[1]),t}e.exports=n},{}],221:[function(t,e,r){function n(t,e){return t.add(e),t}e.exports=n},{}],222:[function(t,e,r){function n(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}e.exports=n},{}],223:[function(t,e,r){function n(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}e.exports=n},{}],224:[function(t,e,r){function n(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}e.exports=n},{}],225:[function(t,e,r){function n(t,e){return!!(null==t?0:t.length)&&o(t,e,0)>-1}var o=t("./_baseIndexOf");e.exports=n},{"./_baseIndexOf":252}],226:[function(t,e,r){function n(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}e.exports=n},{}],227:[function(t,e,r){function n(t,e){var r=a(t),n=!r&&i(t),c=!r&&!n&&s(t),d=!r&&!n&&!c&&l(t),p=r||n||c||d,h=p?o(t.length,String):[],m=h.length;for(var g in t)!e&&!f.call(t,g)||p&&("length"==g||c&&("offset"==g||"parent"==g)||d&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||u(g,m))||h.push(g);return h}var o=t("./_baseTimes"),i=t("./isArguments"),a=t("./isArray"),s=t("./isBuffer"),u=t("./_isIndex"),l=t("./isTypedArray"),c=Object.prototype,f=c.hasOwnProperty;e.exports=n},{"./_baseTimes":277,"./_isIndex":349,"./isArguments":448,"./isArray":449,"./isBuffer":452,"./isTypedArray":461}],228:[function(t,e,r){function n(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}e.exports=n},{}],229:[function(t,e,r){function n(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}e.exports=n},{}],230:[function(t,e,r){function n(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}e.exports=n},{}],231:[function(t,e,r){function n(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}e.exports=n},{}],232:[function(t,e,r){function n(t){return t.split("")}e.exports=n},{}],233:[function(t,e,r){function n(t,e,r){var n=t[e];s.call(t,e)&&i(n,r)&&(void 0!==r||e in t)||o(t,e,r)}var o=t("./_baseAssignValue"),i=t("./eq"),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},{"./_baseAssignValue":237,"./eq":412}],234:[function(t,e,r){function n(t,e){for(var r=t.length;r--;)if(o(t[r][0],e))return r;return-1}var o=t("./eq");e.exports=n},{"./eq":412}],235:[function(t,e,r){function n(t,e){return t&&o(e,i(e),t)}var o=t("./_copyObject"),i=t("./keys");e.exports=n},{"./_copyObject":297,"./keys":463}],236:[function(t,e,r){function n(t,e){return t&&o(e,i(e),t)}var o=t("./_copyObject"),i=t("./keysIn");e.exports=n},{"./_copyObject":297,"./keysIn":464}],237:[function(t,e,r){function n(t,e,r){"__proto__"==e&&o?o(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var o=t("./_defineProperty");e.exports=n},{"./_defineProperty":316}],238:[function(t,e,r){function n(t,e,r,k,M,R){var N,I=e&S,B=e&O,L=e&A;if(r&&(N=M?r(t,k,M,R):r(t)),void 0!==N)return N;if(!x(t))return t;var D=y(t);if(D){if(N=g(t),!I)return c(t,N)}else{var F=m(t),G=F==j||F==P;if(_(t))return l(t,I);if(F==T||F==E||G&&!M){if(N=B||G?{}:b(t),!I)return B?d(t,u(N,t)):f(t,s(N,t))}else{if(!C[F])return M?t:{};N=v(t,F,n,I)}}R||(R=new o);var z=R.get(t);if(z)return z;R.set(t,N);var H=L?B?h:p:B?keysIn:w,W=D?void 0:H(t);return i(W||t,function(o,i){W&&(i=o,o=t[i]),a(N,i,n(o,e,r,i,t,R))}),N}var o=t("./_Stack"),i=t("./_arrayEach"),a=t("./_assignValue"),s=t("./_baseAssign"),u=t("./_baseAssignIn"),l=t("./_cloneBuffer"),c=t("./_copyArray"),f=t("./_copySymbols"),d=t("./_copySymbolsIn"),p=t("./_getAllKeys"),h=t("./_getAllKeysIn"),m=t("./_getTag"),g=t("./_initCloneArray"),v=t("./_initCloneByTag"),b=t("./_initCloneObject"),y=t("./isArray"),_=t("./isBuffer"),x=t("./isObject"),w=t("./keys"),S=1,O=2,A=4,E="[object Arguments]",j="[object Function]",P="[object GeneratorFunction]",T="[object Object]",C={};C[E]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[T]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[j]=C["[object WeakMap]"]=!1,e.exports=n},{"./_Stack":216,"./_arrayEach":223,"./_assignValue":233,"./_baseAssign":235,"./_baseAssignIn":236,"./_cloneBuffer":287,"./_copyArray":296,"./_copySymbols":298,"./_copySymbolsIn":299,"./_getAllKeys":322,"./_getAllKeysIn":323,"./_getTag":334,"./_initCloneArray":344,"./_initCloneByTag":345,"./_initCloneObject":346,"./isArray":449,"./isBuffer":452,"./isObject":457,"./keys":463}],239:[function(t,e,r){var n=t("./isObject"),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();e.exports=i},{"./isObject":457}],240:[function(t,e,r){function n(t,e,r,n){var f=-1,d=i,p=!0,h=t.length,m=[],g=e.length;if(!h)return m;r&&(e=s(e,u(r))),n?(d=a,p=!1):e.length>=c&&(d=l,p=!1,e=new o(e));t:for(;++f<h;){var v=t[f],b=null==r?v:r(v);if(v=n||0!==v?v:0,p&&b===b){for(var y=g;y--;)if(e[y]===b)continue t;m.push(v)}else d(e,b,n)||m.push(v)}return m}var o=t("./_SetCache"),i=t("./_arrayIncludes"),a=t("./_arrayIncludesWith"),s=t("./_arrayMap"),u=t("./_baseUnary"),l=t("./_cacheHas"),c=200;e.exports=n},{"./_SetCache":215,"./_arrayIncludes":225,"./_arrayIncludesWith":226,"./_arrayMap":228,"./_baseUnary":279,"./_cacheHas":283}],241:[function(t,e,r){var n=t("./_baseForOwn"),o=t("./_createBaseEach"),i=o(n);e.exports=i},{"./_baseForOwn":246,"./_createBaseEach":302}],242:[function(t,e,r){function n(t,e){var r=[];return o(t,function(t,n,o){e(t,n,o)&&r.push(t)}),r}var o=t("./_baseEach");e.exports=n},{"./_baseEach":241}],243:[function(t,e,r){function n(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}e.exports=n},{}],244:[function(t,e,r){function n(t,e,r,a,s){var u=-1,l=t.length;for(r||(r=i),s||(s=[]);++u<l;){var c=t[u];e>0&&r(c)?e>1?n(c,e-1,r,a,s):o(s,c):a||(s[s.length]=c)}return s}var o=t("./_arrayPush"),i=t("./_isFlattenable");e.exports=n},{"./_arrayPush":229,"./_isFlattenable":348}],245:[function(t,e,r){var n=t("./_createBaseFor"),o=n();e.exports=o},{"./_createBaseFor":303}],246:[function(t,e,r){function n(t,e){return t&&o(t,e,i)}var o=t("./_baseFor"),i=t("./keys");e.exports=n},{"./_baseFor":245,"./keys":463}],247:[function(t,e,r){function n(t,e){e=o(e,t);for(var r=0,n=e.length;null!=t&&r<n;)t=t[i(e[r++])];return r&&r==n?t:void 0}var o=t("./_castPath"),i=t("./_toKey");e.exports=n},{"./_castPath":284,"./_toKey":399}],248:[function(t,e,r){function n(t,e,r){var n=e(t);return i(t)?n:o(n,r(t))}var o=t("./_arrayPush"),i=t("./isArray");e.exports=n},{"./_arrayPush":229,"./isArray":449}],249:[function(t,e,r){function n(t){return null==t?void 0===t?u:s:l&&l in Object(t)?i(t):a(t)}var o=t("./_Symbol"),i=t("./_getRawTag"),a=t("./_objectToString"),s="[object Null]",u="[object Undefined]",l=o?o.toStringTag:void 0;e.exports=n},{"./_Symbol":217,"./_getRawTag":331,"./_objectToString":376}],250:[function(t,e,r){function n(t,e){return null!=t&&e in Object(t)}e.exports=n},{}],251:[function(t,e,r){function n(t,e,r){return t>=i(e,r)&&t<o(e,r)}var o=Math.max,i=Math.min;e.exports=n},{}],252:[function(t,e,r){function n(t,e,r){return e===e?a(t,e,r):o(t,i,r)}var o=t("./_baseFindIndex"),i=t("./_baseIsNaN"),a=t("./_strictIndexOf");e.exports=n},{"./_baseFindIndex":243,"./_baseIsNaN":257,"./_strictIndexOf":396}],253:[function(t,e,r){function n(t){return i(t)&&o(t)==a}var o=t("./_baseGetTag"),i=t("./isObjectLike"),a="[object Arguments]";e.exports=n},{"./_baseGetTag":249,"./isObjectLike":458}],254:[function(t,e,r){function n(t,e,r,a,s){return t===e||(null==t||null==e||!i(t)&&!i(e)?t!==t&&e!==e:o(t,e,r,a,n,s))}var o=t("./_baseIsEqualDeep"),i=t("./isObjectLike");e.exports=n},{"./_baseIsEqualDeep":255,"./isObjectLike":458}],255:[function(t,e,r){function n(t,e,r,n,g,b){var y=l(t),_=l(e),x=y?h:u(t),w=_?h:u(e);x=x==p?m:x,w=w==p?m:w;var S=x==m,O=w==m,A=x==w;if(A&&c(t)){if(!c(e))return!1;y=!0,S=!1}if(A&&!S)return b||(b=new o),y||f(t)?i(t,e,r,n,g,b):a(t,e,x,r,n,g,b);if(!(r&d)){var E=S&&v.call(t,"__wrapped__"),j=O&&v.call(e,"__wrapped__");if(E||j){var P=E?t.value():t,T=j?e.value():e;return b||(b=new o),g(P,T,r,n,b)}}return!!A&&(b||(b=new o),s(t,e,r,n,g,b))}var o=t("./_Stack"),i=t("./_equalArrays"),a=t("./_equalByTag"),s=t("./_equalObjects"),u=t("./_getTag"),l=t("./isArray"),c=t("./isBuffer"),f=t("./isTypedArray"),d=1,p="[object Arguments]",h="[object Array]",m="[object Object]",g=Object.prototype,v=g.hasOwnProperty;e.exports=n},{"./_Stack":216,"./_equalArrays":317,"./_equalByTag":318,"./_equalObjects":319,"./_getTag":334,"./isArray":449,"./isBuffer":452,"./isTypedArray":461}],256:[function(t,e,r){function n(t,e,r,n){var u=r.length,l=u,c=!n;if(null==t)return!l;for(t=Object(t);u--;){var f=r[u];if(c&&f[2]?f[1]!==t[f[0]]:!(f[0]in t))return!1}for(;++u<l;){f=r[u];var d=f[0],p=t[d],h=f[1];if(c&&f[2]){if(void 0===p&&!(d in t))return!1}else{var m=new o;if(n)var g=n(p,h,d,t,e,m);if(!(void 0===g?i(h,p,a|s,n,m):g))return!1}}return!0}var o=t("./_Stack"),i=t("./_baseIsEqual"),a=1,s=2;e.exports=n},{"./_Stack":216,"./_baseIsEqual":254}],257:[function(t,e,r){function n(t){return t!==t}e.exports=n},{}],258:[function(t,e,r){function n(t){return!(!a(t)||i(t))&&(o(t)?h:l).test(s(t))}var o=t("./isFunction"),i=t("./_isMasked"),a=t("./isObject"),s=t("./_toSource"),u=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,f=Object.prototype,d=c.toString,p=f.hasOwnProperty,h=RegExp("^"+d.call(p).replace(u,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},{"./_isMasked":354,"./_toSource":400,"./isFunction":455,"./isObject":457}],259:[function(t,e,r){function n(t){return a(t)&&i(t.length)&&!!s[o(t)]}var o=t("./_baseGetTag"),i=t("./isLength"),a=t("./isObjectLike"),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=n},{"./_baseGetTag":249,"./isLength":456,"./isObjectLike":458}],260:[function(t,e,r){function n(t){return"function"==typeof t?t:null==t?a:"object"==typeof t?s(t)?i(t[0],t[1]):o(t):u(t)}var o=t("./_baseMatches"),i=t("./_baseMatchesProperty"),a=t("./identity"),s=t("./isArray"),u=t("./property");e.exports=n},{"./_baseMatches":264,"./_baseMatchesProperty":265,"./identity":446,"./isArray":449,"./property":472}],261:[function(t,e,r){function n(t){if(!o(t))return i(t);var e=[];for(var r in Object(t))s.call(t,r)&&"constructor"!=r&&e.push(r);return e}var o=t("./_isPrototype"),i=t("./_nativeKeys"),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},{"./_isPrototype":355,"./_nativeKeys":373}],262:[function(t,e,r){function n(t){if(!o(t))return a(t);var e=i(t),r=[];for(var n in t)("constructor"!=n||!e&&u.call(t,n))&&r.push(n);return r}var o=t("./isObject"),i=t("./_isPrototype"),a=t("./_nativeKeysIn"),s=Object.prototype,u=s.hasOwnProperty;e.exports=n},{"./_isPrototype":355,"./_nativeKeysIn":374,"./isObject":457}],263:[function(t,e,r){function n(){}e.exports=n},{}],264:[function(t,e,r){function n(t){var e=i(t);return 1==e.length&&e[0][2]?a(e[0][0],e[0][1]):function(r){return r===t||o(r,t,e)}}var o=t("./_baseIsMatch"),i=t("./_getMatchData"),a=t("./_matchesStrictComparable");e.exports=n},{"./_baseIsMatch":256,"./_getMatchData":328,"./_matchesStrictComparable":368}],265:[function(t,e,r){function n(t,e){return s(t)&&u(e)?l(c(t),e):function(r){var n=i(r,t);return void 0===n&&n===e?a(r,t):o(e,n,f|d)}}var o=t("./_baseIsEqual"),i=t("./get"),a=t("./hasIn"),s=t("./_isKey"),u=t("./_isStrictComparable"),l=t("./_matchesStrictComparable"),c=t("./_toKey"),f=1,d=2;e.exports=n},{"./_baseIsEqual":254,"./_isKey":351,"./_isStrictComparable":356,"./_matchesStrictComparable":368,"./_toKey":399,"./get":444,"./hasIn":445}],266:[function(t,e,r){function n(t,e){return o(t,e,function(e,r){return i(t,r)})}var o=t("./_basePickBy"),i=t("./hasIn");e.exports=n},{"./_basePickBy":267,"./hasIn":445}],267:[function(t,e,r){function n(t,e,r){for(var n=-1,s=e.length,u={};++n<s;){var l=e[n],c=o(t,l);r(c,l)&&i(u,a(l,t),c)}return u}var o=t("./_baseGet"),i=t("./_baseSet"),a=t("./_castPath");e.exports=n},{"./_baseGet":247,"./_baseSet":273,"./_castPath":284}],268:[function(t,e,r){function n(t){return function(e){return null==e?void 0:e[t]}}e.exports=n},{}],269:[function(t,e,r){function n(t){return function(e){return o(e,t)}}var o=t("./_baseGet");e.exports=n},{"./_baseGet":247}],270:[function(t,e,r){function n(t,e,r,n){for(var a=-1,s=i(o((e-t)/(r||1)),0),u=Array(s);s--;)u[n?s:++a]=t,t+=r;return u}var o=Math.ceil,i=Math.max;e.exports=n},{}],271:[function(t,e,r){function n(t,e,r,n,o){return o(t,function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)}),r}e.exports=n},{}],272:[function(t,e,r){function n(t,e){return a(i(t,e,o),t+"")}var o=t("./identity"),i=t("./_overRest"),a=t("./_setToString");e.exports=n},{"./_overRest":378,"./_setToString":388,"./identity":446}],273:[function(t,e,r){function n(t,e,r,n){if(!s(t))return t;e=i(e,t);for(var l=-1,c=e.length,f=c-1,d=t;null!=d&&++l<c;){var p=u(e[l]),h=r;if(l!=f){var m=d[p];h=n?n(m,p,d):void 0,void 0===h&&(h=s(m)?m:a(e[l+1])?[]:{})}o(d,p,h),d=d[p]}return t}var o=t("./_assignValue"),i=t("./_castPath"),a=t("./_isIndex"),s=t("./isObject"),u=t("./_toKey");e.exports=n},{"./_assignValue":233,"./_castPath":284,"./_isIndex":349,"./_toKey":399,"./isObject":457}],274:[function(t,e,r){var n=t("./identity"),o=t("./_metaMap"),i=o?function(t,e){return o.set(t,e),t}:n;e.exports=i},{"./_metaMap":371,"./identity":446}],275:[function(t,e,r){
  var n=t("./constant"),o=t("./_defineProperty"),i=t("./identity"),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;e.exports=a},{"./_defineProperty":316,"./constant":408,"./identity":446}],276:[function(t,e,r){function n(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}e.exports=n},{}],277:[function(t,e,r){function n(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}e.exports=n},{}],278:[function(t,e,r){function n(t){if("string"==typeof t)return t;if(a(t))return i(t,n)+"";if(s(t))return c?c.call(t):"";var e=t+"";return"0"==e&&1/t==-u?"-0":e}var o=t("./_Symbol"),i=t("./_arrayMap"),a=t("./isArray"),s=t("./isSymbol"),u=1/0,l=o?o.prototype:void 0,c=l?l.toString:void 0;e.exports=n},{"./_Symbol":217,"./_arrayMap":228,"./isArray":449,"./isSymbol":460}],279:[function(t,e,r){function n(t){return function(e){return t(e)}}e.exports=n},{}],280:[function(t,e,r){function n(t,e,r){var n=-1,f=i,d=t.length,p=!0,h=[],m=h;if(r)p=!1,f=a;else if(d>=c){var g=e?null:u(t);if(g)return l(g);p=!1,f=s,m=new o}else m=e?[]:h;t:for(;++n<d;){var v=t[n],b=e?e(v):v;if(v=r||0!==v?v:0,p&&b===b){for(var y=m.length;y--;)if(m[y]===b)continue t;e&&m.push(b),h.push(v)}else f(m,b,r)||(m!==h&&m.push(b),h.push(v))}return h}var o=t("./_SetCache"),i=t("./_arrayIncludes"),a=t("./_arrayIncludesWith"),s=t("./_cacheHas"),u=t("./_createSet"),l=t("./_setToArray"),c=200;e.exports=n},{"./_SetCache":215,"./_arrayIncludes":225,"./_arrayIncludesWith":226,"./_cacheHas":283,"./_createSet":313,"./_setToArray":387}],281:[function(t,e,r){function n(t,e){return e=o(e,t),null==(t=a(t,e))||delete t[s(i(e))]}var o=t("./_castPath"),i=t("./last"),a=t("./_parent"),s=t("./_toKey");e.exports=n},{"./_castPath":284,"./_parent":379,"./_toKey":399,"./last":465}],282:[function(t,e,r){function n(t,e,r){var n=t.length;if(n<2)return n?a(t[0]):[];for(var s=-1,u=Array(n);++s<n;)for(var l=t[s],c=-1;++c<n;)c!=s&&(u[s]=o(u[s]||l,t[c],e,r));return a(i(u,1),e,r)}var o=t("./_baseDifference"),i=t("./_baseFlatten"),a=t("./_baseUniq");e.exports=n},{"./_baseDifference":240,"./_baseFlatten":244,"./_baseUniq":280}],283:[function(t,e,r){function n(t,e){return t.has(e)}e.exports=n},{}],284:[function(t,e,r){function n(t,e){return o(t)?t:i(t,e)?[t]:a(s(t))}var o=t("./isArray"),i=t("./_isKey"),a=t("./_stringToPath"),s=t("./toString");e.exports=n},{"./_isKey":351,"./_stringToPath":398,"./isArray":449,"./toString":483}],285:[function(t,e,r){function n(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:o(t,e,r)}var o=t("./_baseSlice");e.exports=n},{"./_baseSlice":276}],286:[function(t,e,r){function n(t){var e=new t.constructor(t.byteLength);return new o(e).set(new o(t)),e}var o=t("./_Uint8Array");e.exports=n},{"./_Uint8Array":218}],287:[function(t,e,r){function n(t,e){if(e)return t.slice();var r=t.length,n=l?l(r):new t.constructor(r);return t.copy(n),n}var o=t("./_root"),i="object"==typeof r&&r&&!r.nodeType&&r,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===i,u=s?o.Buffer:void 0,l=u?u.allocUnsafe:void 0;e.exports=n},{"./_root":383}],288:[function(t,e,r){function n(t,e){var r=e?o(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var o=t("./_cloneArrayBuffer");e.exports=n},{"./_cloneArrayBuffer":286}],289:[function(t,e,r){function n(t,e,r){var n=e?r(a(t),s):a(t);return i(n,o,new t.constructor)}var o=t("./_addMapEntry"),i=t("./_arrayReduce"),a=t("./_mapToArray"),s=1;e.exports=n},{"./_addMapEntry":220,"./_arrayReduce":230,"./_mapToArray":367}],290:[function(t,e,r){function n(t){var e=new t.constructor(t.source,o.exec(t));return e.lastIndex=t.lastIndex,e}var o=/\w*$/;e.exports=n},{}],291:[function(t,e,r){function n(t,e,r){var n=e?r(a(t),s):a(t);return i(n,o,new t.constructor)}var o=t("./_addSetEntry"),i=t("./_arrayReduce"),a=t("./_setToArray"),s=1;e.exports=n},{"./_addSetEntry":221,"./_arrayReduce":230,"./_setToArray":387}],292:[function(t,e,r){function n(t){return a?Object(a.call(t)):{}}var o=t("./_Symbol"),i=o?o.prototype:void 0,a=i?i.valueOf:void 0;e.exports=n},{"./_Symbol":217}],293:[function(t,e,r){function n(t,e){var r=e?o(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var o=t("./_cloneArrayBuffer");e.exports=n},{"./_cloneArrayBuffer":286}],294:[function(t,e,r){function n(t,e,r,n){for(var i=-1,a=t.length,s=r.length,u=-1,l=e.length,c=o(a-s,0),f=Array(l+c),d=!n;++u<l;)f[u]=e[u];for(;++i<s;)(d||i<a)&&(f[r[i]]=t[i]);for(;c--;)f[u++]=t[i++];return f}var o=Math.max;e.exports=n},{}],295:[function(t,e,r){function n(t,e,r,n){for(var i=-1,a=t.length,s=-1,u=r.length,l=-1,c=e.length,f=o(a-u,0),d=Array(f+c),p=!n;++i<f;)d[i]=t[i];for(var h=i;++l<c;)d[h+l]=e[l];for(;++s<u;)(p||i<a)&&(d[h+r[s]]=t[i++]);return d}var o=Math.max;e.exports=n},{}],296:[function(t,e,r){function n(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}e.exports=n},{}],297:[function(t,e,r){function n(t,e,r,n){var a=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var l=e[s],c=n?n(r[l],t[l],l,r,t):void 0;void 0===c&&(c=t[l]),a?i(r,l,c):o(r,l,c)}return r}var o=t("./_assignValue"),i=t("./_baseAssignValue");e.exports=n},{"./_assignValue":233,"./_baseAssignValue":237}],298:[function(t,e,r){function n(t,e){return o(t,i(t),e)}var o=t("./_copyObject"),i=t("./_getSymbols");e.exports=n},{"./_copyObject":297,"./_getSymbols":332}],299:[function(t,e,r){function n(t,e){return o(t,i(t),e)}var o=t("./_copyObject"),i=t("./_getSymbolsIn");e.exports=n},{"./_copyObject":297,"./_getSymbolsIn":333}],300:[function(t,e,r){var n=t("./_root"),o=n["__core-js_shared__"];e.exports=o},{"./_root":383}],301:[function(t,e,r){function n(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}e.exports=n},{}],302:[function(t,e,r){function n(t,e){return function(r,n){if(null==r)return r;if(!o(r))return t(r,n);for(var i=r.length,a=e?i:-1,s=Object(r);(e?a--:++a<i)&&!1!==n(s[a],a,s););return r}}var o=t("./isArrayLike");e.exports=n},{"./isArrayLike":450}],303:[function(t,e,r){function n(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===r(i[u],u,i))break}return e}}e.exports=n},{}],304:[function(t,e,r){function n(t,e,r){function n(){return(this&&this!==i&&this instanceof n?u:t).apply(s?r:this,arguments)}var s=e&a,u=o(t);return n}var o=t("./_createCtor"),i=t("./_root"),a=1;e.exports=n},{"./_createCtor":306,"./_root":383}],305:[function(t,e,r){function n(t){return function(e){e=s(e);var r=i(e)?a(e):void 0,n=r?r[0]:e.charAt(0),u=r?o(r,1).join(""):e.slice(1);return n[t]()+u}}var o=t("./_castSlice"),i=t("./_hasUnicode"),a=t("./_stringToArray"),s=t("./toString");e.exports=n},{"./_castSlice":285,"./_hasUnicode":338,"./_stringToArray":397,"./toString":483}],306:[function(t,e,r){function n(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=o(t.prototype),n=t.apply(r,e);return i(n)?n:r}}var o=t("./_baseCreate"),i=t("./isObject");e.exports=n},{"./_baseCreate":239,"./isObject":457}],307:[function(t,e,r){function n(t,e,r){function n(){for(var i=arguments.length,d=Array(i),p=i,h=u(n);p--;)d[p]=arguments[p];var m=i<3&&d[0]!==h&&d[i-1]!==h?[]:l(d,h);return(i-=m.length)<r?s(t,e,a,n.placeholder,void 0,d,m,void 0,void 0,r-i):o(this&&this!==c&&this instanceof n?f:t,this,d)}var f=i(t);return n}var o=t("./_apply"),i=t("./_createCtor"),a=t("./_createHybrid"),s=t("./_createRecurry"),u=t("./_getHolder"),l=t("./_replaceHolders"),c=t("./_root");e.exports=n},{"./_apply":222,"./_createCtor":306,"./_createHybrid":309,"./_createRecurry":312,"./_getHolder":326,"./_replaceHolders":382,"./_root":383}],308:[function(t,e,r){function n(t){return i(function(e){var r=e.length,n=r,i=o.prototype.thru;for(t&&e.reverse();n--;){var m=e[n];if("function"!=typeof m)throw new TypeError(c);if(i&&!g&&"wrapper"==s(m))var g=new o([],!0)}for(n=g?n:r;++n<r;){m=e[n];var v=s(m),b="wrapper"==v?a(m):void 0;g=b&&l(b[0])&&b[1]==(p|f|d|h)&&!b[4].length&&1==b[9]?g[s(b[0])].apply(g,b[3]):1==m.length&&l(m)?g[v]():g.thru(m)}return function(){var t=arguments,n=t[0];if(g&&1==t.length&&u(n))return g.plant(n).value();for(var o=0,i=r?e[o].apply(this,t):n;++o<r;)i=e[o].call(this,i);return i}})}var o=t("./_LodashWrapper"),i=t("./_flatRest"),a=t("./_getData"),s=t("./_getFuncName"),u=t("./isArray"),l=t("./_isLaziable"),c="Expected a function",f=8,d=32,p=128,h=256;e.exports=n},{"./_LodashWrapper":210,"./_flatRest":320,"./_getData":324,"./_getFuncName":325,"./_isLaziable":353,"./isArray":449}],309:[function(t,e,r){function n(t,e,r,y,_,x,w,S,O,A){function E(){for(var p=arguments.length,h=Array(p),m=p;m--;)h[m]=arguments[m];if(C)var g=l(E),v=a(h,g);if(y&&(h=o(h,y,_,C)),x&&(h=i(h,x,w,C)),p-=v,C&&p<A){var b=f(h,g);return u(t,e,n,E.placeholder,r,h,b,S,O,A-p)}var R=P?r:this,N=T?R[t]:t;return p=h.length,S?h=c(h,S):k&&p>1&&h.reverse(),j&&O<p&&(h.length=O),this&&this!==d&&this instanceof E&&(N=M||s(N)),N.apply(R,h)}var j=e&v,P=e&p,T=e&h,C=e&(m|g),k=e&b,M=T?void 0:s(t);return E}var o=t("./_composeArgs"),i=t("./_composeArgsRight"),a=t("./_countHolders"),s=t("./_createCtor"),u=t("./_createRecurry"),l=t("./_getHolder"),c=t("./_reorder"),f=t("./_replaceHolders"),d=t("./_root"),p=1,h=2,m=8,g=16,v=128,b=512;e.exports=n},{"./_composeArgs":294,"./_composeArgsRight":295,"./_countHolders":301,"./_createCtor":306,"./_createRecurry":312,"./_getHolder":326,"./_reorder":381,"./_replaceHolders":382,"./_root":383}],310:[function(t,e,r){function n(t,e,r,n){function u(){for(var e=-1,i=arguments.length,s=-1,f=n.length,d=Array(f+i),p=this&&this!==a&&this instanceof u?c:t;++s<f;)d[s]=n[s];for(;i--;)d[s++]=arguments[++e];return o(p,l?r:this,d)}var l=e&s,c=i(t);return u}var o=t("./_apply"),i=t("./_createCtor"),a=t("./_root"),s=1;e.exports=n},{"./_apply":222,"./_createCtor":306,"./_root":383}],311:[function(t,e,r){function n(t){return function(e,r,n){return n&&"number"!=typeof n&&i(e,r,n)&&(r=n=void 0),e=a(e),void 0===r?(r=e,e=0):r=a(r),n=void 0===n?e<r?1:-1:a(n),o(e,r,n,t)}}var o=t("./_baseRange"),i=t("./_isIterateeCall"),a=t("./toFinite");e.exports=n},{"./_baseRange":270,"./_isIterateeCall":350,"./toFinite":479}],312:[function(t,e,r){function n(t,e,r,n,p,h,m,g,v,b){var y=e&c,_=y?m:void 0,x=y?void 0:m,w=y?h:void 0,S=y?void 0:h;e|=y?f:d,(e&=~(y?d:f))&l||(e&=~(s|u));var O=[t,e,p,w,_,S,x,g,v,b],A=r.apply(void 0,O);return o(t)&&i(A,O),A.placeholder=n,a(A,t,e)}var o=t("./_isLaziable"),i=t("./_setData"),a=t("./_setWrapToString"),s=1,u=2,l=4,c=8,f=32,d=64;e.exports=n},{"./_isLaziable":353,"./_setData":386,"./_setWrapToString":389}],313:[function(t,e,r){var n=t("./_Set"),o=t("./noop"),i=t("./_setToArray"),a=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;e.exports=a},{"./_Set":214,"./_setToArray":387,"./noop":467}],314:[function(t,e,r){function n(t,e,r,n,w,S,O,A){var E=e&g;if(!E&&"function"!=typeof t)throw new TypeError(h);var j=n?n.length:0;if(j||(e&=~(y|_),n=w=void 0),O=void 0===O?O:x(p(O),0),A=void 0===A?A:p(A),j-=w?w.length:0,e&_){var P=n,T=w;n=w=void 0}var C=E?void 0:l(t),k=[t,e,r,n,w,P,T,S,O,A];if(C&&c(k,C),t=k[0],e=k[1],r=k[2],n=k[3],w=k[4],A=k[9]=void 0===k[9]?E?0:t.length:x(k[9]-j,0),!A&&e&(v|b)&&(e&=~(v|b)),e&&e!=m)M=e==v||e==b?a(t,e,A):e!=y&&e!=(m|y)||w.length?s.apply(void 0,k):u(t,e,r,n);else var M=i(t,e,r);return d((C?o:f)(M,k),t,e)}var o=t("./_baseSetData"),i=t("./_createBind"),a=t("./_createCurry"),s=t("./_createHybrid"),u=t("./_createPartial"),l=t("./_getData"),c=t("./_mergeData"),f=t("./_setData"),d=t("./_setWrapToString"),p=t("./toInteger"),h="Expected a function",m=1,g=2,v=8,b=16,y=32,_=64,x=Math.max;e.exports=n},{"./_baseSetData":274,"./_createBind":304,"./_createCurry":307,"./_createHybrid":309,"./_createPartial":310,"./_getData":324,"./_mergeData":370,"./_setData":386,"./_setWrapToString":389,"./toInteger":480}],315:[function(t,e,r){function n(t){return o(t)?void 0:t}var o=t("./isPlainObject");e.exports=n},{"./isPlainObject":459}],316:[function(t,e,r){var n=t("./_getNative"),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();e.exports=o},{"./_getNative":329}],317:[function(t,e,r){function n(t,e,r,n,l,c){var f=r&s,d=t.length,p=e.length;if(d!=p&&!(f&&p>d))return!1;var h=c.get(t);if(h&&c.get(e))return h==e;var m=-1,g=!0,v=r&u?new o:void 0;for(c.set(t,e),c.set(e,t);++m<d;){var b=t[m],y=e[m];if(n)var _=f?n(y,b,m,e,t,c):n(b,y,m,t,e,c);if(void 0!==_){if(_)continue;g=!1;break}if(v){if(!i(e,function(t,e){if(!a(v,e)&&(b===t||l(b,t,r,n,c)))return v.push(e)})){g=!1;break}}else if(b!==y&&!l(b,y,r,n,c)){g=!1;break}}return c.delete(t),c.delete(e),g}var o=t("./_SetCache"),i=t("./_arraySome"),a=t("./_cacheHas"),s=1,u=2;e.exports=n},{"./_SetCache":215,"./_arraySome":231,"./_cacheHas":283}],318:[function(t,e,r){function n(t,e,r,n,o,S,A){switch(r){case w:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!S(new i(t),new i(e)));case d:case p:case g:return a(+t,+e);case h:return t.name==e.name&&t.message==e.message;case v:case y:return t==e+"";case m:var E=u;case b:var j=n&c;if(E||(E=l),t.size!=e.size&&!j)return!1;var P=A.get(t);if(P)return P==e;n|=f,A.set(t,e);var T=s(E(t),E(e),n,o,S,A);return A.delete(t),T;case _:if(O)return O.call(t)==O.call(e)}return!1}var o=t("./_Symbol"),i=t("./_Uint8Array"),a=t("./eq"),s=t("./_equalArrays"),u=t("./_mapToArray"),l=t("./_setToArray"),c=1,f=2,d="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",g="[object Number]",v="[object RegExp]",b="[object Set]",y="[object String]",_="[object Symbol]",x="[object ArrayBuffer]",w="[object DataView]",S=o?o.prototype:void 0,O=S?S.valueOf:void 0;e.exports=n},{"./_Symbol":217,"./_Uint8Array":218,"./_equalArrays":317,"./_mapToArray":367,"./_setToArray":387,"./eq":412}],319:[function(t,e,r){function n(t,e,r,n,a,u){var l=r&i,c=o(t),f=c.length;if(f!=o(e).length&&!l)return!1;for(var d=f;d--;){var p=c[d];if(!(l?p in e:s.call(e,p)))return!1}var h=u.get(t);if(h&&u.get(e))return h==e;var m=!0;u.set(t,e),u.set(e,t);for(var g=l;++d<f;){p=c[d];var v=t[p],b=e[p];if(n)var y=l?n(b,v,p,e,t,u):n(v,b,p,t,e,u);if(!(void 0===y?v===b||a(v,b,r,n,u):y)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var _=t.constructor,x=e.constructor;_!=x&&"constructor"in t&&"constructor"in e&&!("function"==typeof _&&_ instanceof _&&"function"==typeof x&&x instanceof x)&&(m=!1)}return u.delete(t),u.delete(e),m}var o=t("./_getAllKeys"),i=1,a=Object.prototype,s=a.hasOwnProperty;e.exports=n},{"./_getAllKeys":322}],320:[function(t,e,r){function n(t){return a(i(t,void 0,o),t+"")}var o=t("./flatten"),i=t("./_overRest"),a=t("./_setToString");e.exports=n},{"./_overRest":378,"./_setToString":388,"./flatten":417}],321:[function(t,e,r){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],322:[function(t,e,r){function n(t){return o(t,a,i)}var o=t("./_baseGetAllKeys"),i=t("./_getSymbols"),a=t("./keys");e.exports=n},{"./_baseGetAllKeys":248,"./_getSymbols":332,"./keys":463}],323:[function(t,e,r){function n(t){return o(t,a,i)}var o=t("./_baseGetAllKeys"),i=t("./_getSymbolsIn"),a=t("./keysIn");e.exports=n},{"./_baseGetAllKeys":248,"./_getSymbolsIn":333,"./keysIn":464}],324:[function(t,e,r){var n=t("./_metaMap"),o=t("./noop"),i=n?function(t){return n.get(t)}:o;e.exports=i},{"./_metaMap":371,"./noop":467}],325:[function(t,e,r){function n(t){for(var e=t.name+"",r=o[e],n=a.call(o,e)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==t)return i.name}return e}var o=t("./_realNames"),i=Object.prototype,a=i.hasOwnProperty;e.exports=n},{"./_realNames":380}],326:[function(t,e,r){function n(t){return t.placeholder}e.exports=n},{}],327:[function(t,e,r){function n(t,e){var r=t.__data__;return o(e)?r["string"==typeof e?"string":"hash"]:r.map}var o=t("./_isKeyable");e.exports=n},{"./_isKeyable":352}],328:[function(t,e,r){function n(t){for(var e=i(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,o(a)]}return e}var o=t("./_isStrictComparable"),i=t("./keys");e.exports=n},{"./_isStrictComparable":356,"./keys":463}],329:[function(t,e,r){function n(t,e){var r=i(t,e);return o(r)?r:void 0}var o=t("./_baseIsNative"),i=t("./_getValue");e.exports=n},{"./_baseIsNative":258,"./_getValue":335}],330:[function(t,e,r){var n=t("./_overArg"),o=n(Object.getPrototypeOf,Object);e.exports=o},{"./_overArg":377}],331:[function(t,e,r){function n(t){var e=a.call(t,u),r=t[u];try{t[u]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[u]=r:delete t[u]),o}var o=t("./_Symbol"),i=Object.prototype,a=i.hasOwnProperty,s=i.toString,u=o?o.toStringTag:void 0;e.exports=n},{"./_Symbol":217}],332:[function(t,e,r){var n=t("./_arrayFilter"),o=t("./stubArray"),i=Object.prototype,a=i.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(t){return null==t?[]:(t=Object(t),n(s(t),function(e){return a.call(t,e)}))}:o;e.exports=u},{"./_arrayFilter":224,"./stubArray":476}],333:[function(t,e,r){var n=t("./_arrayPush"),o=t("./_getPrototype"),i=t("./_getSymbols"),a=t("./stubArray"),s=Object.getOwnPropertySymbols,u=s?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:a;e.exports=u},{"./_arrayPush":229,"./_getPrototype":330,"./_getSymbols":332,"./stubArray":476}],334:[function(t,e,r){var n=t("./_DataView"),o=t("./_Map"),i=t("./_Promise"),a=t("./_Set"),s=t("./_WeakMap"),u=t("./_baseGetTag"),l=t("./_toSource"),c=l(n),f=l(o),d=l(i),p=l(a),h=l(s),m=u;(n&&"[object DataView]"!=m(new n(new ArrayBuffer(1)))||o&&"[object Map]"!=m(new o)||i&&"[object Promise]"!=m(i.resolve())||a&&"[object Set]"!=m(new a)||s&&"[object WeakMap]"!=m(new s))&&(m=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?l(r):"";if(n)switch(n){case c:return"[object DataView]";case f:return"[object Map]";case d:return"[object Promise]";case p:return"[object Set]";case h:return"[object WeakMap]"}return e}),e.exports=m},{"./_DataView":206,"./_Map":211,"./_Promise":213,"./_Set":214,"./_WeakMap":219,"./_baseGetTag":249,"./_toSource":400}],335:[function(t,e,r){function n(t,e){return null==t?void 0:t[e]}e.exports=n},{}],336:[function(t,e,r){function n(t){var e=t.match(o);return e?e[1].split(i):[]}var o=/\{\n\/\* \[wrapped with (.+)\] \*/,i=/,? & /;e.exports=n},{}],337:[function(t,e,r){function n(t,e,r){e=o(e,t);for(var n=-1,c=e.length,f=!1;++n<c;){var d=l(e[n]);if(!(f=null!=t&&r(t,d)))break;t=t[d]}return f||++n!=c?f:!!(c=null==t?0:t.length)&&u(c)&&s(d,c)&&(a(t)||i(t))}var o=t("./_castPath"),i=t("./isArguments"),a=t("./isArray"),s=t("./_isIndex"),u=t("./isLength"),l=t("./_toKey");e.exports=n},{"./_castPath":284,"./_isIndex":349,"./_toKey":399,"./isArguments":448,"./isArray":449,"./isLength":456}],338:[function(t,e,r){function n(t){return o.test(t)}var o=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=n},{}],339:[function(t,e,r){function n(){this.__data__=o?o(null):{},this.size=0}var o=t("./_nativeCreate");e.exports=n},{"./_nativeCreate":372}],340:[function(t,e,r){function n(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}e.exports=n},{}],341:[function(t,e,r){function n(t){var e=this.__data__;if(o){var r=e[t];return r===i?void 0:r}return s.call(e,t)?e[t]:void 0}var o=t("./_nativeCreate"),i="__lodash_hash_undefined__",a=Object.prototype,s=a.hasOwnProperty;e.exports=n},{"./_nativeCreate":372}],342:[function(t,e,r){function n(t){var e=this.__data__;return o?void 0!==e[t]:a.call(e,t)}var o=t("./_nativeCreate"),i=Object.prototype,a=i.hasOwnProperty;e.exports=n},{"./_nativeCreate":372}],343:[function(t,e,r){function n(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=o&&void 0===e?i:e,this}var o=t("./_nativeCreate"),i="__lodash_hash_undefined__";e.exports=n},{"./_nativeCreate":372}],344:[function(t,e,r){function n(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&i.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var o=Object.prototype,i=o.hasOwnProperty;e.exports=n},{}],345:[function(t,e,r){function n(t,e,r,n){var C=t.constructor;switch(e){case y:return o(t);case f:case d:return new C(+t);case _:return i(t,n);case x:case w:case S:case O:case A:case E:case j:case P:case T:return c(t,n);case p:return a(t,n,r);case h:case v:return new C(t);case m:return s(t);case g:return u(t,n,r);case b:return l(t)}}var o=t("./_cloneArrayBuffer"),i=t("./_cloneDataView"),a=t("./_cloneMap"),s=t("./_cloneRegExp"),u=t("./_cloneSet"),l=t("./_cloneSymbol"),c=t("./_cloneTypedArray"),f="[object Boolean]",d="[object Date]",p="[object Map]",h="[object Number]",m="[object RegExp]",g="[object Set]",v="[object String]",b="[object Symbol]",y="[object ArrayBuffer]",_="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",O="[object Int16Array]",A="[object Int32Array]",E="[object Uint8Array]",j="[object Uint8ClampedArray]",P="[object Uint16Array]",T="[object Uint32Array]";e.exports=n},{"./_cloneArrayBuffer":286,"./_cloneDataView":288,"./_cloneMap":289,"./_cloneRegExp":290,"./_cloneSet":291,"./_cloneSymbol":292,"./_cloneTypedArray":293}],346:[function(t,e,r){function n(t){return"function"!=typeof t.constructor||a(t)?{}:o(i(t))}var o=t("./_baseCreate"),i=t("./_getPrototype"),a=t("./_isPrototype");e.exports=n},{"./_baseCreate":239,"./_getPrototype":330,"./_isPrototype":355}],347:[function(t,e,r){function n(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(o,"{\n/* [wrapped with "+e+"] */\n")}var o=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=n},{}],348:[function(t,e,r){function n(t){return a(t)||i(t)||!!(s&&t&&t[s])}var o=t("./_Symbol"),i=t("./isArguments"),a=t("./isArray"),s=o?o.isConcatSpreadable:void 0;e.exports=n},{"./_Symbol":217,"./isArguments":448,"./isArray":449}],349:[function(t,e,r){function n(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||i.test(t))&&t>-1&&t%1==0&&t<e}var o=9007199254740991,i=/^(?:0|[1-9]\d*)$/;e.exports=n},{}],350:[function(t,e,r){function n(t,e,r){if(!s(r))return!1;var n=typeof e;return!!("number"==n?i(r)&&a(e,r.length):"string"==n&&e in r)&&o(r[e],t)}var o=t("./eq"),i=t("./isArrayLike"),a=t("./_isIndex"),s=t("./isObject");e.exports=n},{"./_isIndex":349,"./eq":412,"./isArrayLike":450,"./isObject":457}],351:[function(t,e,r){function n(t,e){if(o(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!i(t))||(s.test(t)||!a.test(t)||null!=e&&t in Object(e))}var o=t("./isArray"),i=t("./isSymbol"),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=n},{"./isArray":449,"./isSymbol":460}],352:[function(t,e,r){function n(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}e.exports=n},{}],353:[function(t,e,r){function n(t){var e=a(t),r=s[e];if("function"!=typeof r||!(e in o.prototype))return!1;if(t===r)return!0;var n=i(r);return!!n&&t===n[0]}var o=t("./_LazyWrapper"),i=t("./_getData"),a=t("./_getFuncName"),s=t("./wrapperLodash");e.exports=n},{"./_LazyWrapper":208,"./_getData":324,"./_getFuncName":325,"./wrapperLodash":487}],354:[function(t,e,r){function n(t){return!!i&&i in t}var o=t("./_coreJsData"),i=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();e.exports=n},{"./_coreJsData":300}],355:[function(t,e,r){function n(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||o)}var o=Object.prototype;e.exports=n},{}],356:[function(t,e,r){function n(t){return t===t&&!o(t)}var o=t("./isObject");e.exports=n},{"./isObject":457}],357:[function(t,e,r){function n(){this.__data__=[],this.size=0}e.exports=n},{}],358:[function(t,e,r){function n(t){var e=this.__data__,r=o(e,t);return!(r<0)&&(r==e.length-1?e.pop():a.call(e,r,1),--this.size,!0)}var o=t("./_assocIndexOf"),i=Array.prototype,a=i.splice;e.exports=n},{"./_assocIndexOf":234}],359:[function(t,e,r){function n(t){var e=this.__data__,r=o(e,t);return r<0?void 0:e[r][1]}var o=t("./_assocIndexOf");e.exports=n},{"./_assocIndexOf":234}],360:[function(t,e,r){function n(t){return o(this.__data__,t)>-1}var o=t("./_assocIndexOf");e.exports=n},{"./_assocIndexOf":234}],361:[function(t,e,r){function n(t,e){var r=this.__data__,n=o(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var o=t("./_assocIndexOf");e.exports=n},{"./_assocIndexOf":234}],362:[function(t,e,r){function n(){this.size=0,this.__data__={hash:new o,map:new(a||i),string:new o}}var o=t("./_Hash"),i=t("./_ListCache"),a=t("./_Map");e.exports=n},{"./_Hash":207,"./_ListCache":209,"./_Map":211}],363:[function(t,e,r){function n(t){var e=o(this,t).delete(t);return this.size-=e?1:0,e}var o=t("./_getMapData");e.exports=n},{"./_getMapData":327}],364:[function(t,e,r){function n(t){return o(this,t).get(t)}var o=t("./_getMapData");e.exports=n},{"./_getMapData":327}],365:[function(t,e,r){function n(t){return o(this,t).has(t)}var o=t("./_getMapData");e.exports=n},{"./_getMapData":327}],366:[function(t,e,r){function n(t,e){var r=o(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var o=t("./_getMapData");e.exports=n},{"./_getMapData":327}],367:[function(t,e,r){function n(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}e.exports=n},{}],368:[function(t,e,r){function n(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}e.exports=n},{}],369:[function(t,e,r){function n(t){var e=o(t,function(t){return r.size===i&&r.clear(),t}),r=e.cache;return e}var o=t("./memoize"),i=500;e.exports=n},{"./memoize":466}],370:[function(t,e,r){function n(t,e){var r=t[1],n=e[1],m=r|n,g=m<(u|l|d),v=n==d&&r==f||n==d&&r==p&&t[7].length<=e[8]||n==(d|p)&&e[7].length<=e[8]&&r==f;if(!g&&!v)return t;n&u&&(t[2]=e[2],m|=r&u?0:c);var b=e[3];if(b){var y=t[3];t[3]=y?o(y,b,e[4]):b,t[4]=y?a(t[3],s):e[4]}return b=e[5],b&&(y=t[5],t[5]=y?i(y,b,e[6]):b,t[6]=y?a(t[5],s):e[6]),b=e[7],b&&(t[7]=b),n&d&&(t[8]=null==t[8]?e[8]:h(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=m,t}var o=t("./_composeArgs"),i=t("./_composeArgsRight"),a=t("./_replaceHolders"),s="__lodash_placeholder__",u=1,l=2,c=4,f=8,d=128,p=256,h=Math.min;e.exports=n},{"./_composeArgs":294,"./_composeArgsRight":295,"./_replaceHolders":382}],371:[function(t,e,r){var n=t("./_WeakMap"),o=n&&new n;e.exports=o},{"./_WeakMap":219}],372:[function(t,e,r){var n=t("./_getNative"),o=n(Object,"create");e.exports=o},{"./_getNative":329}],373:[function(t,e,r){var n=t("./_overArg"),o=n(Object.keys,Object);e.exports=o},{"./_overArg":377}],374:[function(t,e,r){function n(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}e.exports=n},{}],375:[function(t,e,r){var n=t("./_freeGlobal"),o="object"==typeof r&&r&&!r.nodeType&&r,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=i&&i.exports===o,s=a&&n.process,u=function(){try{return s&&s.binding&&s.binding("util")}catch(t){}}();e.exports=u},{"./_freeGlobal":321}],376:[function(t,e,r){function n(t){return i.call(t)}var o=Object.prototype,i=o.toString;e.exports=n},{}],377:[function(t,e,r){function n(t,e){return function(r){return t(e(r))}}e.exports=n},{}],378:[function(t,e,r){function n(t,e,r){return e=i(void 0===e?t.length-1:e,0),function(){for(var n=arguments,a=-1,s=i(n.length-e,0),u=Array(s);++a<s;)u[a]=n[e+a];a=-1;for(var l=Array(e+1);++a<e;)l[a]=n[a];return l[e]=r(u),o(t,this,l)}}var o=t("./_apply"),i=Math.max;e.exports=n},{"./_apply":222}],379:[function(t,e,r){function n(t,e){return e.length<2?t:o(t,i(e,0,-1))}var o=t("./_baseGet"),i=t("./_baseSlice");e.exports=n},{"./_baseGet":247,"./_baseSlice":276}],380:[function(t,e,r){var n={};e.exports=n},{}],381:[function(t,e,r){function n(t,e){for(var r=t.length,n=a(e.length,r),s=o(t);n--;){var u=e[n];t[n]=i(u,r)?s[u]:void 0}return t}var o=t("./_copyArray"),i=t("./_isIndex"),a=Math.min;e.exports=n},{"./_copyArray":296,"./_isIndex":349}],382:[function(t,e,r){function n(t,e){for(var r=-1,n=t.length,i=0,a=[];++r<n;){var s=t[r];s!==e&&s!==o||(t[r]=o,a[i++]=r)}return a}var o="__lodash_placeholder__";e.exports=n},{}],383:[function(t,e,r){var n=t("./_freeGlobal"),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},{"./_freeGlobal":321}],384:[function(t,e,r){function n(t){return this.__data__.set(t,o),this}var o="__lodash_hash_undefined__";e.exports=n},{}],385:[function(t,e,r){function n(t){return this.__data__.has(t)}e.exports=n},{}],386:[function(t,e,r){var n=t("./_baseSetData"),o=t("./_shortOut"),i=o(n);e.exports=i},{"./_baseSetData":274,"./_shortOut":390}],387:[function(t,e,r){function n(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}e.exports=n},{}],388:[function(t,e,r){var n=t("./_baseSetToString"),o=t("./_shortOut"),i=o(n);e.exports=i},{"./_baseSetToString":275,"./_shortOut":390}],389:[function(t,e,r){function n(t,e,r){var n=e+"";return a(t,i(n,s(o(n),r)))}var o=t("./_getWrapDetails"),i=t("./_insertWrapDetails"),a=t("./_setToString"),s=t("./_updateWrapDetails");e.exports=n},{"./_getWrapDetails":336,"./_insertWrapDetails":347,"./_setToString":388,"./_updateWrapDetails":402}],390:[function(t,e,r){function n(t){var e=0,r=0;return function(){var n=a(),s=i-(n-r);if(r=n,s>0){if(++e>=o)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var o=800,i=16,a=Date.now;e.exports=n},{}],391:[function(t,e,r){function n(){this.__data__=new o,this.size=0}var o=t("./_ListCache");e.exports=n},{"./_ListCache":209}],392:[function(t,e,r){function n(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}e.exports=n},{}],393:[function(t,e,r){function n(t){return this.__data__.get(t)}e.exports=n},{}],394:[function(t,e,r){function n(t){return this.__data__.has(t)}e.exports=n},{}],395:[function(t,e,r){function n(t,e){var r=this.__data__;if(r instanceof o){var n=r.__data__;if(!i||n.length<s-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new a(n)}return r.set(t,e),this.size=r.size,this}var o=t("./_ListCache"),i=t("./_Map"),a=t("./_MapCache"),s=200;e.exports=n},{"./_ListCache":209,"./_Map":211,"./_MapCache":212}],396:[function(t,e,r){function n(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}e.exports=n},{}],397:[function(t,e,r){function n(t){return i(t)?a(t):o(t)}var o=t("./_asciiToArray"),i=t("./_hasUnicode"),a=t("./_unicodeToArray");e.exports=n},{"./_asciiToArray":232,"./_hasUnicode":338,"./_unicodeToArray":401}],398:[function(t,e,r){var n=t("./_memoizeCapped"),o=/^\./,i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,s=n(function(t){var e=[];return o.test(t)&&e.push(""),t.replace(i,function(t,r,n,o){e.push(n?o.replace(a,"$1"):r||t)}),e});e.exports=s},{"./_memoizeCapped":369}],399:[function(t,e,r){function n(t){if("string"==typeof t||o(t))return t;var e=t+"";return"0"==e&&1/t==-i?"-0":e}var o=t("./isSymbol"),i=1/0;e.exports=n},{"./isSymbol":460}],400:[function(t,e,r){function n(t){if(null!=t){try{return i.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var o=Function.prototype,i=o.toString;e.exports=n},{}],401:[function(t,e,r){function n(t){return t.match(d)||[]}var o="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",l="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",a,s].join("|")+")[\\ufe0e\\ufe0f]?"+u+")*",c="[\\ufe0e\\ufe0f]?"+u+l,f="(?:"+["[^\\ud800-\\udfff]"+o+"?",o,a,s,"[\\ud800-\\udfff]"].join("|")+")",d=RegExp(i+"(?="+i+")|"+f+c,"g");e.exports=n},{}],402:[function(t,e,r){function n(t,e){return o(a,function(r){var n="_."+r[0];e&r[1]&&!i(t,n)&&t.push(n)}),t.sort()}
  var o=t("./_arrayEach"),i=t("./_arrayIncludes"),a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=n},{"./_arrayEach":223,"./_arrayIncludes":225}],403:[function(t,e,r){function n(t){if(t instanceof o)return t.clone();var e=new i(t.__wrapped__,t.__chain__);return e.__actions__=a(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var o=t("./_LazyWrapper"),i=t("./_LodashWrapper"),a=t("./_copyArray");e.exports=n},{"./_LazyWrapper":208,"./_LodashWrapper":210,"./_copyArray":296}],404:[function(t,e,r){function n(t,e,r){return e=r?void 0:e,e=t&&null==e?t.length:e,o(t,i,void 0,void 0,void 0,void 0,e)}var o=t("./_createWrap"),i=128;e.exports=n},{"./_createWrap":314}],405:[function(t,e,r){function n(t){return i(o(t).toLowerCase())}var o=t("./toString"),i=t("./upperFirst");e.exports=n},{"./toString":483,"./upperFirst":485}],406:[function(t,e,r){function n(t,e,r){e=(r?i(t,e,r):void 0===e)?1:u(a(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var l=0,c=0,f=Array(s(n/e));l<n;)f[c++]=o(t,l,l+=e);return f}var o=t("./_baseSlice"),i=t("./_isIterateeCall"),a=t("./toInteger"),s=Math.ceil,u=Math.max;e.exports=n},{"./_baseSlice":276,"./_isIterateeCall":350,"./toInteger":480}],407:[function(t,e,r){function n(t){return o(t,i)}var o=t("./_baseClone"),i=4;e.exports=n},{"./_baseClone":238}],408:[function(t,e,r){function n(t){return function(){return t}}e.exports=n},{}],409:[function(t,e,r){function n(t,e,r){e=r?void 0:e;var a=o(t,i,void 0,void 0,void 0,void 0,void 0,e);return a.placeholder=n.placeholder,a}var o=t("./_createWrap"),i=8;n.placeholder={},e.exports=n},{"./_createWrap":314}],410:[function(t,e,r){function n(t,e,r){function n(e){var r=b,n=y;return b=y=void 0,O=e,x=t.apply(n,r)}function c(t){return O=t,w=setTimeout(p,e),A?n(t):x}function f(t){var r=t-S,n=t-O,o=e-r;return E?l(o,_-n):o}function d(t){var r=t-S,n=t-O;return void 0===S||r>=e||r<0||E&&n>=_}function p(){var t=i();if(d(t))return h(t);w=setTimeout(p,f(t))}function h(t){return w=void 0,j&&b?n(t):(b=y=void 0,x)}function m(){void 0!==w&&clearTimeout(w),O=0,b=S=y=w=void 0}function g(){return void 0===w?x:h(i())}function v(){var t=i(),r=d(t);if(b=arguments,y=this,S=t,r){if(void 0===w)return c(S);if(E)return w=setTimeout(p,e),n(S)}return void 0===w&&(w=setTimeout(p,e)),x}var b,y,_,x,w,S,O=0,A=!1,E=!1,j=!0;if("function"!=typeof t)throw new TypeError(s);return e=a(e)||0,o(r)&&(A=!!r.leading,E="maxWait"in r,_=E?u(a(r.maxWait)||0,e):_,j="trailing"in r?!!r.trailing:j),v.cancel=m,v.flush=g,v}var o=t("./isObject"),i=t("./now"),a=t("./toNumber"),s="Expected a function",u=Math.max,l=Math.min;e.exports=n},{"./isObject":457,"./now":468,"./toNumber":481}],411:[function(t,e,r){var n=t("./_baseDifference"),o=t("./_baseFlatten"),i=t("./_baseRest"),a=t("./isArrayLikeObject"),s=i(function(t,e){return a(t)?n(t,o(e,1,a,!0)):[]});e.exports=s},{"./_baseDifference":240,"./_baseFlatten":244,"./_baseRest":272,"./isArrayLikeObject":451}],412:[function(t,e,r){function n(t,e){return t===e||t!==t&&e!==e}e.exports=n},{}],413:[function(t,e,r){function n(t){return t=o(t),t&&a.test(t)?t.replace(i,"\\$&"):t}var o=t("./toString"),i=/[\\^$.*+?()[\]{}|]/g,a=RegExp(i.source);e.exports=n},{"./toString":483}],414:[function(t,e,r){function n(t,e){return(s(t)?o:i)(t,a(e,3))}var o=t("./_arrayFilter"),i=t("./_baseFilter"),a=t("./_baseIteratee"),s=t("./isArray");e.exports=n},{"./_arrayFilter":224,"./_baseFilter":242,"./_baseIteratee":260,"./isArray":449}],415:[function(t,e,r){function n(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var u=null==r?0:a(r);return u<0&&(u=s(n+u,0)),o(t,i(e,3),u)}var o=t("./_baseFindIndex"),i=t("./_baseIteratee"),a=t("./toInteger"),s=Math.max;e.exports=n},{"./_baseFindIndex":243,"./_baseIteratee":260,"./toInteger":480}],416:[function(t,e,r){function n(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var l=n-1;return void 0!==r&&(l=a(r),l=r<0?s(n+l,0):u(l,n-1)),o(t,i(e,3),l,!0)}var o=t("./_baseFindIndex"),i=t("./_baseIteratee"),a=t("./toInteger"),s=Math.max,u=Math.min;e.exports=n},{"./_baseFindIndex":243,"./_baseIteratee":260,"./toInteger":480}],417:[function(t,e,r){function n(t){return(null==t?0:t.length)?o(t,1):[]}var o=t("./_baseFlatten");e.exports=n},{"./_baseFlatten":244}],418:[function(t,e,r){var n=t("./_createFlow"),o=n();e.exports=o},{"./_createFlow":308}],419:[function(t,e,r){function n(t,e){return 2==e?function(e,r){return t.apply(void 0,arguments)}:function(e){return t.apply(void 0,arguments)}}function o(t,e){return 2==e?function(e,r){return t(e,r)}:function(e){return t(e)}}function i(t){for(var e=t?t.length:0,r=Array(e);e--;)r[e]=t[e];return r}function a(t){return function(e){return t({},e)}}function s(t,e){return function(){for(var r=arguments.length,n=r-1,o=Array(r);r--;)o[r]=arguments[r];var i=o[e],a=o.slice(0,e);return i&&d.apply(a,i),e!=n&&d.apply(a,o.slice(e+1)),t.apply(this,a)}}function u(t,e){return function(){var r=arguments.length;if(r){for(var n=Array(r);r--;)n[r]=arguments[r];var o=n[0]=e.apply(void 0,n);return t.apply(void 0,n),o}}}function l(t,e,r,d){function p(t,e){if(j.cap){var r=c.iterateeRearg[t];if(r)return x(e,r);var n=!A&&c.iterateeAry[t];if(n)return _(e,n)}return e}function h(t,e,r){return P||j.curry&&r>1?L(e,r):e}function m(t,e,r){if(j.fixed&&(T||!c.skipFixed[t])){var n=c.methodSpread[t],o=n&&n.start;return void 0===o?N(e,r):s(e,o)}return e}function g(t,e,r){return j.rearg&&r>1&&(C||!c.skipRearg[t])?H(e,c.methodRearg[t]||c.aryRearg[r]):e}function v(t,e){e=U(e);for(var r=-1,n=e.length,o=n-1,i=B(Object(t)),a=i;null!=a&&++r<n;){var s=e[r],u=a[s];null!=u&&(a[e[r]]=B(r==o?u:Object(u))),a=a[s]}return i}function b(t){return K.runInContext.convert(t)(void 0)}function y(t,e){var r=c.aliasToReal[t]||t,n=c.remap[r]||r,o=d;return function(t){var i=A?M:R,a=A?M[n]:e,s=I(I({},o),t);return l(i,r,a,s)}}function _(t,e){return w(t,function(t){return"function"==typeof t?o(t,e):t})}function x(t,e){return w(t,function(t){var r=e.length;return n(H(o(t,r),e),r)})}function w(t,e){return function(){var r=arguments.length;if(!r)return t();for(var n=Array(r);r--;)n[r]=arguments[r];var o=j.rearg?0:r-1;return n[o]=e(n[o]),t.apply(void 0,n)}}function S(t,e){var r,n=c.aliasToReal[t]||t,o=e,s=q[n];return s?o=s(e):j.immutable&&(c.mutate.array[n]?o=u(e,i):c.mutate.object[n]?o=u(e,a(e)):c.mutate.set[n]&&(o=u(e,v))),D(V,function(t){return D(c.aryMethod[t],function(e){if(n==e){var i=c.methodSpread[n],a=i&&i.afterRearg;return r=a?m(n,g(n,o,t),t):g(n,m(n,o,t),t),r=p(n,r),r=h(n,r,t),!1}}),!r}),r||(r=o),r==e&&(r=P?L(r,1):function(){return e.apply(this,arguments)}),r.convert=y(n,e),c.placeholder[n]&&(O=!0,r.placeholder=e.placeholder=k),r}var O,A="function"==typeof e,E=e===Object(e);if(E&&(d=r,r=e,e=void 0),null==r)throw new TypeError;d||(d={});var j={cap:!("cap"in d)||d.cap,curry:!("curry"in d)||d.curry,fixed:!("fixed"in d)||d.fixed,immutable:!("immutable"in d)||d.immutable,rearg:!("rearg"in d)||d.rearg},P="curry"in d&&d.curry,T="fixed"in d&&d.fixed,C="rearg"in d&&d.rearg,k=A?r:f,M=A?r.runInContext():void 0,R=A?r:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isFunction:t.isFunction,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},N=R.ary,I=R.assign,B=R.clone,L=R.curry,D=R.forEach,F=R.isArray,G=R.isFunction,z=R.keys,H=R.rearg,W=R.toInteger,U=R.toPath,V=z(c.aryMethod),q={castArray:function(t){return function(){var e=arguments[0];return F(e)?t(i(e)):t.apply(void 0,arguments)}},iteratee:function(t){return function(){var e=arguments[0],r=arguments[1],n=t(e,r),i=n.length;return j.cap&&"number"==typeof r?(r=r>2?r-2:1,i&&i<=r?n:o(n,r)):n}},mixin:function(t){return function(e){var r=this;if(!G(r))return t(r,Object(e));var n=[];return D(z(e),function(t){G(e[t])&&n.push([t,r.prototype[t]])}),t(r,Object(e)),D(n,function(t){var e=t[1];G(e)?r.prototype[t[0]]=e:delete r.prototype[t[0]]}),r}},nthArg:function(t){return function(e){var r=e<0?1:W(e)+1;return L(t(e),r)}},rearg:function(t){return function(e,r){var n=r?r.length:0;return L(t(e,r),n)}},runInContext:function(e){return function(r){return l(t,e(r),d)}}};if(!E)return S(e,r);var K=r,Y=[];return D(V,function(t){D(c.aryMethod[t],function(t){var e=K[c.remap[t]||t];e&&Y.push([t,S(t,e)])})}),D(z(K),function(t){var e=K[t];if("function"==typeof e){for(var r=Y.length;r--;)if(Y[r][0]==t)return;e.convert=y(t,e),Y.push([t,e])}}),D(Y,function(t){K[t[0]]=t[1]}),K.convert=b,O&&(K.placeholder=k),D(z(K),function(t){D(c.realToAlias[t]||[],function(e){K[e]=K[t]})}),K}var c=t("./_mapping"),f=t("./placeholder"),d=Array.prototype.push;e.exports=l},{"./_mapping":421,"./placeholder":437}],420:[function(t,e,r){e.exports={cap:!1,curry:!1,fixed:!1,immutable:!1,rearg:!1}},{}],421:[function(t,e,r){r.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},r.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},r.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},r.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},r.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},r.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},r.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},r.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},r.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},r.realToAlias=function(){var t=Object.prototype.hasOwnProperty,e=r.aliasToReal,n={};for(var o in e){var i=e[o];t.call(n,i)?n[i].push(o):n[i]=[o]}return n}(),r.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},r.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},r.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},{}],422:[function(t,e,r){e.exports={ary:t("../ary"),assign:t("../_baseAssign"),clone:t("../clone"),curry:t("../curry"),forEach:t("../_arrayEach"),isArray:t("../isArray"),isFunction:t("../isFunction"),iteratee:t("../iteratee"),keys:t("../_baseKeys"),rearg:t("../rearg"),toInteger:t("../toInteger"),toPath:t("../toPath")}},{"../_arrayEach":223,"../_baseAssign":235,"../_baseKeys":261,"../ary":404,"../clone":407,"../curry":409,"../isArray":449,"../isFunction":455,"../iteratee":462,"../rearg":474,"../toInteger":480,"../toPath":482}],423:[function(t,e,r){var n=t("./convert"),o=n("capitalize",t("../capitalize"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../capitalize":405,"./_falseOptions":420,"./convert":425,"./placeholder":437}],424:[function(t,e,r){var n=t("./convert"),o=n("chunk",t("../chunk"));o.placeholder=t("./placeholder"),e.exports=o},{"../chunk":406,"./convert":425,"./placeholder":437}],425:[function(t,e,r){function n(t,e,r){return o(i,t,e,r)}var o=t("./_baseConvert"),i=t("./_util");e.exports=n},{"./_baseConvert":419,"./_util":422}],426:[function(t,e,r){var n=t("./convert"),o=n("debounce",t("../debounce"));o.placeholder=t("./placeholder"),e.exports=o},{"../debounce":410,"./convert":425,"./placeholder":437}],427:[function(t,e,r){var n=t("./convert"),o=n("escapeRegExp",t("../escapeRegExp"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../escapeRegExp":413,"./_falseOptions":420,"./convert":425,"./placeholder":437}],428:[function(t,e,r){var n=t("./convert"),o=n("filter",t("../filter"));o.placeholder=t("./placeholder"),e.exports=o},{"../filter":414,"./convert":425,"./placeholder":437}],429:[function(t,e,r){var n=t("./convert"),o=n("findIndex",t("../findIndex"));o.placeholder=t("./placeholder"),e.exports=o},{"../findIndex":415,"./convert":425,"./placeholder":437}],430:[function(t,e,r){var n=t("./convert"),o=n("findLastIndex",t("../findLastIndex"));o.placeholder=t("./placeholder"),e.exports=o},{"../findLastIndex":416,"./convert":425,"./placeholder":437}],431:[function(t,e,r){var n=t("./convert"),o=n("flow",t("../flow"));o.placeholder=t("./placeholder"),e.exports=o},{"../flow":418,"./convert":425,"./placeholder":437}],432:[function(t,e,r){var n=t("./convert"),o=n("isEmpty",t("../isEmpty"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../isEmpty":453,"./_falseOptions":420,"./convert":425,"./placeholder":437}],433:[function(t,e,r){var n=t("./convert"),o=n("isEqual",t("../isEqual"));o.placeholder=t("./placeholder"),e.exports=o},{"../isEqual":454,"./convert":425,"./placeholder":437}],434:[function(t,e,r){var n=t("./convert"),o=n("omit",t("../omit"));o.placeholder=t("./placeholder"),e.exports=o},{"../omit":469,"./convert":425,"./placeholder":437}],435:[function(t,e,r){var n=t("./convert"),o=n("pick",t("../pick"));o.placeholder=t("./placeholder"),e.exports=o},{"../pick":470,"./convert":425,"./placeholder":437}],436:[function(t,e,r){var n=t("./convert"),o=n("pickBy",t("../pickBy"));o.placeholder=t("./placeholder"),e.exports=o},{"../pickBy":471,"./convert":425,"./placeholder":437}],437:[function(t,e,r){e.exports={}},{}],438:[function(t,e,r){var n=t("./convert"),o=n("range",t("../range"));o.placeholder=t("./placeholder"),e.exports=o},{"../range":473,"./convert":425,"./placeholder":437}],439:[function(t,e,r){var n=t("./convert"),o=n("reduce",t("../reduce"));o.placeholder=t("./placeholder"),e.exports=o},{"../reduce":475,"./convert":425,"./placeholder":437}],440:[function(t,e,r){var n=t("./convert"),o=n("throttle",t("../throttle"));o.placeholder=t("./placeholder"),e.exports=o},{"../throttle":478,"./convert":425,"./placeholder":437}],441:[function(t,e,r){var n=t("./convert"),o=n("upperFirst",t("../upperFirst"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../upperFirst":485,"./_falseOptions":420,"./convert":425,"./placeholder":437}],442:[function(t,e,r){var n=t("./convert"),o=n("without",t("../without"));o.placeholder=t("./placeholder"),e.exports=o},{"../without":486,"./convert":425,"./placeholder":437}],443:[function(t,e,r){var n=t("./convert"),o=n("xor",t("../xor"));o.placeholder=t("./placeholder"),e.exports=o},{"../xor":488,"./convert":425,"./placeholder":437}],444:[function(t,e,r){function n(t,e,r){var n=null==t?void 0:o(t,e);return void 0===n?r:n}var o=t("./_baseGet");e.exports=n},{"./_baseGet":247}],445:[function(t,e,r){function n(t,e){return null!=t&&i(t,e,o)}var o=t("./_baseHasIn"),i=t("./_hasPath");e.exports=n},{"./_baseHasIn":250,"./_hasPath":337}],446:[function(t,e,r){function n(t){return t}e.exports=n},{}],447:[function(t,e,r){function n(t,e,r){return e=i(e),void 0===r?(r=e,e=0):r=i(r),t=a(t),o(t,e,r)}var o=t("./_baseInRange"),i=t("./toFinite"),a=t("./toNumber");e.exports=n},{"./_baseInRange":251,"./toFinite":479,"./toNumber":481}],448:[function(t,e,r){var n=t("./_baseIsArguments"),o=t("./isObjectLike"),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};e.exports=u},{"./_baseIsArguments":253,"./isObjectLike":458}],449:[function(t,e,r){var n=Array.isArray;e.exports=n},{}],450:[function(t,e,r){function n(t){return null!=t&&i(t.length)&&!o(t)}var o=t("./isFunction"),i=t("./isLength");e.exports=n},{"./isFunction":455,"./isLength":456}],451:[function(t,e,r){function n(t){return i(t)&&o(t)}var o=t("./isArrayLike"),i=t("./isObjectLike");e.exports=n},{"./isArrayLike":450,"./isObjectLike":458}],452:[function(t,e,r){var n=t("./_root"),o=t("./stubFalse"),i="object"==typeof r&&r&&!r.nodeType&&r,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===i,u=s?n.Buffer:void 0,l=u?u.isBuffer:void 0,c=l||o;e.exports=c},{"./_root":383,"./stubFalse":477}],453:[function(t,e,r){function n(t){if(null==t)return!0;if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||l(t)||f(t)||a(t)))return!t.length;var e=i(t);if(e==d||e==p)return!t.size;if(c(t))return!o(t).length;for(var r in t)if(m.call(t,r))return!1;return!0}var o=t("./_baseKeys"),i=t("./_getTag"),a=t("./isArguments"),s=t("./isArray"),u=t("./isArrayLike"),l=t("./isBuffer"),c=t("./_isPrototype"),f=t("./isTypedArray"),d="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;e.exports=n},{"./_baseKeys":261,"./_getTag":334,"./_isPrototype":355,"./isArguments":448,"./isArray":449,"./isArrayLike":450,"./isBuffer":452,"./isTypedArray":461}],454:[function(t,e,r){function n(t,e){return o(t,e)}var o=t("./_baseIsEqual");e.exports=n},{"./_baseIsEqual":254}],455:[function(t,e,r){function n(t){if(!i(t))return!1;var e=o(t);return e==s||e==u||e==a||e==l}var o=t("./_baseGetTag"),i=t("./isObject"),a="[object AsyncFunction]",s="[object Function]",u="[object GeneratorFunction]",l="[object Proxy]";e.exports=n},{"./_baseGetTag":249,"./isObject":457}],456:[function(t,e,r){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}var o=9007199254740991;e.exports=n},{}],457:[function(t,e,r){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}e.exports=n},{}],458:[function(t,e,r){function n(t){return null!=t&&"object"==typeof t}e.exports=n},{}],459:[function(t,e,r){function n(t){if(!a(t)||o(t)!=s)return!1;var e=i(t);if(null===e)return!0;var r=f.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==d}var o=t("./_baseGetTag"),i=t("./_getPrototype"),a=t("./isObjectLike"),s="[object Object]",u=Function.prototype,l=Object.prototype,c=u.toString,f=l.hasOwnProperty,d=c.call(Object);e.exports=n},{"./_baseGetTag":249,"./_getPrototype":330,"./isObjectLike":458}],460:[function(t,e,r){function n(t){return"symbol"==typeof t||i(t)&&o(t)==a}var o=t("./_baseGetTag"),i=t("./isObjectLike"),a="[object Symbol]";e.exports=n},{"./_baseGetTag":249,"./isObjectLike":458}],461:[function(t,e,r){var n=t("./_baseIsTypedArray"),o=t("./_baseUnary"),i=t("./_nodeUtil"),a=i&&i.isTypedArray,s=a?o(a):n;e.exports=s},{"./_baseIsTypedArray":259,"./_baseUnary":279,"./_nodeUtil":375}],462:[function(t,e,r){function n(t){return i("function"==typeof t?t:o(t,a))}var o=t("./_baseClone"),i=t("./_baseIteratee"),a=1;e.exports=n},{"./_baseClone":238,"./_baseIteratee":260}],463:[function(t,e,r){function n(t){return a(t)?o(t):i(t)}var o=t("./_arrayLikeKeys"),i=t("./_baseKeys"),a=t("./isArrayLike");e.exports=n},{"./_arrayLikeKeys":227,"./_baseKeys":261,"./isArrayLike":450}],464:[function(t,e,r){function n(t){return a(t)?o(t,!0):i(t)}var o=t("./_arrayLikeKeys"),i=t("./_baseKeysIn"),a=t("./isArrayLike");e.exports=n},{"./_arrayLikeKeys":227,"./_baseKeysIn":262,"./isArrayLike":450}],465:[function(t,e,r){function n(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}e.exports=n},{}],466:[function(t,e,r){function n(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(i);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(n.Cache||o),r}var o=t("./_MapCache"),i="Expected a function";n.Cache=o,e.exports=n},{"./_MapCache":212}],467:[function(t,e,r){function n(){}e.exports=n},{}],468:[function(t,e,r){var n=t("./_root"),o=function(){return n.Date.now()};e.exports=o},{"./_root":383}],469:[function(t,e,r){var n=t("./_arrayMap"),o=t("./_baseClone"),i=t("./_baseUnset"),a=t("./_castPath"),s=t("./_copyObject"),u=t("./_customOmitClone"),l=t("./_flatRest"),c=t("./_getAllKeysIn"),f=l(function(t,e){var r={};if(null==t)return r;var l=!1;e=n(e,function(e){return e=a(e,t),l||(l=e.length>1),e}),s(t,c(t),r),l&&(r=o(r,7,u));for(var f=e.length;f--;)i(r,e[f]);return r});e.exports=f},{"./_arrayMap":228,"./_baseClone":238,"./_baseUnset":281,"./_castPath":284,"./_copyObject":297,"./_customOmitClone":315,"./_flatRest":320,"./_getAllKeysIn":323}],470:[function(t,e,r){var n=t("./_basePick"),o=t("./_flatRest"),i=o(function(t,e){return null==t?{}:n(t,e)});e.exports=i},{"./_basePick":266,"./_flatRest":320}],471:[function(t,e,r){function n(t,e){if(null==t)return{};var r=o(s(t),function(t){return[t]});return e=i(e),a(t,r,function(t,r){return e(t,r[0])})}var o=t("./_arrayMap"),i=t("./_baseIteratee"),a=t("./_basePickBy"),s=t("./_getAllKeysIn");e.exports=n},{"./_arrayMap":228,"./_baseIteratee":260,"./_basePickBy":267,"./_getAllKeysIn":323}],472:[function(t,e,r){function n(t){return a(t)?o(s(t)):i(t)}var o=t("./_baseProperty"),i=t("./_basePropertyDeep"),a=t("./_isKey"),s=t("./_toKey");e.exports=n},{"./_baseProperty":268,"./_basePropertyDeep":269,"./_isKey":351,"./_toKey":399}],473:[function(t,e,r){var n=t("./_createRange"),o=n();e.exports=o},{"./_createRange":311}],474:[function(t,e,r){var n=t("./_createWrap"),o=t("./_flatRest"),i=o(function(t,e){return n(t,256,void 0,void 0,void 0,e)});e.exports=i},{"./_createWrap":314,"./_flatRest":320}],475:[function(t,e,r){function n(t,e,r){var n=u(t)?o:s,l=arguments.length<3;return n(t,a(e,4),r,l,i)}var o=t("./_arrayReduce"),i=t("./_baseEach"),a=t("./_baseIteratee"),s=t("./_baseReduce"),u=t("./isArray");e.exports=n},{"./_arrayReduce":230,"./_baseEach":241,"./_baseIteratee":260,"./_baseReduce":271,"./isArray":449}],476:[function(t,e,r){function n(){return[]}e.exports=n},{}],477:[function(t,e,r){function n(){return!1}e.exports=n},{}],478:[function(t,e,r){function n(t,e,r){var n=!0,s=!0;if("function"!=typeof t)throw new TypeError(a);return i(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),o(t,e,{leading:n,maxWait:e,trailing:s})}var o=t("./debounce"),i=t("./isObject"),a="Expected a function";e.exports=n},{"./debounce":410,"./isObject":457}],479:[function(t,e,r){function n(t){if(!t)return 0===t?t:0;if((t=o(t))===i||t===-i){return(t<0?-1:1)*a}return t===t?t:0}var o=t("./toNumber"),i=1/0,a=1.7976931348623157e308;e.exports=n},{"./toNumber":481}],480:[function(t,e,r){function n(t){var e=o(t),r=e%1;return e===e?r?e-r:e:0}var o=t("./toFinite");e.exports=n},{"./toFinite":479}],481:[function(t,e,r){function n(t){if("number"==typeof t)return t;if(i(t))return a;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var r=l.test(t);return r||c.test(t)?f(t.slice(2),r?2:8):u.test(t)?a:+t}var o=t("./isObject"),i=t("./isSymbol"),a=NaN,s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=parseInt;e.exports=n},{"./isObject":457,"./isSymbol":460}],482:[function(t,e,r){function n(t){return a(t)?o(t,l):s(t)?[t]:i(u(c(t)))}var o=t("./_arrayMap"),i=t("./_copyArray"),a=t("./isArray"),s=t("./isSymbol"),u=t("./_stringToPath"),l=t("./_toKey"),c=t("./toString");e.exports=n},{"./_arrayMap":228,"./_copyArray":296,"./_stringToPath":398,"./_toKey":399,"./isArray":449,"./isSymbol":460,"./toString":483}],483:[function(t,e,r){function n(t){return null==t?"":o(t)}var o=t("./_baseToString");e.exports=n},{"./_baseToString":278}],484:[function(t,e,r){function n(t){return t&&t.length?o(t):[]}var o=t("./_baseUniq");e.exports=n},{"./_baseUniq":280}],485:[function(t,e,r){var n=t("./_createCaseFirst"),o=n("toUpperCase");e.exports=o},{"./_createCaseFirst":305}],486:[function(t,e,r){var n=t("./_baseDifference"),o=t("./_baseRest"),i=t("./isArrayLikeObject"),a=o(function(t,e){return i(t)?n(t,e):[]});e.exports=a},{"./_baseDifference":240,"./_baseRest":272,"./isArrayLikeObject":451}],487:[function(t,e,r){function n(t){if(u(t)&&!s(t)&&!(t instanceof o)){if(t instanceof i)return t;if(f.call(t,"__wrapped__"))return l(t)}return new i(t)}var o=t("./_LazyWrapper"),i=t("./_LodashWrapper"),a=t("./_baseLodash"),s=t("./isArray"),u=t("./isObjectLike"),l=t("./_wrapperClone"),c=Object.prototype,f=c.hasOwnProperty;n.prototype=a.prototype,n.prototype.constructor=n,e.exports=n},{"./_LazyWrapper":208,"./_LodashWrapper":210,"./_baseLodash":263,"./_wrapperClone":403,"./isArray":449,"./isObjectLike":458}],488:[function(t,e,r){var n=t("./_arrayFilter"),o=t("./_baseRest"),i=t("./_baseXor"),a=t("./isArrayLikeObject"),s=o(function(t){return i(n(t,a))});e.exports=s},{"./_arrayFilter":224,"./_baseRest":272,"./_baseXor":282,"./isArrayLikeObject":451}],489:[function(e,r,n){!function(o,i){"object"==typeof n&&void 0!==r?r.exports=i(e("preact"),e("redux")):"function"==typeof t&&t.amd?t(["preact","redux"],i):o.preactRedux=i(o.preact,o.Redux)}(this,function(t,e){function r(){}function n(){var t=[],e=[];return{clear:function(){e=G,t=G},notify:function(){for(var r=t=e,n=0;n<r.length;n++)r[n]()},subscribe:function(r){var n=!0;return e===t&&(e=t.slice()),e.push(r),function(){n&&t!==G&&(n=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(r),1))}}}}function o(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}function i(){U||(U=!0,o("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/reactjs/react-redux/releases/tag/v2.0.0 for the migration instructions."))}function a(e){var r,n,o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=o.getDisplayName,a=void 0===i?function(t){return"ConnectAdvanced("+t+")"}:i,s=o.methodName,u=void 0===s?"connectAdvanced":s,l=o.renderCountProp,c=void 0===l?void 0:l,f=o.shouldHandleStateChanges,d=void 0===f||f,p=o.storeKey,h=void 0===p?"store":p,m=o.withRef,g=void 0!==m&&m,v=D(o,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),b=h+"Subscription",y=Z++,_=(r={},r[h]=W,r[b]=R.instanceOf(H),r),x=(n={},n[b]=R.instanceOf(H),n);return function(r){X("function"==typeof r,"You must pass a component to the function returned by connect. Instead received "+r);var n=r.displayName||r.name||"Component",o=a(n),i=B({},v,{getDisplayName:a,methodName:u,renderCountProp:c,shouldHandleStateChanges:d,storeKey:h,withRef:g,displayName:o,wrappedComponentName:n,WrappedComponent:r}),s=function(n){function a(t,e){I(this,a);var r=F(this,n.call(this,t,e));return r.version=y,r.state={},r.renderCount=0,r.store=r.props[h]||r.context[h],r.parentSub=t[b]||e[b],r.setWrappedInstance=r.setWrappedInstance.bind(r),X(r.store,'Could not find "'+h+'" in either the context or props of "'+o+'". Either wrap the root component in a <Provider>, or explicitly pass "'+h+'" as a prop to "'+o+'".'),r.getState=r.store.getState.bind(r.store),r.initSelector(),r.initSubscription(),r}return L(a,n),a.prototype.getChildContext=function(){var t
  ;return t={},t[b]=this.subscription||this.parentSub,t},a.prototype.componentDidMount=function(){d&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},a.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},a.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},a.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.store=null,this.parentSub=null,this.selector.run=function(){}},a.prototype.getWrappedInstance=function(){return X(g,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+u+"() call."),this.wrappedInstance},a.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},a.prototype.initSelector=function(){var t=this.store.dispatch,r=this.getState,n=e(t,i),o=this.selector={shouldComponentUpdate:!0,props:n(r(),this.props),run:function(t){try{var e=n(r(),t);(o.error||e!==o.props)&&(o.shouldComponentUpdate=!0,o.props=e,o.error=null)}catch(t){o.shouldComponentUpdate=!0,o.error=t}}}},a.prototype.initSubscription=function(){var t=this;d&&function(){var e=t.subscription=new H(t.store,t.parentSub),r={};e.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=function(){this.componentDidUpdate=void 0,e.notifyNestedSubs()},this.setState(r)):e.notifyNestedSubs()}.bind(t)}()},a.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},a.prototype.addExtraProps=function(t){if(!g&&!c)return t;var e=B({},t);return g&&(e.ref=this.setWrappedInstance),c&&(e[c]=this.renderCount++),e},a.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return t.h(r,this.addExtraProps(e.props))},a}(t.Component);return s.WrappedComponent=r,s.displayName=o,s.childContextTypes=x,s.contextTypes=_,s.prototype.componentWillUpdate=function(){this.version!==y&&(this.version=y,this.initSelector(),this.subscription&&this.subscription.tryUnsubscribe(),this.initSubscription(),d&&this.subscription.trySubscribe())},$(s,r)}}function s(t,e){if(t===e)return!0;var r=0,n=0;for(var o in t){if(Q.call(t,o)&&t[o]!==e[o])return!1;r++}for(var i in e)Q.call(e,i)&&n++;return r===n}function u(t){return J(Object(t))}function l(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function c(t){return!!t&&"object"==(void 0===t?"undefined":N(t))}function f(t){if(!c(t)||it.call(t)!=tt||l(t))return!1;var e=u(t);if(null===e)return!0;var r=nt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&rt.call(r)==ot}function d(t,e,r){f(t)||o(r+"() in "+e+" must return a plain object. Instead received "+t+".")}function p(t){return function(e,r){function n(){return o}var o=t(e,r);return n.dependsOnOwnProps=!1,n}}function h(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?Boolean(t.dependsOnOwnProps):1!==t.length}function m(t,e){return function(r,n){var o=n.displayName,i=function(t,e){return i.dependsOnOwnProps?i.mapToProps(t,e):i.mapToProps(t)};return i.dependsOnOwnProps=h(t),i.mapToProps=function(r,n){i.mapToProps=t;var a=i(r,n);return"function"==typeof a&&(i.mapToProps=a,i.dependsOnOwnProps=h(a),a=i(r,n)),d(a,o,e),a},i}}function g(t){return"function"==typeof t?m(t,"mapDispatchToProps"):void 0}function v(t){return t?void 0:p(function(t){return{dispatch:t}})}function b(t){return t&&"object"===(void 0===t?"undefined":N(t))?p(function(r){return e.bindActionCreators(t,r)}):void 0}function y(t){return"function"==typeof t?m(t,"mapStateToProps"):void 0}function _(t){return t?void 0:p(function(){return{}})}function x(t,e,r){return B({},r,t,e)}function w(t){return function(e,r){var n=r.displayName,o=r.pure,i=r.areMergedPropsEqual,a=!1,s=void 0;return function(e,r,u){var l=t(e,r,u);return a?o&&i(l,s)||(s=l):(a=!0,s=l,d(s,n,"mergeProps")),s}}}function S(t){return"function"==typeof t?w(t):void 0}function O(t){return t?void 0:function(){return x}}function A(t,e,r){if(!t)throw new Error("Unexpected value for "+e+" in "+r+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")||o("The selector for "+e+" of "+r+" did not specify a value for dependsOnOwnProps.")}function E(t,e,r,n){A(t,"mapStateToProps",n),A(e,"mapDispatchToProps",n),A(r,"mergeProps",n)}function j(t,e,r,n){return function(o,i){return r(t(o,i),e(n,i),i)}}function P(t,e,r,n,o){function i(o,i){return h=o,m=i,g=t(h,m),v=e(n,m),b=r(g,v,m),p=!0,b}function a(){return g=t(h,m),e.dependsOnOwnProps&&(v=e(n,m)),b=r(g,v,m)}function s(){return t.dependsOnOwnProps&&(g=t(h,m)),e.dependsOnOwnProps&&(v=e(n,m)),b=r(g,v,m)}function u(){var e=t(h,m),n=!d(e,g);return g=e,n&&(b=r(g,v,m)),b}function l(t,e){var r=!f(e,m),n=!c(t,h);return h=t,m=e,r&&n?a():r?s():n?u():b}var c=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,p=!1,h=void 0,m=void 0,g=void 0,v=void 0,b=void 0;return function(t,e){return p?l(t,e):i(t,e)}}function T(t,e){var r=e.initMapStateToProps,n=e.initMapDispatchToProps,o=e.initMergeProps,i=D(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=r(t,i),s=n(t,i),u=o(t,i);return E(a,s,u,i.displayName),(i.pure?P:j)(a,s,u,t,i)}function C(t,e,r){for(var n=e.length-1;n>=0;n--){var o=e[n](t);if(o)return o}return function(e,n){throw new Error("Invalid value of type "+(void 0===t?"undefined":N(t))+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function k(t,e){return t===e}var M={only:function(t){return t&&t[0]||null}};r.isRequired=r;var R={element:r,func:r,shape:function(){return r},instanceOf:function(){return r}},N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},I=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},B=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},L=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},D=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},F=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},G=null,z={notify:function(){}},H=function(){function t(e,r){I(this,t),this.store=e,this.parentSub=r,this.unsubscribe=null,this.listeners=z}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},t.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=n())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=z)},t}(),W=R.shape({subscribe:R.func.isRequired,dispatch:R.func.isRequired,getState:R.func.isRequired}),U=!1,V=function(t){function e(r,n){I(this,e);var o=F(this,t.call(this,r,n));return o.store=r.store,o}return L(e,t),e.prototype.getChildContext=function(){return{store:this.store,storeSubscription:null}},e.prototype.render=function(){return M.only(this.props.children)},e}(t.Component);V.prototype.componentWillReceiveProps=function(t){this.store!==t.store&&i()},V.childContextTypes={store:W.isRequired,storeSubscription:R.instanceOf(H)},V.displayName="Provider";var q={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},K={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},Y="function"==typeof Object.getOwnPropertySymbols,$=function(t,e,r){if("string"!=typeof e){var n=Object.getOwnPropertyNames(e);Y&&(n=n.concat(Object.getOwnPropertySymbols(e)));for(var o=0;o<n.length;++o)if(!(q[n[o]]||K[n[o]]||r&&r[n[o]]))try{t[n[o]]=e[n[o]]}catch(t){}}return t},X=function(){},Z=0,Q=Object.prototype.hasOwnProperty,J=Object.getPrototypeOf,tt="[object Object]",et=Object.prototype,rt=Function.prototype.toString,nt=et.hasOwnProperty,ot=rt.call(Object),it=et.toString,at=[g,v,b],st=[y,_],ut=[S,O];return{Provider:V,connect:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=t.connectHOC,r=void 0===e?a:e,n=t.mapStateToPropsFactories,o=void 0===n?st:n,i=t.mapDispatchToPropsFactories,u=void 0===i?at:i,l=t.mergePropsFactories,c=void 0===l?ut:l,f=t.selectorFactory,d=void 0===f?T:f;return function(t,e,n){var i=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],a=i.pure,l=void 0===a||a,f=i.areStatesEqual,p=void 0===f?k:f,h=i.areOwnPropsEqual,m=void 0===h?s:h,g=i.areStatePropsEqual,v=void 0===g?s:g,b=i.areMergedPropsEqual,y=void 0===b?s:b,_=D(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),x=C(t,o,"mapStateToProps"),w=C(e,u,"mapDispatchToProps"),S=C(n,c,"mergeProps");return r(d,B({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:Boolean(t),initMapStateToProps:x,initMapDispatchToProps:w,initMergeProps:S,pure:l,areStatesEqual:p,areOwnPropsEqual:m,areStatePropsEqual:v,areMergedPropsEqual:y},_))}}(),connectAdvanced:a}})},{preact:490,redux:510}],490:[function(t,e,r){!function(){"use strict";function t(){}function r(e,r){var n,o,i,a,s=R;for(a=arguments.length;a-- >2;)M.push(arguments[a]);for(r&&null!=r.children&&(M.length||M.push(r.children),delete r.children);M.length;)if((o=M.pop())&&void 0!==o.pop)for(a=o.length;a--;)M.push(o[a]);else!0!==o&&!1!==o||(o=null),(i="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(i=!1)),i&&n?s[s.length-1]+=o:s===R?s=[o]:s.push(o),n=i;var u=new t;return u.nodeName=e,u.children=s,u.attributes=null==r?void 0:r,u.key=null==r?void 0:r.key,void 0!==k.vnode&&k.vnode(u),u}function n(t,e){for(var r in e)t[r]=e[r];return t}function o(t,e){return r(t.nodeName,n(n({},t.attributes),e),arguments.length>2?[].slice.call(arguments,2):t.children)}function i(t){!t.__d&&(t.__d=!0)&&1==I.push(t)&&(k.debounceRendering||setTimeout)(a)}function a(){var t,e=I;for(I=[];t=e.pop();)t.__d&&E(t)}function s(t,e,r){return"string"==typeof e||"number"==typeof e?void 0!==t.splitText:"string"==typeof e.nodeName?!t._componentConstructor&&u(t,e.nodeName):r||t._componentConstructor===e.nodeName}function u(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function l(t){var e=n({},t.attributes);e.children=t.children;var r=t.nodeName.defaultProps;if(void 0!==r)for(var o in r)void 0===e[o]&&(e[o]=r[o]);return e}function c(t,e){var r=e?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return r.__n=t,r}function f(t){t.parentNode&&t.parentNode.removeChild(t)}function d(t,e,r,n,o){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)r&&r(null),n&&n(t);else if("class"!==e||o)if("style"===e){if(n&&"string"!=typeof n&&"string"!=typeof r||(t.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof r)for(var i in r)i in n||(t.style[i]="");for(var i in n)t.style[i]="number"==typeof n[i]&&!1===N.test(i)?n[i]+"px":n[i]}}else if("dangerouslySetInnerHTML"===e)n&&(t.innerHTML=n.__html||"");else if("o"==e[0]&&"n"==e[1]){var a=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),n?r||t.addEventListener(e,h,a):t.removeEventListener(e,h,a),(t.__l||(t.__l={}))[e]=n}else if("list"!==e&&"type"!==e&&!o&&e in t)p(t,e,null==n?"":n),null!=n&&!1!==n||t.removeAttribute(e);else{var s=o&&e!==(e=e.replace(/^xlink\:?/,""));null==n||!1===n?s?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof n&&(s?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),n):t.setAttribute(e,n))}else t.className=n||""}function p(t,e,r){try{t[e]=r}catch(t){}}function h(t){return this.__l[t.type](k.event&&k.event(t)||t)}function m(){for(var t;t=B.pop();)k.afterMount&&k.afterMount(t),t.componentDidMount&&t.componentDidMount()}function g(t,e,r,n,o,i){L++||(D=null!=o&&void 0!==o.ownerSVGElement,F=null!=t&&!("__preactattr_"in t));var a=v(t,e,r,n,i);return o&&a.parentNode!==o&&o.appendChild(a),--L||(F=!1,i||m()),a}function v(t,e,r,n,o){var i=t,a=D;if(null==e&&(e=""),"string"==typeof e)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||o)?t.nodeValue!=e&&(t.nodeValue=e):(i=document.createTextNode(e),t&&(t.parentNode&&t.parentNode.replaceChild(i,t),y(t,!0))),i.__preactattr_=!0,i;if("function"==typeof e.nodeName)return j(t,e,r,n);if(D="svg"===e.nodeName||"foreignObject"!==e.nodeName&&D,(!t||!u(t,String(e.nodeName)))&&(i=c(String(e.nodeName),D),t)){for(;t.firstChild;)i.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(i,t),y(t,!0)}var s=i.firstChild,l=i.__preactattr_||(i.__preactattr_={}),f=e.children;return!F&&f&&1===f.length&&"string"==typeof f[0]&&null!=s&&void 0!==s.splitText&&null==s.nextSibling?s.nodeValue!=f[0]&&(s.nodeValue=f[0]):(f&&f.length||null!=s)&&b(i,f,r,n,F||null!=l.dangerouslySetInnerHTML),x(i,e.attributes,l),D=a,i}function b(t,e,r,n,o){var i,a,u,l,c=t.childNodes,d=[],p={},h=0,m=0,g=c.length,b=0,_=e?e.length:0;if(0!==g)for(var x=0;x<g;x++){var w=c[x],S=w.__preactattr_,O=_&&S?w._component?w._component.__k:S.key:null;null!=O?(h++,p[O]=w):(S||(void 0!==w.splitText?!o||w.nodeValue.trim():o))&&(d[b++]=w)}if(0!==_)for(var x=0;x<_;x++){u=e[x],l=null;var O=u.key;if(null!=O)h&&void 0!==p[O]&&(l=p[O],p[O]=void 0,h--);else if(!l&&m<b)for(i=m;i<b;i++)if(void 0!==d[i]&&s(a=d[i],u,o)){l=a,d[i]=void 0,i===b-1&&b--,i===m&&m++;break}l=v(l,u,r,n),l&&l!==t&&(x>=g?t.appendChild(l):l!==c[x]&&(l===c[x+1]?f(c[x]):t.insertBefore(l,c[x]||null)))}if(h)for(var x in p)void 0!==p[x]&&y(p[x],!1);for(;m<=b;)void 0!==(l=d[b--])&&y(l,!1)}function y(t,e){var r=t._component;r?P(r):(null!=t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),!1!==e&&null!=t.__preactattr_||f(t),_(t))}function _(t){for(t=t.lastChild;t;){var e=t.previousSibling;y(t,!0),t=e}}function x(t,e,r){var n;for(n in r)e&&null!=e[n]||null==r[n]||d(t,n,r[n],r[n]=void 0,D);for(n in e)"children"===n||"innerHTML"===n||n in r&&e[n]===("value"===n||"checked"===n?t[n]:r[n])||d(t,n,r[n],r[n]=e[n],D)}function w(t){var e=t.constructor.name;(G[e]||(G[e]=[])).push(t)}function S(t,e,r){var n,o=G[t.name];if(t.prototype&&t.prototype.render?(n=new t(e,r),T.call(n,e,r)):(n=new T(e,r),n.constructor=t,n.render=O),o)for(var i=o.length;i--;)if(o[i].constructor===t){n.__b=o[i].__b,o.splice(i,1);break}return n}function O(t,e,r){return this.constructor(t,r)}function A(t,e,r,n,o){t.__x||(t.__x=!0,(t.__r=e.ref)&&delete e.ref,(t.__k=e.key)&&delete e.key,!t.base||o?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(e,n),n&&n!==t.context&&(t.__c||(t.__c=t.context),t.context=n),t.__p||(t.__p=t.props),t.props=e,t.__x=!1,0!==r&&(1!==r&&!1===k.syncComponentUpdates&&t.base?i(t):E(t,1,o)),t.__r&&t.__r(t))}function E(t,e,r,o){if(!t.__x){var i,a,s,u=t.props,c=t.state,f=t.context,d=t.__p||u,p=t.__s||c,h=t.__c||f,v=t.base,b=t.__b,_=v||b,x=t._component,w=!1;if(v&&(t.props=d,t.state=p,t.context=h,2!==e&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(u,c,f)?w=!0:t.componentWillUpdate&&t.componentWillUpdate(u,c,f),t.props=u,t.state=c,t.context=f),t.__p=t.__s=t.__c=t.__b=null,t.__d=!1,!w){i=t.render(u,c,f),t.getChildContext&&(f=n(n({},f),t.getChildContext()));var O,j,T=i&&i.nodeName;if("function"==typeof T){var C=l(i);a=x,a&&a.constructor===T&&C.key==a.__k?A(a,C,1,f,!1):(O=a,t._component=a=S(T,C,f),a.__b=a.__b||b,a.__u=t,A(a,C,0,f,!1),E(a,1,r,!0)),j=a.base}else s=_,O=x,O&&(s=t._component=null),(_||1===e)&&(s&&(s._component=null),j=g(s,i,f,r||!v,_&&_.parentNode,!0));if(_&&j!==_&&a!==x){var M=_.parentNode;M&&j!==M&&(M.replaceChild(j,_),O||(_._component=null,y(_,!1)))}if(O&&P(O),t.base=j,j&&!o){for(var R=t,N=t;N=N.__u;)(R=N).base=j;j._component=R,j._componentConstructor=R.constructor}}if(!v||r?B.unshift(t):w||(m(),t.componentDidUpdate&&t.componentDidUpdate(d,p,h),k.afterUpdate&&k.afterUpdate(t)),null!=t.__h)for(;t.__h.length;)t.__h.pop().call(t);L||o||m()}}function j(t,e,r,n){for(var o=t&&t._component,i=o,a=t,s=o&&t._componentConstructor===e.nodeName,u=s,c=l(e);o&&!u&&(o=o.__u);)u=o.constructor===e.nodeName;return o&&u&&(!n||o._component)?(A(o,c,3,r,n),t=o.base):(i&&!s&&(P(i),t=a=null),o=S(e.nodeName,c,r),t&&!o.__b&&(o.__b=t,a=null),A(o,c,1,r,n),t=o.base,a&&t!==a&&(a._component=null,y(a,!1))),t}function P(t){k.beforeUnmount&&k.beforeUnmount(t);var e=t.base;t.__x=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var r=t._component;r?P(r):e&&(e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),t.__b=e,f(e),w(t),_(e)),t.__r&&t.__r(null)}function T(t,e){this.__d=!0,this.context=e,this.props=t,this.state=this.state||{}}function C(t,e,r){return g(r,t,{},!1,e,!1)}var k={},M=[],R=[],N=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,I=[],B=[],L=0,D=!1,F=!1,G={};n(T.prototype,{setState:function(t,e){var r=this.state;this.__s||(this.__s=n({},r)),n(r,"function"==typeof t?t(r,this.props):t),e&&(this.__h=this.__h||[]).push(e),i(this)},forceUpdate:function(t){t&&(this.__h=this.__h||[]).push(t),E(this,2)},render:function(){}});var z={h:r,createElement:r,cloneElement:o,Component:T,render:C,rerender:a,options:k};void 0!==e?e.exports=z:self.preact=z}()},{}],491:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(f===setTimeout)return setTimeout(t,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function a(t){if(d===clearTimeout)return clearTimeout(t);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function s(){g&&h&&(g=!1,h.length?m=h.concat(m):v=-1,m.length&&u())}function u(){if(!g){var t=i(s);g=!0;for(var e=m.length;e;){for(h=m,m=[];++v<e;)h&&h[v].run();v=-1,e=m.length}h=null,g=!1,a(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var f,d,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(t){f=n}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(t){d=o}}();var h,m=[],g=!1,v=-1;p.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];m.push(new l(t,e)),1!==m.length||g||i(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(t){return[]},p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],492:[function(t,e,r){"use strict";e.exports=t("./lib/core.js"),t("./lib/done.js"),t("./lib/es6-extensions.js"),t("./lib/node-extensions.js")},{"./lib/core.js":493,"./lib/done.js":494,"./lib/es6-extensions.js":495,"./lib/node-extensions.js":496}],493:[function(t,e,r){"use strict";function n(t){function e(t){if(null===u)return void c.push(t);a(function(){var e=u?t.onFulfilled:t.onRejected;if(null===e)return void(u?t.resolve:t.reject)(l);var r;try{r=e(l)}catch(e){return void t.reject(e)}t.resolve(r)})}function r(t){try{if(t===f)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void i(e.bind(t),r,n)}u=!0,l=t,s()}catch(t){n(t)}}function n(t){u=!1,l=t,s()}function s(){for(var t=0,r=c.length;t<r;t++)e(c[t]);c=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");var u=null,l=null,c=[],f=this;this.then=function(t,r){return new f.constructor(function(n,i){e(new o(t,r,n,i))})},i(t,r,n)}function o(t,e,r,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=r,this.reject=n}function i(t,e,r){var n=!1;try{t(function(t){n||(n=!0,e(t))},function(t){n||(n=!0,r(t))})}catch(t){if(n)return;n=!0,r(t)}}var a=t("asap");e.exports=n},{asap:1}],494:[function(t,e,r){"use strict";var n=t("./core.js"),o=t("asap");e.exports=n,n.prototype.done=function(t,e){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){o(function(){throw t})})}},{"./core.js":493,asap:1}],495:[function(t,e,r){"use strict";function n(t){this.then=function(e){return"function"!=typeof e?this:new o(function(r,n){i(function(){try{r(e(t))}catch(t){n(t)}})})}}var o=t("./core.js"),i=t("asap");e.exports=o,n.prototype=o.prototype;var a=new n(!0),s=new n(!1),u=new n(null),l=new n(void 0),c=new n(0),f=new n("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return u;if(void 0===t)return l;if(!0===t)return a;if(!1===t)return s;if(0===t)return c;if(""===t)return f;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new o(e.bind(t))}catch(t){return new o(function(e,r){r(t)})}return new n(t)},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,r){function n(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){n(i,t)},r)}e[i]=a,0==--o&&t(e)}catch(t){r(t)}}if(0===e.length)return t([]);for(var o=e.length,i=0;i<e.length;i++)n(i,e[i])})},o.reject=function(t){return new o(function(e,r){r(t)})},o.race=function(t){return new o(function(e,r){t.forEach(function(t){o.resolve(t).then(e,r)})})},o.prototype.catch=function(t){return this.then(null,t)}},{"./core.js":493,asap:1}],496:[function(t,e,r){"use strict";var n=t("./core.js"),o=t("asap");e.exports=n,n.denodeify=function(t,e){return e=e||1/0,function(){var r=this,o=Array.prototype.slice.call(arguments);return new n(function(n,i){for(;o.length&&o.length>e;)o.pop();o.push(function(t,e){t?i(t):n(e)});var a=t.apply(r,o);!a||"object"!=typeof a&&"function"!=typeof a||"function"!=typeof a.then||n(a)})}},n.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,i=this;try{return t.apply(this,arguments).nodeify(r,i)}catch(t){if(null===r||void 0===r)return new n(function(e,r){r(t)});o(function(){r.call(i,t)})}}},n.prototype.nodeify=function(t,e){if("function"!=typeof t)return this;this.then(function(r){o(function(){t.call(e,null,r)})},function(r){o(function(){t.call(e,r)})})}},{"./core.js":493,asap:1}],497:[function(e,r,n){(function(e){!function(o){function i(t){throw new RangeError(N[t])}function a(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function s(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(R,"."),n+a(t.split("."),e).join(".")}function u(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function l(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=L(t>>>10&1023|55296),t=56320|1023&t),e+=L(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:S}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function d(t,e,r){var n=0;for(t=r?B(t/j):t>>1,t+=B(t/e);t>I*A>>1;n+=S)t=B(t/I);return B(n+(I+1)*t/(t+E))}function p(t){var e,r,n,o,a,s,u,f,p,h,m=[],g=t.length,v=0,b=T,y=P;for(r=t.lastIndexOf(C),r<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&i("not-basic"),m.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<g;){for(a=v,s=1,u=S;o>=g&&i("invalid-input"),f=c(t.charCodeAt(o++)),(f>=S||f>B((w-v)/s))&&i("overflow"),v+=f*s,p=u<=y?O:u>=y+A?A:u-y,!(f<p);u+=S)h=S-p,s>B(w/h)&&i("overflow"),s*=h;e=m.length+1,y=d(v-a,e,0==a),B(v/e)>w-b&&i("overflow"),b+=B(v/e),v%=e,m.splice(v++,0,b)}return l(m)}function h(t){var e,r,n,o,a,s,l,c,p,h,m,g,v,b,y,_=[];for(t=u(t),g=t.length,e=T,r=0,a=P,s=0;s<g;++s)(m=t[s])<128&&_.push(L(m));for(n=o=_.length,o&&_.push(C);n<g;){for(l=w,s=0;s<g;++s)(m=t[s])>=e&&m<l&&(l=m);for(v=n+1,l-e>B((w-r)/v)&&i("overflow"),r+=(l-e)*v,e=l,s=0;s<g;++s)if(m=t[s],m<e&&++r>w&&i("overflow"),m==e){for(c=r,p=S;h=p<=a?O:p>=a+A?A:p-a,!(c<h);p+=S)y=c-h,b=S-h,_.push(L(f(h+y%b,0))),c=B(y/b);_.push(L(f(c,0))),a=d(r,v,n==o),r=0,++n}++r,++e}return _.join("")}function m(t){return s(t,function(t){return k.test(t)?p(t.slice(4).toLowerCase()):t})}function g(t){return s(t,function(t){return M.test(t)?"xn--"+h(t):t})}var v="object"==typeof n&&n&&!n.nodeType&&n,b="object"==typeof r&&r&&!r.nodeType&&r,y="object"==typeof e&&e;y.global!==y&&y.window!==y&&y.self!==y||(o=y);var _,x,w=2147483647,S=36,O=1,A=26,E=38,j=700,P=72,T=128,C="-",k=/^xn--/,M=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,N={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=S-O,B=Math.floor,L=String.fromCharCode;if(_={version:"1.4.1",ucs2:{decode:u,encode:l},decode:p,encode:h,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return _});else if(v&&b)if(r.exports==v)b.exports=_;else for(x in _)_.hasOwnProperty(x)&&(v[x]=_[x]);else o.punycode=_}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],498:[function(t,e,r){"use strict";var n=t("strict-uri-encode");r.extract=function(t){return t.split("?")[1]||""},r.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,e){var r=e.replace(/\+/g," ").split("="),n=r.shift(),o=r.length>0?r.join("="):void 0;return n=decodeURIComponent(n),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(n)?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o,t},{}):{})},r.stringify=function(t){return t?Object.keys(t).sort().map(function(e){var r=t[e];return Array.isArray(r)?r.sort().map(function(t){return n(e)+"="+n(t)}).join("&"):n(e)+"="+n(r)}).filter(function(t){return t.length>0}).join("&"):""}},{"strict-uri-encode":514}],499:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,i){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var l=t.length;u>0&&l>u&&(l=u);for(var c=0;c<l;++c){var f,d,p,h,m=t[c].replace(s,"%20"),g=m.indexOf(r);g>=0?(f=m.substr(0,g),d=m.substr(g+1)):(f=m,d=""),p=decodeURIComponent(f),h=decodeURIComponent(d),n(a,p)?o(a[p])?a[p].push(h):a[p]=[a[p],h]:a[p]=h}return a};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],500:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?n(a(t),function(a){var s=encodeURIComponent(o(a))+r;return i(t[a])?n(t[a],function(t){return s+encodeURIComponent(o(t))}).join(e):s+encodeURIComponent(o(t[a]))}).join(e):s?encodeURIComponent(o(s))+r+encodeURIComponent(o(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],501:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":499,"./encode":500}],502:[function(e,r,n){!function(e,o){"object"==typeof n&&"object"==typeof r?r.exports=o():"function"==typeof t&&t.amd?t([],o):"object"==typeof n?n.Raphael=o():e.Raphael=o()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var n,o;n=[r(1),r(3),r(4)],void 0!==(o=function(t){return t}.apply(e,n))&&(t.exports=o)},function(t,e,r){var n,o;n=[r(2)],void 0!==(o=function(t){function e(r){if(e.is(r,"function"))return y?r():t.on("raphael.DOMload",r);if(e.is(r,q))return e._engine.create[P](e,r.splice(0,3+e.is(r[0],U))).add(r);var n=Array.prototype.slice.call(arguments,0);if(e.is(n[n.length-1],"function")){var o=n.pop();return y?o.call(e._engine.create[P](e,n)):t.on("raphael.DOMload",function(){o.call(e._engine.create[P](e,n))})}return e._engine.create[P](e,arguments)}function r(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var n in t)t[O](n)&&(e[n]=r(t[n]));return e}function n(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return t.push(t.splice(r,1)[0])}function o(t,e,r){function o(){var i=Array.prototype.slice.call(arguments,0),a=i.join("␀"),s=o.cache=o.cache||{},u=o.count=o.count||[];return s[O](a)?(n(u,a),r?r(s[a]):s[a]):(u.length>=1e3&&delete s[u.shift()],u.push(a),s[a]=t[P](e,i),r?r(s[a]):s[a])}return o}function i(){return this.hex}function a(t,e){for(var r=[],n=0,o=t.length;o-2*!e>n;n+=2){var i=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?o-4==n?i[3]={x:+t[0],y:+t[1]}:o-2==n&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[o-2],y:+t[o-1]}:o-4==n?i[3]=i[2]:n||(i[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return r}function s(t,e,r,n,o){return t*(t*(-3*e+9*r-9*n+3*o)+6*e-12*r+6*n)-3*e+3*r}function u(t,e,r,n,o,i,a,u,l){null==l&&(l=1),l=l>1?1:l<0?0:l;for(var c=l/2,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0,h=0;h<12;h++){var m=c*f[h]+c,g=s(m,t,r,o,a),v=s(m,e,n,i,u),b=g*g+v*v;p+=d[h]*D.sqrt(b)}return c*p}function l(t,e,r,n,o,i,a,s,l){if(!(l<0||u(t,e,r,n,o,i,a,s)<l)){var c,f=.5,d=1-f;for(c=u(t,e,r,n,o,i,a,s,d);z(c-l)>.01;)f/=2,d+=(c<l?1:-1)*f,c=u(t,e,r,n,o,i,a,s,d);return d}}function c(t,e,r,n,o,i,a,s){if(!(F(t,r)<G(o,a)||G(t,r)>F(o,a)||F(e,n)<G(i,s)||G(e,n)>F(i,s))){var u=(t*n-e*r)*(o-a)-(t-r)*(o*s-i*a),l=(t*n-e*r)*(i-s)-(e-n)*(o*s-i*a),c=(t-r)*(i-s)-(e-n)*(o-a);if(c){var f=u/c,d=l/c,p=+f.toFixed(2),h=+d.toFixed(2);if(!(p<+G(t,r).toFixed(2)||p>+F(t,r).toFixed(2)||p<+G(o,a).toFixed(2)||p>+F(o,a).toFixed(2)||h<+G(e,n).toFixed(2)||h>+F(e,n).toFixed(2)||h<+G(i,s).toFixed(2)||h>+F(i,s).toFixed(2)))return{x:f,y:d}}}}function f(t,r,n){var o=e.bezierBBox(t),i=e.bezierBBox(r);if(!e.isBBoxIntersect(o,i))return n?0:[];for(var a=u.apply(0,t),s=u.apply(0,r),l=F(~~(a/5),1),f=F(~~(s/5),1),d=[],p=[],h={},m=n?0:[],g=0;g<l+1;g++){var v=e.findDotsAtSegment.apply(e,t.concat(g/l));d.push({x:v.x,y:v.y,t:g/l})}for(g=0;g<f+1;g++)v=e.findDotsAtSegment.apply(e,r.concat(g/f)),p.push({x:v.x,y:v.y,t:g/f});for(g=0;g<l;g++)for(var b=0;b<f;b++){var y=d[g],_=d[g+1],x=p[b],w=p[b+1],S=z(_.x-y.x)<.001?"y":"x",O=z(w.x-x.x)<.001?"y":"x",A=c(y.x,y.y,_.x,_.y,x.x,x.y,w.x,w.y)
  ;if(A){if(h[A.x.toFixed(4)]==A.y.toFixed(4))continue;h[A.x.toFixed(4)]=A.y.toFixed(4);var E=y.t+z((A[S]-y[S])/(_[S]-y[S]))*(_.t-y.t),j=x.t+z((A[O]-x[O])/(w[O]-x[O]))*(w.t-x.t);E>=0&&E<=1.001&&j>=0&&j<=1.001&&(n?m++:m.push({x:A.x,y:A.y,t1:G(E,1),t2:G(j,1)}))}}return m}function d(t,r,n){t=e._path2curve(t),r=e._path2curve(r);for(var o,i,a,s,u,l,c,d,p,h,m=n?0:[],g=0,v=t.length;g<v;g++){var b=t[g];if("M"==b[0])o=u=b[1],i=l=b[2];else{"C"==b[0]?(p=[o,i].concat(b.slice(1)),o=p[6],i=p[7]):(p=[o,i,o,i,u,l,u,l],o=u,i=l);for(var y=0,_=r.length;y<_;y++){var x=r[y];if("M"==x[0])a=c=x[1],s=d=x[2];else{"C"==x[0]?(h=[a,s].concat(x.slice(1)),a=h[6],s=h[7]):(h=[a,s,a,s,c,d,c,d],a=c,s=d);var w=f(p,h,n);if(n)m+=w;else{for(var S=0,O=w.length;S<O;S++)w[S].segment1=g,w[S].segment2=y,w[S].bez1=p,w[S].bez2=h;m=m.concat(w)}}}}}return m}function p(t,e,r,n,o,i){null!=t?(this.a=+t,this.b=+e,this.c=+r,this.d=+n,this.e=+o,this.f=+i):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function h(){return this.x+M+this.y+M+this.width+" × "+this.height}function m(t,e,r,n,o,i){function a(t){return((c*t+l)*t+u)*t}function s(t,e){var r,n,o,i,s,f;for(o=t,f=0;f<8;f++){if(i=a(o)-t,z(i)<e)return o;if(s=(3*c*o+2*l)*o+u,z(s)<1e-6)break;o-=i/s}if(r=0,n=1,(o=t)<r)return r;if(o>n)return n;for(;r<n;){if(i=a(o),z(i-t)<e)return o;t>i?r=o:n=o,o=(n-r)/2+r}return o}var u=3*e,l=3*(n-e)-u,c=1-u-l,f=3*r,d=3*(o-r)-f,p=1-f-d;return function(t,e){var r=s(t,e);return((p*r+d)*r+f)*r}(t,1/(200*i))}function g(t,e){var r=[],n={};if(this.ms=e,this.times=1,t){for(var o in t)t[O](o)&&(n[Q(o)]=t[o],r.push(Q(o)));r.sort(ct)}this.anim=n,this.top=r[r.length-1],this.percents=r}function v(r,n,o,i,a,s){o=Q(o);var u,l,c,f,d,h,g=r.ms,v={},b={},y={};if(i)for(w=0,S=ie.length;w<S;w++){var _=ie[w];if(_.el.id==n.id&&_.anim==r){_.percent!=o?(ie.splice(w,1),c=1):l=_,n.attr(_.totalOrigin);break}}else i=+b;for(var w=0,S=r.percents.length;w<S;w++){if(r.percents[w]==o||r.percents[w]>i*r.top){o=r.percents[w],d=r.percents[w-1]||0,g=g/r.top*(o-d),f=r.percents[w+1],u=r.anim[o];break}i&&n.attr(r.anim[r.percents[w]])}if(u){if(l)l.initstatus=i,l.start=new Date-l.ms*i;else{for(var A in u)if(u[O](A)&&(rt[O](A)||n.paper.customAttributes[O](A)))switch(v[A]=n.attr(A),null==v[A]&&(v[A]=et[A]),b[A]=u[A],rt[A]){case U:y[A]=(b[A]-v[A])/g;break;case"colour":v[A]=e.getRGB(v[A]);var E=e.getRGB(b[A]);y[A]={r:(E.r-v[A].r)/g,g:(E.g-v[A].g)/g,b:(E.b-v[A].b)/g};break;case"path":var j=Nt(v[A],b[A]),P=j[1];for(v[A]=j[0],y[A]=[],w=0,S=v[A].length;w<S;w++){y[A][w]=[0];for(var C=1,k=v[A][w].length;C<k;C++)y[A][w][C]=(P[w][C]-v[A][w][C])/g}break;case"transform":var M=n._,I=Ft(M[A],b[A]);if(I)for(v[A]=I.from,b[A]=I.to,y[A]=[],y[A].real=!0,w=0,S=v[A].length;w<S;w++)for(y[A][w]=[v[A][w][0]],C=1,k=v[A][w].length;C<k;C++)y[A][w][C]=(b[A][w][C]-v[A][w][C])/g;else{var B=n.matrix||new p,L={_:{transform:M.transform},getBBox:function(){return n.getBBox(1)}};v[A]=[B.a,B.b,B.c,B.d,B.e,B.f],Lt(L,b[A]),b[A]=L._.transform,y[A]=[(L.matrix.a-B.a)/g,(L.matrix.b-B.b)/g,(L.matrix.c-B.c)/g,(L.matrix.d-B.d)/g,(L.matrix.e-B.e)/g,(L.matrix.f-B.f)/g]}break;case"csv":var D=R(u[A])[N](x),F=R(v[A])[N](x);if("clip-rect"==A)for(v[A]=F,y[A]=[],w=F.length;w--;)y[A][w]=(D[w]-v[A][w])/g;b[A]=D;break;default:for(D=[][T](u[A]),F=[][T](v[A]),y[A]=[],w=n.paper.customAttributes[A].length;w--;)y[A][w]=((D[w]||0)-(F[w]||0))/g}var G=u.easing,z=e.easing_formulas[G];if(!z)if((z=R(G).match(X))&&5==z.length){var H=z;z=function(t){return m(t,+H[1],+H[2],+H[3],+H[4],g)}}else z=ft;if(h=u.start||r.start||+new Date,_={anim:r,percent:o,timestamp:h,start:h+(r.del||0),status:0,initstatus:i||0,stop:!1,ms:g,easing:z,from:v,diff:y,to:b,el:n,callback:u.callback,prev:d,next:f,repeat:s||r.times,origin:n.attr(),totalOrigin:a},ie.push(_),i&&!l&&!c&&(_.stop=!0,_.start=new Date-g*i,1==ie.length))return se();c&&(_.start=new Date-_.ms*i),1==ie.length&&ae(se)}t("raphael.anim.start."+n.id,n,r)}}function b(t){for(var e=0;e<ie.length;e++)ie[e].el.paper==t&&ie.splice(e--,1)}e.version="2.2.0",e.eve=t;var y,_,x=/[, ]+/,w={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},S=/\{(\d+)\}/g,O="hasOwnProperty",A={doc:document,win:window},E={was:Object.prototype[O].call(A.win,"Raphael"),is:A.win.Raphael},j=function(){this.ca=this.customAttributes={}},P="apply",T="concat",C="ontouchstart"in A.win||A.win.DocumentTouch&&A.doc instanceof DocumentTouch,k="",M=" ",R=String,N="split",I="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[N](M),B={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},L=R.prototype.toLowerCase,D=Math,F=D.max,G=D.min,z=D.abs,H=D.pow,W=D.PI,U="number",V="string",q="array",K=Object.prototype.toString,Y=(e._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),$={NaN:1,Infinity:1,"-Infinity":1},X=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,Z=D.round,Q=parseFloat,J=parseInt,tt=R.prototype.toUpperCase,et=e._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0,class:""},rt=e._availableAnimAttrs={blur:U,"clip-rect":"csv",cx:U,cy:U,fill:"colour","fill-opacity":U,"font-size":U,height:U,opacity:U,path:"path",r:U,rx:U,ry:U,stroke:"colour","stroke-opacity":U,"stroke-width":U,transform:"transform",width:U,x:U,y:U},nt=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,ot={hs:1,rg:1},it=/,?([achlmqrstvxz]),?/gi,at=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,st=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ut=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,lt=(e._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),ct=function(t,e){return Q(t)-Q(e)},ft=function(t){return t},dt=e._rectPath=function(t,e,r,n,o){return o?[["M",t+o,e],["l",r-2*o,0],["a",o,o,0,0,1,o,o],["l",0,n-2*o],["a",o,o,0,0,1,-o,o],["l",2*o-r,0],["a",o,o,0,0,1,-o,-o],["l",0,2*o-n],["a",o,o,0,0,1,o,-o],["z"]]:[["M",t,e],["l",r,0],["l",0,n],["l",-r,0],["z"]]},pt=function(t,e,r,n){return null==n&&(n=r),[["M",t,e],["m",0,-n],["a",r,n,0,1,1,0,2*n],["a",r,n,0,1,1,0,-2*n],["z"]]},ht=e._getPath={path:function(t){return t.attr("path")},circle:function(t){var e=t.attrs;return pt(e.cx,e.cy,e.r)},ellipse:function(t){var e=t.attrs;return pt(e.cx,e.cy,e.rx,e.ry)},rect:function(t){var e=t.attrs;return dt(e.x,e.y,e.width,e.height,e.r)},image:function(t){var e=t.attrs;return dt(e.x,e.y,e.width,e.height)},text:function(t){var e=t._getBBox();return dt(e.x,e.y,e.width,e.height)},set:function(t){var e=t._getBBox();return dt(e.x,e.y,e.width,e.height)}},mt=e.mapPath=function(t,e){if(!e)return t;var r,n,o,i,a,s,u;for(t=Nt(t),o=0,a=t.length;o<a;o++)for(u=t[o],i=1,s=u.length;i<s;i+=2)r=e.x(u[i],u[i+1]),n=e.y(u[i],u[i+1]),u[i]=r,u[i+1]=n;return t};if(e._g=A,e.type=A.win.SVGAngle||A.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==e.type){var gt,vt=A.doc.createElement("div");if(vt.innerHTML='<v:shape adj="1"/>',gt=vt.firstChild,gt.style.behavior="url(#default#VML)",!gt||"object"!=typeof gt.adj)return e.type=k;vt=null}e.svg=!(e.vml="VML"==e.type),e._Paper=j,e.fn=_=j.prototype=e.prototype,e._id=0,e.is=function(t,e){return e=L.call(e),"finite"==e?!$[O](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||K.call(t).slice(8,-1).toLowerCase()==e},e.angle=function(t,r,n,o,i,a){if(null==i){var s=t-n,u=r-o;return s||u?(180+180*D.atan2(-u,-s)/W+360)%360:0}return e.angle(t,r,i,a)-e.angle(n,o,i,a)},e.rad=function(t){return t%360*W/180},e.deg=function(t){return Math.round(180*t/W%360*1e3)/1e3},e.snapTo=function(t,r,n){if(n=e.is(n,"finite")?n:10,e.is(t,q)){for(var o=t.length;o--;)if(z(t[o]-r)<=n)return t[o]}else{t=+t;var i=r%t;if(i<n)return r-i;if(i>t-n)return r-i+t}return r};e.createUUID=function(t,e){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(t,e).toUpperCase()}}(/[xy]/g,function(t){var e=16*D.random()|0;return("x"==t?e:3&e|8).toString(16)});e.setWindow=function(r){t("raphael.setWindow",e,A.win,r),A.win=r,A.doc=A.win.document,e._engine.initWin&&e._engine.initWin(A.win)};var bt=function(t){if(e.vml){var r,n=/^\s+|\s+$/g;try{var i=new ActiveXObject("htmlfile");i.write("<body>"),i.close(),r=i.body}catch(t){r=createPopup().document.body}var a=r.createTextRange();bt=o(function(t){try{r.style.color=R(t).replace(n,k);var e=a.queryCommandValue("ForeColor");return e=(255&e)<<16|65280&e|(16711680&e)>>>16,"#"+("000000"+e.toString(16)).slice(-6)}catch(t){return"none"}})}else{var s=A.doc.createElement("i");s.title="Raphaël Colour Picker",s.style.display="none",A.doc.body.appendChild(s),bt=o(function(t){return s.style.color=t,A.doc.defaultView.getComputedStyle(s,k).getPropertyValue("color")})}return bt(t)},yt=function(){return"hsb("+[this.h,this.s,this.b]+")"},_t=function(){return"hsl("+[this.h,this.s,this.l]+")"},xt=function(){return this.hex},wt=function(t,r,n){if(null==r&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(n=t.b,r=t.g,t=t.r),null==r&&e.is(t,V)){var o=e.getRGB(t);t=o.r,r=o.g,n=o.b}return(t>1||r>1||n>1)&&(t/=255,r/=255,n/=255),[t,r,n]},St=function(t,r,n,o){t*=255,r*=255,n*=255;var i={r:t,g:r,b:n,hex:e.rgb(t,r,n),toString:xt};return e.is(o,"finite")&&(i.opacity=o),i};e.color=function(t){var r;return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(r=e.hsb2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(r=e.hsl2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):(e.is(t,"string")&&(t=e.getRGB(t)),e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(r=e.rgb2hsl(t),t.h=r.h,t.s=r.s,t.l=r.l,r=e.rgb2hsb(t),t.v=r.b):(t={hex:"none"},t.r=t.g=t.b=t.h=t.s=t.v=t.l=-1)),t.toString=xt,t},e.hsb2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,n=t.o,t=t.h),t*=360;var o,i,a,s,u;return t=t%360/60,u=r*e,s=u*(1-z(t%2-1)),o=i=a=r-u,t=~~t,o+=[u,s,0,0,s,u][t],i+=[s,u,u,s,0,0][t],a+=[0,0,s,u,u,s][t],St(o,i,a,n)},e.hsl2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),t*=360;var o,i,a,s,u;return t=t%360/60,u=2*e*(r<.5?r:1-r),s=u*(1-z(t%2-1)),o=i=a=r-u/2,t=~~t,o+=[u,s,0,0,s,u][t],i+=[s,u,u,s,0,0][t],a+=[0,0,s,u,u,s][t],St(o,i,a,n)},e.rgb2hsb=function(t,e,r){r=wt(t,e,r),t=r[0],e=r[1],r=r[2];var n,o,i,a;return i=F(t,e,r),a=i-G(t,e,r),n=0==a?null:i==t?(e-r)/a:i==e?(r-t)/a+2:(t-e)/a+4,n=(n+360)%6*60/360,o=0==a?0:a/i,{h:n,s:o,b:i,toString:yt}},e.rgb2hsl=function(t,e,r){r=wt(t,e,r),t=r[0],e=r[1],r=r[2];var n,o,i,a,s,u;return a=F(t,e,r),s=G(t,e,r),u=a-s,n=0==u?null:a==t?(e-r)/u:a==e?(r-t)/u+2:(t-e)/u+4,n=(n+360)%6*60/360,i=(a+s)/2,o=0==u?0:i<.5?u/(2*i):u/(2-2*i),{h:n,s:o,l:i,toString:_t}},e._path2string=function(){return this.join(",").replace(it,"$1")};e._preload=function(t,e){var r=A.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,A.doc.body.removeChild(this)},r.onerror=function(){A.doc.body.removeChild(this)},A.doc.body.appendChild(r),r.src=t};e.getRGB=o(function(t){if(!t||(t=R(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:i};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:i};!(ot[O](t.toLowerCase().substring(0,2))||"#"==t.charAt())&&(t=bt(t));var r,n,o,a,s,u,l=t.match(Y);return l?(l[2]&&(o=J(l[2].substring(5),16),n=J(l[2].substring(3,5),16),r=J(l[2].substring(1,3),16)),l[3]&&(o=J((s=l[3].charAt(3))+s,16),n=J((s=l[3].charAt(2))+s,16),r=J((s=l[3].charAt(1))+s,16)),l[4]&&(u=l[4][N](nt),r=Q(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=Q(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),o=Q(u[2]),"%"==u[2].slice(-1)&&(o*=2.55),"rgba"==l[1].toLowerCase().slice(0,4)&&(a=Q(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100)),l[5]?(u=l[5][N](nt),r=Q(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=Q(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),o=Q(u[2]),"%"==u[2].slice(-1)&&(o*=2.55),("deg"==u[0].slice(-3)||"°"==u[0].slice(-1))&&(r/=360),"hsba"==l[1].toLowerCase().slice(0,4)&&(a=Q(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100),e.hsb2rgb(r,n,o,a)):l[6]?(u=l[6][N](nt),r=Q(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=Q(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),o=Q(u[2]),"%"==u[2].slice(-1)&&(o*=2.55),("deg"==u[0].slice(-3)||"°"==u[0].slice(-1))&&(r/=360),"hsla"==l[1].toLowerCase().slice(0,4)&&(a=Q(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100),e.hsl2rgb(r,n,o,a)):(l={r:r,g:n,b:o,toString:i},l.hex="#"+(16777216|o|n<<8|r<<16).toString(16).slice(1),e.is(a,"finite")&&(l.opacity=a),l)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:i}},e),e.hsb=o(function(t,r,n){return e.hsb2rgb(t,r,n).hex}),e.hsl=o(function(t,r,n){return e.hsl2rgb(t,r,n).hex}),e.rgb=o(function(t,e,r){function n(t){return t+.5|0}return"#"+(16777216|n(r)|n(e)<<8|n(t)<<16).toString(16).slice(1)}),e.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=function(t){if(!t)return null;var r=Ot(t);if(r.arr)return Et(r.arr);var n={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},o=[];return e.is(t,q)&&e.is(t[0],q)&&(o=Et(t)),o.length||R(t).replace(at,function(t,e,r){var i=[],a=e.toLowerCase();if(r.replace(ut,function(t,e){e&&i.push(+e)}),"m"==a&&i.length>2&&(o.push([e][T](i.splice(0,2))),a="l",e="m"==e?"l":"L"),"r"==a)o.push([e][T](i));else for(;i.length>=n[a]&&(o.push([e][T](i.splice(0,n[a]))),n[a]););}),o.toString=e._path2string,r.arr=Et(o),o},e.parseTransformString=o(function(t){if(!t)return null;var r=[];return e.is(t,q)&&e.is(t[0],q)&&(r=Et(t)),r.length||R(t).replace(st,function(t,e,n){var o=[];L.call(e);n.replace(ut,function(t,e){e&&o.push(+e)}),r.push([e][T](o))}),r.toString=e._path2string,r});var Ot=function(t){var e=Ot.ps=Ot.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[O](r)&&r!=t&&!--e[r].sleep&&delete e[r]}),e[t]};e.findDotsAtSegment=function(t,e,r,n,o,i,a,s,u){var l=1-u,c=H(l,3),f=H(l,2),d=u*u,p=d*u,h=c*t+3*f*u*r+3*l*u*u*o+p*a,m=c*e+3*f*u*n+3*l*u*u*i+p*s,g=t+2*u*(r-t)+d*(o-2*r+t),v=e+2*u*(n-e)+d*(i-2*n+e),b=r+2*u*(o-r)+d*(a-2*o+r),y=n+2*u*(i-n)+d*(s-2*i+n),_=l*t+u*r,x=l*e+u*n,w=l*o+u*a,S=l*i+u*s,O=90-180*D.atan2(g-b,v-y)/W;return(g>b||v<y)&&(O+=180),{x:h,y:m,m:{x:g,y:v},n:{x:b,y:y},start:{x:_,y:x},end:{x:w,y:S},alpha:O}},e.bezierBBox=function(t,r,n,o,i,a,s,u){e.is(t,"array")||(t=[t,r,n,o,i,a,s,u]);var l=Rt.apply(null,t);return{x:l.min.x,y:l.min.y,x2:l.max.x,y2:l.max.y,width:l.max.x-l.min.x,height:l.max.y-l.min.y}},e.isPointInsideBBox=function(t,e,r){return e>=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},e.isBBoxIntersect=function(t,r){var n=e.isPointInsideBBox;return n(r,t.x,t.y)||n(r,t.x2,t.y)||n(r,t.x,t.y2)||n(r,t.x2,t.y2)||n(t,r.x,r.y)||n(t,r.x2,r.y)||n(t,r.x,r.y2)||n(t,r.x2,r.y2)||(t.x<r.x2&&t.x>r.x||r.x<t.x2&&r.x>t.x)&&(t.y<r.y2&&t.y>r.y||r.y<t.y2&&r.y>t.y)},e.pathIntersection=function(t,e){return d(t,e)},e.pathIntersectionNumber=function(t,e){return d(t,e,1)},e.isPointInsidePath=function(t,r,n){var o=e.pathBBox(t);return e.isPointInsideBBox(o,r,n)&&d(t,[["M",r,n],["H",o.x2+10]],1)%2==1},e._removedFactory=function(e){return function(){t("raphael.log",null,"Raphaël: you are calling to method “"+e+"” of removed object",e)}};var At=e.pathBBox=function(t){var e=Ot(t);if(e.bbox)return r(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};t=Nt(t);for(var n,o=0,i=0,a=[],s=[],u=0,l=t.length;u<l;u++)if(n=t[u],"M"==n[0])o=n[1],i=n[2],a.push(o),s.push(i);else{var c=Rt(o,i,n[1],n[2],n[3],n[4],n[5],n[6]);a=a[T](c.min.x,c.max.x),s=s[T](c.min.y,c.max.y),o=n[5],i=n[6]}var f=G[P](0,a),d=G[P](0,s),p=F[P](0,a),h=F[P](0,s),m=p-f,g=h-d,v={x:f,y:d,x2:p,y2:h,width:m,height:g,cx:f+m/2,cy:d+g/2};return e.bbox=r(v),v},Et=function(t){var n=r(t);return n.toString=e._path2string,n},jt=e._pathToRelative=function(t){var r=Ot(t);if(r.rel)return Et(r.rel);e.is(t,q)&&e.is(t&&t[0],q)||(t=e.parsePathString(t));var n=[],o=0,i=0,a=0,s=0,u=0;"M"==t[0][0]&&(o=t[0][1],i=t[0][2],a=o,s=i,u++,n.push(["M",o,i]));for(var l=u,c=t.length;l<c;l++){var f=n[l]=[],d=t[l];if(d[0]!=L.call(d[0]))switch(f[0]=L.call(d[0]),f[0]){case"a":f[1]=d[1],f[2]=d[2],f[3]=d[3],f[4]=d[4],f[5]=d[5],f[6]=+(d[6]-o).toFixed(3),f[7]=+(d[7]-i).toFixed(3);break;case"v":f[1]=+(d[1]-i).toFixed(3);break;case"m":a=d[1],s=d[2];default:for(var p=1,h=d.length;p<h;p++)f[p]=+(d[p]-(p%2?o:i)).toFixed(3)}else{f=n[l]=[],"m"==d[0]&&(a=d[1]+o,s=d[2]+i);for(var m=0,g=d.length;m<g;m++)n[l][m]=d[m]}var v=n[l].length;switch(n[l][0]){case"z":o=a,i=s;break;case"h":o+=+n[l][v-1];break;case"v":i+=+n[l][v-1];break;default:o+=+n[l][v-2],i+=+n[l][v-1]}}return n.toString=e._path2string,r.rel=Et(n),n},Pt=e._pathToAbsolute=function(t){var r=Ot(t);if(r.abs)return Et(r.abs);if(e.is(t,q)&&e.is(t&&t[0],q)||(t=e.parsePathString(t)),!t||!t.length)return[["M",0,0]];var n=[],o=0,i=0,s=0,u=0,l=0;"M"==t[0][0]&&(o=+t[0][1],i=+t[0][2],s=o,u=i,l++,n[0]=["M",o,i]);for(var c,f,d=3==t.length&&"M"==t[0][0]&&"R"==t[1][0].toUpperCase()&&"Z"==t[2][0].toUpperCase(),p=l,h=t.length;p<h;p++){if(n.push(c=[]),f=t[p],f[0]!=tt.call(f[0]))switch(c[0]=tt.call(f[0]),c[0]){case"A":c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=+(f[6]+o),c[7]=+(f[7]+i);break;case"V":c[1]=+f[1]+i;break;case"H":c[1]=+f[1]+o;break;case"R":for(var m=[o,i][T](f.slice(1)),g=2,v=m.length;g<v;g++)m[g]=+m[g]+o,m[++g]=+m[g]+i;n.pop(),n=n[T](a(m,d));break;case"M":s=+f[1]+o,u=+f[2]+i;default:for(g=1,v=f.length;g<v;g++)c[g]=+f[g]+(g%2?o:i)}else if("R"==f[0])m=[o,i][T](f.slice(1)),n.pop(),n=n[T](a(m,d)),c=["R"][T](f.slice(-2));else for(var b=0,y=f.length;b<y;b++)c[b]=f[b];switch(c[0]){case"Z":o=s,i=u;break;case"H":o=c[1];break;case"V":i=c[1];break;case"M":s=c[c.length-2],u=c[c.length-1];default:o=c[c.length-2],i=c[c.length-1]}}return n.toString=e._path2string,r.abs=Et(n),n},Tt=function(t,e,r,n){return[t,e,r,n,r,n]},Ct=function(t,e,r,n,o,i){var a=1/3,s=2/3;return[a*t+s*r,a*e+s*n,a*o+s*r,a*i+s*n,o,i]},kt=function(t,e,r,n,i,a,s,u,l,c){var f,d=120*W/180,p=W/180*(+i||0),h=[],m=o(function(t,e,r){return{x:t*D.cos(r)-e*D.sin(r),y:t*D.sin(r)+e*D.cos(r)}});if(c)O=c[0],A=c[1],w=c[2],S=c[3];else{f=m(t,e,-p),t=f.x,e=f.y,f=m(u,l,-p),u=f.x,l=f.y;var g=(D.cos(W/180*i),D.sin(W/180*i),(t-u)/2),v=(e-l)/2,b=g*g/(r*r)+v*v/(n*n);b>1&&(b=D.sqrt(b),r*=b,n*=b);var y=r*r,_=n*n,x=(a==s?-1:1)*D.sqrt(z((y*_-y*v*v-_*g*g)/(y*v*v+_*g*g))),w=x*r*v/n+(t+u)/2,S=x*-n*g/r+(e+l)/2,O=D.asin(((e-S)/n).toFixed(9)),A=D.asin(((l-S)/n).toFixed(9));O=t<w?W-O:O,A=u<w?W-A:A,O<0&&(O=2*W+O),A<0&&(A=2*W+A),s&&O>A&&(O-=2*W),!s&&A>O&&(A-=2*W)}var E=A-O;if(z(E)>d){var j=A,P=u,C=l;A=O+d*(s&&A>O?1:-1),u=w+r*D.cos(A),l=S+n*D.sin(A),h=kt(u,l,r,n,i,0,s,P,C,[A,j,w,S])}E=A-O;var k=D.cos(O),M=D.sin(O),R=D.cos(A),I=D.sin(A),B=D.tan(E/4),L=4/3*r*B,F=4/3*n*B,G=[t,e],H=[t+L*M,e-F*k],U=[u+L*I,l-F*R],V=[u,l];if(H[0]=2*G[0]-H[0],H[1]=2*G[1]-H[1],c)return[H,U,V][T](h);h=[H,U,V][T](h).join()[N](",");for(var q=[],K=0,Y=h.length;K<Y;K++)q[K]=K%2?m(h[K-1],h[K],p).y:m(h[K],h[K+1],p).x;return q},Mt=function(t,e,r,n,o,i,a,s,u){var l=1-u;return{x:H(l,3)*t+3*H(l,2)*u*r+3*l*u*u*o+H(u,3)*a,y:H(l,3)*e+3*H(l,2)*u*n+3*l*u*u*i+H(u,3)*s}},Rt=o(function(t,e,r,n,o,i,a,s){var u,l=o-2*r+t-(a-2*o+r),c=2*(r-t)-2*(o-r),f=t-r,d=(-c+D.sqrt(c*c-4*l*f))/2/l,p=(-c-D.sqrt(c*c-4*l*f))/2/l,h=[e,s],m=[t,a];return z(d)>"1e12"&&(d=.5),z(p)>"1e12"&&(p=.5),d>0&&d<1&&(u=Mt(t,e,r,n,o,i,a,s,d),m.push(u.x),h.push(u.y)),p>0&&p<1&&(u=Mt(t,e,r,n,o,i,a,s,p),m.push(u.x),h.push(u.y)),l=i-2*n+e-(s-2*i+n),c=2*(n-e)-2*(i-n),f=e-n,d=(-c+D.sqrt(c*c-4*l*f))/2/l,p=(-c-D.sqrt(c*c-4*l*f))/2/l,z(d)>"1e12"&&(d=.5),z(p)>"1e12"&&(p=.5),d>0&&d<1&&(u=Mt(t,e,r,n,o,i,a,s,d),m.push(u.x),h.push(u.y)),p>0&&p<1&&(u=Mt(t,e,r,n,o,i,a,s,p),m.push(u.x),h.push(u.y)),{min:{x:G[P](0,m),y:G[P](0,h)},max:{x:F[P](0,m),y:F[P](0,h)}}}),Nt=e._path2curve=o(function(t,e){var r=!e&&Ot(t);if(!e&&r.curve)return Et(r.curve);for(var n=Pt(t),o=e&&Pt(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=(function(t,e,r){var n,o,i={T:1,Q:1};if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in i)&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][T](kt[P](0,[e.x,e.y][T](t.slice(1))));break;case"S":"C"==r||"S"==r?(n=2*e.x-e.bx,o=2*e.y-e.by):(n=e.x,o=e.y),t=["C",n,o][T](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][T](Ct(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][T](Ct(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][T](Tt(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][T](Tt(e.x,e.y,t[1],e.y));break;case"V":t=["C"][T](Tt(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][T](Tt(e.x,e.y,e.X,e.Y))}return t}),u=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)c[e]="A",o&&(f[e]="A"),t.splice(e++,0,["C"][T](r.splice(0,6)));t.splice(e,1),m=F(n.length,o&&o.length||0)}},l=function(t,e,r,i,a){t&&e&&"M"==t[a][0]&&"M"!=e[a][0]&&(e.splice(a,0,["M",i.x,i.y]),r.bx=0,r.by=0,r.x=t[a][1],r.y=t[a][2],m=F(n.length,o&&o.length||0))},c=[],f=[],d="",p="",h=0,m=F(n.length,o&&o.length||0);h<m;h++){n[h]&&(d=n[h][0]),"C"!=d&&(c[h]=d,h&&(p=c[h-1])),n[h]=s(n[h],i,p),"A"!=c[h]&&"C"==d&&(c[h]="C"),u(n,h),o&&(o[h]&&(d=o[h][0]),"C"!=d&&(f[h]=d,h&&(p=f[h-1])),o[h]=s(o[h],a,p),"A"!=f[h]&&"C"==d&&(f[h]="C"),u(o,h)),l(n,o,i,a,h),l(o,n,a,i,h);var g=n[h],v=o&&o[h],b=g.length,y=o&&v.length;i.x=g[b-2],i.y=g[b-1],i.bx=Q(g[b-4])||i.x,i.by=Q(g[b-3])||i.y,a.bx=o&&(Q(v[y-4])||a.x),a.by=o&&(Q(v[y-3])||a.y),a.x=o&&v[y-2],a.y=o&&v[y-1]}return o||(r.curve=Et(n)),o?[n,o]:n},null,Et),It=(e._parseDots=o(function(t){for(var r=[],n=0,o=t.length;n<o;n++){var i={},a=t[n].match(/^([^:]*):?([\d\.]*)/);if(i.color=e.getRGB(a[1]),i.color.error)return null;i.opacity=i.color.opacity,i.color=i.color.hex,a[2]&&(i.offset=a[2]+"%"),r.push(i)}for(n=1,o=r.length-1;n<o;n++)if(!r[n].offset){for(var s=Q(r[n-1].offset||0),u=0,l=n+1;l<o;l++)if(r[l].offset){u=r[l].offset;break}u||(u=100,l=o),u=Q(u);for(var c=(u-s)/(l-n+1);n<l;n++)s+=c,r[n].offset=s+"%"}return r}),e._tear=function(t,e){t==e.top&&(e.top=t.prev),t==e.bottom&&(e.bottom=t.next),t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next)}),Bt=(e._tofront=function(t,e){e.top!==t&&(It(t,e),t.next=null,t.prev=e.top,e.top.next=t,e.top=t)},e._toback=function(t,e){e.bottom!==t&&(It(t,e),t.next=e.bottom,t.prev=null,e.bottom.prev=t,e.bottom=t)},e._insertafter=function(t,e,r){It(t,r),e==r.top&&(r.top=t),e.next&&(e.next.prev=t),t.next=e.next,t.prev=e,e.next=t},e._insertbefore=function(t,e,r){It(t,r),e==r.bottom&&(r.bottom=t),e.prev&&(e.prev.next=t),t.prev=e.prev,e.prev=t,t.next=e},e.toMatrix=function(t,e){var r=At(t),n={_:{transform:k},getBBox:function(){return r}};return Lt(n,e),n.matrix}),Lt=(e.transformPath=function(t,e){return mt(t,Bt(t,e))},e._extractTransform=function(t,r){if(null==r)return t._.transform;r=R(r).replace(/\.{3}|\u2026/g,t._.transform||k);var n=e.parseTransformString(r),o=0,i=0,a=0,s=1,u=1,l=t._,c=new p;if(l.transform=n||[],n)for(var f=0,d=n.length;f<d;f++){var h,m,g,v,b,y=n[f],_=y.length,x=R(y[0]).toLowerCase(),w=y[0]!=x,S=w?c.invert():0;"t"==x&&3==_?w?(h=S.x(0,0),m=S.y(0,0),g=S.x(y[1],y[2]),v=S.y(y[1],y[2]),c.translate(g-h,v-m)):c.translate(y[1],y[2]):"r"==x?2==_?(b=b||t.getBBox(1),c.rotate(y[1],b.x+b.width/2,b.y+b.height/2),o+=y[1]):4==_&&(w?(g=S.x(y[2],y[3]),v=S.y(y[2],y[3]),c.rotate(y[1],g,v)):c.rotate(y[1],y[2],y[3]),o+=y[1]):"s"==x?2==_||3==_?(b=b||t.getBBox(1),c.scale(y[1],y[_-1],b.x+b.width/2,b.y+b.height/2),s*=y[1],u*=y[_-1]):5==_&&(w?(g=S.x(y[3],y[4]),v=S.y(y[3],y[4]),c.scale(y[1],y[2],g,v)):c.scale(y[1],y[2],y[3],y[4]),s*=y[1],u*=y[2]):"m"==x&&7==_&&c.add(y[1],y[2],y[3],y[4],y[5],y[6]),l.dirtyT=1,t.matrix=c}t.matrix=c,l.sx=s,l.sy=u,l.deg=o,l.dx=i=c.e,l.dy=a=c.f,1==s&&1==u&&!o&&l.bbox?(l.bbox.x+=+i,l.bbox.y+=+a):l.dirtyT=1}),Dt=function(t){var e=t[0];switch(e.toLowerCase()){case"t":return[e,0,0];case"m":return[e,1,0,0,1,0,0];case"r":return 4==t.length?[e,0,t[2],t[3]]:[e,0];case"s":return 5==t.length?[e,1,1,t[3],t[4]]:3==t.length?[e,1,1]:[e,1]}},Ft=e._equaliseTransform=function(t,r){r=R(r).replace(/\.{3}|\u2026/g,t),t=e.parseTransformString(t)||[],r=e.parseTransformString(r)||[];for(var n,o,i,a,s=F(t.length,r.length),u=[],l=[],c=0;c<s;c++){if(i=t[c]||Dt(r[c]),a=r[c]||Dt(i),i[0]!=a[0]||"r"==i[0].toLowerCase()&&(i[2]!=a[2]||i[3]!=a[3])||"s"==i[0].toLowerCase()&&(i[3]!=a[3]||i[4]!=a[4]))return;for(u[c]=[],l[c]=[],n=0,o=F(i.length,a.length);n<o;n++)n in i&&(u[c][n]=i[n]),n in a&&(l[c][n]=a[n])}return{from:u,to:l}};e._getContainer=function(t,r,n,o){var i;if(null!=(i=null!=o||e.is(t,"object")?t:A.doc.getElementById(t)))return i.tagName?null==r?{container:i,width:i.style.pixelWidth||i.offsetWidth,height:i.style.pixelHeight||i.offsetHeight}:{container:i,width:r,height:n}:{container:1,x:t,y:r,width:n,height:o}},e.pathToRelative=jt,e._engine={},e.path2curve=Nt,e.matrix=function(t,e,r,n,o,i){return new p(t,e,r,n,o,i)},function(t){function r(t){return t[0]*t[0]+t[1]*t[1]}function n(t){var e=D.sqrt(r(t));t[0]&&(t[0]/=e),t[1]&&(t[1]/=e)}t.add=function(t,e,r,n,o,i){var a,s,u,l,c=[[],[],[]],f=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],d=[[t,r,o],[e,n,i],[0,0,1]];for(t&&t instanceof p&&(d=[[t.a,t.c,t.e],[t.b,t.d,t.f],[0,0,1]]),a=0;a<3;a++)for(s=0;s<3;s++){for(l=0,u=0;u<3;u++)l+=f[a][u]*d[u][s];c[a][s]=l}this.a=c[0][0],this.b=c[1][0],this.c=c[0][1],this.d=c[1][1],this.e=c[0][2],this.f=c[1][2]},t.invert=function(){var t=this,e=t.a*t.d-t.b*t.c;return new p(t.d/e,-t.b/e,-t.c/e,t.a/e,(t.c*t.f-t.d*t.e)/e,(t.b*t.e-t.a*t.f)/e)},t.clone=function(){return new p(this.a,this.b,this.c,this.d,this.e,this.f)},t.translate=function(t,e){this.add(1,0,0,1,t,e)},t.scale=function(t,e,r,n){null==e&&(e=t),(r||n)&&this.add(1,0,0,1,r,n),this.add(t,0,0,e,0,0),(r||n)&&this.add(1,0,0,1,-r,-n)},t.rotate=function(t,r,n){t=e.rad(t),r=r||0,n=n||0;var o=+D.cos(t).toFixed(9),i=+D.sin(t).toFixed(9);this.add(o,i,-i,o,r,n),this.add(1,0,0,1,-r,-n)},t.x=function(t,e){return t*this.a+e*this.c+this.e},t.y=function(t,e){return t*this.b+e*this.d+this.f},t.get=function(t){return+this[R.fromCharCode(97+t)].toFixed(4)},t.toString=function(){return e.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},t.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},t.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},t.split=function(){var t={};t.dx=this.e,t.dy=this.f;var o=[[this.a,this.c],[this.b,this.d]];t.scalex=D.sqrt(r(o[0])),n(o[0]),t.shear=o[0][0]*o[1][0]+o[0][1]*o[1][1],o[1]=[o[1][0]-o[0][0]*t.shear,o[1][1]-o[0][1]*t.shear],t.scaley=D.sqrt(r(o[1])),n(o[1]),t.shear/=t.scaley;var i=-o[0][1],a=o[1][1];return a<0?(t.rotate=e.deg(D.acos(a)),i<0&&(t.rotate=360-t.rotate)):t.rotate=e.deg(D.asin(i)),t.isSimple=!(+t.shear.toFixed(9)||t.scalex.toFixed(9)!=t.scaley.toFixed(9)&&t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t},t.toTransformString=function(t){var e=t||this[N]();return e.isSimple?(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[e.dx,e.dy]:k)+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:k)+(e.rotate?"r"+[e.rotate,0,0]:k)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(p.prototype);for(var Gt=function(){this.returnValue=!1},zt=function(){return this.originalEvent.preventDefault()},Ht=function(){this.cancelBubble=!0},Wt=function(){return this.originalEvent.stopPropagation()},Ut=function(t){var e=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,r=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;return{x:t.clientX+r,y:t.clientY+e}},Vt=function(){return A.doc.addEventListener?function(t,e,r,n){var o=function(t){var e=Ut(t);return r.call(n,t,e.x,e.y)};if(t.addEventListener(e,o,!1),C&&B[e]){var i=function(e){for(var o=Ut(e),i=e,a=0,s=e.targetTouches&&e.targetTouches.length;a<s;a++)if(e.targetTouches[a].target==t){e=e.targetTouches[a],e.originalEvent=i,e.preventDefault=zt,e.stopPropagation=Wt;break}return r.call(n,e,o.x,o.y)};t.addEventListener(B[e],i,!1)}return function(){return t.removeEventListener(e,o,!1),C&&B[e]&&t.removeEventListener(B[e],i,!1),!0}}:A.doc.attachEvent?function(t,e,r,n){var o=function(t){t=t||A.win.event;var e=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,o=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,i=t.clientX+o,a=t.clientY+e;return t.preventDefault=t.preventDefault||Gt,t.stopPropagation=t.stopPropagation||Ht,r.call(n,t,i,a)};return t.attachEvent("on"+e,o),function(){return t.detachEvent("on"+e,o),!0}}:void 0}(),qt=[],Kt=function(e){for(var r,n=e.clientX,o=e.clientY,i=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,a=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,s=qt.length;s--;){if(r=qt[s],C&&e.touches){for(var u,l=e.touches.length;l--;)if(u=e.touches[l],u.identifier==r.el._drag.id){n=u.clientX,o=u.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}else e.preventDefault();var c,f=r.el.node,d=f.nextSibling,p=f.parentNode,h=f.style.display;A.win.opera&&p.removeChild(f),f.style.display="none",c=r.el.paper.getElementByPoint(n,o),f.style.display=h,A.win.opera&&(d?p.insertBefore(f,d):p.appendChild(f)),c&&t("raphael.drag.over."+r.el.id,r.el,c),n+=a,o+=i,t("raphael.drag.move."+r.el.id,r.move_scope||r.el,n-r.el._drag.x,o-r.el._drag.y,n,o,e)}},Yt=function(r){
  e.unmousemove(Kt).unmouseup(Yt);for(var n,o=qt.length;o--;)n=qt[o],n.el._drag={},t("raphael.drag.end."+n.el.id,n.end_scope||n.start_scope||n.move_scope||n.el,r);qt=[]},$t=e.el={},Xt=I.length;Xt--;)!function(t){e[t]=$t[t]=function(r,n){return e.is(r,"function")&&(this.events=this.events||[],this.events.push({name:t,f:r,unbind:Vt(this.shape||this.node||A.doc,t,r,n||this)})),this},e["un"+t]=$t["un"+t]=function(r){for(var n=this.events||[],o=n.length;o--;)n[o].name!=t||!e.is(r,"undefined")&&n[o].f!=r||(n[o].unbind(),n.splice(o,1),!n.length&&delete this.events);return this}}(I[Xt]);$t.data=function(r,n){var o=lt[this.id]=lt[this.id]||{};if(0==arguments.length)return o;if(1==arguments.length){if(e.is(r,"object")){for(var i in r)r[O](i)&&this.data(i,r[i]);return this}return t("raphael.data.get."+this.id,this,o[r],r),o[r]}return o[r]=n,t("raphael.data.set."+this.id,this,n,r),this},$t.removeData=function(t){return null==t?lt[this.id]={}:lt[this.id]&&delete lt[this.id][t],this},$t.getData=function(){return r(lt[this.id]||{})},$t.hover=function(t,e,r,n){return this.mouseover(t,r).mouseout(e,n||r)},$t.unhover=function(t,e){return this.unmouseover(t).unmouseout(e)};var Zt=[];$t.drag=function(r,n,o,i,a,s){function u(u){(u.originalEvent||u).preventDefault();var l=u.clientX,c=u.clientY,f=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,d=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;if(this._drag.id=u.identifier,C&&u.touches)for(var p,h=u.touches.length;h--;)if(p=u.touches[h],this._drag.id=p.identifier,p.identifier==this._drag.id){l=p.clientX,c=p.clientY;break}this._drag.x=l+d,this._drag.y=c+f,!qt.length&&e.mousemove(Kt).mouseup(Yt),qt.push({el:this,move_scope:i,start_scope:a,end_scope:s}),n&&t.on("raphael.drag.start."+this.id,n),r&&t.on("raphael.drag.move."+this.id,r),o&&t.on("raphael.drag.end."+this.id,o),t("raphael.drag.start."+this.id,a||i||this,u.clientX+d,u.clientY+f,u)}return this._drag={},Zt.push({el:this,start:u}),this.mousedown(u),this},$t.onDragOver=function(e){e?t.on("raphael.drag.over."+this.id,e):t.unbind("raphael.drag.over."+this.id)},$t.undrag=function(){for(var r=Zt.length;r--;)Zt[r].el==this&&(this.unmousedown(Zt[r].start),Zt.splice(r,1),t.unbind("raphael.drag.*."+this.id));!Zt.length&&e.unmousemove(Kt).unmouseup(Yt),qt=[]},_.circle=function(t,r,n){var o=e._engine.circle(this,t||0,r||0,n||0);return this.__set__&&this.__set__.push(o),o},_.rect=function(t,r,n,o,i){var a=e._engine.rect(this,t||0,r||0,n||0,o||0,i||0);return this.__set__&&this.__set__.push(a),a},_.ellipse=function(t,r,n,o){var i=e._engine.ellipse(this,t||0,r||0,n||0,o||0);return this.__set__&&this.__set__.push(i),i},_.path=function(t){t&&!e.is(t,V)&&!e.is(t[0],q)&&(t+=k);var r=e._engine.path(e.format[P](e,arguments),this);return this.__set__&&this.__set__.push(r),r},_.image=function(t,r,n,o,i){var a=e._engine.image(this,t||"about:blank",r||0,n||0,o||0,i||0);return this.__set__&&this.__set__.push(a),a},_.text=function(t,r,n){var o=e._engine.text(this,t||0,r||0,R(n));return this.__set__&&this.__set__.push(o),o},_.set=function(t){!e.is(t,"array")&&(t=Array.prototype.splice.call(arguments,0,arguments.length));var r=new le(t);return this.__set__&&this.__set__.push(r),r.paper=this,r.type="set",r},_.setStart=function(t){this.__set__=t||this.set()},_.setFinish=function(t){var e=this.__set__;return delete this.__set__,e},_.getSize=function(){var t=this.canvas.parentNode;return{width:t.offsetWidth,height:t.offsetHeight}},_.setSize=function(t,r){return e._engine.setSize.call(this,t,r)},_.setViewBox=function(t,r,n,o,i){return e._engine.setViewBox.call(this,t,r,n,o,i)},_.top=_.bottom=null,_.raphael=e;var Qt=function(t){var e=t.getBoundingClientRect(),r=t.ownerDocument,n=r.body,o=r.documentElement,i=o.clientTop||n.clientTop||0,a=o.clientLeft||n.clientLeft||0;return{y:e.top+(A.win.pageYOffset||o.scrollTop||n.scrollTop)-i,x:e.left+(A.win.pageXOffset||o.scrollLeft||n.scrollLeft)-a}};_.getElementByPoint=function(t,e){var r=this,n=r.canvas,o=A.doc.elementFromPoint(t,e);if(A.win.opera&&"svg"==o.tagName){var i=Qt(n),a=n.createSVGRect();a.x=t-i.x,a.y=e-i.y,a.width=a.height=1;var s=n.getIntersectionList(a,null);s.length&&(o=s[s.length-1])}if(!o)return null;for(;o.parentNode&&o!=n.parentNode&&!o.raphael;)o=o.parentNode;return o==r.canvas.parentNode&&(o=n),o=o&&o.raphael?r.getById(o.raphaelid):null},_.getElementsByBBox=function(t){var r=this.set();return this.forEach(function(n){e.isBBoxIntersect(n.getBBox(),t)&&r.push(n)}),r},_.getById=function(t){for(var e=this.bottom;e;){if(e.id==t)return e;e=e.next}return null},_.forEach=function(t,e){for(var r=this.bottom;r;){if(!1===t.call(e,r))return this;r=r.next}return this},_.getElementsByPoint=function(t,e){var r=this.set();return this.forEach(function(n){n.isPointInside(t,e)&&r.push(n)}),r},$t.isPointInside=function(t,r){var n=this.realPath=ht[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(n=e.transformPath(n,this.attr("transform"))),e.isPointInsidePath(n,t,r)},$t.getBBox=function(t){if(this.removed)return{};var e=this._;return t?(!e.dirty&&e.bboxwt||(this.realPath=ht[this.type](this),e.bboxwt=At(this.realPath),e.bboxwt.toString=h,e.dirty=0),e.bboxwt):((e.dirty||e.dirtyT||!e.bbox)&&(!e.dirty&&this.realPath||(e.bboxwt=0,this.realPath=ht[this.type](this)),e.bbox=At(mt(this.realPath,this.matrix)),e.bbox.toString=h,e.dirty=e.dirtyT=0),e.bbox)},$t.clone=function(){if(this.removed)return null;var t=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(t),t},$t.glow=function(t){if("text"==this.type)return null;t=t||{};var e={width:(t.width||10)+(+this.attr("stroke-width")||1),fill:t.fill||!1,opacity:null==t.opacity?.5:t.opacity,offsetx:t.offsetx||0,offsety:t.offsety||0,color:t.color||"#000"},r=e.width/2,n=this.paper,o=n.set(),i=this.realPath||ht[this.type](this);i=this.matrix?mt(i,this.matrix):i;for(var a=1;a<r+1;a++)o.push(n.path(i).attr({stroke:e.color,fill:e.fill?e.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/r*a).toFixed(3),opacity:+(e.opacity/r).toFixed(3)}));return o.insertBefore(this).translate(e.offsetx,e.offsety)};var Jt=function(t,r,n,o,i,a,s,c,f){return null==f?u(t,r,n,o,i,a,s,c):e.findDotsAtSegment(t,r,n,o,i,a,s,c,l(t,r,n,o,i,a,s,c,f))},te=function(t,r){return function(n,o,i){n=Nt(n);for(var a,s,u,l,c,f="",d={},p=0,h=0,m=n.length;h<m;h++){if(u=n[h],"M"==u[0])a=+u[1],s=+u[2];else{if(l=Jt(a,s,u[1],u[2],u[3],u[4],u[5],u[6]),p+l>o){if(r&&!d.start){if(c=Jt(a,s,u[1],u[2],u[3],u[4],u[5],u[6],o-p),f+=["C"+c.start.x,c.start.y,c.m.x,c.m.y,c.x,c.y],i)return f;d.start=f,f=["M"+c.x,c.y+"C"+c.n.x,c.n.y,c.end.x,c.end.y,u[5],u[6]].join(),p+=l,a=+u[5],s=+u[6];continue}if(!t&&!r)return c=Jt(a,s,u[1],u[2],u[3],u[4],u[5],u[6],o-p),{x:c.x,y:c.y,alpha:c.alpha}}p+=l,a=+u[5],s=+u[6]}f+=u.shift()+u}return d.end=f,c=t?p:r?d:e.findDotsAtSegment(a,s,u[0],u[1],u[2],u[3],u[4],u[5],1),c.alpha&&(c={x:c.x,y:c.y,alpha:c.alpha}),c}},ee=te(1),re=te(),ne=te(0,1);e.getTotalLength=ee,e.getPointAtLength=re,e.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return ne(t,e).end;var n=ne(t,r,1);return e?ne(n,e).end:n},$t.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():ee(t)},$t.getPointAtLength=function(t){var e=this.getPath();if(e)return re(e,t)},$t.getPath=function(){var t,r=e._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(t=r(this)),t},$t.getSubpath=function(t,r){var n=this.getPath();if(n)return e.getSubpath(n,t,r)};var oe=e.easing_formulas={linear:function(t){return t},"<":function(t){return H(t,1.7)},">":function(t){return H(t,.48)},"<>":function(t){var e=.48-t/1.04,r=D.sqrt(.1734+e*e),n=r-e,o=H(z(n),1/3)*(n<0?-1:1),i=-r-e,a=H(z(i),1/3)*(i<0?-1:1),s=o+a+.5;return 3*(1-s)*s*s+s*s*s},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){t-=1;var e=1.70158;return t*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:H(2,-10*t)*D.sin(2*W*(t-.075)/.3)+1},bounce:function(t){var e,r=7.5625,n=2.75;return t<1/n?e=r*t*t:t<2/n?(t-=1.5/n,e=r*t*t+.75):t<2.5/n?(t-=2.25/n,e=r*t*t+.9375):(t-=2.625/n,e=r*t*t+.984375),e}};oe.easeIn=oe["ease-in"]=oe["<"],oe.easeOut=oe["ease-out"]=oe[">"],oe.easeInOut=oe["ease-in-out"]=oe["<>"],oe["back-in"]=oe.backIn,oe["back-out"]=oe.backOut;var ie=[],ae=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,16)},se=function(){for(var r=+new Date,n=0;n<ie.length;n++){var o=ie[n];if(!o.el.removed&&!o.paused){var i,a,s=r-o.start,u=o.ms,l=o.easing,c=o.from,f=o.diff,d=o.to,p=(o.t,o.el),h={},m={};if(o.initstatus?(s=(o.initstatus*o.anim.top-o.prev)/(o.percent-o.prev)*u,o.status=o.initstatus,delete o.initstatus,o.stop&&ie.splice(n--,1)):o.status=(o.prev+(o.percent-o.prev)*(s/u))/o.anim.top,!(s<0))if(s<u){var g=l(s/u);for(var b in c)if(c[O](b)){switch(rt[b]){case U:i=+c[b]+g*u*f[b];break;case"colour":i="rgb("+[ue(Z(c[b].r+g*u*f[b].r)),ue(Z(c[b].g+g*u*f[b].g)),ue(Z(c[b].b+g*u*f[b].b))].join(",")+")";break;case"path":i=[];for(var y=0,_=c[b].length;y<_;y++){i[y]=[c[b][y][0]];for(var x=1,w=c[b][y].length;x<w;x++)i[y][x]=+c[b][y][x]+g*u*f[b][y][x];i[y]=i[y].join(M)}i=i.join(M);break;case"transform":if(f[b].real)for(i=[],y=0,_=c[b].length;y<_;y++)for(i[y]=[c[b][y][0]],x=1,w=c[b][y].length;x<w;x++)i[y][x]=c[b][y][x]+g*u*f[b][y][x];else{var S=function(t){return+c[b][t]+g*u*f[b][t]};i=[["m",S(0),S(1),S(2),S(3),S(4),S(5)]]}break;case"csv":if("clip-rect"==b)for(i=[],y=4;y--;)i[y]=+c[b][y]+g*u*f[b][y];break;default:var A=[][T](c[b]);for(i=[],y=p.paper.customAttributes[b].length;y--;)i[y]=+A[y]+g*u*f[b][y]}h[b]=i}p.attr(h),function(e,r,n){setTimeout(function(){t("raphael.anim.frame."+e,r,n)})}(p.id,p,o.anim)}else{if(function(r,n,o){setTimeout(function(){t("raphael.anim.frame."+n.id,n,o),t("raphael.anim.finish."+n.id,n,o),e.is(r,"function")&&r.call(n)})}(o.callback,p,o.anim),p.attr(d),ie.splice(n--,1),o.repeat>1&&!o.next){for(a in d)d[O](a)&&(m[a]=o.totalOrigin[a]);o.el.attr(m),v(o.anim,o.el,o.anim.percents[0],null,o.totalOrigin,o.repeat-1)}o.next&&!o.stop&&v(o.anim,o.el,o.next,null,o.totalOrigin,o.repeat)}}}ie.length&&ae(se)},ue=function(t){return t>255?255:t<0?0:t};$t.animateWith=function(t,r,n,o,i,a){var s=this;if(s.removed)return a&&a.call(s),s;var u=n instanceof g?n:e.animation(n,o,i,a);v(u,s,u.percents[0],null,s.attr());for(var l=0,c=ie.length;l<c;l++)if(ie[l].anim==r&&ie[l].el==t){ie[c-1].start=ie[l].start;break}return s},$t.onAnimation=function(e){return e?t.on("raphael.anim.frame."+this.id,e):t.unbind("raphael.anim.frame."+this.id),this},g.prototype.delay=function(t){var e=new g(this.anim,this.ms);return e.times=this.times,e.del=+t||0,e},g.prototype.repeat=function(t){var e=new g(this.anim,this.ms);return e.del=this.del,e.times=D.floor(F(t,0))||1,e},e.animation=function(t,r,n,o){if(t instanceof g)return t;!e.is(n,"function")&&n||(o=o||n||null,n=null),t=Object(t),r=+r||0;var i,a,s={};for(a in t)t[O](a)&&Q(a)!=a&&Q(a)+"%"!=a&&(i=!0,s[a]=t[a]);if(i)return n&&(s.easing=n),o&&(s.callback=o),new g({100:s},r);if(o){var u=0;for(var l in t){var c=J(l);t[O](l)&&c>u&&(u=c)}u+="%",!t[u].callback&&(t[u].callback=o)}return new g(t,r)},$t.animate=function(t,r,n,o){var i=this;if(i.removed)return o&&o.call(i),i;var a=t instanceof g?t:e.animation(t,r,n,o);return v(a,i,a.percents[0],null,i.attr()),i},$t.setTime=function(t,e){return t&&null!=e&&this.status(t,G(e,t.ms)/t.ms),this},$t.status=function(t,e){var r,n,o=[],i=0;if(null!=e)return v(t,this,-1,G(e,1)),this;for(r=ie.length;i<r;i++)if(n=ie[i],n.el.id==this.id&&(!t||n.anim==t)){if(t)return n.status;o.push({anim:n.anim,status:n.status})}return t?0:o},$t.pause=function(e){for(var r=0;r<ie.length;r++)ie[r].el.id!=this.id||e&&ie[r].anim!=e||!1!==t("raphael.anim.pause."+this.id,this,ie[r].anim)&&(ie[r].paused=!0);return this},$t.resume=function(e){for(var r=0;r<ie.length;r++)if(ie[r].el.id==this.id&&(!e||ie[r].anim==e)){var n=ie[r];!1!==t("raphael.anim.resume."+this.id,this,n.anim)&&(delete n.paused,this.status(n.anim,n.status))}return this},$t.stop=function(e){for(var r=0;r<ie.length;r++)ie[r].el.id!=this.id||e&&ie[r].anim!=e||!1!==t("raphael.anim.stop."+this.id,this,ie[r].anim)&&ie.splice(r--,1);return this},t.on("raphael.remove",b),t.on("raphael.clear",b),$t.toString=function(){return"Raphaël’s object"};var le=function(t){if(this.items=[],this.length=0,this.type="set",t)for(var e=0,r=t.length;e<r;e++)!t[e]||t[e].constructor!=$t.constructor&&t[e].constructor!=le||(this[this.items.length]=this.items[this.items.length]=t[e],this.length++)},ce=le.prototype;ce.push=function(){for(var t,e,r=0,n=arguments.length;r<n;r++)!(t=arguments[r])||t.constructor!=$t.constructor&&t.constructor!=le||(e=this.items.length,this[e]=this.items[e]=t,this.length++);return this},ce.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},ce.forEach=function(t,e){for(var r=0,n=this.items.length;r<n;r++)if(!1===t.call(e,this.items[r],r))return this;return this};for(var fe in $t)$t[O](fe)&&(ce[fe]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t][P](r,e)})}}(fe));return ce.attr=function(t,r){if(t&&e.is(t,q)&&e.is(t[0],"object"))for(var n=0,o=t.length;n<o;n++)this.items[n].attr(t[n]);else for(var i=0,a=this.items.length;i<a;i++)this.items[i].attr(t,r);return this},ce.clear=function(){for(;this.length;)this.pop()},ce.splice=function(t,e,r){t=t<0?F(this.length+t,0):t,e=F(0,G(this.length-t,e));var n,o=[],i=[],a=[];for(n=2;n<arguments.length;n++)a.push(arguments[n]);for(n=0;n<e;n++)i.push(this[t+n]);for(;n<this.length-t;n++)o.push(this[t+n]);var s=a.length;for(n=0;n<s+o.length;n++)this.items[t+n]=this[t+n]=n<s?a[n]:o[n-s];for(n=this.items.length=this.length-=e-s;this[n];)delete this[n++];return new le(i)},ce.exclude=function(t){for(var e=0,r=this.length;e<r;e++)if(this[e]==t)return this.splice(e,1),!0},ce.animate=function(t,r,n,o){(e.is(n,"function")||!n)&&(o=n||null);var i,a,s=this.items.length,u=s,l=this;if(!s)return this;o&&(a=function(){!--s&&o.call(l)}),n=e.is(n,V)?n:a;var c=e.animation(t,r,n,a);for(i=this.items[--u].animate(c);u--;)this.items[u]&&!this.items[u].removed&&this.items[u].animateWith(i,c,c),this.items[u]&&!this.items[u].removed||s--;return this},ce.insertAfter=function(t){for(var e=this.items.length;e--;)this.items[e].insertAfter(t);return this},ce.getBBox=function(){for(var t=[],e=[],r=[],n=[],o=this.items.length;o--;)if(!this.items[o].removed){var i=this.items[o].getBBox();t.push(i.x),e.push(i.y),r.push(i.x+i.width),n.push(i.y+i.height)}return t=G[P](0,t),e=G[P](0,e),r=F[P](0,r),n=F[P](0,n),{x:t,y:e,x2:r,y2:n,width:r-t,height:n-e}},ce.clone=function(t){t=this.paper.set();for(var e=0,r=this.items.length;e<r;e++)t.push(this.items[e].clone());return t},ce.toString=function(){return"Raphaël‘s set"},ce.glow=function(t){var e=this.paper.set();return this.forEach(function(r,n){var o=r.glow(t);null!=o&&o.forEach(function(t,r){e.push(t)})}),e},ce.isPointInside=function(t,e){var r=!1;return this.forEach(function(n){if(n.isPointInside(t,e))return r=!0,!1}),r},e.registerFont=function(t){if(!t.face)return t;this.fonts=this.fonts||{};var e={w:t.w,face:{},glyphs:{}},r=t.face["font-family"];for(var n in t.face)t.face[O](n)&&(e.face[n]=t.face[n]);if(this.fonts[r]?this.fonts[r].push(e):this.fonts[r]=[e],!t.svg){e.face["units-per-em"]=J(t.face["units-per-em"],10);for(var o in t.glyphs)if(t.glyphs[O](o)){var i=t.glyphs[o];if(e.glyphs[o]={w:i.w,k:{},d:i.d&&"M"+i.d.replace(/[mlcxtrv]/g,function(t){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[t]||"M"})+"z"},i.k)for(var a in i.k)i[O](a)&&(e.glyphs[o].k[a]=i.k[a])}}return t},_.getFont=function(t,r,n,o){if(o=o||"normal",n=n||"normal",r=+r||{normal:400,bold:700,lighter:300,bolder:800}[r]||400,e.fonts){var i=e.fonts[t];if(!i){var a=new RegExp("(^|\\s)"+t.replace(/[^\w\d\s+!~.:_-]/g,k)+"(\\s|$)","i");for(var s in e.fonts)if(e.fonts[O](s)&&a.test(s)){i=e.fonts[s];break}}var u;if(i)for(var l=0,c=i.length;l<c&&(u=i[l],u.face["font-weight"]!=r||u.face["font-style"]!=n&&u.face["font-style"]||u.face["font-stretch"]!=o);l++);return u}},_.print=function(t,r,n,o,i,a,s,u){a=a||"middle",s=F(G(s||0,1),-1),u=F(G(u||1,3),1);var l,c=R(n)[N](k),f=0,d=0,p=k;if(e.is(o,"string")&&(o=this.getFont(o)),o){l=(i||16)/o.face["units-per-em"];for(var h=o.face.bbox[N](x),m=+h[0],g=h[3]-h[1],v=0,b=+h[1]+("baseline"==a?g+ +o.face.descent:g/2),y=0,_=c.length;y<_;y++){if("\n"==c[y])f=0,S=0,d=0,v+=g*u;else{var w=d&&o.glyphs[c[y-1]]||{},S=o.glyphs[c[y]];f+=d?(w.w||o.w)+(w.k&&w.k[c[y]]||0)+o.w*s:0,d=1}S&&S.d&&(p+=e.transformPath(S.d,["t",f*l,v*l,"s",l,l,m,b,"t",(t-m)/l,(r-b)/l]))}}return this.path(p).attr({fill:"#000",stroke:"none"})},_.add=function(t){if(e.is(t,"array"))for(var r,n=this.set(),o=0,i=t.length;o<i;o++)r=t[o]||{},w[O](r.type)&&n.push(this[r.type]().attr(r));return n},e.format=function(t,r){var n=e.is(r,q)?[0][T](r):arguments;return t&&e.is(t,V)&&n.length-1&&(t=t.replace(S,function(t,e){return null==n[++e]?k:n[e]})),t||k},e.fullfill=function(){var t=/\{([^\}]+)\}/g,e=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,r=function(t,r,n){var o=n;return r.replace(e,function(t,e,r,n,i){e=e||n,o&&(e in o&&(o=o[e]),"function"==typeof o&&i&&(o=o()))}),o=(null==o||o==n?t:o)+""};return function(e,n){return String(e).replace(t,function(t,e){return r(t,e,n)})}}(),e.ninja=function(){if(E.was)A.win.Raphael=E.is;else{window.Raphael=void 0;try{delete window.Raphael}catch(t){}}return e},e.st=ce,t.on("raphael.DOMload",function(){y=!0}),function(t,r,n){function o(){/in/.test(t.readyState)?setTimeout(o,9):e.eve("raphael.DOMload")}null==t.readyState&&t.addEventListener&&(t.addEventListener(r,n=function(){t.removeEventListener(r,n,!1),t.readyState="complete"},!1),t.readyState="loading"),o()}(document,"DOMContentLoaded"),e}.apply(e,n))&&(t.exports=o)},function(t,e,r){var n,o;!function(r){var i,a,s="0.5.0",u="hasOwnProperty",l=/[\.\/]/,c=/\s*,\s*/,f=function(t,e){return t-e},d={n:{}},p=function(){for(var t=0,e=this.length;t<e;t++)if(void 0!==this[t])return this[t]},h=function(){for(var t=this.length;--t;)if(void 0!==this[t])return this[t]},m=Object.prototype.toString,g=String,v=Array.isArray||function(t){return t instanceof Array||"[object Array]"==m.call(t)};eve=function(t,e){var r,n=a,o=Array.prototype.slice.call(arguments,2),s=eve.listeners(t),u=0,l=[],c={},d=[],m=i;d.firstDefined=p,d.lastDefined=h,i=t,a=0;for(var g=0,v=s.length;g<v;g++)"zIndex"in s[g]&&(l.push(s[g].zIndex),s[g].zIndex<0&&(c[s[g].zIndex]=s[g]));for(l.sort(f);l[u]<0;)if(r=c[l[u++]],d.push(r.apply(e,o)),a)return a=n,d;for(g=0;g<v;g++)if("zIndex"in(r=s[g]))if(r.zIndex==l[u]){if(d.push(r.apply(e,o)),a)break;do{if(u++,r=c[l[u]],r&&d.push(r.apply(e,o)),a)break}while(r)}else c[r.zIndex]=r;else if(d.push(r.apply(e,o)),a)break;return a=n,i=m,d},eve._events=d,eve.listeners=function(t){var e,r,n,o,i,a,s,u,c=v(t)?t:t.split(l),f=d,p=[f],h=[];for(o=0,i=c.length;o<i;o++){for(u=[],a=0,s=p.length;a<s;a++)for(f=p[a].n,r=[f[c[o]],f["*"]],n=2;n--;)(e=r[n])&&(u.push(e),h=h.concat(e.f||[]));p=u}return h},eve.separator=function(t){t?(t=g(t).replace(/(?=[\.\^\]\[\-])/g,"\\"),t="["+t+"]",l=new RegExp(t)):l=/[\.\/]/},eve.on=function(t,e){if("function"!=typeof e)return function(){};for(var r=v(t)?v(t[0])?t:[t]:g(t).split(c),n=0,o=r.length;n<o;n++)!function(t){for(var r,n=v(t)?t:g(t).split(l),o=d,i=0,a=n.length;i<a;i++)o=o.n,o=o.hasOwnProperty(n[i])&&o[n[i]]||(o[n[i]]={n:{}});for(o.f=o.f||[],i=0,a=o.f.length;i<a;i++)if(o.f[i]==e){r=!0;break}!r&&o.f.push(e)}(r[n]);return function(t){+t==+t&&(e.zIndex=+t)}},eve.f=function(t){var e=[].slice.call(arguments,1);return function(){eve.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},eve.stop=function(){a=1},eve.nt=function(t){var e=v(i)?i.join("."):i;return t?new RegExp("(?:\\.|\\/|^)"+t+"(?:\\.|\\/|$)").test(e):e},eve.nts=function(){return v(i)?i:i.split(l)},eve.off=eve.unbind=function(t,e){if(!t)return void(eve._events=d={n:{}});var r=v(t)?v(t[0])?t:[t]:g(t).split(c);if(r.length>1)for(var n=0,o=r.length;n<o;n++)eve.off(r[n],e);else{r=v(t)?t:g(t).split(l);var i,a,s,n,o,f,p,h=[d];for(n=0,o=r.length;n<o;n++)for(f=0;f<h.length;f+=s.length-2){if(s=[f,1],i=h[f].n,"*"!=r[n])i[r[n]]&&s.push(i[r[n]]);else for(a in i)i[u](a)&&s.push(i[a]);h.splice.apply(h,s)}for(n=0,o=h.length;n<o;n++)for(i=h[n];i.n;){if(e){if(i.f){for(f=0,p=i.f.length;f<p;f++)if(i.f[f]==e){i.f.splice(f,1);break}!i.f.length&&delete i.f}for(a in i.n)if(i.n[u](a)&&i.n[a].f){var m=i.n[a].f;for(f=0,p=m.length;f<p;f++)if(m[f]==e){m.splice(f,1);break}!m.length&&delete i.n[a].f}}else{delete i.f;for(a in i.n)i.n[u](a)&&i.n[a].f&&delete i.n[a].f}i=i.n}}},eve.once=function(t,e){var r=function(){return eve.off(t,r),e.apply(this,arguments)};return eve.on(t,r)},eve.version=s,eve.toString=function(){return"You are running Eve "+s},void 0!==t&&t.exports?t.exports=eve:(n=[],void 0!==(o=function(){return eve}.apply(e,n))&&(t.exports=o))}()},function(t,e,r){var n,o;n=[r(1)],void 0!==(o=function(t){if(!t||t.svg){var e="hasOwnProperty",r=String,n=parseFloat,o=parseInt,i=Math,a=i.max,s=i.abs,u=i.pow,l=/[, ]+/,c=t.eve,f="",d=" ",p="http://www.w3.org/1999/xlink",h={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},m={};t.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var g=function(n,o){if(o){"string"==typeof n&&(n=g(n));for(var i in o)o[e](i)&&("xlink:"==i.substring(0,6)?n.setAttributeNS(p,i.substring(6),r(o[i])):n.setAttribute(i,r(o[i])))}else n=t._g.doc.createElementNS("http://www.w3.org/2000/svg",n),n.style&&(n.style.webkitTapHighlightColor="rgba(0,0,0,0)");return n},v=function(e,o){var l="linear",c=e.id+o,d=.5,p=.5,h=e.node,m=e.paper,v=h.style,b=t._g.doc.getElementById(c);if(!b){if(o=r(o).replace(t._radial_gradient,function(t,e,r){if(l="radial",e&&r){d=n(e),p=n(r);var o=2*(p>.5)-1;u(d-.5,2)+u(p-.5,2)>.25&&(p=i.sqrt(.25-u(d-.5,2))*o+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*o)}return f}),o=o.split(/\s*\-\s*/),"linear"==l){var _=o.shift();if(_=-n(_),isNaN(_))return null;var x=[0,0,i.cos(t.rad(_)),i.sin(t.rad(_))],w=1/(a(s(x[2]),s(x[3]))||1);x[2]*=w,x[3]*=w,x[2]<0&&(x[0]=-x[2],x[2]=0),x[3]<0&&(x[1]=-x[3],x[3]=0)}var S=t._parseDots(o);if(!S)return null;if(c=c.replace(/[\(\)\s,\xb0#]/g,"_"),e.gradient&&c!=e.gradient.id&&(m.defs.removeChild(e.gradient),delete e.gradient),!e.gradient){b=g(l+"Gradient",{id:c}),e.gradient=b,g(b,"radial"==l?{fx:d,fy:p}:{x1:x[0],y1:x[1],x2:x[2],y2:x[3],gradientTransform:e.matrix.invert()}),m.defs.appendChild(b);for(var O=0,A=S.length;O<A;O++)b.appendChild(g("stop",{offset:S[O].offset?S[O].offset:O?"100%":"0%","stop-color":S[O].color||"#fff","stop-opacity":isFinite(S[O].opacity)?S[O].opacity:1}))}}return g(h,{fill:y(c),opacity:1,"fill-opacity":1}),v.fill=f,v.opacity=1,v.fillOpacity=1,1},b=function(){var t=document.documentMode;return t&&(9===t||10===t)},y=function(t){if(b())return"url('#"+t+"')";var e=document.location;return"url('"+e.protocol+"//"+e.host+e.pathname+e.search+"#"+t+"')"},_=function(t){var e=t.getBBox(1);g(t.pattern,{patternTransform:t.matrix.invert()+" translate("+e.x+","+e.y+")"})},x=function(n,o,i){if("path"==n.type){for(var a,s,u,l,c,d=r(o).toLowerCase().split("-"),p=n.paper,v=i?"end":"start",b=n.node,y=n.attrs,_=y["stroke-width"],x=d.length,w="classic",S=3,O=3,A=5;x--;)switch(d[x]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=d[x];break;case"wide":O=5;break;case"narrow":O=2;break;case"long":S=5;break;case"short":S=2}if("open"==w?(S+=2,O+=2,A+=2,u=1,l=i?4:1,c={fill:"none",stroke:y.stroke}):(l=u=S/2,c={fill:y.stroke,stroke:"none"}),n._.arrows?i?(n._.arrows.endPath&&m[n._.arrows.endPath]--,n._.arrows.endMarker&&m[n._.arrows.endMarker]--):(n._.arrows.startPath&&m[n._.arrows.startPath]--,n._.arrows.startMarker&&m[n._.arrows.startMarker]--):n._.arrows={},"none"!=w){var E="raphael-marker-"+w,j="raphael-marker-"+v+w+S+O+"-obj"+n.id;t._g.doc.getElementById(E)?m[E]++:(p.defs.appendChild(g(g("path"),{"stroke-linecap":"round",d:h[w],id:E})),m[E]=1);var P,T=t._g.doc.getElementById(j);T?(m[j]++,P=T.getElementsByTagName("use")[0]):(T=g(g("marker"),{id:j,markerHeight:O,markerWidth:S,orient:"auto",refX:l,refY:O/2}),P=g(g("use"),{"xlink:href":"#"+E,transform:(i?"rotate(180 "+S/2+" "+O/2+") ":f)+"scale("+S/A+","+O/A+")","stroke-width":(1/((S/A+O/A)/2)).toFixed(4)}),T.appendChild(P),p.defs.appendChild(T),m[j]=1),g(P,c);var C=u*("diamond"!=w&&"oval"!=w);i?(a=n._.arrows.startdx*_||0,s=t.getTotalLength(y.path)-C*_):(a=C*_,s=t.getTotalLength(y.path)-(n._.arrows.enddx*_||0)),c={},c["marker-"+v]="url(#"+j+")",(s||a)&&(c.d=t.getSubpath(y.path,a,s)),g(b,c),n._.arrows[v+"Path"]=E,n._.arrows[v+"Marker"]=j,n._.arrows[v+"dx"]=C,n._.arrows[v+"Type"]=w,n._.arrows[v+"String"]=o}else i?(a=n._.arrows.startdx*_||0,s=t.getTotalLength(y.path)-a):(a=0,s=t.getTotalLength(y.path)-(n._.arrows.enddx*_||0)),n._.arrows[v+"Path"]&&g(b,{d:t.getSubpath(y.path,a,s)}),delete n._.arrows[v+"Path"],delete n._.arrows[v+"Marker"],delete n._.arrows[v+"dx"],delete n._.arrows[v+"Type"],delete n._.arrows[v+"String"];for(c in m)if(m[e](c)&&!m[c]){var k=t._g.doc.getElementById(c);k&&k.parentNode.removeChild(k)}}},w={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},S=function(t,e,n){if(e=w[r(e).toLowerCase()]){for(var o=t.attrs["stroke-width"]||"1",i={round:o,square:o,butt:0}[t.attrs["stroke-linecap"]||n["stroke-linecap"]]||0,a=[],s=e.length;s--;)a[s]=e[s]*o+(s%2?1:-1)*i;g(t.node,{"stroke-dasharray":a.join(",")})}else g(t.node,{"stroke-dasharray":"none"})},O=function(n,i){var u=n.node,c=n.attrs,d=u.style.visibility;u.style.visibility="hidden";for(var h in i)if(i[e](h)){if(!t._availableAttrs[e](h))continue;var m=i[h];switch(c[h]=m,h){case"blur":n.blur(m);break;case"title":var b=u.getElementsByTagName("title");if(b.length&&(b=b[0]))b.firstChild.nodeValue=m;else{b=g("title");var y=t._g.doc.createTextNode(m);b.appendChild(y),u.appendChild(b)}break;case"href":case"target":var w=u.parentNode;if("a"!=w.tagName.toLowerCase()){var O=g("a");w.insertBefore(O,u),O.appendChild(u),w=O}"target"==h?w.setAttributeNS(p,"show","blank"==m?"new":m):w.setAttributeNS(p,h,m);break;case"cursor":u.style.cursor=m;break;case"transform":n.transform(m);break;case"arrow-start":x(n,m);break;case"arrow-end":x(n,m,1);break;case"clip-rect":var E=r(m).split(l);if(4==E.length){n.clip&&n.clip.parentNode.parentNode.removeChild(n.clip.parentNode);var j=g("clipPath"),P=g("rect");j.id=t.createUUID(),g(P,{x:E[0],y:E[1],width:E[2],height:E[3]}),j.appendChild(P),n.paper.defs.appendChild(j),g(u,{"clip-path":"url(#"+j.id+")"}),n.clip=P}if(!m){var T=u.getAttribute("clip-path");if(T){var C=t._g.doc.getElementById(T.replace(/(^url\(#|\)$)/g,f));C&&C.parentNode.removeChild(C),g(u,{"clip-path":f}),delete n.clip}}break;case"path":"path"==n.type&&(g(u,{d:m?c.path=t._pathToAbsolute(m):"M0,0"}),n._.dirty=1,n._.arrows&&("startString"in n._.arrows&&x(n,n._.arrows.startString),"endString"in n._.arrows&&x(n,n._.arrows.endString,1)));break;case"width":if(u.setAttribute(h,m),n._.dirty=1,!c.fx)break;h="x",m=c.x;case"x":c.fx&&(m=-c.x-(c.width||0));case"rx":if("rx"==h&&"rect"==n.type)break;case"cx":u.setAttribute(h,m),n.pattern&&_(n),n._.dirty=1;break;case"height":if(u.setAttribute(h,m),n._.dirty=1,!c.fy)break;h="y",m=c.y;case"y":c.fy&&(m=-c.y-(c.height||0));case"ry":if("ry"==h&&"rect"==n.type)break;case"cy":u.setAttribute(h,m),n.pattern&&_(n),n._.dirty=1;break;case"r":"rect"==n.type?g(u,{rx:m,ry:m}):u.setAttribute(h,m),n._.dirty=1;break;case"src":"image"==n.type&&u.setAttributeNS(p,"href",m);break;case"stroke-width":1==n._.sx&&1==n._.sy||(m/=a(s(n._.sx),s(n._.sy))||1),u.setAttribute(h,m),c["stroke-dasharray"]&&S(n,c["stroke-dasharray"],i),n._.arrows&&("startString"in n._.arrows&&x(n,n._.arrows.startString),"endString"in n._.arrows&&x(n,n._.arrows.endString,1));break;case"stroke-dasharray":S(n,m,i);break;case"fill":var k=r(m).match(t._ISURL);if(k){j=g("pattern");var M=g("image");j.id=t.createUUID(),g(j,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),g(M,{x:0,y:0,"xlink:href":k[1]}),j.appendChild(M),function(e){t._preload(k[1],function(){var t=this.offsetWidth,r=this.offsetHeight;g(e,{width:t,height:r}),g(M,{width:t,height:r})})}(j),n.paper.defs.appendChild(j),g(u,{fill:"url(#"+j.id+")"}),n.pattern=j,n.pattern&&_(n);break}var R=t.getRGB(m);if(R.error){if(("circle"==n.type||"ellipse"==n.type||"r"!=r(m).charAt())&&v(n,m)){if("opacity"in c||"fill-opacity"in c){var N=t._g.doc.getElementById(u.getAttribute("fill").replace(/^url\(#|\)$/g,f));if(N){var I=N.getElementsByTagName("stop");g(I[I.length-1],{"stop-opacity":("opacity"in c?c.opacity:1)*("fill-opacity"in c?c["fill-opacity"]:1)})}}c.gradient=m,c.fill="none";break}}else delete i.gradient,delete c.gradient,!t.is(c.opacity,"undefined")&&t.is(i.opacity,"undefined")&&g(u,{opacity:c.opacity}),!t.is(c["fill-opacity"],"undefined")&&t.is(i["fill-opacity"],"undefined")&&g(u,{"fill-opacity":c["fill-opacity"]});R[e]("opacity")&&g(u,{"fill-opacity":R.opacity>1?R.opacity/100:R.opacity});case"stroke":R=t.getRGB(m),u.setAttribute(h,R.hex),"stroke"==h&&R[e]("opacity")&&g(u,{"stroke-opacity":R.opacity>1?R.opacity/100:R.opacity}),"stroke"==h&&n._.arrows&&("startString"in n._.arrows&&x(n,n._.arrows.startString),"endString"in n._.arrows&&x(n,n._.arrows.endString,1));break;case"gradient":("circle"==n.type||"ellipse"==n.type||"r"!=r(m).charAt())&&v(n,m);break;case"opacity":c.gradient&&!c[e]("stroke-opacity")&&g(u,{"stroke-opacity":m>1?m/100:m});case"fill-opacity":if(c.gradient){(N=t._g.doc.getElementById(u.getAttribute("fill").replace(/^url\(#|\)$/g,f)))&&(I=N.getElementsByTagName("stop"),g(I[I.length-1],{"stop-opacity":m}));break}default:"font-size"==h&&(m=o(m,10)+"px");var B=h.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});u.style[B]=m,n._.dirty=1,u.setAttribute(h,m)}}A(n,i),u.style.visibility=d},A=function(n,i){if("text"==n.type&&(i[e]("text")||i[e]("font")||i[e]("font-size")||i[e]("x")||i[e]("y"))){var a=n.attrs,s=n.node,u=s.firstChild?o(t._g.doc.defaultView.getComputedStyle(s.firstChild,f).getPropertyValue("font-size"),10):10;if(i[e]("text")){for(a.text=i.text;s.firstChild;)s.removeChild(s.firstChild);for(var l,c=r(i.text).split("\n"),d=[],p=0,h=c.length;p<h;p++)l=g("tspan"),p&&g(l,{dy:1.2*u,x:a.x}),l.appendChild(t._g.doc.createTextNode(c[p])),s.appendChild(l),d[p]=l}else for(d=s.getElementsByTagName("tspan"),p=0,h=d.length;p<h;p++)p?g(d[p],{dy:1.2*u,x:a.x}):g(d[0],{dy:0});g(s,{x:a.x,y:a.y}),n._.dirty=1;var m=n._getBBox(),v=a.y-(m.y+m.height/2);v&&t.is(v,"finite")&&g(d[0],{dy:v})}},E=function(t){return t.parentNode&&"a"===t.parentNode.tagName.toLowerCase()?t.parentNode:t},j=function(e,r){this[0]=this.node=e,e.raphael=!0,this.id=function(){return("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5)}(),e.raphaelid=this.id,this.matrix=t.matrix(),this.realPath=null,this.paper=r,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},P=t.el;j.prototype=P,P.constructor=j,t._engine.path=function(t,e){var r=g("path");e.canvas&&e.canvas.appendChild(r);var n=new j(r,e);return n.type="path",O(n,{fill:"none",stroke:"#000",path:t}),n},P.rotate=function(t,e,o){if(this.removed)return this;if(t=r(t).split(l),t.length-1&&(e=n(t[1]),o=n(t[2])),t=n(t[0]),null==o&&(e=o),null==e||null==o){var i=this.getBBox(1);e=i.x+i.width/2,o=i.y+i.height/2}return this.transform(this._.transform.concat([["r",t,e,o]])),this},P.scale=function(t,e,o,i){if(this.removed)return this;if(t=r(t).split(l),t.length-1&&(e=n(t[1]),o=n(t[2]),i=n(t[3])),t=n(t[0]),null==e&&(e=t),null==i&&(o=i),null==o||null==i)var a=this.getBBox(1);return o=null==o?a.x+a.width/2:o,i=null==i?a.y+a.height/2:i,
  this.transform(this._.transform.concat([["s",t,e,o,i]])),this},P.translate=function(t,e){return this.removed?this:(t=r(t).split(l),t.length-1&&(e=n(t[1])),t=n(t[0])||0,e=+e||0,this.transform(this._.transform.concat([["t",t,e]])),this)},P.transform=function(r){var n=this._;if(null==r)return n.transform;if(t._extractTransform(this,r),this.clip&&g(this.clip,{transform:this.matrix.invert()}),this.pattern&&_(this),this.node&&g(this.node,{transform:this.matrix}),1!=n.sx||1!=n.sy){var o=this.attrs[e]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":o})}return this},P.hide=function(){return this.removed||(this.node.style.display="none"),this},P.show=function(){return this.removed||(this.node.style.display=""),this},P.remove=function(){var e=E(this.node);if(!this.removed&&e.parentNode){var r=this.paper;r.__set__&&r.__set__.exclude(this),c.unbind("raphael.*.*."+this.id),this.gradient&&r.defs.removeChild(this.gradient),t._tear(this,r),e.parentNode.removeChild(e),this.removeData();for(var n in this)this[n]="function"==typeof this[n]?t._removedFactory(n):null;this.removed=!0}},P._getBBox=function(){if("none"==this.node.style.display){this.show();var t=!0}var e,r=!1;this.paper.canvas.parentElement?e=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(e=this.paper.canvas.parentNode.style),e&&"none"==e.display&&(r=!0,e.display="");var n={};try{n=this.node.getBBox()}catch(t){n={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{n=n||{},r&&(e.display="none")}return t&&this.hide(),n},P.attr=function(r,n){if(this.removed)return this;if(null==r){var o={};for(var i in this.attrs)this.attrs[e](i)&&(o[i]=this.attrs[i]);return o.gradient&&"none"==o.fill&&(o.fill=o.gradient)&&delete o.gradient,o.transform=this._.transform,o}if(null==n&&t.is(r,"string")){if("fill"==r&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==r)return this._.transform;for(var a=r.split(l),s={},u=0,f=a.length;u<f;u++)r=a[u],r in this.attrs?s[r]=this.attrs[r]:t.is(this.paper.customAttributes[r],"function")?s[r]=this.paper.customAttributes[r].def:s[r]=t._availableAttrs[r];return f-1?s:s[a[0]]}if(null==n&&t.is(r,"array")){for(s={},u=0,f=r.length;u<f;u++)s[r[u]]=this.attr(r[u]);return s}if(null!=n){var d={};d[r]=n}else null!=r&&t.is(r,"object")&&(d=r);for(var p in d)c("raphael.attr."+p+"."+this.id,this,d[p]);for(p in this.paper.customAttributes)if(this.paper.customAttributes[e](p)&&d[e](p)&&t.is(this.paper.customAttributes[p],"function")){var h=this.paper.customAttributes[p].apply(this,[].concat(d[p]));this.attrs[p]=d[p];for(var m in h)h[e](m)&&(d[m]=h[m])}return O(this,d),this},P.toFront=function(){if(this.removed)return this;var e=E(this.node);e.parentNode.appendChild(e);var r=this.paper;return r.top!=this&&t._tofront(this,r),this},P.toBack=function(){if(this.removed)return this;var e=E(this.node),r=e.parentNode;r.insertBefore(e,r.firstChild),t._toback(this,this.paper);this.paper;return this},P.insertAfter=function(e){if(this.removed||!e)return this;var r=E(this.node),n=E(e.node||e[e.length-1].node);return n.nextSibling?n.parentNode.insertBefore(r,n.nextSibling):n.parentNode.appendChild(r),t._insertafter(this,e,this.paper),this},P.insertBefore=function(e){if(this.removed||!e)return this;var r=E(this.node),n=E(e.node||e[0].node);return n.parentNode.insertBefore(r,n),t._insertbefore(this,e,this.paper),this},P.blur=function(e){var r=this;if(0!=+e){var n=g("filter"),o=g("feGaussianBlur");r.attrs.blur=e,n.id=t.createUUID(),g(o,{stdDeviation:+e||1.5}),n.appendChild(o),r.paper.defs.appendChild(n),r._blur=n,g(r.node,{filter:"url(#"+n.id+")"})}else r._blur&&(r._blur.parentNode.removeChild(r._blur),delete r._blur,delete r.attrs.blur),r.node.removeAttribute("filter");return r},t._engine.circle=function(t,e,r,n){var o=g("circle");t.canvas&&t.canvas.appendChild(o);var i=new j(o,t);return i.attrs={cx:e,cy:r,r:n,fill:"none",stroke:"#000"},i.type="circle",g(o,i.attrs),i},t._engine.rect=function(t,e,r,n,o,i){var a=g("rect");t.canvas&&t.canvas.appendChild(a);var s=new j(a,t);return s.attrs={x:e,y:r,width:n,height:o,rx:i||0,ry:i||0,fill:"none",stroke:"#000"},s.type="rect",g(a,s.attrs),s},t._engine.ellipse=function(t,e,r,n,o){var i=g("ellipse");t.canvas&&t.canvas.appendChild(i);var a=new j(i,t);return a.attrs={cx:e,cy:r,rx:n,ry:o,fill:"none",stroke:"#000"},a.type="ellipse",g(i,a.attrs),a},t._engine.image=function(t,e,r,n,o,i){var a=g("image");g(a,{x:r,y:n,width:o,height:i,preserveAspectRatio:"none"}),a.setAttributeNS(p,"href",e),t.canvas&&t.canvas.appendChild(a);var s=new j(a,t);return s.attrs={x:r,y:n,width:o,height:i,src:e},s.type="image",s},t._engine.text=function(e,r,n,o){var i=g("text");e.canvas&&e.canvas.appendChild(i);var a=new j(i,e);return a.attrs={x:r,y:n,"text-anchor":"middle",text:o,"font-family":t._availableAttrs["font-family"],"font-size":t._availableAttrs["font-size"],stroke:"none",fill:"#000"},a.type="text",O(a,a.attrs),a},t._engine.setSize=function(t,e){return this.width=t||this.width,this.height=e||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e&&e.container,n=e.x,o=e.y,i=e.width,a=e.height;if(!r)throw new Error("SVG container not found.");var s,u=g("svg"),l="overflow:hidden;";return n=n||0,o=o||0,i=i||512,a=a||342,g(u,{height:a,version:1.1,width:i,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),1==r?(u.style.cssText=l+"position:absolute;left:"+n+"px;top:"+o+"px",t._g.doc.body.appendChild(u),s=1):(u.style.cssText=l+"position:relative",r.firstChild?r.insertBefore(u,r.firstChild):r.appendChild(u)),r=new t._Paper,r.width=i,r.height=a,r.canvas=u,r.clear(),r._left=r._top=0,s&&(r.renderfix=function(){}),r.renderfix(),r},t._engine.setViewBox=function(t,e,r,n,o){c("raphael.setViewBox",this,this._viewBox,[t,e,r,n,o]);var i,s,u=this.getSize(),l=a(r/u.width,n/u.height),f=this.top,p=o?"xMidYMid meet":"xMinYMin";for(null==t?(this._vbSize&&(l=1),delete this._vbSize,i="0 0 "+this.width+d+this.height):(this._vbSize=l,i=t+d+e+d+r+d+n),g(this.canvas,{viewBox:i,preserveAspectRatio:p});l&&f;)s="stroke-width"in f.attrs?f.attrs["stroke-width"]:1,f.attr({"stroke-width":s}),f._.dirty=1,f._.dirtyT=1,f=f.prev;return this._viewBox=[t,e,r,n,!!o],this},t.prototype.renderfix=function(){var t,e=this.canvas,r=e.style;try{t=e.getScreenCTM()||e.createSVGMatrix()}catch(r){t=e.createSVGMatrix()}var n=-t.e%1,o=-t.f%1;(n||o)&&(n&&(this._left=(this._left+n)%1,r.left=this._left+"px"),o&&(this._top=(this._top+o)%1,r.top=this._top+"px"))},t.prototype.clear=function(){t.eve("raphael.clear",this);for(var e=this.canvas;e.firstChild;)e.removeChild(e.firstChild);this.bottom=this.top=null,(this.desc=g("desc")).appendChild(t._g.doc.createTextNode("Created with Raphaël "+t.version)),e.appendChild(this.desc),e.appendChild(this.defs=g("defs"))},t.prototype.remove=function(){c("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]="function"==typeof this[e]?t._removedFactory(e):null};var T=t.st;for(var C in P)P[e](C)&&!T[e](C)&&(T[C]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(C))}}.apply(e,n))&&(t.exports=o)},function(t,e,r){var n,o;n=[r(1)],void 0!==(o=function(t){if(!t||t.vml){var e="hasOwnProperty",r=String,n=parseFloat,o=Math,i=o.round,a=o.max,s=o.min,u=o.abs,l="fill",c=/[, ]+/,f=t.eve,d=" ",p="",h={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},m=/([clmz]),?([^clmz]*)/gi,g=/ progid:\S+Blur\([^\)]+\)/g,v=/-?[^,\s-]+/g,b="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",y=21600,_={path:1,rect:1,image:1},x={circle:1,ellipse:1},w=function(e){var n=/[ahqstv]/gi,o=t._pathToAbsolute;if(r(e).match(n)&&(o=t._path2curve),n=/[clmz]/g,o==t._pathToAbsolute&&!r(e).match(n)){var a=r(e).replace(m,function(t,e,r){var n=[],o="m"==e.toLowerCase(),a=h[e];return r.replace(v,function(t){o&&2==n.length&&(a+=n+h["m"==e?"l":"L"],n=[]),n.push(i(t*y))}),a+n});return a}var s,u,l=o(e);a=[];for(var c=0,f=l.length;c<f;c++){s=l[c],"z"==(u=l[c][0].toLowerCase())&&(u="x");for(var g=1,b=s.length;g<b;g++)u+=i(s[g]*y)+(g!=b-1?",":p);a.push(u)}return a.join(d)},S=function(e,r,n){var o=t.matrix();return o.rotate(-e,.5,.5),{dx:o.x(r,n),dy:o.y(r,n)}},O=function(t,e,r,n,o,i){var a=t._,s=t.matrix,c=a.fillpos,f=t.node,p=f.style,h=1,m="",g=y/e,v=y/r;if(p.visibility="hidden",e&&r){if(f.coordsize=u(g)+d+u(v),p.rotation=i*(e*r<0?-1:1),i){var b=S(i,n,o);n=b.dx,o=b.dy}if(e<0&&(m+="x"),r<0&&(m+=" y")&&(h=-1),p.flip=m,f.coordorigin=n*-g+d+o*-v,c||a.fillsize){var _=f.getElementsByTagName(l);_=_&&_[0],f.removeChild(_),c&&(b=S(i,s.x(c[0],c[1]),s.y(c[0],c[1])),_.position=b.dx*h+d+b.dy*h),a.fillsize&&(_.size=a.fillsize[0]*u(e)+d+a.fillsize[1]*u(r)),f.appendChild(_)}p.visibility="visible"}};t.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(t,e,n){for(var o=r(e).toLowerCase().split("-"),i=n?"end":"start",a=o.length,s="classic",u="medium",l="medium";a--;)switch(o[a]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":s=o[a];break;case"wide":case"narrow":l=o[a];break;case"long":case"short":u=o[a]}var c=t.node.getElementsByTagName("stroke")[0];c[i+"arrow"]=s,c[i+"arrowlength"]=u,c[i+"arrowwidth"]=l},E=function(o,u){o.attrs=o.attrs||{};var f=o.node,h=o.attrs,m=f.style,g=_[o.type]&&(u.x!=h.x||u.y!=h.y||u.width!=h.width||u.height!=h.height||u.cx!=h.cx||u.cy!=h.cy||u.rx!=h.rx||u.ry!=h.ry||u.r!=h.r),v=x[o.type]&&(h.cx!=u.cx||h.cy!=u.cy||h.r!=u.r||h.rx!=u.rx||h.ry!=u.ry),b=o;for(var S in u)u[e](S)&&(h[S]=u[S]);if(g&&(h.path=t._getPath[o.type](o),o._.dirty=1),u.href&&(f.href=u.href),u.title&&(f.title=u.title),u.target&&(f.target=u.target),u.cursor&&(m.cursor=u.cursor),"blur"in u&&o.blur(u.blur),(u.path&&"path"==o.type||g)&&(f.path=w(~r(h.path).toLowerCase().indexOf("r")?t._pathToAbsolute(h.path):h.path),o._.dirty=1,"image"==o.type&&(o._.fillpos=[h.x,h.y],o._.fillsize=[h.width,h.height],O(o,1,1,0,0,0))),"transform"in u&&o.transform(u.transform),v){var E=+h.cx,P=+h.cy,T=+h.rx||+h.r||0,k=+h.ry||+h.r||0;f.path=t.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",i((E-T)*y),i((P-k)*y),i((E+T)*y),i((P+k)*y),i(E*y)),o._.dirty=1}if("clip-rect"in u){var M=r(u["clip-rect"]).split(c);if(4==M.length){M[2]=+M[2]+ +M[0],M[3]=+M[3]+ +M[1];var R=f.clipRect||t._g.doc.createElement("div"),N=R.style;N.clip=t.format("rect({1}px {2}px {3}px {0}px)",M),f.clipRect||(N.position="absolute",N.top=0,N.left=0,N.width=o.paper.width+"px",N.height=o.paper.height+"px",f.parentNode.insertBefore(R,f),R.appendChild(f),f.clipRect=R)}u["clip-rect"]||f.clipRect&&(f.clipRect.style.clip="auto")}if(o.textpath){var I=o.textpath.style;u.font&&(I.font=u.font),u["font-family"]&&(I.fontFamily='"'+u["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,p)+'"'),u["font-size"]&&(I.fontSize=u["font-size"]),u["font-weight"]&&(I.fontWeight=u["font-weight"]),u["font-style"]&&(I.fontStyle=u["font-style"])}if("arrow-start"in u&&A(b,u["arrow-start"]),"arrow-end"in u&&A(b,u["arrow-end"],1),null!=u.opacity||null!=u.fill||null!=u.src||null!=u.stroke||null!=u["stroke-width"]||null!=u["stroke-opacity"]||null!=u["fill-opacity"]||null!=u["stroke-dasharray"]||null!=u["stroke-miterlimit"]||null!=u["stroke-linejoin"]||null!=u["stroke-linecap"]){var B=f.getElementsByTagName(l);if(B=B&&B[0],!B&&(B=C(l)),"image"==o.type&&u.src&&(B.src=u.src),u.fill&&(B.on=!0),null!=B.on&&"none"!=u.fill&&null!==u.fill||(B.on=!1),B.on&&u.fill){var L=r(u.fill).match(t._ISURL);if(L){B.parentNode==f&&f.removeChild(B),B.rotate=!0,B.src=L[1],B.type="tile";var D=o.getBBox(1);B.position=D.x+d+D.y,o._.fillpos=[D.x,D.y],t._preload(L[1],function(){o._.fillsize=[this.offsetWidth,this.offsetHeight]})}else B.color=t.getRGB(u.fill).hex,B.src=p,B.type="solid",t.getRGB(u.fill).error&&(b.type in{circle:1,ellipse:1}||"r"!=r(u.fill).charAt())&&j(b,u.fill,B)&&(h.fill="none",h.gradient=u.fill,B.rotate=!1)}if("fill-opacity"in u||"opacity"in u){var F=((+h["fill-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+t.getRGB(u.fill).o+1||2)-1);F=s(a(F,0),1),B.opacity=F,B.src&&(B.color="none")}f.appendChild(B);var G=f.getElementsByTagName("stroke")&&f.getElementsByTagName("stroke")[0],z=!1;!G&&(z=G=C("stroke")),(u.stroke&&"none"!=u.stroke||u["stroke-width"]||null!=u["stroke-opacity"]||u["stroke-dasharray"]||u["stroke-miterlimit"]||u["stroke-linejoin"]||u["stroke-linecap"])&&(G.on=!0),("none"==u.stroke||null===u.stroke||null==G.on||0==u.stroke||0==u["stroke-width"])&&(G.on=!1);var H=t.getRGB(u.stroke);G.on&&u.stroke&&(G.color=H.hex),F=((+h["stroke-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+H.o+1||2)-1);var W=.75*(n(u["stroke-width"])||1);if(F=s(a(F,0),1),null==u["stroke-width"]&&(W=h["stroke-width"]),u["stroke-width"]&&(G.weight=W),W&&W<1&&(F*=W)&&(G.weight=1),G.opacity=F,u["stroke-linejoin"]&&(G.joinstyle=u["stroke-linejoin"]||"miter"),G.miterlimit=u["stroke-miterlimit"]||8,u["stroke-linecap"]&&(G.endcap="butt"==u["stroke-linecap"]?"flat":"square"==u["stroke-linecap"]?"square":"round"),"stroke-dasharray"in u){var U={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};G.dashstyle=U[e](u["stroke-dasharray"])?U[u["stroke-dasharray"]]:p}z&&f.appendChild(G)}if("text"==b.type){b.paper.canvas.style.display=p;var V=b.paper.span,q=h.font&&h.font.match(/\d+(?:\.\d*)?(?=px)/);m=V.style,h.font&&(m.font=h.font),h["font-family"]&&(m.fontFamily=h["font-family"]),h["font-weight"]&&(m.fontWeight=h["font-weight"]),h["font-style"]&&(m.fontStyle=h["font-style"]),q=n(h["font-size"]||q&&q[0])||10,m.fontSize=100*q+"px",b.textpath.string&&(V.innerHTML=r(b.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var K=V.getBoundingClientRect();b.W=h.w=(K.right-K.left)/100,b.H=h.h=(K.bottom-K.top)/100,b.X=h.x,b.Y=h.y+b.H/2,("x"in u||"y"in u)&&(b.path.v=t.format("m{0},{1}l{2},{1}",i(h.x*y),i(h.y*y),i(h.x*y)+1));for(var Y=["x","y","text","font","font-family","font-weight","font-style","font-size"],$=0,X=Y.length;$<X;$++)if(Y[$]in u){b._.dirty=1;break}switch(h["text-anchor"]){case"start":b.textpath.style["v-text-align"]="left",b.bbx=b.W/2;break;case"end":b.textpath.style["v-text-align"]="right",b.bbx=-b.W/2;break;default:b.textpath.style["v-text-align"]="center",b.bbx=0}b.textpath.style["v-text-kern"]=!0}},j=function(e,i,a){e.attrs=e.attrs||{};var s=(e.attrs,Math.pow),u="linear",l=".5 .5";if(e.attrs.gradient=i,i=r(i).replace(t._radial_gradient,function(t,e,r){return u="radial",e&&r&&(e=n(e),r=n(r),s(e-.5,2)+s(r-.5,2)>.25&&(r=o.sqrt(.25-s(e-.5,2))*(2*(r>.5)-1)+.5),l=e+d+r),p}),i=i.split(/\s*\-\s*/),"linear"==u){var c=i.shift();if(c=-n(c),isNaN(c))return null}var f=t._parseDots(i);if(!f)return null;if(e=e.shape||e.node,f.length){e.removeChild(a),a.on=!0,a.method="none",a.color=f[0].color,a.color2=f[f.length-1].color;for(var h=[],m=0,g=f.length;m<g;m++)f[m].offset&&h.push(f[m].offset+d+f[m].color);a.colors=h.length?h.join():"0% "+a.color,"radial"==u?(a.type="gradientTitle",a.focus="100%",a.focussize="0 0",a.focusposition=l,a.angle=0):(a.type="gradient",a.angle=(270-c)%360),e.appendChild(a)}return 1},P=function(e,r){this[0]=this.node=e,e.raphael=!0,this.id=t._oid++,e.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=r,this.matrix=t.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},T=t.el;P.prototype=T,T.constructor=P,T.transform=function(e){if(null==e)return this._.transform;var n,o=this.paper._viewBoxShift,i=o?"s"+[o.scale,o.scale]+"-1-1t"+[o.dx,o.dy]:p;o&&(n=e=r(e).replace(/\.{3}|\u2026/g,this._.transform||p)),t._extractTransform(this,i+e);var a,s=this.matrix.clone(),u=this.skew,l=this.node,c=~r(this.attrs.fill).indexOf("-"),f=!r(this.attrs.fill).indexOf("url(");if(s.translate(1,1),f||c||"image"==this.type)if(u.matrix="1 0 0 1",u.offset="0 0",a=s.split(),c&&a.noRotation||!a.isSimple){l.style.filter=s.toFilter();var h=this.getBBox(),m=this.getBBox(1),g=h.x-m.x,v=h.y-m.y;l.coordorigin=g*-y+d+v*-y,O(this,1,1,g,v,0)}else l.style.filter=p,O(this,a.scalex,a.scaley,a.dx,a.dy,a.rotate);else l.style.filter=p,u.matrix=r(s),u.offset=s.offset();return null!==n&&(this._.transform=n,t._extractTransform(this,n)),this},T.rotate=function(t,e,o){if(this.removed)return this;if(null!=t){if(t=r(t).split(c),t.length-1&&(e=n(t[1]),o=n(t[2])),t=n(t[0]),null==o&&(e=o),null==e||null==o){var i=this.getBBox(1);e=i.x+i.width/2,o=i.y+i.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",t,e,o]])),this}},T.translate=function(t,e){return this.removed?this:(t=r(t).split(c),t.length-1&&(e=n(t[1])),t=n(t[0])||0,e=+e||0,this._.bbox&&(this._.bbox.x+=t,this._.bbox.y+=e),this.transform(this._.transform.concat([["t",t,e]])),this)},T.scale=function(t,e,o,i){if(this.removed)return this;if(t=r(t).split(c),t.length-1&&(e=n(t[1]),o=n(t[2]),i=n(t[3]),isNaN(o)&&(o=null),isNaN(i)&&(i=null)),t=n(t[0]),null==e&&(e=t),null==i&&(o=i),null==o||null==i)var a=this.getBBox(1);return o=null==o?a.x+a.width/2:o,i=null==i?a.y+a.height/2:i,this.transform(this._.transform.concat([["s",t,e,o,i]])),this._.dirtyT=1,this},T.hide=function(){return!this.removed&&(this.node.style.display="none"),this},T.show=function(){return!this.removed&&(this.node.style.display=p),this},T.auxGetBBox=t.el.getBBox,T.getBBox=function(){var t=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var e={},r=1/this.paper._viewBoxShift.scale;return e.x=t.x-this.paper._viewBoxShift.dx,e.x*=r,e.y=t.y-this.paper._viewBoxShift.dy,e.y*=r,e.width=t.width*r,e.height=t.height*r,e.x2=e.x+e.width,e.y2=e.y+e.height,e}return t},T._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},T.remove=function(){if(!this.removed&&this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),t.eve.unbind("raphael.*.*."+this.id),t._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var e in this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;this.removed=!0}},T.attr=function(r,n){if(this.removed)return this;if(null==r){var o={};for(var i in this.attrs)this.attrs[e](i)&&(o[i]=this.attrs[i]);return o.gradient&&"none"==o.fill&&(o.fill=o.gradient)&&delete o.gradient,o.transform=this._.transform,o}if(null==n&&t.is(r,"string")){if(r==l&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var a=r.split(c),s={},u=0,d=a.length;u<d;u++)r=a[u],r in this.attrs?s[r]=this.attrs[r]:t.is(this.paper.customAttributes[r],"function")?s[r]=this.paper.customAttributes[r].def:s[r]=t._availableAttrs[r];return d-1?s:s[a[0]]}if(this.attrs&&null==n&&t.is(r,"array")){for(s={},u=0,d=r.length;u<d;u++)s[r[u]]=this.attr(r[u]);return s}var p;null!=n&&(p={},p[r]=n),null==n&&t.is(r,"object")&&(p=r);for(var h in p)f("raphael.attr."+h+"."+this.id,this,p[h]);if(p){for(h in this.paper.customAttributes)if(this.paper.customAttributes[e](h)&&p[e](h)&&t.is(this.paper.customAttributes[h],"function")){var m=this.paper.customAttributes[h].apply(this,[].concat(p[h]));this.attrs[h]=p[h];for(var g in m)m[e](g)&&(p[g]=m[g])}p.text&&"text"==this.type&&(this.textpath.string=p.text),E(this,p)}return this},T.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&t._tofront(this,this.paper),this},T.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),t._toback(this,this.paper)),this)},T.insertAfter=function(e){return this.removed?this:(e.constructor==t.st.constructor&&(e=e[e.length-1]),e.node.nextSibling?e.node.parentNode.insertBefore(this.node,e.node.nextSibling):e.node.parentNode.appendChild(this.node),t._insertafter(this,e,this.paper),this)},T.insertBefore=function(e){return this.removed?this:(e.constructor==t.st.constructor&&(e=e[0]),e.node.parentNode.insertBefore(this.node,e.node),t._insertbefore(this,e,this.paper),this)},T.blur=function(e){var r=this.node.runtimeStyle,n=r.filter;return n=n.replace(g,p),0!=+e?(this.attrs.blur=e,r.filter=n+d+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+e||1.5)+")",r.margin=t.format("-{0}px 0 0 -{0}px",i(+e||1.5))):(r.filter=n,r.margin=0,delete this.attrs.blur),this},t._engine.path=function(t,e){var r=C("shape");r.style.cssText=b,r.coordsize=y+d+y,r.coordorigin=e.coordorigin;var n=new P(r,e),o={fill:"none",stroke:"#000"};t&&(o.path=t),n.type="path",n.path=[],n.Path=p,E(n,o),e.canvas&&e.canvas.appendChild(r);var i=C("skew");return i.on=!0,r.appendChild(i),n.skew=i,n.transform(p),n},t._engine.rect=function(e,r,n,o,i,a){var s=t._rectPath(r,n,o,i,a),u=e.path(s),l=u.attrs;return u.X=l.x=r,u.Y=l.y=n,u.W=l.width=o,u.H=l.height=i,l.r=a,l.path=s,u.type="rect",u},t._engine.ellipse=function(t,e,r,n,o){var i=t.path();i.attrs;return i.X=e-n,i.Y=r-o,i.W=2*n,i.H=2*o,i.type="ellipse",E(i,{cx:e,cy:r,rx:n,ry:o}),i},t._engine.circle=function(t,e,r,n){var o=t.path();o.attrs;return o.X=e-n,o.Y=r-n,o.W=o.H=2*n,o.type="circle",E(o,{cx:e,cy:r,r:n}),o},t._engine.image=function(e,r,n,o,i,a){var s=t._rectPath(n,o,i,a),u=e.path(s).attr({stroke:"none"}),c=u.attrs,f=u.node,d=f.getElementsByTagName(l)[0];return c.src=r,u.X=c.x=n,u.Y=c.y=o,u.W=c.width=i,u.H=c.height=a,c.path=s,u.type="image",d.parentNode==f&&f.removeChild(d),d.rotate=!0,d.src=r,d.type="tile",u._.fillpos=[n,o],u._.fillsize=[i,a],f.appendChild(d),O(u,1,1,0,0,0),u},t._engine.text=function(e,n,o,a){var s=C("shape"),u=C("path"),l=C("textpath");n=n||0,o=o||0,a=a||"",u.v=t.format("m{0},{1}l{2},{1}",i(n*y),i(o*y),i(n*y)+1),u.textpathok=!0,l.string=r(a),l.on=!0,s.style.cssText=b,s.coordsize=y+d+y,s.coordorigin="0 0";var c=new P(s,e),f={fill:"#000",stroke:"none",font:t._availableAttrs.font,text:a};c.shape=s,c.path=u,c.textpath=l,c.type="text",c.attrs.text=r(a),c.attrs.x=n,c.attrs.y=o,c.attrs.w=1,c.attrs.h=1,E(c,f),s.appendChild(l),s.appendChild(u),e.canvas.appendChild(s);var h=C("skew");return h.on=!0,s.appendChild(h),c.skew=h,c.transform(p),c},t._engine.setSize=function(e,r){var n=this.canvas.style;return this.width=e,this.height=r,e==+e&&(e+="px"),r==+r&&(r+="px"),n.width=e,n.height=r,n.clip="rect(0 "+e+" "+r+" 0)",this._viewBox&&t._engine.setViewBox.apply(this,this._viewBox),this},t._engine.setViewBox=function(e,r,n,o,i){t.eve("raphael.setViewBox",this,this._viewBox,[e,r,n,o,i]);var a,s,u=this.getSize(),l=u.width,c=u.height;return i&&(a=c/o,s=l/n,n*a<l&&(e-=(l-n*a)/2/a),o*s<c&&(r-=(c-o*s)/2/s)),this._viewBox=[e,r,n,o,!!i],this._viewBoxShift={dx:-e,dy:-r,scale:u},this.forEach(function(t){t.transform("...")}),this};var C;t._engine.initWin=function(t){var e=t.document;e.styleSheets.length<31?e.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):e.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!e.namespaces.rvml&&e.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),C=function(t){return e.createElement("<rvml:"+t+' class="rvml">')}}catch(t){C=function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},t._engine.initWin(t._g.win),t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e.container,n=e.height,o=e.width,i=e.x,a=e.y;if(!r)throw new Error("VML container not found.");var s=new t._Paper,u=s.canvas=t._g.doc.createElement("div"),l=u.style;return i=i||0,a=a||0,o=o||512,n=n||342,s.width=o,s.height=n,o==+o&&(o+="px"),n==+n&&(n+="px"),s.coordsize=216e5+d+216e5,s.coordorigin="0 0",s.span=t._g.doc.createElement("span"),s.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",u.appendChild(s.span),l.cssText=t.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",o,n),1==r?(t._g.doc.body.appendChild(u),l.left=i+"px",l.top=a+"px",l.position="absolute"):r.firstChild?r.insertBefore(u,r.firstChild):r.appendChild(u),s.renderfix=function(){},s},t.prototype.clear=function(){t.eve("raphael.clear",this),this.canvas.innerHTML=p,this.span=t._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},t.prototype.remove=function(){t.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;return!0};var k=t.st;for(var M in T)T[e](M)&&!k[e](M)&&(k[M]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(M))}}.apply(e,n))&&(t.exports=o)}])})},{}],503:[function(e,r,n){(function(e){!function(e,o){"object"==typeof n&&void 0!==r?o(n):"function"==typeof t&&t.amd?t(["exports"],o):o(e.reduxLogger=e.reduxLogger||{})}(this,function(t){"use strict";function r(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}function n(t,e){Object.defineProperty(this,"kind",{value:t,enumerable:!0}),e&&e.length&&Object.defineProperty(this,"path",{value:e,enumerable:!0})}function o(t,e,r){o.super_.call(this,"E",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0}),Object.defineProperty(this,"rhs",{value:r,enumerable:!0})}function i(t,e){i.super_.call(this,"N",t),Object.defineProperty(this,"rhs",{value:e,enumerable:!0})}function a(t,e){a.super_.call(this,"D",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0})}function s(t,e,r){s.super_.call(this,"A",t),Object.defineProperty(this,"index",{value:e,enumerable:!0}),Object.defineProperty(this,"item",{value:r,enumerable:!0})}function u(t,e,r){var n=t.slice((r||e)+1||t.length);return t.length=e<0?t.length+e:e,t.push.apply(t,n),t}function l(t){var e=void 0===t?"undefined":C(t);return"object"!==e?e:t===Math?"math":null===t?"null":Array.isArray(t)?"array":"[object Date]"===Object.prototype.toString.call(t)?"date":"function"==typeof t.toString&&/^\/.*\//.test(t.toString())?"regexp":"object"}function c(t,e,r,n,f,d,p){f=f||[],p=p||[];var h=f.slice(0);if(void 0!==d){if(n){if("function"==typeof n&&n(h,d))return;if("object"===(void 0===n?"undefined":C(n))){if(n.prefilter&&n.prefilter(h,d))return;if(n.normalize){var m=n.normalize(h,d,t,e);m&&(t=m[0],e=m[1])}}}h.push(d)}"regexp"===l(t)&&"regexp"===l(e)&&(t=t.toString(),e=e.toString());var g=void 0===t?"undefined":C(t),v=void 0===e?"undefined":C(e),b="undefined"!==g||p&&p[p.length-1].lhs&&p[p.length-1].lhs.hasOwnProperty(d),y="undefined"!==v||p&&p[p.length-1].rhs&&p[p.length-1].rhs.hasOwnProperty(d);if(!b&&y)r(new i(h,e));else if(!y&&b)r(new a(h,t));else if(l(t)!==l(e))r(new o(h,t,e));else if("date"===l(t)&&t-e!=0)r(new o(h,t,e));else if("object"===g&&null!==t&&null!==e)if(p.filter(function(e){return e.lhs===t}).length)t!==e&&r(new o(h,t,e));else{if(p.push({lhs:t,rhs:e}),Array.isArray(t)){var _;for(t.length,_=0;_<t.length;_++)_>=e.length?r(new s(h,_,new a(void 0,t[_]))):c(t[_],e[_],r,n,h,_,p);for(;_<e.length;)r(new s(h,_,new i(void 0,e[_++])))}else{var x=Object.keys(t),w=Object.keys(e);x.forEach(function(o,i){var a=w.indexOf(o);a>=0?(c(t[o],e[o],r,n,h,o,p),w=u(w,a)):c(t[o],void 0,r,n,h,o,p)}),w.forEach(function(t){c(void 0,e[t],r,n,h,t,p)})}p.length=p.length-1}else t!==e&&("number"===g&&isNaN(t)&&isNaN(e)||r(new o(h,t,e)))}function f(t,e,r,n){return n=n||[],c(t,e,function(t){t&&n.push(t)},r),n.length?n:void 0}function d(t,e,r){if(r.path&&r.path.length){var n,o=t[e],i=r.path.length-1;for(n=0;n<i;n++)o=o[r.path[n]];switch(r.kind){case"A":d(o[r.path[n]],r.index,r.item);break;case"D":delete o[r.path[n]];break;case"E":case"N":o[r.path[n]]=r.rhs}}else switch(r.kind){case"A":d(t[e],r.index,r.item);break;case"D":t=u(t,e);break;case"E":case"N":t[e]=r.rhs}return t}function p(t,e,r){if(t&&e&&r&&r.kind){for(var n=t,o=-1,i=r.path?r.path.length-1:0;++o<i;)void 0===n[r.path[o]]&&(n[r.path[o]]="number"==typeof r.path[o]?[]:{}),n=n[r.path[o]];switch(r.kind){case"A":d(r.path?n[r.path[o]]:n,r.index,r.item);break;case"D":delete n[r.path[o]];break;case"E":case"N":n[r.path[o]]=r.rhs}}}function h(t,e,r){if(r.path&&r.path.length){var n,o=t[e],i=r.path.length-1;for(n=0;n<i;n++)o=o[r.path[n]];switch(r.kind){case"A":h(o[r.path[n]],r.index,r.item);break;case"D":case"E":o[r.path[n]]=r.lhs;break;case"N":delete o[r.path[n]]}}else switch(r.kind){case"A":h(t[e],r.index,r.item);break;case"D":case"E":t[e]=r.lhs;break;case"N":t=u(t,e)}return t}function m(t,e,r){if(t&&e&&r&&r.kind){var n,o,i=t;for(o=r.path.length-1,n=0;n<o;n++)void 0===i[r.path[n]]&&(i[r.path[n]]={}),i=i[r.path[n]];switch(r.kind){case"A":h(i[r.path[n]],r.index,r.item);break;case"D":case"E":i[r.path[n]]=r.lhs;break;case"N":delete i[r.path[n]]}}}function g(t,e,r){if(t&&e){c(t,e,function(n){r&&!r(t,e,n)||p(t,e,n)})}}function v(t){return"color: "+R[t].color+"; font-weight: bold"}function b(t){var e=t.kind,r=t.path,n=t.lhs,o=t.rhs,i=t.index,a=t.item;switch(e){case"E":return[r.join("."),n,"→",o];case"N":return[r.join("."),o];case"D":return[r.join(".")];case"A":return[r.join(".")+"["+i+"]",a];default:return[]}}function y(t,e,r,n){var o=f(t,e);try{n?r.groupCollapsed("diff"):r.group("diff")}catch(t){r.log("diff")}o?o.forEach(function(t){var e=t.kind,n=b(t);r.log.apply(r,["%c "+R[e].text,v(e)].concat(k(n)))}):r.log("—— no diff ——");try{r.groupEnd()}catch(t){r.log("—— diff end —— ")}}function _(t,e,r,n){switch(void 0===t?"undefined":C(t)){case"object":return"function"==typeof t[n]?t[n].apply(t,k(r)):t[n];case"function":return t(e);default:return t}}function x(t){var e=t.timestamp,r=t.duration;return function(t,n,o){var i=["action"];return i.push("%c"+String(t.type)),e&&i.push("%c@ "+n),r&&i.push("%c(in "+o.toFixed(2)+" ms)"),i.join(" ")}}function w(t,e){var r=e.logger,n=e.actionTransformer,o=e.titleFormatter,i=void 0===o?x(e):o,a=e.collapsed,s=e.colors,u=e.level,l=e.diff,c=void 0===e.titleFormatter;t.forEach(function(o,f){var d=o.started,p=o.startedTime,h=o.action,m=o.prevState,g=o.error,v=o.took,b=o.nextState,x=t[f+1];x&&(b=x.prevState,v=x.started-d);var w=n(h),S="function"==typeof a?a(function(){return b},h,o):a,O=P(p),A=s.title?"color: "+s.title(w)+";":"",E=["color: gray; font-weight: lighter;"];E.push(A),e.timestamp&&E.push("color: gray; font-weight: lighter;"),e.duration&&E.push("color: gray; font-weight: lighter;");var j=i(w,O,v);try{S?s.title&&c?r.groupCollapsed.apply(r,["%c "+j].concat(E)):r.groupCollapsed(j):s.title&&c?r.group.apply(r,["%c "+j].concat(E)):r.group(j)}catch(t){r.log(j)}var T=_(u,w,[m],"prevState"),C=_(u,w,[w],"action"),k=_(u,w,[g,m],"error"),M=_(u,w,[b],"nextState");if(T)if(s.prevState){var R="color: "+s.prevState(m)+"; font-weight: bold";r[T]("%c prev state",R,m)}else r[T]("prev state",m);if(C)if(s.action){var N="color: "+s.action(w)+"; font-weight: bold";r[C]("%c action    ",N,w)}else r[C]("action    ",w);if(g&&k)if(s.error){var I="color: "+s.error(g,m)+"; font-weight: bold;";r[k]("%c error     ",I,g)}else r[k]("error     ",g);if(M)if(s.nextState){var B="color: "+s.nextState(b)+"; font-weight: bold";r[M]("%c next state",B,b)}else r[M]("next state",b);l&&y(m,b,r,S);try{r.groupEnd()}catch(t){r.log("—— log end ——")}})}function S(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},N,t),r=e.logger,n=e.stateTransformer,o=e.errorTransformer,i=e.predicate,a=e.logErrors,s=e.diffPredicate;if(void 0===r)return function(){return function(t){return function(e){return t(e)}}}
  ;if(t.getState&&t.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n  reducer,\n  applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n  // ...options\n});\nconst store = createStore(\n  reducer,\n  applyMiddleware(logger)\n)\n"),function(){return function(t){return function(e){return t(e)}}};var u=[];return function(t){var r=t.getState;return function(t){return function(l){if("function"==typeof i&&!i(r,l))return t(l);var c={};u.push(c),c.started=T.now(),c.startedTime=new Date,c.prevState=n(r()),c.action=l;var f=void 0;if(a)try{f=t(l)}catch(t){c.error=o(t)}else f=t(l);c.took=T.now()-c.started,c.nextState=n(r());var d=e.diff&&"function"==typeof s?s(r,l):e.diff;if(w(u,Object.assign({},e,{diff:d})),u.length=0,c.error)throw c.error;return f}}}}var O,A,E=function(t,e){return new Array(e+1).join(t)},j=function(t,e){return E("0",e-t.toString().length)+t},P=function(t){return j(t.getHours(),2)+":"+j(t.getMinutes(),2)+":"+j(t.getSeconds(),2)+"."+j(t.getMilliseconds(),3)},T="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},M=[];O="object"===(void 0===e?"undefined":C(e))&&e?e:"undefined"!=typeof window?window:{},A=O.DeepDiff,A&&M.push(function(){void 0!==A&&O.DeepDiff===f&&(O.DeepDiff=A,A=void 0)}),r(o,n),r(i,n),r(a,n),r(s,n),Object.defineProperties(f,{diff:{value:f,enumerable:!0},observableDiff:{value:c,enumerable:!0},applyDiff:{value:g,enumerable:!0},applyChange:{value:p,enumerable:!0},revertChange:{value:m,enumerable:!0},isConflict:{value:function(){return void 0!==A},enumerable:!0},noConflict:{value:function(){return M&&(M.forEach(function(t){t()}),M=null),f},enumerable:!0}});var R={E:{color:"#2196F3",text:"CHANGED:"},N:{color:"#4CAF50",text:"ADDED:"},D:{color:"#F44336",text:"DELETED:"},A:{color:"#2196F3",text:"ARRAY:"}},N={level:"log",logger:console,logErrors:!0,collapsed:void 0,predicate:void 0,duration:!1,timestamp:!0,stateTransformer:function(t){return t},actionTransformer:function(t){return t},errorTransformer:function(t){return t},colors:{title:function(){return"inherit"},prevState:function(){return"#9E9E9E"},action:function(){return"#03A9F4"},nextState:function(){return"#4CAF50"},error:function(){return"#F20404"}},diff:!1,diffPredicate:void 0,transformer:void 0},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.dispatch,r=t.getState;return"function"==typeof e||"function"==typeof r?S()({dispatch:e,getState:r}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};t.defaults=N,t.createLogger=S,t.logger=I,t.default=I,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],504:[function(t,e,r){"use strict";function n(t){return function(e){var r=e.dispatch,n=e.getState;return function(e){return function(o){return"function"==typeof o?o(r,n,t):e(o)}}}}r.__esModule=!0;var o=n();o.withExtraArgument=n,r.default=o},{}],505:[function(t,e,r){"use strict";function n(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return function(r,n,i){var s=t(r,n,i),u=s.dispatch,l=[],c={getState:s.getState,dispatch:function(t){return u(t)}};return l=e.map(function(t){return t(c)}),u=a.default.apply(void 0,l)(s.dispatch),o({},s,{dispatch:u})}}}r.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.default=n;var i=t("./compose"),a=function(t){return t&&t.__esModule?t:{default:t}}(i)},{"./compose":508}],506:[function(t,e,r){"use strict";function n(t,e){return function(){return e(t.apply(void 0,arguments))}}function o(t,e){if("function"==typeof t)return n(t,e);if("object"!=typeof t||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(t),o={},i=0;i<r.length;i++){var a=r[i],s=t[a];"function"==typeof s&&(o[a]=n(s,e))}return o}r.__esModule=!0,r.default=o},{}],507:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=e&&e.type;return"Given action "+(r&&'"'+r.toString()+'"'||"an action")+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function i(t){Object.keys(t).forEach(function(e){var r=t[e];if(void 0===r(void 0,{type:s.ActionTypes.INIT}))throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');if(void 0===r(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+e+"\" returned undefined when probed with a random type. Don't try to handle "+s.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.')})}function a(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var a=e[n];"function"==typeof t[a]&&(r[a]=t[a])}var s,u=Object.keys(r);try{i(r)}catch(t){s=t}return function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=arguments[1];if(s)throw s;for(var n=!1,i={},a=0;a<u.length;a++){var l=u[a],c=r[l],f=t[l],d=c(f,e);if(void 0===d){var p=o(l,e);throw new Error(p)}i[l]=d,n=n||d!==f}return n?i:t}}r.__esModule=!0,r.default=a;var s=t("./createStore"),u=t("lodash/isPlainObject"),l=(n(u),t("./utils/warning"));n(l)},{"./createStore":509,"./utils/warning":511,"lodash/isPlainObject":459}],508:[function(t,e,r){"use strict";function n(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(0===e.length)return function(t){return t};if(1===e.length)return e[0];var n=e[e.length-1],o=e.slice(0,-1);return function(){return o.reduceRight(function(t,e){return e(t)},n.apply(void 0,arguments))}}r.__esModule=!0,r.default=n},{}],509:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){function n(){v===g&&(v=g.slice())}function i(){return m}function s(t){if("function"!=typeof t)throw new Error("Expected listener to be a function.");var e=!0;return n(),v.push(t),function(){if(e){e=!1,n();var r=v.indexOf(t);v.splice(r,1)}}}function c(t){if(!(0,a.default)(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(b)throw new Error("Reducers may not dispatch actions.");try{b=!0,m=h(m,t)}finally{b=!1}for(var e=g=v,r=0;r<e.length;r++)e[r]();return t}function f(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");h=t,c({type:l.INIT})}function d(){var t,e=s;return t={subscribe:function(t){function r(){t.next&&t.next(i())}if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");return r(),{unsubscribe:e(r)}}},t[u.default]=function(){return this},t}var p;if("function"==typeof e&&void 0===r&&(r=e,e=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(o)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var h=t,m=e,g=[],v=g,b=!1;return c({type:l.INIT}),p={dispatch:c,subscribe:s,getState:i,replaceReducer:f},p[u.default]=d,p}r.__esModule=!0,r.ActionTypes=void 0,r.default=o;var i=t("lodash/isPlainObject"),a=n(i),s=t("symbol-observable"),u=n(s),l=r.ActionTypes={INIT:"@@redux/INIT"}},{"lodash/isPlainObject":459,"symbol-observable":516}],510:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}r.__esModule=!0,r.compose=r.applyMiddleware=r.bindActionCreators=r.combineReducers=r.createStore=void 0;var o=t("./createStore"),i=n(o),a=t("./combineReducers"),s=n(a),u=t("./bindActionCreators"),l=n(u),c=t("./applyMiddleware"),f=n(c),d=t("./compose"),p=n(d),h=t("./utils/warning");n(h);r.createStore=i.default,r.combineReducers=s.default,r.bindActionCreators=l.default,r.applyMiddleware=f.default,r.compose=p.default},{"./applyMiddleware":505,"./bindActionCreators":506,"./combineReducers":507,"./compose":508,"./createStore":509,"./utils/warning":511}],511:[function(t,e,r){"use strict";function n(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}r.__esModule=!0,r.default=n},{}],512:[function(t,e,r){(function(t){!function(t){"use strict";function r(t,e,r,n){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),s=new p(n||[]);return a._invoke=l(t,r,s),a}function n(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function u(e){function r(t,o,i,a){var s=n(e[t],e,o);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,i,a)},function(t){r("throw",t,i,a)}):Promise.resolve(l).then(function(t){u.value=t,i(u)},a)}a(s.arg)}function o(t,e){function n(){return new Promise(function(n,o){r(t,e,n,o)})}return i=i?i.then(n,n):n()}"object"==typeof t.process&&t.process.domain&&(r=t.process.domain.bind(r));var i;this._invoke=o}function l(t,e,r){var o=A;return function(i,a){if(o===j)throw new Error("Generator is already running");if(o===P){if("throw"===i)throw a;return m()}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=c(s,r);if(u){if(u===T)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===A)throw o=P,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=j;var l=n(t,e,r);if("normal"===l.type){if(o=r.done?P:E,l.arg===T)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=P,r.method="throw",r.arg=l.arg)}}}function c(t,e){var r=t.iterator[e.method];if(r===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,c(t,e),"throw"===e.method))return T;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=n(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,T;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,T):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,T)}function f(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function d(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)}function h(t){if(t){var e=t[_];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(b.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=g,e.done=!0,e};return n.next=n}}return{next:m}}function m(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,y="function"==typeof Symbol?Symbol:{},_=y.iterator||"@@iterator",x=y.asyncIterator||"@@asyncIterator",w=y.toStringTag||"@@toStringTag",S="object"==typeof e,O=t.regeneratorRuntime;if(O)return void(S&&(e.exports=O));O=t.regeneratorRuntime=S?e.exports:{},O.wrap=r;var A="suspendedStart",E="suspendedYield",j="executing",P="completed",T={},C={};C[_]=function(){return this};var k=Object.getPrototypeOf,M=k&&k(k(h([])));M&&M!==v&&b.call(M,_)&&(C=M);var R=a.prototype=o.prototype=Object.create(C);i.prototype=R.constructor=a,a.constructor=i,a[w]=i.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,w in t||(t[w]="GeneratorFunction")),t.prototype=Object.create(R),t},O.awrap=function(t){return{__await:t}},s(u.prototype),u.prototype[x]=function(){return this},O.AsyncIterator=u,O.async=function(t,e,n,o){var i=new u(r(t,e,n,o));return O.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(R),R[w]="Generator",R[_]=function(){return this},R.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},O.values=h,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(d),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=g),!!n}if(this.done)throw t;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&b.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),d(r),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;d(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:h(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=g),T}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],513:[function(t,e,r){"use strict";function n(t,e){return t===e}function o(t,e,r){if(null===e||null===r||e.length!==r.length)return!1;for(var n=e.length,o=0;o<n;o++)if(!t(e[o],r[o]))return!1;return!0}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(e,r,arguments)||(i=t.apply(null,arguments)),r=arguments,i}}function a(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(t){return"function"==typeof t})){var r=e.map(function(t){return typeof t}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return e}function s(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];var s=0,u=n.pop(),l=a(n),c=t.apply(void 0,[function(){return s++,u.apply(null,arguments)}].concat(r)),f=i(function(){for(var t=[],e=l.length,r=0;r<e;r++)t.push(l[r].apply(null,arguments));return c.apply(null,t)});return f.resultFunc=u,f.recomputations=function(){return s},f.resetRecomputations=function(){return s=0},f}}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;if("object"!=typeof t)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof t);var r=Object.keys(t);return e(r.map(function(e){return t[e]}),function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce(function(t,e,n){return t[r[n]]=e,t},{})})}r.__esModule=!0,r.defaultMemoize=i,r.createSelectorCreator=s,r.createStructuredSelector=u;var l=r.createSelector=s(i)},{}],514:[function(t,e,r){"use strict";e.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},{}],515:[function(t,e,r){function n(t,e,r){this.f=t,this.once=e,this.priority=r}function o(){this.handlers=[]}function i(t,e){for(var r=0;r<t.handlers.length&&!(t.handlers[r].priority<e.priority);r++);t.handlers=t.handlers.slice(0,r).concat(e).concat(t.handlers.slice(r))}function a(){o.call(this)}function s(){o.call(this)}function u(){o.call(this)}r.Subscription=o,o.prototype.handlersForDispatch=function(){for(var t=this.handlers,e=null,r=t.length-1;r>=0;r--)t[r].once&&(e||(e=t.slice()),e.splice(r,1));return e&&(this.handlers=e),t},o.prototype.add=function(t,e){i(this,new n(t,!1,e||0))},o.prototype.addOnce=function(t,e){i(this,new n(t,!0,e||0))},o.prototype.remove=function(t){for(var e=0;e<this.handlers.length;e++)if(this.handlers[e].f==t)return void(this.handlers=this.handlers.slice(0,e).concat(this.handlers.slice(e+1)))},o.prototype.hasHandler=function(){return this.handlers.length>0},o.prototype.dispatch=function(){for(var t=this.handlersForDispatch(),e=0;e<t.length;e++)t[e].f.apply(null,arguments)},r.PipelineSubscription=a,a.prototype=new o,a.prototype.dispatch=function(t){for(var e=this.handlersForDispatch(),r=0;r<e.length;r++)t=e[r].f(t);return t},r.StoppableSubscription=s,s.prototype=new o,s.prototype.dispatch=function(){for(var t=this.handlersForDispatch(),e=0;e<t.length;e++){var r=t[e].f.apply(null,arguments);if(r)return r}},r.DOMSubscription=u,u.prototype=new o,u.prototype.dispatch=function(t){for(var e=this.handlersForDispatch(),r=0;r<e.length;r++)if(e[r].f(t)||t.defaultPrevented)return!0;return!1}},{}],516:[function(t,e,r){(function(n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o,i=t("./ponyfill.js"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==e?e:Function("return this")();var s=(0,a.default)(o);r.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill.js":517}],517:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],518:[function(t,e,r){(function(e,n){function o(t,e){this._id=t,this._clearFn=e}var i=t("process/browser.js").nextTick,a=Function.prototype.apply,s=Array.prototype.slice,u={},l=0;r.setTimeout=function(){return new o(a.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new o(a.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&s.call(arguments,1);return u[e]=!0,i(function(){u[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete u[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":491,timers:518}],519:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,r){if(t&&l.isObject(t)&&t instanceof n)return t;var o=new n;return o.parse(t,e,r),o}function i(t){return l.isString(t)&&(t=o(t)),t instanceof n?t.format():n.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function s(t,e){return t?o(t,!1,!0).resolveObject(e):e}var u=t("punycode"),l=t("./util");r.parse=o,r.resolve=a,r.resolveObject=s,r.format=i,r.Url=n;var c=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,d=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(h),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=t("querystring");n.prototype.parse=function(t,e,r){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),o=-1!==n&&n<t.indexOf("#")?"?":"#",i=t.split(o),a=/\\/g;i[0]=i[0].replace(a,"/"),t=i.join(o);var s=t;if(s=s.trim(),!r&&1===t.split("#").length){var f=d.exec(s);if(f)return this.path=s,this.href=s,this.pathname=f[1],f[2]?(this.search=f[2],this.query=e?S.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var p=c.exec(s);if(p){p=p[0];var h=p.toLowerCase();this.protocol=h,s=s.substr(p.length)}if(r||p||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var O="//"===s.substr(0,2);!O||p&&x[p]||(s=s.substr(2),this.slashes=!0)}if(!x[p]&&(O||p&&!w[p])){for(var A=-1,E=0;E<v.length;E++){var j=s.indexOf(v[E]);-1!==j&&(-1===A||j<A)&&(A=j)}var P,T;T=-1===A?s.lastIndexOf("@"):s.lastIndexOf("@",A),-1!==T&&(P=s.slice(0,T),s=s.slice(T+1),this.auth=decodeURIComponent(P)),A=-1;for(var E=0;E<g.length;E++){var j=s.indexOf(g[E]);-1!==j&&(-1===A||j<A)&&(A=j)}-1===A&&(A=s.length),this.host=s.slice(0,A),s=s.slice(A),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var k=this.hostname.split(/\./),E=0,M=k.length;E<M;E++){var R=k[E];if(R&&!R.match(b)){for(var N="",I=0,B=R.length;I<B;I++)R.charCodeAt(I)>127?N+="x":N+=R[I];if(!N.match(b)){var L=k.slice(0,E),D=k.slice(E+1),F=R.match(y);F&&(L.push(F[1]),D.unshift(F[2])),D.length&&(s="/"+D.join(".")+s),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=u.toASCII(this.hostname));var G=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+G,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[h])for(var E=0,M=m.length;E<M;E++){var H=m[E];if(-1!==s.indexOf(H)){var W=encodeURIComponent(H);W===H&&(W=escape(H)),s=s.split(H).join(W)}}var U=s.indexOf("#");-1!==U&&(this.hash=s.substr(U),s=s.slice(0,U));var V=s.indexOf("?");if(-1!==V?(this.search=s.substr(V),this.query=s.substr(V+1),e&&(this.query=S.parse(this.query)),s=s.slice(0,V)):e&&(this.search="",this.query={}),s&&(this.pathname=s),w[h]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",q=this.search||"";this.path=G+q}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(i=S.stringify(this.query));var a=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||w[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+r+a+n},n.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(l.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var r=new n,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(r[c]=t[c])}return w[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!w[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var p=f[d];r[p]=t[p]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||x[t.protocol])r.pathname=t.pathname;else{for(var h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var m=r.pathname||"",g=r.search||"";r.path=m+g}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=b||v||r.host&&t.pathname,_=y,S=r.pathname&&r.pathname.split("/")||[],h=t.pathname&&t.pathname.split("/")||[],O=r.protocol&&!w[r.protocol];if(O&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===h[0]?h[0]=t.host:h.unshift(t.host)),t.host=null),y=y&&(""===h[0]||""===S[0])),b)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=h;else if(h.length)S||(S=[]),S.pop(),S=S.concat(h),r.search=t.search,r.query=t.query;else if(!l.isNullOrUndefined(t.search)){if(O){r.hostname=r.host=S.shift();var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return r.search=t.search,r.query=t.query,l.isNull(r.pathname)&&l.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=S.slice(-1)[0],j=(r.host||t.host||S.length>1)&&("."===E||".."===E)||""===E,P=0,T=S.length;T>=0;T--)E=S[T],"."===E?S.splice(T,1):".."===E?(S.splice(T,1),P++):P&&(S.splice(T,1),P--);if(!y&&!_)for(;P--;P)S.unshift("..");!y||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),j&&"/"!==S.join("/").substr(-1)&&S.push("");var C=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(O){r.hostname=r.host=C?"":S.length?S.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return y=y||r.host&&S.length,y&&!C&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),l.isNull(r.pathname)&&l.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":520,punycode:497,querystring:501}],520:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],521:[function(t,e,r){function n(t){var e=c&&(t.ctrlKey||t.altKey||t.metaKey)||s&&t.shiftKey&&t.key&&1==t.key.length,r=!e&&t.key||(t.shiftKey?i:o)[t.keyCode]||t.key||"Unidentified";return"Esc"==r&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r}for(var o={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:";",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},a="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),u="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),l="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),c=a&&(l||+a[1]<57)||u&&l,f=0;f<10;f++)o[48+f]=o[96+f]=String(f);for(var f=1;f<=24;f++)o[f+111]="F"+f;for(var f=65;f<=90;f++)o[f]=String.fromCharCode(f+32),i[f]=String.fromCharCode(f);for(var d in o)i.hasOwnProperty(d)||(i[d]=o[d]);e.exports=n,n.base=o,n.shift=i},{}],522:[function(t,e,r){!function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function r(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return v.iterable&&(e[Symbol.iterator]=function(){return e}),e}function o(t){this.map={},t instanceof o?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function i(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function s(t){var e=new FileReader,r=a(e);return e.readAsArrayBuffer(t),r}function u(t){var e=new FileReader,r=a(e)
  ;return e.readAsText(t),r}function l(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function c(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(v.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(v.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(v.arrayBuffer&&v.blob&&y(t))this._bodyArrayBuffer=c(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!v.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!_(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=c(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob&&(this.blob=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return u(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(l(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function d(t){var e=t.toUpperCase();return x.indexOf(e)>-1?e:t}function p(t,e){e=e||{};var r=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new o(e.headers)),this.method=d(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function m(t){var e=new o;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}function g(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new o(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var v={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(v.arrayBuffer)var b=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=function(t){return t&&DataView.prototype.isPrototypeOf(t)},_=ArrayBuffer.isView||function(t){return t&&b.indexOf(Object.prototype.toString.call(t))>-1};o.prototype.append=function(t,n){t=e(t),n=r(n);var o=this.map[t];this.map[t]=o?o+","+n:n},o.prototype.delete=function(t){delete this.map[e(t)]},o.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},o.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},o.prototype.set=function(t,n){this.map[e(t)]=r(n)},o.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},o.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),n(t)},o.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},o.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),n(t)},v.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},f.call(p.prototype),f.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];g.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.Headers=o,t.Request=p,t.Response=g,t.fetch=function(t,e){return new Promise(function(r,n){var o=new p(t,e),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:m(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new g(e,t))},i.onerror=function(){n(new TypeError("Network request failed"))},i.ontimeout=function(){n(new TypeError("Network request failed"))},i.open(o.method,o.url,!0),"include"===o.credentials&&(i.withCredentials=!0),"responseType"in i&&v.blob&&(i.responseType="blob"),o.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],523:[function(t,e,r){"use strict";function n(t,e,r,n){return new Promise(function(o,i){function a(){t().then(function(t){try{e(t)?o(t):setTimeout(a,r)}catch(t){i(t)}},function(t){return i(t)})}setTimeout(a,n||0)})}function o(t,e){return t.replace(/:(\w+)/g,function(t,r){return e[r]})}function i(t,e){function r(t,e,r,n){return r&&"GET"===t&&(e=o(e,r)),fetch(a+e,{method:t,headers:Object.assign({Accept:"application/json"},n),body:"GET"!==t?r:void 0,credentials:"same-origin"}).then(function(t){return t.json().then(function(e){return t.ok?e:Promise.reject(e.error)})}).catch(function(t){throw Error(t)})}function i(t,n,o){return function(i,a){var u=Object.assign({},o,i);return u.options=Object.assign(u.options||{},e,a),s.then(function(){return r(t,n,JSON.stringify(u),{"Content-Type":"application/json"})})}}var a=!t||/\/$/.test(t)?t:t+"/",s=r("GET","info").then(function(t){return{indigoVersion:t.indigo_version,imagoVersions:t.imago_versions}}).catch(function(){throw Error("Server is not compatible")});return Object.assign(s,{convert:i("POST","indigo/convert"),layout:i("POST","indigo/layout"),clean:i("POST","indigo/clean"),aromatize:i("POST","indigo/aromatize"),dearomatize:i("POST","indigo/dearomatize"),calculateCip:i("POST","indigo/calculate_cip"),automap:i("POST","indigo/automap"),check:i("POST","indigo/check"),calculate:i("POST","indigo/calculate"),recognize:function(t,e){var o=e?"?version="+e:"",i=r("POST","imago/uploads"+o,t,{"Content-Type":t.type||"application/octet-stream"}),a=r.bind(null,"GET","imago/uploads/:id");return i.then(function(t){return n(a.bind(null,{id:t.upload_id}),function(t){if("FAILURE"===t.state)throw t;return"SUCCESS"===t.state},500,300)}).then(function(t){return{struct:t.metadata.mol_str}})}})}Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{}],524:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={H:["#000000","#000000"],He:["#89a1a1","#d9ffff"],Li:["#bd77ed","#cc80ff"],Be:["#8fbc00","#c2ff00"],B:["#c18989","#ffb5b5"],C:["#000000","#000000"],N:["#304ff7","#304ff7"],O:["#ff0d0d","#ff0d0d"],F:["#78bc42","#8fe04f"],Ne:["#80a2af","#b3e3f5"],Na:["#ab5cf2","#ab5cf2"],Mg:["#6fcd00","#8aff00"],Al:["#a99393","#bfa6a6"],Si:["#b29478","#f0c7a1"],P:["#ff8000","#ff8000"],S:["#c99a19","#d9a61a"],Cl:["#1fd01f","#1fd01f"],Ar:["#69acba","#80d1e3"],K:["#8f40d4","#8f40d4"],Ca:["#38e900","#3dff00"],Sc:["#999999","#e6e6e6"],Ti:["#979a9e","#bfc2c7"],V:["#99999e","#a6a6ab"],Cr:["#8a99c7","#8a99c7"],Mn:["#9c7ac7","#9c7ac7"],Fe:["#e06633","#e06633"],Co:["#d37e8e","#f08fa1"],Ni:["#4ece4e","#4fd14f"],Cu:["#c78033","#c78033"],Zn:["#7d80b0","#7d80b0"],Ga:["#bc8b8b","#c28f8f"],Ge:["#668f8f","#668f8f"],As:["#b87ddd","#bd80e3"],Se:["#e59100","#ffa100"],Br:["#a62929","#a62929"],Kr:["#59b1c9","#5cb8d1"],Rb:["#702eb0","#702eb0"],Sr:["#00ff00","#00ff00"],Y:["#66afaf","#94ffff"],Zr:["#71abab","#94e0e0"],Nb:["#67aeb4","#73c2c9"],Mo:["#54b5b5","#54b5b5"],Tc:["#3b9e9e","#3b9e9e"],Ru:["#248f8f","#248f8f"],Rh:["#0a7d8c","#0a7d8c"],Pd:["#006985","#006985"],Ag:["#9a9a9a","#bfbfbf"],Cd:["#b29764","#ffd98f"],In:["#a67573","#a67573"],Sn:["#668080","#668080"],Sb:["#9e63b5","#9e63b5"],Te:["#d47a00","#d47a00"],I:["#940094","#940094"],Xe:["#429eb0","#429eb0"],Cs:["#57178f","#57178f"],Ba:["#00c900","#00c900"],La:["#5caed1","#70d4ff"],Ce:["#9d9d7b","#ffffc7"],Pr:["#8ca581","#d9ffc7"],Nd:["#84a984","#c7ffc7"],Pm:["#71b18a","#a3ffc7"],Sm:["#66b68e","#8fffc7"],Eu:["#4ac298","#61ffc7"],Gd:["#37cb9e","#45ffc7"],Tb:["#28d1a4","#30ffc7"],Dy:["#1bd7a8","#1fffc7"],Ho:["#00e98f","#00ff9c"],Er:["#00e675","#00e675"],Tm:["#00d452","#00d452"],Yb:["#00bf38","#00bf38"],Lu:["#00ab24","#00ab24"],Hf:["#47b3ec","#4dc2ff"],Ta:["#4da6ff","#4da6ff"],W:["#2194d6","#2194d6"],Re:["#267dab","#267dab"],Os:["#266696","#266696"],Ir:["#175487","#175487"],Pt:["#9898a3","#d1d1e0"],Au:["#c19e1c","#ffd124"],Hg:["#9797ac","#b8b8d1"],Tl:["#a6544d","#a6544d"],Pb:["#575961","#575961"],Bi:["#9e4fb5","#9e4fb5"],Po:["#ab5c00","#ab5c00"],At:["#754f45","#754f45"],Rn:["#428296","#428296"],Fr:["#420066","#420066"],Ra:["#007d00","#007d00"],Ac:["#6aa2ec","#70abfa"],Th:["#00baff","#00baff"],Pa:["#00a1ff","#00a1ff"],U:["#008fff","#008fff"],Np:["#0080ff","#0080ff"],Pu:["#006bff","#006bff"],Am:["#545cf2","#545cf2"],Cm:["#785ce3","#785ce3"],Bk:["#8a4fe3","#8a4fe3"],Cf:["#a136d4","#a136d4"],Es:["#b31fd4","#b31fd4"],Fm:["#000000","#000000"],Md:["#000000","#000000"],No:["#000000","#000000"],Lr:["#000000","#000000"],Rf:["#47b3ec","#4dc2ff"],Db:["#4da6ff","#4da6ff"],Sg:["#2194d6","#2194d6"],Bh:["#267dab","#267dab"],Hs:["#266696","#266696"],Mt:["#175487","#175487"],Ds:["#9898a3","#d1d1e0"],Rg:["#c19e1c","#ffd124"],Cn:["#9797ac","#b8b8d1"],Nh:["#000000","#000000"],Fl:["#000000","#000000"],Mc:["#000000","#000000"],Lv:["#000000","#000000"],Ts:["#000000","#000000"],Og:["#000000","#000000"]};r.sketchingColors=Object.keys(n).reduce(function(t,e){return t[e]=n[e][0],t},{}),r.oldColors=Object.keys(n).reduce(function(t,e){return t[e]=n[e][1],t},{})},{}],525:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=[null,{label:"H",period:1,group:1,title:"Hydrogen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:1.00794},{label:"He",period:1,group:8,title:"Helium",state:"gas",origin:"primordial",type:"noble",atomic_mass:4.0026022},{label:"Li",period:2,group:1,title:"Lithium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:6.94},{label:"Be",period:2,group:2,title:"Beryllium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:9.01218315},{label:"B",period:2,group:3,title:"Boron",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:10.81},{label:"C",period:2,group:4,title:"Carbon",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:12.011},{label:"N",period:2,group:5,title:"Nitrogen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:14.007},{label:"O",period:2,group:6,leftH:!0,title:"Oxygen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:15.999},{label:"F",period:2,group:7,leftH:!0,title:"Fluorine",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:18.9984031636},{label:"Ne",period:2,group:8,title:"Neon",state:"gas",origin:"primordial",type:"noble",atomic_mass:20.17976},{label:"Na",period:3,group:1,title:"Sodium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:22.989769282},{label:"Mg",period:3,group:2,title:"Magnesium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:24.305},{label:"Al",period:3,group:3,title:"Aluminium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:26.98153857},{label:"Si",period:3,group:4,title:"Silicon",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:28.085},{label:"P",period:3,group:5,title:"Phosphorus",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:30.9737619985},{label:"S",period:3,group:6,leftH:!0,title:"Sulfur",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:32.06},{label:"Cl",period:3,group:7,leftH:!0,title:"Chlorine",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:35.45},{label:"Ar",period:3,group:8,title:"Argon",state:"gas",origin:"primordial",type:"noble",atomic_mass:39.9481},{label:"K",period:4,group:1,title:"Potassium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:39.09831},{label:"Ca",period:4,group:2,title:"Calcium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:40.0784},{label:"Sc",period:4,group:3,title:"Scandium",state:"solid",origin:"primordial",type:"transition",atomic_mass:44.9559085},{label:"Ti",period:4,group:4,title:"Titanium",state:"solid",origin:"primordial",type:"transition",atomic_mass:47.8671},{label:"V",period:4,group:5,title:"Vanadium",state:"solid",origin:"primordial",type:"transition",atomic_mass:50.94151},{label:"Cr",period:4,group:6,title:"Chromium",state:"solid",origin:"primordial",type:"transition",atomic_mass:51.99616},{label:"Mn",period:4,group:7,title:"Manganese",state:"solid",origin:"primordial",type:"transition",atomic_mass:54.9380443},{label:"Fe",period:4,group:8,title:"Iron",state:"solid",origin:"primordial",type:"transition",atomic_mass:55.8452},{label:"Co",period:4,group:8,title:"Cobalt",state:"solid",origin:"primordial",type:"transition",atomic_mass:58.9331944},{label:"Ni",period:4,group:8,title:"Nickel",state:"solid",origin:"primordial",type:"transition",atomic_mass:58.69344},{label:"Cu",period:4,group:1,title:"Copper",state:"solid",origin:"primordial",type:"transition",atomic_mass:63.5463},{label:"Zn",period:4,group:2,title:"Zinc",state:"solid",origin:"primordial",type:"transition",atomic_mass:65.382},{label:"Ga",period:4,group:3,title:"Gallium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:69.7231},{label:"Ge",period:4,group:4,title:"Germanium",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:72.6308},{label:"As",period:4,group:5,title:"Arsenic",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:74.9215956},{label:"Se",period:4,group:6,leftH:!0,title:"Selenium",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:78.9718},{label:"Br",period:4,group:7,leftH:!0,title:"Bromine",state:"liquid",origin:"primordial",type:"diatomic",atomic_mass:79.904},{label:"Kr",period:4,group:8,title:"Krypton",state:"gas",origin:"primordial",type:"noble",atomic_mass:83.7982},{label:"Rb",period:5,group:1,title:"Rubidium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:85.46783},{label:"Sr",period:5,group:2,title:"Strontium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:87.621},{label:"Y",period:5,group:3,title:"Yttrium",state:"solid",origin:"primordial",type:"transition",atomic_mass:88.905842},{label:"Zr",period:5,group:4,title:"Zirconium",state:"solid",origin:"primordial",type:"transition",atomic_mass:91.2242},{label:"Nb",period:5,group:5,title:"Niobium",state:"solid",origin:"primordial",type:"transition",atomic_mass:92.906372},{label:"Mo",period:5,group:6,title:"Molybdenum",state:"solid",origin:"primordial",type:"transition",atomic_mass:95.951},{label:"Tc",period:5,group:7,title:"Technetium",state:"solid",origin:"decay",type:"transition",atomic_mass:98},{label:"Ru",period:5,group:8,title:"Ruthenium",state:"solid",origin:"primordial",type:"transition",atomic_mass:101.072},{label:"Rh",period:5,group:8,title:"Rhodium",state:"solid",origin:"primordial",type:"transition",atomic_mass:102.905502},{label:"Pd",period:5,group:8,title:"Palladium",state:"solid",origin:"primordial",type:"transition",atomic_mass:106.421},{label:"Ag",period:5,group:1,title:"Silver",state:"solid",origin:"primordial",type:"transition",atomic_mass:107.86822},{label:"Cd",period:5,group:2,title:"Cadmium",state:"solid",origin:"primordial",type:"transition",atomic_mass:112.4144},{label:"In",period:5,group:3,title:"Indium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:114.8181},{label:"Sn",period:5,group:4,title:"Tin",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:118.7107},{label:"Sb",period:5,group:5,title:"Antimony",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:121.7601},{label:"Te",period:5,group:6,title:"Tellurium",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:127.603},{label:"I",period:5,group:7,leftH:!0,title:"Iodine",state:"solid",origin:"primordial",type:"diatomic",atomic_mass:126.904473},{label:"Xe",period:5,group:8,title:"Xenon",state:"gas",origin:"primordial",type:"noble",atomic_mass:131.2936},{label:"Cs",period:6,group:1,title:"Caesium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:132.905451966},{label:"Ba",period:6,group:2,title:"Barium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:137.3277},{label:"La",period:6,group:3,title:"Lanthanum",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:138.905477},{label:"Ce",period:6,group:3,title:"Cerium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:140.1161},{label:"Pr",period:6,group:3,title:"Praseodymium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:140.907662},{label:"Nd",period:6,group:3,title:"Neodymium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:144.2423},{label:"Pm",period:6,group:3,title:"Promethium",state:"solid",origin:"decay",type:"lanthanide",atomic_mass:145},{label:"Sm",period:6,group:3,title:"Samarium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:150.362},{label:"Eu",period:6,group:3,title:"Europium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:151.9641},{label:"Gd",period:6,group:3,title:"Gadolinium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:157.253},{label:"Tb",period:6,group:3,title:"Terbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:158.925352},{label:"Dy",period:6,group:3,title:"Dysprosium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:162.5001},{label:"Ho",period:6,group:3,title:"Holmium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:164.930332},{label:"Er",period:6,group:3,title:"Erbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:167.2593},{label:"Tm",period:6,group:3,title:"Thulium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:168.934222},{label:"Yb",period:6,group:3,title:"Ytterbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:173.0451},{label:"Lu",period:6,group:3,title:"Lutetium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:174.96681},{label:"Hf",period:6,group:4,title:"Hafnium",state:"solid",origin:"primordial",type:"transition",atomic_mass:178.492},{label:"Ta",period:6,group:5,title:"Tantalum",state:"solid",origin:"primordial",type:"transition",atomic_mass:180.947882},{label:"W",period:6,group:6,title:"Tungsten",state:"solid",origin:"primordial",type:"transition",atomic_mass:183.841},{label:"Re",period:6,group:7,title:"Rhenium",state:"solid",origin:"primordial",type:"transition",atomic_mass:186.2071},{label:"Os",period:6,group:8,title:"Osmium",state:"solid",origin:"primordial",type:"transition",atomic_mass:190.233},{label:"Ir",period:6,group:8,title:"Iridium",state:"solid",origin:"primordial",type:"transition",atomic_mass:192.2173},{label:"Pt",period:6,group:8,title:"Platinum",state:"solid",origin:"primordial",type:"transition",atomic_mass:195.0849},{label:"Au",period:6,group:1,title:"Gold",state:"solid",origin:"primordial",type:"transition",atomic_mass:196.9665695},{label:"Hg",period:6,group:2,title:"Mercury",state:"liquid",origin:"primordial",type:"transition",atomic_mass:200.5923},{label:"Tl",period:6,group:3,title:"Thallium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:204.38},{label:"Pb",period:6,group:4,title:"Lead",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:207.21},{label:"Bi",period:6,group:5,title:"Bismuth",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:208.980401},{label:"Po",period:6,group:6,title:"Polonium",state:"solid",origin:"decay",type:"post-transition",atomic_mass:209},{label:"At",period:6,group:7,title:"Astatine",state:"solid",origin:"decay",type:"metalloid",atomic_mass:210},{label:"Rn",period:6,group:8,title:"Radon",state:"gas",origin:"decay",type:"noble",atomic_mass:222},{label:"Fr",period:7,group:1,title:"Francium",state:"solid",origin:"decay",type:"alkali",atomic_mass:223},{label:"Ra",period:7,group:2,title:"Radium",state:"solid",origin:"decay",type:"alkaline-earth",atomic_mass:226},{label:"Ac",period:7,group:3,title:"Actinium",state:"solid",origin:"decay",type:"actinide",atomic_mass:227},{label:"Th",period:7,group:3,title:"Thorium",state:"solid",origin:"primordial",type:"actinide",atomic_mass:232.03774},{label:"Pa",period:7,group:3,title:"Protactinium",state:"solid",origin:"decay",type:"actinide",atomic_mass:231.035882},{label:"U",period:7,group:3,title:"Uranium",state:"solid",origin:"primordial",type:"actinide",atomic_mass:238.028913},{label:"Np",period:7,group:3,title:"Neptunium",state:"solid",origin:"decay",type:"actinide",atomic_mass:237},{label:"Pu",period:7,group:3,title:"Plutonium",state:"solid",origin:"decay",type:"actinide",atomic_mass:244},{label:"Am",period:7,group:3,title:"Americium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:243},{label:"Cm",period:7,group:3,title:"Curium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:247},{label:"Bk",period:7,group:3,title:"Berkelium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:247},{label:"Cf",period:7,group:3,title:"Californium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:251},{label:"Es",period:7,group:3,title:"Einsteinium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:252},{label:"Fm",period:7,group:3,title:"Fermium",origin:"synthetic",type:"actinide",atomic_mass:257},{label:"Md",period:7,group:3,title:"Mendelevium",origin:"synthetic",type:"actinide",atomic_mass:258},{label:"No",period:7,group:3,title:"Nobelium",origin:"synthetic",type:"actinide",atomic_mass:259},{label:"Lr",period:7,group:3,title:"Lawrencium",origin:"synthetic",type:"actinide",atomic_mass:266},{label:"Rf",period:7,group:4,title:"Rutherfordium",origin:"synthetic",type:"transition",atomic_mass:267},{label:"Db",period:7,group:5,title:"Dubnium",origin:"synthetic",type:"transition",atomic_mass:268},{label:"Sg",period:7,group:6,title:"Seaborgium",origin:"synthetic",type:"transition",atomic_mass:269},{label:"Bh",period:7,group:7,title:"Bohrium",origin:"synthetic",type:"transition",atomic_mass:270},{label:"Hs",period:7,group:8,title:"Hassium",origin:"synthetic",type:"transition",atomic_mass:269},{label:"Mt",period:7,group:8,title:"Meitnerium",origin:"synthetic",atomic_mass:278},{label:"Ds",period:7,group:8,title:"Darmstadtium",origin:"synthetic",atomic_mass:281},{label:"Rg",period:7,group:1,title:"Roentgenium",origin:"synthetic",atomic_mass:282},{label:"Cn",period:7,group:2,title:"Copernicium",origin:"synthetic",type:"transition",atomic_mass:285},{label:"Nh",period:7,group:3,title:"Nihonium",origin:"synthetic",atomic_mass:286},{label:"Fl",period:7,group:4,title:"Flerovium",origin:"synthetic",type:"post-transition",atomic_mass:289},{label:"Mc",period:7,group:5,title:"Moscovium",origin:"synthetic",atomic_mass:289},{label:"Lv",period:7,group:6,title:"Livermorium",origin:"synthetic",atomic_mass:293},{label:"Ts",period:7,group:7,title:"Tennessine",origin:"synthetic",atomic_mass:294},{label:"Og",period:7,group:8,title:"Oganesson",origin:"synthetic",atomic_mass:294}];n.map=n.reduce(function(t,e,r){return e&&(t[e.label]=r),t},{}),r.default=n},{}],526:[function(t,e,r){"use strict";function n(t,e,r){return Object.keys(t).reduce(function(r,o){return"labels"===o?t.labels.reduce(function(t,r){return t[r]=e||!0,t},r):n(t[o],e?e.concat(o):[o],r)},r||{})}function o(t,e){return e.reduce(function(t,e){return t&&t[e]||null},t)}Object.defineProperty(r,"__esModule",{value:!0});var i={atom:{any:{labels:["A","AH"]},"no-carbon":{labels:["Q","QH"]},metal:{labels:["M","MH"]},halogen:{labels:["X","XH"]}},group:{labels:["G","GH","G*","GH*"],acyclic:{labels:["ACY","ACH"],carbo:{labels:["ABC","ABH"],alkynyl:{labels:["AYL","AYH"]},alkyl:{labels:["ALK","ALH"]},alkenyl:{labels:["AEL","AEH"]}},hetero:{labels:["AHC","AHH"],alkoxy:{labels:["AOX","AOH"]}}},cyclic:{labels:["CYC","CYH"],"no-carbon":{labels:["CXX","CXH"]},carbo:{labels:["CBC","CBH"],aryl:{labels:["ARY","ARH"]},cycloalkyl:{labels:["CAL","CAH"]},cycloalkenyl:{labels:["CEL","CEH"]}},hetero:{labels:["CHC","CHH"],aryl:{labels:["HAR","HAH"]}}}},special:{labels:["H+","D","T","R","Pol"]}};i.map=n(i),i.map["*"]=i.map.A,i.get=function(t){return n(o(t))},r.default=i},{}],527:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(0===t[0].search("\\$MDL")){var e=x.default.parseRg2000(t);return e.name=t[3].trim(),e}var r=i(t.slice(3));return r.name=t[0].trim(),r}function i(t){var e=y(t[0],P.default.fmtInfo.countsLinePartition),r=e[11].trim();if(t=t.slice(1),"V2000"===r)return x.default.parseCTabV2000(t,e);if("V3000"===r)return S.default.parseCTabV3000(t,!T);throw new Error("Molfile version unknown: "+r)}function a(t,e){var r=t[0].trim().split(" ");if(r.length>1&&"V3000"===r[1])return S.default.parseRxn3000(t,e);var n=x.default.parseRxn2000(t,e);return n.name=t[1].trim(),n}function s(t,e){var r=[];if(e.bonds.forEach(function(n,o){var i=e.atoms.get(n.begin),a=e.atoms.get(n.end);(i.sgs.has(t.id)&&!a.sgs.has(t.id)||a.sgs.has(t.id)&&!i.sgs.has(t.id))&&r.push(o)},t),0!==r.length&&2!==r.length)throw{id:t.id,"error-type":"cross-bond-number",message:"Unsupported cross-bonds number"};t.bonds=r}function u(t,e){var r=[];e.bonds.forEach(function(n,o){var i=e.atoms.get(n.begin),a=e.atoms.get(n.end);(i.sgs.has(t.id)&&!a.sgs.has(t.id)||a.sgs.has(t.id)&&!i.sgs.has(t.id))&&r.push(o)},t),t.bonds=r}function l(t,e){}function c(t,e){t.atoms=E.SGroup.getAtoms(e,t)}function f(t,e,r,n,o){var i=(r[t.id]+"").padStart(3),a=[];a=a.concat(g("SAL",i,Array.from(t.atomSet.values()),n)),a=a.concat(g("SPA",i,Array.from(t.parentAtomSet.values()),n)),a=a.concat(g("SBL",i,t.bonds,o));var s="M  SMT "+i+" "+t.data.mul;return a.push(s),a=a.concat(v(e,t,i)),a.join("\n")}function d(t,e,r,n,o){var i=(r[t.id]+"").padStart(3),a=[];return a=a.concat(g("SAL",i,t.atoms,n)),a=a.concat(g("SBL",i,t.bonds,o)),a=a.concat(v(e,t,i)),a.join("\n")}function p(t,e,r,n,o){var i=(r[t.id]+"").padStart(3),a=[];return a=a.concat(g("SAL",i,t.atoms,n)),a=a.concat(g("SBL",i,t.bonds,o)),t.data.name&&""!==t.data.name&&a.push("M  SMT "+i+" "+t.data.name),a.join("\n")}function h(t,e,r,n){var o=(r[t.id]+"").padStart(3),i=t.data,a=t.pp;i.absolute||(a=a.sub(E.SGroup.getMassCentre(e,t.atoms)));var s=[];s=s.concat(g("SAL",o,t.atoms,n));var u="M  SDT "+o+" "+(i.fieldName||"").padEnd(30)+(i.fieldType||"").padStart(2)+(i.units||"").padEnd(20)+(i.query||"").padStart(2);i.queryOp&&(u+=i.queryOp.padEnd(15)),s.push(u);var l="M  SDD "+o+" "+P.default.paddedNum(a.x,10,4)+P.default.paddedNum(-a.y,10,4)+"    "+(i.attached?"A":"D")+(i.absolute?"A":"R")+(i.showUnits?"U":" ")+"   "+(i.nCharnCharsToDisplay>=0?P.default.paddedNum(i.nCharnCharsToDisplay,3):"ALL")+"  1   "+(i.tagChar||" ")+"  "+P.default.paddedNum(i.daspPos,1)+"  ";s.push(l);var c=b(i.fieldValue).replace(/\n*$/,"");return c.split("\n").forEach(function(t){for(;t.length>69;)s.push("M  SCD "+o+" "+t.slice(0,69)),t=t.slice(69);s.push("M  SED "+o+" "+t)}),s.join("\n")}function m(t,e,r,n,o){var i=(r[t.id]+"").padStart(3),a=[];return a=a.concat(g("SAL",i,t.atoms,n)),a=a.concat(g("SBL",i,t.bonds,o)),a=a.concat(v(e,t,i)),a.join("\n")}function g(t,e,r,n){if(!r)return[];for(var o=[],i=0;i<Math.floor((r.length+14)/15);++i){for(var a=Math.min(r.length-15*i,15),s="M  "+t+" "+e+" "+P.default.paddedNum(a,2),u=0;u<a;++u)s+=" "+P.default.paddedNum(n[r[15*i+u]],3);o.push(s)}return o}function v(t,e,r){var n=[],o=[],i=new A.default(e.atoms);E.SGroup.getCrossBonds(n,o,t,i),E.SGroup.bracketPos(e,t,o);for(var a=e.bracketBox,s=e.bracketDir,u=s.rotateSC(1,0),l=E.SGroup.getBracketParameters(t,o,i,a,s,u),c=[],f=0;f<l.length;++f){for(var d=l[f],p=d.c.addScaled(d.n,-.5*d.h).yComplement(),h=d.c.addScaled(d.n,.5*d.h).yComplement(),m="M  SDI "+r+P.default.paddedNum(4,3),g=[p.x,p.y,h.x,h.y],v=0;v<g.length;++v)m+=P.default.paddedNum(g[v],10,4);c.push(m)}return c}function b(t){return t.replace(M,"\n")}function y(t,e,r){for(var n=[],o=0,i=0;o<e.length;++o)n.push(t.slice(i,i+e[o])),r&&i++,i+=e[o];return n}Object.defineProperty(r,"__esModule",{value:!0});var _=t("./v2000"),x=n(_),w=t("./v3000"),S=n(w),O=t("../../util/pile"),A=n(O),E=t("./../struct/index"),j=t("./utils"),P=n(j),T=!0,C={MUL:E.SGroup.prepareMulForSaving,SRU:s,SUP:u,DAT:c,GEN:l},k={MUL:f,SRU:d,SUP:p,DAT:h,GEN:m},M=/\r\n|[\n\r]/g;r.default={parseCTab:i,parseMol:o,parseRxn:a,prepareForSaving:C,saveToMolfile:k}},{"../../util/pile":688,"./../struct/index":542,"./utils":531,"./v2000":532,"./v3000":533}],528:[function(t,e,r){"use strict";function n(t,e){var r=new i.default,n=t.split(/\r\n|[\n\r]/g);try{return r.parseCTFile(n,e.reactionRelayout)}catch(t){if(e.badHeaderRecover){try{return r.parseCTFile(n.slice(1),e.reactionRelayout)}catch(t){}try{return r.parseCTFile([""].concat(n),e.reactionRelayout)}catch(t){}}throw t}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./molfile"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);r.default={stringify:function(t,e){var r=e||{};return new i.default(r.v3000).saveMolecule(t,r.ignoreErrors,r.noRgroups,r.preserveIndigoDesc)},parse:function(t,e){return n(t,e||{})}}},{"./molfile":529}],529:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.molecule=null,this.molfile=null,this.v3000=t||!1}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./../element"),a=n(i),s=t("./common"),u=n(s),l=t("./utils"),c=n(l);o.prototype.parseCTFile=function(t,e){var r=null;return r=0===t[0].search("\\$RXN")?u.default.parseRxn(t,e):u.default.parseMol(t),r.initHalfBonds(),r.initNeighbors(),r.markFragments(),r},o.prototype.prepareSGroups=function(t,e){var r=this.molecule,n=[],o=0;if(this.molecule.sGroupForest.getSGroupsBFS().reverse().forEach(function(i){var a=r.sgroups.get(i),s=!1;try{u.default.prepareForSaving[a.type](a,r)}catch(e){if(!t||"number"!=typeof e.id)throw new Error("Error: "+e.message);s=!0}(s||!e&&/^INDIGO_.+_DESC$/i.test(a.data.fieldName))&&(o+=s,n.push(a.id))},this),o)throw new Error("Warning: "+o+" invalid S-groups were detected. They will be omitted.");for(var i=0;i<n.length;++i)r.sGroupDelete(n[i]);return r},o.prototype.getCTab=function(t,e){return this.molecule=t.clone(),this.prepareSGroups(!1,!1),this.molfile="",
  this.writeCTab2000(e),this.molfile},o.prototype.saveMolecule=function(t,e,r,n){var i=this;if(this.reaction=t.rxnArrows.size>0,t.rxnArrows.size>1)throw new Error("Reaction may not contain more than one arrow");if(this.molfile=""+t.name,this.reaction){if(t.rgroups.size>0)throw new Error("Reactions with r-groups are not supported at the moment");var a=t.getComponents(),s=a.reactants,u=a.products,l=s.concat(u);this.molfile="$RXN\n"+t.name+"\n\n\n"+c.default.paddedNum(s.length,3)+c.default.paddedNum(u.length,3)+c.default.paddedNum(0,3)+"\n";for(var f=0;f<l.length;++f){var d=new o(!1),p=t.clone(l[f],null,!0),h=d.saveMolecule(p,!1,!0);this.molfile+="$MOL\n"+h}return this.molfile}if(t.rgroups.size>0){if(!r){var m=new o(!1).getCTab(t.getScaffold(),t.rgroups);return this.molfile="$MDL  REV  1\n$MOL\n$HDR\n"+t.name+"\n\n\n$END HDR\n",this.molfile+="$CTAB\n"+m+"$END CTAB\n",t.rgroups.forEach(function(e,r){i.molfile+="$RGP\n",i.writePaddedNumber(r,3),i.molfile+="\n",e.frags.forEach(function(e){var r=new o(!1).getCTab(t.getFragment(e));i.molfile+="$CTAB\n"+r+"$END CTAB\n"}),i.molfile+="$END RGP\n"}),this.molfile+="$END MOL\n",this.molfile}t=t.getScaffold()}return this.molecule=t.clone(),this.prepareSGroups(e,n),this.writeHeader(),this.writeCTab2000(),this.molfile},o.prototype.writeHeader=function(){var t=new Date;this.writeCR(),this.writeWhiteSpace(2),this.write("Ketcher"),this.writeWhiteSpace(),this.writeCR((t.getMonth()+1+"").padStart(2)+(t.getDate()+"").padStart(2)+(t.getFullYear()%100+"").padStart(2)+(t.getHours()+"").padStart(2)+(t.getMinutes()+"").padStart(2)+"2D 1   1.00000     0.00000     0"),this.writeCR()},o.prototype.write=function(t){this.molfile+=t},o.prototype.writeCR=function(t){0==arguments.length&&(t=""),this.molfile+=t+"\n"},o.prototype.writeWhiteSpace=function(t){0==arguments.length&&(t=1),this.write(" ".repeat(Math.max(t,0)))},o.prototype.writePadded=function(t,e){this.write(t),this.writeWhiteSpace(e-t.length)},o.prototype.writePaddedNumber=function(t,e){var r=(t-0).toString();this.writeWhiteSpace(e-r.length),this.write(r)},o.prototype.writePaddedFloat=function(t,e,r){this.write(c.default.paddedNum(t,e,r))},o.prototype.writeCTab2000Header=function(){this.writePaddedNumber(this.molecule.atoms.size,3),this.writePaddedNumber(this.molecule.bonds.size,3),this.writePaddedNumber(0,3),this.writeWhiteSpace(3),this.writePaddedNumber(this.molecule.isChiral?1:0,3),this.writePaddedNumber(0,3),this.writeWhiteSpace(12),this.writePaddedNumber(999,3),this.writeCR(" V2000")},o.prototype.writeCTab2000=function(t){function e(t,e){for(var r=this;e.length>0;){for(var n=[];e.length>0&&n.length<8;)n.push(e[0]),e.splice(0,1);this.write(t),this.writePaddedNumber(n.length,3),n.forEach(function(t){r.writeWhiteSpace(),r.writePaddedNumber(r.mapping[t[0]],3),r.writeWhiteSpace(),r.writePaddedNumber(t[1],3)}),this.writeCR()}}var r=this;this.writeCTab2000Header(),this.mapping={};var n=1,o=[],i=[];for(this.molecule.atoms.forEach(function(t,e){r.writePaddedFloat(t.pp.x,10,4),r.writePaddedFloat(-t.pp.y,10,4),r.writePaddedFloat(t.pp.z,10,4),r.writeWhiteSpace();var s=t.label;null!=t.atomList?(s="L",o.push(e)):t.pseudo?t.pseudo.length>3&&(s="A",i.push({id:e,value:"'"+t.pseudo+"'"})):t.alias?i.push({id:e,value:t.alias}):a.default.map[s]||-1!=["A","Q","X","*","R#"].indexOf(s)||(s="C",i.push({id:e,value:t.label})),r.writePadded(s,3),r.writePaddedNumber(0,2),r.writePaddedNumber(0,3),r.writePaddedNumber(0,3),void 0===t.hCount&&(t.hCount=0),r.writePaddedNumber(t.hCount,3),void 0===t.stereoCare&&(t.stereoCare=0),r.writePaddedNumber(t.stereoCare,3),r.writePaddedNumber(t.explicitValence<0?0:0==t.explicitValence?15:t.explicitValence,3),r.writePaddedNumber(0,3),r.writePaddedNumber(0,3),r.writePaddedNumber(0,3),void 0===t.aam&&(t.aam=0),r.writePaddedNumber(t.aam,3),void 0===t.invRet&&(t.invRet=0),r.writePaddedNumber(t.invRet,3),void 0===t.exactChangeFlag&&(t.exactChangeFlag=0),r.writePaddedNumber(t.exactChangeFlag,3),r.writeCR(),r.mapping[e]=n,n++},this),this.bondMapping={},n=1,this.molecule.bonds.forEach(function(t,e){r.bondMapping[e]=n++,r.writePaddedNumber(r.mapping[t.begin],3),r.writePaddedNumber(r.mapping[t.end],3),r.writePaddedNumber(t.type,3),void 0===t.stereo&&(t.stereo=0),r.writePaddedNumber(t.stereo,3),r.writePadded(t.xxx,3),void 0===t.topology&&(t.topology=0),r.writePaddedNumber(t.topology,3),void 0===t.reactingCenterStatus&&(t.reactingCenterStatus=0),r.writePaddedNumber(t.reactingCenterStatus,3),r.writeCR()});i.length>0;)this.write("A  "),this.writePaddedNumber(i[0].id+1,3),this.writeCR(),this.writeCR(i[0].value),i.splice(0,1);var s=[],l=[],f=[],d=[],p=[],h=[],m=[],g=[],v=[];this.molecule.atoms.forEach(function(t,e){if(0!=t.charge&&s.push([e,t.charge]),0!=t.isotope&&l.push([e,t.isotope]),0!=t.radical&&f.push([e,t.radical]),null!=t.rglabel&&"R#"==t.label)for(var r=0;r<32;r++)t.rglabel&1<<r&&d.push([e,r+1]);null!=t.attpnt&&h.push([e,t.attpnt]),0!=t.ringBondCount&&m.push([e,t.ringBondCount]),0!=t.substitutionCount&&v.push([e,t.substitutionCount]),0!=t.unsaturatedAtom&&g.push([e,t.unsaturatedAtom])}),t&&t.forEach(function(t,e){if(t.resth||t.ifthen>0||t.range.length>0){var r="  1 "+c.default.paddedNum(e,3)+" "+c.default.paddedNum(t.ifthen,3)+" "+c.default.paddedNum(t.resth?1:0,3)+"   "+t.range;p.push(r)}}),e.call(this,"M  CHG",s),e.call(this,"M  ISO",l),e.call(this,"M  RAD",f),e.call(this,"M  RGP",d);for(var b=0;b<p.length;++b)this.write("M  LOG"+p[b]+"\n");if(e.call(this,"M  APO",h),e.call(this,"M  RBC",m),e.call(this,"M  SUB",v),e.call(this,"M  UNS",g),o.length>0)for(b=0;b<o.length;++b){var y=o[b],_=this.molecule.atoms.get(y).atomList;this.write("M  ALS"),this.writePaddedNumber(y+1,4),this.writePaddedNumber(_.ids.length,3),this.writeWhiteSpace(),this.write(_.notList?"T":"F");for(var x=_.labelList(),w=0;w<x.length;++w)this.writeWhiteSpace(),this.writePadded(x[w],3);this.writeCR()}var S={},O=1,A={};this.molecule.sGroupForest.getSGroupsBFS().forEach(function(t){A[O]=t,S[t]=O++});for(var E=1;E<O;++E){var j=A[E],P=this.molecule.sgroups.get(j);this.write("M  STY"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(E,3),this.writeWhiteSpace(1),this.writePadded(P.type,3),this.writeCR(),this.write("M  SLB"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(E,3),this.writeWhiteSpace(1),this.writePaddedNumber(E,3),this.writeCR();var T=this.molecule.sGroupForest.parent.get(j);if(T>=0&&(this.write("M  SPL"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(E,3),this.writeWhiteSpace(1),this.writePaddedNumber(S[T],3),this.writeCR()),"SRU"==P.type&&P.data.connectivity){var C="";C+=" ",C+=E.toString().padStart(3),C+=" ",C+=(P.data.connectivity||"").padEnd(3),this.write("M  SCN"),this.writePaddedNumber(1,3),this.write(C.toUpperCase()),this.writeCR()}"SRU"==P.type&&(this.write("M  SMT "),this.writePaddedNumber(E,3),this.writeWhiteSpace(),this.write(P.data.subscript||"n"),this.writeCR()),this.writeCR(u.default.saveToMolfile[P.type](P,this.molecule,S,this.mapping,this.bondMapping))}this.writeCR("M  END")},r.default=o},{"./../element":525,"./common":527,"./utils":531}],530:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){for(var r=new C.default,n=R.default.partitionLineFixed(t,3,!0),o=R.default.parseDecimalInt(n[0]),i=0;i<o;++i){var a=R.default.parseDecimalInt(n[2*i+1])-1,s=e?n[2*i+2].trim():R.default.parseDecimalInt(n[2*i+2]);r.set(a,s)}return r}function i(t,e){for(var r=[],n=R.default.partitionLineFixed(t,3,!0),o=R.default.parseDecimalInt(n[0]),i=0;i<o;++i)r.push([R.default.parseDecimalInt(n[2*i+1])-1,e?n[2*i+2].trim():R.default.parseDecimalInt(n[2*i+2])]);return r}function a(t,e,r){t.data.mul=t.data.subscript-0;var n={};t.atoms=k.SGroup.filterAtoms(t.atoms,r),t.patoms=k.SGroup.filterAtoms(t.patoms,r);for(var o=1;o<t.data.mul;++o)for(var i=0;i<t.patoms.length;++i){var a=t.atoms[o*t.patoms.length+i];if(!(a<0)){if(t.patoms[i]<0)throw new Error("parent atom missing");n[a]=t.patoms[i]}}t.patoms=k.SGroup.removeNegative(t.patoms);var s=A(t.patoms),u=[];e.bonds.forEach(function(t,e){var r=t.begin in n,o=t.end in n;r&&o||r&&t.end in s||o&&t.begin in s?u.push(e):r?t.begin=n[t.begin]:o&&(t.end=n[t.end])},t);for(var l=0;l<u.length;++l)e.bonds.delete(u[l]);for(var c in n)e.atoms.delete(+c),r[c]=-1;t.atoms=t.patoms,t.patoms=null}function s(t){t.data.connectivity=(t.data.connectivity||"EU").trim().toLowerCase()}function u(t){t.data.name=(t.data.subscript||"").trim(),t.data.subscript=""}function l(t,e,r){}function c(t,e){t.data.absolute||(t.pp=t.pp.add(k.SGroup.getMassCentre(e,t.atoms)))}function f(t,e,r){var n={MUL:a,SRU:s,SUP:u,DAT:c,GEN:l};e.id=t.sgroups.add(e),n[e.type](e,t,r);for(var o=0;o<e.atoms.length;++o)t.atoms.has(e.atoms[o])&&t.atoms.get(e.atoms[o]).sgs.add(e.id);return"DAT"===e.type?t.sGroupForest.insert(e.id,-1,[]):t.sGroupForest.insert(e.id),e.id}function d(t,e){var r=o(e,!0),n=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(n=(s=u.next()).done);n=!0){var l=s.value,c=E(l,2),f=c[0],d=c[1];if(!(d in k.SGroup.TYPES))throw new Error("Unsupported S-group type");var p=new k.SGroup(d);p.number=f,t[f]=p}}catch(t){i=!0,a=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw a}}}function p(t,e,r,n,i){var a=o(r,!n),s=!0,u=!1,l=void 0;try{for(var c,f=a.keys()[Symbol.iterator]();!(s=(c=f.next()).done);s=!0){var d=c.value;(i?t[d]:t[d].data)[e]=a.get(d)}}catch(t){u=!0,l=t}finally{try{!s&&f.return&&f.return()}finally{if(u)throw l}}}function h(t,e,r,n){var o=R.default.parseDecimalInt(r.slice(1,4))-1,i=R.default.parseDecimalInt(r.slice(4,8)),a=S(R.default.partitionLineFixed(r.slice(8),3,!0));if(a.length!==i)throw new Error("File format invalid");n&&(a=a.map(function(t){return t+n})),t[o][e]=t[o][e].concat(a)}function m(t,e){t.data.fieldName=e}function g(t,e){t.data.query=e}function v(t,e){t.data.queryOp=e}function b(t,e){var r=R.default.partitionLine(e,[4,31,2,20,2,3],!1),n=R.default.parseDecimalInt(r[0])-1,o=r[1].trim(),i=r[2].trim(),a=r[3].trim(),s=r[4].trim(),u=r[5].trim(),l=t[n];l.data.fieldType=i,l.data.fieldName=o,l.data.units=a,l.data.query=s,l.data.queryOp=u}function y(t,e){var r=R.default.partitionLine(e,[10,10,4,1,1,1,3,3,3,3,2,3,2],!1),n=parseFloat(r[0]),o=parseFloat(r[1]),i="A"==r[3].trim(),a="A"==r[4].trim(),s="U"==r[5].trim(),u=r[7].trim();u="ALL"==u?-1:R.default.parseDecimalInt(u);var l=r[10].trim(),c=R.default.parseDecimalInt(r[11].trim());t.pp=new P.default(n,-o),t.data.attached=i,t.data.absolute=a,t.data.showUnits=s,t.data.nCharsToDisplay=u,t.data.tagChar=l,t.data.daspPos=c}function _(t,e){y(t[R.default.parseDecimalInt(e.substr(0,4))-1],e.substr(5))}function x(t,e,r){t.data.fieldValue=(t.data.fieldValue||"")+e,r&&(t.data.fieldValue=O(t.data.fieldValue),t.data.fieldValue.startsWith('"')&&t.data.fieldValue.endsWith('"')&&(t.data.fieldValue=t.data.fieldValue.substr(1,t.data.fieldValue.length-2)))}function w(t,e,r){var n=R.default.parseDecimalInt(e.substr(0,5))-1,o=e.substr(5);x(t[n],o,r)}function S(t){for(var e=[],r=0;r<t.length;++r)e[r]=R.default.parseDecimalInt(t[r]);return e}function O(t){return t.replace(/\s+$/,"")}function A(t){for(var e={},r=0;r<t.length;++r)e[t[r]]=t[r];return e}Object.defineProperty(r,"__esModule",{value:!0});var E=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),j=t("../../util/vec2"),P=n(j),T=t("../../util/pool"),C=n(T),k=t("./../struct/index"),M=t("./utils"),R=n(M);r.default={readKeyValuePairs:o,readKeyMultiValuePairs:i,loadSGroup:f,initSGroup:d,applySGroupProp:p,applySGroupArrayProp:h,applyDataSGroupName:m,applyDataSGroupQuery:g,applyDataSGroupQueryOp:v,applyDataSGroupDesc:b,applyDataSGroupInfo:y,applyDataSGroupData:x,applyDataSGroupInfoLine:_,applyDataSGroupDataLine:w}},{"../../util/pool":689,"../../util/vec2":691,"./../struct/index":542,"./utils":531}],531:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){t=parseFloat(t);var n=t.toFixed(r||0).replace(",",".");if(n.length>e)throw new Error("number does not fit");return n.padStart(e)}function i(t){var e=parseInt(t,10);return isNaN(e)?0:e}function a(t,e,r){for(var n=[],o=0,i=0;o<e.length;++o)n.push(t.slice(i,i+e[o])),r&&i++,i+=e[o];return n}function s(t,e,r){for(var n=[],o=0;o<t.length;o+=e)n.push(t.slice(o,o+e)),r&&o++;return n}function u(t,e,r,n,o){function i(t,e,r,n,o){var i=new c.default(n-r.min.x,o?1-r.min.y:-(r.min.y+r.max.y)/2);return e.atoms.forEach(function(t){t.pp.add_(i)}),e.sgroups.forEach(function(t){t.pp&&t.pp.add_(i)}),r.min.add_(i),r.max.add_(i),e.mergeInto(t),r.max.x-r.min.x}var a,s=new d.default,u=[],l=[],p=[],g=[],v=[],b=[],y={cnt:0,totalLength:0};for(a=0;a<t.length;++a){var _=t[a],x=_.getBondLengthData();y.cnt+=x.cnt,y.totalLength+=x.totalLength}if(m){var w=1/(0==y.cnt?1:y.totalLength/y.cnt);for(a=0;a<t.length;++a)_=t[a],_.scale(w)}for(a=0;a<t.length;++a){_=t[a];var S=_.getCoordBoundingBoxObj();if(S){var O=a<e?h.REACTANT:a<e+r?h.PRODUCT:h.AGENT;O==h.REACTANT?(u.push(S),g.push(_)):O==h.AGENT?(l.push(S),v.push(_)):O==h.PRODUCT&&(p.push(S),b.push(_)),_.atoms.forEach(function(t){t.rxnFragmentType=O})}}if(o){var A=0;for(a=0;a<g.length;++a)A+=i(s,g[a],u[a],A,!1)+2;for(A+=2,a=0;a<v.length;++a)A+=i(s,v[a],l[a],A,!0)+2;for(A+=2,a=0;a<b.length;++a)A+=i(s,b[a],p[a],A,!1)+2}else{for(a=0;a<g.length;++a)g[a].mergeInto(s);for(a=0;a<v.length;++a)v[a].mergeInto(s);for(a=0;a<b.length;++a)b[a].mergeInto(s)}var E,j,P,T,C=null,k=null;for(a=0;a<u.length-1;++a)E=u[a],j=u[a+1],P=(E.max.x+j.min.x)/2,T=(E.max.y+E.min.y+j.max.y+j.min.y)/4,s.rxnPluses.add(new f.RxnPlus({pp:new c.default(P,T)}));for(a=0;a<u.length;++a)0==a?(C={},C.max=new c.default(u[a].max),C.min=new c.default(u[a].min)):(C.max=c.default.max(C.max,u[a].max),C.min=c.default.min(C.min,u[a].min));for(a=0;a<p.length-1;++a)E=p[a],j=p[a+1],P=(E.max.x+j.min.x)/2,T=(E.max.y+E.min.y+j.max.y+j.min.y)/4,s.rxnPluses.add(new f.RxnPlus({pp:new c.default(P,T)}));for(a=0;a<p.length;++a)0==a?(k={},k.max=new c.default(p[a].max),k.min=new c.default(p[a].min)):(k.max=c.default.max(k.max,p[a].max),k.min=c.default.min(k.min,p[a].min));if(E=C,j=k,E||j){var M=E?new c.default(E.max.x,(E.max.y+E.min.y)/2):null,R=j?new c.default(j.min.x,(j.max.y+j.min.y)/2):null;M||(M=new c.default(R.x-3,R.y)),R||(R=new c.default(M.x+3,M.y)),s.rxnArrows.add(new f.RxnArrow({pp:c.default.lc2(M,.5,R,.5)}))}else s.rxnArrows.add(new f.RxnArrow({pp:new c.default(0,0)}));return s.isReaction=!0,s}Object.defineProperty(r,"__esModule",{value:!0});var l=t("../../util/vec2"),c=n(l),f=t("./../struct/index"),d=n(f),p={bondTypeMap:{1:f.Bond.PATTERN.TYPE.SINGLE,2:f.Bond.PATTERN.TYPE.DOUBLE,3:f.Bond.PATTERN.TYPE.TRIPLE,4:f.Bond.PATTERN.TYPE.AROMATIC,5:f.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE,6:f.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC,7:f.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC,8:f.Bond.PATTERN.TYPE.ANY},bondStereoMap:{0:f.Bond.PATTERN.STEREO.NONE,1:f.Bond.PATTERN.STEREO.UP,4:f.Bond.PATTERN.STEREO.EITHER,6:f.Bond.PATTERN.STEREO.DOWN,3:f.Bond.PATTERN.STEREO.CIS_TRANS},v30bondStereoMap:{0:f.Bond.PATTERN.STEREO.NONE,1:f.Bond.PATTERN.STEREO.UP,2:f.Bond.PATTERN.STEREO.EITHER,3:f.Bond.PATTERN.STEREO.DOWN},bondTopologyMap:{0:f.Bond.PATTERN.TOPOLOGY.EITHER,1:f.Bond.PATTERN.TOPOLOGY.RING,2:f.Bond.PATTERN.TOPOLOGY.CHAIN},countsLinePartition:[3,3,3,3,3,3,3,3,3,3,3,6],atomLinePartition:[10,10,10,1,3,2,3,3,3,3,3,3,3,3,3,3,3],bondLinePartition:[3,3,3,3,3,3,3],atomListHeaderPartition:[3,1,1,4,1,1],atomListHeaderLength:11,atomListHeaderItemLength:4,chargeMap:[0,3,2,1,0,-1,-2,-3],valenceMap:[void 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,0],implicitHydrogenMap:[void 0,0,1,2,3,4],v30atomPropMap:{CHG:"charge",RAD:"radical",MASS:"isotope",VAL:"explicitValence",HCOUNT:"hCount",INVRET:"invRet",SUBST:"substitutionCount",UNSAT:"unsaturatedAtom",RBCNT:"ringBondCount"},rxnItemsPartition:[3,3,3]},h={NONE:0,REACTANT:1,PRODUCT:2,AGENT:3},m=!0;r.default={fmtInfo:p,paddedNum:o,parseDecimalInt:i,partitionLine:a,partitionLineFixed:s,rxnMerge:u}},{"../../util/vec2":691,"./../struct/index":542}],532:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=j.default.partitionLine(t,j.default.fmtInfo.atomLinePartition),r={pp:new v.default(parseFloat(e[0]),-parseFloat(e[1]),parseFloat(e[2])),label:e[4].trim(),explicitValence:j.default.fmtInfo.valenceMap[j.default.parseDecimalInt(e[10])],massDifference:j.default.parseDecimalInt(e[5]),charge:j.default.fmtInfo.chargeMap[j.default.parseDecimalInt(e[6])],hCount:j.default.parseDecimalInt(j.default.parseDecimalInt(e[8])),stereoCare:0!=j.default.parseDecimalInt(e[9]),aam:j.default.parseDecimalInt(e[14]),invRet:j.default.parseDecimalInt(e[15]),exactChangeFlag:0!=j.default.parseDecimalInt(e[16])};return new w.Atom(r)}function i(t){var e=j.default.partitionLine(t,j.default.fmtInfo.bondLinePartition),r={begin:j.default.parseDecimalInt(e[0])-1,end:j.default.parseDecimalInt(e[1])-1,type:j.default.fmtInfo.bondTypeMap[j.default.parseDecimalInt(e[2])],stereo:j.default.fmtInfo.bondStereoMap[j.default.parseDecimalInt(e[3])],xxx:e[4],topology:j.default.fmtInfo.bondTopologyMap[j.default.parseDecimalInt(e[5])],reactingCenterStatus:j.default.parseDecimalInt(e[6])};return new w.Bond(r)}function a(t){for(var e=j.default.partitionLine(t,j.default.fmtInfo.atomListHeaderPartition),r=j.default.parseDecimalInt(e[0])-1,n="T"==e[2].trim(),o=j.default.parseDecimalInt(e[4].trim()),i=t.slice(j.default.fmtInfo.atomListHeaderLength),a=[],s=j.default.fmtInfo.atomListHeaderItemLength,u=0;u<o;++u)a[u]=j.default.parseDecimalInt(i.slice(u*s,(u+1)*s-1));return{aid:r,atomList:new w.AtomList({notList:n,ids:a})}}function s(t,e,r,n,o,i){for(var a=new y.default;r<n;){var s=e[r];if("A"==s.charAt(0)){var u=e[++r],l=/'.+'/.test(u);l&&!a.get("pseudo")&&a.set("pseudo",new y.default),l||a.get("alias")||a.set("alias",new y.default),l&&(u=u.replace(/'/g,"")),a.get(l?"pseudo":"alias").set(j.default.parseDecimalInt(s.slice(3,6))-1,u)}else if("M"==s.charAt(0)){var c=s.slice(3,6),f=s.slice(6);if("END"==c)break;if("CHG"==c)a.get("charge")||a.set("charge",A.default.readKeyValuePairs(f));else if("RAD"==c)a.get("radical")||a.set("radical",A.default.readKeyValuePairs(f));else if("ISO"==c)a.get("isotope")||a.set("isotope",A.default.readKeyValuePairs(f));else if("RBC"==c)a.get("ringBondCount")||a.set("ringBondCount",A.default.readKeyValuePairs(f));else if("SUB"==c)a.get("substitutionCount")||a.set("substitutionCount",A.default.readKeyValuePairs(f));else if("UNS"==c)a.get("unsaturatedAtom")||a.set("unsaturatedAtom",A.default.readKeyValuePairs(f));else if("RGP"==c){a.get("rglabel")||a.set("rglabel",new y.default);for(var d=a.get("rglabel"),p=A.default.readKeyMultiValuePairs(f),h=0;h<p.length;h++){var g=p[h];d.set(g[0],(d.get(g[0])||0)|1<<g[1]-1)}}else if("LOG"==c){f=f.slice(4);var v=j.default.parseDecimalInt(f.slice(0,3).trim()),b=j.default.parseDecimalInt(f.slice(4,7).trim()),_=j.default.parseDecimalInt(f.slice(8,11).trim()),x=f.slice(12).trim(),w={};b>0&&(w.ifthen=b),w.resth=1==_,w.range=x,i[v]=w}else if("APO"==c)a.get("attpnt")||a.set("attpnt",A.default.readKeyValuePairs(f));else if("ALS"==c){var S=m(j.default.partitionLine(f,[1,3,3,1,1,1]),j.default.partitionLineFixed(f.slice(10),4,!1));a.get("atomList")||a.set("atomList",new y.default),a.get("label")||a.set("label",new y.default),S.forEach(function(t,e){a.get("label").set(e,"L#"),a.get("atomList").set(e,t)})}else if("STY"==c)A.default.initSGroup(o,f);else if("SST"==c)A.default.applySGroupProp(o,"subtype",f);else if("SLB"==c)A.default.applySGroupProp(o,"label",f,!0);else if("SPL"==c)A.default.applySGroupProp(o,"parent",f,!0,!0);else if("SCN"==c)A.default.applySGroupProp(o,"connectivity",f);else if("SAL"==c)A.default.applySGroupArrayProp(o,"atoms",f,-1);else if("SBL"==c)A.default.applySGroupArrayProp(o,"bonds",f,-1);else if("SPA"==c)A.default.applySGroupArrayProp(o,"patoms",f,-1);else if("SMT"==c){var O=j.default.parseDecimalInt(f.slice(0,4))-1;o[O].data.subscript=f.slice(4).trim()}else"SDT"==c?A.default.applyDataSGroupDesc(o,f):"SDD"==c?A.default.applyDataSGroupInfoLine(o,f):"SCD"==c?A.default.applyDataSGroupDataLine(o,f,!1):"SED"==c&&A.default.applyDataSGroupDataLine(o,f,!0)}++r}return a}function u(t,e,r){e.forEach(function(e,n){t.get(n)[r]=e})}function l(t,e){var r=new S.default,n=void 0,l=j.default.parseDecimalInt(e[0]),c=j.default.parseDecimalInt(e[1]),f=j.default.parseDecimalInt(e[2]);r.isChiral=!!r.isChiral||0!==j.default.parseDecimalInt(e[4]);var d=j.default.parseDecimalInt(e[5]),p=j.default.parseDecimalInt(e[10]),h=0,m=t.slice(h,h+l);h+=l;var g=t.slice(h,h+c);h+=c;var v=t.slice(h,h+f);h+=f+d;var b=m.map(o);for(n=0;n<b.length;++n)r.atoms.add(b[n]);var y=g.map(i);for(n=0;n<y.length;++n)r.bonds.add(y[n]);v.map(a).forEach(function(t){r.atoms.get(t.aid).atomList=t.atomList,r.atoms.get(t.aid).label="L#"});var _={},x={};s(r,t,h,Math.min(t.length,h+p),_,x).forEach(function(t,e){u(r.atoms,t,e)});var O={},E=void 0;for(E in _){var P=_[E];if("DAT"===P.type&&0===P.atoms.length){var T=_[E].parent;if(T>=0){var C=_[T-1];"GEN"===C.type&&(P.atoms=[].slice.call(C.atoms))}}}for(E in _)A.default.loadSGroup(r,_[E],O);var k=[];for(E in _)w.SGroup.filter(r,_[E],O),0!==_[E].atoms.length||_[E].allAtoms||k.push(+E);for(n=0;n<k.length;++n)r.sGroupForest.remove(k[n]),r.sgroups.delete(k[n]);for(var M in x){var R=parseInt(M,10);r.rgroups.set(R,new w.RGroup(x[R]))}return r}function c(t){if(t=t.slice(7),"$CTAB"!==t[0].trim())throw new Error("RGFile format invalid");for(var e=1;"$"!==t[e].charAt(0);)e++;if("$END CTAB"!==t[e].trim())throw new Error("RGFile format invalid");var r=t.slice(1,e);t=t.slice(e+1);for(var n={};;){if(0===t.length)throw new Error("Unexpected end of file");var o=t[0].trim();if("$END MOL"===o){t=t.slice(1);break}if("$RGP"!==o)throw new Error("RGFile format invalid");var i=parseInt(t[1].trim(),10);for(n[i]=[],t=t.slice(2);;){if(0===t.length)throw new Error("Unexpected end of file");if("$END RGP"===(o=t[0].trim())){t=t.slice(1);break}if("$CTAB"!==o)throw new Error("RGFile format invalid");for(e=1;"$"!==t[e].charAt(0);)e++;if("$END CTAB"!==t[e].trim())throw new Error("RGFile format invalid");n[i].push(t.slice(1,e)),t=t.slice(e+1)}}var a=d(r),s={};if(P)for(var u in n){var l=parseInt(u,10);s[l]=[];for(var c=0;c<n[l].length;++c)s[l].push(d(n[l][c]))}return p(a,s)}function f(t,e){t=t.slice(4);var r=j.default.partitionLine(t[0],j.default.fmtInfo.rxnItemsPartition),n=r[0]-0,o=r[1]-0,i=r[2]-0;t=t.slice(1);for(var a=[];t.length>0&&"$MOL"==t[0].substr(0,4);){t=t.slice(1);for(var s=0;s<t.length&&"$MOL"!=t[s].substr(0,4);)s++;var u,l=t.slice(0,s);0==l[0].search("\\$MDL")?u=c(l):(u=d(l.slice(3)),u.name=l[0].trim()),a.push(u),t=t.slice(s)}return j.default.rxnMerge(a,n,o,i,e)}function d(t){var e=j.default.partitionLine(t[0],j.default.fmtInfo.countsLinePartition);return t=t.slice(1),l(t,e)}function p(t,e){var r=new S.default;return t.mergeInto(r,null,null,!1,!0),Object.keys(e).forEach(function(t){for(var n=parseInt(t,10),o=0;o<e[n].length;++o)!function(t){var o=e[n][t];o.rgroups.set(n,new w.RGroup);var i={},a=o.frags.add(i);o.rgroups.get(n).frags.add(a),o.atoms.forEach(function(t){t.fragment=a}),o.mergeInto(r)}(o)}),r}function h(t){for(var e=[],r=0;r<t.length;++r)e.push(x.default.map[t[r].trim()]);return e}function m(t,e){var r=j.default.parseDecimalInt(t[1])-1,n=j.default.parseDecimalInt(t[2]),o="T"==t[4].trim(),i=h(e.slice(0,n)),a=new y.default;return a.set(r,new w.AtomList({notList:o,ids:i})),a}Object.defineProperty(r,"__esModule",{value:!0});var g=t("../../util/vec2"),v=n(g),b=t("../../util/pool"),y=n(b),_=t("./../element"),x=n(_),w=t("./../struct/index"),S=n(w),O=t("./parseSGroup"),A=n(O),E=t("./utils"),j=n(E),P=!0;r.default={parseCTabV2000:l,parseRg2000:c,parseRxn2000:f}},{"../../util/pool":689,"../../util/vec2":691,"./../element":525,"./../struct/index":542,"./parseSGroup":530,"./utils":531}],533:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e,r,n,o,i;e=f(t);var a={pp:new y.default(parseFloat(e[2]),-parseFloat(e[3]),parseFloat(e[4])),aam:e[5].trim()},s=e[1].trim();if('"'==s.charAt(0)&&'"'==s.charAt(s.length-1)&&(s=s.substr(1,s.length-2)),"]"==s.charAt(s.length-1)){s=s.substr(0,s.length-1);var u={};if(u.notList=!1,"NOT ["==s.substr(0,5))u.notList=!0,s=s.substr(5);else{if("["!=s.charAt(0))throw new Error("Error: atom list expected, found '"+s+"'");s=s.substr(1)}u.ids=v(s.split(",")),a.atomList=new w.AtomList(u),a.label="L#"}else a.label=s;for(e.splice(0,6),i=0;i<e.length;++i)if(r=p(e[i],"="),n=r[0],o=r[1],n in j.default.fmtInfo.v30atomPropMap){var l=j.default.parseDecimalInt(o);if("VAL"==n){if(0==l)continue;-1==l&&(l=0)}a[j.default.fmtInfo.v30atomPropMap[n]]=l}else if("RGROUPS"==n){o=o.trim().substr(1,o.length-2);var c=o.split(" ").slice(1);a.rglabel=0;for(var d=0;d<c.length;++d)a.rglabel|=1<<c[d]-1}else"ATTCHPT"==n&&(a.attpnt=o.trim()-0);return new w.Atom(a)}function i(t){var e,r,n,o,i;e=f(t);var a={begin:j.default.parseDecimalInt(e[2])-1,end:j.default.parseDecimalInt(e[3])-1,type:j.default.fmtInfo.bondTypeMap[j.default.parseDecimalInt(e[1])]};for(e.splice(0,4),i=0;i<e.length;++i)r=p(e[i],"="),n=r[0],o=r[1],"CFG"==n?(a.stereo=j.default.fmtInfo.v30bondStereoMap[j.default.parseDecimalInt(o)],a.type==w.Bond.PATTERN.TYPE.DOUBLE&&a.stereo==w.Bond.PATTERN.STEREO.EITHER&&(a.stereo=w.Bond.PATTERN.STEREO.CIS_TRANS)):"TOPO"==n?a.topology=j.default.fmtInfo.bondTopologyMap[j.default.parseDecimalInt(o)]:"RXCTR"==n?a.reactingCenterStatus=j.default.parseDecimalInt(o):"STBOX"==n&&(a.stereoCare=j.default.parseDecimalInt(o));return new w.Bond(a)}function a(t,e,r){for(r++;"M  V30 END COLLECTION"!=e[r].trim();)r++;return++r}function s(t,e,r,n,o){var i="";for(o++;o<e.length;){if(i=g(e[o++]).trim(),"END SGROUP"==i.trim())return o;for(;"-"==i.charAt(i.length-1);)i=(i.substr(0,i.length-1)+g(e[o++])).trim();var a=h(i),s=a[1],u=new w.SGroup(s);u.number=a[0]-0,u.type=s,u.label=a[2]-0,r[u.number]=u;for(var l={},c=3;c<a.length;++c){var f=p(a[c],"=");if(2!=f.length)throw new Error("A record of form AAA=BBB or AAA=(...) expected, got '"+a[c]+"'");var v=f[0];v in l||(l[v]=[]),l[v].push(f[1])}u.atoms=m(l.ATOMS[0],-1),l.PATOMS&&(u.patoms=m(l.PATOMS[0],-1)),u.bonds=l.BONDS?m(l.BONDS[0],-1):[];var b=l.BRKXYZ;if(u.brkxyz=[],b)for(var y=0;y<b.length;++y)u.brkxyz.push(m(b[y]));l.MULT&&(u.data.subscript=l.MULT[0]-0),l.LABEL&&(u.data.subscript=l.LABEL[0].trim()),l.CONNECT&&(u.data.connectivity=l.CONNECT[0].toLowerCase()),l.FIELDDISP&&A.default.applyDataSGroupInfo(u,d(l.FIELDDISP[0])),l.FIELDDATA&&A.default.applyDataSGroupData(u,l.FIELDDATA[0],!0),l.FIELDNAME&&A.default.applyDataSGroupName(u,l.FIELDNAME[0]),l.QUERYTYPE&&A.default.applyDataSGroupQuery(u,l.QUERYTYPE[0]),l.QUERYOP&&A.default.applyDataSGroupQueryOp(u,l.QUERYOP[0]),A.default.loadSGroup(t,u,n)}throw new Error("S-group declaration incomplete.")}function u(t,e){var r=new S.default,n=0;if("M  V30 BEGIN CTAB"!=t[n++].trim())throw Error("CTAB V3000 invalid");if("M  V30 COUNTS"!=t[n].slice(0,13))throw Error("CTAB V3000 invalid");var u=t[n].slice(14).split(" ");if(r.isChiral=1==j.default.parseDecimalInt(u[4]),n++,"M  V30 BEGIN ATOM"==t[n].trim()){n++;for(var c;n<t.length&&"END ATOM"!=(c=g(t[n++]).trim());){for(;"-"==c.charAt(c.length-1);)c=(c.substring(0,c.length-1)+g(t[n++])).trim();r.atoms.add(o(c))}if("M  V30 BEGIN BOND"==t[n].trim())for(n++;n<t.length&&"END BOND"!=(c=g(t[n++]).trim());){for(;"-"==c.charAt(c.length-1);)c=(c.substring(0,c.length-1)+g(t[n++])).trim();r.bonds.add(i(c))}for(var f={},d={};"M  V30 END CTAB"!=t[n].trim();)if("M  V30 BEGIN COLLECTION"==t[n].trim())n=a(r,t,n);else{if("M  V30 BEGIN SGROUP"!=t[n].trim())throw Error("CTAB V3000 invalid");n=s(r,t,f,d,n)}}if("M  V30 END CTAB"!=t[n++].trim())throw Error("CTAB V3000 invalid");return e||l(r,t.slice(n)),r}function l(t,e){for(var r={},n={},o=0;o<e.length&&0==e[o].search("M  V30 BEGIN RGROUP");){var i=e[o++].split(" ").pop();for(r[i]=[],n[i]={};;){var a=e[o].trim();if(0!=a.search("M  V30 RLOGIC")){if("M  V30 BEGIN CTAB"!=a)throw Error("CTAB V3000 invalid");for(var s=0;s<e.length&&"M  V30 END CTAB"!=e[o+s].trim();++s);var l=e.slice(o,o+s+1),c=u(l,!0);if(r[i].push(c),o=o+s+1,"M  V30 END RGROUP"==e[o].trim()){o++;break}}else{a=a.slice(13);var f=a.trim().split(/\s+/g),d=j.default.parseDecimalInt(f[0]),p=j.default.parseDecimalInt(f[1]),h=f.slice(2).join(" "),m={};d>0&&(m.ifthen=d),m.resth=1==p,m.range=h,n[i]=m,o++}}}Object.keys(r).forEach(function(e){r[e].forEach(function(r){r.rgroups.set(e,new w.RGroup(n[e]));var o=r.frags.add({});r.rgroups.get(e).frags.add(o),r.atoms.forEach(function(t){t.fragment=o}),r.mergeInto(t)})})}function c(t,e){t=t.slice(4);for(var r=t[0].split(/\s+/g).slice(3),n=r[0]-0,o=r[1]-0,i=r.length>2?r[2]-0:0,a=[],s=[],c=null,f=[],d=0;d<t.length;++d){var p,h=t[d].trim();if(h.startsWith("M  V30 COUNTS"));else{if("M  END"==h)break;if("M  V30 BEGIN PRODUCT"==h)console.assert(null==c,"CTab format invalid"),c=s;else if("M  V30 END PRODUCT"==h)console.assert(c===s,"CTab format invalid"),c=null;else if("M  V30 BEGIN REACTANT"==h)console.assert(null==c,"CTab format invalid"),c=a;else if("M  V30 END REACTANT"==h)console.assert(c===a,"CTab format invalid"),c=null;else if(h.startsWith("M  V30 BEGIN RGROUP"))console.assert(null==c,"CTab format invalid"),p=function(e){for(var r=e;r<t.length;++r)if("M  V30 END RGROUP"==t[r].trim())return r;return console.error("CTab format invalid")}(d),f.push(t.slice(d,p+1)),d=p;else{if("M  V30 BEGIN CTAB"!=h)throw new Error("line unrecognized: "+h);p=function(e){for(var r=e;r<t.length;++r)if("M  V30 END CTAB"==t[r].trim())return r;return console.error("CTab format invalid")}(d),c.push(t.slice(d,p+1)),d=p}}}var m=[],g=a.concat(s);for(p=0;p<g.length;++p){var v=u(g[p],r);m.push(v)}var b=j.default.rxnMerge(m,n,o,i,e);return l(b,function(t){for(var e=[],r=0;r<t.length;++r)e=e.concat(t[r]);return e}(f)),b}function f(t){var e,r,n=[],o=0,i=-1,a=!1;for(r=0;r<t.length;++r)e=t[r],"("==e?o++:")"==e&&o--,'"'==e&&(a=!a),a||" "!=t[r]||0!=o||(r>i+1&&n.push(t.slice(i+1,r)),i=r);return r>i+1&&n.push(t.slice(i+1,r)),n}function d(t){return'"'===t[0]&&'"'===t[t.length-1]?t.substr(1,t.length-2):t}function p(t,e){var r=t.indexOf(e);return[t.slice(0,r),t.slice(r+1)]}function h(t){for(var e=[],r=0,n=!1,o=0;o<t.length;++o){var i=t.charAt(o);'"'==i?n=!n:n||("("==i?r++:")"==i?r--:" "==i&&0==r&&(e.push(t.slice(0,o)),t=t.slice(o+1).trim(),o=0))}if(0!=r)throw new Error("Brace balance broken. S-group properies invalid!");return t.length>0&&e.push(t.trim()),e}function m(t,e){if(!t)return null;var r=[];t=t.trim(),t=t.substr(1,t.length-2);var n=t.split(" ");e=e||0;for(var o=1;o<n.length;++o){var i=parseInt(n[o]);isNaN(i)||r.push(i+e)}return r}function g(t){if("M  V30 "!=t.slice(0,7))throw new Error("Prefix invalid");return t.slice(7)}function v(t){for(var e=[],r=0;r<t.length;++r)e.push(x.default.map[t[r].trim()]);return e}Object.defineProperty(r,"__esModule",{value:!0});var b=t("../../util/vec2"),y=n(b),_=t("./../element"),x=n(_),w=t("./../struct/index"),S=n(w),O=t("./parseSGroup"),A=n(O),E=t("./utils"),j=n(E);r.default={parseCTabV3000:u,readRGroups3000:l,parseRxn3000:c}},{"../../util/vec2":691,"./../element":525,"./../struct/index":542,"./parseSGroup":530,"./utils":531}],534:[function(t,e,r){"use strict";function n(t,e){for(var r,n,o=/^[^]+?\$\$\$\$$/gm,i=[];null!==(r=o.exec(t));){n=r[0].replace(/\r/g,""),n=n.trim();var s=n.indexOf("M  END");if(-1!==s){var u={},l=n.substr(s+7).trim().split(/^$\n?/m);u.struct=a.default.parse(n.substring(0,s+6),e),u.props=l.reduce(function(t,e){var r=e.match(/^> [ \d]*<(\S+)>/);if(r){var n=r[1],o=e.split("\n")[1].trim();t[n]=isFinite(o)?+o:o}return t},{}),i.push(u)}}return i}function o(t,e){return t.reduce(function(t,r){
  return t+=a.default.stringify(r.struct,e),Object.keys(r.props).forEach(function(e){t+="> <"+e+">\n",t+=r.props[e]+"\n\n"}),t+"$$$$"},"")}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./molfile"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);r.default={stringify:o,parse:n}},{"./molfile":528}],535:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){this.molecule=t,this.bonds=new s.default,this.getNeighbors=e,this.context=r}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Object.defineProperty(r,"__esModule",{value:!0});var a=t("../../util/pool"),s=n(a),u=t("../../util/vec2"),l=n(u),c=t("../struct");o.PARITY={NONE:0,CIS:1,TRANS:2},o.prototype.each=function(t){this.bonds.forEach(t)},o.prototype.getParity=function(t){return this.bonds.get(t).parity},o.prototype.getSubstituents=function(t){return this.bonds.get(t).substituents},o.prototype.sameside=function(t,e,r,n){var o=l.default.diff(t,e),i=new l.default(-o.y,o.x);if(!i.normalize())return 0;var a=l.default.diff(r,t),s=l.default.diff(n,e);if(!a.normalize())return 0;if(!s.normalize())return 0;var u=l.default.dot(a,i),c=l.default.dot(s,i);return Math.abs(u)<.001||Math.abs(c)<.001?0:u*c>0?1:-1},o.prototype.samesides=function(t,e,r,n){return this.sameside(this.molecule.atoms.get(t).pp,this.molecule.atoms.get(e).pp,this.molecule.atoms.get(r).pp,this.molecule.atoms.get(n).pp)},o.prototype.sortSubstituents=function(t){var e=this.molecule.atoms.get(t[0]).pureHydrogen(),r=t[1]<0||this.molecule.atoms.get(t[1]).pureHydrogen(),n=this.molecule.atoms.get(t[2]).pureHydrogen(),o=t[3]<0||this.molecule.atoms.get(t[3]).pureHydrogen();return(!e||!r)&&((!n||!o)&&(r?t[1]=-1:e?(t[0]=t[1],t[1]=-1):t[0]>t[1]&&i(t,0,1),o?t[3]=-1:n?(t[2]=t[3],t[3]=-1):t[2]>t[3]&&i(t,2,3),!0))},o.prototype.isGeomStereoBond=function(t,e){var r=this.molecule.bonds.get(t);if(r.type!=c.Bond.PATTERN.TYPE.DOUBLE)return!1;var n=this.molecule.atoms.get(r.begin).label,o=this.molecule.atoms.get(r.end).label;if("C"!=n&&"N"!=n&&"Si"!=n&&"Ge"!=n)return!1;if("C"!=o&&"N"!=o&&"Si"!=o&&"Ge"!=o)return!1;var i=this.getNeighbors.call(this.context,r.begin),a=this.getNeighbors.call(this.context,r.end);if(i.length<2||i.length>3||a.length<2||a.length>3)return!1;e[0]=-1,e[1]=-1,e[2]=-1,e[3]=-1;var s,u;for(s=0;s<i.length;s++)if(u=i[s],u.bid!=t){if(this.molecule.bonds.get(u.bid).type!=c.Bond.PATTERN.TYPE.SINGLE)return!1;-1==e[0]?e[0]=u.aid:e[1]=u.aid}for(s=0;s<a.length;s++)if(u=a[s],u.bid!=t){if(this.molecule.bonds.get(u.bid).type!=c.Bond.PATTERN.TYPE.SINGLE)return!1;-1==e[2]?e[2]=u.aid:e[3]=u.aid}return(-1==e[1]||-1==this.samesides(r.begin,r.end,e[0],e[1]))&&(-1==e[3]||-1==this.samesides(r.begin,r.end,e[2],e[3]))},o.prototype.build=function(t){var e=this;this.molecule.bonds.forEach(function(r,n){var i={parity:0,substituents:[]};if(e.bonds.set(n,i),(!Array.isArray(t)||!t[n])&&e.isGeomStereoBond(n,i.substituents)&&e.sortSubstituents(i.substituents)){var a=e.samesides(r.begin,r.end,i.substituents[0],i.substituents[2]);1===a?i.parity=o.PARITY.CIS:-1===a&&(i.parity=o.PARITY.TRANS)}})},r.default=o},{"../../util/pool":689,"../../util/vec2":691,"../struct":542}],536:[function(t,e,r){"use strict";function n(t,e,r,o){var i=this;this.molecule=t,this.atom_data=e,this.components=r,this.nComponentsInReactants=-1,this.nReactants=o,this.vertices=new Array(this.molecule.atoms.size),this.molecule.atoms.forEach(function(t,e){i.vertices[e]=new n.VertexDesc},this),this.edges=new Array(this.molecule.bonds.size),this.molecule.bonds.forEach(function(t,e){i.edges[e]=new n.EdgeDesc},this),this.v_seq=[]}Object.defineProperty(r,"__esModule",{value:!0}),n.VertexDesc=function(){this.dfs_state=0,this.parent_vertex=0,this.parent_edge=0,this.branches=0},n.EdgeDesc=function(){this.opening_cycles=0,this.closing_cycle=0},n.SeqElem=function(t,e,r){this.idx=t,this.parent_vertex=e,this.parent_edge=r},n.prototype.walk=function(){for(var t,e,r=this,o=[],i=0,a=0;;){if(o.length<1){for(var s=-1;i<this.components.length&&-1==s;)s=this.components[i].find(function(t){return 0===r.vertices[t].dfs_state&&(s=t,!0)}),null===s&&(s=-1,i++),i==this.nReactants&&(this.nComponentsInReactants=a);if(s<-1&&this.molecule.atoms.find(function(t){return 0===r.vertices[t].dfs_state&&(s=t,!0)}),-1==s)break;this.vertices[s].parent_vertex=-1,this.vertices[s].parent_edge=-1,o.push(s),a++}var u=o.pop(),l=this.vertices[u].parent_vertex,c=new n.SeqElem(u,l,this.vertices[u].parent_edge);this.v_seq.push(c),this.vertices[u].dfs_state=2;var f=this.atom_data[u];for(t=0;t<f.neighbours.length;t++){var d=f.neighbours[t].aid,p=f.neighbours[t].bid;if(d!=l)if(2==this.vertices[d].dfs_state){for(this.edges[p].closing_cycle=1,e=u;-1!=e&&this.vertices[e].parent_vertex!=d;)e=this.vertices[e].parent_vertex;if(-1==e)throw new Error("cycle unwind error");this.edges[this.vertices[e].parent_edge].opening_cycles++,this.vertices[u].branches++,c=new n.SeqElem(d,u,p),this.v_seq.push(c)}else{if(1==this.vertices[d].dfs_state){if(-1==(e=o.indexOf(d)))throw new Error("internal: removing vertex from stack");o.splice(e,1);var h=this.vertices[d].parent_vertex;h>=0&&this.vertices[h].branches--}this.vertices[u].branches++,this.vertices[d].parent_vertex=u,this.vertices[d].parent_edge=p,this.vertices[d].dfs_state=1,o.push(d)}}}},n.prototype.edgeClosingCycle=function(t){return 0!==this.edges[t].closing_cycle},n.prototype.numBranches=function(t){return this.vertices[t].branches},n.prototype.numOpeningCycles=function(t){return this.edges[t].opening_cycles},n.prototype.toString=function(){var t="";return this.v_seq.forEach(function(e){t+=e.idx+" -> "}),t+="*"},r.default=n},{}],537:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(){this.smiles="",this.writtenAtoms=[],this.writtenComponents=0,this.ignore_errors=!1}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/pile"),a=n(i),s=t("../struct"),u=t("./cis_trans"),l=n(u),c=t("./dfs"),f=n(c),d=t("./stereocenters"),p=n(d);o._Atom=function(t){this.neighbours=[],this.aromatic=!1,this.lowercase=!1,this.chirality=0,this.branch_cnt=0,this.paren_written=!1,this.h_count=t,this.parent=-1},o.prototype.isBondInRing=function(t){return console.assert(this.inLoop,"Init this.inLoop prior to calling this method"),this.inLoop[t]},o.prototype.saveMolecule=function(t,e){var r,n,i,u=this;e||(this.ignore_errors=e),t=t.clone(),t.initHalfBonds(),t.initNeighbors(),t.sortNeighbors(),t.setImplicitHydrogen(),t.sgroups.forEach(function(e){if("MUL"===e.type)try{s.SGroup.prepareMulForSaving(e,t)}catch(t){throw Error("Bad s-group ("+t.message+")")}}),this.atoms=new Array(t.atoms.size),t.atoms.forEach(function(t,e){u.atoms[e]=new o._Atom(t.implicitH)});var l=["B","C","N","O","P","S","Se","As"];t.bonds.forEach(function(e,r){e.type===s.Bond.PATTERN.TYPE.AROMATIC&&(u.atoms[e.begin].aromatic=!0,-1!==l.indexOf(t.atoms.get(e.begin).label)&&(u.atoms[e.begin].lowercase=!0),u.atoms[e.end].aromatic=!0,-1!==l.indexOf(t.atoms.get(e.end).label)&&(u.atoms[e.end].lowercase=!0)),u.atoms[e.begin].neighbours.push({aid:e.end,bid:r}),u.atoms[e.end].neighbours.push({aid:e.begin,bid:r})}),this.inLoop=function(){t.prepareLoopStructure();var e=new a.default;t.loops.forEach(function(r){if(r.hbs.length<=6){var n=r.hbs.map(function(e){return t.halfBonds.get(e).bid});e=e.union(new a.default(n))}});var r={};return e.forEach(function(t){r[t]=1}),r}(),this.touchedCistransbonds=0,this.markCisTrans(t);var c=t.getComponents(),d=c.reactants.concat(c.products),h=new f.default(t,this.atoms,d,c.reactants.length);for(h.walk(),this.atoms.forEach(function(t){t.neighbours=[]}),r=0;r<h.v_seq.length;r++){var m=h.v_seq[r],g=m.idx,v=m.parent_edge,b=m.parent_vertex;if(v>=0){var y=this.atoms[g],_=h.numOpeningCycles(v);for(n=0;n<_;n++)this.atoms[b].neighbours.push({aid:-1,bid:-1});if(h.edgeClosingCycle(v)){for(i=0;i<y.neighbours.length;i++)if(-1===y.neighbours[i].aid){y.neighbours[i].aid=b,y.neighbours[i].bid=v;break}if(i===y.neighbours.length)throw new Error("internal: can not put closing bond to its place")}else y.neighbours.push({aid:b,bid:v}),y.parent=b;this.atoms[b].neighbours.push({aid:g,bid:v})}}try{var x=new p.default(t,function(t){return this.atoms[t].neighbours},this);x.buildFromBonds(this.ignore_errors),x.each(function(t,e){var r=-1;-1==t.pyramid[3]&&(r=3);var o=[],a=0,s=u.atoms[e];if(-1!=s.parent)for(i=0;i<4;i++)if(t.pyramid[i]==s.parent){o[a++]=i;break}for(-1!=r&&(o[a++]=r),n=0;n!=s.neighbours.length;n++)if(s.neighbours[n].aid!=s.parent)for(i=0;i<4;i++)if(s.neighbours[n].aid==t.pyramid[i]){if(a>=4)throw new Error("internal: pyramid overflow");o[a++]=i;break}if(4==a)a=o[0],o[0]=o[1],o[1]=o[2],o[2]=o[3],o[3]=a;else if(3!=a)throw new Error("cannot calculate chirality");p.default.isPyramidMappingRigid(o)?u.atoms[e].chirality=1:u.atoms[e].chirality=2})}catch(t){alert("Warning: "+t.message)}var w=[];w.push(0);var S=!0;for(r=0;r<h.v_seq.length;r++){m=h.v_seq[r],g=m.idx,v=m.parent_edge,b=m.parent_vertex;var O=!0;if(b>=0){for(h.numBranches(b)>1&&this.atoms[b].branch_cnt>0&&this.atoms[b].paren_written&&(this.smiles+=")"),_=h.numOpeningCycles(v),n=0;n<_;n++){for(i=1;i<w.length&&-1!=w[i];i++);i==w.length?w.push(b):w[i]=b,this.writeCycleNumber(i)}if(b>=0){var A=h.numBranches(b);if(A>1&&this.atoms[b].branch_cnt<A-1&&(h.edgeClosingCycle(v)?this.atoms[b].paren_written=!1:(this.smiles+="(",this.atoms[b].paren_written=!0)),++this.atoms[b].branch_cnt>A)throw new Error("unexpected branch")}var E=t.bonds.get(v),j=0;if(E.type==s.Bond.PATTERN.TYPE.SINGLE&&(j=this.calcBondDirection(t,v,b)),1==j&&g==E.end||2==j&&g==E.begin?this.smiles+="/":2==j&&g==E.end||1==j&&g==E.begin?this.smiles+="\\":E.type==s.Bond.PATTERN.TYPE.ANY?this.smiles+="~":E.type==s.Bond.PATTERN.TYPE.DOUBLE?this.smiles+="=":E.type==s.Bond.PATTERN.TYPE.TRIPLE?this.smiles+="#":E.type!=s.Bond.PATTERN.TYPE.AROMATIC||this.atoms[E.begin].lowercase&&this.atoms[E.end].lowercase&&this.isBondInRing(v)?E.type==s.Bond.PATTERN.TYPE.SINGLE&&this.atoms[E.begin].aromatic&&this.atoms[E.end].aromatic&&(this.smiles+="-"):this.smiles+=":",h.edgeClosingCycle(v)){for(n=1;n<w.length&&w[n]!=g;n++);if(n==w.length)throw new Error("cycle number not found");this.writeCycleNumber(n),w[n]=-1,O=!1}}else S||(this.smiles+=this.writtenComponents===h.nComponentsInReactants&&0!==h.nReactants?">>":"."),S=!1,this.writtenComponents++;O&&(this.writeAtom(t,g,this.atoms[g].aromatic,this.atoms[g].lowercase,this.atoms[g].chirality),this.writtenAtoms.push(m.idx))}return this.comma=!1,this.writeRadicals(t),this.comma&&(this.smiles+="|"),this.smiles},o.prototype.writeCycleNumber=function(t){if(t>0&&t<10)this.smiles+=t;else if(t>=10&&t<100)this.smiles+="%"+t;else{if(!(t>=100&&t<1e3))throw new Error("bad cycle number: "+t);this.smiles+="%%"+t}},o.prototype.writeAtom=function(t,e,r,n,o){var i=t.atoms.get(e),a=!1,s=-1,u=0;if("A"==i.label)return void(this.smiles+="*");if("R"==i.label||"R#"==i.label)return void(this.smiles+="[*]");u=i.aam,"C"!=i.label&&"P"!=i.label&&"N"!=i.label&&"S"!=i.label&&"O"!=i.label&&"Cl"!=i.label&&"F"!=i.label&&"Br"!=i.label&&"B"!=i.label&&"I"!=i.label&&(a=!0),(i.explicitValence>=0||0!=i.radical||o>0||r&&"C"!=i.label&&"O"!=i.label||r&&"C"==i.label&&this.atoms[e].neighbours.length<3&&0==this.atoms[e].h_count)&&(s=this.atoms[e].h_count);var l=i.label;if(i.atomList&&!i.atomList.notList?(l=i.atomList.label(),a=!1):i.isPseudo()||i.atomList&&i.atomList.notList?(l="*",a=!0):(o||0!=i.charge||i.isotope>0||s>=0||u>0)&&(a=!0),a&&(-1==s&&(s=this.atoms[e].h_count),this.smiles+="["),i.isotope>0&&(this.smiles+=i.isotope),this.smiles+=n?l.toLowerCase():l,o>0&&(this.smiles+=1==o?"@":"@@",i.implicitH>1))throw new Error(i.implicitH+" implicit H near stereocenter");"H"!=i.label&&(s>1||0==s&&!a?this.smiles+="H"+s:1==s&&(this.smiles+="H")),i.charge>1?this.smiles+="+"+i.charge:i.charge<-1?this.smiles+=i.charge:1==i.charge?this.smiles+="+":-1==i.charge&&(this.smiles+="-"),u>0&&(this.smiles+=":"+u),a&&(this.smiles+="]")},o.prototype.markCisTrans=function(t){var e=this;this.cis_trans=new l.default(t,function(t){return this.atoms[t].neighbours},this),this.cis_trans.build(),this.dbonds=new Array(t.bonds.size),t.bonds.forEach(function(t,r){e.dbonds[r]={ctbond_beg:-1,ctbond_end:-1,saved:0}}),this.cis_trans.each(function(r,n){var o=t.bonds.get(n);if(0!==r.parity&&!e.isBondInRing(n)){var i=e.atoms[o.begin].neighbours,a=e.atoms[o.end].neighbours,u=!0,l=!0;if(i.forEach(function(e){e.bid!==n&&t.bonds.get(e.bid).type===s.Bond.PATTERN.TYPE.SINGLE&&(u=!1)}),a.forEach(function(e){e.bid!==n&&t.bonds.get(e.bid).type===s.Bond.PATTERN.TYPE.SINGLE&&(l=!1)}),u||l)return;i.forEach(function(r){r.bid!==n&&(t.bonds.get(r.bid).begin===o.begin?e.dbonds[r.bid].ctbond_beg=n:e.dbonds[r.bid].ctbond_end=n)}),a.forEach(function(r){r.bid!==n&&(t.bonds.get(r.bid).begin===o.end?e.dbonds[r.bid].ctbond_beg=n:e.dbonds[r.bid].ctbond_end=n)})}})},o.prototype.updateSideBonds=function(t,e){var r=t.bonds.get(e),n=this.cis_trans.getSubstituents(e),o=this.cis_trans.getParity(e),i=[-1,-1,-1,-1];i[0]=t.findBondId(n[0],r.begin),-1!=n[1]&&(i[1]=t.findBondId(n[1],r.begin)),i[2]=t.findBondId(n[2],r.end),-1!=n[3]&&(i[3]=t.findBondId(n[3],r.end));var a=0,s=0,u=0,c=0;if(0!=this.dbonds[i[0]].saved&&(1==this.dbonds[i[0]].saved&&t.bonds.get(i[0]).begin==r.begin||2==this.dbonds[i[0]].saved&&t.bonds.get(i[0]).end==r.begin?a++:s++),-1!=i[1]&&0!=this.dbonds[i[1]].saved&&(2==this.dbonds[i[1]].saved&&t.bonds.get(i[1]).begin==r.begin||1==this.dbonds[i[1]].saved&&t.bonds.get(i[1]).end==r.begin?a++:s++),0!=this.dbonds[i[2]].saved&&(1==this.dbonds[i[2]].saved&&t.bonds.get(i[2]).begin==r.end||2==this.dbonds[i[2]].saved&&t.bonds.get(i[2]).end==r.end?u++:c++),-1!=i[3]&&0!=this.dbonds[i[3]].saved&&(2==this.dbonds[i[3]].saved&&t.bonds.get(i[3]).begin==r.end||1==this.dbonds[i[3]].saved&&t.bonds.get(i[3]).end==r.end?u++:c++),o==l.default.PARITY.CIS?(a+=u,s+=c):(a+=c,s+=u),a>0&&s>0)throw new Error("incompatible cis-trans configuration");return(0!=a||0!=s)&&(a>0&&(this.dbonds[i[0]].saved=t.bonds.get(i[0]).begin==r.begin?1:2,-1!=i[1]&&(this.dbonds[i[1]].saved=t.bonds.get(i[1]).begin==r.begin?2:1),this.dbonds[i[2]].saved=t.bonds.get(i[2]).begin==r.end==(o==l.default.PARITY.CIS)?1:2,-1!=i[3]&&(this.dbonds[i[3]].saved=t.bonds.get(i[3]).begin==r.end==(o==l.default.PARITY.CIS)?2:1)),s>0&&(this.dbonds[i[0]].saved=t.bonds.get(i[0]).begin==r.begin?2:1,-1!=i[1]&&(this.dbonds[i[1]].saved=t.bonds.get(i[1]).begin==r.begin?1:2),this.dbonds[i[2]].saved=t.bonds.get(i[2]).begin==r.end==(o==l.default.PARITY.CIS)?2:1,-1!=i[3]&&(this.dbonds[i[3]].saved=t.bonds.get(i[3]).begin==r.end==(o==l.default.PARITY.CIS)?1:2)),!0)},o.prototype.calcBondDirection=function(t,e,r){var n,o=this;if(-1==this.dbonds[e].ctbond_beg&&-1==this.dbonds[e].ctbond_end)return 0;if(t.bonds.get(e).type!=s.Bond.PATTERN.TYPE.SINGLE)throw new Error("internal: directed bond type "+t.bonds.get(e).type);for(;;){if(n=0,this.cis_trans.each(function(e,r){0===e.parity||o.isBondInRing(r)||o.updateSideBonds(t,r)&&n++}),n===this.touchedCistransbonds)break;this.touchedCistransbonds=n}return 0===this.dbonds[e].saved&&(r===t.bonds.get(e).begin?this.dbonds[e].saved=1:this.dbonds[e].saved=2),this.dbonds[e].saved},o.prototype.writeRadicals=function(t){var e,r,n=new Array(this.writtenAtoms.length);for(e=0;e<this.writtenAtoms.length;e++)if(!n[e]){var o=t.atoms.get(this.writtenAtoms[e]).radical;if(0!=o)for(this.comma?this.smiles+=",":(this.smiles+=" |",this.comma=!0),o==s.Atom.PATTERN.RADICAL.SINGLET?this.smiles+="^3:":o==s.Atom.PATTERN.RADICAL.DOUPLET?this.smiles+="^1:":this.smiles+="^4:",this.smiles+=e,r=e+1;r<this.writtenAtoms.length;r++)t.atoms.get(this.writtenAtoms[r]).radical==o&&(n[r]=!0,this.smiles+=","+r)}},r.default={stringify:function(t,e){var r=e||{};return(new o).saveMolecule(t,r.ignoreErrors)}}},{"../../util/pile":688,"../struct":542,"./cis_trans":535,"./dfs":536,"./stereocenters":538}],538:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){this.molecule=t,this.atoms=new l.default,this.getNeighbors=e,this.context=r}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Object.defineProperty(r,"__esModule",{value:!0});var a=t("../../util/vec2"),s=n(a),u=t("../../util/pool"),l=n(u),c=t("../../util/pile"),f=n(c),d=t("../struct");o.prototype.each=function(t,e){this.atoms.forEach(t,e)},o.prototype.buildFromBonds=function(t){var e=this,r=this.molecule.atoms,n=this.molecule.bonds,o=new f.default;r.forEach(function(t,i){var a=e.getNeighbors.call(e.context,i);if(2!==a.length)return!1;var s=a[0],u=a[1];if([i,s.aid,u.aid].findIndex(function(t){return["C","Si"].indexOf(r.get(t).label)<0},e)>=0)return!1;if([s.bid,u.bid].findIndex(function(t){return n.get(t).type!==d.Bond.PATTERN.TYPE.DOUBLE},e)>=0)return!1;var l=e.getNeighbors.call(e.context,s.aid).filter(function(t){return t.aid!=i}),c=e.getNeighbors.call(e.context,u.aid).filter(function(t){return t.aid!=i});return!(l.length<1||l.length>2||c.length<1||c.length>2)&&(!(l.concat(c).findIndex(function(t){return n.get(t.bid).type!=d.Bond.PATTERN.TYPE.SINGLE},e)>=0)&&(!(l.concat(c).findIndex(function(t){return n.get(t.bid).stereo==d.Bond.PATTERN.STEREO.EITHER},e)>=0)&&(o.add(s.aid).add(u.aid),!0)))}),o.size>0&&alert("This structure may contain allenes, which cannot be represented in the SMILES notation. Relevant stereo-information will be discarded."),r.forEach(function(t,r){if(!o.has(r)){var n=e.getNeighbors.call(e.context,r),i=!1;n.find(function(t){var e=this.molecule.bonds.get(t.bid);return e.type===d.Bond.PATTERN.TYPE.SINGLE&&e.begin==r&&(e.stereo===d.Bond.PATTERN.STEREO.UP||e.stereo==d.Bond.PATTERN.STEREO.DOWN)&&(i=!0,!0)},e),i&&e.buildOneCenter(r)}})},o.allowed_stereocenters=[{elem:"C",charge:0,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"C",charge:0,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"Si",charge:0,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"Si",charge:0,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:1,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:1,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:0,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"S",charge:0,degree:4,n_double_bonds:2,implicit_degree:4},{elem:"S",charge:1,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"S",charge:0,degree:3,n_double_bonds:1,implicit_degree:3},{elem:"P",charge:0,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"P",charge:1,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"P",charge:0,degree:4,n_double_bonds:1,implicit_degree:4}],o.prototype.buildOneCenter=function(t){var e=this,r=this.molecule.atoms.get(t),n=this.getNeighbors.call(this.context,t),a=n.length,u=-1,l={group:0,type:0,pyramid:[]},c=[],f=0,p=0;l.pyramid[0]=-1,l.pyramid[1]=-1,l.pyramid[2]=-1,l.pyramid[3]=-1;var h=0;if(a>4)throw new Error("stereocenter with %d bonds are not supported"+a);if(n.forEach(function(t,n){var o=e.molecule.atoms.get(t.aid),i=e.molecule.bonds.get(t.bid);if(c[n]={edge_idx:t.bid,nei_idx:t.aid,rank:t.aid,vec:s.default.diff(o.pp,r.pp).yComplement()},o.pureHydrogen()?(h++,c[n].rank=1e4):"H"===o.label&&(c[n].rank=5e3),!c[n].vec.normalize())throw new Error("zero bond length");if(i.type===d.Bond.PATTERN.TYPE.TRIPLE)throw new Error("non-single bonds not allowed near stereocenter");if(i.type===d.Bond.PATTERN.TYPE.AROMATIC)throw new Error("aromatic bonds not allowed near stereocenter");i.type===d.Bond.PATTERN.TYPE.DOUBLE&&p++}),o.allowed_stereocenters.find(function(t){return t.elem===r.label&&t.charge===r.charge&&t.degree===a&&t.n_double_bonds===p&&(u=t.implicit_degree,!0)}),-1===u)throw new Error("unknown stereocenter configuration: "+r.label+", charge "+r.charge+", "+a+" bonds ("+p+" double)");if(4===a&&h>1)throw new Error(h+" hydrogens near stereocenter");if(3===a&&4===u&&h>0)throw new Error("have hydrogen(s) besides implicit hydrogen near stereocenter");if(4===a){c[0].rank>c[1].rank&&i(c,0,1),c[1].rank>c[2].rank&&i(c,1,2),c[2].rank>c[3].rank&&i(c,2,3),c[1].rank>c[2].rank&&i(c,1,2),c[0].rank>c[1].rank&&i(c,0,1),c[1].rank>c[2].rank&&i(c,1,2);for(var m=-1,g=-1,v=-1,b=-1,y=0,_=0;_<4;_++){var x=this.getBondStereo(t,c[_].edge_idx);if(x===d.Bond.PATTERN.STEREO.UP||x==d.Bond.PATTERN.STEREO.DOWN){m=_,y=x;break}}if(-1===m)throw new Error("none of 4 bonds going from stereocenter is stereobond");var w,S;if(-1===g&&(w=o.xyzzy(c[m].vec,c[(m+1)%4].vec,c[(m+2)%4].vec),S=o.xyzzy(c[m].vec,c[(m+1)%4].vec,c[(m+3)%4].vec),w+S!=3&&w+S!=12||(g=(m+1)%4,v=(m+2)%4,b=(m+3)%4)),-1==g&&(w=o.xyzzy(c[m].vec,c[(m+2)%4].vec,c[(m+1)%4].vec),S=o.xyzzy(c[m].vec,c[(m+2)%4].vec,c[(m+3)%4].vec),w+S!=3&&w+S!=12||(g=(m+2)%4,v=(m+1)%4,b=(m+3)%4)),-1==g&&(w=o.xyzzy(c[m].vec,c[(m+3)%4].vec,c[(m+1)%4].vec),S=o.xyzzy(c[m].vec,c[(m+3)%4].vec,c[(m+2)%4].vec),w+S!=3&&w+S!=12||(g=(m+3)%4,v=(m+2)%4,b=(m+1)%4)),-1==g)throw new Error("internal error: can not find opposite bond");if(y==d.Bond.PATTERN.STEREO.UP&&this.getBondStereo(t,c[g].edge_idx)==d.Bond.PATTERN.STEREO.DOWN)throw new Error("stereo types of the opposite bonds mismatch");if(y==d.Bond.PATTERN.STEREO.DOWN&&this.getBondStereo(t,c[g].edge_idx)==d.Bond.PATTERN.STEREO.UP)throw new Error("stereo types of the opposite bonds mismatch");if(y==this.getBondStereo(t,c[v].edge_idx))throw new Error("stereo types of non-opposite bonds match");if(y==this.getBondStereo(t,c[b].edge_idx))throw new Error("stereo types of non-opposite bonds match");f=3==m||3==g?y:y==d.Bond.PATTERN.STEREO.UP?d.Bond.PATTERN.STEREO.DOWN:d.Bond.PATTERN.STEREO.UP,C=o.sign(c[0].vec,c[1].vec,c[2].vec),f==d.Bond.PATTERN.STEREO.UP&&C>0||f==d.Bond.PATTERN.STEREO.DOWN&&C<0?(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[1].nei_idx,l.pyramid[2]=c[2].nei_idx):(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[2].nei_idx,l.pyramid[2]=c[1].nei_idx),l.pyramid[3]=c[3].nei_idx}else if(3===a){c[0].rank>c[1].rank&&i(c,0,1),c[1].rank>c[2].rank&&i(c,1,2),c[0].rank>c[1].rank&&i(c,0,1);var O=this.getBondStereo(t,c[0].edge_idx),A=this.getBondStereo(t,c[1].edge_idx),E=this.getBondStereo(t,c[2].edge_idx),j=0,P=0;if(j+=O===d.Bond.PATTERN.STEREO.UP?1:0,j+=A===d.Bond.PATTERN.STEREO.UP?1:0,j+=E===d.Bond.PATTERN.STEREO.UP?1:0,P+=O===d.Bond.PATTERN.STEREO.DOWN?1:0,P+=A===d.Bond.PATTERN.STEREO.DOWN?1:0,P+=E===d.Bond.PATTERN.STEREO.DOWN?1:0,4==u){if(3==j)throw new Error("all 3 bonds up near stereoatom");if(3==P)throw new Error("all 3 bonds down near stereoatom");if(0==j&&0==P)throw new Error("no up/down bonds near stereoatom -- indefinite case");if(1==j&&1==P)throw new Error("one bond up, one bond down -- indefinite case");if(y=0,2==j)f=d.Bond.PATTERN.STEREO.DOWN;else if(2==P)f=d.Bond.PATTERN.STEREO.UP;else{for(m=-1,v=-1,b=-1,_=0;_<3;_++)if((k=this.getBondStereo(t,c[_].edge_idx))==d.Bond.PATTERN.STEREO.UP||k==d.Bond.PATTERN.STEREO.DOWN){m=_,y=k,v=(_+1)%3,b=(_+2)%3;break}if(-1==m)throw new Error("internal error: can not find up or down bond");var T=o.xyzzy(c[v].vec,c[b].vec,c[m].vec);if(3==T||4==T)throw new Error("degenerate case for 3 bonds near stereoatom");f=1==T?y:y==d.Bond.PATTERN.STEREO.UP?d.Bond.PATTERN.STEREO.DOWN:d.Bond.PATTERN.STEREO.UP}var C=o.sign(c[0].vec,c[1].vec,c[2].vec);f==d.Bond.PATTERN.STEREO.UP&&C>0||f==d.Bond.PATTERN.STEREO.DOWN&&C<0?(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[1].nei_idx,l.pyramid[2]=c[2].nei_idx):(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[2].nei_idx,l.pyramid[2]=c[1].nei_idx),l.pyramid[3]=-1}else{var k;if(P>0&&j>0)throw new Error("one bond up, one bond down -- indefinite case");if(0==P&&0==j)throw new Error("no up-down bonds attached to stereocenter");k=j>0?1:-1,1!==o.xyzzy(c[0].vec,c[1].vec,c[2].vec)&&1!==o.xyzzy(c[0].vec,c[2].vec,c[1].vec)&&1!==o.xyzzy(c[2].vec,c[1].vec,c[0].vec)||(k=-k),C=o.sign(c[0].vec,c[1].vec,c[2].vec),C==k?(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[2].nei_idx,l.pyramid[2]=c[1].nei_idx):(l.pyramid[0]=c[0].nei_idx,l.pyramid[1]=c[1].nei_idx,l.pyramid[2]=c[2].nei_idx),l.pyramid[3]=-1}}this.atoms.set(t,l)},o.prototype.getBondStereo=function(t,e){var r=this.molecule.bonds.get(e);return t!=r.begin?0:r.stereo},o.xyzzy=function(t,e,r){var n=s.default.cross(t,e),o=s.default.dot(t,e),i=s.default.cross(t,r),a=s.default.dot(t,r);if(Math.abs(n)<.001){if(Math.abs(i)<.001)throw new Error("degenerate case -- bonds overlap");return i>0?4:8}return n*i<-1e-6?2:a<o?2:1},o.sign=function(t,e,r){var n=(t.x-r.x)*(e.y-r.y)-(t.y-r.y)*(e.x-r.x);if(n>.001)return 1;if(n<-.001)return-1;throw new Error("degenerate triangle")},o.isPyramidMappingRigid=function(t){var e=t.slice(),r=!0;return e[0]>e[1]&&(i(e,0,1),r=!r),e[1]>e[2]&&(i(e,1,2),r=!r),e[2]>e[3]&&(i(e,2,3),r=!r),e[1]>e[2]&&(i(e,1,2),r=!r),e[0]>e[1]&&(i(e,0,1),r=!r),e[1]>e[2]&&(i(e,1,2),r=!r),r},r.default=o},{"../../util/pile":688,"../../util/pool":689,"../../util/vec2":691,"../struct":542}],539:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=o.attrGetDefault;console.assert(t||"label"in t,"label must be specified!"),this.label=t.label,this.fragment="fragment"in t?t.fragment:-1,this.pseudo=t.pseudo||s(t.label),a(this,t,"alias",e("alias")),a(this,t,"isotope",e("isotope")),a(this,t,"radical",e("radical")),a(this,t,"charge",e("charge")),a(this,t,"rglabel",e("rglabel")),a(this,t,"attpnt",e("attpnt")),a(this,t,"explicitValence",e("explicitValence")),this.valence=0,this.implicitH=0,this.pp=t.pp?new l.default(t.pp):new l.default,this.sgs=new f.default,a(this,t,"ringBondCount",e("ringBondCount")),a(this,t,"substitutionCount",e("substitutionCount")),a(this,t,"unsaturatedAtom",e("unsaturatedAtom")),a(this,t,"hCount",e("hCount")),a(this,t,"aam",e("aam")),a(this,t,"invRet",e("invRet")),a(this,t,"exactChangeFlag",e("exactChangeFlag")),a(this,t,"rxnFragmentType",-1),this.atomList=t.atomList?new m.default(t.atomList):null,this.neighbors=[],this.badConn=!1}function i(t){return t-=0,t===o.PATTERN.RADICAL.NONE?0:t===o.PATTERN.RADICAL.DOUPLET?1:t===o.PATTERN.RADICAL.SINGLET||t===o.PATTERN.RADICAL.TRIPLET?2:console.assert(!1,"Unknown radical value")}function a(t,e,r,n){t[r]=void 0!==e[r]?e[r]:n}function s(t){return p.default.map[t]||"L"===t||"L#"===t||"R#"===t?null:t}Object.defineProperty(r,"__esModule",{value:!0}),r.radicalElectrons=i;var u=t("../../util/vec2"),l=n(u),c=t("../../util/pile"),f=n(c),d=t("../element"),p=n(d),h=t("./atomlist"),m=n(h);o.getAttrHash=function(t){var e={};for(var r in o.attrlist)void 0!==t[r]&&(e[r]=t[r]);return e},o.attrGetDefault=function(t){return t in o.attrlist?o.attrlist[t]:console.assert(!1,"Attribute unknown")},o.PATTERN={RADICAL:{NONE:0,SINGLET:1,DOUPLET:2,TRIPLET:3}},o.attrlist={alias:null,label:"C",pseudo:null,isotope:0,radical:0,charge:0,explicitValence:-1,ringBondCount:0,substitutionCount:0,unsaturatedAtom:0,hCount:0,atomList:null,invRet:0,exactChangeFlag:0,rglabel:null,attpnt:null,aam:0},o.prototype.clone=function(t){var e=new o(this);return t&&t.has(this.fragment)&&(e.fragment=t.get(this.fragment)),e},o.prototype.isQuery=function(){return null!==this.atomList||"A"===this.label||this.attpnt||this.hCount},o.prototype.pureHydrogen=function(){return"H"===this.label&&0===this.isotope},o.prototype.isPlainCarbon=function(){return"C"===this.label&&0===this.isotope&&0===this.radical&&0===this.charge&&this.explicitValence<0&&0===this.ringBondCount&&0===this.substitutionCount&&0===this.unsaturatedAtom&&0===this.hCount&&!this.atomList},o.prototype.isPseudo=function(){return!this.atomList&&!this.rglabel&&!p.default.map[this.label]},o.prototype.hasRxnProps=function(){return!!(this.invRet||this.exactChangeFlag||null!==this.attpnt||this.aam)},o.prototype.calcValence=function(t){var e=this,r=e.charge,n=e.label;if(e.isQuery())return this.implicitH=0,!0;var o=p.default.map[n];if(void 0===o)return this.implicitH=0,!0;var a=p.default[o].group,s=i(e.radical),u=t,l=0,c=Math.abs(r);return 1===a?"H"!==n&&"Li"!==n&&"Na"!==n&&"K"!==n&&"Rb"!==n&&"Cs"!==n&&"Fr"!==n||(u=1,l=1-s-t-c):2===a?t+s+c===2||t+s+c===0?u=2:l=-1:3===a?"B"===n||"Al"===n||"Ga"===n||"In"===n?-1===r?(u=4,l=4-s-t):(u=3,l=3-s-t-c):"Tl"===n&&(-1===r?s+t<=2?(u=2,l=2-s-t):(u=4,l=4-s-t):-2===r?s+t<=3?(u=3,l=3-s-t):(u=5,l=5-s-t):s+t+c<=1?(u=1,l=1-s-t-c):(u=3,l=3-s-t-c)):4===a?"C"===n||"Si"===n||"Ge"===n?(u=4,l=4-s-t-c):"Sn"!==n&&"Pb"!==n||(t+s+c<=2?(u=2,l=2-s-t-c):(u=4,l=4-s-t-c)):5===a?"N"===n||"P"===n?1===r?(u=4,l=4-s-t):2===r?(u=3,l=3-s-t):"N"===n||s+t+c<=3?(u=3,l=3-s-t-c):(u=5,l=5-s-t-c):"Bi"!==n&&"Sb"!==n&&"As"!==n||(1===r?s+t<=2&&"As"!==n?(u=2,l=2-s-t):(u=4,l=4-s-t):2===r?(u=3,l=3-s-t):s+t<=3?(u=3,l=3-s-t-c):(u=5,l=5-s-t-c)):6===a?"O"===n?r>=1?(u=3,l=3-s-t):(u=2,l=2-s-t-c):"S"===n||"Se"===n||"Po"===n?1===r?t<=3?(u=3,l=3-s-t):(u=5,l=5-s-t):t+s+c<=2?(u=2,l=2-s-t-c):t+s+c<=4?(u=4,l=4-s-t-c):(u=6,l=6-s-t-c):"Te"===n&&(-1===r?t<=2&&(u=2,l=2-s-t-c):0!==r&&2!==r||(t<=2?(u=2,l=2-s-t-c):t<=4?(u=4,l=4-s-t-c):0===r&&t<=6?(u=6,l=6-s-t-c):l=-1)):7===a?"F"===n?(u=1,l=1-s-t-c):"Cl"!==n&&"Br"!==n&&"I"!==n&&"At"!==n||(1===r?t<=2?(u=2,l=2-s-t):(3===t||5===t||t>=7)&&(l=-1):0===r&&(t<=1?(u=1,l=1-s-t):2===t||4===t||6===t?1===s?(u=t,l=0):l=-1:t>7&&(l=-1))):8===a&&(t+s+c===0?u=1:l=-1),this.valence=u,this.implicitH=l,!(this.implicitH<0)||(this.valence=t,this.implicitH=0,this.badConn=!0,!1)},o.prototype.calcValenceMinusHyd=function(t){var e=this,r=e.charge,n=e.label,o=p.default.map[n];if(null===o&&console.assert("Element "+n+" unknown"),o<0)return this.implicitH=0,null;var a=p.default[o].group,s=i(e.radical);if(3===a){if(("B"===n||"Al"===n||"Ga"===n||"In"===n)&&-1===r&&s+t<=4)return s+t}else if(5===a){if("N"===n||"P"===n){if(1===r)return s+t;if(2===r)return s+t}else if("Sb"===n||"Bi"===n||"As"===n){if(1===r)return s+t;if(2===r)return s+t}}else if(6===a){if("O"===n){if(r>=1)return s+t}else if(("S"===n||"Se"===n||"Po"===n)&&1===r)return s+t}else if(7===a&&("Cl"===n||"Br"===n||"I"===n||"At"===n)&&1===r)return s+t;return s+t+Math.abs(r)},r.default=o},{"../../util/pile":688,"../../util/vec2":691,"../element":525,"./atomlist":540}],540:[function(t,e,r){"use strict";function n(t){console.assert(t&&"notList"in t&&"ids"in t,"'notList' and 'ids' must be specified!"),this.notList=t.notList,this.ids=t.ids}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../element"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.prototype.labelList=function(){for(var t=[],e=0;e<this.ids.length;++e)t.push(i.default[this.ids[e]].label);return t},n.prototype.label=function(){var t="["+this.labelList().join(",")+"]";return this.notList&&(t="!"+t),t},n.prototype.equals=function(t){return this.notList==t.notList&&(this.ids||[]).sort().toString()===(t.ids||[]).sort().toString()},r.default=n},{"../element":525}],541:[function(t,e,r){"use strict";function n(t){console.assert(t&&"begin"in t&&"end"in t&&"type"in t,"'begin', 'end' and 'type' properties must be specified!"),this.begin=t.begin,this.end=t.end,this.type=t.type,this.xxx=t.xxx||"",this.stereo=n.PATTERN.STEREO.NONE,this.topology=n.PATTERN.TOPOLOGY.EITHER,this.reactingCenterStatus=0,this.hb1=null,this.hb2=null,this.len=0,this.sb=0,this.sa=0,this.angle=0,t.stereo&&(this.stereo=t.stereo),t.topology&&(this.topology=t.topology),t.reactingCenterStatus&&(this.reactingCenterStatus=t.reactingCenterStatus),this.center=new i.default}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../../util/vec2"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.PATTERN={TYPE:{SINGLE:1,DOUBLE:2,TRIPLE:3,AROMATIC:4,SINGLE_OR_DOUBLE:5,SINGLE_OR_AROMATIC:6,DOUBLE_OR_AROMATIC:7,ANY:8},STEREO:{NONE:0,UP:1,EITHER:4,DOWN:6,CIS_TRANS:3},TOPOLOGY:{EITHER:0,RING:1,CHAIN:2},REACTING_CENTER:{NOT_CENTER:-1,UNMARKED:0,CENTER:1,UNCHANGED:2,MADE_OR_BROKEN:4,ORDER_CHANGED:8,MADE_OR_BROKEN_AND_CHANGED:12}},n.attrlist={type:n.PATTERN.TYPE.SINGLE,stereo:n.PATTERN.STEREO.NONE,topology:n.PATTERN.TOPOLOGY.EITHER,reactingCenterStatus:n.PATTERN.REACTING_CENTER.UNMARKED},n.getAttrHash=function(t){var e={};for(var r in n.attrlist)void 0!==t[r]&&(e[r]=t[r]);return e},n.attrGetDefault=function(t){return t in n.attrlist?n.attrlist[t]:console.error("Attribute unknown")},n.prototype.hasRxnProps=function(){return!!this.reactingCenterStatus},n.prototype.getCenter=function(t){var e=t.atoms.get(this.begin).pp,r=t.atoms.get(this.end).pp
  ;return i.default.lc2(e,.5,r,.5)},n.prototype.getDir=function(t){var e=t.atoms.get(this.begin).pp;return t.atoms.get(this.end).pp.sub(e).normalized()},n.prototype.clone=function(t){var e=new n(this);return t&&(e.begin=t.get(e.begin),e.end=t.get(e.end)),e},r.default=n},{"../../util/vec2":691}],542:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(){this.atoms=new p.default,this.bonds=new p.default,this.sgroups=new p.default,this.halfBonds=new p.default,this.loops=new p.default,this.isChiral=!1,this.isReaction=!1,this.rxnArrows=new p.default,this.rxnPluses=new p.default,this.frags=new p.default,this.rgroups=new p.default,this.name="",this.sGroupForest=new R.default(this)}function a(t,e,r){console.assert(3===arguments.length,"Invalid parameter number!"),this.begin=t,this.end=e,this.bid=r,this.dir=new v.default,this.norm=new v.default,this.ang=0,this.p=new v.default,this.loop=-1,this.contra=-1,this.next=-1,this.leftSin=0,this.leftCos=0,this.leftNeighbor=0,this.rightSin=0,this.rightCos=0,this.rightNeighbor=0}function s(t,e,r){var n=this;this.hbs=t,this.dblBonds=0,this.aromatic=!0,this.convex=r||!1,t.forEach(function(t){var r=e.bonds.get(e.halfBonds.get(t).bid);r.type!==j.default.PATTERN.TYPE.AROMATIC&&(n.aromatic=!1),r.type===j.default.PATTERN.TYPE.DOUBLE&&n.dblBonds++})}function u(t){t=t||{},this.pp=t.pp?new v.default(t.pp):new v.default}function l(t){t=t||{},this.pp=t.pp?new v.default(t.pp):new v.default}function c(t,e){for(var r=0;r<t.length;++r)if(t[r]===e)return!1;return t.push(e),!0}Object.defineProperty(r,"__esModule",{value:!0}),r.RxnArrow=r.RxnPlus=r.RGroup=r.SGroup=r.Bond=r.AtomList=r.Atom=void 0;var f=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=t("../../util/pool"),p=n(d),h=t("../../util/pile"),m=n(h),g=t("../../util/vec2"),v=n(g),b=t("../../util/box2abs"),y=n(b),_=t("../element"),x=n(_),w=t("./atom"),S=n(w),O=t("./atomlist"),A=n(O),E=t("./bond"),j=n(E),P=t("./sgroup"),T=n(P),C=t("./rgroup"),k=n(C),M=t("./sgforest"),R=n(M);i.prototype.hasRxnProps=function(){return this.atoms.find(function(t,e){return e.hasRxnProps()})||this.bonds.find(function(t,e){return e.hasRxnProps()})},i.prototype.hasRxnArrow=function(){return this.rxnArrows.size>0},i.prototype.isBlank=function(){return 0===this.atoms.size&&0===this.rxnArrows.size&&0===this.rxnPluses.size&&!this.isChiral},i.prototype.clone=function(t,e,r,n){return this.mergeInto(new i,t,e,r,!1,n)},i.prototype.getScaffold=function(){var t=this,e=new m.default;return this.atoms.forEach(function(t,r){e.add(r)}),this.rgroups.forEach(function(r){r.frags.forEach(function(r,n){t.atoms.forEach(function(t,r){t.fragment===n&&e.delete(r)})})}),this.clone(e)},i.prototype.getFragmentIds=function(t){var e=new m.default;return this.atoms.forEach(function(r,n){r.fragment===t&&e.add(n)}),e},i.prototype.getFragment=function(t){return this.clone(this.getFragmentIds(t))},i.prototype.mergeInto=function(t,e,r,n,o,i){var a=this;e=e||new m.default(this.atoms.keys()),r=r||new m.default(this.bonds.keys()),i=i||new Map,r=r.filter(function(t){var r=a.bonds.get(t);return e.has(r.begin)&&e.has(r.end)});var s=new m.default;this.atoms.forEach(function(t,r){e.has(r)&&s.add(t.fragment)});var u=new Map;this.frags.forEach(function(e,r){s.has(r)&&u.set(r,t.frags.add(Object.assign({},e)))});var l=[];this.rgroups.forEach(function(e,r){var n=o;if(n||(e.frags.forEach(function(t,e){l.push(e),s.has(e)&&(n=!0)}),n)){var i=t.rgroups.get(r);i?e.frags.forEach(function(t,e){l.push(e),s.has(e)&&i.frags.add(u.get(e))}):t.rgroups.set(r,e.clone(u))}}),this.atoms.forEach(function(r,n){e.has(n)&&-1===l.indexOf(r.fragment)&&i.set(n,t.atoms.add(r.clone(u)))}),this.atoms.forEach(function(r,n){e.has(n)&&-1!==l.indexOf(r.fragment)&&i.set(n,t.atoms.add(r.clone(u)))});var c=new Map;return this.bonds.forEach(function(e,n){r.has(n)&&c.set(n,t.bonds.add(e.clone(i)))}),this.sgroups.forEach(function(r){if(!r.atoms.some(function(t){return!e.has(t)})){r=T.default.clone(r,i);var n=t.sgroups.add(r);r.id=n,r.atoms.forEach(function(e){t.atoms.get(e).sgs.add(n)}),"DAT"===r.type?t.sGroupForest.insert(r.id,-1,[]):t.sGroupForest.insert(r.id)}}),t.isChiral=t.isChiral||this.isChiral,n||(t.isReaction=this.isReaction,this.rxnArrows.forEach(function(e){t.rxnArrows.add(e.clone())}),this.rxnPluses.forEach(function(e){t.rxnPluses.add(e.clone())})),t},i.prototype.findBondId=function(t,e){return this.bonds.find(function(r,n){return n.begin===t&&n.end===e||n.begin===e&&n.end===t})},i.prototype.initNeighbors=function(){var t=this;this.atoms.forEach(function(t){t.neighbors=[]}),this.bonds.forEach(function(e){var r=t.atoms.get(e.begin),n=t.atoms.get(e.end);r.neighbors.push(e.hb1),n.neighbors.push(e.hb2)})},i.prototype.bondInitHalfBonds=function(t,e){e=e||this.bonds.get(t),e.hb1=2*t,e.hb2=2*t+1,this.halfBonds.set(e.hb1,new a(e.begin,e.end,t)),this.halfBonds.set(e.hb2,new a(e.end,e.begin,t));var r=this.halfBonds.get(e.hb1),n=this.halfBonds.get(e.hb2);r.contra=e.hb2,n.contra=e.hb1},i.prototype.halfBondUpdate=function(t){var e=this.halfBonds.get(t),r=this.atoms.get(e.begin).pp,n=this.atoms.get(e.end).pp,o=v.default.diff(n,r).normalized();e.dir=v.default.dist(n,r)>1e-4?o:new v.default(1,0),e.norm=e.dir.turnLeft(),e.ang=e.dir.oxAngle(),e.loop<0&&(e.loop=-1)},i.prototype.initHalfBonds=function(){var t=this;this.halfBonds.clear(),this.bonds.forEach(function(e,r){t.bondInitHalfBonds(r,e)})},i.prototype.setHbNext=function(t,e){this.halfBonds.get(this.halfBonds.get(t).contra).next=e},i.prototype.halfBondSetAngle=function(t,e){var r=this.halfBonds.get(t),n=this.halfBonds.get(e);n.rightCos=v.default.dot(n.dir,r.dir),r.leftCos=v.default.dot(n.dir,r.dir),n.rightSin=v.default.cross(n.dir,r.dir),r.leftSin=v.default.cross(n.dir,r.dir),r.leftNeighbor=e,n.rightNeighbor=t},i.prototype.atomAddNeighbor=function(t){for(var e=this.halfBonds.get(t),r=this.atoms.get(e.begin),n=0;n<r.neighbors.length&&!(this.halfBonds.get(r.neighbors[n]).ang>e.ang);++n);r.neighbors.splice(n,0,t);var o=r.neighbors[(n+1)%r.neighbors.length],i=r.neighbors[(n+r.neighbors.length-1)%r.neighbors.length];this.setHbNext(i,t),this.setHbNext(t,o),this.halfBondSetAngle(t,i),this.halfBondSetAngle(o,t)},i.prototype.atomSortNeighbors=function(t){var e=this,r=this.atoms.get(t),n=this.halfBonds;r.neighbors.sort(function(t,e){return n.get(t).ang-n.get(e).ang}).forEach(function(t,n){var o=r.neighbors[(n+1)%r.neighbors.length];e.halfBonds.get(e.halfBonds.get(t).contra).next=o,e.halfBondSetAngle(o,t)})},i.prototype.sortNeighbors=function(t){var e=this;t?t.forEach(function(t){e.atomSortNeighbors(t)}):this.atoms.forEach(function(t,r){e.atomSortNeighbors(r)})},i.prototype.atomUpdateHalfBonds=function(t){var e=this;this.atoms.get(t).neighbors.forEach(function(t){e.halfBondUpdate(t),e.halfBondUpdate(e.halfBonds.get(t).contra)})},i.prototype.updateHalfBonds=function(t){var e=this;t?t.forEach(function(t){e.atomUpdateHalfBonds(t)}):this.atoms.forEach(function(t,r){e.atomUpdateHalfBonds(r)})},i.prototype.sGroupsRecalcCrossBonds=function(){var t=this;this.sgroups.forEach(function(t){t.xBonds=[],t.neiAtoms=[]}),this.bonds.forEach(function(e,r){var n=t.atoms.get(e.begin),o=t.atoms.get(e.end);n.sgs.forEach(function(n){if(!o.sgs.has(n)){var i=t.sgroups.get(n);i.xBonds.push(r),c(i.neiAtoms,e.end)}}),o.sgs.forEach(function(o){if(!n.sgs.has(o)){var i=t.sgroups.get(o);i.xBonds.push(r),c(i.neiAtoms,e.begin)}})})},i.prototype.sGroupDelete=function(t){var e=this;this.sgroups.get(t).atoms.forEach(function(r){e.atoms.get(r).sgs.delete(t)}),this.sGroupForest.remove(t),this.sgroups.delete(t)},i.prototype.atomSetPos=function(t,e){this.atoms.get(t).pp=e},i.prototype.rxnPlusSetPos=function(t,e){this.rxnPluses.get(t).pp=e},i.prototype.rxnArrowSetPos=function(t,e){this.rxnArrows.get(t).pp=e},i.prototype.getCoordBoundingBox=function(t){function e(t){r?(r.min=v.default.min(r.min,t),r.max=v.default.max(r.max,t)):r={min:t,max:t}}var r=null,n=!t||0===t.size;return this.atoms.forEach(function(r,o){(n||t.has(o))&&e(r.pp)}),n&&(this.rxnPluses.forEach(function(t){e(t.pp)}),this.rxnArrows.forEach(function(t){e(t.pp)})),!r&&n&&(r={min:new v.default(0,0),max:new v.default(1,1)}),r},i.prototype.getCoordBoundingBoxObj=function(){function t(t){e?(e.min=v.default.min(e.min,t),e.max=v.default.max(e.max,t)):e={min:new v.default(t),max:new v.default(t)}}var e=null;return this.atoms.forEach(function(e){t(e.pp)}),e},i.prototype.getBondLengthData=function(){var t=this,e=0,r=0;return this.bonds.forEach(function(n){e+=v.default.dist(t.atoms.get(n.begin).pp,t.atoms.get(n.end).pp),r++}),{cnt:r,totalLength:e}},i.prototype.getAvgBondLength=function(){var t=this.getBondLengthData();return t.cnt>0?t.totalLength/t.cnt:-1},i.prototype.getAvgClosestAtomDistance=function(){var t,e,r,n=0,o=0,i=this.atoms.keys();for(e=0;e<i.length;++e){for(t=-1,r=0;r<i.length;++r)r!=e&&(o=v.default.dist(this.atoms.get(i[r]).pp,this.atoms.get(i[e]).pp),(t<0||t>o)&&(t=o));n+=t}return i.length>0?n/i.length:-1},i.prototype.checkBondExists=function(t,e){return void 0!==this.bonds.find(function(r,n){return n.begin===t&&n.end===e||n.end===t&&n.begin===e})},i.prototype.findConnectedComponent=function(t){for(var e=this,r=[t],n=new m.default;r.length>0;){var o=r.pop();n.add(o);this.atoms.get(o).neighbors.forEach(function(t){var o=e.halfBonds.get(t).end;n.has(o)||r.push(o)})}return n},i.prototype.findConnectedComponents=function(t){var e=this;this.halfBonds.size||(this.initHalfBonds(),this.initNeighbors(),this.updateHalfBonds(Array.from(this.atoms.keys())),this.sortNeighbors(Array.from(this.atoms.keys())));var r=new m.default,n=[];return this.atoms.forEach(function(o,i){if((t||o.fragment<0)&&!r.has(i)){var a=e.findConnectedComponent(i);n.push(a),r=r.union(a)}}),n},i.prototype.markFragment=function(t){var e=this,r={},n=this.frags.add(r);t.forEach(function(t){e.atoms.get(t).fragment=n})},i.prototype.markFragments=function(){var t=this;this.findConnectedComponents().forEach(function(e){t.markFragment(e)})},i.prototype.scale=function(t){1!==t&&(this.atoms.forEach(function(e){e.pp=e.pp.scaled(t)}),this.rxnPluses.forEach(function(e){e.pp=e.pp.scaled(t)}),this.rxnArrows.forEach(function(e){e.pp=e.pp.scaled(t)}),this.sgroups.forEach(function(e){e.pp=e.pp?e.pp.scaled(t):null}))},i.prototype.rescale=function(){var t=this.getAvgBondLength();t<0&&!this.isReaction&&(t=this.getAvgClosestAtomDistance()),t<.001&&(t=1);var e=1/t;this.scale(e)},i.prototype.loopHasSelfIntersections=function(t){for(var e=0;e<t.length;++e)for(var r=this.halfBonds.get(t[e]),n=this.atoms.get(r.begin).pp,o=this.atoms.get(r.end).pp,i=new m.default([r.begin,r.end]),a=e+2;a<t.length;++a){var s=this.halfBonds.get(t[a]);if(!i.has(s.begin)&&!i.has(s.end)){var u=this.atoms.get(s.begin).pp,l=this.atoms.get(s.end).pp;if(y.default.segmentIntersection(n,o,u,l))return!0}}return!1},i.prototype.partitionLoop=function(t){for(var e=[],r=!0;r;){var n={};r=!1;for(var o=0;o<t.length;++o){var i=t[o],a=this.halfBonds.get(i).begin,s=this.halfBonds.get(i).end;if(s in n){var u=n[s],l=t.slice(u,o+1);e.push(l),o<t.length&&t.splice(u,o-u+1),r=!0;break}n[a]=o}r||e.push(t)}return e},i.prototype.halfBondAngle=function(t,e){var r=this.halfBonds.get(t),n=this.halfBonds.get(e);return Math.atan2(v.default.cross(r.dir,n.dir),v.default.dot(r.dir,n.dir))},i.prototype.loopIsConvex=function(t){var e=this;return t.every(function(t,r,n){return e.halfBondAngle(t,n[(r+1)%n.length])<=0})},i.prototype.loopIsInner=function(t){var e=this,r=2*Math.PI;return t.forEach(function(t,n,o){var i=o[(n+1)%o.length],a=e.halfBonds.get(i),s=e.halfBondAngle(t,i);r+=a.contra===t?Math.PI:s}),Math.abs(r)<Math.PI},i.prototype.findLoops=function(){var t=this,e=[],r=new m.default,n=void 0,i=void 0,a=void 0,u=void 0;return this.halfBonds.forEach(function(l,c){if(-1===l.loop)for(n=c,i=0,a=[];i<=t.halfBonds.size;n=t.halfBonds.get(n).next,++i){if(i>0&&n===c){var f=t.partitionLoop(a);f.forEach(function(n){t.loopIsInner(n)&&!t.loopHasSelfIntersections(n)?(u=Math.min.apply(Math,o(n)),t.loops.set(u,new s(n,t,t.loopIsConvex(n)))):u=-2,n.forEach(function(e){t.halfBonds.get(e).loop=u,r.add(t.halfBonds.get(e).bid)}),u>=0&&e.push(u)});break}a.push(n)}}),{newLoops:e,bondsToMark:Array.from(r)}},i.prototype.prepareLoopStructure=function(){this.initHalfBonds(),this.initNeighbors(),this.updateHalfBonds(Array.from(this.atoms.keys())),this.sortNeighbors(Array.from(this.atoms.keys())),this.findLoops()},i.prototype.atomAddToSGroup=function(t,e){T.default.addAtom(this.sgroups.get(t),e),this.atoms.get(e).sgs.add(t)},i.prototype.calcConn=function(t){for(var e=0,r=0;r<t.neighbors.length;++r){var n=this.halfBonds.get(t.neighbors[r]);switch(this.bonds.get(n.bid).type){case j.default.PATTERN.TYPE.SINGLE:e+=1;break;case j.default.PATTERN.TYPE.DOUBLE:e+=2;break;case j.default.PATTERN.TYPE.TRIPLE:e+=3;break;case j.default.PATTERN.TYPE.AROMATIC:return 1===t.neighbors.length?[-1,!0]:[t.neighbors.length,!0];default:return[-1,!1]}}return[e,!1]},i.prototype.calcImplicitHydrogen=function(t){var e=this.atoms.get(t),r=this.calcConn(e),n=f(r,2),o=n[0],i=n[1],a=o;if(e.badConn=!1,i)if("C"===e.label&&0===e.charge){if(3===o)return void(e.implicitH=-(0,w.radicalElectrons)(e.radical));if(2===o)return void(e.implicitH=1-(0,w.radicalElectrons)(e.radical))}else{if("O"===e.label&&0===e.charge||"N"===e.label&&0===e.charge&&3===o||"N"===e.label&&1===e.charge&&3===o||"S"===e.label&&0===e.charge&&3===o)return void(e.implicitH=0);e.hasImplicitH||a++}if(a<0||e.isQuery())return void(e.implicitH=0);if(e.explicitValence>=0){var s=x.default.map[e.label];e.implicitH=null!==s?e.explicitValence-e.calcValenceMinusHyd(a):0,e.implicitH<0&&(e.implicitH=0,e.badConn=!0)}else e.calcValence(a)},i.prototype.setImplicitHydrogen=function(t){var e=this;this.sgroups.forEach(function(t){"MRV_IMPLICIT_H"===t.data.fieldName&&(e.atoms.get(t.atoms[0]).hasImplicitH=!0)}),t?t.forEach(function(t){e.calcImplicitHydrogen(t)}):this.atoms.forEach(function(t,r){e.calcImplicitHydrogen(r)})},i.prototype.getComponents=function(){var t=this,e=this.findConnectedComponents(!0),r=[],n=null;this.rxnArrows.forEach(function(t){n=t.pp.x}),this.rxnPluses.forEach(function(t){r.push(t.pp.x)}),null!==n&&r.push(n),r.sort(function(t,e){return t-e});var o=[];e.forEach(function(e){for(var n=t.getCoordBoundingBox(e),i=v.default.lc2(n.min,.5,n.max,.5),a=0;i.x>r[a];)++a;o[a]=o[a]||new m.default,o[a]=o[a].union(e)});var i=[],a=[],s=[];return o.forEach(function(e){if(!e)return void i.push("");1===t.defineRxnFragmentTypeForAtomset(e,n)?a.push(e):s.push(e)}),{reactants:a,products:s}},i.prototype.defineRxnFragmentTypeForAtomset=function(t,e){var r=this.getCoordBoundingBox(t);return v.default.lc2(r.min,.5,r.max,.5).x<e?1:2},i.prototype.getBondFragment=function(t){var e=this.bonds.get(t).begin;return this.atoms.get(e).fragment},u.prototype.clone=function(){return new u(this)},l.prototype.clone=function(){return new l(this)},r.default=i,r.Atom=S.default,r.AtomList=A.default,r.Bond=j.default,r.SGroup=T.default,r.RGroup=k.default,r.RxnPlus=u,r.RxnArrow=l},{"../../util/box2abs":687,"../../util/pile":688,"../../util/pool":689,"../../util/vec2":691,"../element":525,"./atom":539,"./atomlist":540,"./bond":541,"./rgroup":543,"./sgforest":544,"./sgroup":545}],543:[function(t,e,r){"use strict";function n(t){t=t||{},this.frags=new i.default,this.resth=t.resth||!1,this.range=t.range||"",this.ifthen=t.ifthen||0}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../../util/pile"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.prototype.getAttrs=function(){return{resth:this.resth,range:this.range,ifthen:this.ifthen}},n.findRGroupByFragment=function(t,e){return t.find(function(t,r){return r.frags.has(e)})},n.prototype.clone=function(t){var e=new n(this);return this.frags.forEach(function(r){e.frags.add(t?t.get(r):r)}),e},r.default=n},{"../../util/pile":688}],544:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.parent=new a.default,this.children=new a.default,this.children.set(-1,[]),this.molecule=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/pool"),a=n(i),s=t("../../util/pile"),u=n(s);o.prototype.getSGroupsBFS=function(){for(var t=[],e=-1,r=[].slice.call(this.children.get(-1));r.length>0;)e=r.shift(),r=r.concat(this.children.get(e)),t.push(e);return t},o.prototype.getAtomSets=function(){var t=new Map;return this.molecule.sgroups.forEach(function(e,r){t.set(r,new u.default(e.atoms))}),t},o.prototype.getAtomSetRelations=function(t,e){var r=this,n=new Map,o=new Map,i=this.getAtomSets();i.delete(t),i.forEach(function(t,r){o.set(r,t.isSuperset(e)),n.set(r,e.isSuperset(t)&&!t.equals(e))});var a=Array.from(i.keys()).filter(function(t){return!!o.get(t)&&r.children.get(t).findIndex(function(t){return o.get(t)})<0});return{children:Array.from(i.keys()).filter(function(t){return n.get(t)&&!n.get(r.parent.get(t))}),parent:0===a.length?-1:a[0]}},o.prototype.getPathToRoot=function(t){for(var e=[],r=t;r>=0;r=this.parent.get(r))console.assert(e.indexOf(r)<0,"SGroupForest: loop detected"),e.push(r);return e},o.prototype.validate=function(){var t=this,e=this.getAtomSets();this.molecule.sgroups.forEach(function(e,r){t.getPathToRoot(r)});var r=!0;return this.parent.forEach(function(t,n){t>=0&&!e.get(t).isSuperset(e.get(n))&&(r=!1)}),this.children.forEach(function(n){for(var o=0;o<n.length;++o)for(var i=o+1;i<n.length;++i){var a=n[o],s=n[i],u=t.molecule.sgroups.get(a),l=t.molecule.sgroups.get(s);0!==e.get(a).intersection(e.get(s)).size&&"DAT"!==u.type&&"DAT"!==l.type&&(r=!1)}}),r},o.prototype.insert=function(t,e,r){var n=this;console.assert(!this.parent.has(t),"sgid already present in the forest"),console.assert(!this.children.has(t),"sgid already present in the forest"),console.assert(this.validate(),"s-group forest invalid");var o=new u.default(this.molecule.sgroups.get(t).atoms);if(!e||!r){var i=this.getAtomSetRelations(t,o);e=i.parent,r=i.children}return r.forEach(function(e){var r=n.children.get(n.parent.get(e)),o=r.indexOf(e);console.assert(o>=0&&r.indexOf(e,o+1)<0,"Assertion failed"),r.splice(o,1),n.parent.set(e,t)}),this.children.set(t,r),this.parent.set(t,e),this.children.get(e).push(t),console.assert(this.validate(),"s-group forest invalid"),{parent:e,children:r}},o.prototype.remove=function(t){var e=this;console.assert(this.parent.has(t),"sgid is not in the forest"),console.assert(this.children.has(t),"sgid is not in the forest"),console.assert(this.validate(),"s-group forest invalid");var r=this.parent.get(t);this.children.get(t).forEach(function(t){e.parent.set(t,r),e.children.get(r).push(t)});var n=this.children.get(r),o=n.indexOf(t);console.assert(o>=0&&n.indexOf(t,o+1)<0,"Assertion failed"),n.splice(o,1),this.children.delete(t),this.parent.delete(t),console.assert(this.validate(),"s-group forest invalid")},r.default=o},{"../../util/pile":688,"../../util/pool":689}],545:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){console.assert(t&&t in o.TYPES,"Invalid or unsupported s-group type"),this.type=t,this.id=-1,this.label=-1,this.bracketBox=null,this.bracketDir=new u.default(1,0),this.areas=[],this.highlight=!1,this.highlighting=null,this.selected=!1,this.selectionPlate=null,this.atoms=[],this.patoms=[],this.bonds=[],this.xBonds=[],this.neiAtoms=[],this.pp=null,this.data={mul:1,connectivity:"ht",name:"",subscript:"n",attached:!1,absolute:!0,showUnits:!1,nCharsToDisplay:-1,tagChar:"",daspPos:1,fieldType:"F",fieldName:"",fieldValue:"",units:"",query:"",queryOp:""}}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/box2abs"),a=n(i),s=t("../../util/vec2"),u=n(s),l=t("../../util/pile"),c=n(l),f=t("./atom"),d=n(f),p=t("./bond"),h=n(p);o.TYPES={MUL:1,SRU:2,SUP:3,DAT:4,GEN:5},o.prototype.getAttr=function(t){return this.data[t]},o.prototype.getAttrs=function(){var t=this,e={};return Object.keys(this.data).forEach(function(r){e[r]=t.data[r]}),e},o.prototype.setAttr=function(t,e){var r=this.data[t];return this.data[t]=e,r},o.prototype.checkAttr=function(t,e){return this.data[t]==e},o.filterAtoms=function(t,e){for(var r=[],n=0;n<t.length;++n){var o=t[n];"number"!=typeof e[o]?r.push(o):e[o]>=0?r.push(e[o]):r.push(-1)}return r},o.removeNegative=function(t){for(var e=[],r=0;r<t.length;++r)t[r]>=0&&e.push(t[r]);return e},o.filter=function(t,e,r){e.atoms=o.removeNegative(o.filterAtoms(e.atoms,r))},o.clone=function(t,e){var r=new o(t.type);return Object.keys(t.data).forEach(function(e){r.data[e]=t.data[e]}),r.atoms=t.atoms.map(function(t){return e.get(t)}),r.pp=t.pp,r.bracketBox=t.bracketBox,r.patoms=null,r.bonds=null,r.allAtoms=t.allAtoms,r},o.addAtom=function(t,e){t.atoms.push(e)},o.removeAtom=function(t,e){for(var r=0;r<t.atoms.length;++r)if(t.atoms[r]===e)return void t.atoms.splice(r,1);console.error("The atom is not found in the given s-group")},o.getCrossBonds=function(t,e,r,n){r.bonds.forEach(function(r,o){n.has(r.begin)&&n.has(r.end)?null!==t&&t.push(o):(n.has(r.begin)||n.has(r.end))&&null!==e&&e.push(o)})},o.bracketPos=function(t,e,r){var n=t.atoms;if(r&&2===r.length){var o=e.bonds.get(r[0]).getCenter(e),i=e.bonds.get(r[1]).getCenter(e);t.bracketDir=u.default.diff(i,o).normalized()}else t.bracketDir=new u.default(1,0);var s=t.bracketDir,l=null,c=[];n.forEach(function(t){var r=e.atoms.get(t),n=new u.default(r.pp),o=new u.default(.05*3,.05*3),i=new a.default(n,n).extend(o,o);c.push(i)}),c.forEach(function(t){var e=null;[t.p0.x,t.p1.x].forEach(function(r){[t.p0.y,t.p1.y].forEach(function(t){var n=new u.default(r,t),o=new u.default(u.default.dot(n,s),u.default.dot(n,s.rotateSC(1,0)));e=null===e?new a.default(o,o):e.include(o)})}),l=null===l?e:a.default.union(l,e)});var f=new u.default(.2,.4);null!==l&&(l=l.extend(f,f)),t.bracketBox=l},o.getBracketParameters=function(t,e,r,n,o,i){function a(t,e,r,n){this.c=t,this.d=e,this.n=e.rotateSC(1,0),this.w=r,this.h=n}var s=[];return e.length<2?function(){o=o||new u.default(1,0),i=i||o.rotateSC(1,0);var t=Math.min(.25,.3*n.sz().x),e=u.default.lc2(o,n.p0.x,i,.5*(n.p0.y+n.p1.y)),r=u.default.lc2(o,n.p1.x,i,.5*(n.p0.y+n.p1.y)),l=n.sz().y;s.push(new a(e,o.negated(),t,l),new a(r,o,t,l))}():2===e.length?function(){var r=t.bonds.get(e[0]),n=t.bonds.get(e[1]),o=r.getCenter(t),i=n.getCenter(t),l=u.default.diff(i,o).normalized(),c=l.negated();s.push(new a(o.addScaled(c,0),c,.25,1.5),new a(i.addScaled(l,0),l,.25,1.5))}():function(){for(var n=0;n<e.length;++n){var o=t.bonds.get(e[n]),i=o.getCenter(t),u=r.has(o.begin)?o.getDir(t):o.getDir(t).negated();s.push(new a(i,u,.2,1))}}(),s},o.getObjBBox=function(t,e){console.assert(0!=t.length,"Atom list is empty");for(var r=e.atoms.get(t[0]).pp,n=new a.default(r,r),o=1;o<t.length;++o){var i=t[o],s=e.atoms.get(i),u=s.pp;n=n.include(u)}return n},o.getAtoms=function(t,e){if(!e.allAtoms)return e.atoms;var r=[];return t.atoms.forEach(function(t,e){r.push(e)}),r},o.getBonds=function(t,e){var r=o.getAtoms(t,e),n=[];return t.bonds.forEach(function(t,e){r.indexOf(t.begin)>=0&&r.indexOf(t.end)>=0&&n.push(e)}),n},o.prepareMulForSaving=function(t,e){t.atoms.sort(function(t,e){return t-e}),t.atomSet=new c.default(t.atoms),t.parentAtomSet=new c.default(t.atomSet);var r=[],n=[];if(e.bonds.forEach(function(e,o){t.parentAtomSet.has(e.begin)&&t.parentAtomSet.has(e.end)?r.push(o):(t.parentAtomSet.has(e.begin)||t.parentAtomSet.has(e.end))&&n.push(o)}),0!==n.length&&2!==n.length)throw Error("Unsupported cross-bonds number");var o=-1,i=-1,a=null;if(2===n.length){var s=e.bonds.get(n[0]);o=t.parentAtomSet.has(s.begin)?s.begin:s.end;var u=e.bonds.get(n[1]);i=t.parentAtomSet.has(u.begin)?u.begin:u.end,a=u}for(var l=null,f=i,p=[],m=0;m<t.data.mul-1;m++)if(l={},t.atoms.forEach(function(r){var n=e.atoms.get(r),o=e.atoms.add(new d.default(n));p.push(o),t.atomSet.add(o),l[r]=o}),r.forEach(function(t){var r=e.bonds.get(t),n=new h.default(r);n.begin=l[n.begin],n.end=l[n.end],e.bonds.add(n)}),null!==a){var g=new h.default(a);g.begin=f,g.end=l[o],e.bonds.add(g),f=l[i]}if(f>=0){var v=e.bonds.get(n[1]);v.begin===i?v.begin=f:v.end=f}t.bonds=n,p.forEach(function(r){e.sGroupForest.getPathToRoot(t.id).reverse().forEach(function(t){e.atomAddToSGroup(t,r)})})},o.getMassCentre=function(t,e){for(var r=new u.default,n=0;n<e.length;++n)r=r.addScaled(t.atoms.get(e[n]).pp,1/e.length);return r},r.default=o},{"../../util/box2abs":687,"../../util/pile":688,"../../util/vec2":691,"./atom":539,"./bond":541}],546:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n,o){var c=e.molecule,p=t.molecule,h=p.getBondFragment(r),m=u(p,h),v=null,b=null,y=new g.default;return s(m.frag)&&s(c)?Promise.all([n.aromatizeStruct.dispatch(m.frag).then(function(t){return f.default.parse(t.struct)}),n.aromatizeStruct.dispatch(c).then(function(t){return f.default.parse(t.struct)})]).then(function(a){var s=l(a,2),c=s[0],d=s[1],p=i(t,c,m.bondMap),g={bid:e.bid,molecule:d},_=o(t,g,r);return b=_[1],y=_[0].mergeWith(p),v=u(t.molecule,h),n.dearomatizeStruct.dispatch(v.frag).then(function(t){return f.default.parse(t.struct)})}).then(function(e){e.bonds.forEach(function(t){if(t.type===d.Bond.PATTERN.TYPE.AROMATIC)throw Error("Bad dearomatize")});var r=a(t,e,v.bondMap);return y=r.mergeWith(y),[y,b]}).catch(function(n){return console.info(n.message),y.perform(t),o(t,e,r)}):(y=o(t,e,r),Promise.resolve(y))}function i(t,e,r){var n=new g.default;return e.bonds.forEach(function(e,o){e.type===d.Bond.PATTERN.TYPE.AROMATIC&&n.addOp(new h.default.BondAttr(r.get(o),"type",d.Bond.PATTERN.TYPE.AROMATIC).perform(t))}),n}function a(t,e,r){var n=new g.default;return e.bonds.forEach(function(e,o){n.addOp(new h.default.BondAttr(r.get(o),"type",e.type).perform(t))}),n}function s(t){0===t.loops.size&&t.prepareLoopStructure();var e=t.loops.find(function(t,e){return e.aromatic});return 0!==t.loops.size&&!e&&void 0!==t.loops.find(function(t,e){return e.dblBonds===e.hbs.length/2})}function u(t,e){var r=t.getFragmentIds(e),n=Array.from(r),o=t.clone(r),i=new Map;return o.bonds.forEach(function(e,r){i.set(r,t.findBondId(n[e.begin],n[e.end]))}),{frag:o,bondMap:i}}Object.defineProperty(r,"__esModule",{value:!0});var l=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();r.fromAromaticTemplateOnBond=o;var c=t("../../chem/molfile"),f=n(c),d=t("../../chem/struct"),p=t("../shared/op"),h=n(p),m=t("../shared/action"),g=n(m)},{"../../chem/molfile":528,"../../chem/struct":542,"../shared/action":562,"../shared/op":565}],547:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){r=Object.assign({},r);var n=new g.default;return r.fragment=n.addOp((new h.default.FragmentAdd).perform(t)).frid,n.addOp(new h.default.AtomAdd(r,e).perform(t)),n}function i(t,e){var r=new g.default,n=[],o=t.molecule.atoms.get(e).fragment;return(0,v.atomGetNeighbors)(t,e).forEach(function(e){r.addOp(new h.default.BondDelete(e.bid)),1===(0,v.atomGetDegree)(t,e.aid)&&((0,b.removeAtomFromSgroupIfNeeded)(r,t,e.aid)&&n.push(e.aid),r.addOp(new h.default.AtomDelete(e.aid)))}),(0,b.removeAtomFromSgroupIfNeeded)(r,t,e)&&n.push(e),r.addOp(new h.default.AtomDelete(e)),(0,b.removeSgroupIfNeeded)(r,t,n),r=r.perform(t),r.mergeWith((0,_.fromFragmentSplit)(t,o)),r}function a(t,e,r,n){var o=new g.default;return(Array.isArray(e)?e:[e]).forEach(function(t){Object.keys(d.Atom.attrlist).forEach(function(e){if(("attpnt"!==e||e in r)&&(e in r||n)){var i=e in r?r[e]:d.Atom.attrGetDefault(e);o.addOp(new h.default.AtomAttr(t,e,i))}}),!n&&"label"in r&&null!==r.label&&"L#"!==r.label&&!r.atomList&&o.addOp(new h.default.AtomAttr(t,"atomList",null))}),o.perform(t)}function s(t,e,r){if(e===r)return new g.default;var n=new g.default;u(n,t,e,r);var o=new g.default;(0,v.atomGetNeighbors)(t,e).forEach(function(e){var n=t.molecule.bonds.get(e.bid);if(r===n.begin||r===n.end)return void o.addOp(new h.default.BondDelete(e.bid));var i=n.begin===e.aid?e.aid:r,a=n.begin===e.aid?r:e.aid,s=t.molecule.findBondId(i,a);if(null===s)o.addOp(new h.default.BondAdd(i,a,n));else{var u=d.Bond.getAttrHash(n);Object.keys(u).forEach(function(t){o.addOp(new h.default.BondAttr(s,t,u[t]))})}o.addOp(new h.default.BondDelete(e.bid))});var i=d.Atom.getAttrHash(t.molecule.atoms.get(e));return 1===(0,v.atomGetDegree)(t,e)&&"*"===i.label&&(i.label="C"),Object.keys(i).forEach(function(t){o.addOp(new h.default.AtomAttr(r,t,i[t]))}),(0,b.removeAtomFromSgroupIfNeeded)(o,t,e)&&(0,b.removeSgroupIfNeeded)(o,t,[e]),o.addOp(new h.default.AtomDelete(e)),o.perform(t).mergeWith(n)}function u(t,e,r,n){var o=(0,v.atomGetAttr)(e,r,"fragment"),i=(0,v.atomGetAttr)(e,n,"fragment");if(i!==o&&"number"==typeof i){var a=e.molecule,s=d.RGroup.findRGroupByFragment(a.rgroups,i);void 0!==s&&t.mergeWith((0,y.fromRGroupFragment)(e,null,i)).mergeWith((0,y.fromUpdateIfThen)(e,0,s));var u=a.getFragmentIds(o);a.atoms.forEach(function(r,n){r.fragment===i&&t.addOp(new h.default.AtomAttr(n,"fragment",o).perform(e))}),l(t,e,u,n),t.addOp(new h.default.FragmentDelete(i).perform(e))}}function l(t,e,r,n){(0,v.atomGetSGroups)(e,n).forEach(function(n){var o=e.molecule.sgroups.get(n),i=["Atom","Bond","Group"];"DAT"===o.type&&i.includes(o.data.context)||(0,f.default)(o.atoms,r).forEach(function(r){return t.addOp(new h.default.SGroupAtomAdd(n,r).perform(e))})})}Object.defineProperty(r,"__esModule",{value:!0});var c=t("lodash/fp/without"),f=n(c);r.fromAtomAddition=o,r.fromAtomDeletion=i,r.fromAtomsAttrs=a,r.fromAtomMerge=s,r.mergeFragmentsIfNeeded=u,r.mergeSgroups=l;var d=t("../../chem/struct"),p=t("../shared/op"),h=n(p),m=t("../shared/action"),g=n(m),v=t("./utils"),b=t("./sgroup"),y=t("./rgroup"),_=t("./fragment")},{"../../chem/struct":542,"../shared/action":562,"../shared/op":565,"./fragment":553,"./rgroup":556,"./sgroup":558,"./utils":560,"lodash/fp/without":442}],548:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=new l.default;return r.addOp(new s.default.CanvasLoad(e)),r.perform(t)}function i(t){var e=new l.default;return e.addOp(new s.default.AlignDescriptors(t)),e.perform(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.fromNewCanvas=o,r.fromDescriptorsAlign=i;var a=t("../shared/op"),s=n(a),u=t("../shared/action"),l=n(u)},{"../shared/action":562,"../shared/op":565}],549:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n,o,i){if(void 0===n){var a=(0,b.atomForNewBond)(t,r);n=a.atom,o=a.pos}var s=new v.default,u=null;"number"!=typeof r?"number"==typeof n&&(u=(0,b.atomGetAttr)(t,n,"fragment")):(u=(0,b.atomGetAttr)(t,r,"fragment"),"number"==typeof n&&(0,y.mergeFragmentsIfNeeded)(s,t,r,n)),null==u&&(u=s.addOp((new p.default.FragmentAdd).perform(t)).frid),"number"!=typeof r?(r.fragment=u,r=s.addOp(new p.default.AtomAdd(r,o).perform(t)).data.aid,"number"==typeof n&&(0,y.mergeSgroups)(s,t,[r],n),o=i):"*"===(0,b.atomGetAttr)(t,r,"label")&&s.addOp(new p.default.AtomAttr(r,"label","C").perform(t)),"number"!=typeof n?(n.fragment=u,n=s.addOp(new p.default.AtomAdd(n,o).perform(t)).data.aid,"number"==typeof r&&(0,y.mergeSgroups)(s,t,[n],r)):"*"===(0,b.atomGetAttr)(t,n,"label")&&s.addOp(new p.default.AtomAttr(n,"label","C").perform(t));var l=s.addOp(new p.default.BondAdd(r,n,e).perform(t)).data.bid
  ;return s.operations.reverse(),[s,r,n,l]}function i(t,e){var r=new v.default,n=t.molecule.bonds.get(e),o=t.molecule.atoms.get(n.begin).fragment,i=[];return r.addOp(new p.default.BondDelete(e)),1===(0,b.atomGetDegree)(t,n.begin)&&((0,_.removeAtomFromSgroupIfNeeded)(r,t,n.begin)&&i.push(n.begin),r.addOp(new p.default.AtomDelete(n.begin))),1===(0,b.atomGetDegree)(t,n.end)&&((0,_.removeAtomFromSgroupIfNeeded)(r,t,n.end)&&i.push(n.end),r.addOp(new p.default.AtomDelete(n.end))),(0,_.removeSgroupIfNeeded)(r,t,i),r=r.perform(t),r.mergeWith((0,x.fromFragmentSplit)(t,o)),r}function a(t,e,r,n){var o=new v.default;return(Array.isArray(e)?e:[e]).forEach(function(t){Object.keys(f.Bond.attrlist).forEach(function(e){if(e in r||n){var i=e in r?r[e]:f.Bond.attrGetDefault(e);o.addOp(new p.default.BondAttr(t,e,i))}})}),o.perform(t)}function s(t,e){var r=t.molecule,n=new Map,o=new v.default;return e.forEach(function(t,e){var o=r.bonds.get(e),i=r.bonds.get(t),a=m.default.mergeBondsParams(r,o,r,i);a.merged&&(n.set(o.begin,a.cross?i.end:i.begin),n.set(o.end,a.cross?i.begin:i.end))}),n.forEach(function(e,r){o=(0,y.fromAtomMerge)(t,r,e).mergeWith(o)}),o}function u(t,e){var r=t.molecule.bonds.get(e),n=new v.default;return n.addOp(new p.default.BondDelete(e)),n.addOp(new p.default.BondAdd(r.end,r.begin,r)).data.bid=e,n.perform(t)}function l(t,e,r,n){if(n.stereo!==f.Bond.PATTERN.STEREO.NONE&&n.type===f.Bond.PATTERN.TYPE.SINGLE&&r.type===n.type&&r.stereo===n.stereo)return u(t,e);var o=w.includes(n.type)?w:null;n.stereo===f.Bond.PATTERN.STEREO.NONE&&n.type===f.Bond.PATTERN.TYPE.SINGLE&&r.stereo===f.Bond.PATTERN.STEREO.NONE&&o&&(n.type=o[(o.indexOf(r.type)+1)%o.length]);var i=c(t.molecule,r,n),s=i?u(t,e):new v.default;return a(t,e,n).mergeWith(s)}function c(t,e,r){return r.type===f.Bond.PATTERN.TYPE.SINGLE&&e.stereo===f.Bond.PATTERN.STEREO.NONE&&r.stereo!==f.Bond.PATTERN.STEREO.NONE&&t.atoms.get(e.begin).neighbors.length<t.atoms.get(e.end).neighbors.length}Object.defineProperty(r,"__esModule",{value:!0}),r.fromBondAddition=o,r.fromBondDeletion=i,r.fromBondsAttrs=a,r.fromBondsMerge=s,r.bondChangingAction=l;var f=t("../../chem/struct"),d=t("../shared/op"),p=n(d),h=t("../shared/utils"),m=n(h),g=t("../shared/action"),v=n(g),b=t("./utils"),y=t("./atom"),_=t("./sgroup"),x=t("./fragment"),w=[f.Bond.PATTERN.TYPE.SINGLE,f.Bond.PATTERN.TYPE.DOUBLE,f.Bond.PATTERN.TYPE.TRIPLE]},{"../../chem/struct":542,"../shared/action":562,"../shared/op":565,"../shared/utils":566,"./atom":547,"./fragment":553,"./sgroup":558,"./utils":560}],550:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n,o){var i=Math.cos(Math.PI/6),s=Math.sin(Math.PI/6),l=new c.default,p=null!==o?(0,f.atomGetAttr)(t,o,"fragment"):l.addOp((new u.default.FragmentAdd).perform(t)).frid,h={atoms:[],bonds:[]},m=null!==o?o:l.addOp(new u.default.AtomAdd({label:"C",fragment:p},e).perform(t)).data.aid;h.atoms.push(m),l.operations.reverse();for(var g=0;g<n;g++){var v=new a.default(i*(g+1),1&g?0:s).rotate(r).add(e),b=(0,d.fromBondAddition)(t,{},m,{},v);l=b[0].mergeWith(l),m=b[2],h.bonds.push(b[3]),h.atoms.push(m)}return[l,h]}Object.defineProperty(r,"__esModule",{value:!0}),r.fromChain=o;var i=t("../../util/vec2"),a=n(i),s=t("../shared/op"),u=n(s),l=t("../shared/action"),c=n(l),f=t("./utils"),d=t("./bond")},{"../../util/vec2":691,"../shared/action":562,"../shared/op":565,"./bond":549,"./utils":560}],551:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=new f.default,n=t.molecule;if(t.chiralFlags.size<1){if(!e){var o=n.getCoordBoundingBox(),i=n.isBlank()?o.min.y+1:o.min.y-1;e=new s.default(o.max.x,i)}r.addOp(new l.default.ChiralFlagAdd(e).perform(t))}return r}function i(t){var e=new f.default;return e.addOp(new l.default.ChiralFlagDelete),e.perform(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.fromChiralFlagAddition=o,r.fromChiralFlagDeletion=i;var a=t("../../util/vec2"),s=n(a),u=t("../shared/op"),l=n(u),c=t("../shared/action"),f=n(c)},{"../../util/vec2":691,"../shared/action":562,"../shared/op":565}],552:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=new l.default;if(!e)return r;var n=new Set;return e.atoms.forEach(function(e,o){n.has(e)||n.has(o)||(r=(0,p.fromAtomMerge)(t,o,e).mergeWith(r),n.add(e).add(o))}),r=(0,d.fromBondsMerge)(t,e.bonds).mergeWith(r)}function i(t,e){var r=t.render.ctab.molecule,n=e||{atoms:Array.from(r.atoms.keys()),bonds:Array.from(r.bonds.keys())};return s(r,t.findMerge(n,["atoms","bonds"]))}function a(t){if(!t)return null;var e={atoms:Array.from(t.atoms.values()),bonds:Array.from(t.bonds.values())};return{map:"merge",id:+Date.now(),items:e}}function s(t,e){var r={atoms:new Map(e.atoms),bonds:new Map(e.bonds)};return e.bonds.forEach(function(e,n){var o=t.bonds.get(n),i=t.bonds.get(e);f.default.mergeBondsParams(t,o,t,i).merged?(r.atoms.delete(o.begin),r.atoms.delete(o.end)):r.bonds.delete(n)}),0===r.atoms.size&&0===r.bonds.size?null:r}Object.defineProperty(r,"__esModule",{value:!0}),r.fromItemsFuse=o,r.getItemsToFuse=i,r.getHoverToFuse=a;var u=t("../shared/action"),l=n(u),c=t("../shared/utils"),f=n(c),d=t("./bond"),p=t("./atom")},{"../shared/action":562,"../shared/utils":566,"./atom":547,"./bond":549}],553:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){r=new l.default(r);var n=new g.default,o=t.molecule,i=new f.default,a=new f.default;if(e.atoms){var s=new f.default(e.atoms),u=[];if(t.bonds.forEach(function(t,e){return s.has(t.b.begin)&&s.has(t.b.end)?(u.push(e),void["hb1","hb2"].forEach(function(e){var r=o.halfBonds.get(t.b[e]).loop;r>=0&&i.add(r)})):s.has(t.b.begin)?void a.add(t.b.begin):void(s.has(t.b.end)&&a.add(t.b.end))}),u.forEach(function(t){n.addOp(new h.default.BondMove(t,r))}),i.forEach(function(e){t.reloops.get(e)&&t.reloops.get(e).visel&&n.addOp(new h.default.LoopMove(e,r))}),e.atoms.forEach(function(t){n.addOp(new h.default.AtomMove(t,r,!a.has(t)))}),e.sgroupData&&0===e.sgroupData.length){(0,v.getRelSgroupsBySelection)(t,e.atoms).forEach(function(t){n.addOp(new h.default.SGroupDataMove(t.id,r))})}}return e.rxnArrows&&e.rxnArrows.forEach(function(t){n.addOp(new h.default.RxnArrowMove(t,r,!0))}),e.rxnPluses&&e.rxnPluses.forEach(function(t){n.addOp(new h.default.RxnPlusMove(t,r,!0))}),e.sgroupData&&e.sgroupData.forEach(function(t){n.addOp(new h.default.SGroupDataMove(t,r))}),e.chiralFlags&&o.isChiral&&e.chiralFlags.forEach(function(){n.addOp(new h.default.ChiralFlagMove(r))}),n.perform(t)}function i(t,e,r,n){for(var o=new g.default,i=[e],a=new f.default(i);i.length>0;){var s=i.shift();o.addOp(new h.default.AtomAttr(s,"fragment",n).perform(t)),(0,v.atomGetNeighbors)(t,s).forEach(function(e){t.molecule.atoms.get(e.aid).fragment!==r||a.has(e.aid)||(a.add(e.aid),i.push(e.aid))})}return o}function a(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=new g.default,o=d.RGroup.findRGroupByFragment(t.molecule.rgroups,e);return t.molecule.atoms.forEach(function(r,a){if(r.fragment===e){var s=n.addOp((new h.default.FragmentAdd).perform(t)).frid;n.mergeWith(i(t,a,e,s)),o&&n.mergeWith((0,y.fromRGroupFragment)(t,o,s))}}),-1!==e&&(n.mergeWith((0,y.fromRGroupFragment)(t,0,e)),n.addOp(new h.default.FragmentDelete(e).perform(t)),n.mergeWith((0,y.fromUpdateIfThen)(t,0,o,r))),t.molecule.isChiral&&0===t.molecule.frags.size&&n.addOp((new h.default.ChiralFlagDelete).perform(t)),n}function s(t,e){console.assert(!!e);var r=new g.default,n=[],o=[];e={atoms:e.atoms||[],bonds:e.bonds||[],rxnPluses:e.rxnPluses||[],rxnArrows:e.rxnArrows||[],sgroupData:e.sgroupData||[],chiralFlags:e.chiralFlags||[]};var i=new g.default;t.molecule.sgroups.forEach(function(r,n){(e.sgroupData.includes(n)||new f.default(e.atoms).isSuperset(new f.default(r.atoms)))&&i.mergeWith((0,b.fromSgroupDeletion)(t,n))}),e.atoms.forEach(function(r){(0,v.atomGetNeighbors)(t,r).forEach(function(t){-1===e.bonds.indexOf(t.bid)&&(e.bonds=e.bonds.concat([t.bid]))})}),e.bonds.forEach(function(i){r.addOp(new h.default.BondDelete(i));var a=t.molecule.bonds.get(i),s=t.molecule.atoms.get(a.begin).fragment;o.indexOf(s)<0&&o.push(s),-1===e.atoms.indexOf(a.begin)&&1===(0,v.atomGetDegree)(t,a.begin)&&((0,b.removeAtomFromSgroupIfNeeded)(r,t,a.begin)&&n.push(a.begin),r.addOp(new h.default.AtomDelete(a.begin))),-1===e.atoms.indexOf(a.end)&&1===(0,v.atomGetDegree)(t,a.end)&&((0,b.removeAtomFromSgroupIfNeeded)(r,t,a.end)&&n.push(a.end),r.addOp(new h.default.AtomDelete(a.end)))}),e.atoms.forEach(function(e){var i=t.molecule.atoms.get(e).fragment;o.indexOf(i)<0&&o.push(i),(0,b.removeAtomFromSgroupIfNeeded)(r,t,e)&&n.push(e),r.addOp(new h.default.AtomDelete(e))}),(0,b.removeSgroupIfNeeded)(r,t,n),e.rxnArrows.forEach(function(t){r.addOp(new h.default.RxnArrowDelete(t))}),e.rxnPluses.forEach(function(t){r.addOp(new h.default.RxnPlusDelete(t))}),e.chiralFlags.forEach(function(t){r.addOp(new h.default.ChiralFlagDelete(t))}),r=r.perform(t);for(var s=o.map(function(e){return d.RGroup.findRGroupByFragment(t.molecule.rgroups,e)});o.length>0;)r.mergeWith(a(t,o.pop(),s));return r.mergeWith(i),r}Object.defineProperty(r,"__esModule",{value:!0}),r.fromMultipleMove=o,r.fromFragmentSplit=a,r.fromFragmentDeletion=s;var u=t("../../util/vec2"),l=n(u),c=t("../../util/pile"),f=n(c),d=t("../../chem/struct"),p=t("../shared/op"),h=n(p),m=t("../shared/action"),g=n(m),v=t("./utils"),b=t("./sgroup"),y=t("./rgroup")},{"../../chem/struct":542,"../../util/pile":688,"../../util/vec2":691,"../shared/action":562,"../shared/op":565,"./rgroup":556,"./sgroup":558,"./utils":560}],554:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=i(e),a=s.default.diff(r,o),u=new f.default,c=new Map,m=new Map,g={atoms:[],bonds:[]};if(e.atoms.forEach(function(e,i){m.has(e.fragment)||m.set(e.fragment,u.addOp((new l.default.FragmentAdd).perform(t)).frid);var a=Object.assign(e.clone(),{fragment:m.get(e.fragment)}),f=new l.default.AtomAdd(a,s.default.diff(e.pp,o).rotate(n).add(r)).perform(t);u.addOp(f),c.set(i,f.data.aid),g.atoms.push(f.data.aid)}),e.bonds.forEach(function(e){var r=new l.default.BondAdd(c.get(e.begin),c.get(e.end),e).perform(t);u.addOp(r),g.bonds.push(r.data.bid)}),e.sgroups.forEach(function(e){var r=t.molecule.sgroups.newId(),n=e.atoms.map(function(t){return c.get(t)});(0,h.fromSgroupAddition)(t,e.type,n,e.data,r,e.pp?e.pp.add(a):null).operations.reverse().forEach(function(t){u.addOp(t)})}),t.rxnArrows.size<1&&e.rxnArrows.forEach(function(e){u.addOp(new l.default.RxnArrowAdd(e.pp.add(a)).perform(t))}),e.rxnPluses.forEach(function(e){u.addOp(new l.default.RxnPlusAdd(e.pp.add(a)).perform(t))}),e.isChiral){var v=e.getCoordBoundingBox(),b=new s.default(v.max.x,v.min.y-1);u.mergeWith((0,d.fromChiralFlagAddition)(t,b.add(a)))}return e.rgroups.forEach(function(r,n){r.frags.forEach(function(e,r){u.addOp(new l.default.RGroupFragment(n,m.get(r)).perform(t))});var o=e.rgroups.get(n).ifthen,i=e.rgroups.get(o)?o:0;u.mergeWith((0,p.fromRGroupAttrs)(t,n,r.getAttrs())).mergeWith((0,p.fromUpdateIfThen)(t,i,r.ifthen))}),u.operations.reverse(),[u,g]}function i(t){if(t.atoms.size>0){var e=1e50,r=e,n=-e,o=-r;return t.atoms.forEach(function(t){e=Math.min(e,t.pp.x),r=Math.min(r,t.pp.y),n=Math.max(n,t.pp.x),o=Math.max(o,t.pp.y)}),new s.default((e+n)/2,(r+o)/2)}return t.rxnArrows.size>0?t.rxnArrows.get(0).pp:t.rxnPluses.size>0?t.rxnPluses.get(0).pp:t.isChiral?new s.default(1,-1):null}Object.defineProperty(r,"__esModule",{value:!0}),r.fromPaste=o;var a=t("../../util/vec2"),s=n(a),u=t("../shared/op"),l=n(u),c=t("../shared/action"),f=n(c),d=t("./chiral-flag"),p=t("./rgroup"),h=t("./sgroup")},{"../../util/vec2":691,"../shared/action":562,"../shared/op":565,"./chiral-flag":551,"./rgroup":556,"./sgroup":558}],555:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=new f.default;return t.molecule.rxnArrows.size<1&&r.addOp(new l.default.RxnArrowAdd(e).perform(t)),r}function i(t,e){var r=new f.default;return r.addOp(new l.default.RxnArrowDelete(e)),r.perform(t)}function a(t,e){var r=new f.default;return r.addOp(new l.default.RxnPlusAdd(e).perform(t)),r}function s(t,e){var r=new f.default;return r.addOp(new l.default.RxnPlusDelete(e)),r.perform(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.fromArrowAddition=o,r.fromArrowDeletion=i,r.fromPlusAddition=a,r.fromPlusDeletion=s;var u=t("../shared/op"),l=n(u),c=t("../shared/action"),f=n(c)},{"../shared/action":562,"../shared/op":565}],556:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){var n=new c.default;return Object.keys(r).forEach(function(t){n.addOp(new u.default.RGroupAttr(e,t,r[t]))}),n.perform(t)}function i(t,e,r){var n=new c.default;return n.addOp(new u.default.RGroupFragment(e,r)),n.perform(t)}function a(t,e,r,n){var o=new c.default;return t.molecule.rgroups.get(r)||o.addOp(new u.default.UpdateIfThen(e,r,n)),o.perform(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.fromRGroupAttrs=o,r.fromRGroupFragment=i,r.fromUpdateIfThen=a;var s=t("../shared/op"),u=n(s),l=t("../shared/action"),c=n(l)},{"../shared/action":562,"../shared/op":565}],557:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n){var o=t.molecule,a=new y.default;if(e||(e=(0,_.structSelection)(o)),!e.atoms)return a.perform(t);var s=e.atoms.reduce(function(t,e){var r=o.atoms.get(e);return t[r.fragment]||(t[r.fragment]=[]),t[r.fragment].push(e),t},{});return Object.keys(s).find(function(t){return t=parseInt(t,10),!o.getFragmentIds(t).equals(new d.default(s[t]))})?a:(Object.keys(s).forEach(function(u){var l=new d.default(s[u]),f=o.getCoordBoundingBox(l),p=n||new c.default((f.max.x+f.min.x)/2,(f.max.y+f.min.y)/2);if(l.forEach(function(t){var e=o.atoms.get(t),n=i(e,p,r);a.addOp(new m.default.AtomMove(t,n))}),!e.sgroupData){(0,_.getRelSgroupsBySelection)(t,Array.from(l)).forEach(function(t){var e=i(t,p,r);a.addOp(new m.default.SGroupDataMove(t.id,e))})}}),e.bonds&&e.bonds.forEach(function(t){var e=o.bonds.get(t);if(e.type===p.Bond.PATTERN.TYPE.SINGLE)return e.stereo===p.Bond.PATTERN.STEREO.UP?void a.addOp(new m.default.BondAttr(t,"stereo",p.Bond.PATTERN.STEREO.DOWN)):void(e.stereo===p.Bond.PATTERN.STEREO.DOWN&&a.addOp(new m.default.BondAttr(t,"stereo",p.Bond.PATTERN.STEREO.UP)))}),a.perform(t))}function i(t,e,r){var n=new c.default;return"horizontal"===r?n.x=e.x>t.pp.x?2*(e.x-t.pp.x):-2*(t.pp.x-e.x):n.y=e.y>t.pp.y?2*(e.y-t.pp.y):-2*(t.pp.y-e.y),n}function a(t,e,r,n){var o=t.molecule,i=new y.default;if(e||(e=(0,_.structSelection)(o)),e.atoms&&(e.atoms.forEach(function(t){var e=o.atoms.get(t);i.addOp(new m.default.AtomMove(t,u(e.pp,r,n)))}),!e.sgroupData)){(0,_.getRelSgroupsBySelection)(t,e.atoms).forEach(function(t){i.addOp(new m.default.SGroupDataMove(t.id,u(t.pp,r,n)))})}return e.rxnArrows&&e.rxnArrows.forEach(function(t){var e=o.rxnArrows.get(t);i.addOp(new m.default.RxnArrowMove(t,u(e.pp,r,n)))}),e.rxnPluses&&e.rxnPluses.forEach(function(t){var e=o.rxnPluses.get(t);i.addOp(new m.default.RxnPlusMove(t,u(e.pp,r,n)))}),e.sgroupData&&e.sgroupData.forEach(function(t){var e=o.sgroups.get(t);i.addOp(new m.default.SGroupDataMove(t,u(e.pp,r,n)))}),e.chiralFlags&&e.chiralFlags.forEach(function(e){var o=t.chiralFlags.get(e);i.addOp(new m.default.ChiralFlagMove(u(o.pp,r,n)))}),i.perform(t)}function s(t,e,r){var n=t.molecule,i=n.bonds.get(e),s=n.atoms.get(i.begin),u=n.atoms.get(i.end),l=s.pp.add(u.pp).scaled(.5),c=v.default.calcAngle(s.pp,u.pp),f=(0,_.getFragmentAtoms)(n,s.fragment);return c="horizontal"===r?-c:Math.PI/2-c,0===c||Math.abs(c)===Math.PI?o(t,{atoms:f},r,l):a(t,{atoms:f},l,c)}function u(t,e,r){var n=t.sub(e);return n=n.rotate(r),n.add_(e),n.sub(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.fromFlip=o,r.fromRotate=a,r.fromBondAlign=s;var l=t("../../util/vec2"),c=n(l),f=t("../../util/pile"),d=n(f),p=t("../../chem/struct"),h=t("../shared/op"),m=n(h),g=t("../shared/utils"),v=n(g),b=t("../shared/action"),y=n(b),_=t("./utils")},{"../../chem/struct":542,"../../util/pile":688,"../../util/vec2":691,"../shared/action":562,"../shared/op":565,"../shared/utils":566,"./utils":560}],558:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n){var o=n.fieldValue;return"string"==typeof o||"DAT"!==e?u(t,e,r,n,t.molecule.sgroups.newId()):o.reduce(function(o,i){var a=Object.assign({},n);return a.fieldValue=i,o.mergeWith(u(t,e,r,a,t.molecule.sgroups.newId()))},new E.default)}function i(t,e,r){var n=new E.default;return Object.keys(r).forEach(function(t){n.addOp(new O.default.SGroupAttr(e,t,r[t]))}),n.perform(t)}function a(t,e){var r=new E.default;return Object.keys(e).forEach(function(n){r.addOp(new O.default.SGroupAttr(t,n,e[n]))}),r}function s(t,e){var r=new E.default,n=t.molecule,o=t.sgroups.get(e).item;"SRU"===o.type&&(n.sGroupsRecalcCrossBonds(),o.neiAtoms.forEach(function(e){"*"===(0,P.atomGetAttr)(t,e,"label")&&r.addOp(new O.default.AtomAttr(e,"label","C"))}));var i=n.sgroups.get(e),s=_.SGroup.getAtoms(n,i),u=i.getAttrs();return r.addOp(new O.default.SGroupRemoveFromHierarchy(e)),s.forEach(function(t){r.addOp(new O.default.SGroupAtomRemove(e,t))}),r.addOp(new O.default.SGroupDelete(e)),r=r.perform(t),r.mergeWith(a(e,u)),r}function u(t,e,r,n,o,a){var s=new E.default;if(o=o-0===o?o:t.molecule.sgroups.newId(),s.addOp(new O.default.SGroupCreate(o,e,a)),r.forEach(function(t){s.addOp(new O.default.SGroupAtomAdd(o,t))}),s.addOp("DAT"!==e?new O.default.SGroupAddToHierarchy(o):new O.default.SGroupAddToHierarchy(o,-1,[])),s=s.perform(t),"SRU"===e){t.molecule.sGroupsRecalcCrossBonds();var u=new E.default;t.sgroups.get(o).item.neiAtoms.forEach(function(e){var r=t.atoms.get(e).a.isPlainCarbon();1===(0,P.atomGetDegree)(t,e)&&r&&u.addOp(new O.default.AtomAttr(e,"label","*"))}),u=u.perform(t),u.mergeWith(s),s=u}return i(t,o,n).mergeWith(s)}function l(t,e,r,n,i){if(t===j.SgContexts.Bond)return d(e,r,n,i);var a=v(e.molecule,i.bonds),s=(0,y.default)(n.concat(a));return t===j.SgContexts.Fragment?f(e,r,s,Array.from(e.atoms.keys())):t===j.SgContexts.Multifragment?p(e,r,s):t===j.SgContexts.Group?f(e,r,s,s):t===j.SgContexts.Atom?c(e,r,s):{action:o(e,r.type,n,r.attrs)}}function c(t,e,r){return r.reduce(function(r,n){return r.action=r.action.mergeWith(o(t,e.type,[n],e.attrs)),r},{action:new E.default,selection:{atoms:r,bonds:[]}})}function f(t,e,r,n){var i=new w.default(r.map(function(e){return t.atoms.get(e).a.fragment}));return Array.from(i).reduce(function(r,i){var a=n.reduce(function(e,r){var n=t.atoms.get(r).a;return i===n.fragment&&e.push(r),e},[]),s=g(t.molecule,a);return r.action=r.action.mergeWith(o(t,e.type,a,e.attrs)),r.selection.atoms=r.selection.atoms.concat(a),r.selection.bonds=r.selection.bonds.concat(s),r},{action:new E.default,selection:{atoms:[],bonds:[]}})}function d(t,e,r,n){var i=t.molecule,a=g(i,r);return n.bonds&&(a=(0,y.default)(a.concat(n.bonds))),a.reduce(function(r,n){var a=i.bonds.get(n);return r.action=r.action.mergeWith(o(t,e.type,[a.begin,a.end],e.attrs)),r.selection.bonds.push(n),r},{action:new E.default,selection:{atoms:r,bonds:[]}})}function p(t,e,r){var n=g(t.molecule,r);return{action:o(t,e.type,r,e.attrs),selection:{atoms:r,bonds:n}}}function h(t,e,r){var n=(0,P.atomGetSGroups)(e,r);return n.length>0&&(n.forEach(function(e){t.addOp(new O.default.SGroupAtomRemove(e,r))}),!0)}function m(t,e,r){var n=e.molecule,o=new Map;r.forEach(function(t){(0,P.atomGetSGroups)(e,t).forEach(function(t){o.set(t,o.has(t)?o.get(t)+1:1)})}),o.forEach(function(r,o){var i=e.sgroups.get(o).item;if(_.SGroup.getAtoms(e.molecule,i).length===r){var s=n.sgroups.get(o);t.mergeWith(a(o,s.getAttrs())),t.addOp(new O.default.SGroupRemoveFromHierarchy(o)),t.addOp(new O.default.SGroupDelete(o))}})}function g(t,e){var r=new w.default(e);return Array.from(t.bonds.keys()).filter(function(e){var n=t.bonds.get(e);return r.has(n.begin)&&r.has(n.end)})}function v(t,e){return e=e||[],e.reduce(function(e,r){var n=t.bonds.get(r);return e=e.concat([n.begin,n.end])},[])}Object.defineProperty(r,"__esModule",{value:!0});var b=t("lodash/uniq"),y=n(b);r.fromSeveralSgroupAddition=o,r.fromSgroupAttrs=i,r.sGroupAttributeAction=a,r.fromSgroupDeletion=s,r.fromSgroupAddition=u,r.fromSgroupAction=l,r.removeAtomFromSgroupIfNeeded=h,r.removeSgroupIfNeeded=m;var _=t("../../chem/struct"),x=t("../../util/pile"),w=n(x),S=t("../shared/op"),O=n(S),A=t("../shared/action"),E=n(A),j=t("../shared/constants"),P=t("./utils")},{"../../chem/struct":542,"../../util/pile":688,"../shared/action":562,"../shared/constants":564,"../shared/op":565,"./utils":560,"lodash/uniq":484}],559:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n){return(0,O.fromPaste)(t,e.molecule,r,n)}function i(t,e,r){var n=new m.default,o=(0,_.atomGetAttr)(t,e,"fragment"),i=null;if(null===r){var a=(0,_.atomForNewBond)(t,e),s=(0,w.fromBondAddition)(t,{type:1},e,a.atom,a.pos.get_xy0());n=s[0],n.operations.reverse(),i=s[2]}else{var u=new p.default.AtomAdd({label:"C",fragment:o},new c.default(1,0).rotate(r).add(t.molecule.atoms.get(e).pp).get_xy0()).perform(t);n.addOp(u),n.addOp(new p.default.BondAdd(e,u.data.aid,{type:1}).perform(t)),i=u.data.aid}return{action:n,aid1:i}}function a(t,e,r,n,o){var a=new m.default,s=e.molecule,u=t.molecule,l=u.atoms.get(r),d=r,h=null;if(o){var g=i(t,r,n);a=g.action,d=g.aid1,l=u.atoms.get(d),h=v.default.calcAngle(u.atoms.get(r).pp,l.pp)-e.angle0}else null===n&&(n=v.default.calcAngle(l.pp,(0,_.atomForNewBond)(t,r).pos)),h=n-e.angle0;var b=new Map,y=s.atoms.get(e.aid).pp,w=(0,_.atomGetAttr)(t,r,"fragment"),S={atoms:[],bonds:[]};return s.atoms.forEach(function(r,n){var o=f.Atom.getAttrHash(r);if(o.fragment=w,n===e.aid)a.mergeWith((0,x.fromAtomsAttrs)(t,d,o,!0)),b.set(n,d),S.atoms.push(d);else{var i=c.default.diff(r.pp,y).rotate(h).add(l.pp),s=new p.default.AtomAdd(o,i.get_xy0()).perform(t);a.addOp(s),b.set(n,s.data.aid),S.atoms.push(s.data.aid)}}),(0,x.mergeSgroups)(a,t,S.atoms,r),s.bonds.forEach(function(e){var r=new p.default.BondAdd(b.get(e.begin),b.get(e.end),e).perform(t);a.addOp(r),S.bonds.push(r.data.bid)}),a.operations.reverse(),[a,S]}function s(t,e,r,n,o,i){if(!i)return u(t,e,r,o);var a=function(t,e,r){return u(t,e,r,o)};return(0,S.fromAromaticTemplateOnBond)(t,e,r,n,a)}function u(t,e,r,n){var o=new m.default,i=e.molecule,a=t.molecule,s=a.bonds.get(r),u=i.bonds.get(e.bid),l=i.atoms.get(n?u.end:u.begin),d=new Map([[u.begin,n?s.end:s.begin],[u.end,n?s.begin:s.end]]),h={begin:n?u.end:u.begin,end:n?u.begin:u.end},g=v.default.mergeBondsParams(a,s,i,h),b=g.angle,_=g.scale,S=a.getBondFragment(r),O={atoms:[],bonds:[]};return i.atoms.forEach(function(e,r){var n=f.Atom.getAttrHash(e);if(n.fragment=S,r===u.begin||r===u.end)return void o.mergeWith((0,x.fromAtomsAttrs)(t,d.get(r),n,!0));var i=c.default.diff(e.pp,l.pp).rotate(b).scaled(_).add(a.atoms.get(s.begin).pp),h=y.default.atom(t,i,null,.1);if(null===h){var m=new p.default.AtomAdd(n,i).perform(t);o.addOp(m),d.set(r,m.data.aid),O.atoms.push(m.data.aid)}else d.set(r,h.id),o.mergeWith((0,x.fromAtomsAttrs)(t,d.get(r),n,!0))}),(0,x.mergeSgroups)(o,t,O.atoms,s.begin),i.bonds.forEach(function(e){var r=a.findBondId(d.get(e.begin),d.get(e.end));if(null===r){var n=new p.default.BondAdd(d.get(e.begin),d.get(e.end),e).perform(t);o.addOp(n),O.bonds.push(n.data.bid)}else o.mergeWith((0,w.fromBondsAttrs)(t,r,u,!0))}),o.operations.reverse(),[o,O]}Object.defineProperty(r,"__esModule",{value:!0}),r.fromTemplateOnCanvas=o,r.fromTemplateOnAtom=a,r.fromTemplateOnBondAction=s;var l=t("../../util/vec2"),c=n(l),f=t("../../chem/struct"),d=t("../shared/op"),p=n(d),h=t("../shared/action"),m=n(h),g=t("../shared/utils"),v=n(g),b=t("../shared/closest"),y=n(b),_=t("./utils"),x=t("./atom"),w=t("./bond"),S=t("./aromatic-fusing"),O=t("./paste")},{"../../chem/struct":542,"../../util/vec2":691,"../shared/action":562,"../shared/closest":563,"../shared/op":565,"../shared/utils":566,"./aromatic-fusing":546,"./atom":547,"./bond":549,"./paste":554,"./utils":560}],560:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){return t.molecule.atoms.get(e)[r]}function i(t,e){return t.atoms.get(e).a.neighbors.length}function a(t,e){return t.atoms.get(e).a.neighbors.map(function(e){var r=t.molecule.halfBonds.get(e);return{aid:r.end,bid:r.bid}})}function s(t,e){return Array.from(t.atoms.get(e).a.sgs)}function u(t,e){return t.molecule.atoms.get(e).pp}function l(t){return["atoms","bonds","frags","sgroups","rgroups","rxnArrows","rxnPluses"].reduce(function(e,r){return e[r]=Array.from(t[r].keys()),e},{})}function c(t,e){return Array.from(t.atoms.keys()).filter(function(r){return t.atoms.get(r).fragment===e})}function f(t,e){var r=[],n=u(t,e);a(t,e).forEach(function(e){var o=u(t,e.aid);g.default.dist(n,o)<.1||r.push({id:e.aid,v:g.default.diff(o,n)})}),r.sort(function(t,e){return Math.atan2(t.v.y,t.v.x)-Math.atan2(e.v.y,e.v.x)});var o,s,l=0,c=0;for(o=0;o<r.length;o++)s=g.default.angle(r[o].v,r[(o+1)%r.length].v),s<0&&(s+=2*Math.PI),s>c&&(l=o,c=s);var f=new g.default(1,0);if(r.length>0){if(1===r.length){c=-4*Math.PI/3;var d=a(t,e)[0];if(i(t,d.aid)>1){var p=[],h=u(t,d.aid),m=g.default.diff(n,h),v=Math.atan2(m.y,m.x);a(t,d.aid).forEach(function(e){var r=u(t,e.aid);if(!(e.bid===d.bid||g.default.dist(h,r)<.1)){var n=g.default.diff(r,h),o=Math.atan2(n.y,n.x)-v;o<0&&(o+=2*Math.PI),p.push(o)}}),p.sort(function(t,e){return t-e}),p[0]<=1.01*Math.PI&&p[p.length-1]<=1.01*Math.PI&&(c*=-1)}}s=c/2+Math.atan2(r[l].v.y,r[l].v.x),f=f.rotate(s)}f.add_(n);var y=b.default.atom(t,f,null,.1);return y=null===y?{label:"C"}:y.id,{atom:y,pos:f}}function d(t,e){return t.molecule.sgroups.filter(function(t,r){return!r.data.attached&&!r.data.absolute&&0===(0,h.default)(r.atoms,e).length})}Object.defineProperty(r,"__esModule",{value:!0});var p=t("lodash/difference"),h=n(p);r.atomGetAttr=o,r.atomGetDegree=i,r.atomGetNeighbors=a,r.atomGetSGroups=s,r.atomGetPos=u,r.structSelection=l,r.getFragmentAtoms=c,r.atomForNewBond=f,r.getRelSgroupsBySelection=d;var m=t("../../util/vec2"),g=n(m),v=t("../shared/closest"),b=n(v)},{"../../util/vec2":691,"../shared/closest":563,"lodash/difference":411}],561:[function(t,e,r){(function(e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){this.render=new y.default(t,Object.assign({scale:A},e)),this._selection=null,this._tool=null,this.historyStack=[],this.historyPtr=0,this.event={message:new f.default.Subscription,elementEdit:new f.default.PipelineSubscription,bondEdit:new f.default.PipelineSubscription,rgroupEdit:new f.default.PipelineSubscription,sgroupEdit:new f.default.PipelineSubscription,sdataEdit:new f.default.PipelineSubscription,quickEdit:new f.default.PipelineSubscription,attachEdit:new f.default.PipelineSubscription,change:new f.default.PipelineSubscription,selectionChange:new f.default.PipelineSubscription,aromatizeStruct:new f.default.PipelineSubscription,dearomatizeStruct:new f.default.PipelineSubscription},a(this,t)}function i(t){return t.which&&3===t.which||t.button&&2===t.button}function a(t,e){["click","dblclick","mousedown","mousemove","mouseup","mouseleave"].forEach(function(r){t.event[r]=new f.default.DOMSubscription;var n=t.event[r];e.addEventListener(r,n.dispatch.bind(n)),n.add(function(e){if("mouseup"!==r&&"mouseleave"!==r&&(i(e)||!e.target||"DIV"===e.target.nodeName))return t.hover(null),!0;var n=t.tool();return t.lastEvent=e,n&&r in n&&n[r](e),!0},-1)})}function s(t,e){console.assert(e,"Reference point not specified"),t.render.setScrollOffset(0,0)}function u(t,e){var r=t.getVBoxObj(e||{});return p.default.lc2(r.p0,.5,r.p1,.5)}function l(t){var e=0,r=0;do{e+=t.offsetTop||0,r+=t.offsetLeft||0,t=t.offsetParent}while(t);return new p.default(r,e)}Object.defineProperty(r,"__esModule",{value:!0});var c=t("subscription"),f=n(c),d=t("../util/vec2"),p=n(d),h=t("../util/pile"),m=n(h),g=t("../chem/struct"),v=n(g),b=t("../render"),y=n(b),_=t("./actions/basic"),x=t("./shared/closest"),w=n(x),S=t("./tool"),O=n(S),A=40,E=["atoms","bonds","frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"];o.prototype.tool=function(t,e){if(arguments.length>0){this._tool&&this._tool.cancel&&this._tool.cancel();var r=O.default[t](this,e);if(!r)return null;this._tool=r}return this._tool},o.prototype.struct=function(t){return arguments.length>0&&(this.selection(null),this.update((0,_.fromNewCanvas)(this.render.ctab,t||new v.default)),s(this,u(this.render.ctab))),this.render.ctab.molecule},o.prototype.options=function(t){if(arguments.length>0){var e=this.render.ctab.molecule,r=this.render.options.zoom;this.render.clientArea.innerHTML="",this.render=new y.default(this.render.clientArea,Object.assign({scale:A},t)),this.render.setMolecule(e),this.render.setZoom(r),this.render.update()}return this.render.options},o.prototype.zoom=function(t){return arguments.length>0&&(this.render.setZoom(t),s(this,u(this.render.ctab,this.selection())),this.render.update()),this.render.options.zoom},o.prototype.selection=function(t){var e=this.render.ctab;if(arguments.length>0){if(this._selection=null,"all"===t&&(t=E.reduce(function(t,r){return t[r]=Array.from(e[r].keys()),t},{})),"descriptors"===t&&(e=this.render.ctab,t={sgroupData:Array.from(e.sgroupData.keys())}),t){var r={};Object.keys(t).forEach(function(e){t[e].length>0&&(r[e]=t[e].slice())}),0!==Object.keys(r).length&&(this._selection=r)}this.render.ctab.setSelection(this._selection),this.event.selectionChange.dispatch(this._selection),this.render.update()}return this._selection},o.prototype.hover=function(t,e){var r=e||this._tool;"ci"in r&&(!t||r.ci.map!==t.map||r.ci.id!==t.id)&&(this.highlight(r.ci,!1),delete r.ci),t&&this.highlight(t,!0)&&(r.ci=t)};var j=["atoms","bonds","rxnArrows","rxnPluses","chiralFlags","frags","merge","rgroups","sgroups","sgroupData"];o.prototype.highlight=function(t,e){if(-1===j.indexOf(t.map))return!1;var r=this.render,n=null;if("merge"===t.map)return Object.keys(t.items).forEach(function(o){t.items[o].forEach(function(t){(n=r.ctab[o].get(t))&&n.setHighlight(e,r)})}),!0;if(!(n=r.ctab[t.map].get(t.id)))return!0;if("sgroups"===t.map&&"DAT"===n.item.type||"sgroupData"===t.map){var o=r.ctab.sgroups.get(t.id),i=r.ctab.sgroupData.get(t.id);o&&o.setHighlight(e,r),i&&i.setHighlight(e,r)}else n.setHighlight(e,r);return!0},o.prototype.update=function(t,e){!0===t?this.render.update(!0):(e||t.isDummy()||(this.historyStack.splice(this.historyPtr,33,t),this.historyStack.length>32&&this.historyStack.shift(),this.historyPtr=this.historyStack.length,this.event.change.dispatch(t)),this.render.update())},o.prototype.historySize=function(){return{undo:this.historyPtr,redo:this.historyStack.length-this.historyPtr}},o.prototype.undo=function(){if(0===this.historyPtr)throw new Error("Undo stack is empty");if(this.tool()&&this.tool().cancel&&this.tool().cancel(),this.selection(null),this._tool instanceof O.default.paste)return void this.event.change.dispatch();this.historyPtr--;var t=this.historyStack[this.historyPtr].perform(this.render.ctab);this.historyStack[this.historyPtr]=t,this.event.change.dispatch(t),this.render.update()},o.prototype.redo=function(){if(this.historyPtr===this.historyStack.length)throw new Error("Redo stack is empty");if(this.tool()&&this.tool().cancel&&this.tool().cancel(),this.selection(null),this._tool instanceof O.default.paste)return void this.event.change.dispatch();var t=this.historyStack[this.historyPtr].perform(this.render.ctab);this.historyStack[this.historyPtr]=t,this.historyPtr++,this.event.change.dispatch(t),this.render.update()},o.prototype.on=function(t,e){this.event[t].add(e)},o.prototype.findItem=function(t,r,n){var o=e._ui_editor?new p.default(this.render.page2obj(t)):new p.default(t.pageX,t.pageY).sub(l(this.render.clientArea));return w.default.item(this.render.ctab,o,r,n,this.render.options)},
  o.prototype.findMerge=function(t,e){return w.default.merge(this.render.ctab,t,e,this.render.options)},o.prototype.explicitSelected=function(){var t=this.selection()||{},e=E.reduce(function(e,r){return e[r]=t[r]?t[r].slice():[],e},{}),r=this.render.ctab.molecule;return e.bonds&&e.bonds.forEach(function(t){var n=r.bonds.get(t);e.atoms=e.atoms||[],e.atoms.indexOf(n.begin)<0&&e.atoms.push(n.begin),e.atoms.indexOf(n.end)<0&&e.atoms.push(n.end)}),e.atoms&&e.bonds&&r.bonds.forEach(function(t,r){!e.bonds.indexOf(r)<0&&e.atoms.indexOf(t.begin)>=0&&e.atoms.indexOf(t.end)>=0&&(e.bonds=e.bonds||[],e.bonds.push(r))}),e},o.prototype.structSelected=function(){var t=this.render.ctab.molecule,e=this.explicitSelected(),r=t.clone(new m.default(e.atoms),new m.default(e.bonds),!0);return t.rxnArrows.forEach(function(t,n){-1!==e.rxnArrows.indexOf(n)&&r.rxnArrows.add(t.clone())}),t.rxnPluses.forEach(function(t,n){-1!==e.rxnPluses.indexOf(n)&&r.rxnPluses.add(t.clone())}),r.isChiral=t.isChiral,r.isReaction=t.isReaction&&(r.rxnArrows.size||r.rxnPluses.size),r},o.prototype.alignDescriptors=function(){this.selection(null);var t=(0,_.fromDescriptorsAlign)(this.render.ctab);this.update(t),this.render.update(!0)},r.default=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../chem/struct":542,"../render":591,"../util/pile":688,"../util/vec2":691,"./actions/basic":548,"./shared/closest":563,"./tool":577,subscription:515}],562:[function(t,e,r){"use strict";function n(){this.operations=[]}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype.addOp=function(t,e){return e&&t.isDummy(e)||this.operations.push(t),t},n.prototype.mergeWith=function(t){return this.operations=this.operations.concat(t.operations),this},n.prototype.perform=function(t){var e=new n;return this.operations.forEach(function(r){e.addOp(r.perform(t))}),e.operations.reverse(),e},n.prototype.isDummy=function(t){return void 0===this.operations.find(function(e){return!t||!e.isDummy(t)})},r.default=n},{}],563:[function(t,e,r){"use strict";function n(t,e,r,n){var o=null,i=g,a=r&&"atoms"===r.map?r.id:null;return n=n||i,n=Math.min(n,i),t.atoms.forEach(function(t,r){if(r!==a){var i=m.default.dist(e,t.a.pp);i<n&&(o=r,n=i)}}),null!==o?{id:o,dist:n}:null}function o(t,e,r,n,o){var i=null,a=null,s=.8*g,u=r&&"bonds"===r.map?r.id:null;n=n||s,n=Math.min(n,s);var l=n;return t.bonds.forEach(function(r,n){if(n!==u){var o=t.atoms.get(r.b.begin).a.pp,i=t.atoms.get(r.b.end).a.pp,s=m.default.lc2(o,.5,i,.5),c=m.default.dist(e,s);c<l&&(l=c,a=n)}}),t.bonds.forEach(function(r,o){if(o!==u){var a=t.molecule.halfBonds.get(r.b.hb1),s=a.dir,l=a.norm,c=t.atoms.get(r.b.begin).a.pp,f=t.atoms.get(r.b.end).a.pp;if(m.default.dot(e.sub(c),s)*m.default.dot(e.sub(f),s)<0){var d=Math.abs(m.default.dot(e.sub(c),l));d<n&&(i=o,n=d)}}}),null!==a?{id:a,dist:l}:null!==i&&n>g*o?{id:i,dist:n}:null}function i(t,e){var r,n=null;return t.chiralFlags.forEach(function(t,o){var i=t.pp;if(!(Math.abs(e.x-i.x)>=1)){var a=Math.abs(e.y-i.y);a<.3&&(!n||a<r)&&(r=a,n={id:o,dist:r})}}),n}function a(t,e){var r=null,n=null;return t.sgroupData.forEach(function(t,o){if("DAT"!==t.sgroup.type)throw new Error("Data group expected");if("MRV_IMPLICIT_H"!==t.sgroup.data.fieldName){var i=t.sgroup.dataArea,a=i.p0.y<e.y&&i.p1.y>e.y&&i.p0.x<e.x&&i.p1.x>e.x,s=Math.min(Math.abs(i.p0.x-e.x),Math.abs(i.p1.x-e.x));a&&(null===n||s<r)&&(n={id:o,dist:s},r=s)}}),n}function s(t,e,r,i,a){i=Math.min(i||g,g);var s=t.molecule,u=n(t,e,r,i);if(u)return{id:s.atoms.get(u.id).fragment,dist:u.dist};var l=o(t,e,r,i,a);if(l){var c=s.bonds.get(l.id).begin;return{id:s.atoms.get(c).fragment,dist:l.dist}}return null}function u(t,e,r,n){n=Math.min(n||g,g);var o=null;return t.rgroups.forEach(function(t,i){if(i!==r&&t.labelBox&&t.labelBox.contains(e,.5)){var a=m.default.dist(t.labelBox.centre(),e);(!o||a<n)&&(n=a,o={id:i,dist:n})}}),o}function l(t,e){var r=null,n=null;return t.rxnArrows.forEach(function(t,o){var i=t.item.pp;if(!(Math.abs(e.x-i.x)>=1)){var a=Math.abs(e.y-i.y);a<.3&&(!n||a<r)&&(r=a,n={id:o,dist:r})}}),n}function c(t,e){var r=null,n=null;return t.rxnPluses.forEach(function(t,o){var i=t.item.pp,a=Math.max(Math.abs(e.x-i.x),Math.abs(e.y-i.y));a<.3&&(!n||a<r)&&(r=a,n={id:o,dist:r})}),n}function f(t,e){var r=null,n=g;return t.molecule.sgroups.forEach(function(t,o){var i=t.bracketDir,a=i.rotateSC(1,0),s=new m.default(m.default.dot(e,i),m.default.dot(e,a));t.areas.forEach(function(t){var e=t.p0.y<s.y&&t.p1.y>s.y&&t.p0.x<s.x&&t.p1.x>s.x,i=Math.min(Math.abs(t.p0.x-s.x),Math.abs(t.p1.x-s.x));e&&(null===r||i<n)&&(r=o,n=i)})}),null!==r?{id:r,dist:n}:null}function d(t,e,r,n,o){return r=r||Object.keys(v),r.reduce(function(r,i){var a=r?r.dist:null,s=v[i](t,e,n,a,o);return null!==s&&(null===r||s.dist<r.dist)?{map:i,id:s.id,dist:s.dist}:r},null)}function p(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["atoms","bonds"],n=arguments[3],o={atoms:new Map,bonds:new Map},i=t.molecule;e.atoms.forEach(function(t){o.atoms.set(t,i.atoms.get(t).pp)}),e.bonds.forEach(function(t){var e=i.bonds.get(t);o.bonds.set(t,m.default.lc2(i.atoms.get(e.begin).pp,.5,i.atoms.get(e.end).pp,.5))});var a={};return r.forEach(function(r){a[r]=Array.from(o[r].keys()).reduce(function(i,a){var s={map:r,id:a},u=v[r](t,o[r].get(a),s,null,n);return u&&!e[r].includes(u.id)&&i.set(a,u.id),i},new Map)}),a}Object.defineProperty(r,"__esModule",{value:!0});var h=t("../../util/vec2"),m=function(t){return t&&t.__esModule?t:{default:t}}(h),g=.4,v={atoms:n,bonds:o,chiralFlags:i,sgroupData:a,sgroups:f,rxnArrows:l,rxnPluses:c,frags:s,rgroups:u};r.default={atom:n,item:d,merge:p}},{"../../util/vec2":691}],564:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.SgContexts={Fragment:"Fragment",Multifragment:"Multifragment",Bond:"Bond",Atom:"Atom",Group:"Group"}},{}],565:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(){this.type="OpBase",this.execute=function(){throw new Error("Operation.execute() is not implemented")},this.invert=function(){throw new Error("Operation.invert() is not implemented")},this.perform=function(t){return this.execute(t),this._inverted||(this._inverted=this.invert(),this._inverted._inverted=this),this._inverted},this.isDummy=function(t){return!!this._isDummy&&this._isDummy(t)}}function a(t,e){this.data={atom:t,pos:e,aid:null},this.execute=function(t){var e=this,r=t.molecule,n={};this.data.atom&&Object.keys(this.data.atom).forEach(function(t){n[t]=e.data.atom[t]}),n.label=n.label||"C","number"!=typeof this.data.aid?this.data.aid=r.atoms.add(new Z.Atom(n)):r.atoms.set(this.data.aid,new Z.Atom(n));var o=new Q.ReAtom(r.atoms.get(this.data.aid));o.component=t.connectedComponents.add(new X.default([this.data.aid])),t.atoms.set(this.data.aid,o),t.markAtom(this.data.aid,1),r.atomSetPos(this.data.aid,new q.default(this.data.pos));var i=r.rxnArrows.get(0);if(i){r.atoms.get(this.data.aid).rxnFragmentType=r.defineRxnFragmentTypeForAtomset(new X.default([this.data.aid]),i.pp.x)}},this.invert=function(){var t=new s;return t.data=this.data,t}}function s(t){this.data={aid:t,atom:null,pos:null},this.execute=function(t){var e=t.molecule;this.data.atom||(this.data.atom=e.atoms.get(this.data.aid),this.data.pos=this.data.atom.pp);var r=t.atoms.get(this.data.aid),n=t.connectedComponents.get(r.component);n.delete(this.data.aid),0===n.size&&t.connectedComponents.delete(r.component),t.clearVisel(r.visel),t.atoms.delete(this.data.aid),t.markItemRemoved(),e.atoms.delete(this.data.aid)},this.invert=function(){var t=new a;return t.data=this.data,t}}function u(t,e,r){this.data={aid:t,attribute:e,value:r},this.data2=null,this.execute=function(t){var e=t.molecule.atoms.get(this.data.aid);this.data2||(this.data2={aid:this.data.aid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,z(t,this.data.aid)},this._isDummy=function(t){return t.molecule.atoms.get(this.data.aid)[this.data.attribute]===this.data.value},this.invert=function(){var t=new u;return t.data=this.data2,t.data2=this.data,t}}function l(t,e,r){this.data={aid:t,d:e,noinvalidate:r},this.execute=function(t){var e=t.molecule,r=this.data.aid,n=this.data.d;e.atoms.get(r).pp.add_(n),t.atoms.get(r).visel.translate(Y.default.obj2scaled(n,t.render.options)),this.data.d=n.negated(),this.data.noinvalidate||z(t,r,1)},this._isDummy=function(){return 0===this.data.d.x&&0===this.data.d.y},this.invert=function(){var t=new l;return t.data=this.data,t}}function c(t,e){this.data={bid:t,d:e},this.execute=function(t){t.bonds.get(this.data.bid).visel.translate(Y.default.obj2scaled(this.data.d,t.render.options)),this.data.d=this.data.d.negated()},this.invert=function(){var t=new c;return t.data=this.data,t}}function f(t,e){this.data={id:t,d:e},this.execute=function(t){t.reloops.get(this.data.id)&&t.reloops.get(this.data.id).visel&&t.reloops.get(this.data.id).visel.translate(Y.default.obj2scaled(this.data.d,t.render.options)),this.data.d=this.data.d.negated()},this.invert=function(){var t=new f;return t.data=this.data,t}}function d(t,e){this.type="OpSGroupAtomAdd",this.data={sgid:t,aid:e},this.execute=function(t){var e=t.molecule,r=this.data.aid,n=this.data.sgid,o=e.atoms.get(r);if(e.sgroups.get(n).atoms.indexOf(r)>=0)throw new Error("The same atom cannot be added to an S-group more than once");if(!o)throw new Error("OpSGroupAtomAdd: Atom "+r+" not found");e.atomAddToSGroup(n,r),z(t,r)},this.invert=function(){var t=new p;return t.data=this.data,t}}function p(t,e){this.type="OpSGroupAtomRemove",this.data={sgid:t,aid:e},this.execute=function(t){var e=this.data.aid,r=this.data.sgid,n=t.molecule,o=n.atoms.get(e),i=n.sgroups.get(r);Z.SGroup.removeAtom(i,e),o.sgs.delete(r),z(t,e)},this.invert=function(){var t=new d;return t.data=this.data,t}}function h(t,e,r){this.type="OpSGroupAttr",this.data={sgid:t,attr:e,value:r},this.execute=function(t){var e=t.molecule,r=this.data.sgid,n=e.sgroups.get(r);"DAT"===n.type&&t.sgroupData.has(r)&&(t.clearVisel(t.sgroupData.get(r).visel),t.sgroupData.delete(r)),this.data.value=n.setAttr(this.data.attr,this.data.value)},this.invert=function(){var t=new h;return t.data=this.data,t}}function m(t,e,r){this.type="OpSGroupCreate",this.data={sgid:t,type:e,pp:r},this.execute=function(t){var e=t.molecule,r=new Z.SGroup(this.data.type),n=this.data.sgid;r.id=n,e.sgroups.set(n,r),this.data.pp&&(e.sgroups.get(n).pp=new q.default(this.data.pp)),t.sgroups.set(n,new Q.ReSGroup(e.sgroups.get(n))),this.data.sgid=n},this.invert=function(){var t=new g;return t.data=this.data,t}}function g(t){this.type="OpSGroupDelete",this.data={sgid:t},this.execute=function(t){var e=t.molecule,r=this.data.sgid,n=t.sgroups.get(r);if(this.data.type=n.item.type,this.data.pp=n.item.pp,"DAT"===n.item.type&&t.sgroupData.has(r)&&(t.clearVisel(t.sgroupData.get(r).visel),t.sgroupData.delete(r)),t.clearVisel(n.visel),0!==n.item.atoms.length)throw new Error("S-Group not empty!");t.sgroups.delete(r),e.sgroups.delete(r)},this.invert=function(){var t=new m;return t.data=this.data,t}}function v(t,e,r){this.type="OpSGroupAddToHierarchy",this.data={sgid:t,parent:e,children:r},this.execute=function(t){var n=t.molecule,o=this.data.sgid,i=n.sGroupForest.insert(o,e,r);this.data.parent=i.parent,this.data.children=i.children},this.invert=function(){var t=new b;return t.data=this.data,t}}function b(t){this.type="OpSGroupRemoveFromHierarchy",this.data={sgid:t},this.execute=function(t){var e=t.molecule,r=this.data.sgid;this.data.parent=e.sGroupForest.parent.get(r),this.data.children=e.sGroupForest.children.get(r),e.sGroupForest.remove(r)},this.invert=function(){var t=new v;return t.data=this.data,t}}function y(t,e,r){this.data={bond:r,begin:t,end:e,bid:null},this.execute=function(t){var e=this,r=t.molecule;if(this.data.begin===this.data.end)throw new Error("Distinct atoms expected");if(J.debug&&this.molecule.checkBondExists(this.data.begin,this.data.end))throw new Error("Bond already exists");z(t,this.data.begin,1),z(t,this.data.end,1);var n={};this.data.bond&&Object.keys(this.data.bond).forEach(function(t){n[t]=e.data.bond[t]}),n.type=n.type||Z.Bond.PATTERN.TYPE.SINGLE,n.begin=this.data.begin,n.end=this.data.end,"number"!=typeof this.data.bid?this.data.bid=r.bonds.add(new Z.Bond(n)):r.bonds.set(this.data.bid,new Z.Bond(n)),r.bondInitHalfBonds(this.data.bid),r.atomAddNeighbor(r.bonds.get(this.data.bid).hb1),r.atomAddNeighbor(r.bonds.get(this.data.bid).hb2),t.bonds.set(this.data.bid,new Q.ReBond(r.bonds.get(this.data.bid))),t.markBond(this.data.bid,1)},this.invert=function(){var t=new _;return t.data=this.data,t}}function _(t){this.data={bid:t,bond:null,begin:null,end:null},this.execute=function(t){var e=t.molecule;this.data.bond||(this.data.bond=e.bonds.get(this.data.bid),this.data.begin=this.data.bond.begin,this.data.end=this.data.bond.end),W(t,this.data.bid);var r=t.bonds.get(this.data.bid);[r.b.hb1,r.b.hb2].forEach(function(e){var r=t.molecule.halfBonds.get(e);r.loop>=0&&t.loopRemove(r.loop)},t),t.clearVisel(r.visel),t.bonds.delete(this.data.bid),t.markItemRemoved();var n=e.bonds.get(this.data.bid);[n.hb1,n.hb2].forEach(function(t){var r=e.halfBonds.get(t),n=e.atoms.get(r.begin),o=n.neighbors.indexOf(t),i=(o+n.neighbors.length-1)%n.neighbors.length,a=(o+1)%n.neighbors.length;e.setHbNext(n.neighbors[i],n.neighbors[a]),n.neighbors.splice(o,1)}),e.halfBonds.delete(n.hb1),e.halfBonds.delete(n.hb2),e.bonds.delete(this.data.bid)},this.invert=function(){var t=new y;return t.data=this.data,t}}function x(t,e,r){this.data={bid:t,attribute:e,value:r},this.data2=null,this.execute=function(t){var e=t.molecule.bonds.get(this.data.bid);this.data2||(this.data2={bid:this.data.bid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,W(t,this.data.bid),"type"===this.data.attribute&&H(t,this.data.bid)},this._isDummy=function(t){return t.molecule.bonds.get(this.data.bid)[this.data.attribute]===this.data.value},this.invert=function(){var t=new x;return t.data=this.data2,t.data2=this.data,t}}function w(t){this.frid=void 0===t?null:t,this.execute=function(t){var e=t.molecule,r={};null===this.frid?this.frid=e.frags.add(r):e.frags.set(this.frid,r),t.frags.set(this.frid,new Q.ReFrag(r))},this.invert=function(){return new S(this.frid)}}function S(t){this.frid=t,this.execute=function(t){var e=t.molecule;U(t,"frags",this.frid,1),t.frags.delete(this.frid),e.frags.delete(this.frid)},this.invert=function(){return new w(this.frid)}}function O(t,e,r){this.data={rgid:t,attribute:e,value:r},this.data2=null,this.execute=function(t){var e=t.molecule.rgroups.get(this.data.rgid);this.data2||(this.data2={rgid:this.data.rgid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,U(t,"rgroups",this.data.rgid)},this._isDummy=function(t){return t.molecule.rgroups.get(this.data.rgid)[this.data.attribute]===this.data.value},this.invert=function(){var t=new O;return t.data=this.data2,t.data2=this.data,t}}function A(t,e,r){this.type="OpAddOrDeleteRGFragment",this.rgid_new=t,this.rg_new=r,this.rgid_old=null,this.rg_old=null,this.frid=e,this.execute=function(t){var e=t.molecule;if(this.rgid_old=this.rgid_old||Z.RGroup.findRGroupByFragment(e.rgroups,this.frid),this.rg_old=this.rgid_old?e.rgroups.get(this.rgid_old):null,this.rg_old&&(this.rg_old.frags.delete(this.frid),t.clearVisel(t.rgroups.get(this.rgid_old).visel),0===this.rg_old.frags.size?(t.rgroups.delete(this.rgid_old),e.rgroups.delete(this.rgid_old),t.markItemRemoved()):t.markItem("rgroups",this.rgid_old,1)),this.rgid_new){var r=e.rgroups.get(this.rgid_new);r?t.markItem("rgroups",this.rgid_new,1):(r=this.rg_new||new Z.RGroup,e.rgroups.set(this.rgid_new,r),t.rgroups.set(this.rgid_new,new Q.ReRGroup(r))),r.frags.add(this.frid)}},this.invert=function(){return new A(this.rgid_old,this.frid,this.rg_old)}}function E(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this.type="OpUpdateIfThenValues",this.rgid_new=t,this.rgid_old=e,this.ifThenHistory=new Map,this.execute=function(t){var e=this,n=t.molecule;n.rgroups.forEach(function(t,o){t.ifthen!==e.rgid_old||r.includes(o)||(t.ifthen=e.rgid_new,e.ifThenHistory.set(o,e.rgid_old),n.rgroups.set(o,t))})},this.invert=function(){return new j(this.rgid_new,this.rgid_old,this.ifThenHistory)}}function j(t,e,r){this.type="OpRestoreIfThenValues",this.rgid_new=t,this.rgid_old=e,this.ifThenHistory=r||new Map,this.execute=function(t){var e=t.molecule;this.ifThenHistory.forEach(function(t,r){var n=e.rgroups.get(r);n.ifthen=t,e.rgroups.set(r,n)})},this.invert=function(){return new E(this.rgid_old,this.rgid_new)}}function P(t){this.data={pos:t,arid:null},this.execute=function(t){var e=t.molecule;"number"!=typeof this.data.arid?this.data.arid=e.rxnArrows.add(new Z.RxnArrow):e.rxnArrows.set(this.data.arid,new Z.RxnArrow),t.rxnArrows.set(this.data.arid,new Q.ReRxnArrow(e.rxnArrows.get(this.data.arid))),e.rxnArrowSetPos(this.data.arid,new q.default(this.data.pos));var r=e.getComponents(),n=r.reactants,i=r.products;n=n.reduce(function(t,e){return t.concat.apply(t,o(e))},[]),i=i.reduce(function(t,e){return t.concat.apply(t,o(e))},[]),n.forEach(function(t){e.atoms.get(t).rxnFragmentType=1}),i.forEach(function(t){e.atoms.get(t).rxnFragmentType=2}),U(t,"rxnArrows",this.data.arid,1)},this.invert=function(){var t=new T;return t.data=this.data,t}}function T(t){this.data={arid:t,pos:null},this.execute=function(t){var e=t.molecule;this.data.pos||(this.data.pos=e.rxnArrows.get(this.data.arid).pp),t.markItemRemoved(),t.clearVisel(t.rxnArrows.get(this.data.arid).visel),t.rxnArrows.delete(this.data.arid),e.rxnArrows.delete(this.data.arid),e.atoms.forEach(function(t){t.rxnFragmentType=-1})},this.invert=function(){var t=new P;return t.data=this.data,t}}function C(t,e,r){this.data={id:t,d:e,noinvalidate:r},this.execute=function(t){var e=t.molecule,r=this.data.id,n=this.data.d;e.rxnArrows.get(r).pp.add_(n),t.rxnArrows.get(r).visel.translate(Y.default.obj2scaled(n,t.render.options)),this.data.d=n.negated(),this.data.noinvalidate||U(t,"rxnArrows",r,1)},this.invert=function(){var t=new C;return t.data=this.data,t}}function k(t){this.data={plid:null,pos:t},this.execute=function(t){var e=t.molecule;"number"!=typeof this.data.plid?this.data.plid=e.rxnPluses.add(new Z.RxnPlus):e.rxnPluses.set(this.data.plid,new Z.RxnPlus),t.rxnPluses.set(this.data.plid,new Q.ReRxnPlus(e.rxnPluses.get(this.data.plid))),e.rxnPlusSetPos(this.data.plid,new q.default(this.data.pos)),U(t,"rxnPluses",this.data.plid,1)},this.invert=function(){var t=new M;return t.data=this.data,t}}function M(t){this.data={plid:t,pos:null},this.execute=function(t){var e=t.molecule;this.data.pos||(this.data.pos=e.rxnPluses.get(this.data.plid).pp),t.markItemRemoved(),t.clearVisel(t.rxnPluses.get(this.data.plid).visel),t.rxnPluses.delete(this.data.plid),e.rxnPluses.delete(this.data.plid)},this.invert=function(){var t=new k;return t.data=this.data,t}}function R(t,e,r){this.data={id:t,d:e,noinvalidate:r},this.execute=function(t){var e=t.molecule,r=this.data.id,n=this.data.d;e.rxnPluses.get(r).pp.add_(n),t.rxnPluses.get(r).visel.translate(Y.default.obj2scaled(n,t.render.options)),this.data.d=n.negated(),this.data.noinvalidate||U(t,"rxnPluses",r,1)},this.invert=function(){var t=new R;return t.data=this.data,t}}function N(t,e){this.data={id:t,d:e},this.execute=function(t){t.molecule.sgroups.get(this.data.id).pp.add_(this.data.d),this.data.d=this.data.d.negated(),U(t,"sgroupData",this.data.id,1)},this.invert=function(){var t=new N;return t.data=this.data,t}}function I(t){this.data={struct:t},this.execute=function(t){var e=t.molecule;t.clearVisels(),t.render.setMolecule(this.data.struct),this.data.struct=e},this.invert=function(){var t=new I;return t.data=this.data,t}}function B(t){this.data={pos:t},this.execute=function(e){var r=e.molecule;e.chiralFlags.size>0&&(e.clearVisel(e.chiralFlags.get(0).visel),e.chiralFlags.delete(0)),e.chiralFlags.set(0,new Q.ReChiralFlag(t)),r.isChiral=!0,U(e,"chiralFlags",0,1)},this.invert=function(){var t=new L;return t.data=this.data,t}}function L(){this.data={pos:null},this.execute=function(t){var e=t.molecule;if(t.chiralFlags.size<1)throw new Error("Cannot remove chiral flag");t.clearVisel(t.chiralFlags.get(0).visel),this.data.pos=t.chiralFlags.get(0).pp,t.chiralFlags.delete(0),e.isChiral=!1},this.invert=function(){var t=new B(this.data.pos);return t.data=this.data,t}}function D(t){this.data={d:t},this.execute=function(t){t.chiralFlags.get(0).pp.add_(this.data.d),this.data.d=this.data.d.negated(),U(t,"chiralFlags",0,1)},this.invert=function(){var t=new D;return t.data=this.data,t}}function F(){this.type="OpAlignDescriptors",this.history={},this.execute=function(t){var e=this,r=Array.from(t.molecule.sgroups.values()).reverse(),n=t.molecule.getCoordBoundingBoxObj(),o=new q.default(n.max.x,n.min.y).add(new q.default(2,-1));r.forEach(function(r){e.history[r.id]=new q.default(r.pp),o=o.add(new q.default(0,.5)),r.pp=o,t.molecule.sgroups.set(r.id,r),U(t,"sgroupData",r.id,1)})},this.invert=function(){return new G(this.history)}}function G(t){this.type="OpRestoreDescriptorsPosition",this.history=t,this.execute=function(t){var e=this;Array.from(t.molecule.sgroups.values()).forEach(function(r){r.pp=e.history[r.id],t.molecule.sgroups.set(r.id,r),U(t,"sgroupData",r.id,1)})},this.invert=function(){return new F}}function z(t,e,r){var n=t.atoms.get(e);t.markAtom(e,r?1:0);var o=t.molecule.halfBonds;n.a.neighbors.forEach(function(e){if(o.has(e)){var n=o.get(e);t.markBond(n.bid,1),t.markAtom(n.end,0),r&&H(t,n.bid)}})}function H(t,e){var r=t.bonds.get(e),n=t.molecule.halfBonds.get(r.b.hb1).loop,o=t.molecule.halfBonds.get(r.b.hb2).loop;n>=0&&t.loopRemove(n),o>=0&&t.loopRemove(o)}function W(t,e){var r=t.bonds.get(e);H(t,e),z(t,r.b.begin,0),z(t,r.b.end,0)}function U(t,e,r,n){"atoms"===e?z(t,r,n):"bonds"===e?(W(t,r),n>0&&H(t,r)):t.markItem(e,r,n)}Object.defineProperty(r,"__esModule",{value:!0});var V=t("../../util/vec2"),q=n(V),K=t("../../util/scale"),Y=n(K),$=t("../../util/pile"),X=n($),Z=t("../../chem/struct"),Q=t("../../render/restruct"),J={debug:!1,logcnt:0,logmouse:!1,hl:!1};J.logMethod=function(){},a.prototype=new i,s.prototype=new i,u.prototype=new i,l.prototype=new i,c.prototype=new i,f.prototype=new i,d.prototype=new i,p.prototype=new i,h.prototype=new i,m.prototype=new i,g.prototype=new i,v.prototype=new i,b.prototype=new i,y.prototype=new i,_.prototype=new i,x.prototype=new i,w.prototype=new i,S.prototype=new i,O.prototype=new i,A.prototype=new i,E.prototype=new i,j.prototype=new i,P.prototype=new i,T.prototype=new i,C.prototype=new i,k.prototype=new i,M.prototype=new i,R.prototype=new i,N.prototype=new i,I.prototype=new i,B.prototype=new i,L.prototype=new i,D.prototype=new i,F.prototype=new i,G.prototype=new i,r.default={AtomAdd:a,AtomDelete:s,AtomAttr:u,AtomMove:l,BondMove:c,LoopMove:f,SGroupAtomAdd:d,SGroupAtomRemove:p,SGroupAttr:h,SGroupCreate:m,SGroupDelete:g,SGroupAddToHierarchy:v,SGroupRemoveFromHierarchy:b,BondAdd:y,BondDelete:_,BondAttr:x,FragmentAdd:w,FragmentDelete:S,RGroupAttr:O,RGroupFragment:A,RxnArrowAdd:P,RxnArrowDelete:T,RxnArrowMove:C,RxnPlusAdd:k,RxnPlusDelete:M,RxnPlusMove:R,SGroupDataMove:N,CanvasLoad:I,ChiralFlagAdd:B,ChiralFlagDelete:L,ChiralFlagMove:D,UpdateIfThen:E,AlignDescriptors:F}},{"../../chem/struct":542,"../../render/restruct":593,"../../util/pile":688,"../../util/scale":690,"../../util/vec2":691}],566:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){h=Math.PI/180*t}function i(t,e){var r=p.default.diff(e,t);return Math.atan2(r.y,r.x)}function a(t,e){return e&&(t=i(t,e)),Math.round(t/h)*h}function s(t,e,r){var n=new p.default(1,0).rotate(r?i(t,e):a(t,e));return n.add_(t),n}function u(t){var e=Math.round(t/Math.PI*180);return e>180?e-=360:e<=-180&&(e+=360),e}function l(t,e,r,n){var o=t.atoms.get(e.begin),a=r.atoms.get(n.begin),s=t.atoms.get(e.end),l=r.atoms.get(n.end),c=i(o.pp,s.pp)-i(a.pp,l.pp),d=Math.abs(u(c)%180),h=p.default.dist(o.pp,s.pp)/p.default.dist(a.pp,l.pp);return{merged:!(0,f.default)(d,m,180-m)&&(0,f.default)(h,1-g,1+g),angle:c,scale:h,cross:Math.abs(u(c))>90}}Object.defineProperty(r,"__esModule",{value:!0});var c=t("lodash/inRange"),f=n(c),d=t("../../util/vec2"),p=n(d),h=Math.PI/12,m=10,g=.2;r.default={calcAngle:i,fracAngle:a,calcNewAtomPos:s,degrees:u,setFracAngle:o,mergeBondsParams:l}},{"../../util/vec2":691,"lodash/inRange":447}],567:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.editor=t,this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../actions/atom");n.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["atoms"]))},n.prototype.click=function(t){var e=this.editor,r=e.render.ctab.molecule,n=e.findItem(t,["atoms"]);if(n&&"atoms"===n.map){this.editor.hover(null);var i=r.atoms.get(n.id),a=e.event.elementEdit.dispatch({attpnt:i.attpnt});return Promise.resolve(a).then(function(t){if(i.attpnt!==t.attpnt){var r=(0,o.fromAtomsAttrs)(e.render.ctab,n.id,t);e.update(r)}}).catch(function(){return null}),!0}return!0},r.default=n},{"../actions/atom":547}],568:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n)){if(!t.selection()||!t.selection().atoms)return new n(t,e);var r=(0,u.fromAtomsAttrs)(t.render.ctab,t.selection().atoms,e,!0);return t.update(r),t.selection(null),null}this.editor=t,this.atomProps=e,this.bondProps={type:1,stereo:i.Bond.PATTERN.STEREO.NONE}}function o(t,e){var r=t.dragCtx,n=t.editor,o=r.item&&r.item.id,a=void 0!==o&&null!==o?e.ctab.molecule.atoms.get(o):new i.Atom({label:""});r.timeout=setTimeout(function(){delete t.dragCtx,n.selection(null);var i=n.event.quickEdit.dispatch(a);Promise.resolve(i).then(function(t){var i=o?(0,u.fromAtomsAttrs)(e.ctab,o,t):(0,u.fromAtomAddition)(e.ctab,r.xy0,t);n.update(i)}).catch(function(){return null})},750),r.stopTapping=function(){r.timeout&&(clearTimeout(r.timeout),delete t.dragCtx.timeout)}}Object.defineProperty(r,"__esModule",{value:!0}),r.atomLongtapEvent=o;var i=t("../../chem/struct"),a=t("../shared/utils"),s=function(t){return t&&t.__esModule?t:{default:t}}(a),u=t("../actions/atom"),l=t("../actions/bond");n.prototype.mousedown=function(t){this.editor.hover(null),this.editor.selection(null);var e=this.editor.findItem(t,["atoms"]);e?"atoms"===e.map&&(this.dragCtx={item:e}):this.dragCtx={}},n.prototype.mousemove=function(t){var e=this.editor.render;if(!this.dragCtx||!this.dragCtx.item)return void this.editor.hover(this.editor.findItem(t,["atoms"]));var r=this.dragCtx,n=this.editor.findItem(t,["atoms"]);if(n&&"atoms"===n.map&&n.id===r.item.id)return void this.editor.hover(this.editor.findItem(t,["atoms"]));var o=e.ctab.molecule.atoms.get(r.item.id),i=s.default.calcAngle(o.pp,e.page2obj(t));t.ctrlKey||(i=s.default.fracAngle(i));var a=s.default.degrees(i);this.editor.event.message.dispatch({info:a+"º"});var u=s.default.calcNewAtomPos(o.pp,e.page2obj(t),t.ctrlKey);r.action&&r.action.perform(e.ctab),r.action=(0,l.fromBondAddition)(e.ctab,this.bondProps,r.item.id,Object.assign({},this.atomProps),u,u)[0],this.editor.update(r.action,!0)},n.prototype.mouseup=function(t){if(this.dragCtx){var e=this.dragCtx,r=this.editor.render;this.editor.update(e.action||(e.item?(0,u.fromAtomsAttrs)(r.ctab,e.item.id,this.atomProps,!0):(0,u.fromAtomAddition)(r.ctab,r.page2obj(t),this.atomProps))),delete this.dragCtx}this.editor.event.message.dispatch({info:!1})},r.default=n},{"../../chem/struct":542,"../actions/atom":547,"../actions/bond":549,"../shared/utils":566}],569:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this.attach=e||{atomid:0,bondid:0},this.editor=t,this.editor.selection({atoms:[this.attach.atomid],bonds:[this.attach.bondid]})}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../../chem/element"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.prototype.mousemove=function(t){var e=this.editor.render,r=this.editor.findItem(t,["atoms","bonds"]),n=e.ctab.molecule;return r&&("atoms"===r.map&&i.default.map[n.atoms.get(r.id).label]||"bonds"===r.map)?this.editor.hover(r):this.editor.hover(null),!0},n.prototype.click=function(t){var e=this.editor,r=e.render,n=r.ctab.molecule,o=e.findItem(t,["atoms","bonds"]);return o&&("atoms"===o.map&&i.default.map[n.atoms.get(o.id).label]||"bonds"===o.map)&&("atoms"===o.map?this.attach.atomid=o.id:this.attach.bondid=o.id,this.editor.selection({atoms:[this.attach.atomid],bonds:[this.attach.bondid]}),this.editor.event.attachEdit.dispatch(this.attach)),!0},r.default=n},{"../../chem/element":525}],570:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(this instanceof o)){if(!t.selection()||!t.selection().bonds)return new o(t,e);var r=(0,c.fromBondsAttrs)(t.render.ctab,t.selection().bonds,e);return t.update(r),t.selection(null),null}this.editor=t,this.atomProps={label:"C"},this.bondProps=e}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/vec2"),a=n(i),s=t("../../chem/struct"),u=t("../shared/utils"),l=n(u),c=t("../actions/bond");o.prototype.mousedown=function(t){var e=this.editor.render;return this.editor.hover(null),this.editor.selection(null),this.dragCtx={xy0:e.page2obj(t),item:this.editor.findItem(t,["atoms","bonds"])},this.dragCtx.item||delete this.dragCtx.item,!0},o.prototype.mousemove=function(t){var e=this.editor,r=e.render;if("dragCtx"in this){var n=this.dragCtx,o=r.page2obj(t),i=l.default.calcAngle(n.xy0,o);t.ctrlKey||(i=l.default.fracAngle(i));var s=l.default.degrees(i);if(this.editor.event.message.dispatch({info:s+"º"}),!("item"in n)||"atoms"===n.item.map){"action"in n&&n.action.perform(r.ctab);var u=void 0,f=void 0,d=void 0,p=void 0;"item"in n&&"atoms"===n.item.map?(u=n.item.id,f=e.findItem(t,["atoms"],n.item)):(u=this.atomProps,d=n.xy0,f=e.findItem(t,["atoms"]));var h=Number.MAX_VALUE;if(f&&"atoms"===f.map)f=f.id;else{f=this.atomProps;var m=r.page2obj(t);if(h=a.default.dist(n.xy0,m),d)p=l.default.calcNewAtomPos(d,m,t.ctrlKey);else{var g=r.ctab.molecule.atoms.get(u);d=l.default.calcNewAtomPos(g.pp.get_xy0(),m,t.ctrlKey)}}return h>.3?n.action=(0,c.fromBondAddition)(r.ctab,this.bondProps,u,f,d,p)[0]:delete n.action,this.editor.update(n.action,!0),!0}}return this.editor.hover(this.editor.findItem(t,["atoms","bonds"])),!0},o.prototype.mouseup=function(t){if("dragCtx"in this){var e=this.dragCtx,r=this.editor.render,n=r.ctab.molecule;if("action"in e)this.editor.update(e.action);else if("item"in e){if("atoms"===e.item.map)this.editor.update((0,c.fromBondAddition)(r.ctab,this.bondProps,e.item.id)[0]);else if("bonds"===e.item.map){var o=Object.assign({},this.bondProps),i=n.bonds.get(e.item.id);this.editor.update((0,c.bondChangingAction)(r.ctab,e.item.id,i,o))}}else{var u=r.page2obj(t),l=new a.default(.5,0).rotate(this.bondProps.type===s.Bond.PATTERN.TYPE.SINGLE?-Math.PI/6:0),f=(0,c.fromBondAddition)(r.ctab,this.bondProps,{label:"C"},{label:"C"},a.default.diff(u,l),a.default.sum(u,l));this.editor.update(f[0])}delete this.dragCtx}return this.editor.event.message.dispatch({info:!1}),!0},r.default=o},{"../../chem/struct":542,"../../util/vec2":691,"../actions/bond":549,"../shared/utils":566}],571:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(!(this instanceof o))return new o(t);this.editor=t,this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r)
  ;throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=t("../../util/vec2"),s=n(a),u=t("../../chem/struct"),l=t("../shared/utils"),c=n(l),f=t("./atom"),d=t("../actions/bond"),p=t("../actions/chain"),h=t("../actions/closely-fusing");o.prototype.mousedown=function(t){var e=this.editor.render,r=this.editor.findItem(t,["atoms","bonds"]);return this.editor.hover(null),this.dragCtx={xy0:e.page2obj(t),item:r},r&&"atoms"===r.map&&(this.editor.selection({atoms:[r.id]}),(0,f.atomLongtapEvent)(this,e)),this.dragCtx.item||delete this.dragCtx.item,!0},o.prototype.mousemove=function(t){var e=this.editor,r=e.render.ctab,n=this.dragCtx;if(e.hover(this.editor.findItem(t,["atoms","bonds"])),!n)return!0;if(n&&n.stopTapping&&n.stopTapping(),e.selection(null),!n.item||"atoms"===n.item.map){n.action&&n.action.perform(r);var o=r.molecule.atoms,a=n.item?o.get(n.item.id).pp:n.xy0,u=e.render.page2obj(t),l=Math.ceil(s.default.diff(u,a).length()),f=t.ctrlKey?c.default.calcAngle(a,u):c.default.fracAngle(a,u),d=(0,p.fromChain)(r,a,f,l,n.item?n.item.id:null),m=i(d,2),g=m[0],v=m[1];return e.event.message.dispatch({info:l+" sectors"}),n.action=g,e.update(n.action,!0),n.mergeItems=(0,h.getItemsToFuse)(e,v),e.hover((0,h.getHoverToFuse)(n.mergeItems)),!0}return!0},o.prototype.mouseup=function(){var t=this.dragCtx;if(!t)return!0;delete this.dragCtx;var e=this.editor,r=e.render.ctab,n=r.molecule;if(t.stopTapping&&t.stopTapping(),!t.action&&t.item&&"bonds"===t.item.map){var o=n.bonds.get(t.item.id);t.action=(0,d.bondChangingAction)(r,t.item.id,o,{type:u.Bond.PATTERN.TYPE.SINGLE,stereo:u.Bond.PATTERN.STEREO.NONE})}else t.action=t.action?(0,h.fromItemsFuse)(r,t.mergeItems).mergeWith(t.action):(0,h.fromItemsFuse)(r,t.mergeItems);return e.selection(null),e.hover(null),t.action&&e.update(t.action),e.event.message.dispatch({info:!1}),!0},o.prototype.cancel=o.prototype.mouseup,o.prototype.mouseleave=o.prototype.mouseup,r.default=o},{"../../chem/struct":542,"../../util/vec2":691,"../actions/bond":549,"../actions/chain":550,"../actions/closely-fusing":552,"../shared/utils":566,"./atom":568}],572:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this.editor=t,this.editor.selection(null),this.charge=e}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../../chem/element"),i=function(t){return t&&t.__esModule?t:{default:t}}(o),a=t("../actions/atom");n.prototype.mousemove=function(t){var e=this.editor.render,r=this.editor.findItem(t,["atoms"]),n=e.ctab.molecule;return r&&"atoms"===r.map&&i.default.map[n.atoms.get(r.id).label]?this.editor.hover(r):this.editor.hover(null),!0},n.prototype.click=function(t){var e=this.editor,r=e.render,n=r.ctab.molecule,o=e.findItem(t,["atoms"]);return o&&"atoms"===o.map&&i.default.map[n.atoms.get(o.id).label]&&(this.editor.hover(null),this.editor.update((0,a.fromAtomsAttrs)(r.ctab,o.id,{charge:n.atoms.get(o.id).charge+this.charge}))),!0},r.default=n},{"../../chem/element":525,"../actions/atom":547}],573:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n)){this.editor=t;var e=this.editor.render,r=null;r=!1===e.ctab.molecule.isChiral?(0,o.fromChiralFlagAddition)(e.ctab):(0,o.fromChiralFlagDeletion)(e.ctab),this.editor.update(r)}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../actions/chiral-flag");r.default=n},{"../actions/chiral-flag":551}],574:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n)){if(!t.selection())return new n(t,e);var r=(0,a.fromFragmentDeletion)(t.render.ctab,t.selection());return t.update(r),t.selection(null),null}this.editor=t,this.maps=["atoms","bonds","rxnArrows","rxnPluses","sgroups","sgroupData","chiralFlags"],this.lassoHelper=new i.default(e||0,t)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./helper/lasso"),i=function(t){return t&&t.__esModule?t:{default:t}}(o),a=t("../actions/fragment"),s=t("../actions/atom"),u=t("../actions/bond"),l=t("../actions/reaction"),c=t("../actions/sgroup"),f=t("../actions/chiral-flag");n.prototype.mousedown=function(t){this.editor.findItem(t,this.maps)||this.lassoHelper.begin(t)},n.prototype.mousemove=function(t){this.lassoHelper.running()?this.editor.selection(this.lassoHelper.addPoint(t)):this.editor.hover(this.editor.findItem(t,this.maps))},n.prototype.mouseup=function(t){var e=this.editor.render;this.lassoHelper.running()&&(this.editor.update((0,a.fromFragmentDeletion)(e.ctab,this.lassoHelper.end(t))),this.editor.selection(null))},n.prototype.click=function(t){var e=this.editor.render.ctab,r=this.editor.findItem(t,this.maps);if(r){if(this.editor.hover(null),"atoms"===r.map)this.editor.update((0,s.fromAtomDeletion)(e,r.id));else if("bonds"===r.map)this.editor.update((0,u.fromBondDeletion)(e,r.id));else if("sgroups"===r.map||"sgroupData"===r.map)this.editor.update((0,c.fromSgroupDeletion)(e,r.id));else if("rxnArrows"===r.map)this.editor.update((0,l.fromArrowDeletion)(e,r.id));else if("rxnPluses"===r.map)this.editor.update((0,l.fromPlusDeletion)(e,r.id));else{if("chiralFlags"!==r.map)return void console.error("EraserTool: unable to delete the object "+r.map+"["+r.id+"]");this.editor.update((0,f.fromChiralFlagDeletion)(e))}this.editor.selection(null)}},n.prototype.mouseleave=n.prototype.mouseup,n.prototype.cancel=function(){this.lassoHelper.running()&&this.lassoHelper.end(),this.editor.selection(null)},r.default=n},{"../actions/atom":547,"../actions/bond":549,"../actions/chiral-flag":551,"../actions/fragment":553,"../actions/reaction":555,"../actions/sgroup":558,"./helper/lasso":575}],575:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){this.mode=t,this.fragment=r,this.editor=e}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./locate"),a=n(i),s=t("../../../render/draw"),u=n(s),l=t("../../../util/scale"),c=n(l);o.prototype.getSelection=function(){var t=this.editor.render;if(0===this.mode)return a.default.inPolygon(t.ctab,this.points);if(1===this.mode)return a.default.inRectangle(t.ctab,this.points[0],this.points[1]);throw new Error("Selector mode unknown")},o.prototype.begin=function(t){var e=this.editor.render;this.points=[e.page2obj(t)],1===this.mode&&this.points.push(this.points[0])},o.prototype.running=function(){return!!this.points},o.prototype.addPoint=function(t){if(!this.points)return null;var e=this.editor.render;return 0===this.mode?this.points.push(e.page2obj(t)):1===this.mode&&(this.points=[this.points[0],e.page2obj(t)]),this.update(),this.getSelection()},o.prototype.update=function(){if(this.selection&&(this.selection.remove(),this.selection=null),this.points&&this.points.length>1){var t=this.editor.render,e=this.points.map(function(e){return c.default.obj2scaled(e,t.options).add(t.options.offset)});this.selection=0===this.mode?u.default.selectionPolygon(t.paper,e,t.options):u.default.selectionRectangle(t.paper,e[0],e[1],t.options)}},o.prototype.end=function(){var t=this.getSelection();return this.points=null,this.update(null),t},r.default=o},{"../../../render/draw":590,"../../../util/scale":690,"./locate":576}],576:[function(t,e,r){"use strict";function n(t,e,r){var n=[],o=[],i=Math.min(e.x,r.x),a=Math.max(e.x,r.x),u=Math.min(e.y,r.y),l=Math.max(e.y,r.y);t.bonds.forEach(function(e,r){var o=s.default.lc2(t.atoms.get(e.b.begin).a.pp,.5,t.atoms.get(e.b.end).a.pp,.5);o.x>i&&o.x<a&&o.y>u&&o.y<l&&n.push(r)}),t.atoms.forEach(function(t,e){t.a.pp.x>i&&t.a.pp.x<a&&t.a.pp.y>u&&t.a.pp.y<l&&o.push(e)});var c=[],f=[];t.rxnArrows.forEach(function(t,e){t.item.pp.x>i&&t.item.pp.x<a&&t.item.pp.y>u&&t.item.pp.y<l&&c.push(e)}),t.rxnPluses.forEach(function(t,e){t.item.pp.x>i&&t.item.pp.x<a&&t.item.pp.y>u&&t.item.pp.y<l&&f.push(e)});var d=[];t.chiralFlags.forEach(function(t,e){t.pp.x>i&&t.pp.x<a&&t.pp.y>u&&t.pp.y<l&&d.push(e)});var p=[];return t.sgroupData.forEach(function(t,e){t.sgroup.pp.x>i&&t.sgroup.pp.x<a&&t.sgroup.pp.y>u&&t.sgroup.pp.y<l&&p.push(e)}),{atoms:o,bonds:n,rxnArrows:c,rxnPluses:f,chiralFlags:d,sgroupData:p}}function o(t,e){for(var r=[],n=[],o=[],a=0;a<e.length;++a)o[a]=new s.default(e[a].x,e[a].y);t.bonds.forEach(function(e,n){var a=s.default.lc2(t.atoms.get(e.b.begin).a.pp,.5,t.atoms.get(e.b.end).a.pp,.5);i(o,a)&&r.push(n)}),t.atoms.forEach(function(t,e){i(o,t.a.pp)&&n.push(e)});var u=[],l=[];t.rxnArrows.forEach(function(t,e){i(o,t.item.pp)&&u.push(e)}),t.rxnPluses.forEach(function(t,e){i(o,t.item.pp)&&l.push(e)});var c=[];t.chiralFlags.forEach(function(t,e){i(o,t.pp)&&c.push(e)});var f=[];return t.sgroupData.forEach(function(t,e){i(o,t.sgroup.pp)&&f.push(e)}),{atoms:n,bonds:r,rxnArrows:u,rxnPluses:l,chiralFlags:c,sgroupData:f}}function i(t,e){for(var r=new s.default(0,1),n=r.rotate(Math.PI/2),o=s.default.diff(t[t.length-1],e),i=s.default.dot(n,o),a=s.default.dot(r,o),u=null,l=0,c=!1,f=!1,d=0;d<t.length;++d){var p=s.default.diff(t[d],e),h=s.default.diff(p,o),m=s.default.dot(n,p),g=s.default.dot(r,p);c=!1,m*i<0&&(g*a>-1e-5?a>-1e-5&&(c=!0):(Math.abs(i)*Math.abs(g)-Math.abs(m)*Math.abs(a))*g>0&&(c=!0)),c&&f&&s.default.dot(h,n)*s.default.dot(u,n)>=0&&(c=!1),c&&l++,o=p,i=m,a=g,u=h,f=c}return l%2!=0}Object.defineProperty(r,"__esModule",{value:!0});var a=t("../../../util/vec2"),s=function(t){return t&&t.__esModule?t:{default:t}}(a);r.default={inRectangle:n,inPolygon:o}},{"../../../util/vec2":691}],577:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./rgroupatom"),i=n(o),a=t("./select"),s=n(a),u=t("./sgroup"),l=n(u),c=t("./eraser"),f=n(c),d=t("./atom"),p=n(d),h=t("./bond"),m=n(h),g=t("./chain"),v=n(g),b=t("./chiral-flag"),y=n(b),_=t("./template"),x=n(_),w=t("./charge"),S=n(w),O=t("./rgroupfragment"),A=n(O),E=t("./apoint"),j=n(E),P=t("./attach"),T=n(P),C=t("./reactionarrow"),k=n(C),M=t("./reactionplus"),R=n(M),N=t("./reactionmap"),I=n(N),B=t("./reactionunmap"),L=n(B),D=t("./paste"),F=n(D),G=t("./rotate"),z=n(G);r.default={rgroupatom:i.default,select:s.default,sgroup:l.default,eraser:f.default,atom:p.default,bond:m.default,chain:v.default,chiralFlag:y.default,template:x.default,charge:S.default,rgroupfragment:A.default,apoint:j.default,attach:T.default,reactionarrow:k.default,reactionplus:R.default,reactionmap:I.default,reactionunmap:L.default,paste:F.default,rotate:z.default}},{"./apoint":567,"./atom":568,"./attach":569,"./bond":570,"./chain":571,"./charge":572,"./chiral-flag":573,"./eraser":574,"./paste":578,"./reactionarrow":579,"./reactionmap":580,"./reactionplus":581,"./reactionunmap":582,"./rgroupatom":583,"./rgroupfragment":584,"./rotate":585,"./select":586,"./sgroup":587,"./template":588}],578:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this.editor=t,this.editor.selection(null),this.struct=e;var r=t.render,s=t.lastEvent?r.page2obj(t.lastEvent):null,u=(0,i.fromPaste)(r.ctab,this.struct,s),l=o(u,2),c=l[0],f=l[1];this.action=c,this.editor.update(this.action,!0),this.mergeItems=(0,a.getItemsToFuse)(this.editor,f),this.editor.hover((0,a.getHoverToFuse)(this.mergeItems),this)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t("../actions/paste"),a=t("../actions/closely-fusing");n.prototype.mousemove=function(t){var e=this.editor.render;this.action&&this.action.perform(e.ctab);var r=(0,i.fromPaste)(e.ctab,this.struct,e.page2obj(t)),n=o(r,2),s=n[0],u=n[1];this.action=s,this.editor.update(this.action,!0),this.mergeItems=(0,a.getItemsToFuse)(this.editor,u),this.editor.hover((0,a.getHoverToFuse)(this.mergeItems))},n.prototype.mouseup=function(){var t=this.editor,e=t.render.ctab;if(t.selection(null),this.action=this.action?(0,a.fromItemsFuse)(e,this.mergeItems).mergeWith(this.action):(0,a.fromItemsFuse)(e,this.mergeItems),t.hover(null),this.action){var r=this.action;delete this.action,this.editor.update(r)}},n.prototype.cancel=function(){var t=this.editor.render;this.editor.hover(null),this.action&&(this.action.perform(t.ctab),delete this.action,t.update())},n.prototype.mouseleave=n.prototype.cancel,r.default=n},{"../actions/closely-fusing":552,"../actions/paste":554}],579:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.editor=t,this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../shared/action"),i=function(t){return t&&t.__esModule?t:{default:t}}(o),a=t("../actions/reaction"),s=t("../actions/fragment");n.prototype.mousedown=function(t){var e=this.editor.render,r=this.editor.findItem(t,["rxnArrows"]);r&&"rxnArrows"===r.map&&(this.editor.hover(null),this.editor.selection({rxnArrows:[r.id]}),this.dragCtx={xy0:e.page2obj(t),action:new i.default})},n.prototype.mousemove=function(t){var e=this.editor.render;"dragCtx"in this?(this.dragCtx.action&&this.dragCtx.action.perform(e.ctab),this.dragCtx.action=(0,s.fromMultipleMove)(e.ctab,this.editor.selection()||{},e.page2obj(t).sub(this.dragCtx.xy0)),this.editor.update(this.dragCtx.action,!0)):this.editor.hover(this.editor.findItem(t,["rxnArrows"]))},n.prototype.mouseup=function(){this.dragCtx&&(this.editor.update(this.dragCtx.action),delete this.dragCtx)},n.prototype.click=function(t){var e=this.editor.render;e.ctab.molecule.rxnArrows.size<1&&this.editor.update((0,a.fromArrowAddition)(e.ctab,e.page2obj(t)))},r.default=n},{"../actions/fragment":553,"../actions/reaction":555,"../shared/action":562}],580:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(!(this instanceof o))return new o(t);this.editor=t,this.editor.selection(null)}function i(t,e,r){for(var n,o,i=0;(!n||!o)&&i<t.reactants.length;i++){var a=Array.from(t.reactants[i]);!n&&a.indexOf(e)>=0&&(n="r"),!o&&a.indexOf(r)>=0&&(o="r")}for(var s=0;(!n||!o)&&s<t.products.length;s++){var u=Array.from(t.products[s]);!n&&u.indexOf(e)>=0&&(n="p"),!o&&u.indexOf(r)>=0&&(o="p")}return n&&o&&n!==o}Object.defineProperty(r,"__esModule",{value:!0});var a=t("../../util/scale"),s=n(a),u=t("../shared/action"),l=n(u),c=t("../../render/draw"),f=n(c),d=t("../actions/atom");o.prototype.mousedown=function(t){var e=this.editor.render;this.rcs=e.ctab.molecule.getComponents();var r=this.editor.findItem(t,["atoms"]);r&&"atoms"===r.map&&(this.editor.hover(null),this.dragCtx={item:r,xy0:e.page2obj(t)})},o.prototype.mousemove=function(t){var e=this.editor.render;if("dragCtx"in this){var r=this.editor.findItem(t,["atoms"],this.dragCtx.item),n=e.ctab.molecule.atoms;r&&"atoms"===r.map&&i(this.rcs,this.dragCtx.item.id,r.id)?(this.editor.hover(r),this.updateLine(n.get(this.dragCtx.item.id).pp,n.get(r.id).pp)):(this.editor.hover(null),this.updateLine(n.get(this.dragCtx.item.id).pp,e.page2obj(t)))}else this.editor.hover(this.editor.findItem(t,["atoms"]))},o.prototype.updateLine=function(t,e){if(this.line&&(this.line.remove(),this.line=null),t&&e){var r=this.editor.render;this.line=f.default.selectionLine(r.paper,s.default.obj2scaled(t,r.options).add(r.options.offset),s.default.obj2scaled(e,r.options).add(r.options.offset),r.options)}},o.prototype.mouseup=function(t){var e=this;if("dragCtx"in this){var r=this.editor.render,n=this.editor.findItem(t,["atoms"],this.dragCtx.item);if(n&&"atoms"===n.map&&i(this.rcs,this.dragCtx.item.id,n.id)){var o=new l.default,a=r.ctab.molecule.atoms,s=a.get(this.dragCtx.item.id),u=a.get(n.id),c=s.aam,f=u.aam;if(!c||c!==f){if((c&&c!==f||!c&&f)&&a.forEach(function(t,n){n!==e.dragCtx.item.id&&(c&&t.aam===c||f&&t.aam===f)&&o.mergeWith((0,d.fromAtomsAttrs)(r.ctab,n,{aam:0}))}),c)o.mergeWith((0,d.fromAtomsAttrs)(r.ctab,n.id,{aam:c}));else{var p=0;a.forEach(function(t){p=Math.max(p,t.aam||0)}),o.mergeWith((0,d.fromAtomsAttrs)(r.ctab,this.dragCtx.item.id,{aam:p+1})),o.mergeWith((0,d.fromAtomsAttrs)(r.ctab,n.id,{aam:p+1}))}this.editor.update(o)}}this.updateLine(null),delete this.dragCtx}this.editor.hover(null)},r.default=o},{"../../render/draw":590,"../../util/scale":690,"../actions/atom":547,"../shared/action":562}],581:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.editor=t,this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../actions/reaction"),i=t("../actions/fragment");n.prototype.mousedown=function(t){var e=this.editor.render,r=this.editor.findItem(t,["rxnPluses"]);r&&"rxnPluses"===r.map&&(this.editor.hover(null),this.editor.selection({rxnPluses:[r.id]}),this.dragCtx={xy0:e.page2obj(t)})},n.prototype.mousemove=function(t){var e=this.editor.render;"dragCtx"in this?(this.dragCtx.action&&this.dragCtx.action.perform(e.ctab),this.dragCtx.action=(0,i.fromMultipleMove)(e.ctab,this.editor.selection()||{},e.page2obj(t).sub(this.dragCtx.xy0)),this.editor.update(this.dragCtx.action,!0)):this.editor.hover(this.editor.findItem(t,["rxnPluses"]))},n.prototype.mouseup=function(){this.dragCtx&&(this.editor.update(this.dragCtx.action),delete this.dragCtx)},n.prototype.click=function(t){var e=this.editor.render;this.editor.update((0,o.fromPlusAddition)(e.ctab,e.page2obj(t)))},r.default=n},{"../actions/fragment":553,"../actions/reaction":555}],582:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.editor=t,this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../shared/action"),i=function(t){return t&&t.__esModule?t:{default:t}}(o),a=t("../actions/atom");n.prototype.mousemove=function(t){var e=this.editor.findItem(t,["atoms"]);e&&"atoms"===e.map?this.editor.hover(this.editor.render.ctab.molecule.atoms.get(e.id).aam?e:null):this.editor.hover(null)},n.prototype.mouseup=function(t){var e=this,r=this.editor.findItem(t,["atoms"]),n=this.editor.render.ctab.molecule.atoms;if(r&&"atoms"===r.map&&n.get(r.id).aam){var o=new i.default,s=n.get(r.id).aam;n.forEach(function(t,r){t.aam===s&&o.mergeWith((0,a.fromAtomsAttrs)(e.editor.render.ctab,r,{aam:0}))}),this.editor.update(o)}this.editor.hover(null)},r.default=n},{"../actions/atom":547,"../shared/action":562}],583:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return t.selection(null),new n(t);this.editor=t}function o(t,e,r){var n=t.render.ctab.molecule,o=e||0===e?n.atoms.get(e):null,s=o?o.rglabel:0,u=o?o.label:"R#",l=t.event.elementEdit.dispatch({label:"R#",rglabel:s,fragId:o?o.fragment:null});Promise.resolve(l).then(function(n){n=Object.assign({},i.Atom.attrlist,n),!e&&0!==e&&n.rglabel?t.update((0,a.fromAtomAddition)(t.render.ctab,r,n)):s!==n.rglabel&&(n.aam=o.aam,n.attpnt=o.attpnt,n.rglabel||"R#"===u||(n.label=u),t.update((0,a.fromAtomsAttrs)(t.render.ctab,e,n)))}).catch(function(){return null})}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../chem/struct"),a=t("../actions/atom");n.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["atoms"]))},n.prototype.click=function(t){var e=this.editor.render,r=this.editor.findItem(t,["atoms"]);return r?"atoms"!==r.map||(this.editor.hover(null),o(this.editor,r.id),!0):(this.editor.hover(null),o(this.editor,null,e.page2obj(t)),!0)},r.default=n},{"../../chem/struct":542,"../actions/atom":547}],584:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return t.selection(null),new n(t);this.editor=t}Object.defineProperty(r,"__esModule",{value:!0});var o=t("../../chem/struct"),i=t("../actions/rgroup");n.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["frags","rgroups"]))},n.prototype.click=function(t){var e=this.editor,r=e.render.ctab.molecule,n=e.findItem(t,["frags","rgroups"]);if(!n)return!0;this.editor.hover(null);var a="rgroups"===n.map?n.id:o.RGroup.findRGroupByFragment(r.rgroups,n.id),s=Object.assign({label:a},"frags"===n.map?{fragId:n.id}:r.rgroups.get(n.id)),u=e.event.rgroupEdit.dispatch(s);return Promise.resolve(u).then(function(t){var r=e.render.ctab,a=null;if("rgroups"!==n.map){var s=o.RGroup.findRGroupByFragment(r.molecule.rgroups,n.id);a=(0,i.fromRGroupFragment)(r,t.label,n.id).mergeWith((0,i.fromUpdateIfThen)(r,t.label,s))}else a=(0,i.fromRGroupAttrs)(r,n.id,t);e.update(a)}).catch(function(){return null}),!0},n.prototype.cancel=function(){this.editor.hover(null)},r.default=n},{"../../chem/struct":542,"../actions/rgroup":556}],585:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(this instanceof o)){if(!e)return new o(t);var r=t.render.ctab,n=t.selection(),i=n&&n.bonds&&1===Object.keys(n).length&&1===n.bonds.length,a=i?(0,l.fromBondAlign)(r,n.bonds[0],e):(0,l.fromFlip)(r,n,e);return t.update(a),null}this.editor=t,t.selection()&&t.selection().atoms||this.editor.selection(null)}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/vec2"),a=n(i),s=t("../shared/utils"),u=n(s),l=t("../actions/rotate"),c=t("../actions/closely-fusing");o.prototype.mousedown=function(t){var e=new a.default,r=this.editor.selection(),n=this.editor.render,o=n.ctab.molecule;if(r&&r.atoms){console.assert(r.atoms.length>0);var i=null,s=!1;r.atoms.forEach(function(t){var n=o.atoms.get(t);e.add_(n.pp),s||n.neighbors.find(function(e){var n=o.halfBonds.get(e);if(-1===r.atoms.indexOf(n.end)){if(n.loop>=0){if(!o.atoms.get(t).neighbors.find(function(t){var e=o.halfBonds.get(t);return e.loop>=0&&-1!==r.atoms.indexOf(e.end)}))return s=!0,!0}if(null==i)i=t;else if(i!==t)return s=!0,!0}return!1})}),e=s||null===i?e.scaled(1/r.atoms.length):o.atoms.get(i).pp}else o.atoms.forEach(function(t){e.add_(t.pp)}),e=e.scaled(1/o.atoms.size);return this.dragCtx={xy0:e,angle1:u.default.calcAngle(e,n.page2obj(t))},!0},o.prototype.mousemove=function(t){if(!this.dragCtx)return!0;var e=this.editor.render,r=this.dragCtx,n=e.page2obj(t),o=u.default.calcAngle(r.xy0,n)-r.angle1;t.ctrlKey||(o=u.default.fracAngle(o));var i=u.default.degrees(o);if("angle"in r&&r.angle===i)return!0;"action"in r&&r.action.perform(e.ctab),r.angle=i,r.action=(0,l.fromRotate)(e.ctab,this.editor.selection(),r.xy0,o),this.editor.event.message.dispatch({info:i+"º"});var a=this.editor.explicitSelected();return r.mergeItems=(0,c.getItemsToFuse)(this.editor,a),this.editor.hover((0,c.getHoverToFuse)(r.mergeItems)),this.editor.update(r.action,!0),!0},o.prototype.mouseup=function(){if(!this.dragCtx)return!0;var t=this.dragCtx,e=this.editor.render.ctab,r=t.action?(0,c.fromItemsFuse)(e,t.mergeItems).mergeWith(t.action):(0,c.fromItemsFuse)(e,t.mergeItems);return delete this.dragCtx,this.editor.update(r),this.editor.hover(null),t.mergeItems&&this.editor.selection(null),this.editor.event.message.dispatch({info:!1}),!0},o.prototype.cancel=o.prototype.mouseup,o.prototype.mouseleave=o.prototype.mouseup,r.default=o},{"../../util/vec2":691,"../actions/closely-fusing":552,"../actions/rotate":557,"../shared/utils":566}],586:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(this instanceof o))return new o(t,e);this.editor=t,this.lassoHelper=new p.default("lasso"===e?0:1,t,"fragment"===e)}function i(t){var e={};return e[t.map]=[t.id],e}function a(t,e,r){return e&&Object.keys(e).forEach(function(n){t[n]?t[n]=u(t[n],e[n],r):t[n]=e[n].slice()}),t}function s(t,e){return t&&t[e.map]&&t[e.map].includes(e.id)}function u(t,e,r){return e.reduce(function(e,n){return r?t=(0,c.default)(t,[n]):t.includes(n)||t.push(n),t},[])}Object.defineProperty(r,"__esModule",{value:!0});var l=t("lodash/fp/xor"),c=n(l),f=t("../../chem/struct"),d=t("./helper/lasso"),p=n(d),h=t("./sgroup"),m=t("./atom"),g=t("../actions/fragment"),v=t("../actions/atom"),b=t("../actions/bond"),y=t("../actions/closely-fusing"),_=t("../shared/utils"),x=n(_);o.prototype.mousedown=function(t){var e=this.editor.render,r=e.ctab,n=r.molecule;this.editor.hover(null);var o=this.lassoHelper.fragment||t.ctrlKey,u=this.editor.findItem(t,o?["frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]:["atoms","bonds","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]);if(this.dragCtx={item:u,xy0:e.page2obj(t)},u&&"atoms"!==u.map||(0,m.atomLongtapEvent)(this,e),!u)return delete this.dragCtx.item,this.lassoHelper.fragment||this.lassoHelper.begin(t),!0;var l=i(u),c=this.editor.selection();if("frags"===u.map){var d=r.frags.get(u.id);l={atoms:d.fragGetAtoms(r,u.id),bonds:d.fragGetBonds(r,u.id)}}else if("sgroups"===u.map){var p=r.sgroups.get(u.id).item;l={atoms:f.SGroup.getAtoms(n,p),bonds:f.SGroup.getBonds(n,p)}}else if("rgroups"===u.map){var h=r.rgroups.get(u.id);l={atoms:h.getAtoms(e),bonds:h.getBonds(e)}}else if("sgroupData"===u.map&&s(c,u))return!0;return t.shiftKey?this.editor.selection(a(l,c,!0)):this.editor.selection(s(c,u)?c:l),!0},o.prototype.mousemove=function(t){var e=this.editor,r=e.render,n=e.render.ctab,o=this.dragCtx;if(o&&o.stopTapping&&o.stopTapping(),o&&o.item){var i=n.molecule.atoms,s=e.selection();if("atoms"===o.item.map&&1===i.get(o.item.id).neighbors.length&&1===s.atoms.length&&!s.bonds){var u=r.page2obj(t),l=x.default.calcAngle(o.xy0,u),c=x.default.degrees(l);this.editor.event.message.dispatch({info:c+"º"})}o.action&&(o.action.perform(n),e.update(o.action,!0));var f=e.explicitSelected();return o.action=(0,g.fromMultipleMove)(n,f,e.render.page2obj(t).sub(o.xy0)),o.mergeItems=(0,y.getItemsToFuse)(e,f),e.hover((0,y.getHoverToFuse)(o.mergeItems)),e.update(o.action,!0),!0}if(this.lassoHelper.running()){var d=this.lassoHelper.addPoint(t);return e.selection(t.shiftKey?a(d,e.selection(),!1):d),!0}var p=this.lassoHelper.fragment||t.ctrlKey?["frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]:["atoms","bonds","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"];return e.hover(e.findItem(t,p)),!0},o.prototype.mouseup=function(t){var e=this.editor,r=e.render.ctab,n=this.dragCtx;if(n&&n.stopTapping&&n.stopTapping(),n&&n.item)n.action=n.action?(0,y.fromItemsFuse)(r,n.mergeItems).mergeWith(n.action):(0,y.fromItemsFuse)(r,n.mergeItems),e.hover(null),n.mergeItems&&e.selection(null),0!==n.action.operations.length&&e.update(n.action),delete this.dragCtx;else if(this.lassoHelper.running()){var o=this.lassoHelper.end();e.selection(t.shiftKey?a(o,e.selection()):o)}else this.lassoHelper.fragment&&(t.shiftKey||e.selection(null));return this.editor.event.message.dispatch({info:!1}),!0},o.prototype.dblclick=function(t){var e=this.editor,r=this.editor.render,n=this.editor.findItem(t,["atoms","bonds","sgroups","sgroupData"]);if(!n)return!0;var o=r.ctab.molecule;if("atoms"===n.map){this.editor.selection(i(n));var a=o.atoms.get(n.id),s=e.event.elementEdit.dispatch(a);Promise.resolve(s).then(function(t){e.update((0,v.fromAtomsAttrs)(r.ctab,n.id,t))}).catch(function(){return null})}else if("bonds"===n.map){this.editor.selection(i(n));var u=r.ctab.bonds.get(n.id).b,l=e.event.bondEdit.dispatch(u);Promise.resolve(l).then(function(t){e.update((0,b.fromBondsAttrs)(r.ctab,n.id,t))}).catch(function(){return null})}else"sgroups"!==n.map&&"sgroupData"!==n.map||(this.editor.selection(i(n)),(0,h.sgroupDialog)(this.editor,n.id));return!0},o.prototype.cancel=function(){if(this.dragCtx&&this.dragCtx.stopTapping&&this.dragCtx.stopTapping(),this.dragCtx&&this.dragCtx.action){var t=this.dragCtx.action;this.editor.update(t)}this.lassoHelper.running()&&this.editor.selection(this.lassoHelper.end()),delete this.dragCtx,this.editor.hover(null)},o.prototype.mouseleave=o.prototype.cancel,r.default=o},{"../../chem/struct":542,"../actions/atom":547,"../actions/bond":549,"../actions/closely-fusing":552,"../actions/fragment":553,"../shared/utils":566,"./atom":568,"./helper/lasso":575,"./sgroup":587,"lodash/fp/xor":443}],587:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(this instanceof o)){var r=t.selection()||{};if(!r.atoms&&!r.bonds)return new o(t,e);var n=t.render.ctab.molecule.sgroups,a=t.selection().atoms,s=n.find(function(t,e){return(0,m.default)(e.atoms,a)});return i(t,void 0!==s?s:null,e),null}this.editor=t,this.type=e,this.lassoHelper=new x.default(1,t),this.editor.selection(null)}function i(t,e,r){var n=t.render.ctab,o=n.molecule,i=t.selection()||{},l=null!==e?o.sgroups.get(e):null,c=l?l.type:r,f="DAT"===c?"sdataEdit":"sgroupEdit";if(!i.atoms&&!i.bonds&&!l)return void console.info("There is no selection or sgroup");var d=null;l?(d=l.getAttrs(),d.context=a(n,l.atoms)):d={context:s(n,i)};var h=t.event[f].dispatch({type:c,attrs:d});Promise.resolve(h).then(function(r){if("DAT"!==r.type&&p(o,i.atoms||[]))t.event.message.dispatch({error:"Partial S-group overlapping is not allowed."});else{if(!(l||"DAT"===r.type||i.atoms&&0!==i.atoms.length))return;if(l&&l.getAttrs().context===r.attrs.context){var a=(0,w.fromSeveralSgroupAddition)(n,r.type,l.atoms,r.attrs).mergeWith((0,w.fromSgroupDeletion)(n,e));return t.update(a),void t.selection(i)}var s=u(e,t,r,i);t.update(s.action),t.selection(s.selection)}}).catch(function(){return null})}function a(t,e){var r=t.molecule;if(1===e.length)return g.SgContexts.Atom;if(f(t,e))return g.SgContexts.Multifragment;if(c(t,e))return g.SgContexts.Fragment;var n=new b.default(e);return l(Array.from(r.bonds.values()).filter(function(t){return n.has(t.begin)&&n.has(t.end)}))?g.SgContexts.Group:g.SgContexts.Bond}function s(t,e){var r=t.molecule;if(e.atoms&&!e.bonds)return g.SgContexts.Atom;var n=e.bonds.map(function(t){return r.bonds.get(t)});if(!l(n))return g.SgContexts.Bond;e.atoms=e.atoms||[];var o=new b.default(e.atoms),i=n.every(function(t){return o.has(t.begin)&&o.has(t.end)});return c(t,e.atoms)&&i?g.SgContexts.Fragment:f(t,e.atoms)?g.SgContexts.Multifragment:g.SgContexts.Group}function u(t,e,r,n){var o=e.render.ctab,i=o.molecule.sgroups.get(t),a=i&&i.atoms||n.atoms||[],s=r.attrs.context,u=(0,w.fromSgroupAction)(s,o,r,a,n);return u.selection=u.selection||n,null!==t&&void 0!==t&&(u.action=u.action.mergeWith((0,w.fromSgroupDeletion)(o,t))),e.selection(u.selection),u}function l(t){if(0===t.length)return!0;for(var e=0;e<t.length;++e)for(var r=t[e],n=0;n<t.length;++n)if(e!==n){var o=t[n];if(r.end===o.begin||r.end===o.end)return!0}return!1}function c(t,e){return 1===d(t,e)}function f(t,e){return d(t,e)>1}function d(t,e){var r=new b.default(e);return Array.from(t.connectedComponents.values()).reduce(function(t,e){return t+(r.isSuperset(e)?1:0)},0)}function p(t,e){var r=e.reduce(function(e,r){var n=t.atoms.get(r);return e.union(n.sgs)},new b.default);return Array.from(r).some(function(r){var n=t.sgroups.get(r);if("DAT"===n.type)return!1;var o=y.SGroup.getAtoms(t,n);return o.length<e.length?o.findIndex(function(t){return-1===e.indexOf(t)})>=0:e.findIndex(function(t){return-1===o.indexOf(t)})>=0})}Object.defineProperty(r,"__esModule",{value:!0}),r.sgroupDialog=i;var h=t("lodash/fp/isEqual"),m=n(h),g=t("../shared/constants"),v=t("../../util/pile"),b=n(v),y=t("../../chem/struct"),_=t("./helper/lasso"),x=n(_),w=t("../actions/sgroup"),S=["atoms","bonds","sgroups","sgroupData"];o.prototype.mousedown=function(t){this.editor.findItem(t,S)||this.lassoHelper.begin(t)},o.prototype.mousemove=function(t){this.lassoHelper.running(t)?this.editor.selection(this.lassoHelper.addPoint(t)):this.editor.hover(this.editor.findItem(t,S))},o.prototype.mouseleave=function(t){this.lassoHelper.running(t)&&this.lassoHelper.end(t)},o.prototype.mouseup=function(t){var e=null,r=null;if(this.lassoHelper.running(t))r=this.lassoHelper.end(t);else{var n=this.editor.findItem(t,S);if(!n)return;if(this.editor.hover(null),"atoms"===n.map)r={atoms:[n.id]};else if("bonds"===n.map){var o=this.editor.render.ctab.bonds.get(n.id);r={atoms:[o.b.begin,o.b.end]}}else{if("sgroups"!==n.map&&"sgroupData"!==n.map)return;e=n.id}}(null!==e||r&&r.atoms)&&i(this.editor,e,this.type)},o.prototype.cancel=function(){this.lassoHelper.running()&&this.lassoHelper.end(),
  this.editor.selection(null)},r.default=o},{"../../chem/struct":542,"../../util/pile":688,"../actions/sgroup":558,"../shared/constants":564,"./helper/lasso":575,"lodash/fp/isEqual":433}],588:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(this instanceof o))return new o(t,e);this.editor=t,this.editor.selection(null),this.template={aid:parseInt(e.aid)||0,bid:parseInt(e.bid)||0};var r=e.struct;r.rescale();var n=new u.default;r.atoms.forEach(function(t){n.add_(t.pp)}),this.template.molecule=r,this.findItems=[],this.template.xy0=n.scaled(1/(r.atoms.size||1));var a=r.atoms.get(this.template.aid);a&&(this.template.angle0=c.default.calcAngle(a.pp,this.template.xy0),this.findItems.push("atoms"));var s=r.bonds.get(this.template.bid);s&&(this.template.sign=i(r,s,this.template.xy0),this.findItems.push("bonds"))}function i(t,e,r){var n=t.atoms.get(e.begin).pp,o=t.atoms.get(e.end).pp,i=u.default.cross(u.default.diff(n,o),u.default.diff(r,o));return i>0?1:i<0?-1:0}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=t("../../util/vec2"),u=n(s),l=t("../shared/utils"),c=n(l),f=t("../actions/template"),d=t("../actions/closely-fusing");o.prototype.mousedown=function(t){var e=this.editor,r=e.render.ctab;this.editor.hover(null),this.dragCtx={xy0:e.render.page2obj(t),item:e.findItem(t,this.findItems)};var n=this.dragCtx,o=n.item;if(!o)return delete n.item,!0;if("bonds"===o.map){var a=r.molecule,s=new u.default,l=a.bonds.get(o.id),c=a.atoms.get(l.begin).fragment,f=a.getFragmentIds(c),d=0,p=a.halfBonds.get(l.hb1).loop;if(p<0&&(p=a.halfBonds.get(l.hb2).loop),p>=0){a.loops.get(p).hbs.forEach(function(t){s.add_(a.atoms.get(a.halfBonds.get(t).begin).pp),d++})}else f.forEach(function(t){s.add_(a.atoms.get(t).pp),d++});n.v0=s.scaled(1/d);var h=i(a,l,n.v0);n.sign1=h||1,n.sign2=this.template.sign}return!0},o.prototype.mousemove=function(t){var e=this.editor.render.ctab;if(!this.dragCtx)return this.editor.hover(this.editor.findItem(t,this.findItems)),!0;var r=this.dragCtx,n=r.item,o=null,s=this.editor.render.page2obj(t),l=e.molecule;if(n&&"bonds"===n.map){var p=l.bonds.get(n.id),h=i(l,p,s);if(r.sign1*this.template.sign>0&&(h=-h),h!==r.sign2||!r.action){r.action&&r.action.perform(e),r.sign2=h;var m=(0,f.fromTemplateOnBondAction)(e,this.template,n.id,this.editor.event,r.sign1*r.sign2>0,!1),g=a(m,2);_=g[0],x=g[1],r.action=_,this.editor.update(r.action,!0),r.mergeItems=(0,d.getItemsToFuse)(this.editor,x),this.editor.hover((0,d.getHoverToFuse)(r.mergeItems))}return!0}var v=null;n?"atoms"===n.map&&(o=l.atoms.get(n.id).pp,v=u.default.dist(o,s)>1):o=r.xy0;var b=c.default.calcAngle(o,s);t.ctrlKey||(b=c.default.fracAngle(b));var y=c.default.degrees(b);if(this.editor.event.message.dispatch({info:y+"º"}),r.hasOwnProperty("angle")&&r.angle===y&&(!r.hasOwnProperty("extra_bond")||r.extra_bond===v))return!0;r.action&&r.action.perform(e),r.angle=y;var _=null,x=void 0;if(n){if("atoms"===n.map){var w=(0,f.fromTemplateOnAtom)(e,this.template,n.id,b,v),S=a(w,2);_=S[0],x=S[1],r.extra_bond=v}}else{var O=(0,f.fromTemplateOnCanvas)(e,this.template,o,b),A=a(O,2);_=A[0],x=A[1]}return r.action=_,this.editor.update(r.action,!0),r.mergeItems=(0,d.getItemsToFuse)(this.editor,x),this.editor.hover((0,d.getHoverToFuse)(r.mergeItems)),!0},o.prototype.mouseup=function(t){var e=this,r=this.dragCtx;if(!r)return!0;delete this.dragCtx;var n=this.editor.render.ctab,o=n.molecule,i=r.item;if(r.action&&i&&"bonds"===i.map)return r.action.perform(n),(0,f.fromTemplateOnBondAction)(n,this.template,i.id,this.editor.event,r.sign1*r.sign2>0,!0).then(function(t){var r=a(t,2),o=r[0],i=r[1],s=(0,d.getItemsToFuse)(e.editor,i);o=(0,d.fromItemsFuse)(n,s).mergeWith(o),e.editor.update(o)}),!0;var s=void 0,u=null;if(!r.action)if(i){if("atoms"===i.map){var l=n.atoms.get(i.id).a.neighbors.length,p=void 0,h=void 0;if(l>1)p=null,h=!0;else if(1===l){var m=o.atoms.get(i.id),g=o.halfBonds.get(m.neighbors[0]).end,v=o.atoms.get(g);p=t.ctrlKey?c.default.calcAngle(v.pp,m.pp):c.default.fracAngle(c.default.calcAngle(v.pp,m.pp)),h=!1}else p=0,h=!1;var b=(0,f.fromTemplateOnAtom)(n,this.template,i.id,p,h),y=a(b,2);s=y[0],u=y[1],r.action=s}else if("bonds"===i.map)return(0,f.fromTemplateOnBondAction)(n,this.template,i.id,this.editor.event,r.sign1*r.sign2>0,!0).then(function(t){var r=a(t,2),o=r[0],i=r[1],s=(0,d.getItemsToFuse)(e.editor,i);o=(0,d.fromItemsFuse)(n,s).mergeWith(o),e.editor.update(o)}),!0}else{var _=(0,f.fromTemplateOnCanvas)(n,this.template,r.xy0,0),x=a(_,2);s=x[0],u=x[1],r.action=s}this.editor.selection(null),!r.mergeItems&&u&&(r.mergeItems=(0,d.getItemsToFuse)(this.editor,u)),r.action=r.action?(0,d.fromItemsFuse)(n,r.mergeItems).mergeWith(r.action):(0,d.fromItemsFuse)(n,r.mergeItems),this.editor.hover(null);var w=r.action;return w&&!w.isDummy()&&this.editor.update(w),this.editor.event.message.dispatch({info:!1}),!0},o.prototype.cancel=o.prototype.mouseup,o.prototype.mouseleave=o.prototype.mouseup,r.default=o},{"../../util/vec2":691,"../actions/closely-fusing":552,"../actions/template":559,"../shared/utils":566}],589:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("raphael"),i=n(o),a=t("./util/vec2"),s=n(a);i.default.el.translateAbs=function(t,e){this.delta=this.delta||new s.default,this.delta.x+=t-0,this.delta.y+=e-0,this.transform("t"+this.delta.x.toString()+","+this.delta.y.toString())},i.default.st.translateAbs=function(t,e){this.forEach(function(r){r.translateAbs(t,e)})},r.default=i.default},{"./util/vec2":691,raphael:502}],590:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r,n){return t.path("M{0},{1}L{2},{3}L{4},{5}M{2},{3}L{4},{6}",I(e.x),I(e.y),I(r.x),I(r.y),I(r.x-7),I(r.y-5),I(r.y+5)).attr(n.lineattr)}function i(t,e,r){var n=r.scale/5;return t.path("M{0},{4}L{0},{5}M{2},{1}L{3},{1}",I(e.x),I(e.y),I(e.x-n),I(e.x+n),I(e.y-n),I(e.y+n)).attr(r.lineattr)}function a(t,e,r,n){var o=e.p,i=r.p;return t.path(A(o,i)).attr(n.lineattr)}function s(t,e,r,n,o){return t.path("M{0},{1}L{2},{3}L{4},{5}Z",I(e.x),I(e.y),I(r.x),I(r.y),I(n.x),I(n.y)).attr(o.lineattr).attr({fill:"#000"})}function u(t,e,r,n,o,i){return t.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}Z",I(e.x),I(e.y),I(r.x),I(r.y),I(n.x),I(n.y),I(o.x),I(o.y)).attr(i.lineattr).attr({stroke:"#000",fill:"#000"})}function l(t,e,r,n,o){return t.set([e,t.path("M{0},{1}L{2},{3}",I(r.x),I(r.y),I(n.x),I(n.y)).attr(o.lineattr)])}function c(t,e,r,n,o,i){for(var a,s,u,l=e.p,c=e.norm,f=.7*i.stereoBond,d="",p=0;p<n;++p)u=l.addScaled(r,o*p),a=u.addScaled(c,f*(p+.5)/(n-.5)),s=u.addScaled(c,-f*(p+.5)/(n-.5)),d+=A(a,s);return t.path(d).attr(i.lineattr)}function f(t,e,r,n,o,i){for(var a=e.p,s=e.norm,u=.7*i.stereoBond,l="M"+I(a.x)+","+I(a.y),c=a,f=0;f<n;++f)c=a.addScaled(r,o*(f+.5)).addScaled(s,(1&f?-1:1)*u*(f+.5)/(n-.5)),l+="L"+I(c.x)+","+I(c.y);return t.path(l).attr(i.lineattr)}function d(t,e,r,n,o,i,a){return t.path(i?"M{0},{1}L{6},{7}M{4},{5}L{2},{3}":"M{0},{1}L{2},{3}M{4},{5}L{6},{7}",I(e.x),I(e.y),I(n.x),I(n.y),I(r.x),I(r.y),I(o.x),I(o.y)).attr(a.lineattr)}function p(t,e,r,n,o){for(var i,a=e.p,s=r.p,u=e.norm,l=o.bondSpace/2,c="",f=a,d=1;d<=n;++d)i=M.default.lc2(a,(n-d)/n,s,d/n),1&d?c+=A(f,i):(c+=A(f.addScaled(u,l),i.addScaled(u,l)),c+=A(f.addScaled(u,-l),i.addScaled(u,-l))),f=i;return t.path(c).attr(o.lineattr)}function h(t,e,r,n){var o=e.p,i=r.p,a=e.norm,s=o.addScaled(a,n.bondSpace),u=i.addScaled(a,n.bondSpace),l=o.addScaled(a,-n.bondSpace),c=i.addScaled(a,-n.bondSpace);return t.path(A(o,i)+A(s,u)+A(l,c)).attr(n.lineattr)}function m(t,e,r,n){var o=t.path(e[0]).attr(n.lineattr),i=t.path(e[1]).attr(n.lineattr);return void 0!==r&&null!==r&&(r>0?o:i).attr({"stroke-dasharray":"- "}),t.set([o,i])}function g(t,e,r,n){var o=e.p,i=r.p;return t.path(A(o,i)).attr(n.lineattr).attr({"stroke-dasharray":"- "})}function v(t,e,r){for(var n="",o=0;o<e.length/2;++o)n+=A(e[2*o],e[2*o+1]);return t.path(n).attr(r.lineattr)}function b(t,e,r,n){var o=t.text(e.x,e.y,r).attr({font:n.font,"font-size":n.fontszsub,fill:"#000"});return P(o,C.default.relBox(o.getBBox())),o}function y(t,e,r){var n=.9*r.lineWidth,o=n,i=2*n;return t.path("M{0},{1}L{2},{3}L{4},{5}",I(e.x-o),I(e.y+i),I(e.x),I(e.y),I(e.x+o),I(e.y+i)).attr({stroke:"#000","stroke-width":.7*r.lineWidth,"stroke-linecap":"square","stroke-linejoin":"miter"})}function _(t,e,r){return t.circle(I(e.x),I(e.y),r.lineWidth).attr({stroke:null,fill:"#000"})}function x(t,e,r,n,o,i,a){o=o||.25,i=i||1;var s=n.addScaled(r,-.5*i),u=n.addScaled(r,.5*i),l=s.addScaled(e,-o),c=u.addScaled(e,-o);return t.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}",I(l.x),I(l.y),I(s.x),I(s.y),I(u.x),I(u.y),I(c.x),I(c.y)).attr(a.sgroupBracketStyle)}function w(t,e,r,n){return t.rect(I(Math.min(e.x,r.x)),I(Math.min(e.y,r.y)),I(Math.abs(r.x-e.x)),I(Math.abs(r.y-e.y))).attr(n.lassoStyle)}function S(t,e,r){for(var n=e[e.length-1],o="M"+I(n.x)+","+I(n.y),i=0;i<e.length;++i)o+="L"+I(e[i].x)+","+I(e[i].y);return t.path(o).attr(r.lassoStyle)}function O(t,e,r,n){return t.path(A(e,r)).attr(n.lassoStyle)}function A(t,e){return"M"+I(t.x)+","+I(t.y)+"L"+I(e.x)+","+I(e.y)+"\t"}function E(t,e,r){for(var n=0,o=M.default.dist(t,e),i=M.default.diff(e,t).normalized(),a=!0,s="",u=0;n<o;){var l=r[u%r.length],c=n+Math.min(l,o-n);a&&(s+="M "+t.addScaled(i,n).coordStr()+" L "+t.addScaled(i,c).coordStr()),n+=l,a=!a,u++}return s}function j(t,e,r,n,o,i){return[i&&1&o?E(t,r,i):A(t,r),i&&2&o?E(e,n,i):A(e,n)]}function P(t,e){if(N.default.vml){console.assert(null,"Souldn't go here!");var r=.16*e.height;t.translateAbs(0,r),e.y+=r}}Object.defineProperty(r,"__esModule",{value:!0});var T=t("./util"),C=n(T),k=t("../util/vec2"),M=n(k),R=t("../raphael-ext"),N=n(R),I=C.default.tfx;r.default={recenterText:P,arrow:o,plus:i,aromaticBondPaths:j,bondSingle:a,bondSingleUp:s,bondSingleStereoBold:u,bondDoubleStereoBold:l,bondSingleDown:c,bondSingleEither:f,bondDouble:d,bondSingleOrDouble:p,bondTriple:h,bondAromatic:m,bondAny:g,reactingCenter:v,topologyMark:b,radicalCap:y,radicalBullet:_,bracket:x,selectionRectangle:w,selectionPolygon:S,selectionLine:O}},{"../raphael-ext":589,"../util/vec2":691,"./util":606}],591:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=t.clientWidth-10,n=t.clientHeight-10;r=r>0?r:0,n=n>0?n:0,this.userOpts=e,this.clientArea=t,this.paper=new u.default(t,r,n),this.sz=d.default.ZERO,this.ctab=new b.default(new g.default,this),this.options=(0,_.default)(this.userOpts)}function i(t){var e=0,r=0;if(t.parentNode)do{e+=t.offsetTop||0,r+=t.offsetLeft||0,t=t.offsetParent}while(t);return{left:r,top:e}}function a(t,e,r,n,o){var i=e<0?-e:0,a=r<0?-r:0;return t.x<n&&(i+=n-t.x),t.y<o&&(a+=o-t.y),new d.default(i,a)}Object.defineProperty(r,"__esModule",{value:!0});var s=t("../raphael-ext"),u=n(s),l=t("../util/box2abs"),c=n(l),f=t("../util/vec2"),d=n(f),p=t("../util/scale"),h=n(p),m=t("../chem/struct"),g=n(m),v=t("./restruct"),b=n(v),y=t("./options"),_=n(y),x={debug:!1,logcnt:0,logmouse:!1,hl:!1};x.logMethod=function(){},o.prototype.view2obj=function(t,e){var r=this.scrollPos();return this.useOldZoom||(t=t.scaled(1/this.options.zoom),r=r.scaled(1/this.options.zoom)),t=e?t:t.add(r).sub(this.options.offset),h.default.scaled2obj(t,this.options)},o.prototype.obj2view=function(t,e){var r=h.default.obj2scaled(t,this.options);return r=e?r:r.add(this.options.offset).sub(this.scrollPos().scaled(1/this.options.zoom)),this.useOldZoom||(r=r.scaled(this.options.zoom)),r},o.prototype.scrollPos=function(){return new d.default(this.clientArea.scrollLeft,this.clientArea.scrollTop)},o.prototype.page2obj=function(t){var e=i(this.clientArea),r=new d.default(t.pageX-e.left,t.pageY-e.top);return this.view2obj(r)},o.prototype.setPaperSize=function(t){x.logMethod("setPaperSize"),this.sz=t,this.paper.setSize(t.x*this.options.zoom,t.y*this.options.zoom),this.setViewBox(this.options.zoom)},o.prototype.setOffset=function(t){x.logMethod("setOffset");var e=new d.default(t.x-this.options.offset.x,t.y-this.options.offset.y);this.clientArea.scrollLeft+=e.x,this.clientArea.scrollTop+=e.y,this.options.offset=t},o.prototype.setZoom=function(t){console.info("set zoom",t),this.options.zoom=t,this.paper.setSize(this.sz.x*t,this.sz.y*t),this.setViewBox(t)},o.prototype.setScrollOffset=function(t,e){var r=this.clientArea,n=r.clientWidth,o=r.clientHeight,i=a(this.sz.scaled(this.options.zoom),t,e,n+t,o+e).scaled(1/this.options.zoom);if(i.x>0||i.y>0){this.setPaperSize(this.sz.add(i));var s=new d.default(t<0?-t:0,e<0?-e:0).scaled(1/this.options.zoom);(s.x>0||s.y>0)&&(this.ctab.translate(s),this.setOffset(this.options.offset.add(s)))}r.scrollLeft=t,r.scrollTop=e,this.update(!1)},o.prototype.setScale=function(t){this.options.offset&&(this.options.offset=this.options.offset.scaled(1/t).scaled(t)),this.userOpts.scale*=t,this.options=null,this.update(!0)},o.prototype.setViewBox=function(t){this.useOldZoom?this.setScale(t):this.paper.canvas.setAttribute("viewBox","0 0 "+this.sz.x+" "+this.sz.y)},o.prototype.setMolecule=function(t){x.logMethod("setMolecule"),this.paper.clear(),this.ctab=new b.default(t,this),this.options.offset=new d.default,this.update(!1)},o.prototype.update=function(t,e){e=e||new d.default(this.clientArea.clientWidth||100,this.clientArea.clientHeight||100);var r=this.ctab.update(t);if(this.ctab.setSelection(),r){var n=this.options.scale,o=this.ctab.getVBoxObj().transform(h.default.obj2scaled,this.options).translate(this.options.offset||new d.default);if(this.options.autoScale){var i=o.sz(),a=this.options.autoScaleMargin,s=new d.default(a,a),u=e;if(u.x<2*a+1||u.y<2*a+1)throw new Error("View box too small for the given margin");var l=Math.max(i.x/(u.x-2*a),i.y/(u.y-2*a));this.options.maxBondLength/l>1&&(l=1);var f=i.add(s.scaled(2*l));this.paper.setViewBox(o.pos().x-a*l-(u.x*l-f.x)/2,o.pos().y-a*l-(u.y*l-f.y)/2,u.x*l,u.y*l)}else{var p=d.default.UNIT.scaled(n),m=o.sz().length()>0?o.extend(p,p):o,g=new c.default(this.scrollPos(),e.scaled(1/this.options.zoom).sub(d.default.UNIT.scaled(20))),v=c.default.union(g,m);this.oldCb||(this.oldCb=new c.default);var b=v.sz().floor(),y=this.oldCb.p0.sub(v.p0).ceil();this.oldBb=o,this.sz&&b.x==this.sz.x&&b.y==this.sz.y||this.setPaperSize(b),this.options.offset=this.options.offset||new d.default,0==y.x&&0==y.y||(this.setOffset(this.options.offset.add(y)),this.ctab.translate(y))}}},r.default=o},{"../chem/struct":542,"../raphael-ext":589,"../util/box2abs":687,"../util/scale":690,"../util/vec2":691,"./options":592,"./restruct":593}],592:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.scale||100;t.rotationStep&&a.default.setFracAngle(t.rotationStep);var r=Math.ceil(e/6*1.9),n=Math.ceil(.7*r),o={showAtomIds:!1,showBondIds:!1,showHalfBondIds:!1,showLoopIds:!1,hideChiralFlag:!1,showValenceWarnings:!0,autoScale:!1,autoScaleMargin:0,maxBondLength:0,atomColoring:!0,hideImplicitHydrogen:!1,hideTerminalLabels:!1,carbonExplicitly:!1,showCharge:!0,showHydrogenLabels:"on",showValence:!0,aromaticCircle:!0,scale:e,zoom:1,offset:new u.default,lineWidth:e/20,bondSpace:t.doubleBondWidth||e/7,stereoBond:t.stereoBondWidth||e/7,subFontSize:n,font:"30px Arial",fontsz:r,fontszsub:n,fontRLabel:1.2*r,fontRLogic:.7*r,lineattr:{stroke:"#000","stroke-width":t.bondThickness||e/20,"stroke-linecap":"round","stroke-linejoin":"round"},selectionStyle:{fill:"#7f7",stroke:"none"},highlightStyle:{stroke:"#0c0","stroke-width":.6*e/20},sgroupBracketStyle:{stroke:"darkgray","stroke-width":.5*e/20},lassoStyle:{stroke:"gray","stroke-width":"1px"},atomSelectionPlateRadius:1.2*r};return Object.assign({},o,t)}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../editor/shared/utils"),a=n(i),s=t("../util/vec2"),u=n(s);r.default=o},{"../editor/shared/utils":566,"../util/vec2":691}],593:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=this;if(this.render=e,this.atoms=new f.default,this.bonds=new f.default,this.reloops=new f.default,this.rxnPluses=new f.default,this.rxnArrows=new f.default,this.frags=new f.default,this.rgroups=new f.default,this.sgroups=new f.default,this.sgroupData=new f.default,this.chiralFlags=new f.default,this.molecule=t||new y.default,this.initialized=!1,this.layers=[],this.initLayers(),this.connectedComponents=new f.default,this.ccFragmentType=new f.default,this.clearMarks(),this.structChanged=!1,t.atoms.forEach(function(t,e){r.atoms.set(e,new x.default(t))}),t.bonds.forEach(function(t,e){r.bonds.set(e,new S.default(t))}),t.loops.forEach(function(t,e){r.reloops.set(e,new F.default(t))}),t.rxnPluses.forEach(function(t,e){r.rxnPluses.set(e,new A.default(t))}),t.rxnArrows.forEach(function(t,e){r.rxnArrows.set(e,new j.default(t))}),t.frags.forEach(function(t,e){r.frags.set(e,new T.default(t))}),t.rgroups.forEach(function(t,e){r.rgroups.set(e,new k.default(t))}),t.sgroups.forEach(function(t,e){r.sgroups.set(e,new L.default(t)),"DAT"!==t.type||t.data.attached||r.sgroupData.set(e,new R.default(t))}),t.isChiral){var n=t.getCoordBoundingBox();this.chiralFlags.set(0,new I.default(new m.default(n.max.x,n.min.y-1)))}}function i(t){return!t||!Object.keys(o.maps).some(function(e){return t[e]&&t[e].length>0})}function a(t,e){if("set"==t.type)for(var r=0;r<t.length;++r)a(t[r],e);else void 0!==t.attrs&&("font-size"in t.attrs?t.attr("font-size",t.attrs["font-size"]*e):"stroke-width"in t.attrs&&t.attr("stroke-width",t.attrs["stroke-width"]*e)),t.scale(e,e,0,0)}function s(t,e){for(var r=0;r<t.paths.length;++r)a(t.paths[r],e)}Object.defineProperty(r,"__esModule",{value:!0}),r.ReSGroup=r.ReChiralFlag=r.ReRGroup=r.ReFrag=r.ReRxnArrow=r.ReRxnPlus=r.ReBond=r.ReAtom=void 0;var u=t("../../util/box2abs"),l=n(u),c=t("../../util/pool"),f=n(c),d=t("../../util/pile"),p=n(d),h=t("../../util/vec2"),m=n(h),g=t("../util"),v=n(g),b=t("../../chem/struct"),y=n(b),_=t("./reatom"),x=n(_),w=t("./rebond"),S=n(w),O=t("./rerxnplus"),A=n(O),E=t("./rerxnarrow"),j=n(E),P=t("./refrag"),T=n(P),C=t("./rergroup"),k=n(C),M=t("./redatasgroupdata"),R=n(M),N=t("./rechiralflag"),I=n(N),B=t("./resgroup"),L=n(B),D=t("./reloop"),F=n(D),G={background:0,selectionPlate:1,highlighting:2,warnings:3,data:4,indices:5};o.prototype.connectedComponentRemoveAtom=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e=e||this.atoms.get(t),!(e.component<0)){var r=this.connectedComponents.get(e.component);r.delete(t),r.size<1&&this.connectedComponents.delete(e.component),e.component=-1}},o.prototype.clearConnectedComponents=function(){this.connectedComponents.clear(),this.atoms.forEach(function(t){t.component=-1})},o.prototype.getConnectedComponent=function(t,e){for(var r=this,n=Array.isArray(t)?Array.from(t):[t],o=new p.default;n.length>0;){var i=n.pop();o.add(i);var a=this.atoms.get(i);a.component>=0&&e.add(a.component),a.a.neighbors.forEach(function(t){var e=r.molecule.halfBonds.get(t).end;o.has(e)||n.push(e)})}return o},o.prototype.addConnectedComponent=function(t){var e=this,r=this.connectedComponents.add(t),n=new p.default,o=this.getConnectedComponent(Array.from(t),n);n.delete(r);var i=-1;return o.forEach(function(t){var n=e.atoms.get(t);n.component=r,-1!==n.a.rxnFragmentType&&(i=n.a.rxnFragmentType)}),this.ccFragmentType.set(r,i),r},o.prototype.removeConnectedComponent=function(t){var e=this;return this.connectedComponents.get(t).forEach(function(t){e.atoms.get(t).component=-1}),this.connectedComponents.delete(t)},o.prototype.assignConnectedComponents=function(){var t=this;this.atoms.forEach(function(e,r){if(!(e.component>=0)){var n=new p.default,o=t.getConnectedComponent(r,n);n.forEach(function(e){t.removeConnectedComponent(e)}),t.addConnectedComponent(o)}})},o.prototype.initLayers=function(){for(var t in G)this.layers[G[t]]=this.render.paper.rect(0,0,10,10).attr({class:t+"Layer",fill:"#000",opacity:"0.0"}).toFront()},o.prototype.addReObjectPath=function(t,e,r,n,o){if(r&&this.layers[G[t]].node.parentNode){var i=this.render.options.offset,a=o?l.default.fromRelBox(v.default.relBox(r.getBBox())):null,s=n&&a?a.translate(n.negated()):null;null!==i&&(r.translateAbs(i.x,i.y),a=a?a.translate(i):null),e.add(r,a,s),r.insertBefore(this.layers[G[t]])}},o.prototype.clearMarks=function(){var t=this;Object.keys(o.maps).forEach(function(e){t[e+"Changed"]=new Map}),this.structChanged=!1},o.prototype.markItemRemoved=function(){this.structChanged=!0},o.prototype.markBond=function(t,e){this.markItem("bonds",t,e)},o.prototype.markAtom=function(t,e){this.markItem("atoms",t,e)},o.prototype.markItem=function(t,e,r){var n=this[t+"Changed"],o=n.has(e)?Math.max(r,n.get(e)):r;n.set(e,o),this[t].has(e)&&this.clearVisel(this[t].get(e).visel)},o.prototype.clearVisel=function(t){t.paths.forEach(function(t){t.remove()}),t.clear()},o.prototype.eachItem=function(t){var e=this;Object.keys(o.maps).forEach(function(r){e[r].forEach(t)})},o.prototype.getVBoxObj=function(t){var e=this;t=t||{},i(t)&&Object.keys(o.maps).forEach(function(r){t[r]=Array.from(e[r].keys())});var r=null;return Object.keys(o.maps).forEach(function(n){t[n]&&t[n].forEach(function(t){var o=e[n].get(t).getVBoxObj(e.render);o&&(r=r?l.default.union(r,o):o.clone())})}),r=r||new l.default(0,0,0,0)},o.prototype.translate=function(t){this.eachItem(function(e){return e.visel.translate(t)})},o.prototype.scale=function(t){this.eachItem(function(e){return s(e.visel,t)})},o.prototype.clearVisels=function(){var t=this;this.eachItem(function(e){return t.clearVisel(e.visel)})},o.prototype.update=function(t){var e=this;t=t||!this.initialized,Object.keys(o.maps).forEach(function(r){var n=e[r+"Changed"];t?e[r].forEach(function(t,e){return n.set(e,1)}):n.forEach(function(t,o){e[r].has(o)||n.delete(o)})}),this.atomsChanged.forEach(function(t,r){return e.connectedComponentRemoveAtom(r)}),this.frags.filter(function(t,r){return!r.calcBBox(e.render.ctab,t,e.render)}).forEach(function(t,r){e.clearVisel(t.visel),e.frags.delete(r),e.molecule.frags.delete(r)}),Object.keys(o.maps).forEach(function(t){var r=e[t+"Changed"];r.forEach(function(n,o){e.clearVisel(e[t].get(o).visel),e.structChanged|=r.get(o)>0})}),this.sgroups.forEach(function(t){e.clearVisel(t.visel),t.highlighting=null,t.selectionPlate=null}),this.frags.forEach(function(t){e.clearVisel(t.visel)}),this.rgroups.forEach(function(t){e.clearVisel(t.visel)}),t&&(this.clearConnectedComponents(),this.molecule.initHalfBonds(),this.molecule.initNeighbors());var r=Array.from(this.atomsChanged.keys());this.molecule.updateHalfBonds(r),this.molecule.sortNeighbors(r),this.assignConnectedComponents(),this.initialized=!0,this.verifyLoops();var n=t||this.structChanged;return n&&this.updateLoops(),this.setImplicitHydrogen(),this.showLabels(),this.showBonds(),n&&this.showLoops(),this.showReactionSymbols(),this.showSGroups(),this.showFragments(),this.showRGroups(),this.showChiralFlags(),this.clearMarks(),!0},o.prototype.updateLoops=function(){var t=this;this.reloops.forEach(function(e){t.clearVisel(e.visel)});var e=this.molecule.findLoops();e.bondsToMark.forEach(function(e){t.markBond(e,1)}),e.newLoops.forEach(function(e){t.reloops.set(e,new F.default(t.molecule.loops.get(e)))})},o.prototype.showLoops=function(){var t=this,e=this.render.options;this.reloops.forEach(function(r,n){r.show(t,n,e)})},o.prototype.showReactionSymbols=function(){var t=this,e=this.render.options;this.rxnArrowsChanged.forEach(function(r,n){t.rxnArrows.get(n).show(t,n,e)}),this.rxnPlusesChanged.forEach(function(r,n){t.rxnPluses.get(n).show(t,n,e)})},o.prototype.showSGroups=function(){var t=this,e=this.render.options;this.molecule.sGroupForest.getSGroupsBFS().reverse().forEach(function(r){t.sgroups.get(r).show(t,r,e)})},o.prototype.showFragments=function(){var t=this;this.frags.forEach(function(e,r){var n=e.draw(t.render,r);n&&t.addReObjectPath("data",e.visel,n,null,!0)})},o.prototype.showRGroups=function(){var t=this,e=this.render.options;this.rgroups.forEach(function(r,n){r.show(t,n,e)})},o.prototype.setImplicitHydrogen=function(){this.molecule.setImplicitHydrogen(Array.from(this.atomsChanged.keys()))},o.prototype.loopRemove=function(t){var e=this;if(this.reloops.has(t)){var r=this.reloops.get(t);this.clearVisel(r.visel);var n=[];r.loop.hbs.forEach(function(t){if(e.molecule.halfBonds.has(t)){var r=e.molecule.halfBonds.get(t);r.loop=-1,e.markBond(r.bid,1),e.markAtom(r.begin,1),n.push(r.bid)}}),this.reloops.delete(t),this.molecule.loops.delete(t)}},o.prototype.verifyLoops=function(){var t=this;this.reloops.forEach(function(e,r){e.isValid(t.molecule,r)||t.loopRemove(r)})},o.prototype.showLabels=function(){var t=this,e=this.render.options;this.atomsChanged.forEach(function(r,n){t.atoms.get(n).show(t,n,e)})},o.prototype.showChiralFlags=function(){var t=this,e=this.render.options;!0!==this.render.options.hideChiralFlag&&this.chiralFlagsChanged.forEach(function(r,n){t.chiralFlags.get(n).show(t,n,e)})},o.prototype.showBonds=function(){var t=this,e=this.render.options;this.bondsChanged.forEach(function(r,n){t.bonds.get(n).show(t,n,e)})},o.prototype.setSelection=function(t){var e=this,r=0===arguments.length;Object.keys(o.maps).forEach(function(n){o.maps[n].isSelectable()&&e[n].forEach(function(o,i){var a=r?o.selected:t&&t[n]&&t[n].indexOf(i)>-1;e.showItemSelection(o,a)})})},o.prototype.showItemSelection=function(t,e){var r=null!==t.selectionPlate&&!t.selectionPlate.removed;if(t.selected=e,t instanceof R.default&&(t.sgroup.selected=e),e){if(!r){var n=this.render,o=n.options,i=n.paper;t.selectionPlate=t.makeSelectionPlate(this,i,o),this.addReObjectPath("selectionPlate",t.visel,t.selectionPlate)}t.selectionPlate&&t.selectionPlate.show()}else r&&t.selectionPlate&&t.selectionPlate.hide()},o.maps={atoms:x.default,bonds:S.default,rxnPluses:A.default,rxnArrows:j.default,frags:T.default,rgroups:k.default,sgroupData:R.default,chiralFlags:I.default,sgroups:L.default,reloops:F.default},r.default=o,r.ReAtom=x.default,r.ReBond=S.default,r.ReRxnPlus=A.default,r.ReRxnArrow=j.default,r.ReFrag=T.default,r.ReRGroup=k.default,r.ReChiralFlag=I.default,r.ReSGroup=L.default},{"../../chem/struct":542,"../../util/box2abs":687,"../../util/pile":688,"../../util/pool":689,"../../util/vec2":691,"../util":606,"./reatom":594,"./rebond":595,"./rechiralflag":596,"./redatasgroupdata":597,"./refrag":598,"./reloop":599,"./rergroup":601,"./rerxnarrow":602,"./rerxnplus":603,"./resgroup":604}],594:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("atom"),this.a=t,this.showLabel=!1,this.hydrogenOnTheLeft=!1,this.color="#000000",this.component=-1}function i(t,e,r){var n="off"!==e.showHydrogenLabels&&"Hetero"!==e.showHydrogenLabels;if(0===r.a.neighbors.length||r.a.neighbors.length<2&&n||e.carbonExplicitly||r.a.alias||0!==r.a.isotope||0!==r.a.radical||0!==r.a.charge||r.a.explicitValence>=0||null!==r.a.atomList||null!==r.a.rglabel||r.a.badConn&&e.showValenceWarnings||"c"!==r.a.label.toLowerCase())return!0;if(2===r.a.neighbors.length){var o=r.a.neighbors[0],i=r.a.neighbors[1],a=t.molecule.halfBonds.get(o),s=t.molecule.halfBonds.get(i),u=t.bonds.get(a.bid),l=t.bonds.get(s.bid);if(u.b.type===l.b.type&&u.b.stereo===D.Bond.PATTERN.STEREO.NONE&&l.b.stereo===D.Bond.PATTERN.STEREO.NONE&&Math.abs(L.default.cross(a.dir,s.dir))<.2)return!0}return!1}function a(t,e){return"on"===t||"Terminal"===t&&e.a.neighbors.length<2||"Hetero"===t&&"c"!==e.label.text.toLowerCase()||"Terminal and Hetero"===t&&(e.a.neighbors.length<2||"c"!==e.label.text.toLowerCase())}function s(t,e){if(0===e.a.neighbors.length){var r=C.default.map[e.a.label];return!r||C.default[r].leftH}var n=1,o=1,i=0,a=0;return e.a.neighbors.forEach(function(e){var r=t.halfBonds.get(e).dir;r.x<=0?(n=Math.min(n,Math.abs(r.y)),i++):(o=Math.min(o,Math.abs(r.y)),a++)}),n<.51||o<.51?o<n:a>i}function u(t,e,r,n){var o={};if(o.text=l(t.a),""===o.text&&(o="R#"),o.text===t.a.label){var i=C.default.map[o.text];n.atomColoring&&i&&(t.color=k.sketchingColors[o.text]||"#000")}return o.path=e.text(r.x,r.y,o.text).attr({font:n.font,"font-size":n.fontsz,fill:t.color,"font-style":t.a.pseudo?"italic":""}),o.rbb=I.default.relBox(o.path.getBBox()),R.default.recenterText(o.path,o.rbb),null!==t.a.atomList&&_(o.path,o.rbb,(t.hydrogenOnTheLeft?-1:1)*(o.rbb.width-o.rbb.height)/2,0),t.label=o,o}function l(t){if(null!==t.atomList)return t.atomList.label();if(t.pseudo)return t.pseudo;if(t.alias)return t.alias;if("R#"===t.label&&null!==t.rglabel){for(var e="",r=0;r<32;r++)t.rglabel&1<<r&&(e+="R"+(r+1).toString());return e}return t.label}function c(t,e,r,n){var o=P.default.obj2scaled(t.a.pp,e.options),i=e.options,a=.5*i.lineWidth,s={};return s.text=(r+1).toString(),s.path=e.paper.text(o.x,o.y,s.text).attr({font:i.font,"font-size":i.fontszsub,fill:t.color}),s.rbb=I.default.relBox(s.path.getBBox()),R.default.recenterText(s.path,s.rbb),_(s.path,s.rbb,n+.5*s.rbb.width+a,.2*t.label.rbb.height),s}function f(t,e){var r,n=P.default.obj2scaled(t.a.pp,e.options),o=e.options,i=e.paper,a={};switch(t.a.radical){case 1:a.path=i.set(),r=1.6*o.lineWidth,a.path.push(R.default.radicalBullet(i,n.add(new L.default(-r,0)),o),R.default.radicalBullet(i,n.add(new L.default(r,0)),o)),a.path.attr("fill",t.color);break;case 2:a.path=i.set(),a.path.push(R.default.radicalBullet(i,n,o)),a.path.attr("fill",t.color);break;case 3:a.path=i.set(),r=1.6*o.lineWidth,a.path.push(R.default.radicalCap(i,n.add(new L.default(-r,0)),o),R.default.radicalCap(i,n.add(new L.default(r,0)),o)),a.path.attr("stroke",t.color)}a.rbb=I.default.relBox(a.path.getBBox());var s=-.5*(t.label.rbb.height+a.rbb.height);return 3===t.a.radical&&(s-=o.lineWidth/2),_(a.path,a.rbb,0,s),a}function d(t,e,r){var n=P.default.obj2scaled(t.a.pp,e.options),o=e.options,i=.5*o.lineWidth,a={};return a.text=t.a.isotope.toString(),a.path=e.paper.text(n.x,n.y,a.text).attr({font:o.font,"font-size":o.fontszsub,fill:t.color}),a.rbb=I.default.relBox(a.path.getBBox()),R.default.recenterText(a.path,a.rbb),_(a.path,a.rbb,r-.5*a.rbb.width-i,-.3*t.label.rbb.height),a}function p(t,e,r){var n=P.default.obj2scaled(t.a.pp,e.options),o=e.options,i=.5*o.lineWidth,a={};a.text="";var s=Math.abs(t.a.charge);return 1!=s&&(a.text=s.toString()),t.a.charge<0?a.text+="–":a.text+="+",a.path=e.paper.text(n.x,n.y,a.text).attr({font:o.font,"font-size":o.fontszsub,fill:t.color}),a.rbb=I.default.relBox(a.path.getBBox()),R.default.recenterText(a.path,a.rbb),_(a.path,a.rbb,r+.5*a.rbb.width+i,-.3*t.label.rbb.height),a}function h(t,e,r){var n={0:"0",1:"I",2:"II",3:"III",4:"IV",5:"V",6:"VI",7:"VII",8:"VIII",9:"IX",10:"X",11:"XI",12:"XII",13:"XIII",14:"XIV"},o=P.default.obj2scaled(t.a.pp,e.options),i=e.options,a=.5*i.lineWidth,s={};if(s.text=n[t.a.explicitValence],!s.text)throw new Error("invalid valence "+t.a.explicitValence.toString());return s.text="("+s.text+")",s.path=e.paper.text(o.x,o.y,s.text).attr({font:i.font,"font-size":i.fontszsub,fill:t.color}),s.rbb=I.default.relBox(s.path.getBBox()),R.default.recenterText(s.path,s.rbb),_(s.path,s.rbb,r+.5*s.rbb.width+a,-.3*t.label.rbb.height),s}function m(t,e,r,n){var o=n.hydroIndex,i=t.hydrogenOnTheLeft,a=P.default.obj2scaled(t.a.pp,e.options),s=e.options,u=.5*s.lineWidth,l=n.hydrogen;return l.text="H",l.path=e.paper.text(a.x,a.y,l.text).attr({font:s.font,"font-size":s.fontsz,fill:t.color}),l.rbb=I.default.relBox(l.path.getBBox()),R.default.recenterText(l.path,l.rbb),i||(_(l.path,l.rbb,n.rightMargin+.5*l.rbb.width+u,0),n.rightMargin+=l.rbb.width+u),r>1&&(o={},o.text=r.toString(),o.path=e.paper.text(a.x,a.y,o.text).attr({font:s.font,"font-size":s.fontszsub,fill:t.color}),o.rbb=I.default.relBox(o.path.getBBox()),
  R.default.recenterText(o.path,o.rbb),i||(_(o.path,o.rbb,n.rightMargin+.5*o.rbb.width+u,.2*t.label.rbb.height),n.rightMargin+=o.rbb.width+u)),i&&(null!=o&&(_(o.path,o.rbb,n.leftMargin-.5*o.rbb.width-u,.2*t.label.rbb.height),n.leftMargin-=o.rbb.width+u),_(l.path,l.rbb,n.leftMargin-.5*l.rbb.width-u,0),n.leftMargin-=l.rbb.width+u),Object.assign(n,{hydrogen:l,hydroIndex:o})}function g(t,e,r,n){var o=P.default.obj2scaled(t.a.pp,e.options),i=.5*e.options.lineWidth,a=I.default.tfx,s={},u=o.y+t.label.rbb.height/2+i;return s.path=e.paper.path("M{0},{1}L{2},{3}",a(o.x+r),a(u),a(o.x+n),a(u)).attr(e.options.lineattr).attr({stroke:"#F00"}),s.rbb=I.default.relBox(s.path.getBBox()),s}function v(t,e,r,n){var o,i,a=P.default.obj2scaled(t.a.pp,e.options),s=e.options,u=I.default.tfx;for(o=0;o<4;++o){var l="";if(t.a.attpnt&1<<o){for(l.length>0&&(l+=" "),l+="∗",i=0;i<(0==o?0:o+1);++i)l+="'";var c=new L.default(a),f=a.addScaled(r,.7*s.scale),d=e.paper.text(f.x,f.y,l).attr({font:s.font,"font-size":s.fontsz,fill:t.color}),p=I.default.relBox(d.getBBox());R.default.recenterText(d,p);var h=r.negated();f=f.addScaled(h,I.default.shiftRayBox(f,h,O.default.fromRelBox(p))+s.lineWidth/2),c=w(t,c,r,s.lineWidth);var m=r.rotateSC(1,0),g=f.addScaled(m,.05*s.scale).addScaled(h,.09*s.scale),v=f.addScaled(m,-.05*s.scale).addScaled(h,.09*s.scale),b=e.paper.set();b.push(d,e.paper.path("M{0},{1}L{2},{3}M{4},{5}L{2},{3}L{6},{7}",u(c.x),u(c.y),u(f.x),u(f.y),u(g.x),u(g.y),u(v.x),u(v.y)).attr(e.options.lineattr).attr({"stroke-width":s.lineWidth/2})),n("indices",t.visel,b,a),r=r.rotate(Math.PI/6)}}}function b(t){var e="";if(t.a.aam>0&&(e+=t.a.aam),t.a.invRet>0)if(e.length>0&&(e+=","),1==t.a.invRet)e+="Inv";else{if(2!=t.a.invRet)throw new Error("Invalid value for the invert/retain flag");e+="Ret"}if(t.a.exactChangeFlag>0){if(e.length>0&&(e+=","),1!=t.a.exactChangeFlag)throw new Error("Invalid value for the exact change flag");e+="ext"}return e}function y(t){var e="";if(0!=t.a.ringBondCount)if(t.a.ringBondCount>0)e+="rb"+t.a.ringBondCount.toString();else if(-1==t.a.ringBondCount)e+="rb0";else{if(-2!=t.a.ringBondCount)throw new Error("Ring bond count invalid");e+="rb*"}if(0!=t.a.substitutionCount)if(e.length>0&&(e+=","),t.a.substitutionCount>0)e+="s"+t.a.substitutionCount.toString();else if(-1==t.a.substitutionCount)e+="s0";else{if(-2!=t.a.substitutionCount)throw new Error("Substitution count invalid");e+="s*"}if(t.a.unsaturatedAtom>0){if(e.length>0&&(e+=","),1!=t.a.unsaturatedAtom)throw new Error("Unsaturated atom invalid value");e+="u"}return t.a.hCount>0&&(e.length>0&&(e+=","),e+="H"+(t.a.hCount-1).toString()),e}function _(t,e,r,n){t.translateAbs(r,n),e.x+=r,e.y+=n}function x(t,e){var r=[];t.a.neighbors.forEach(function(t){var n=e.halfBonds.get(t);r.push(n.ang)}),r=r.sort(function(t,e){return t-e});for(var n=[],o=0;o<r.length-1;++o)n.push(r[(o+1)%r.length]-r[o]);n.push(r[0]-r[r.length-1]+2*Math.PI);var i=0,a=-Math.PI/2;for(o=0;o<r.length;++o)n[o]>i&&(i=n[o],a=r[o]+n[o]/2);return new L.default(Math.cos(a),Math.sin(a))}function w(t,e,r,n){for(var o=0,i=t.visel,a=0;a<i.exts.length;++a){var s=i.exts[a].translate(e);o=Math.max(o,I.default.shiftRayBox(e,r,s))}return o>0&&(e=e.addScaled(r,o+n)),e}Object.defineProperty(r,"__esModule",{value:!0});var S=t("../../util/box2abs"),O=n(S),A=t("./reobject"),E=n(A),j=t("../../util/scale"),P=n(j),T=t("../../chem/element"),C=n(T),k=t("../../chem/element-color"),M=t("../draw"),R=n(M),N=t("../util"),I=n(N),B=t("../../util/vec2"),L=n(B),D=t("../../chem/struct");o.prototype=new E.default,o.isSelectable=function(){return!0},o.prototype.getVBoxObj=function(t){return this.visel.boundingBox?E.default.prototype.getVBoxObj.call(this,t):new O.default(this.a.pp,this.a.pp)},o.prototype.drawHighlight=function(t){var e=this.makeHighlightPlate(t);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeHighlightPlate=function(t){var e=t.paper,r=t.options,n=P.default.obj2scaled(this.a.pp,r);return e.circle(n.x,n.y,r.atomSelectionPlateRadius).attr(r.highlightStyle)},o.prototype.makeSelectionPlate=function(t,e,r){var n=P.default.obj2scaled(this.a.pp,t.render.options);return e.circle(n.x,n.y,r.atomSelectionPlateRadius).attr(r.selectionStyle)},o.prototype.show=function(t,e,r){var n=t.render,o=P.default.obj2scaled(this.a.pp,n.options);if(this.hydrogenOnTheLeft=s(t.molecule,this),this.showLabel=i(t,n.options,this),this.color="black",this.showLabel){var l=u(this,n.paper,o,r),w=.5*r.lineWidth,S=l.rbb.width/2,A=-l.rbb.width/2,E=Math.floor(this.a.implicitH),j="H"===l.text;t.addReObjectPath("data",this.visel,l.path,o,!0);var T=null;r.showAtomIds&&(T={},T.text=e.toString(),T.path=n.paper.text(o.x,o.y,T.text).attr({font:r.font,"font-size":r.fontszsub,fill:"#070"}),T.rbb=I.default.relBox(T.path.getBBox()),R.default.recenterText(T.path,T.rbb),t.addReObjectPath("indices",this.visel,T.path,o)),this.setHighlight(this.highlight,n)}if(this.showLabel&&!this.a.alias&&!this.a.pseudo){var M=null;if(j&&E>0&&(M=c(this,n,E,S),S+=M.rbb.width+w,t.addReObjectPath("data",this.visel,M.path,o,!0)),0!=this.a.radical){var N=f(this,n);t.addReObjectPath("data",this.visel,N.path,o,!0)}if(0!=this.a.isotope){var B=d(this,n,A);A-=B.rbb.width+w,t.addReObjectPath("data",this.visel,B.path,o,!0)}if(!j&&E>0&&a(r.showHydrogenLabels,this)){var L=m(this,n,E,{hydrogen:{},hydroIndex:M,rightMargin:S,leftMargin:A}),D=L.hydrogen;M=L.hydroIndex,S=L.rightMargin,A=L.leftMargin,t.addReObjectPath("data",this.visel,D.path,o,!0),null!=M&&t.addReObjectPath("data",this.visel,M.path,o,!0)}if(0!=this.a.charge&&r.showCharge){var F=p(this,n,S);S+=F.rbb.width+w,t.addReObjectPath("data",this.visel,F.path,o,!0)}if(this.a.explicitValence>=0&&r.showValence){var G=h(this,n,S);S+=G.rbb.width+w,t.addReObjectPath("data",this.visel,G.path,o,!0)}if(this.a.badConn&&r.showValenceWarnings){var z=g(this,n,A,S);t.addReObjectPath("warnings",this.visel,z.path,o,!0)}T&&_(T.path,T.rbb,-.5*l.rbb.width-.5*T.rbb.width-w,.3*l.rbb.height)}if(this.a.attpnt){v(this,n,x(this,t.molecule),t.addReObjectPath.bind(t))}var H=b(this),W=this.a.alias||this.a.pseudo?"":y(this);if(H=(W.length>0?W+"\n":"")+(H.length>0?"."+H+".":""),H.length>0){var U=C.default.map[this.a.label],V=n.paper.text(o.x,o.y,H).attr({font:r.font,"font-size":r.fontszsub,fill:r.atomColoring&&U?k.sketchingColors[this.a.label]:"#000"}),q=I.default.relBox(V.getBBox());R.default.recenterText(V,q);for(var K=x(this,t.molecule),Y=this.visel,$=3,X=0;X<Y.exts.length;++X)$=Math.max($,I.default.shiftRayBox(o,K,Y.exts[X].translate(o)));$+=I.default.shiftRayBox(o,K.negated(),O.default.fromRelBox(q)),K=K.scaled(8+$),_(V,q,K.x,K.y),t.addReObjectPath("data",this.visel,V,o,!0)}},r.default=o},{"../../chem/element":525,"../../chem/element-color":524,"../../chem/struct":542,"../../util/box2abs":687,"../../util/scale":690,"../../util/vec2":691,"../draw":590,"../util":606,"./reobject":600}],595:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("bond"),this.b=t,this.doubleBondShift=0}function i(t,e,r,n){return t.neighbors.findIndex(function(t){var o=n.molecule.halfBonds.get(t),i=o.bid;if(i===e)return!1;var a=n.bonds.get(i);return a.b.type===C.Bond.PATTERN.TYPE.SINGLE&&a.b.stereo===C.Bond.PATTERN.STEREO.UP?a.b.end===o.begin||a.boldStereo&&r:!(a.b.type!==C.Bond.PATTERN.TYPE.DOUBLE||a.b.stereo!==C.Bond.PATTERN.STEREO.NONE||!r||!a.boldStereo)})}function a(t,e,r){var n=[e.b.begin,e.b.end].map(function(e){var n=r.molecule.atoms.get(e),o=i(n,t,!0,r);return o<0?-1:n.neighbors[o]});console.assert(2===n.length),e.neihbid1=r.atoms.get(e.b.begin).showLabel?-1:n[0],e.neihbid2=r.atoms.get(e.b.end).showLabel?-1:n[1]}function s(t,e,r){var n=[e.b.begin,e.b.end].map(function(e){var n=r.molecule.atoms.get(e),o=i(n,t,!1,r);return o<0?-1:n.neighbors[o]});console.assert(2===n.length),e.boldStereo=n[0]>=0&&n[1]>=0}function u(t,e,r,n){var o=null,i=t.render,s=t.molecule,u=!t.atoms.get(r.begin).showLabel,d=!t.atoms.get(n.begin).showLabel;switch(e.b.type){case C.Bond.PATTERN.TYPE.SINGLE:switch(e.b.stereo){case C.Bond.PATTERN.STEREO.UP:a(r.bid,e,t),o=e.boldStereo&&e.neihbid1>=0&&e.neihbid2>=0?c(i,r,n,e,s):l(i,r,n,e,s);break;case C.Bond.PATTERN.STEREO.DOWN:o=h(i,r,n);break;case C.Bond.PATTERN.STEREO.EITHER:o=m(i,r,n);break;default:o=M.default.bondSingle(i.paper,r,n,i.options)}break;case C.Bond.PATTERN.TYPE.DOUBLE:a(r.bid,e,t),o=e.b.stereo===C.Bond.PATTERN.STEREO.NONE&&e.boldStereo&&e.neihbid1>=0&&e.neihbid2>=0?f(i,r,n,e,s,u,d):g(i,r,n,e,u,d);break;case C.Bond.PATTERN.TYPE.TRIPLE:o=M.default.bondTriple(i.paper,r,n,i.options);break;case C.Bond.PATTERN.TYPE.AROMATIC:o=r.loop>=0&&s.loops.get(r.loop).aromatic||n.loop>=0&&s.loops.get(n.loop).aromatic?M.default.bondSingle(i.paper,r,n,i.options):b(i,r,n,e,u,d);break;case C.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE:o=v(i,r,n);break;case C.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC:case C.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC:o=b(i,r,n,e,u,d);break;case C.Bond.PATTERN.TYPE.ANY:o=M.default.bondAny(i.paper,r,n,i.options);break;default:throw new Error("Bond type "+e.b.type+" not supported")}return o}function l(t,e,r,n,o){var i=e.p,a=r.p,s=e.norm,u=t.options,l=.7*u.stereoBond,c=a.addScaled(s,l),f=a.addScaled(s,-l);if(n.neihbid2>=0){var d=p(r,n.neihbid2,u.stereoBond,o);c=d[0],f=d[1]}return M.default.bondSingleUp(t.paper,i,c,f,u)}function c(t,e,r,n,o){var i=t.options,a=p(e,n.neihbid1,i.stereoBond,o),s=p(r,n.neihbid2,i.stereoBond,o),u=a[0],l=a[1],c=s[0],f=s[1];return M.default.bondSingleStereoBold(t.paper,u,l,c,f,i)}function f(t,e,r,n,o,i,a){var s=e.p,u=r.p,l=e.norm,f=n.doubleBondShift,p=1.5*t.options.stereoBond,h=s.addScaled(l,p*f),m=u.addScaled(l,p*f);f>0?(i&&(h=h.addScaled(e.dir,p*d(e.rightCos,e.rightSin))),a&&(m=m.addScaled(e.dir,-p*d(r.leftCos,r.leftSin)))):f<0&&(i&&(h=h.addScaled(e.dir,p*d(e.leftCos,e.leftSin))),a&&(m=m.addScaled(e.dir,-p*d(r.rightCos,r.rightSin))));var g=c(t,e,r,n,o);return M.default.bondDoubleStereoBold(t.paper,g,h,m,t.options)}function d(t,e){return e<0||Math.abs(t)>.9?0:e/(1-t)}function p(t,e,r,n){var o=n.halfBonds.get(e),i=N.default.dot(t.dir,o.dir),a=N.default.cross(t.dir,o.dir),s=Math.sqrt(.5*(1-i)),u=o.dir.rotateSC((a>=0?-1:1)*s,Math.sqrt(.5*(1+i))),l=t.p.addScaled(u,.7*r/(s+.3)),c=t.p.addScaled(u.negated(),.7*r/(s+.3));return a>0?[l,c]:[c,l]}function h(t,e,r){var n=e.p,o=r.p,i=t.options,a=o.sub(n),s=a.length()+.2;a=a.normalized();var u=1.2*i.lineWidth,l=Math.max(Math.floor((s-i.lineWidth)/(i.lineWidth+u)),0)+2,c=s/(l-1);return M.default.bondSingleDown(t.paper,e,a,l,c,i)}function m(t,e,r){var n=e.p,o=r.p,i=t.options,a=o.sub(n),s=a.length();a=a.normalized();var u=.6*i.lineWidth,l=Math.max(Math.floor((s-i.lineWidth)/(i.lineWidth+u)),0)+2,c=s/(l-.5);return M.default.bondSingleEither(t.paper,e,a,l,c,i)}function g(t,e,r,n,o,i){var a=n.b.stereo===C.Bond.PATTERN.STEREO.CIS_TRANS,s=e.p,u=r.p,l=e.norm,c=a?0:n.doubleBondShift,f=t.options,p=f.bondSpace/2,h=p+c*p,m=c*p-p,g=s.addScaled(l,h),v=u.addScaled(l,h),b=s.addScaled(l,m),y=u.addScaled(l,m);return c>0?(o&&(g=g.addScaled(e.dir,f.bondSpace*d(e.rightCos,e.rightSin))),i&&(v=v.addScaled(e.dir,-f.bondSpace*d(r.leftCos,r.leftSin)))):c<0&&(o&&(b=b.addScaled(e.dir,f.bondSpace*d(e.leftCos,e.leftSin))),i&&(y=y.addScaled(e.dir,-f.bondSpace*d(r.rightCos,r.rightSin)))),M.default.bondDouble(t.paper,g,b,v,y,a,f)}function v(t,e,r){var n=e.p,o=r.p,i=t.options,a=(N.default.dist(n,o)/(i.bondSpace+i.lineWidth)).toFixed()-0;return 1&a||(a+=1),M.default.bondSingleOrDouble(t.paper,e,r,a,i)}function b(t,e,r,n,o,i){var a=[.125,.125,.005,.125],s=null,u=null,l=t.options,c=n.doubleBondShift;n.b.type===C.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC&&(s=c>0?1:2,u=a.map(function(t){return t*l.scale})),n.b.type===C.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC&&(s=3,u=a.map(function(t){return t*l.scale}));var f=y(e,r,c,o,i,l.bondSpace,s,u);return M.default.bondAromatic(t.paper,f,c,l)}function y(t,e,r,n,o,i,a,s){var u=t.p,l=e.p,c=t.norm,f=i/2,p=f+r*f,h=r*f-f,m=u.addScaled(c,p),g=l.addScaled(c,p),v=u.addScaled(c,h),b=l.addScaled(c,h);return r>0?(n&&(m=m.addScaled(t.dir,i*d(t.rightCos,t.rightSin))),o&&(g=g.addScaled(t.dir,-i*d(e.leftCos,e.leftSin)))):r<0&&(n&&(v=v.addScaled(t.dir,i*d(t.leftCos,t.leftSin))),o&&(b=b.addScaled(t.dir,-i*d(e.rightCos,e.rightSin)))),M.default.aromaticBondPaths(m,v,g,b,a,s)}function _(t,e,r,n){var o=r.p,i=n.p,a=i.add(o).scaled(.5),s=i.sub(o).normalized(),u=s.rotateSC(1,0),l=[],c=t.options.lineWidth,f=t.options.bondSpace/2,d=c,p=2*c,h=1.5*f,m=1.5*f,g=3*f;switch(e.b.reactingCenterStatus){case C.Bond.PATTERN.REACTING_CENTER.NOT_CENTER:l.push(a.addScaled(u,g).addScaled(s,.2*g)),l.push(a.addScaled(u,-g).addScaled(s,-.2*g)),l.push(a.addScaled(u,g).addScaled(s,-.2*g)),l.push(a.addScaled(u,-g).addScaled(s,.2*g));break;case C.Bond.PATTERN.REACTING_CENTER.CENTER:l.push(a.addScaled(u,g).addScaled(s,.2*g).addScaled(s,d)),l.push(a.addScaled(u,-g).addScaled(s,-.2*g).addScaled(s,d)),l.push(a.addScaled(u,g).addScaled(s,.2*g).addScaled(s,-d)),l.push(a.addScaled(u,-g).addScaled(s,-.2*g).addScaled(s,-d)),l.push(a.addScaled(s,h).addScaled(u,m)),l.push(a.addScaled(s,-h).addScaled(u,m)),l.push(a.addScaled(s,h).addScaled(u,-m)),l.push(a.addScaled(s,-h).addScaled(u,-m));break;case C.Bond.PATTERN.REACTING_CENTER.MADE_OR_BROKEN:l.push(a.addScaled(u,g).addScaled(s,p)),l.push(a.addScaled(u,-g).addScaled(s,p)),l.push(a.addScaled(u,g).addScaled(s,-p)),l.push(a.addScaled(u,-g).addScaled(s,-p));break;case C.Bond.PATTERN.REACTING_CENTER.ORDER_CHANGED:l.push(a.addScaled(u,g)),l.push(a.addScaled(u,-g));break;case C.Bond.PATTERN.REACTING_CENTER.MADE_OR_BROKEN_AND_CHANGED:l.push(a.addScaled(u,g).addScaled(s,p)),l.push(a.addScaled(u,-g).addScaled(s,p)),l.push(a.addScaled(u,g).addScaled(s,-p)),l.push(a.addScaled(u,-g).addScaled(s,-p)),l.push(a.addScaled(u,g)),l.push(a.addScaled(u,-g));break;default:return null}return M.default.reactingCenter(t.paper,l,t.options)}function x(t,e,r,n){var o=t.options,i=null;if(e.b.topology===C.Bond.PATTERN.TOPOLOGY.RING)i="rng";else{if(e.b.topology!==C.Bond.PATTERN.TOPOLOGY.CHAIN)return null;i="chn"}var a=r.p,s=n.p,u=s.add(a).scaled(.5),l=s.sub(a).normalized(),c=l.rotateSC(1,0),f=o.lineWidth;e.doubleBondShift>0?c=c.scaled(-e.doubleBondShift):0==e.doubleBondShift&&(f+=o.bondSpace/2);var d=new N.default(2,1).scaled(o.bondSpace);e.b.type==C.Bond.PATTERN.TYPE.TRIPLE&&(f+=o.bondSpace);var p=u.add(new N.default(c.x*(d.x+f),c.y*(d.y+f)));return M.default.topologyMark(t.paper,p,i,o)}function w(t,e,r,n,o,i,a,s){var u=N.default.lc(r.p,i,n.p,a,s,o),l=e.text(u.x,u.y,t.toString()),c=B.default.relBox(l.getBBox());return M.default.recenterText(l,c),l}function S(t,e){var r,n;if(r=e.halfBonds.get(t.b.hb1).loop,n=e.halfBonds.get(t.b.hb2).loop,r>=0&&n>=0){var o=e.loops.get(r).dblBonds,i=e.loops.get(n).dblBonds,a=e.loops.get(r).hbs.length,s=e.loops.get(n).hbs.length;t.doubleBondShift=E(a,s,o,i)}else t.doubleBondShift=r>=0?-1:n>=0?1:j(e,t)}function O(t,e,r){var n=e.render,o=e.atoms.get(t.b.begin),i=e.atoms.get(t.b.end),a=D.default.obj2scaled(o.a.pp,n.options),s=D.default.obj2scaled(i.a.pp,n.options),u=e.molecule.halfBonds.get(t.b.hb1),l=e.molecule.halfBonds.get(t.b.hb2);u.p=A(o,a,u.dir,2*r.lineWidth),l.p=A(i,s,l.dir,2*r.lineWidth),t.b.center=N.default.lc2(o.a.pp,.5,i.a.pp,.5),t.b.len=N.default.dist(a,s),t.b.sb=5*r.lineWidth,t.b.sa=Math.max(t.b.sb,t.b.len/2-2*r.lineWidth),t.b.angle=180*Math.atan2(u.dir.y,u.dir.x)/Math.PI}function A(t,e,r,n){for(var o=0,i=t.visel,a=0;a<i.exts.length;++a){var s=i.exts[a].translate(e);o=Math.max(o,B.default.shiftRayBox(e,r,s))}return o>0&&(e=e.addScaled(r,o+n)),e}function E(t,e,r,n){return 6==t&&6!=e&&(r>1||1==n)?-1:6==e&&6!=t&&(n>1||1==r)?1:e*r>t*n?-1:e*r<t*n?1:e>t?-1:1}function j(t,e){var r=t.halfBonds.get(e.b.hb1),n=t.halfBonds.get(e.b.hb2),o=(r.leftSin>.3?1:0)+(n.rightSin>.3?1:0),i=(n.leftSin>.3?1:0)+(r.rightSin>.3?1:0);return o>i?-1:o<i?1:(r.leftSin>.3?1:0)+(r.rightSin>.3?1:0)==1?1:0}Object.defineProperty(r,"__esModule",{value:!0});var P=t("./reobject"),T=n(P),C=t("../../chem/struct"),k=t("../draw"),M=n(k),R=t("../../util/vec2"),N=n(R),I=t("../util"),B=n(I),L=t("../../util/scale"),D=n(L);o.prototype=new T.default,o.isSelectable=function(){return!0},o.prototype.drawHighlight=function(t){var e=this.makeHighlightPlate(t);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeHighlightPlate=function(t){var e=t.options;O(this,t.ctab,e);var r=D.default.obj2scaled(this.b.center,e);return t.paper.circle(r.x,r.y,.8*e.atomSelectionPlateRadius).attr(e.highlightStyle)},o.prototype.makeSelectionPlate=function(t,e,r){O(this,t,r);var n=D.default.obj2scaled(this.b.center,r);return e.circle(n.x,n.y,.8*r.atomSelectionPlateRadius).attr(r.selectionStyle)},o.prototype.show=function(t,e,r){var n=t.render,o=t.molecule,i=n.paper,a=o.halfBonds.get(this.b.hb1),l=o.halfBonds.get(this.b.hb2);s(e,this,t),O(this,t,r),S(this,o),this.path=u(t,this,a,l),this.rbb=B.default.relBox(this.path.getBBox()),t.addReObjectPath("data",this.visel,this.path,null,!0);var c={};c.path=_(n,this,a,l),c.path&&(c.rbb=B.default.relBox(c.path.getBBox()),t.addReObjectPath("data",this.visel,c.path,null,!0));var f={};f.path=x(n,this,a,l),f.path&&(f.rbb=B.default.relBox(f.path.getBBox()),t.addReObjectPath("data",this.visel,f.path,null,!0)),this.setHighlight(this.highlight,n);var d=null,p=.6*r.subFontSize;r.showBondIds&&(d=w(e,i,a,l,p,.5,.5,a.norm),t.addReObjectPath("indices",this.visel,d)),r.showHalfBondIds&&(d=w(this.b.hb1,i,a,l,p,.8,.2,a.norm),t.addReObjectPath("indices",this.visel,d),d=w(this.b.hb2,i,a,l,p,.2,.8,l.norm),t.addReObjectPath("indices",this.visel,d)),r.showLoopIds&&!r.showBondIds&&(d=w(a.loop,i,a,l,p,.5,.5,l.norm),t.addReObjectPath("indices",this.visel,d),d=w(l.loop,i,a,l,p,.5,.5,a.norm),t.addReObjectPath("indices",this.visel,d))},r.default=o},{"../../chem/struct":542,"../../util/scale":690,"../../util/vec2":691,"../draw":590,"../util":606,"./reobject":600}],596:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("chiralFlag"),this.pp=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/box2abs"),a=n(i),s=t("../../util/scale"),u=n(s),l=t("./reobject"),c=n(l);o.prototype=new c.default,o.isSelectable=function(){return!0},o.prototype.highlightPath=function(t){var e=a.default.fromRelBox(this.path.getBBox()),r=e.p1.sub(e.p0),n=e.p0.sub(t.options.offset);return t.paper.rect(n.x,n.y,r.x,r.y)},o.prototype.drawHighlight=function(t){if(!this.path)return null;var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeSelectionPlate=function(t,e,r){return this.path?this.highlightPath(t.render).attr(r.selectionStyle):null},o.prototype.show=function(t,e,r){var n=t.render;if(!(t.chiralFlagsChanged[e]<=0)){var o=n.paper,i=u.default.obj2scaled(this.pp,r);this.path=o.text(i.x,i.y,"Chiral").attr({font:r.font,"font-size":r.fontsz,fill:"#000"}),n.ctab.addReObjectPath("data",this.visel,this.path,null,!0)}},r.default=o},{"../../util/box2abs":687,"../../util/scale":690,"./reobject":600}],597:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("sgroupData"),this.sgroup=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./reobject"),a=n(i),s=t("../../util/scale"),u=n(s);o.prototype=new a.default,o.isSelectable=function(){return!0},o.prototype.highlightPath=function(t){var e=this.sgroup.dataArea,r=u.default.obj2scaled(e.p0,t.options),n=u.default.obj2scaled(e.p1,t.options).sub(r);return t.paper.rect(r.x,r.y,n.x,n.y)},o.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeSelectionPlate=function(t,e,r){return this.highlightPath(t.render).attr(r.selectionStyle)},r.default=o},{"../../util/scale":690,"./reobject":600}],598:[function(t,e,r){(function(e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("frag"),this.item=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/box2abs"),a=n(i),s=t("../../util/vec2"),u=n(s),l=t("./reobject"),c=n(l),f=t("../../util/scale"),d=n(f);o.prototype=new c.default,o.isSelectable=function(){return!1},o.prototype.fragGetAtoms=function(t,e){return Array.from(t.atoms.keys()).filter(function(r){return t.atoms.get(r).a.fragment===e})},o.prototype.fragGetBonds=function(t,e){return Array.from(t.bonds.keys()).filter(function(r){var n=t.bonds.get(r).b,o=t.atoms.get(n.begin).a.fragment,i=t.atoms.get(n.end).a.fragment;return o===e&&i===e})},o.prototype.calcBBox=function(t,r,n){var o;return t.atoms.forEach(function(t){if(t.a.fragment===r){var i=t.visel.boundingBox;if(i)n||(n=e._ui_editor.render),i=i.translate((n.options.offset||new u.default).negated()).transform(d.default.scaled2obj,n.options);else{i=new a.default(t.a.pp,t.a.pp);var s=new u.default(.05*3,.05*3);i=i.extend(s,s)}o=o?a.default.union(o,i):i}}),o},o.prototype._draw=function(t,e,r){var n=this.calcBBox(t.ctab,e,t);if(n){var o=d.default.obj2scaled(new u.default(n.p0.x,n.p0.y),t.options),i=d.default.obj2scaled(new u.default(n.p1.x,n.p1.y),t.options);return t.paper.rect(o.x,o.y,i.x-o.x,i.y-o.y,0).attr(r)}return console.assert(null,"Empty fragment")},o.prototype.draw=function(t){return null},o.prototype.drawHighlight=function(t){},o.prototype.setHighlight=function(t,e){var r=e.ctab.frags.keyOf(this);if(!r&&0!==r)return void console.warn("Fragment does not belong to the render");r=parseInt(r,10),e.ctab.atoms.forEach(function(n){n.a.fragment===r&&n.setHighlight(t,e)}),e.ctab.bonds.forEach(function(n){e.ctab.atoms.get(n.b.begin).a.fragment===r&&n.setHighlight(t,e)})},r.default=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../util/box2abs":687,"../../util/scale":690,"../../util/vec2":691,"./reobject":600}],599:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.loop=t,this.visel=new u.default("loop"),this.centre=new a.default,this.radius=new a.default}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/vec2"),a=n(i),s=t("./visel"),u=n(s),l=t("./reobject"),c=n(l),f=t("../../util/scale"),d=n(f),p=t("../util"),h=n(p),m=t("../../chem/struct"),g=h.default.tfx;o.prototype=new c.default,o.isSelectable=function(){return!1},o.prototype.show=function(t,e,r){var n=this,o=t.render,i=o.paper,s=t.molecule,u=this.loop;this.centre=new a.default,u.hbs.forEach(function(e){var o=s.halfBonds.get(e),i=t.bonds.get(o.bid),a=d.default.obj2scaled(t.atoms.get(o.begin).a.pp,r);i.b.type!==m.Bond.PATTERN.TYPE.AROMATIC&&(u.aromatic=!1),n.centre.add_(a)}),u.convex=!0;for(var l=0;l<this.loop.hbs.length;++l){var c=s.halfBonds.get(u.hbs[l]),f=s.halfBonds.get(u.hbs[(l+1)%u.hbs.length]),p=Math.atan2(a.default.cross(c.dir,f.dir),a.default.dot(c.dir,f.dir));p>0&&(u.convex=!1)}if(this.centre=this.centre.scaled(1/u.hbs.length),this.radius=-1,u.hbs.forEach(function(e){var o=s.halfBonds.get(e),i=d.default.obj2scaled(t.atoms.get(o.begin).a.pp,r),u=d.default.obj2scaled(t.atoms.get(o.end).a.pp,r),l=a.default.diff(u,i).rotateSC(1,0).normalized(),c=a.default.dot(a.default.diff(i,n.centre),l);n.radius=n.radius<0?c:Math.min(n.radius,c)}),this.radius*=.7,u.aromatic){var h=null;if(u.convex&&r.aromaticCircle)h=i.circle(this.centre.x,this.centre.y,this.radius).attr({stroke:"#000","stroke-width":r.lineattr["stroke-width"]});else{var v="";for(l=0;l<u.hbs.length;++l){c=s.halfBonds.get(u.hbs[l]),f=s.halfBonds.get(u.hbs[(l+1)%u.hbs.length]),p=Math.atan2(a.default.cross(c.dir,f.dir),a.default.dot(c.dir,f.dir));var b=(Math.PI-p)/2,y=f.dir.rotate(b),_=d.default.obj2scaled(t.atoms.get(f.begin).a.pp,r),x=Math.sin(b);Math.abs(x)<.1&&(x=.1*x/Math.abs(x));var w=r.bondSpace/x,S=_.addScaled(y,-w);v+=0===l?"M":"L",v+=g(S.x)+","+g(S.y)}v+="Z",h=i.path(v).attr({stroke:"#000","stroke-width":r.lineattr["stroke-width"],"stroke-dasharray":"- "})}t.addReObjectPath("data",this.visel,h,null,!0)}},o.prototype.isValid=function(t,e){var r=t.halfBonds;return this.loop.hbs.every(function(t){return r.has(t)&&r.get(t).loop===e})},r.default=o},{"../../chem/struct":542,"../../util/scale":690,"../../util/vec2":691,"../util":606,"./reobject":600,"./visel":605}],600:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(){}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./visel"),a=n(i),s=t("../../util/scale"),u=n(s);o.prototype.init=function(t){this.visel=new a.default(t),this.highlight=!1,this.highlighting=null,this.selected=!1,this.selectionPlate=null},o.prototype.getVBoxObj=function(t){var e=this.visel.boundingBox;return null===e?null:(t.options.offset&&(e=e.translate(t.options.offset.negated())),e.transform(u.default.scaled2obj,t.options))},o.prototype.setHighlight=function(t,e){if(t){var r="highlighting"in this&&null!==this.highlighting;if(r)if("set"===this.highlighting.type){if(!this.highlighting[0])return;r=!this.highlighting[0].removed}else r=!this.highlighting.removed;r?this.highlighting.show():(e.paper.setStart(),this.drawHighlight(e),this.highlighting=e.paper.setFinish())}else this.highlighting&&this.highlighting.hide();this.highlight=t},o.prototype.drawHighlight=function(){console.assert("ReObject.drawHighlight is not overridden")},o.prototype.makeSelectionPlate=function(){console.assert(null,"ReObject.makeSelectionPlate is not overridden")},r.default=o},{"../../util/scale":690,"./visel":605}],601:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("rgroup"),this.labelBox=null,this.item=t}function i(t,e,r,n){n=g.default.obj2scaled(n||new c.default(1,0),e.options);var o=Math.min(.25,.3*r.sz().x),i=r.p1.y-r.p0.y,a=.5*(r.p1.y+r.p0.y),s=h.default.bracket(e.paper,n.negated(),n.negated().rotateSC(1,0),g.default.obj2scaled(new c.default(r.p0.x,a),e.options),o,i,e.options),u=h.default.bracket(e.paper,n,n.rotateSC(1,0),g.default.obj2scaled(new c.default(r.p1.x,a),e.options),o,i,e.options);return t.push(s,u)}function a(t,e){var r=e.ifthen>0?"IF ":"",n=e.range.startsWith(">")||e.range.startsWith("<")||e.range.startsWith("="),o=null;o=e.range.length>0?n?e.range:"="+e.range:">0";var i=e.resth?" (RestH)":"",a=e.ifthen>0?"\nTHEN R"+e.ifthen.toString():"";return r+"R"+t.toString()+o+i+a}Object.defineProperty(r,"__esModule",{value:!0});var s=t("../../util/box2abs"),u=n(s),l=t("../../util/vec2"),c=n(l),f=t("../util"),d=n(f),p=t("../draw"),h=n(p),m=t("../../util/scale"),g=n(m),v=t("./reobject"),b=n(v),y=new c.default(.05*3,.05*3);o.prototype=new b.default,o.isSelectable=function(){return!1},o.prototype.getAtoms=function(t){var e=[];return this.item.frags.forEach(function(r){e=e.concat(t.ctab.frags.get(r).fragGetAtoms(t.ctab,r))}),e},o.prototype.getBonds=function(t){var e=[];return this.item.frags.forEach(function(r){e=e.concat(t.ctab.frags.get(r).fragGetBonds(t.ctab,r))}),e},o.prototype.calcBBox=function(t){var e=null;return this.item.frags.forEach(function(r){var n=t.ctab.frags.get(r).calcBBox(t.ctab,r,t);n&&(e=e?u.default.union(e,n):n)}),e&&(e=e.extend(y,y)),e},o.prototype.draw=function(t,e){var r=this.calcBBox(t);if(!r)return console.error("Abnormal situation, empty fragments must be destroyed by tools"),{};var n={data:[]},o=g.default.obj2scaled(r.p0,e),s=g.default.obj2scaled(r.p1,e),l=t.paper.set();i(l,t,r),n.data.push(l);var c=t.ctab.rgroups.keyOf(this),f=t.paper.set(),p=t.paper.text(o.x,(o.y+s.y)/2,"R"+c+"=").attr({font:e.font,"font-size":e.fontRLabel,fill:"black"}),h=d.default.relBox(p.getBBox());p.translateAbs(-h.width/2-e.lineWidth,0),f.push(p);for(var m={font:e.font,"font-size":e.fontRLogic,fill:"black"},v=[a(c,this.item)],b=h.height/2+e.lineWidth/2,y=0;y<v.length;++y){var _=t.paper.text(o.x,(o.y+s.y)/2,v[y]).attr(m),x=d.default.relBox(_.getBBox());b+=x.height/2,_.translateAbs(-x.width/2-6*e.lineWidth,b),b+=x.height/2+e.lineWidth/2,n.data.push(_),f.push(_)}return n.data.push(p),this.labelBox=u.default.fromRelBox(f.getBBox()).transform(g.default.scaled2obj,t.options),n},o.prototype._draw=function(t,e,r){var n=this.getVBoxObj(t).extend(y,y);if(!n)return null;var o=g.default.obj2scaled(n.p0,t.options),i=g.default.obj2scaled(n.p1,t.options);return t.paper.rect(o.x,o.y,i.x-o.x,i.y-o.y,0).attr(r)},o.prototype.drawHighlight=function(t){var e=t.ctab.rgroups.keyOf(this);if(!e)return console.error("Abnormal situation, fragment does not belong to the render"),null;var r=this._draw(t,e,t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,r),this.item.frags.forEach(function(e,r){t.ctab.frags.get(r).drawHighlight(t)}),r},o.prototype.show=function(t,e,r){var n=this,o=this.draw(t.render,r);Object.keys(o).forEach(function(e){for(;o[e].length>0;)t.addReObjectPath(e,n.visel,o[e].shift(),null,!0)})},r.default=o},{"../../util/box2abs":687,"../../util/scale":690,"../../util/vec2":691,"../draw":590,"../util":606,"./reobject":600}],602:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("rxnArrow"),this.item=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./reobject"),a=n(i),s=t("../../util/box2abs"),u=n(s),l=t("../../util/vec2"),c=n(l),f=t("../draw"),d=n(f),p=t("../util"),h=n(p),m=t("../../util/scale"),g=n(m);o.prototype=new a.default,o.isSelectable=function(){return!0},o.prototype.highlightPath=function(t){var e=g.default.obj2scaled(this.item.pp,t.options),r=t.options.scale;return t.paper.rect(e.x-r,e.y-r/4,2*r,r/2,r/8)},o.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeSelectionPlate=function(t,e,r){return this.highlightPath(t.render).attr(r.selectionStyle)},o.prototype.show=function(t,e,r){var n=t.render,o=g.default.obj2scaled(this.item.pp,r),i=d.default.arrow(n.paper,new c.default(o.x-r.scale,o.y),new c.default(o.x+r.scale,o.y),r),a=r.offset;null!=a&&i.translateAbs(a.x,a.y),this.visel.add(i,u.default.fromRelBox(h.default.relBox(i.getBBox())))},r.default=o},{"../../util/box2abs":687,"../../util/scale":690,"../../util/vec2":691,"../draw":590,"../util":606,"./reobject":600}],603:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("rxnPlus"),this.item=t}Object.defineProperty(r,"__esModule",{value:!0});var i=t("./reobject"),a=n(i),s=t("../../util/box2abs"),u=n(s),l=t("../draw"),c=n(l),f=t("../util"),d=n(f),p=t("../../util/scale"),h=n(p);o.prototype=new a.default,o.isSelectable=function(){return!0},o.prototype.highlightPath=function(t){var e=h.default.obj2scaled(this.item.pp,t.options),r=t.options.scale;return t.paper.rect(e.x-r/4,e.y-r/4,r/2,r/2,r/8)},o.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},o.prototype.makeSelectionPlate=function(t,e,r){return this.highlightPath(t.render).attr(r.selectionStyle)},o.prototype.show=function(t,e,r){var n=t.render,o=h.default.obj2scaled(this.item.pp,r),i=c.default.plus(n.paper,o,r),a=r.offset;null!=a&&i.translateAbs(a.x,a.y),this.visel.add(i,u.default.fromRelBox(d.default.relBox(i.getBBox())))},r.default=o},{"../../util/box2abs":687,"../../util/scale":690,"../draw":590,"../util":606,"./reobject":600}],604:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.init("sgroup"),this.item=t}function i(t,e,r,n,o,i,a,s,u,l){function c(r,n){var o=S.default.obj2scaled(b.c.addScaled(b.n,n*b.h),e.options),i=e.paper.text(o.x,o.y,r).attr({font:e.options.font,"font-size":e.options.fontszsub});l&&i.attr(l);var a=m.default.fromRelBox(x.default.relBox(i.getBBox())),s=Math.max(x.default.shiftRayBox(o,b.d.negated(),a),3)+2;i.translateAbs(s*b.d.x,s*b.d.y),t.push(i)}for(var f=p(e.ctab.molecule,n,o,i,a,e,r.id),d=-1,h=0;h<f.length;++h){
  var g=f[h],v=E.default.bracket(e.paper,S.default.obj2scaled(g.d,e.options),S.default.obj2scaled(g.n,e.options),S.default.obj2scaled(g.c,e.options),g.w,g.h,e.options);t.push(v),(d<0||f[d].d.x<g.d.x||f[d].d.x==g.d.x&&f[d].d.y>g.d.y)&&(d=h)}var b=f[d];s&&c(s,.5),u&&c(u,-.5)}function a(t,e,r,n){var o=t.text(e.x,e.y,r.data.fieldValue).attr({font:n.font,"font-size":n.fontsz}),i=o.getBBox(),a=t.rect(i.x-1,i.y-1,i.width+2,i.height+2,3,3);a=r.selected?a.attr(n.selectionStyle):a.attr({fill:"#fff",stroke:"#fff"});var s=t.set();return s.push(a,o.toFront()),s}function s(t,e){return d(e,t.render,t.molecule),e.areas=e.bracketBox?[e.bracketBox]:[],null===e.pp&&(e.pp=u(t,e)),e.data.attached?f(t,e):c(t,e)}function u(t,e){for(var r=e.bracketBox.p1.add(new v.default(.5,.5)),n=Array.from(t.molecule.sgroups.values()),o=0;o<t.molecule.sgroups.size&&l(n,r);++o)r=r.add(new v.default(0,.5));return r}function l(t,e){return t.some(function(t){if(!t.pp)return!1;var r=t.pp.add(new v.default(.5,.5)),n=e.add(new v.default(.5,.5));return m.default.segmentIntersection(t.pp,r,e,n)})}function c(t,e){var r=t.render,n=r.options,o=r.paper,i=o.set(),s=e.pp.scaled(n.scale),u=a(o,s,e,n),l=x.default.relBox(u.getBBox());u.translateAbs(.5*l.width,-.5*l.height),i.push(u);var c=m.default.fromRelBox(x.default.relBox(u.getBBox()));return e.dataArea=c.transform(S.default.scaled2obj,r.options),t.sgroupData.has(e.id)||t.sgroupData.set(e.id,new P.default(e)),i}function f(t,e){var r=t.render,n=r.options,o=r.paper,i=o.set();return O.SGroup.getAtoms(t,e).forEach(function(s){var u=t.atoms.get(s),l=S.default.obj2scaled(u.a.pp,n),c=u.visel.boundingBox;null!==c&&(l.x=Math.max(l.x,c.p1.x)),l.x+=n.lineWidth;var f=a(o,l,e,n),d=x.default.relBox(f.getBBox());f.translateAbs(.5*d.width,-.3*d.height),i.push(f);var p=m.default.fromRelBox(x.default.relBox(f.getBBox()));p=p.transform(S.default.scaled2obj,r.options),e.areas.push(p)}),i}function d(t,e,r,n){var o=t.atoms;if(n&&2===n.length){var i=r.bonds.get(n[0]).getCenter(r),a=r.bonds.get(n[1]).getCenter(r);t.bracketDir=v.default.diff(a,i).normalized()}else t.bracketDir=new v.default(1,0);var s=t.bracketDir,u=null,l=[];o.forEach(function(t){var n=r.atoms.get(t),o=e?e.ctab.atoms.get(t).visel.boundingBox:null;if(o)o=o.translate((e.options.offset||new v.default).negated()).transform(S.default.scaled2obj,e.options);else{var i=new v.default(n.pp),a=new v.default(.05*3,.05*3);o=new m.default(i,i).extend(a,a)}l.push(o)}),r.sGroupForest.children.get(t.id).forEach(function(t){var r=e.ctab.sgroups.get(t).visel.boundingBox;r=r.translate((e.options.offset||new v.default).negated()).transform(S.default.scaled2obj,e.options),l.push(r)}),l.forEach(function(t){var e=null;[t.p0.x,t.p1.x].forEach(function(r){[t.p0.y,t.p1.y].forEach(function(t){var n=new v.default(r,t),o=new v.default(v.default.dot(n,s),v.default.dot(n,s.rotateSC(1,0)));e=null===e?new m.default(o,o):e.include(o)})}),u=null===u?e:m.default.union(u,e)});var c=new v.default(.2,.4);null!==u&&(u=u.extend(c,c)),t.bracketBox=u}function p(t,e,r,n,o,i,a){function s(t,e,r,n){this.c=t,this.d=e,this.n=e.rotateSC(1,0),this.w=r,this.h=n}var u=[],l=o.rotateSC(1,0);return e.length<2?function(){o=o||new v.default(1,0),l=l||o.rotateSC(1,0);var t=Math.min(.25,.3*n.sz().x),e=v.default.lc2(o,n.p0.x,l,.5*(n.p0.y+n.p1.y)),r=v.default.lc2(o,n.p1.x,l,.5*(n.p0.y+n.p1.y)),i=n.sz().y;u.push(new s(e,o.negated(),t,i),new s(r,o,t,i))}():2===e.length?function(){var r=t.bonds.get(e[0]),n=t.bonds.get(e[1]),o=r.getCenter(t),l=n.getCenter(t),c=-1,f=-1,d=-1,p=-1,h=v.default.centre(o,l),m=v.default.diff(l,o).normalized(),g=m.negated(),b=m.rotateSC(1,0),y=b.negated();t.sGroupForest.children.get(a).forEach(function(t){var e=i.ctab.sgroups.get(t).visel.boundingBox;e=e.translate((i.options.offset||new v.default).negated()).transform(S.default.scaled2obj,i.options),c=Math.max(c,x.default.shiftRayBox(o,g,e)),f=Math.max(f,x.default.shiftRayBox(l,m,e)),d=Math.max(d,x.default.shiftRayBox(h,b,e)),p=Math.max(p,x.default.shiftRayBox(h,y,e))},this),c=Math.max(c+.2,0),f=Math.max(f+.2,0),d=Math.max(Math.max(d,p)+.1,0);var _=1.5+d;u.push(new s(o.addScaled(g,c),g,.25,_),new s(l.addScaled(m,f),m,.25,_))}():function(){for(var n=0;n<e.length;++n){var o=t.bonds.get(e[n]),i=o.getCenter(t),a=r.has(o.begin)?o.getDir(t):o.getDir(t).negated();u.push(new s(i,a,.2,1))}}(),u}Object.defineProperty(r,"__esModule",{value:!0});var h=t("../../util/box2abs"),m=n(h),g=t("../../util/vec2"),v=n(g),b=t("../../util/pile"),y=n(b),_=t("../util"),x=n(_),w=t("../../util/scale"),S=n(w),O=t("../../chem/struct"),A=t("../draw"),E=n(A),j=t("./redatasgroupdata"),P=n(j),T=t("./reobject"),C=n(T),k=x.default.tfx;o.prototype=new C.default,o.isSelectable=function(){return!1},o.prototype.draw=function(t,e){var r=t.render,n=r.paper.set(),o=[],a=[],u=new y.default(e.atoms);O.SGroup.getCrossBonds(o,a,t.molecule,u),d(e,r,t.molecule,a);var l=e.bracketBox,c=e.bracketDir;switch(e.areas=[l],e.type){case"MUL":i(n,r,e,a,u,l,c,e.data.mul);break;case"SRU":var f=e.data.connectivity||"eu";"ht"==f&&(f="");i(n,r,e,a,u,l,c,e.data.subscript||"n",f);break;case"SUP":i(n,r,e,a,u,l,c,e.data.name,null,{"font-style":"italic"});break;case"GEN":i(n,r,e,a,u,l,c);break;case"DAT":n=s(t,e)}return n},o.prototype.drawHighlight=function(t){var e=t.options,r=t.paper,n=this.item,o=n.bracketBox.transform(S.default.obj2scaled,e),i=e.lineWidth,a=new v.default(4*i,6*i);o=o.extend(a,a);var s=n.bracketDir,u=s.rotateSC(1,0),l=v.default.lc2(s,o.p0.x,u,o.p0.y),c=v.default.lc2(s,o.p0.x,u,o.p1.y),f=v.default.lc2(s,o.p1.x,u,o.p0.y),d=v.default.lc2(s,o.p1.x,u,o.p1.y),p=r.set();n.highlighting=r.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}L{0},{1}",k(l.x),k(l.y),k(c.x),k(c.y),k(d.x),k(d.y),k(f.x),k(f.y)).attr(e.highlightStyle),p.push(n.highlighting),O.SGroup.getAtoms(t.ctab.molecule,n).forEach(function(e){p.push(t.ctab.atoms.get(e).makeHighlightPlate(t))},this),O.SGroup.getBonds(t.ctab.molecule,n).forEach(function(e){p.push(t.ctab.bonds.get(e).makeHighlightPlate(t))},this),t.ctab.addReObjectPath("highlighting",this.visel,p)},o.prototype.show=function(t){var e=t.render,r=this.item;if("MRV_IMPLICIT_H"!==r.data.fieldName){var n=e.ctab,o=this.draw(n,r);t.addReObjectPath("data",this.visel,o,null,!0),this.setHighlight(this.highlight,e)}},r.default=o},{"../../chem/struct":542,"../../util/box2abs":687,"../../util/pile":688,"../../util/scale":690,"../../util/vec2":691,"../draw":590,"../util":606,"./redatasgroupdata":597,"./reobject":600}],605:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){this.type=t,this.paths=[],this.boxes=[],this.boundingBox=null}Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../util/box2abs"),a=n(i),s=t("../../util/vec2"),u=n(s);o.prototype.add=function(t,e,r){this.paths.push(t),e&&(this.boxes.push(e),this.boundingBox=null==this.boundingBox?e:a.default.union(this.boundingBox,e)),r&&this.exts.push(r)},o.prototype.clear=function(){this.paths=[],this.boxes=[],this.exts=[],this.boundingBox=null},o.prototype.translate=function(t,e){if(arguments.length>2)throw new Error("One vector or two scalar arguments expected");if(void 0===e)this.translate(t.x,t.y);else{for(var r=new u.default(t,e),n=0;n<this.paths.length;++n)this.paths[n].translateAbs(t,e);for(var o=0;o<this.boxes.length;++o)this.boxes[o]=this.boxes[o].translate(r);null!==this.boundingBox&&(this.boundingBox=this.boundingBox.translate(r))}},r.default=o},{"../../util/box2abs":687,"../../util/vec2":691}],606:[function(t,e,r){"use strict";function n(t){return parseFloat(t).toFixed(8)}function o(t){return{x:t.x,y:t.y,width:t.width,height:t.height}}function i(t,e,r){console.assert(!!t),console.assert(!!e),console.assert(!!r);var n=[r.p0,new s.default(r.p1.x,r.p0.y),r.p1,new s.default(r.p0.x,r.p1.y)],o=n.map(function(e){return e.sub(t)});e=e.normalized();for(var i=o.map(function(t){return s.default.cross(t,e)}),a=o.map(function(t){return s.default.dot(t,e)}),u=-1,l=-1,c=0;c<4;++c)i[c]>0?(u<0||a[u]<a[c])&&(u=c):(l<0||a[l]<a[c])&&(l=c);if(l<0||u<0)return 0;var f=a[u]>a[l]?l:u,d=a[u]>a[l]?u:l;return a[f]+Math.abs(i[f])*(a[d]-a[f])/(Math.abs(i[f])+Math.abs(i[d]))}Object.defineProperty(r,"__esModule",{value:!0});var a=t("../util/vec2"),s=function(t){return t&&t.__esModule?t:{default:t}}(a);r.default={tfx:n,relBox:o,shiftRayBox:i}},{"../util/vec2":691}],607:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=(r.basic=["H","C","N","O","S","P","F","Cl","Br","I"],r.atomCuts={H:"h",C:"c",N:"n",O:"o",S:"s",P:"p",F:"f",Cl:"Shift+c",Br:"Shift+b",I:"i",A:"a"});r.default=Object.keys(n).reduce(function(t,e){return t["atom-"+e.toLowerCase()]={title:"Atom "+e,shortcut:n[e],action:{tool:"atom",opts:{label:e}}},t},{})},{}],608:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../chem/molfile"),o=function(t){return t&&t.__esModule?t:{default:t}}(n);r.default={"force-update":{shortcut:"Ctrl+Shift+r",action:function(t){t.update(!0)}},"qs-serialize":{shortcut:"Alt+Shift+r",action:function(t){var e=o.default.stringify(t.struct()),r="mol="+encodeURIComponent(e).replace(/%20/g,"+"),n=document.location.search;document.location.search=n?-1===n.search("mol=")?n+"&"+r:n.replace(/mol=[^&$]*/,r):"?"+r}}}},{"../../chem/molfile":528}],609:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.selection();return e&&(Object.keys(e).length>1||!e.sgroupData)}function i(t){alert("This action is unavailable via menu.\nInstead, use shortcut to "+t+".")}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("./tools"),u=n(s),l=t("./atoms"),c=n(l),f=t("./zoom"),d=n(f),p=t("./server"),h=n(p),m=t("./debug"),g=n(m),v=t("./templates"),b=n(v),y=t("../component/cliparea");r.default=a({new:{shortcut:"Mod+Delete",title:"Clear Canvas",action:{thunk:function(t,e){var r=e().editor;r.struct().isBlank()||r.struct(null),t({type:"ACTION",action:u.default["select-lasso"].action})}}},open:{shortcut:"Mod+o",title:"Open…",action:{dialog:"open"}},save:{shortcut:"Mod+s",title:"Save As…",action:{dialog:"save"}},undo:{shortcut:"Mod+z",title:"Undo",action:function(t){t.undo()},disabled:function(t){return 0===t.historySize().undo}},redo:{shortcut:["Mod+Shift+z","Mod+y"],title:"Redo",action:function(t){t.redo()},disabled:function(t){return 0===t.historySize().redo}},cut:{shortcut:"Mod+x",title:"Cut",action:function(){(0,y.exec)("cut")||i("Cut")},disabled:function(t){return!o(t)}},copy:{shortcut:"Mod+c",title:"Copy",action:function(){(0,y.exec)("copy")||i("Copy")},disabled:function(t){return!o(t)}},paste:{shortcut:"Mod+v",title:"Paste",action:function(){(0,y.exec)("paste")||i("Paste")},selected:function(t){var e=t.actions;return e&&e.active&&"paste"===e.active.tool}},settings:{title:"Settings",action:{dialog:"settings"}},help:{shortcut:["?","&","Shift+/"],title:"Help",action:{dialog:"help"}},about:{title:"About",action:{dialog:"about"}},"reaction-automap":{title:"Reaction Auto-Mapping Tool",action:{dialog:"automap"},disabled:function(t,e,r){return!r.app.server||!t.struct().hasRxnArrow()}},"period-table":{title:"Periodic Table",action:{dialog:"period-table"}},"select-all":{title:"Select All",shortcut:"Mod+a",action:{thunk:function(t,e){e().editor.selection("all");var r=e().toolbar.visibleTools.select;t({type:"ACTION",action:u.default[r].action})}}},"deselect-all":{title:"Deselect All",shortcut:"Mod+Shift+a",action:function(t){t.selection(null)}},"select-descriptors":{title:"Select descriptors",shortcut:"Mod+d",action:{thunk:function(t,e){var r=e().toolbar.visibleTools.select,n=e().editor;n.alignDescriptors(),n.selection("descriptors"),t({type:"ACTION",action:u.default[r].action})}}}},h.default,g.default,u.default,c.default,d.default,b.default)},{"../component/cliparea":620,"./atoms":607,"./debug":608,"./server":610,"./templates":611,"./tools":612,"./zoom":613}],610:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../state/server");r.default={layout:{shortcut:"Mod+l",title:"Layout",action:{thunk:(0,n.serverTransform)("layout")},disabled:function(t,e,r){return!r.app.server}},clean:{shortcut:"Mod+Shift+l",title:"Clean Up",action:{thunk:(0,n.serverTransform)("clean")},disabled:function(t,e,r){return!r.app.server}},arom:{title:"Aromatize",action:{thunk:(0,n.serverTransform)("aromatize")},disabled:function(t,e,r){return!r.app.server}},dearom:{title:"Dearomatize",action:{thunk:(0,n.serverTransform)("dearomatize")},disabled:function(t,e,r){return!r.app.server}},cip:{shortcut:"Mod+p",title:"Calculate CIP",action:{thunk:(0,n.serverTransform)("calculateCip")},disabled:function(t,e,r){return!r.app.server}},check:{title:"Check Structure",action:{dialog:"check"},disabled:function(t,e,r){return!r.app.server}},analyse:{title:"Calculated Values",action:{dialog:"analyse"},disabled:function(t,e,r){return!r.app.server}},recognize:{title:"Recognize Molecule",action:{dialog:"recognize"},disabled:function(t,e,r){return!r.app.server}},miew:{title:"3D Viewer",action:{dialog:"miew"},disabled:function(){return!window.Miew}}}},{"../state/server":681}],611:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../data/templates"),o=function(t){return t&&t.__esModule?t:{default:t}}(n),i={"template-lib":{shortcut:"Shift+t",title:"Custom Templates",action:{dialog:"templates"},disabled:function(t,e,r){return!r.app.templates}}};r.default=o.default.reduce(function(t,e,r){return t["template-"+r]={title:""+e.name,shortcut:"t",action:{tool:"template",opts:{struct:e}}},t},i)},{"../data/templates":648}],612:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../data/schema/struct-schema"),o=t("../data/convert/structconv"),i={"select-lasso":{title:"Lasso Selection",shortcut:"Escape",action:{tool:"select",opts:"lasso"}},"select-rectangle":{title:"Rectangle Selection",shortcut:"Escape",action:{tool:"select",opts:"rectangle"}},"select-fragment":{title:"Fragment Selection",shortcut:"Escape",action:{tool:"select",opts:"fragment"}},erase:{title:"Erase",shortcut:["Delete","Backspace"],action:{tool:"eraser",opts:1}},chain:{title:"Chain",action:{tool:"chain"}},"chiral-flag":{title:"Chiral Flag",action:{tool:"chiralFlag"},selected:function(t){return t.struct().isChiral}},"charge-plus":{shortcut:"5",title:"Charge Plus",action:{tool:"charge",opts:1}},"charge-minus":{shortcut:"5",title:"Charge Minus",action:{tool:"charge",opts:-1}},"transform-rotate":{shortcut:"Alt+r",title:"Rotate Tool",action:{tool:"rotate"}},"transform-flip-h":{shortcut:"Alt+h",title:"Horizontal Flip",action:{tool:"rotate",opts:"horizontal"}},"transform-flip-v":{shortcut:"Alt+v",title:"Vertical Flip",action:{tool:"rotate",opts:"vertical"}},sgroup:{shortcut:"Mod+g",title:"S-Group",action:{tool:"sgroup"}},"sgroup-data":{shortcut:"Mod+g",title:"Data S-Group",action:{tool:"sgroup",opts:"DAT"}},"reaction-arrow":{title:"Reaction Arrow Tool",action:{tool:"reactionarrow"}},"reaction-plus":{title:"Reaction Plus Tool",action:{tool:"reactionplus"}},"reaction-map":{title:"Reaction Mapping Tool",action:{tool:"reactionmap"}},"reaction-unmap":{title:"Reaction Unmapping Tool",action:{tool:"reactionunmap"}},"rgroup-label":{shortcut:"Mod+r",title:"R-Group Label Tool",action:{tool:"rgroupatom"}},"rgroup-fragment":{shortcut:["Mod+Shift+r","Mod+r"],title:"R-Group Fragment Tool",action:{tool:"rgroupfragment"}},"rgroup-attpoints":{shortcut:"Mod+r",title:"Attachment Point Tool",action:{tool:"apoint"}}},a={single:"1",double:"2",triple:"3",up:"1",down:"1",updown:"1",crossed:"2",any:"0",aromatic:"4"},s=n.bond.properties.type;r.default=s.enum.reduce(function(t,e,r){return t["bond-"+e]={title:s.enumNames[r]+" Bond",shortcut:a[e],action:{tool:"bond",opts:(0,o.toBondType)(e)}},t},i)},{"../data/convert/structconv":642,"../data/schema/struct-schema":647}],613:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0}),r.zoomList=void 0;var o=t("lodash/fp/findLastIndex"),i=n(o),a=t("lodash/fp/findIndex"),s=n(a),u=r.zoomList=[.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2,1.3,1.4,1.5,1.7,2,2.5,3,3.5,4];r.default={zoom:{selected:function(t){return t.zoom()}},"zoom-out":{shortcut:["-","_","Shift+-"],title:"Zoom Out",disabled:function(t){return t.zoom()<=u[0]},action:function(t){var e=t.zoom(),r=(0,s.default)(function(t){return t>=e},u);t.zoom(u[u[r]===e&&r>0?r-1:r])}},"zoom-in":{shortcut:["+","=","Shift+="],title:"Zoom In",disabled:function(t){return u[u.length-1]<=t.zoom()},action:function(t){var e=t.zoom(),r=(0,i.default)(function(t){return t<=e},u);t.zoom(u[u[r]===e&&r<u.length-1?r+1:r])}}}},{"lodash/fp/findIndex":429,"lodash/fp/findLastIndex":430}],614:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("preact-redux"),i=t("../state/editor"),a=n(i),s=t("../component/structeditor"),u=n(s),l=(0,o.connect)(function(t){return{options:t.options.settings}},function(t){return t(a.default)})(u.default);r.default=l},{"../component/structeditor":631,"../state/editor":674,"preact-redux":489}],615:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0}),r.AppCliparea=r.AppHidden=void 0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=t("preact"),u=t("preact-redux"),l=t("../component/cliparea"),c=function(t){return t&&t.__esModule?t:{default:t}}(l),f=t("../state/toolbar"),d=t("../state/hotkeys"),p=t("../state/templates");r.AppHidden=(0,u.connect)(null,function(t){return{onInitTmpls:function(e){return(0,p.initTmplLib)(t,"",e)}}})(function(t){function e(){var t,r,i,a;n(this,e);for(var u=arguments.length,l=Array(u),c=0;c<u;c++)l[c]=arguments[c];return r=i=o(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),i.render=function(){return(0,s.h)("div",{className:"cellar",ref:function(t){i.cacheEl=t}})},a=r,o(i,a)}return i(e,t),a(e,[{key:"componentDidMount",value:function(){this.props.onInitTmpls(this.cacheEl),(0,f.initIcons)(this.cacheEl)}}]),e}(s.Component)),r.AppCliparea=(0,u.connect)(null,function(t){return t(d.initClipboard)})(c.default)},{"../component/cliparea":620,"../state/hotkeys":675,"../state/templates":683,"../state/toolbar":685,preact:490,"preact-redux":489}],616:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,r){var n=(0,y.default)(e,r);return n.dispatch((0,x.initKeydownListener)(t)),n.dispatch((0,w.initResize)()),(0,l.render)((0,l.h)(c.Provider,{store:n},(0,l.h)(S,null)),t),{load:function(t,e){return n.dispatch((0,b.load)(t,e))}}}Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=t("preact"),c=t("preact-redux"),f=t("./hidden"),d=t("./editor"),p=n(d),h=t("./modal"),m=n(h),g=t("./toolbar"),v=n(g),b=t("../state"),y=n(b),_=t("../state/server"),x=t("../state/hotkeys"),w=t("../state/toolbar"),S=(0,c.connect)(null,{onAction:b.onAction,checkServer:_.checkServer})(function(t){function e(){var t,r,n,a;o(this,e);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return r=n=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.render=function(t){return(0,l.h)("main",{role:"application"},(0,l.h)(f.AppHidden,null),(0,l.h)(p.default,{id:"canvas"}),(0,l.h)(v.default,t),(0,l.h)(f.AppCliparea,null),(0,l.h)(m.default,null))},a=r,i(n,a)}return a(e,t),u(e,[{key:"componentDidMount",value:function(){this.props.checkServer()}}]),e}(l.Component));r.default=s},{"../state":676,"../state/hotkeys":675,"../state/server":681,"../state/toolbar":685,"./editor":614,"./hidden":615,"./modal":617,"./toolbar":618,preact:490,"preact-redux":489}],617:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}Object.defineProperty(r,"__esModule",{value:!0});var i=t("lodash/fp/omit"),a=n(i),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=t("preact"),l=t("preact-redux"),c=t("../dialog"),f=n(c),d=function(t){return{modal:t.modal}},p=function(t){return{onOk:function(e){console.info("Output:",e),t({type:"MODAL_CLOSE"})},onCancel:function(){t({type:"MODAL_CLOSE"})}}},h=function(t,e){var r=t.modal&&t.modal.prop,n=r?(0,a.default)(["onResult","onCancel"],r):{};return s({modal:t.modal},n,{onOk:function(t){r&&r.onResult&&r.onResult(t),e.onOk(t)},onCancel:function(){r&&r.onCancel&&r.onCancel(),e.onCancel()}})},m=(0,l.connect)(d,p,h)(function(t){var e=t.modal,r=o(t,["modal"]);if(!e)return null;var n=f.default[e.name];if(!n)throw new Error("There is no modal window named "+e.name);return(0,u.h)("div",{className:"ket-overlay"},(0,u.h)(n,r))});r.default=m},{"../dialog":651,"lodash/fp/omit":434,preact:490,"preact-redux":489}],618:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.status,r=t.onAction,n=e.zoom&&e.zoom.selected;return(0,l.h)("select",{value:n,onChange:function(t){return r(function(e){return e.zoom(parseFloat(t.target.value))})}},S.zoomList.map(function(t){return(0,l.h)("option",{value:t},(100*t).toFixed()+"%")}))}function i(t,e){var r=e.active,n=e.onAction,o=r&&"atom"===r.tool;return(0,l.h)("menu",null,t.map(function(t){var e=p.default.map[t],i=w.basic.indexOf(t)>-1?(0,b.shortcutStr)(w.atomCuts[t]):null;return(0,l.h)("li",{className:(0,f.default)({selected:o&&r.opts.label===t})},(0,l.h)(m.default,{el:p.default[e],shortcut:i,onClick:function(){return n({tool:"atom",opts:{label:t}})}}))}))}function a(t){var e=t.active,r=t.onAction,n=(0,b.shortcutStr)(x.default["template-0"].shortcut),o=e&&"template"===e.tool;return(0,l.h)("menu",null,A.default.map(function(t,i){return(0,l.h)("li",{id:"template-"+i,className:(0,f.default)({selected:o&&e.opts.struct===t})},(0,l.h)("button",{title:t.name+" ("+n+")",onClick:function(){return r({tool:"template",opts:{struct:t}})}},(0,l.h)(v.default,{name:"template-"+i}),t.name))}))}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=t("preact-redux"),l=t("preact"),c=t("classnames"),f=n(c),d=t("../../chem/element"),p=n(d),h=t("../component/view/atom"),m=n(h),g=t("../component/view/icon"),v=n(g),b=t("../component/actionmenu"),y=n(b),_=t("../action"),x=n(_),w=t("../action/atoms"),S=t("../action/zoom"),O=t("../data/templates"),A=n(O),E=[{id:"document",menu:["new","open","save"]},{id:"edit",menu:["undo","redo","cut","copy","paste"]},{id:"zoom",menu:["zoom-in","zoom-out",{id:"zoom-list",component:o}]},{id:"process",menu:["layout","clean","arom","dearom","cip","check","analyse","recognize","miew"]},{id:"meta",menu:["settings","help","about"]}],j=[{id:"select",menu:["select-lasso","select-rectangle","select-fragment"]},"erase",{id:"bond",menu:[{id:"bond-common",menu:["bond-single","bond-double","bond-triple"]},{id:"bond-stereo",menu:["bond-up","bond-down","bond-updown","bond-crossed"]},{id:"bond-query",menu:["bond-any","bond-aromatic","bond-singledouble","bond-singlearomatic","bond-doublearomatic"]}]},"chain",{id:"charge",menu:["charge-plus","charge-minus"]},{id:"transform",menu:["transform-rotate","transform-flip-h","transform-flip-v"]},"sgroup","sgroup-data",{id:"reaction",menu:["reaction-arrow","reaction-plus","reaction-automap","reaction-map","reaction-unmap"]},{id:"rgroup",menu:["rgroup-label","rgroup-fragment","rgroup-attpoints"]}],P=[{id:"template-common",component:a},"template-lib","chiral-flag"],T=[{id:"atom",component:function(t){return i(w.basic,t)}},{id:"freq-atoms",component:function(t){return i(t.freqAtoms,t)}},"period-table"],C=[{id:"mainmenu",menu:E},{id:"toolbox",menu:j},{id:"template",menu:P},{id:"elements",menu:T}];r.default=(0,u.connect)(function(t){return{active:t.actionState&&t.actionState.activeTool,status:t.actionState||{},freqAtoms:t.toolbar.freqAtoms,opened:t.toolbar.opened,visibleTools:t.toolbar.visibleTools}},{onOpen:function(t,e){return{type:"OPENED",data:{menuName:t,isSelected:e}}}})(function(t){return(0,l.h)(y.default,s({menu:C,role:"toolbar"},t))})},{"../../chem/element":525,"../action":609,"../action/atoms":607,"../action/zoom":613,"../component/actionmenu":619,"../component/view/atom":634,"../component/view/icon":635,"../data/templates":648,classnames:2,preact:490,"preact-redux":489}],619:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){return(Array.isArray(t)?t[0]:t).replace(/(\b[a-z]\b$|Mod|Escape|Delete)/g,function(t){return S[t]||t.toUpperCase()})}function a(t){var e=(0,y.hiddenAncestor)(t);return e&&e.classList.contains("opened")}function s(t,e,r,n){return"object"!==(void 0===e?"undefined":p(e))?(0,h.h)(u,d({},n,{name:e,action:t[e],status:r})):e.menu?(0,h.h)(l,d({},n,{name:e.id,menu:e.menu})):e.component(n)}function u(t){var e=this,r=t.name,n=t.action,o=t.status,s=void 0===o?{}:o,u=t.onAction,l=n.shortcut&&i(n.shortcut);return(0,h.h)("button",{disabled:s.disabled,onClick:function(t){s.selected&&!a(e.base)&&"chiralFlag"!==n.action.tool||(u(n.action),t.stopPropagation())},title:l?n.title+" ("+l+")":n.title},(0,h.h)(x.default,{name:r}),n.title,(0,h.h)("kbd",null,l))}function l(t){var e=t.name,r=t.menu,n=t.className,i=t.role,a=o(t,["name","menu","className","role"]);return(0,h.h)("menu",{className:n,role:i,style:c(e,r,a.visibleTools)},r.map(function(t){return(0,h.h)("li",{id:t.id||t,className:(0,g.default)(a.status[t])+" "+(t.id===a.opened?"opened":""),onClick:function(t){return f(t,a.onOpen)}},s(b.default,t,a.status[t],a),t.menu&&(0,h.h)(x.default,{name:"dropdown"}))}))}function c(t,e,r){if(!r[t])return{};var n=window.innerHeight<600||window.innerWidth<1040?32:40,o=e.indexOf(r[t]);if(-1===o){var i=[];e.forEach(function(t){i=i.concat(t.menu)}),o=i.indexOf(r[t])}return-1!==o?{marginTop:-n*o+"px"}:{}}function f(t,e){var r=(0,y.hiddenAncestor)(t.currentTarget),n=t.currentTarget.classList.contains("selected");e(r&&r.id,n),t.stopPropagation()}Object.defineProperty(r,"__esModule",{value:!0});var d=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.shortcutStr=i,r.showMenuOrButton=s;var h=t("preact"),m=t("classnames"),g=n(m),v=t("../action"),b=n(v),y=t("../state/toolbar"),_=t("./view/icon"),x=n(_),w=/Mac/.test(navigator.platform),S={Escape:"Esc",Delete:"Del",Mod:w?"⌘":"Ctrl"};r.default=l},{"../action":609,"../state/toolbar":685,"./view/icon":635,classnames:2,preact:490}],620:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return("INPUT"!==t.tagName||"button"!==t.type)&&["INPUT","SELECT","TEXTAREA","OPTION","LABEL"].includes(t.tagName)}function s(t){t.value=" ",t.focus(),t.select()}function u(t,e){if(!t&&p)p.setData("text",e["text/plain"]);else{var r=null;t.setData("text/plain",e["text/plain"]);try{Object.keys(e).forEach(function(n){r=n,t.setData(n,e[n])})}catch(t){console.info("Could not write exact type "+r)}}}function l(t,e){var r={};return!t&&p?r["text/plain"]=p.getData("text"):(r["text/plain"]=t.getData("text/plain"),r=e.reduce(function(e,r){var n=t.getData(r);return n&&(e[r]=n),e},r)),r}function c(t){var e=document.queryCommandSupported(t);if(e)try{e=document.execCommand(t)||window.ClipboardEvent||p}catch(t){e=!1}return e}Object.defineProperty(r,"__esModule",{value:!0}),r.actions=void 0;var f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();r.exec=c;var d=t("preact"),p=window.clipboardData,h=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),f(e,[{key:"componentDidMount",value:function(){var t=this,e=this.base;this.target=this.props.target||e.parentNode,this.listeners={mouseup:function(r){t.props.focused()&&!a(r.target)&&s(e)},mousedown:function(t){t.shiftKey&&!a(t.target)&&t.preventDefault()},copy:function(e){if(t.props.focused()&&t.props.onCopy){var r=t.props.onCopy();r&&u(e.clipboardData,r),e.preventDefault()}},cut:function(e){if(t.props.focused()&&t.props.onCut){var r=t.props.onCut();r&&u(e.clipboardData,r),e.preventDefault()}},paste:function(e){if(t.props.focused()&&t.props.onPaste){var r=l(e.clipboardData,t.props.formats);r&&t.props.onPaste(r),e.preventDefault()}}},Object.keys(this.listeners).forEach(function(e){t.target.addEventListener(e,t.listeners[e])})}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillUnmount",value:function(){var t=this;Object.keys(this.listeners).forEach(function(e){t.target.removeEventListener(e,t.listeners[e])})}},{key:"render",value:function(){return(0,d.h)("textarea",{className:"cliparea",contentEditable:!0,autoFocus:!0})}}]),e}(d.Component);r.actions=["cut","copy","paste"];r.default=h},{preact:490}],621:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){
  if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=t("preact"),c=t("w3c-keyname"),f=function(t){return t&&t.__esModule?t:{default:t}}(c),d=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"exit",value:function(t){var e=this.props,r=e.params,n=e.result,o=void 0===n?function(){return null}:n,i=e.valid,a=void 0===i?function(){return!!o()}:i,s="OK"===t?"onOk":"onCancel";r&&s in r&&("onOk"!==s||a())&&r[s](o())}},{key:"keyDown",value:function(t){var e=(0,f.default)(t),r=document.activeElement,n=r&&"TEXTAREA"===r.tagName;("Escape"===e||"Enter"===e&&!n)&&(this.exit("Enter"===e?"OK":"Cancel"),t.preventDefault()),t.stopPropagation()}},{key:"componentDidMount",value:function(){var t=this.base.querySelector(["input:not([type=checkbox]):not([type=button])","textarea","[contenteditable]","select"].join(","))||this.base.querySelector(["button.close"].join(","));console.assert(t,"No active buttons"),t.focus&&t.focus()}},{key:"componentWillUnmount",value:function(){(document.querySelector(".cliparea")||document.body).focus()}},{key:"render",value:function(){var t=this,e=this.props,r=e.children,o=e.title,i=e.params,a=void 0===i?{}:i,u=e.result,c=void 0===u?function(){return null}:u,f=e.valid,d=void 0===f?function(){return!!c()}:f,p=e.buttons,h=void 0===p?["Cancel","OK"]:p,m=n(e,["children","title","params","result","valid","buttons"]);return(0,l.h)("form",s({role:"dialog",onSubmit:function(t){return t.preventDefault()},onKeyDown:function(e){return t.keyDown(e)},tabIndex:"-1"},m),(0,l.h)("header",null,o,a.onCancel&&o&&(0,l.h)("button",{className:"close",onClick:function(){return t.exit("Cancel")}},"×")),r,(0,l.h)("footer",null,h.map(function(e){return"string"!=typeof e?e:(0,l.h)("input",{type:"button",value:e,disabled:"OK"===e&&!d(),onClick:function(){return t.exit(e)}})})))}}]),e}(l.Component);r.default=d},{preact:490,"w3c-keyname":521}],622:[function(t,e,r){"use strict";function n(t,e,r){return t?(0,a.default)(e,[r]):(0,a.default)(e,e.concat([r]))}function o(t){var e=t.value,r=t.onChange,o=t.schema,i=t.disabledIds,a=t.multiple,u=void 0;return(0,s.h)("ul",null,o.items.enum.map(function(t,l){return u=e.includes(t)?"selected":"",(0,s.h)("li",null,(0,s.h)("button",{disabled:i.includes(t),type:"button",className:u,onClick:function(){return r(n(a,e,t))}},o.items.enumNames[l]))}))}Object.defineProperty(r,"__esModule",{value:!0});var i=t("lodash/fp/xor"),a=function(t){return t&&t.__esModule?t:{default:t}}(i),s=t("preact");r.default=o},{"lodash/fp/xor":443,preact:490}],623:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=t("preact"),u=function(t){function e(t){n(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state={suggestsHidden:!0},r.click=r.click.bind(r),r.blur=r.blur.bind(r),r.updateInput=r.updateInput.bind(r),r}return i(e,t),a(e,[{key:"updateInput",value:function(t){var e=t.target.value||t.target.textContent;this.setState({suggestsHidden:!0}),this.props.onChange(e)}},{key:"click",value:function(){this.setState({suggestsHidden:!1})}},{key:"blur",value:function(){this.setState({suggestsHidden:!0})}},{key:"render",value:function(t){var e=this,r=t.value,n=t.type,o=void 0===n?"text":n,i=t.schema,a=i.enumNames.filter(function(t){return t!==r}).map(function(t){return(0,s.h)("li",{onMouseDown:e.updateInput},t)});return(0,s.h)("div",null,(0,s.h)("input",{type:o,value:r,onClick:this.click,onBlur:this.blur,onInput:this.updateInput,autoComplete:"off"}),0!==a.length?(0,s.h)("ui",{className:"suggestList",style:"display: "+(this.state.suggestsHidden?"none":"block")},a):"")}}]),e}(s.Component);r.default=u},{preact:490}],624:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t){var e=t.labelPos,r=t.title,n=t.children,o=i(t,["labelPos","title","children"]);return(0,x.h)("label",o,r&&"after"!==e?r+":":"",n,r&&"after"===e?r:"")}function c(t){var e=t.name,r=t.onChange,n=t.className,o=t.component,a=t.labelPos,s=i(t,["name","onChange","className","component","labelPos"]),u=this.context,c=u.schema,f=u.stateStore,d=s.schema||c.properties[e],p=f.field(e,r),h=p.dataError,m=i(p,["dataError"]),g=o?(0,x.h)(o,v({},m,s,{schema:d})):(0,x.h)(O.default,v({name:e,schema:d},m,s));return!1===a?g:(0,x.h)(l,{className:n,"data-error":h,title:s.title||d.title,labelPos:a},g)}function f(t,e){var r=e.customValid,n=e.serialize,o=void 0===n?{}:n,i=e.deserialize,a=void 0===i?{}:i,s=new _.default.Validator;return r&&(t=Object.assign({},t),t.properties=Object.keys(r).reduce(function(t,e){return s.customFormats[e]=r[e],t[e]=v({format:e},t[e]),t},t.properties)),{key:t.key||"",serialize:function(e){return s.validate(e,t,{rewrite:d.bind(null,o)})},deserialize:function(e){return s.validate(e,t,{rewrite:p.bind(null,a)})}}}function d(t,e,r){var n={};return"object"===(void 0===e?"undefined":g(e))&&r.properties?(Object.keys(r.properties).forEach(function(r){r in e&&(n[r]=e[t[r]]||e[r])}),n):void 0!==e?e:r.default}function p(t,e){return e}function h(t){return t.schema.invalidMessage?"function"==typeof t.schema.invalidMessage?t.schema.invalidMessage(t.instance):t.schema.invalidMessage:t.message}function m(t){var e={},r=void 0;return t.forEach(function(t){r=t.property.split(".")[1],e[r]||(e[r]=h(t))}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.SelectOneOf=r.Field=void 0;var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},b=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),y=t("jsonschema"),_=n(y),x=t("preact"),w=t("preact-redux"),S=t("./input"),O=n(S),A=t("../../state/modal/form"),E=function(t){function e(t){var r=t.onUpdate,n=t.schema,o=t.init,u=i(t,["onUpdate","schema","init"]);a(this,e);var l=s(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));if(l.schema=f(n,u),o){var c=l.schema.serialize(o),d=c.valid,p=c.errors,h=m(p);o=Object.assign({},o,{init:!0}),r(o,d,h)}return l}return u(e,t),b(e,[{key:"updateState",value:function(t){var e=this.schema.serialize(t),r=e.instance,n=e.valid,o=e.errors,i=m(o);this.props.onUpdate(r,n,i)}},{key:"getChildContext",value:function(){return{schema:this.props.schema,stateStore:this}}},{key:"field",value:function(t,e){var r=this.props,n=r.result,i=r.errors,a=n[t],s=this;return{dataError:i&&i[t]||!1,value:a,onChange:function(r){var n=Object.assign({},s.props.result,o({},t,r));s.updateState(n),e&&e(r)}}}},{key:"render",value:function(t){var e=t.result,r=(t.errors,t.init,t.children),n=t.schema,o=i(t,["result","errors","init","children","schema"]);return n.key&&n.key!==this.schema.key&&(this.schema=f(n,o),this.schema.serialize(e),this.updateState(e)),(0,x.h)("form",o,r)}}]),e}(x.Component);r.default=(0,w.connect)(null,function(t){return{onUpdate:function(e,r,n){t((0,A.updateFormState)({result:e,valid:r,errors:n}))}}})(E);var j=function(t){var e=t.title,r=t.name,n=t.schema,o=i(t,["title","name","schema"]),a={title:e,enum:[],enumNames:[]};return Object.keys(n).forEach(function(t){a.enum.push(t),a.enumNames.push(n[t].title||t)}),(0,x.h)(c,v({name:r,schema:a},o))};r.Field=c,r.SelectOneOf=j},{"../../state/modal/form":677,"./input":625,jsonschema:204,preact:490,"preact-redux":489}],625:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function s(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function u(t){var e=(t.schema,t.value),r=t.onChange,n=t.type,o=void 0===n?"text":n,i=s(t,["schema","value","onChange","type"]);return(0,A.h)("input",O({type:o,value:e,onInput:r},i))}function l(t){var e=(t.schema,t.value),r=t.onChange,n=s(t,["schema","value","onChange"]);return(0,A.h)("textarea",O({value:e,onInput:r},n))}function c(t){var e=(t.schema,t.value),r=t.onChange,n=s(t,["schema","value","onChange"]);return(0,A.h)("input",O({type:"checkbox",checked:e,onClick:r},n))}function f(t){var e=t.schema,r=t.value,n=t.selected,o=t.onSelect,i=s(t,["schema","value","selected","onSelect"]);return(0,A.h)("select",O({onChange:o},i),p(e,function(t,e){return(0,A.h)("option",{selected:n(e,r),value:"object"!==(void 0===e?"undefined":S(e))&&e},t)}))}function d(t){var e=t.schema,r=t.value,n=t.selected,o=t.onSelect,i=t.type,a=void 0===i?"radio":i,u=s(t,["schema","value","selected","onSelect","type"]);return(0,A.h)("fieldset",{onClick:o,className:"radio"},p(e,function(t,e){return(0,A.h)("li",null,(0,A.h)("label",null,(0,A.h)("input",O({type:a,checked:n(e,r),value:"object"!==(void 0===e?"undefined":S(e))&&e},u)),t))}))}function p(t,e){var r=Array.isArray(t);if(!r&&t.items&&(t=t.items),"function"==typeof e)return(r?t:t.enum).map(function(n,o){var i=r?n.title:t.enumNames&&t.enumNames[o];return e(void 0!==i?i:n,void 0!==n.value?n.value:n)});if(!r)return t.enum[e];var n=t[e];return void 0!==n.value?n.value:n}function h(t,e,r){var n={};return e&&("number"!==e.type&&"integer"!==e.type||(n={type:"text"})),O({onChange:function(n){var o=t.val?t.val(n,e):n;r(o)}},n)}function m(t,e,r){return{selected:function(t,e){return e===t},onSelect:function(n){var o=t.val?t.val(n,e):n;void 0!==o&&r(o)}}}function g(t,e,r){return{multiple:!0,selected:function(t,e){return e&&e.indexOf(t)>=0},onSelect:function(n,o){if(t.val){var i=t.val(n,e);void 0!==i&&r(i)}else{var s=o?o.indexOf(n):-1;r(s<0?o?[n].concat(a(o)):[n]:[].concat(a(o.slice(0,s)),a(o.slice(s+1))))}}}}function v(t,e){var r=e.schema,n=e.multiple,o=e.onChange;return r&&(r.enum||r.items||Array.isArray(r))&&"string"!==r.type?n||"array"===r.type?g(t,r,o):m(t,r,o):h(t,r,o)}function b(t){var e=t.schema,r=t.type,n=t.multiple;return e&&(e.enum||e.items||Array.isArray(e))?n||"array"===e.type?"checkbox"===r?d:f:"radio"===r?d:f:"checkbox"===r||e&&"boolean"===e.type?c:"textarea"===r?l:u}function y(t,e){for(var r in t)if(!(r in e))return!0;for(var n in e)if(t[n]!==e[n])return!0;return!1}Object.defineProperty(r,"__esModule",{value:!0});var _=t("lodash/omit"),x=function(t){return t&&t.__esModule?t:{default:t}}(_),w=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},A=t("preact");u.val=function(t,e){var r=t.target,n="number"===r.type||"range"===r.type||e&&("number"===e.type||"integer"===e.type),o=n?r.value.replace(/,/g,"."):r.value;return n&&!isNaN(o-0)?o-0:o},l.val=function(t){return t.target.value},c.val=function(t){return t.stopPropagation(),!!t.target.checked},f.val=function(t,e){var r=t.target;return r.multiple?[].reduce.call(r.options,function(t,r,n){return r.selected?[p(e,n)].concat(a(t)):t},[]):p(e,r.selectedIndex)},d.val=function(t,e){var r=t.target;if("INPUT"!==t.target.tagName)return void t.stopPropagation();var n=r.parentNode.parentNode.parentNode,o=[].reduce.call(n.querySelectorAll("input"),function(t,r,n){return r.checked?[p(e,n)].concat(a(t)):t},[]);return"radio"===r.type?o[0]:o};var E=function(t){function e(t){var r=t.component,i=s(t,["component"]);n(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i));return a.component=r||b(i),a.ctrl=v(a.component,i),a}return i(e,t),w(e,[{key:"shouldComponentUpdate",value:function(t){var e=(t.children,t.onChange,t.style,s(t,["children","onChange","style"]));return y((0,x.default)(this.props,["children","onChange","style"]),e)}},{key:"render",value:function(){var t=this.props,e=(t.children,t.onChange,s(t,["children","onChange"]));return(0,A.h)(this.component,O({},this.ctrl,e))}}]),e}(A.Component);r.default=E},{"lodash/omit":469,preact:490}],626:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,r){return!t&&0!==t||isNaN(t)?null:"px"===r||"pt"===r?(t*h[e]/h[r]).toFixed()-0:(t*h[e]/h[r]).toFixed(3)-0}Object.defineProperty(r,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=t("preact"),f=t("./input"),d=function(t){return t&&t.__esModule?t:{default:t}}(f),p=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state={cust:t.value||t.schema.default,meas:"px"},r.calcValue=r.calcValue.bind(r),r.handleChange=r.handleChange.bind(r),r.handleMeasChange=r.handleMeasChange.bind(r),r}return a(e,t),l(e,[{key:"handleChange",value:function(t){var e=s(t,this.state.meas,"px");this.state.cust=t,this.props.onChange(e)}},{key:"handleMeasChange",value:function(t){this.setState(function(e){return{meas:t,cust:s(e.cust,e.meas,t)}})}},{key:"calcValue",value:function(){var t=this;this.setState(function(e){return{cust:s(t.props.value,"px",e.meas)}})}},{key:"render",value:function(){var t=this.state,e=t.meas,r=t.cust,o=this.props,i=o.schema,a=o.value,s=(o.onChange,n(o,["schema","value","onChange"]));return"px"===e&&r.toFixed()-0!==a&&this.setState({meas:"px",cust:a}),(0,c.h)("div",u({style:{display:"inline-flex"}},s),(0,c.h)(d.default,{schema:i,step:"px"===e||"pt"===e?"1":"0.001",style:{width:"75%"},value:r,onChange:this.handleChange,onBlur:this.calcValue}),(0,c.h)(d.default,{schema:{enum:["cm","px","pt","inch"]},style:{width:"25%"},value:e,onChange:this.handleMeasChange}))}}]),e}(c.Component),h={px:1,cm:37.795278,pt:1.333333,inch:96};r.default=p},{"./input":625,preact:490}],627:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t){var e=t.schema,r=n(t,["schema"]),o={title:e.title,enum:[!0,!1],enumNames:["on","off"]};return(0,a.h)(u.default,i({schema:o},r))}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a=t("preact"),s=t("./input"),u=function(t){return t&&t.__esModule?t:{default:t}}(s);r.default=o},{"./input":625,preact:490}],628:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t){var e=t.schema,r=t.value,o=t.onSelect,s=t.splitIndexes,u=n(t,["schema","value","onSelect","splitIndexes"]);return(0,a.h)("ul",u,e.enum.map(function(t,n){return(0,a.h)("li",{onClick:function(){return o(t,n)},className:(t===r?"selected ":"")+(i(n,s)?"split":"")},e.enumNames?e.enumNames[n]:t)}))}function i(t,e){return t>0&&e&&e.includes(t)}Object.defineProperty(r,"__esModule",{value:!0});var a=t("preact");r.default=o},{preact:490}],629:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(){var t=v.map(function(t){return new h.default(t).check().then(function(){return t},function(){return null})});return Promise.all(t)}function l(t){return t.substring(t.indexOf("px ")+3)}Object.defineProperty(r,"__esModule",{value:!0});var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),d=t("preact"),p=t("font-face-observer"),h=n(p),m=t("./input"),g=n(m),v=["Arial","Arial Black","Comic Sans MS","Courier New","Georgia","Impact","Charcoal","Lucida Console","Monaco","Palatino Linotype","Book Antiqua","Palatino","Tahoma","Geneva","Times New Roman","Times","Verdana","Symbol","MS Serif","MS Sans Serif","New York","Droid Sans","Droid Serif","Droid Sans Mono","Roboto"],b=null,y=function(t){function e(t){i(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state={availableFonts:[l(t.value)]},r.setAvailableFonts(),r}return s(e,t),f(e,[{key:"setAvailableFonts",value:function(){var t=this;b?this.setState({availableFonts:b}):u().then(function(e){b=e.filter(function(t){return null!==t}),t.setState({availableFonts:b})})}},{key:"render",value:function(){var t=o(this.props,[]),e={enum:[],enumNames:[]};return this.state.availableFonts.forEach(function(t){e.enum.push("30px "+t),e.enumNames.push(t)}),1!==e.enum.length?(0,d.h)(g.default,c({},t,{schema:e})):(0,d.h)("select",null,(0,d.h)("option",null,e.enumNames[0]))}}]),e}(d.Component);r.default=y},{"./input":625,"font-face-observer":200,preact:490}],630:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=t("preact"),u=t("preact-redux"),l=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),a(e,[{key:"componentWillReceiveProps",value:function(t,e){var r=this;!e.editor&&t.editor&&t.editor.event.message.add(function(t){t.info?(r.base.innerHTML=t.info,r.base.classList.add("visible")):r.base.classList.remove("visible")})}},{key:"render",value:function(){return(0,s.h)("div",{className:"measure-log"})}}]),e}(s.Component);r.default=(0,u.connect)(function(t){return{editor:t.editor}})(l)},{preact:490,"preact-redux":489}],631:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.struct,o=e.tool,i=e.toolOpts,a=e.options;n!==r.struct&&t.struct(n),o===r.tool&&i===r.toolOpts||t.tool(o,i),r.options&&a!==r.options&&t.options(a),Object.keys(t.event).forEach(function(n){var o="on"+(0,f.default)(n);e[o]!==r[o]&&(r[o]&&t.event[n].remove(r[o]),e[o]&&t.event[n].add(e[o]))})}function l(t,e){Object.keys(t.event).forEach(function(r){var n="on"+(0,f.default)(r);e[n]&&t.event[r].remove(e[n])})}Object.defineProperty(r,"__esModule",{value:!0});var c=t("lodash/fp/upperFirst"),f=n(c),d=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},p=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),h=t("preact"),m=t("./measurelog"),g=n(m),v=t("../../editor"),b=n(v),y=function(t){function e(){return i(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),p(e,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillReceiveProps",value:function(t){u(this.instance,t,this.props)}},{key:"componentDidMount",value:function(){console.assert(this.base,"No backing element"),this.instance=new b.default(this.base,d({},this.props.options)),u(this.instance,this.props),this.props.onInit&&this.props.onInit(this.instance)}},{key:"componentWillUnmount",value:function(){l(this.instance,this.props)}},{key:"render",value:function(){var t=this.props,e=t.Tag,r=void 0===e?"div":e,n=(t.struct,t.tool,t.toolOpts,t.options,o(t,["Tag","struct","tool","toolOpts","options"]));return(0,h.h)(r,d({onMouseDown:function(t){return t.preventDefault()}},n),(0,h.h)(g.default,null))}}]),e}(h.Component);r.default=y},{"../../editor":561,"./measurelog":630,"lodash/fp/upperFirst":441,preact:490}],632:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t)if(e.prerender)t.innerHTML=e.prerender;else{console.info("render!",t.clientWidth,t.clientWidth);var n=new v.default(t,c({autoScale:!0},r));n.setMolecule(e),n.update()}}Object.defineProperty(r,"__esModule",{value:!0});var l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=t("preact"),d=t("../../chem/struct"),p=n(d),h=t("../../chem/molfile"),m=n(h),g=t("../../render"),v=n(g),b=function(t){function e(t){i(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));if(!(t.struct instanceof p.default))try{r.props.struct=m.default.parse(t.struct)}catch(t){alert("Could not parse structure\n"+t.message),r.props.struct=null}return r}return s(e,t),l(e,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentDidMount",value:function(){var t=this.base,e=this.props;u(t,e.struct,e.options)}},{key:"render",value:function(){var t=this.props,e=t.struct,r=t.Tag,n=void 0===r?"div":r,i=o(t,["struct","Tag"]);return(0,f.h)(n,i,e?null:"No molecule")}}]),e}(f.Component);r.default=b},{"../../chem/molfile":528,"../../chem/struct":542,"../../render":591,preact:490}],633:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var s=t("lodash/fp/xor"),u=function(t){return t&&t.__esModule?t:{default:t}}(s),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=t("preact"),f=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state.active=t.active||[],r}return a(e,t),l(e,[{key:"onActive",value:function(t){var e=this.props.multiple;void 0===e||e?this.setState({active:(0,u.default)(this.state.active,[t])}):this.setState({active:[t]})}},{key:"render",value:function(){var t=this,e=this.props,r=e.children,o=e.captions,i=n(e,["children","captions"]),a=this.state.active;return(0,c.h)("ul",i,o.map(function(e,n){return(0,c.h)("li",{className:"ac_tab "+(a.includes(n)?"active":"hidden")},(0,c.h)("a",{onClick:function(){return t.onActive(n)}},e),r[n])}))}}]),e}(c.Component);r.default=f},{"lodash/fp/xor":443,preact:490}],634:[function(t,e,r){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){return[d.indexOf(t.type)>=0?t.type+" metal":t.type||"unknown-props",t.state||"unknown-state",t.origin]}function a(t){var e=t.el,r=t.shortcut,a=t.className,l=o(t,["el","shortcut","className"]);return(0,u.h)("button",s({title:r?e.title+" ("+r+")":e.title,className:[].concat(n(i(e)),[a]).join(" "),style:{color:f.sketchingColors[e.label]},value:c.default.map[e.label]},l),(0,u.h)("span",null,e.label))}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=t("preact"),l=t("../../../chem/element"),c=function(t){return t&&t.__esModule?t:{default:t}}(l),f=t("../../../chem/element-color"),d=["alkali","alkaline-earth","transition","post-transition"];r.default=a},{"../../../chem/element":525,"../../../chem/element-color":524,preact:490}],635:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t){var e=t.name,r=n(t,["name"]);return(0,i.h)("svg",r,(0,i.h)("use",{xlinkHref:"#icon-"+e}))}Object.defineProperty(r,"__esModule",{value:!0})
  ;var i=t("preact");r.default=o},{preact:490}],636:[function(t,e,r){(function(e){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return new Promise(function(r,n){if(e.FileReader)r(u);else if(e.ActiveXObject)try{var o=new ActiveXObject("Scripting.FileSystemObject");r(function(t){return Promise.resolve(l(o,t))})}catch(t){n(t)}else t?r(t.then(function(){throw Error("Server doesn't still support echo method")})):n(new Error("Your browser does not support opening files locally"))})}function u(t){return new Promise(function(e,r){var n=new FileReader;n.onload=function(){var r=n.result;t.msClose&&t.msClose(),e(r)},n.onerror=function(t){r(t)},n.readAsText(t,"UTF-8")})}function l(t,e){var r=t.OpenTextFile(e.name,1),n=r.ReadAll();return r.Close(),n}Object.defineProperty(r,"__esModule",{value:!0});var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),d=t("preact"),p=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.server&&s(t.server).then(function(t){r.setState({opener:t})}),r}return a(e,t),f(e,[{key:"open",value:function(t){var e=t.target.files,r=function(){return null},n=this.props,o=n.onLoad,i=void 0===o?r:o,a=n.onError,s=void 0===a?r:a;this.state.opener&&e.length?this.state.opener(e[0]).then(i,s):e.length&&i(e[0]),t.target.value=null,t.preventDefault()}},{key:"render",value:function(){var t=this,e=this.props,r=e.children,o=e.type,i=(e.server,e.className),a=void 0===i?"open-button":i,s=n(e,["children","type","server","className"]);return(0,d.h)("button",c({onClick:function(){return t.btn.click()},className:a},s),(0,d.h)("input",{onChange:function(e){return t.open(e)},accept:o,type:"file",ref:function(e){t.btn=e}}),r)}}]),e}(d.Component);r.default=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{preact:490}],637:[function(t,e,r){(function(e){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return new Promise(function(r,n){e.Blob&&d.default.saveAs?r(function(t,e,r){var n=new Blob([t],{type:r});d.default.saveAs(n,e)}):t?r(t.then(function(){throw Error("Server doesn't still support echo method")})):n(new Error("Your browser does not support opening files locally"))})}Object.defineProperty(r,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=t("preact"),f=t("filesaver.js"),d=function(t){return t&&t.__esModule?t:{default:t}}(f),p=function(t){function e(t){var r=t.filename,a=void 0===r?"unnamed":r,l=t.type,c=void 0===l?"text/plain":l,f=t.className,d=void 0===f?"":f,p=n(t,["filename","type","className"]);o(this,e);var h=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u({filename:a,type:c,className:d},p)));return s(p.server).then(function(t){h.setState({saver:t})}),h}return a(e,t),l(e,[{key:"save",value:function(t){var e=function(){return null},r=this.props,n=r.filename,o=r.data,i=r.type,a=r.onSave,s=void 0===a?e:a,u=r.onError,l=void 0===u?e:u;if(this.state.saver&&o)try{this.state.saver(o,n,i),s()}catch(t){l(t)}t.preventDefault()}},{key:"render",value:function(){var t=this,e=this.props,r=e.children,o=(e.filename,e.data),i=e.className,a=void 0===i?"save-button":i,s=n(e,["children","filename","data","className"]);return(0,c.h)("button",u({onClick:function(e){return t.save(e)},className:this.state.saver&&o?a:"disabled "+a},s),r)}}]),e}(c.Component);r.default=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"filesaver.js":198,preact:490}],638:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t){var e=n(t,[]);return(0,a.h)("div",i({className:"ket-spinner"},e))}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a=t("preact");r.default=o},{preact:490}],639:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=t("preact"),l=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state.tabIndex=t.tabIndex||0,r.props.changeTab(r.state.tabIndex),r}return a(e,t),s(e,[{key:"changeTab",value:function(t,e){this.setState({tabIndex:e}),this.props.changeTab&&this.props.changeTab(e)}},{key:"render",value:function(){var t=this,e=this.props,r=e.children,o=e.captions,i=n(e,["children","captions"]);return(0,u.h)("ul",i,(0,u.h)("li",{className:"tabs"},o.map(function(e,r){return(0,u.h)("a",{className:t.state.tabIndex===r?"active":"",onClick:function(e){return t.changeTab(e,r)}},e)})),(0,u.h)("li",{className:"tabs-content"},r[this.state.tabIndex]))}}]),e}(u.Component);r.default=l},{preact:490}],640:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=t("preact"),c=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.resize=function(t,e){var n=r.base.offsetHeight;r.state.height!==n&&r.setState({height:n}),e&&(r.setState({offset:0}),r.base.scrollTop=0)},r.handleScroll=function(){r.setState({offset:r.base.scrollTop}),r.props.sync&&r.forceUpdate()},r.state={offset:0,height:0},r}return a(e,t),u(e,[{key:"componentDidUpdate",value:function(t){var e=t.data,r=e.length===this.props.data.length&&this.props.data.every(function(t,r){return t===e[r]});this.resize(null,!r)}},{key:"componentDidMount",value:function(){this.resize(),addEventListener("resize",this.resize)}},{key:"componentWillUnmount",value:function(){removeEventListener("resize",this.resize)}},{key:"render",value:function(){var t=this.props,e=t.data,r=t.rowHeight,o=t.children,i=t.Tag,a=void 0===i?"div":i,u=t.overscanCount,c=void 0===u?1:u,f=(t.sync,n(t,["data","rowHeight","children","Tag","overscanCount","sync"])),d=this.state,p=d.offset,h=d.height,m=p/r||0,g=o[0],v=h/r||0;c&&(m=Math.max(0,m-m%c),v+=c);var b=m+1+v,y=e.slice(m,b);return(0,l.h)("div",s({onScroll:this.handleScroll},f),(0,l.h)("div",{style:"position:relative; overflow:hidden; width:100%; min-height:100%; height:"+e.length*r+"px;"},(0,l.h)(a,{style:"position:absolute; top:0; left:0; height:100%; width:100%; overflow:visible; top:"+m*r+"px;"},y.map(function(t,e){return g(t,m+e)}))))}}]),e}(l.Component);r.default=c},{preact:490}],641:[function(t,e,r){"use strict";function n(t){var e=t.split(/\+(?!$)/),r=e[e.length-1];"Space"===r&&(r=" ");for(var n=void 0,o=void 0,i=void 0,a=void 0,s=0;s<e.length-1;s++){var u=e[s];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else{if(!/^mod$/i.test(u))throw new Error("Unrecognized modifier name: "+u);p?a=!0:o=!0}}return n&&(r="Alt+"+r),o&&(r="Ctrl+"+r),a&&(r="Meta+"+r),i&&(r="Shift+"+r),r}function o(t){var e=Object.create(null);return Object.keys(t).forEach(function(r){e[n(r)]=t[r]}),e}function i(t,e,r){return e.altKey&&(t="Alt+"+t),e.ctrlKey&&(t="Ctrl+"+t),e.metaKey&&(t="Meta+"+t),!1!==r&&e.shiftKey&&(t="Shift+"+t),t}function a(t,e){return t.replace(/[а-я]/,d.default.base[e.keyCode]).replace(/[А-Я]/,d.default.shift[e.keyCode])}function s(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=a((0,d.default)(t),t),n=1===r.length&&" "!==r;return n&&!e?i(r,t,!n):i(d.default.base[t.keyCode],t,!0)}function u(t){return t instanceof KeyboardEvent?s.apply(void 0,arguments):"object"===(void 0===t?"undefined":c(t))?o(t):n(t)}function l(t,e){var r=a((0,d.default)(e),e);"Add"===r&&(r="+"),"Subtract"===r&&(r="-");var n=1===r.length&&" "!==r,o=t[i(r,e,!n)],s=void 0;return e.shiftKey&&n&&(s=d.default.base[e.keyCode])&&(o=t[i(s,e,!0)]||o),o}Object.defineProperty(r,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=t("w3c-keyname"),d=function(t){return t&&t.__esModule?t:{default:t}}(f),p="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);u.lookup=l,r.default=u},{"w3c-keyname":521}],642:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){return"R#"===t.label?S({type:"rlabel",values:p(t.rglabel)},t):"L#"===t.label?l(t):E.default.map[t.label]?s(t):!t.label&&"attpnt"in t?{ap:f(t.attpnt)}:t}function a(t){return"rlabel"===t.type?{label:t.values.length?"R#":"C",rglabel:0===t.values.length?null:h(t.values)}:"list"===t.type||"not-list"===t.type?c(t):!t.label&&"ap"in t?{attpnt:d(t.ap)}:E.default.map[(0,w.default)(t.label)]?u(t):"A"===t.label||"*"===t.label||"Q"===t.label||"X"===t.label||"R"===t.label?(t.pseudo=t.label,u(t)):t}function s(t){var e=t.alias||"",r=t.charge.toString();return{alias:e,label:t.label,charge:r,isotope:t.isotope,explicitValence:t.explicitValence,radical:t.radical,invRet:t.invRet,exactChangeFlag:!!t.exactChangeFlag,ringBondCount:t.ringBondCount,substitutionCount:t.substitutionCount,unsaturatedAtom:!!t.unsaturatedAtom,hCount:t.hCount}}function u(t){var e=P.atom.properties.charge.pattern,r=e.exec(t.charge),n=r?parseInt(r[1]+r[3]+r[2]):t.charge,o=Object.assign({},t,{label:(0,w.default)(t.label)});return void 0!==n&&(o.charge=n),o}function l(t){return{type:t.atomList.notList?"not-list":"list",values:t.atomList.ids.map(function(t){return E.default[t].label})}}function c(t){return{pseudo:null,label:"L#",atomList:new O.AtomList({notList:"not-list"===t.type,ids:t.values.map(function(t){return E.default.map[t]})})}}function f(t){return{primary:(1&(t||0))>0,secondary:(2&(t||0))>0}}function d(t){return(t.primary&&1)+(t.secondary&&2)}function p(t){var e=[],r=void 0,n=void 0;for(r=0;r<32;r++)t&1<<r&&(n=r+1,e.push(n));return e}function h(t){var e=0;return t.forEach(function(t){e|=1<<t-1}),e}function m(t){return{type:b(t.type,t.stereo),topology:t.topology||0,center:t.reactingCenterStatus||0}}function g(t){return S({topology:t.topology,reactingCenterStatus:t.center},v(t.type))}function v(t){return Object.assign({},T[t])}function b(t,e){for(var r in T)if(T[r].type===t&&T[r].stereo===e)return r;throw Error("No such bond caption")}function y(t){var e=t.type||"GEN",r=t.attrs,n=r.context,o=r.fieldName,i=r.fieldValue,a=r.absolute,s=r.attached;return t.attrs.radiobuttons=!1===a&&!1===s?"Relative":s?"Attached":"Absolute",j.sdataSchema[n][o]&&j.sdataSchema[n][o].properties.fieldValue.items&&(t.attrs.fieldValue=i.split("\n")),Object.assign({type:e},t.attrs)}function _(t){var e=t.type,r=t.radiobuttons,n=o(t,["type","radiobuttons"]),i=S({},n);switch(r){case"Absolute":i.absolute=!0,i.attached=!1;break;case"Attached":i.absolute=!1,i.attached=!0;break;case"Relative":i.absolute=!1,i.attached=!1}return i.fieldName&&(i.fieldName=i.fieldName.trim()),i.fieldValue&&(i.fieldValue="string"==typeof i.fieldValue?i.fieldValue.trim():i.fieldValue),{type:e,attrs:i}}Object.defineProperty(r,"__esModule",{value:!0});var x=t("lodash/fp/capitalize"),w=n(x),S=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.fromElement=i,r.toElement=a,r.fromBond=m,r.toBond=g,r.toBondType=v,r.fromSgroup=y,r.toSgroup=_;var O=t("../../../chem/struct/index"),A=t("../../../chem/element"),E=n(A),j=t("../schema/sdata-schema"),P=t("../schema/struct-schema"),T={single:{type:O.Bond.PATTERN.TYPE.SINGLE,stereo:O.Bond.PATTERN.STEREO.NONE},up:{type:O.Bond.PATTERN.TYPE.SINGLE,stereo:O.Bond.PATTERN.STEREO.UP},down:{type:O.Bond.PATTERN.TYPE.SINGLE,stereo:O.Bond.PATTERN.STEREO.DOWN},updown:{type:O.Bond.PATTERN.TYPE.SINGLE,stereo:O.Bond.PATTERN.STEREO.EITHER},double:{type:O.Bond.PATTERN.TYPE.DOUBLE,stereo:O.Bond.PATTERN.STEREO.NONE},crossed:{type:O.Bond.PATTERN.TYPE.DOUBLE,stereo:O.Bond.PATTERN.STEREO.CIS_TRANS},triple:{type:O.Bond.PATTERN.TYPE.TRIPLE,stereo:O.Bond.PATTERN.STEREO.NONE},aromatic:{type:O.Bond.PATTERN.TYPE.AROMATIC,stereo:O.Bond.PATTERN.STEREO.NONE},singledouble:{type:O.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE,stereo:O.Bond.PATTERN.STEREO.NONE},singlearomatic:{type:O.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC,stereo:O.Bond.PATTERN.STEREO.NONE},doublearomatic:{type:O.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC,stereo:O.Bond.PATTERN.STEREO.NONE},any:{type:O.Bond.PATTERN.TYPE.ANY,stereo:O.Bond.PATTERN.STEREO.NONE}}},{"../../../chem/element":525,"../../../chem/struct/index":542,"../schema/sdata-schema":646,"../schema/struct-schema":647,"lodash/fp/capitalize":423}],643:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r=t.trim();if(-1!==r.indexOf("$RXN"))return"rxn";var n=r.match(/^(M {2}END|\$END MOL)$/m);if(n){var o=n.index+n[0].length;if(o===r.length||-1!==r.slice(o,o+20).search(/^\$(MOL|END CTAB)$/m))return"mol"}return"<"===r[0]&&-1!==r.indexOf("<molecule")?"cml":"InChI"===r.slice(0,5)?"inchi":-1===r.indexOf("\n")?"smiles":e?null:"mol"}function i(t,e,r,n){return console.assert(d[e],"No such format"),new Promise(function(o){var i=l.default.stringify(t);if("mol"===e||"rxn"===e)o(i);else if("smiles"===e)o(f.default.stringify(t));else{var a=r.then(function(){return r.convert({struct:i,output_format:d[e].mime},n)}).catch(function(t){throw"Server is not compatible"===t.message?Error(d[e].name+" is not supported in standalone mode."):Error("Convert error!\n"+t.message)}).then(function(t){return t.struct});o(a)}})}function a(t,e,r,n){return new Promise(function(i){var a=o(t);if(console.assert(d[a],"No such format"),"mol"===a||"rxn"===a){i(l.default.parse(t,e))}else{var s=d[a].supportsCoords;i(r.then(function(){return s?r.convert({struct:t,output_format:d.mol.mime},n):r.layout({struct:t.trim(),output_format:d.mol.mime},n)}).catch(function(t){if("Server is not compatible"===t.message){var e="smiles"===a?d["smiles-ext"].name+" and opening of "+d.smiles.name:d[a].name;throw Error(e+" is not supported in standalone mode.")}throw Error("Convert error!\n"+t.message)}).then(function(t){var e=l.default.parse(t.struct);return s||e.rescale(),e}))}})}function s(t,e){if("inchi"===e||"smiles"===e){if(0!==t.rgroups.size)return"In "+d[e].name+" the structure will be saved without R-group fragments";t=t.clone();if(null!==t.atoms.find(function(t,e){return"R#"===e.label}))return"In "+d[e].name+" the structure will be saved without R-group members";if(null!==t.sgroups.find(function(t,e){return"MUL"!==e.type&&!/^INDIGO_.+_DESC$/i.test(e.data.fieldName)}))return"In "+d[e].name+" the structure will be saved without S-groups"}return null}Object.defineProperty(r,"__esModule",{value:!0}),r.map=void 0,r.guess=o,r.toString=i,r.fromString=a,r.couldBeSaved=s;var u=t("../../../chem/molfile"),l=n(u),c=t("../../../chem/smiles"),f=n(c),d=r.map={mol:{name:"MDL Molfile",mime:"chemical/x-mdl-molfile",ext:[".mol"],supportsCoords:!0},rxn:{name:"MDL Rxnfile",mime:"chemical/x-mdl-rxnfile",ext:[".rxn"],supportsCoords:!0},smiles:{name:"Daylight SMILES",mime:"chemical/x-daylight-smiles",ext:[".smi",".smiles"]},"smiles-ext":{name:"Extended SMILES",mime:"chemical/x-chemaxon-cxsmiles",ext:[".cxsmi",".cxsmiles"]},smarts:{name:"Daylight SMARTS",mime:"chemical/x-daylight-smarts",ext:[".smarts"]},inchi:{name:"InChI",mime:"chemical/x-inchi",ext:[".inchi"]},"inchi-aux":{name:"InChI AuxInfo",mime:"chemical/x-inchi-aux",ext:[".inchi"]},cml:{name:"CML",mime:"chemical/x-cml",ext:[".cml",".mrv"],supportsCoords:!0}}},{"../../../chem/molfile":528,"../../../chem/smiles":537}],644:[function(t,e,r){"use strict";function n(){return Object.keys(h.properties).reduce(function(t,e){return t[e]=h.properties[e].default,t},{})}function o(t){if("object"!==(void 0===t?"undefined":i(t))||null===t)return null;var e=new u.default.Validator,r=e.validate(t,h),n=r.errors,o=n.map(function(t){return t.property.split(".")[1]});return Object.keys(t).reduce(function(e,r){return h.properties[r]&&-1===o.indexOf(r)&&(e[r]=t[r]),e},{})}Object.defineProperty(r,"__esModule",{value:!0}),r.MIEW_OPTIONS=r.SERVER_OPTIONS=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.getDefaultOptions=n,r.validation=o;var s=t("jsonschema"),u=function(t){return t&&t.__esModule?t:{default:t}}(s),l={resetToSelect:{title:"Reset to Select Tool",enum:[!0,"paste",!1],enumNames:["on","After Paste","off"],default:"paste"},rotationStep:{title:"Rotation Step, º",type:"integer",minimum:1,maximum:90,default:15}},c={showValenceWarnings:{title:"Show valence warnings",type:"boolean",default:!0},atomColoring:{title:"Atom coloring",type:"boolean",default:!0},hideChiralFlag:{title:"Do not show the Chiral flag",type:"boolean",default:!1},font:{title:"Font",type:"string",default:"30px Arial"},fontsz:{title:"Font size",type:"integer",default:13,minimum:1,maximum:96},fontszsub:{title:"Sub font size",type:"integer",default:13,minimum:1,maximum:96},carbonExplicitly:{title:"Display carbon explicitly",type:"boolean",default:!1},showCharge:{title:"Display charge",type:"boolean",default:!0},showValence:{title:"Display valence",type:"boolean",default:!0},showHydrogenLabels:{title:"Show hydrogen labels",enum:["off","Hetero","Terminal","Terminal and Hetero","on"],default:"on"},aromaticCircle:{title:"Aromatic Bonds as circle",type:"boolean",default:!0},doubleBondWidth:{title:"Double bond width",type:"integer",default:6,minimum:1,maximum:96},bondThickness:{title:"Bond thickness",type:"integer",default:2,minimum:1,maximum:96},stereoBondWidth:{title:"Stereo (Wedge) bond width",type:"integer",default:6,minimum:1,maximum:96}},f={"smart-layout":{title:"Smart-layout",type:"boolean",default:!0},"ignore-stereochemistry-errors":{title:"Ignore stereochemistry errors",type:"boolean",default:!0},"mass-skip-error-on-pseudoatoms":{title:"Ignore pseudoatoms at mass",type:"boolean",default:!1},"gross-formula-add-rsites":{title:"Add Rsites at mass calculation",type:"boolean",default:!0},"gross-formula-add-isotopes":{title:"Add Isotopes at mass calculation",type:"boolean",default:!0}},d=(r.SERVER_OPTIONS=Object.keys(f),{showAtomIds:{title:"Show atom Ids",type:"boolean",default:!1},showBondIds:{title:"Show bonds Ids",type:"boolean",default:!1},showHalfBondIds:{title:"Show half bonds Ids",type:"boolean",default:!1},showLoopIds:{title:"Show loop Ids",type:"boolean",default:!1}}),p={miewMode:{title:"Display mode",enum:["LN","BS","LC"],enumNames:["Lines","Balls and Sticks","Licorice"],default:"LN"},miewTheme:{title:"Background color",enum:["light","dark"],enumNames:["Light","Dark"],default:"light"},miewAtomLabel:{title:"Label coloring",enum:["no","bright","blackAndWhite","black"],enumNames:["No","Bright","Black and White","Black"],default:"bright"}},h=(r.MIEW_OPTIONS=Object.keys(p),{title:"Settings",type:"object",required:[],properties:a({},l,c,f,d,p)});r.default=h},{jsonschema:204}],645:[function(t,e,r){"use strict";function n(t,e){var r=t.properties[e];return r.constant||r.enum[0]}function o(t,e){return console.assert(t.oneOf),t.oneOf.reduce(function(t,r){return t[n(r,e)]=r,t},{})}function i(t,e){var r=t.properties&&t.properties[e];return r?r.enum.map(function(t,e){var n=r.enumNames&&r.enumNames[e];return n?{title:n,value:t}:t}):t.oneOf.map(function(t){return t.title?{title:t.title,value:n(t,e)}:n(t,e)})}Object.defineProperty(r,"__esModule",{value:!0}),r.mapOf=o,r.selectListOf=i},{}],646:[function(t,e,r){"use strict";function n(t){return Object.keys(t)[0]}function o(t,e){return t||e?e?l[t][e]?l[t][e].properties.fieldValue.default:"":n(l[t]):n(l)}Object.defineProperty(r,"__esModule",{value:!0}),r.sdataSchema=r.sdataCustomSchema=void 0,r.getSdataDefault=o;var i=t("./schema-helper"),a={enum:["Absolute","Relative","Attached"],default:"Absolute"},s={title:"Context",enum:["Fragment","Multifragment","Bond","Atom","Group"],default:"Fragment"},u={Fragment:{title:"Fragment",type:"Object",oneOf:[{key:"FRG_STR",title:"MDLBG_FRAGMENT_STEREO",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_STEREO"],default:"MDLBG_FRAGMENT_STEREO"},fieldValue:{title:"Field value",type:"array",items:{enum:["abs","(+)-enantiomer","(-)-enantiomer","racemate","steric","rel","R(a)","S(a)","R(p)","S(p)"]},default:["abs"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_COEFF",title:"MDLBG_FRAGMENT_COEFFICIENT",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_COEFFICIENT"],default:"MDLBG_FRAGMENT_COEFFICIENT"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_CHRG",title:"MDLBG_FRAGMENT_CHARGE",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_CHARGE"],default:"MDLBG_FRAGMENT_CHARGE"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_RAD",title:"MDLBG_FRAGMENT_RADICALS",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_RADICALS"],default:"MDLBG_FRAGMENT_RADICALS"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Multifragment:{title:"Multifragment",type:"Object",oneOf:[{key:"MLT_FRG",title:"KETCHER_MULTIPLE_FRAGMENT",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["KETCHER_MULTIPLE_FRAGMENT"],default:"KETCHER_MULTIPLE_FRAGMENT"},fieldValue:{title:"Field value",type:"array",items:{enum:["aerosol","alloy","catenane","complex","composite","co-polymer","emulsion","host-guest complex","mixture","rotaxane","suspension"]},default:["aerosol"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Bond:{title:"Bond",type:"Object",oneOf:[{key:"SB_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["erythro","threo","alpha","beta","endo","exo","anti","syn","ECL","STG"]},default:["erythro"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"SB_BND",title:"MDLBG_BOND_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_BOND_KEY"],default:"MDLBG_BOND_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["Value=4"]},default:["Value=4"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Atom:{title:"Atom",type:"Object",oneOf:[{key:"AT_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["RS","SR","P-3","P-3-PI","SP-4","SP-4-PI","T-4","T-4-PI","SP-5","SP-5-PI","TB-5","TB-5-PI","OC-6","TP-6","PB-7","CU-8","SA-8","DD-8","HB-9","TPS-9"]},default:["RS"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Group:{title:"Group",type:"Object",oneOf:[{key:"GRP_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["cis","trans"]},default:["cis"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]}},l=(r.sdataCustomSchema={key:"Custom",properties:{type:{enum:["DAT"]},context:{title:"Context",enum:["Fragment","Multifragment","Bond","Atom","Group"],default:"Fragment"},fieldName:{title:"Field name",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field value"},radiobuttons:{enum:["Absolute","Relative","Attached"],default:"Absolute"}},required:["context","fieldName","fieldValue","radiobuttons"]},r.sdataSchema=Object.keys(u).reduce(function(t,e){return t[e]=(0,i.mapOf)(u[e],"fieldName"),Object.keys(t[e]).forEach(function(r){t[e][r].properties.context=s}),t},{}))},{"./schema-helper":645}],647:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rgroupLogic=r.sgroupMap=r.bond=r.attachmentPoints=r.labelEdit=r.rgroupSchema=r.atom=void 0;var n=t("lodash/fp/range"),o=function(t){return t&&t.__esModule?t:{default:t}}(n),i=t("./schema-helper"),a=(r.atom={title:"Atom",type:"object",required:"label",properties:{label:{title:"Label",type:"string",maxLength:3,invalidMessage:"Wrong label"},alias:{title:"Alias",type:"string",invalidMessage:"Leading and trailing spaces are not allowed"},charge:{title:"Charge",type:"string",pattern:/^([+-]?)(\d{1,3}|1000)([+-]?)$/,maxLength:5,default:"0",invalidMessage:"Invalid charge value"},explicitValence:{title:"Valence",enum:[-1,0,1,2,3,4,5,6,7,8],enumNames:["","0","I","II","III","IV","V","VI","VII","VIII"],default:-1},isotope:{title:"Isotope",type:"integer",minimum:0,default:0,invalidMessage:"There must be integer"},radical:{title:"Radical",enum:[0,2,1,3],enumNames:["","Monoradical","Diradical (singlet)","Diradical (triplet)"],default:0},ringBondCount:{title:"Ring bond count",enum:[0,-2,-1,2,3,4],enumNames:["","As drawn","0","2","3","4"],default:0},hCount:{title:"H count",enum:[0,1,2,3,4,5],enumNames:["","0","1","2","3","4"],default:0},substitutionCount:{title:"Substitution count",enum:[0,-2,-1,1,2,3,4,5,6],enumNames:["","As drawn","0","1","2","3","4","5","6"],default:0},unsaturatedAtom:{title:"Unsaturated",type:"boolean",default:!1},invRet:{title:"Inversion",enum:[0,1,2],enumNames:["","Inverts","Retains"],default:0},exactChangeFlag:{title:"Exact change",type:"boolean",default:!1}}},r.rgroupSchema={title:"R-group",type:"object",properties:{values:{type:"array",items:{type:"string",enum:(0,o.default)(1,33),enumNames:(0,o.default)(1,33).map(function(t){return"R"+t})}}}},r.labelEdit={title:"Label Edit",type:"object",required:["label"],properties:{label:{title:"Atom",default:"",invalidMessage:"Wrong atom symbol"}}},r.attachmentPoints={title:"Attachment Points",type:"object",properties:{primary:{title:"Primary attachment point",type:"boolean"},secondary:{title:"Secondary attachment point",type:"boolean"}}},r.bond={title:"Bond",type:"object",required:["type"],properties:{type:{title:"Type",enum:["single","up","down","updown","double","crossed","triple","aromatic","any","singledouble","singlearomatic","doublearomatic"],enumNames:["Single","Single Up","Single Down","Single Up/Down","Double","Double Cis/Trans","Triple","Aromatic","Any","Single/Double","Single/Aromatic","Double/Aromatic"],default:"single"},topology:{title:"Topology",enum:[0,1,2],enumNames:["Either","Ring","Chain"],default:0},center:{title:"Reacting Center",enum:[0,-1,1,2,4,8,12],enumNames:["Unmarked","Not center","Center","No change","Made/broken","Order changes","Made/broken and changes"],default:0}}},{title:"SGroup",type:"object",required:["type"],oneOf:[{key:"GEN",title:"Generic",properties:{type:{enum:["GEN"]}}},{key:"MUL",title:"Multiple group",type:"object",properties:{type:{enum:["MUL"]},mul:{title:"Repeat count",type:"integer",default:1,minimum:1,maximum:1e3,invalidMessage:"Value out of range: must be between 1 and 1000"}},required:["mul"]},{key:"SRU",title:"SRU polymer",properties:{type:{enum:["SRU"]},subscript:{title:"Polymer label",type:"string",default:"n",pattern:/^[a-zA-Z]$/,invalidMessage:"SRU subscript should consist of a single letter"
  },connectivity:{title:"Repeat Pattern",enum:["ht","hh","eu"],enumNames:["Head-to-tail","Head-to-head","Either unknown"],default:"ht"}},required:["subscript","connectivity"]},{key:"SUP",title:"Superatom",properties:{type:{enum:["SUP"]},name:{title:"Name",type:"string",default:"",minLength:1,invalidMessage:"Please, provide a name for the superatom"}},required:["name"]}]});r.sgroupMap=(0,i.mapOf)(a,"type"),r.rgroupLogic={title:"R-Group",type:"object",properties:{range:{title:"Occurrence",type:"string",maxLength:50,invalidMessage:"Wrong value"},resth:{title:"RestH",type:"boolean"},ifthen:{title:"Condition",type:"integer",minium:0}}}},{"./schema-helper":645,"lodash/fp/range":438}],648:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../chem/molfile"),o=function(t){return t&&t.__esModule?t:{default:t}}(n);r.default=["Benzene\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  6  6  0     0  0            999 V2000\n    0.8660    2.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7320    1.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7320    0.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.8660    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    0.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    1.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  2  3  2  0     0  0\n  3  4  1  0     0  0\n  4  5  2  0     0  0\n  5  6  1  0     0  0\n  6  1  2  0     0  0\nM  END\n","Cyclopentadiene\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  5  5  0     0  0            999 V2000\n    0.0000    1.4257    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.8090    0.8379    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.5000   -0.1132    0.0000 C   0  0  0  0  0  0        0  0  0\n   -0.5000   -0.1132    0.0000 C   0  0  0  0  0  0        0  0  0\n   -0.8090    0.8379    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  2  3  2  0     0  0\n  3  4  1  0     0  0\n  4  5  2  0     0  0\n  5  1  1  0     0  0\nM  END\n","Cyclohexane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  6  6  0     0  0            999 V2000\n    0.8660    2.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7320    1.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7320    0.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.8660    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    0.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    1.5000    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  2  3  1  0     0  0\n  3  4  1  0     0  0\n  4  5  1  0     0  0\n  5  6  1  0     0  0\n  6  1  1  0     0  0\nM  END\n","Cyclopentane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  5  5  0     0  0            999 V2000\n    0.8090    1.5389    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.6180    0.9511    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.3090    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.3090    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    0.9511    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  2  3  1  0     0  0\n  3  4  1  0     0  0\n  4  5  1  0     0  0\n  5  1  1  0     0  0\nM  END\n","Cyclopropane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  3  3  0     0  0            999 V2000\n   -3.2250   -0.2750    0.0000 C   0  0  0  0  0  0        0  0  0\n   -2.2250   -0.2750    0.0000 C   0  0  0  0  0  0        0  0  0\n   -2.7250    0.5910    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  2  3  1  0     0  0\n  1  3  1  0     0  0\nM  END\n","Cyclobutane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  4  4  0     0  0            999 V2000\n   -3.8250    1.5500    0.0000 C   0  0  0  0  0  0        0  0  0\n   -3.8250    0.5500    0.0000 C   0  0  0  0  0  0        0  0  0\n   -2.8250    1.5500    0.0000 C   0  0  0  0  0  0        0  0  0\n   -2.8250    0.5500    0.0000 C   0  0  0  0  0  0        0  0  0\n  1  2  1  0     0  0\n  1  3  1  0     0  0\n  3  4  1  0     0  0\n  4  2  1  0     0  0\nM  END\n","Cycloheptane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  7  7  0     0  0            999 V2000\n    0.0000    1.6293    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.7835    2.2465    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7559    2.0242    0.0000 C   0  0  0  0  0  0        0  0  0\n    2.1897    1.1289    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    0.6228    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7566    0.2224    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.7835    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n  6  7  1  0     0  0\n  5  7  1  0     0  0\n  1  5  1  0     0  0\n  4  6  1  0     0  0\n  3  4  1  0     0  0\n  2  3  1  0     0  0\n  1  2  1  0     0  0\nM  END\n","Cyclooctane\n  Ketcher 11161218352D 1   1.00000     0.00000     0\n\n  8  8  0     0  0            999 V2000\n    0.0000    0.7053    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.0000    1.7078    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.7053    2.4131    0.0000 C   0  0  0  0  0  0        0  0  0\n    0.7056    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7079    0.0000    0.0000 C   0  0  0  0  0  0        0  0  0\n    2.4133    0.7053    0.0000 C   0  0  0  0  0  0        0  0  0\n    2.4133    1.7078    0.0000 C   0  0  0  0  0  0        0  0  0\n    1.7079    2.4131    0.0000 C   0  0  0  0  0  0        0  0  0\n  8  3  1  0     0  0\n  7  8  1  0     0  0\n  6  7  1  0     0  0\n  5  6  1  0     0  0\n  4  5  1  0     0  0\n  1  4  1  0     0  0\n  2  3  1  0     0  0\n  1  2  1  0     0  0\nM  END\n"].map(function(t){return o.default.parse(t)})},{"../../chem/molfile":528}],649:[function(t,e,r){"use strict";function n(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t){var e=t.labels,r=t.caption,o=void 0===r?"":r,i=t.selected,a=t.onSelect,s=n(t,["labels","caption","selected","onSelect"]);return(0,u.h)("fieldset",s,e.map(function(t){return(0,u.h)("button",{onClick:function(){return a(t)},className:i(t)?"selected":""},t)}),o?(0,u.h)("legend",null,o):null)}function i(t){var e=t.gen,r=t.name,n=t.path,a=t.selected,s=t.onSelect,l=e[r],c=n?n+"/"+r:r,d=f[c];return d&&d.caption?(0,u.h)("fieldset",{className:r},(0,u.h)("legend",null,d.caption),l.labels?(0,u.h)(o,{labels:l.labels,selected:a,onSelect:s}):null,d.order.map(function(t){return(0,u.h)(i,{gen:l,name:t,path:c,selected:a,onSelect:s})})):(0,u.h)(o,{labels:l.labels,caption:d||r,className:r,selected:a,onSelect:s})}function a(t){var e=t.selected,r=t.onSelect,o=n(t,["selected","onSelect"]);return(0,u.h)("div",s({summary:"Generic Groups"},o),(0,u.h)("div",{className:"col"},(0,u.h)(i,{gen:c.default,name:"atom",selected:function(t){return e(t)},onSelect:function(t){return r(t)}}),(0,u.h)(i,{gen:c.default,name:"special",selected:function(t){return e(t)},onSelect:function(t){return r(t)}})),(0,u.h)("div",{className:"col"},(0,u.h)(i,{gen:c.default,name:"group",selected:function(t){return e(t)},onSelect:function(t){return r(t)}})))}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=t("preact"),l=t("../../../chem/generics"),c=function(t){return t&&t.__esModule?t:{default:t}}(l),f={atom:{caption:"Atom Generics",order:["any","no-carbon","metal","halogen"]},group:{caption:"Group Generics",order:["acyclic","cyclic"]},special:{caption:"Special Nodes",order:[]},"group/acyclic":{caption:"Acyclic",order:["carbo","hetero"]},"group/cyclic":{caption:"Cyclic",order:["no-carbon","carbo","hetero"]},"group/acyclic/carbo":{caption:"Carbo",order:["alkynyl","alkyl","alkenyl"]},"group/acyclic/hetero":{caption:"Hetero",order:["alkoxy"]},"group/cyclic/carbo":{caption:"Carbo",order:["aryl","cycloalkyl","cycloalkenyl"]},"group/cyclic/hetero":{caption:"Hetero",order:["aryl"]},"atom/any":"any atom","atom/no-carbon":"except C or H","atom/metal":"any metal","atom/halogen":"any halogen","group/cyclic/no-carbon":"no carbon","group/cyclic/hetero/aryl":"hetero aryl"};r.default=a},{"../../../chem/generics":526,preact:490}],650:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function u(){return(0,_.h)("tr",null,(0,v.default)(0,19).map(function(t){return(0,_.h)("th",null,t||"")}))}function l(t){var e=t.value,r=t.onChange,n=s(t,["value","onChange"]);return(0,_.h)("fieldset",null,B.map(function(t){return(0,_.h)("label",null,(0,_.h)("input",y({type:"radio",value:t.value,checked:t.value===e,onClick:function(){return r(t.value)}},n)),t.title)}))}function c(t){var e=t.row,r=t.caption,n=t.refer,o=t.selected,i=t.onSelect,a=t.curEvents;return(0,_.h)("tr",null,(0,_.h)("th",null,r),e.map(function(t){return"number"!=typeof t?(0,_.h)("td",null,(0,_.h)(P.default,y({el:t,className:o(t.label)?"selected":"",onClick:function(){return i(t.label)}},a(t)))):n(t)?(0,_.h)("td",{className:"ref"},n(t)):(0,_.h)("td",{colSpan:t})}))}function f(t){var e=t.row,r=t.caption,n=t.selected,o=t.onSelect,i=t.curEvents;return(0,_.h)("tr",null,(0,_.h)("th",{colSpan:"3",className:"ref"},r),e.map(function(t){return(0,_.h)("td",null,(0,_.h)(P.default,y({el:t,className:n(t.label)?"selected":"",onClick:function(){return o(t.label)}},i(t))))}),(0,_.h)("td",null))}function d(t){var e=t.el,r=t.isInfo,n={color:O.sketchingColors[e.label]||"black","font-size":"1.2em"},o={color:O.sketchingColors[e.label]||"black","font-weight":"bold","font-size":"2em"};return(0,_.h)("div",{className:"ket-atom-info "+(r?"":"none")},(0,_.h)("div",{style:n},S.default.map[e.label]),(0,_.h)("span",{style:o},e.label),(0,_.h)("br",null),e.title,(0,_.h)("br",null),e.atomic_mass)}function p(t){var e=t.selection();if(e&&1===Object.keys(e).length&&e.atoms&&1===Object.keys(e.atoms).length){var r=t.struct(),n=r.atoms.get(e.atoms[0]);return y({},(0,R.fromElement)(n))}return{}}Object.defineProperty(r,"__esModule",{value:!0});var h=t("lodash/fp/xor"),m=n(h),g=t("lodash/fp/range"),v=n(g),b=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_=t("preact"),x=t("preact-redux"),w=t("../../../chem/element"),S=n(w),O=t("../../../chem/element-color"),A=t("../../component/dialog"),E=n(A),j=t("../../component/view/atom"),P=n(j),T=t("../../component/view/tabs"),C=n(T),k=t("./generic-groups"),M=n(k),R=t("../../data/convert/structconv"),N=t("../../state"),I=t("../../state/toolbar"),B=[{title:"Single",value:"atom"},{title:"List",value:"list"},{title:"Not List",value:"not-list"}],L={He:16,B:10,Al:10,Hf:1,Rf:1},D=function(t){return t.reduce(function(t,e){var r=t[e.period-1];return r?(L[e.label]&&r.push(L[e.label]),r.push(e)):t.push([e]),t},[])}(S.default.filter(function(t){return t&&"actinide"!==t.type&&"lanthanide"!==t.type})),F=S.default.filter(function(t){return t&&"lanthanide"===t.type}),G=S.default.filter(function(t){return t&&"actinide"===t.type}),z=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));r.curEvents=function(t){return{onMouseEnter:function(){return r.setState({cur:t,isInfo:!0})},onMouseLeave:function(){return r.setState({isInfo:!1})}}};var n=r.props.pseudo?"gen":null;return r.state={type:t.type||n||"atom",value:t.values||t.label||null,cur:S.default[2],isInfo:!1},r.firstType=!0,r.selected=r.selected.bind(r),r.onSelect=r.onSelect.bind(r),r}return a(e,t),b(e,[{key:"changeType",value:function(t){if(this.firstType)return void(this.firstType=!1);var e="list"===this.state.type||"not-list"===this.state.type;"list"!==t&&"not-list"!==t||!e?this.setState({type:t,value:"atom"===t||"gen"===t?null:[]}):this.setState({type:t})}},{key:"selected",value:function(t){var e=this.state,r=e.type,n=e.value;return"atom"===r||"gen"===r?n===t:n.includes(t)}},{key:"onSelect",value:function(t){var e=this.state,r=e.type,n=e.value;this.setState({value:"atom"===r||"gen"===r?t:(0,m.default)([t],n)})}},{key:"result",value:function(){var t=this.state,e=t.type,r=t.value;return"atom"===e?r?{label:r,pseudo:null}:null:"gen"===e?r?{type:e,label:r,pseudo:r}:null:r.length?{type:e,values:r}:null}},{key:"render",value:function(){var t=this,e=["Table","Extended"],r=this.state,n=r.type,o=r.value;return(0,_.h)(E.default,{title:"Periodic table",className:"elements-table",params:this.props,result:function(){return t.result()}},(0,_.h)(C.default,{className:"tabs",captions:e,tabIndex:"gen"!==n?0:1,changeTab:function(e){return t.changeType(0===e?"atom":"gen")}},(0,_.h)("div",{className:"period-table"},(0,_.h)(d,{el:this.state.cur,isInfo:this.state.isInfo}),(0,_.h)(H,{value:o,curEvents:this.curEvents,selected:this.selected,onSelect:this.onSelect}),(0,_.h)(l,{value:n,onChange:function(e){return t.changeType(e)}})),(0,_.h)(M.default,{className:"generic-groups",selected:this.selected,onSelect:this.onSelect})))}}]),e}(_.Component),H=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),b(e,[{key:"shouldComponentUpdate",value:function(t){return t.value!==this.props.value}},{key:"render",value:function(){var t=this.props,e=t.curEvents,r=t.selected,n=t.onSelect,o={curEvents:e,selected:r,onSelect:n};return(0,_.h)("table",{summary:"Periodic table of the chemical elements"},(0,_.h)(u,null),D.map(function(t,e){return(0,_.h)(c,y({row:t,caption:e+1,refer:function(t){return 1===t&&(5===e?"*":"**")}},o))}),(0,_.h)(f,y({row:F,caption:"*"},o)),(0,_.h)(f,y({row:G,caption:"**"},o)))}}]),e}(_.Component);r.default=(0,x.connect)(function(t,e){return e.values||e.label?{}:p(t.editor)},function(t,e){return{onOk:function(r){r.type&&"atom"!==r.type||t((0,I.addAtoms)(r.label)),t((0,N.onAction)({tool:"atom",opts:(0,R.toElement)(r)})),e.onOk(r)}}})(z)},{"../../../chem/element":525,"../../../chem/element-color":524,"../../component/dialog":621,"../../component/view/atom":634,"../../component/view/tabs":639,"../../data/convert/structconv":642,"../../state":676,"../../state/toolbar":685,"./generic-groups":649,"lodash/fp/range":438,"lodash/fp/xor":443,preact:490,"preact-redux":489}],651:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./mainmenu/open"),i=n(o),a=t("./mainmenu/analyse"),s=n(a),u=t("./mainmenu/recognize"),l=n(u),c=t("./elements/period-table"),f=n(c),d=t("./toolbox/rgroup"),p=n(d),h=t("./template/template-attach"),m=n(h),g=t("./template/template-lib"),v=n(g),b=t("./mainmenu/about"),y=n(b),_=t("./mainmenu/help"),x=n(_),w=t("./mainmenu/miew"),S=n(w),O=t("./toolbox/atom"),A=n(O),E=t("./toolbox/attach"),j=n(E),P=t("./toolbox/automap"),T=n(P),C=t("./toolbox/bond"),k=n(C),M=t("./mainmenu/check"),R=n(M),N=t("./toolbox/labeledit"),I=n(N),B=t("./toolbox/rgroup-logic"),L=n(B),D=t("./mainmenu/save"),F=n(D),G=t("./mainmenu/options"),z=n(G),H=t("./toolbox/sgroup"),W=n(H),U=t("./toolbox/sdata"),V=n(U);r.default={open:i.default,analyse:s.default,recognize:l.default,"period-table":f.default,rgroup:p.default,attach:m.default,templates:v.default,about:y.default,help:x.default,miew:S.default,atomProps:A.default,attachmentPoints:j.default,automap:T.default,bondProps:k.default,check:R.default,labelEdit:I.default,rgroupLogic:L.default,save:F.default,settings:z.default,sgroup:W.default,sdata:V.default}},{"./elements/period-table":650,"./mainmenu/about":652,"./mainmenu/analyse":653,"./mainmenu/check":654,"./mainmenu/help":655,"./mainmenu/miew":656,"./mainmenu/open":657,"./mainmenu/options":658,"./mainmenu/recognize":659,"./mainmenu/save":660,"./template/template-attach":661,"./template/template-lib":662,"./toolbox/atom":663,"./toolbox/attach":664,"./toolbox/automap":665,"./toolbox/bond":666,"./toolbox/labeledit":667,"./toolbox/rgroup":669,"./toolbox/rgroup-logic":668,"./toolbox/sdata":670,"./toolbox/sgroup":671}],652:[function(t,e,r){"use strict";function n(t){var e=t.indigoVersion&&t.indigoVersion.split(".r");return(0,i.h)(u.default,{title:"About",className:"about",params:t,buttons:["Close"]},(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/",target:"_blank"},(0,i.h)("img",{alt:"Ketcher",src:"logo/ketcher-logo.svg"})),(0,i.h)("dl",null,(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/help.html",target:"_blank"},"Ketcher")),(0,i.h)("dd",null,"version",(0,i.h)("var",null,t.version)),t.buildNumber?(0,i.h)("dd",null,"build #",(0,i.h)("var",null,t.buildNumber)," at ",(0,i.h)("time",null,t.buildDate)):null,t.indigoVersion?(0,i.h)("div",null,(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/indigo/",target:"_blank"},"Indigo Toolkit")),(0,i.h)("dd",null,"version",(0,i.h)("var",null,e[0])),(0,i.h)("dd",null,"build #",(0,i.h)("var",null,e[1]))):(0,i.h)("dd",null,"standalone"),(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/",target:"_blank"},"EPAM Life Sciences")),(0,i.h)("dd",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/#feedback",target:"_blank"},"Feedback"))))}Object.defineProperty(r,"__esModule",{value:!0});var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},i=t("preact"),a=t("preact-redux"),s=t("../../component/dialog"),u=function(t){return t&&t.__esModule?t:{default:t}}(s);r.default=(0,a.connect)(function(t){return o({},t.options.app)})(n)},{"../../component/dialog":621,preact:490,"preact-redux":489}],653:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e=t.value;return(0,g.h)("input",{type:"text",spellCheck:!1,value:e,onKeyDown:function(t){return f(t)}})}function l(t){return(0,g.h)("div",{className:"chem-input",spellCheck:"false",contentEditable:!0,onKeyDown:function(t){return f(t)}},t)}function c(t){var e=t.value;if(j.test(e))return l(e);for(var r=[],n=void 0,o=0;null!==(n=E.exec(e));)n[1].length>0&&r.push((0,g.h)("sup",null,n[1])),r.push(e.substring(o,n.index)+n[2]),n[3].length>0&&r.push((0,g.h)("sub",null,n[3])),o=n.index+n[0].length;return 0===o?r.push(e):r.push(e.substring(o,e.length)),l(r)}function f(t){var e=["Tab","ArrowLeft","ArrowRight","Home","End"],r=(0,y.default)(t);-1===e.indexOf(r)&&t.preventDefault()}function d(t,e){return"number"==typeof t?t.toFixed(e):t.replace(/[0-9]*\.[0-9]+/g,function(t){return(+t).toFixed(e)})}Object.defineProperty(r,"__esModule",{value:!0});var p=t("lodash/fp/range"),h=n(p),m=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),g=t("preact"),v=t("preact-redux"),b=t("w3c-keyname"),y=n(b),_=t("../../component/dialog"),x=n(_),w=t("../../component/form/input"),S=n(w),O=t("../../state/options"),A=t("../../state/server"),E=/\b(\d*)([A-Z][a-z]{0,3}#?)(\d*)\s*\b/g,j=/error:.*/g,P=function(t){function e(t){i(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.onAnalyse().catch(t.onCancel),r}return s(e,t),m(e,[{key:"render",value:function(){var t=this.props,e=t.values,r=t.round,n=(t.onAnalyse,t.onChangeRound),i=o(t,["values","round","onAnalyse","onChangeRound"]);return(0,g.h)(x.default,{title:"Calculated Values",className:"analyse",buttons:["Close"],params:i},(0,g.h)("ul",null,[{name:"Chemical Formula",key:"gross"},{name:"Molecular Weight",key:"molecular-weight",round:"roundWeight"},{name:"Exact Mass",key:"monoisotopic-mass",round:"roundMass"},{name:"Elemental Analysis",key:"mass-composition"}].map(function(t){return(0,g.h)("li",null,(0,g.h)("label",null,t.name,":"),"gross"===t.key?(0,g.h)(c,{value:e?e[t.key]:0}):(0,g.h)(u,{value:e?d(e[t.key],r[t.round]):0}),t.round?(0,g.h)(S.default,{schema:{enum:(0,h.default)(0,8),enumNames:(0,h.default)(0,8).map(function(t){return t+" decimal places"})},value:r[t.round],onChange:function(e){return n(t.round,e)}}):null)})))}}]),e}(g.Component);r.default=(0,v.connect)(function(t){return{values:t.options.analyse.values,round:{roundWeight:t.options.analyse.roundWeight,roundMass:t.options.analyse.roundMass}}},function(t){return{onAnalyse:function(){return t((0,A.analyse)())},onChangeRound:function(e,r){return t((0,O.changeRound)(e,r))}}})(P)},{"../../component/dialog":621,"../../component/form/input":625,"../../state/options":680,"../../state/server":681,"lodash/fp/range":438,preact:490,"preact-redux":489,"w3c-keyname":521}],654:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=y.properties.checkOptions.items;return e.enumNames[e.enum.indexOf(t)]}function a(t){var e=["Check","Settings"],r=t.formState,n=t.checkState,i=t.onCheck,a=o(t,["formState","checkState","onCheck"]),c=r.result,f=void 0===c?n:c,p=r.moleculeErrors;return(0,l.h)(d.default,{title:"Structure Check",className:"check",result:function(){return f},params:a},(0,l.h)(g.default,u({schema:y,init:n},r),(0,l.h)(h.default,{className:"tabs",captions:e,changeTab:function(t){return 0===t?i(f.checkOptions):null}},(0,l.h)(s,{moleculeErrors:p}),(0,l.h)(m.Field,{name:"checkOptions",multiple:!0,type:"checkbox",labelPos:!1}))))}function s(t){var e=t.moleculeErrors,r=Object.keys(e);return(0,l.h)("fieldset",t,0===r.length?(0,l.h)("dt",null,"No errors found"):r.map(function(t){return(0,l.h)("div",null,(0,l.h)("dt",null,i(t)," warning:"),(0,l.h)("dd",null,e[t]))}))}Object.defineProperty(r,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=t("preact"),c=t("preact-redux"),f=t("../../component/dialog"),d=n(f),p=t("../../component/view/tabs"),h=n(p),m=t("../../component/form/form"),g=n(m),v=t("../../state/server"),b=t("../../state/options"),y={title:"Check",type:"object",properties:{checkOptions:{type:"array",items:{type:"string",enum:["valence","radicals","pseudoatoms","stereo","query","overlapping_atoms","overlapping_bonds","rgroups","chiral","3d","chiral_flag"],enumNames:["Valence","Radical","Pseudoatom","Stereochemistry","Query","Overlapping Atoms","Overlapping Bonds","R-Groups","Chirality","3D Structure","Chiral flag"]}}}};r.default=(0,c.connect)(function(t){return{formState:t.modal.form,checkState:t.options.check}},function(t,e){return{onCheck:function(r){return t((0,v.check)(r)).catch(e.onCancel)},onOk:function(r){t((0,b.checkOpts)(r)),e.onOk(r)}}})(a)},{"../../component/dialog":621,"../../component/form/form":624,"../../component/view/tabs":639,"../../state/options":680,"../../state/server":681,preact:490,"preact-redux":489}],655:[function(t,e,r){"use strict";function n(t){return(0,o.h)(a.default,{title:"Help",className:"help",params:t,buttons:["Close"]},(0,o.h)("iframe",{className:"help",src:"doc/help.html"}))}Object.defineProperty(r,"__esModule",{value:!0});var o=t("preact"),i=t("../../component/dialog"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);r.default=n},{"../../component/dialog":621,preact:490}],656:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e={settings:{theme:t.miewTheme,autoPreset:!1,editing:!0,inversePanning:!0},reps:[{mode:t.miewMode}]},r=w(t);return r&&e.reps.push(r),e}Object.defineProperty(r,"__esModule",{value:!0});var l=t("lodash/fp/pick"),c=n(l),f=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),d=t("preact"),p=t("preact-redux"),h=t("../../component/dialog"),m=n(h),g=t("../../data/convert/structformat"),v=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(g),b=t("../../data/schema/options-schema"),y=t("../../state"),_={dark:"0x202020",light:"0xcccccc"},x={no:null,bright:{colorer:"EL"},blackAndWhite:{colorer:["UN",{color:16777215}],bg:"0x000"},black:{colorer:["UN",{color:0}]}},w=function(t){var e=t.miewAtomLabel;return null===x[e]?null:{colorer:x[e].colorer,selector:"not elem C",mode:["TX",{bg:x[e].bg||_[t.miewTheme],showBg:!0,template:"{{elem}}"}]}},S=function(t){function e(){return i(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),f(e,[{key:"componentDidMount",value:function(){var t=this,e=this.props,r=e.struct,n=e.server,o=e.miewOpts,i=window.Miew;this.viewer=new i({container:this.miewContainer}),this.viewer.init()&&this.viewer.run(),v.toString(r,"cml",n).then(function(e){return t.viewer.load(e,{sourceType:"immediate",fileType:"cml"})}).then(function(){return t.viewer.setOptions(o)}).catch(function(t){return console.error(t.message)})}},{key:"exportCML",value:function(){var t=this.viewer.exportCML();this.props.onExportCML(t)}},{key:"render",value:function(){var t=this,e=this.props,r=(e.miewOpts,e.server,e.struct,o(e,["miewOpts","server","struct"]));return(0,d.h)(m.default,{title:"Miew",className:"miew",params:r,buttons:[(0,d.h)("div",{className:"warning"},"Stereocenters can be changed after the strong 3D rotation"),"Close",(0,d.h)("button",{onClick:function(){return t.exportCML()}},"Apply")]},(0,d.h)("div",{ref:function(e){t.miewContainer=e},className:"miew-container",style:{width:"1024px",height:"600px",position:"relative"}}))}}]),e}(d.Component);r.default=(0,p.connect)(function(t){return{miewOpts:u((0,c.default)(b.MIEW_OPTIONS,t.options.settings)),server:t.options.app.server?t.server:null,struct:t.editor.struct()}},function(t,e){return{onExportCML:function(r){t((0,y.load)(r)),e.onOk()}}})(S)},{"../../component/dialog":621,"../../data/convert/structformat":643,"../../data/schema/options-schema":644,"../../state":676,"lodash/fp/pick":435,preact:490,"preact-redux":489}],657:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(){return Object.keys(d.map).reduce(function(t,e){return t.concat.apply(t,[d.map[e].mime].concat(o(d.map[e].ext)))},[]).join(",")}Object.defineProperty(r,"__esModule",{value:!0});var l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=t("preact"),f=t("preact-redux"),d=t("../../data/convert/structformat"),p=t("../../component/dialog"),h=n(p),m=t("../../component/view/openbutton"),g=n(m),v=t("../../component/cliparea"),b=n(v),y=t("../../state"),_=function(t){function e(t){i(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.state={structStr:"",fragment:!1},r}return s(e,t),l(e,[{key:"result",value:function(){var t=this.state,e=t.structStr,r=t.fragment;return e?{structStr:e,fragment:r}:null}},{key:"changeStructStr",value:function(t){this.setState({structStr:t})}},{key:"changeFragment",value:function(t){this.setState({fragment:t.checked})}},{key:"render",value:function(){var t=this,e=this.state,r=e.structStr,n=e.fragment;return(0,c.h)(h.default,{title:"Open Structure",className:"open",result:function(){return t.result()},params:this.props,buttons:[(0,c.h)(g.default,{server:this.props.server,type:u(),onLoad:function(e){return t.changeStructStr(e)}},"Open From File…"),"Cancel","OK"]},(0,c.h)("textarea",{value:r,onInput:function(e){return t.changeStructStr(e.target.value)}}),(0,c.h)("label",null,(0,c.h)("input",{type:"checkbox",checked:n,onClick:function(e){return t.changeFragment(e.target)}}),"Load as a fragment and copy to the Clipboard"),(0,c.h)(b.default,{focused:function(){return!0},onCopy:function(){return{"text/plain":r}}}))}}]),e}(c.Component);r.default=(0,f.connect)(function(t){return{server:t.server}},function(t,e){return{onOk:function(r){r.fragment&&(0,v.exec)("copy"),t((0,y.load)(r.structStr,{badHeaderRecover:!0,fragment:r.fragment})),e.onOk(r)}}})(_)},{"../../component/cliparea":620,"../../component/dialog":621,"../../component/view/openbutton":636,"../../data/convert/structformat":643,"../../state":676,preact:490,"preact-redux":489}],658:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){
  var e=t.initState,r=t.formState,n=t.server,i=t.onOpenFile,u=t.onReset,l=t.appOpts,c=o(t,["initState","formState","server","onOpenFile","onReset","appOpts"]),f=["Rendering customization options","Atoms","Bonds","Server","3D Viewer","Options for debugging"];return(0,s.h)(v.default,{title:"Settings",className:"settings",result:function(){return r.result},valid:function(){return r.valid},params:c,buttons:[(0,s.h)(S.default,{server:n,onLoad:i},"Open From File…"),(0,s.h)(x.default,{data:JSON.stringify(r.result),filename:"ketcher-settings"},"Save To File…"),(0,s.h)("button",{onClick:u},"Reset"),"Cancel","OK"]},(0,s.h)(m.default,a({schema:d.default,init:e},r),(0,s.h)(y.default,{className:"accordion",multiple:!1,captions:f,active:[0]},(0,s.h)("fieldset",{className:"render"},(0,s.h)(h.Field,{name:"resetToSelect"}),(0,s.h)(h.Field,{name:"rotationStep"}),(0,s.h)(h.Field,{name:"showValenceWarnings",component:T.default}),(0,s.h)(h.Field,{name:"atomColoring",component:T.default}),(0,s.h)(h.Field,{name:"hideChiralFlag",component:T.default}),(0,s.h)(h.Field,{name:"font",component:j.default}),(0,s.h)(h.Field,{name:"fontsz",component:A.default}),(0,s.h)(h.Field,{name:"fontszsub",component:A.default})),(0,s.h)("fieldset",{className:"atoms"},(0,s.h)(h.Field,{name:"carbonExplicitly",component:T.default}),(0,s.h)(h.Field,{name:"showCharge",component:T.default}),(0,s.h)(h.Field,{name:"showValence",component:T.default}),(0,s.h)(h.Field,{name:"showHydrogenLabels",component:T.default})),(0,s.h)("fieldset",{className:"bonds"},(0,s.h)(h.Field,{name:"aromaticCircle",component:T.default}),(0,s.h)(h.Field,{name:"doubleBondWidth",component:A.default}),(0,s.h)(h.Field,{name:"bondThickness",component:A.default}),(0,s.h)(h.Field,{name:"stereoBondWidth",component:A.default})),(0,s.h)("fieldset",{className:"server",disabled:!l.server},(0,s.h)(h.Field,{name:"smart-layout",component:T.default}),(0,s.h)(h.Field,{name:"ignore-stereochemistry-errors",component:T.default}),(0,s.h)(h.Field,{name:"mass-skip-error-on-pseudoatoms",component:T.default}),(0,s.h)(h.Field,{name:"gross-formula-add-rsites",component:T.default}),(0,s.h)(h.Field,{name:"gross-formula-add-isotopes",component:T.default})),(0,s.h)("fieldset",{className:"miew",disabled:!window.Miew},(0,s.h)(h.Field,{name:"miewMode"}),(0,s.h)(h.Field,{name:"miewTheme"}),(0,s.h)(h.Field,{name:"miewAtomLabel"})),(0,s.h)("fieldset",{className:"debug"},(0,s.h)(h.Field,{name:"showAtomIds",component:T.default}),(0,s.h)(h.Field,{name:"showBondIds",component:T.default}),(0,s.h)(h.Field,{name:"showHalfBondIds",component:T.default}),(0,s.h)(h.Field,{name:"showLoopIds",component:T.default}))),p.storage.isAvailable()?null:(0,s.h)("div",{className:"warning"},p.storage.warningMessage)))}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../state/modal/form"),c=t("../../state/options"),f=t("../../data/schema/options-schema"),d=n(f),p=t("../../storage-ext"),h=t("../../component/form/form"),m=n(h),g=t("../../component/dialog"),v=n(g),b=t("../../component/view/accordion"),y=n(b),_=t("../../component/view/savebutton"),x=n(_),w=t("../../component/view/openbutton"),S=n(w),O=t("../../component/form/measure-input"),A=n(O),E=t("../../component/form/systemfonts"),j=n(E),P=t("../../component/form/select-checkbox"),T=n(P);r.default=(0,u.connect)(function(t){return{server:t.options.app.server?t.server:null,appOpts:t.options.app,initState:t.options.settings,formState:t.modal.form}},function(t,e){return{onOpenFile:function(e){try{t((0,l.updateFormState)({result:JSON.parse(e)}))}catch(t){console.info("Bad file")}},onReset:function(){return t((0,l.setDefaultSettings)())},onOk:function(r){t((0,c.saveSettings)(r)),e.onOk(r)}}})(i)},{"../../component/dialog":621,"../../component/form/form":624,"../../component/form/measure-input":626,"../../component/form/select-checkbox":627,"../../component/form/systemfonts":629,"../../component/view/accordion":633,"../../component/view/openbutton":636,"../../component/view/savebutton":637,"../../data/schema/options-schema":644,"../../state/modal/form":677,"../../state/options":680,"../../storage-ext":686,preact:490,"preact-redux":489}],659:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.file,r=t.structStr,n=t.fragment,i=t.version,s=t.imagoVersions,c=o(t,["file","structStr","fragment","version","imagoVersions"]),f=c.onRecognize,d=c.isFragment,p=c.onImage,h=c.onChangeImago,g=o(c,["onRecognize","isFragment","onImage","onChangeImago"]),b=function(){return!r||r instanceof Promise?null:{structStr:r,fragment:n}};return(0,l.h)(m.default,{title:"Import From Image",className:"recognize",params:g,result:function(){return b()},buttons:[(0,l.h)(x.default,{onLoad:p,type:"image/*"},"Choose file…"),(0,l.h)("span",{className:"open-filename"},e?e.name:null),e&&(0,l.h)("button",{onClick:function(){return f(e,i)},disabled:r&&"string"!=typeof r},"Recognize"),"Cancel","OK"]},(0,l.h)("label",{className:"change-version"},"Imago version:",(0,l.h)(v.default,{schema:{enum:s,enumNames:(0,u.default)(1,s.length+1).map(function(t){return"Version "+t})},value:i,onChange:function(t){return h(t)}})),(0,l.h)("div",{className:"picture"},e&&(0,l.h)("img",{alt:"",id:"pic",src:a(e)||"",onError:function(){p(null),alert("Error, it isn't a picture")}})),(0,l.h)("div",{className:"output"},r&&(r instanceof Promise||"string"!=typeof r?(0,l.h)(S.default,null):(0,l.h)(y.default,{className:"struct",struct:r}))),(0,l.h)("label",null,(0,l.h)(v.default,{type:"checkbox",value:n,onChange:function(t){return d(t)}}),"Load as a fragment"))}function a(t){if(!t)return null;var e=window.URL||window.webkitURL;return e?e.createObjectURL(t):"No preview"}Object.defineProperty(r,"__esModule",{value:!0});var s=t("lodash/fp/range"),u=n(s),l=t("preact"),c=t("preact-redux"),f=t("../../state/options"),d=t("../../state"),p=t("../../state/server"),h=t("../../component/dialog"),m=n(h),g=t("../../component/form/input"),v=n(g),b=t("../../component/structrender"),y=n(b),_=t("../../component/view/openbutton"),x=n(_),w=t("../../component/view/spin"),S=n(w);r.default=(0,c.connect)(function(t){return{imagoVersions:t.options.app.imagoVersions,file:t.options.recognize.file,structStr:t.options.recognize.structStr,fragment:t.options.recognize.fragment,version:t.options.recognize.version||t.options.app.imagoVersions[0]}},function(t,e){return{isFragment:function(e){return t((0,f.shouldFragment)(e))},onImage:function(e){return t((0,f.changeImage)(e))},onRecognize:function(e,r){return t((0,p.recognize)(e,r))},onChangeImago:function(e){return t((0,f.changeVersion)(e))},onOk:function(r){t((0,d.load)(r.structStr,{rescale:!0,fragment:r.fragment})),e.onOk(r)}}})(i)},{"../../component/dialog":621,"../../component/form/input":625,"../../component/structrender":632,"../../component/view/openbutton":636,"../../component/view/spin":638,"../../state":676,"../../state/options":680,"../../state/server":681,"lodash/fp/range":438,preact:490,"preact-redux":489}],660:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=t("preact"),c=t("preact-redux"),f=t("../../data/convert/structformat"),d=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(f),p=t("../../state/templates"),h=t("../../state/modal/form"),m=t("../../component/dialog"),g=n(m),v=t("../../component/form/form"),b=n(v),y=t("../../component/view/savebutton"),_=n(y),x={title:"Save",type:"object",properties:{filename:{title:"Filename",type:"string",maxLength:128,pattern:/^[^.<>:?"*|\/\\][^<>:?"*|\/\\]*$/,invalidMessage:function(t){return t?t.length>128?"Filename is too long":"A filename cannot contain characters: \\ / : * ? \" < > | and cannot start with '.'":"Filename should contain at least one character"}},format:{title:"Format",enum:Object.keys(d.map),enumNames:Object.keys(d.map).map(function(t){return d.map[t].name})}}},w=function(t){function e(t){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));r.isRxn=r.props.struct.hasRxnArrow();var n=[r.isRxn?"rxn":"mol","smiles"];return r.props.server&&n.push("smiles-ext","smarts","inchi","inchi-aux","cml"),r.saveSchema=x,r.saveSchema.properties.format=Object.assign(r.saveSchema.properties.format,{enum:n,enumNames:n.map(function(t){return d.map[t].name})}),r.changeType(r.isRxn?"rxn":"mol").then(function(e){return e instanceof Error?t.onCancel():null}),r}return a(e,t),u(e,[{key:"changeType",value:function(t){var e=this,r=this.props,n=r.struct,o=r.server,i=r.options,a=r.formState;return d.toString(n,t,o,i).then(function(t){e.setState({structStr:t}),setTimeout(function(){return e.textarea.select()},10)},function(t){return alert(t.message),e.props.onResetForm(a),t})}},{key:"render",value:function(){var t=this,e=this.state.structStr,r=this.props.formState,n=r.result,o=n.filename,i=n.format,a=d.couldBeSaved(this.props.struct,i),u=this.props.struct.isBlank();return(0,l.h)(g.default,{title:"Save Structure",className:"save",params:this.props,buttons:[(0,l.h)(_.default,{data:e,filename:o+d.map[i].ext[0],type:i.mime,server:this.props.server,onSave:function(){return t.props.onOk()},disabled:!r.valid||u},"Save To File…"),(0,l.h)("button",{className:"save-tmpl",disabled:u,onClick:function(){return t.props.onTmplSave(t.props.struct)}},"Save to Templates"),"Close"]},(0,l.h)(b.default,s({schema:this.saveSchema,init:{filename:o,format:this.isRxn?"rxn":"mol"}},r),(0,l.h)(v.Field,{name:"filename"}),(0,l.h)(v.Field,{name:"format",onChange:function(e){return t.changeType(e)}})),(0,l.h)("textarea",{value:e,readOnly:!0,ref:function(e){t.textarea=e}}),a&&(0,l.h)("div",{className:"warning"},a))}}]),e}(l.Component);r.default=(0,c.connect)(function(t){return{server:t.options.app.server?t.server:null,struct:t.editor.struct(),options:t.options.getServerSettings(),formState:t.modal.form}},function(t){return{onTmplSave:function(e){return t((0,p.saveUserTmpl)(e))},onResetForm:function(e){return t((0,h.updateFormState)(e))}}})(w)},{"../../component/dialog":621,"../../component/form/form":624,"../../component/view/savebutton":637,"../../data/convert/structformat":643,"../../state/modal/form":677,"../../state/templates":683,preact:490,"preact-redux":489}],661:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e={struct:l(t.struct),props:{atomid:+t.props.atomid||0,bondid:+t.props.bondid||0}};return e.struct.name=t.struct.name,e}function l(t){var e=t.clone(),r=e.getCoordBoundingBox();return e.atoms.forEach(function(t){t.pp=t.pp.sub(r.min)}),e.sgroups.forEach(function(t){t.pp=t.pp?t.pp.sub(r.min):r.min}),e.rxnArrows.forEach(function(t){t.pp=t.pp.sub(r.min)}),e.rxnPluses.forEach(function(t){t.pp=t.pp.sub(r.min)}),e}function c(t){var e=t.getCoordBoundingBox(),r=220/Math.max(e.max.y-e.min.y,e.max.x-e.min.x);return r<35&&(r=35),r>60&&(r=60),r}Object.defineProperty(r,"__esModule",{value:!0});var f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=t("preact"),h=t("preact-redux"),m=t("../../component/dialog"),g=n(m),v=t("../../component/form/input"),b=n(v),y=t("../../component/structeditor"),_=n(y),x=t("../../storage-ext"),w=t("../../state/templates"),S={selectionStyle:{fill:"#47b3ec",stroke:"none"},highlightStyle:{stroke:"#1a7090","stroke-width":1.2}},O=function(t){function e(t){var r=t.onInit,n=o(t,["onInit"]);i(this,e);var s=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return s.tmpl=u(n.tmpl),r(s.tmpl.struct.name,s.tmpl.props),s.onResult=s.onResult.bind(s),s}return s(e,t),d(e,[{key:"onResult",value:function(){var t=this.props,e=t.name,r=t.atomid,n=t.bondid;return!e||e===this.tmpl.struct.name&&r===this.tmpl.props.atomid&&n===this.tmpl.props.bondid?null:{name:e,attach:{atomid:r,bondid:n}}}},{key:"render",value:function(){var t=this.props,e=t.name,r=t.atomid,n=t.bondid,i=t.onNameEdit,a=t.onAttachEdit,s=o(t,["name","atomid","bondid","onNameEdit","onAttachEdit"]),u=this.tmpl.struct,l=Object.assign(S,{scale:c(u)});return(0,p.h)(g.default,{title:"Template Edit",className:"attach",result:this.onResult,params:s},(0,p.h)("label",null,"Template name:",(0,p.h)(b.default,{value:e,onChange:i})),(0,p.h)("label",null,"Choose attachment atom and bond:"),(0,p.h)(_.default,{className:"editor",struct:u,onAttachEdit:a,tool:"attach",toolOpts:{atomid:r,bondid:n},options:l}),x.storage.isAvailable()?null:(0,p.h)("div",{className:"warning"},x.storage.warningMessage))}}]),e}(p.Component);r.default=(0,h.connect)(function(t){return f({},t.templates.attach)},function(t){return{onInit:function(e,r){return t((0,w.initAttach)(e,r))},onAttachEdit:function(e){return t((0,w.setAttachPoints)(e))},onNameEdit:function(e){return t((0,w.setTmplName)(e))}}})(O)},{"../../component/dialog":621,"../../component/form/input":625,"../../component/structeditor":631,"../../state/templates":683,"../../storage-ext":686,preact:490,"preact-redux":489}],662:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function u(t,e){return console.assert(t.props&&t.props.group,"No group"),t.struct.name||t.props.group+" template "+(e+1)}function l(t,e){return console.warn("partition",t),(0,S.default)(t)(e)}function c(t){return t.replace(Y,function(t){return K[t]})}function f(t,e){console.warn("Filter",e);var r=new RegExp((0,A.default)(c(e)),"i");return(0,x.default)((0,y.default)(function(t){return!e||r.test(c(t.struct.name))||r.test(c(t.props.group))}),(0,v.default)(function(t,e){return t[e.props.group]?t[e.props.group].push(e):t[e.props.group]=[e],t},{}))(t)}function d(t,e,r){return console.warn("Group",e),l(r,t[e])}function p(t){var e=t.tmpl,r=s(t,["tmpl"]);return e.props&&e.props.prerender?(0,T.h)("svg",r,(0,T.h)("use",{xlinkHref:e.props.prerender})):(0,T.h)(B.default,j({struct:e.struct,options:{autoScaleMargin:15}},r))}Object.defineProperty(r,"__esModule",{value:!0});var h=t("lodash/fp/omit"),m=n(h),g=t("lodash/fp/reduce"),v=n(g),b=t("lodash/fp/filter"),y=n(b),_=t("lodash/fp/flow"),x=n(_),w=t("lodash/fp/chunk"),S=n(w),O=t("lodash/fp/escapeRegExp"),A=n(O),E=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),j=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},P=t("reselect"),T=t("preact"),C=t("preact-redux"),k=t("../../../chem/sdf"),M=n(k),R=t("../../component/view/visibleview"),N=n(R),I=t("../../component/structrender"),B=n(I),L=t("../../component/dialog"),D=n(L),F=t("../../component/view/savebutton"),G=n(F),z=t("../../component/form/input"),H=n(z),W=t("../../component/form/select"),U=n(W),V=t("../../state/templates"),q=t("../../state"),K={Alpha:"A",alpha:"α",Beta:"B",beta:"β",Gamma:"Г",gamma:"γ"},Y=new RegExp("\\b"+Object.keys(K).join("\\b|\\b")+"\\b","g"),$=(0,P.createSelector)(function(t){return t.lib},function(t){return t.filter},f),X=(0,P.createSelector)(function(t){return t.lib},function(t){return t.group},function(t){return t.COLS},d),Z=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),E(e,[{key:"select",value:function(t){t===this.props.selected?this.props.onOk(this.result()):this.props.onSelect(t)}},{key:"result",value:function(){var t=this.props.selected;return console.assert(!t||t.props,"Incorrect SDF parse"),t?{struct:t.struct,aid:parseInt(t.props.atomid)||null,bid:parseInt(t.props.bondid)||null}:null}},{key:"renderRow",value:function(t,e,r){var n=this;return(0,T.h)("div",{className:"tr",key:e},t.map(function(t,o){return(0,T.h)("div",{className:t===n.props.selected?"td selected":"td",title:c(u(t,e*r+o))},(0,T.h)(p,{tmpl:t,className:"struct",onClick:function(){return n.select(t)}}),(0,T.h)("button",{className:"attach-button",onClick:function(){return n.props.onAttach(t)}},"Edit"))}))}},{key:"render",value:function(){var t=this,e=this.props,r=e.filter,n=e.onFilter,o=e.onChangeGroup,i=s(e,["filter","onFilter","onChangeGroup"]),a=i.group,u=$(this.props);return a=u[a]?a:Object.keys(u)[0],(0,T.h)(D.default,{title:"Template Library",className:"template-lib",params:(0,m.default)(["group"],i),result:function(){return t.result()},buttons:[(0,T.h)(G.default,{data:M.default.stringify(this.props.lib),filename:"ketcher-tmpls.sdf"},"Save To SDF…"),"Cancel","OK"]},(0,T.h)("label",null,"Filter:",(0,T.h)(H.default,{type:"search",value:r,onChange:function(t){return n(t)}})),(0,T.h)(H.default,{className:"groups",component:U.default,splitIndexes:[Object.keys(u).indexOf("User Templates")],value:a,onChange:function(t){return o(t)},schema:{enum:Object.keys(u),enumNames:Object.keys(u).map(function(t){return c(t)})}}),(0,T.h)(N.default,{data:X({lib:u,group:a,COLS:3}),rowHeight:120,className:"table"},function(e,r){return t.renderRow(e,r,3)}))}}]),e}(T.Component);r.default=(0,C.connect)(function(t){return j({},(0,m.default)(["attach"],t.templates))},function(t,e){return{onFilter:function(e){return t((0,V.changeFilter)(e))},onSelect:function(e){return t((0,V.selectTmpl)(e))},onChangeGroup:function(e){return t((0,V.changeGroup)(e))},onAttach:function(e){return t((0,V.editTmpl)(e))},onOk:function(r){t((0,q.onAction)({tool:"template",opts:r})),e.onOk(r)}}})(Z)},{"../../../chem/sdf":534,"../../component/dialog":621,"../../component/form/input":625,"../../component/form/select":628,"../../component/structrender":632,"../../component/view/savebutton":637,"../../component/view/visibleview":640,"../../state":676,"../../state/templates":683,"lodash/fp/chunk":424,"lodash/fp/escapeRegExp":427,"lodash/fp/filter":428,"lodash/fp/flow":431,"lodash/fp/omit":434,"lodash/fp/reduce":439,preact:490,"preact-redux":489,reselect:513}],663:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){var r=e.stateStore,n=r.props.result;return(0,d.h)("label",null,"Number:",(0,d.h)("input",{className:"number",type:"text",readOnly:!0,value:_.default.map[(0,c.default)(n.label)]||""}))}function a(t){var e=t.formState,r=o(t,["formState"]);return(0,d.h)(b.default,{title:"Atom Properties",className:"atom-props",result:function(){return e.result},valid:function(){return e.valid},params:r},(0,d.h)(g.default,f({schema:h.atom,customValid:{label:function(t){return s(t)},charge:function(t){return u(t)}},init:r},e),(0,d.h)("fieldset",{className:"main"},(0,d.h)(m.Field,{name:"label"}),(0,d.h)(m.Field,{name:"alias"}),(0,d.h)(i,null),(0,d.h)(m.Field,{name:"charge",maxlength:"5"}),(0,d.h)(m.Field,{name:"explicitValence"}),(0,d.h)(m.Field,{name:"isotope"}),(0,d.h)(m.Field,{name:"radical"})),(0,d.h)("fieldset",{className:"query"},(0,d.h)("legend",null,"Query specific"),(0,d.h)(m.Field,{name:"ringBondCount"}),(0,d.h)(m.Field,{name:"hCount"}),(0,d.h)(m.Field,{name:"substitutionCount"}),(0,d.h)(m.Field,{name:"unsaturatedAtom"})),(0,d.h)("fieldset",{className:"reaction"},(0,d.h)("legend",null,"Reaction flags"),(0,d.h)(m.Field,{name:"invRet"}),(0,d.h)(m.Field,{name:"exactChangeFlag"}))))}function s(t){return t&&!!_.default.map[(0,c.default)(t)]}function u(t){var e=h.atom.properties.charge.pattern.exec(t);return!(null===e||""!==e[1]&&""!==e[3])}Object.defineProperty(r,"__esModule",{value:!0});var l=t("lodash/fp/capitalize"),c=n(l),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d=t("preact"),p=t("preact-redux"),h=t("../../data/schema/struct-schema"),m=t("../../component/form/form"),g=n(m),v=t("../../component/dialog"),b=n(v),y=t("../../../chem/element"),_=n(y);r.default=(0,p.connect)(function(t){return{formState:t.modal.form}})(a)},{"../../../chem/element":525,"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,"lodash/fp/capitalize":423,preact:490,"preact-redux":489}],664:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.formState,r=o(t,["formState"]);return(0,s.h)(p.default,{title:"Attachment Points",className:"attach-points",result:function(){return e.result},valid:function(){return e.valid},params:r},(0,s.h)(f.default,a({schema:l.attachmentPoints,init:r},e),(0,s.h)(c.Field,{name:"primary"}),(0,s.h)(c.Field,{name:"secondary"})))}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../data/schema/struct-schema"),c=t("../../component/form/form"),f=n(c),d=t("../../component/dialog"),p=n(d);r.default=(0,u.connect)(function(t){return{formState:t.modal.form}})(i)},{"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,preact:490,"preact-redux":489}],665:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.formState,r=o(t,["formState"]);return(0,s.h)(d.default,{title:"Reaction Auto-Mapping",className:"automap",result:function(){return e.result},valid:function(){return e.valid},params:r},(0,s.h)(c.default,a({schema:h},e),(0,s.h)(l.Field,{name:"mode"})))}Object.defineProperty(r,"__esModule",{value:!0}),r.automapSchema=void 0;var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../component/form/form"),c=n(l),f=t("../../component/dialog"),d=n(f),p=t("../../state/server"),h=r.automapSchema={title:"Reaction Auto-Mapping",type:"object",required:["mode"],properties:{mode:{title:"Mode",enum:["discard","keep","alter","clear"],enumNames:["Discard","Keep","Alter","Clear"],default:"discard"}}};r.default=(0,u.connect)(function(t){return{formState:t.modal.form}},function(t,e){return{onOk:function(r){t((0,p.automap)(r)),e.onOk(r)}}})(i)},{"../../component/dialog":621,"../../component/form/form":624,"../../state/server":681,preact:490,"preact-redux":489}],666:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.formState,r=o(t,["formState"]);return(0,s.h)(p.default,{title:"Bond Properties",className:"bond",result:function(){return e.result},valid:function(){return e.valid},params:r},(0,s.h)(f.default,a({schema:l.bond,init:r},e),(0,s.h)(c.Field,{name:"type"}),(0,s.h)(c.Field,{name:"topology"}),(0,s.h)(c.Field,{name:"center"})))}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../data/schema/struct-schema"),c=t("../../component/form/form"),f=n(c),d=t("../../component/dialog"),p=n(d);r.default=(0,u.connect)(function(t){return{formState:t.modal.form}})(i)},{"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,preact:490,"preact-redux":489}],667:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=Math.abs(t.charge),r=["",":",".","^^"][t.radical]||"",n="";return e&&(n=t.charge<0?"-":"+"),(t.isotope||"")+t.label+r+(e>1?e:"")+n}function a(t){var e=t.match(/^(\d+)?([a-z*]{1,3})(\.|:|\^\^)?(\d+[-+]|[-+])?$/i);if(e){var r="*"===e[2]?"A":(0,l.default)(e[2]),n=0,o=0,i=0;if(e[1]&&(o=parseInt(e[1])),e[3]&&(i={":":1,".":2,"^^":3}[e[3]]),e[4]&&(n=parseInt(e[4]),isNaN(n)&&(n=1),e[4].endsWith("-")&&(n=-n)),"A"===r||"Q"===r||"X"===r||"M"===r||h.default.map[r])return{label:r,charge:n,isotope:o,radical:i}}return null}function s(t){var e={label:t.letter||i(t)},r=t.formState,n=o(t,["formState"]),s=r.result,u=r.valid;return(0,f.h)(v.default,{title:"Label Edit",className:"labeledit",valid:function(){return u},result:function(){return a(s.label)},params:n},(0,f.h)(y.default,c({schema:m.labelEdit,customValid:{label:function(t){return a(t)}},init:e},r),(0,f.h)(b.Field,{name:"label",maxlength:"20",size:"10"})))}Object.defineProperty(r,"__esModule",{value:!0});var u=t("lodash/fp/capitalize"),l=n(u),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f=t("preact"),d=t("preact-redux"),p=t("../../../chem/element"),h=n(p),m=t("../../data/schema/struct-schema"),g=t("../../component/dialog"),v=n(g),b=t("../../component/form/form"),y=n(b);r.default=(0,d.connect)(function(t){return{formState:t.modal.form}})(s)},{"../../../chem/element":525,"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,"lodash/fp/capitalize":423,preact:490,"preact-redux":489}],668:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){var r=e.schema,n=t.name,o=t.rgids,i={title:r.properties[n].title,enum:[0],enumNames:["Always"]};return o.forEach(function(e){t.label!==e&&(i.enum.push(e),i.enumNames.push("IF R"+t.label+" THEN R"+e))}),(0,l.h)(d.Field,u({name:n,schema:i},t))}function a(t){var e=t.formState,r=t.label,n=t.rgroupLabels,a=o(t,["formState","label","rgroupLabels"]);return(0,l.h)(m.default,{title:"R-Group Logic",className:"rgroup-logic",result:function(){return e.result},valid:function(){return e.valid},params:a},(0,l.h)(p.default,u({schema:f.rgroupLogic,customValid:{range:function(t){return s(t)}},init:a},e),(0,l.h)(d.Field,{name:"range"}),(0,l.h)(d.Field,{name:"resth"}),(0,l.h)(i,{name:"ifthen",className:"cond",label:r,rgids:n})))}function s(t){return t.replace(/\s*/g,"").replace(/,+/g,",").replace(/^,/,"").replace(/,$/,"").split(",").every(function(t){return t.match(/^[>,<=]?[0-9]+$/g)||t.match(/^[0-9]+-[0-9]+$/g)})}Object.defineProperty(r,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l=t("preact"),c=t("preact-redux"),f=t("../../data/schema/struct-schema"),d=t("../../component/form/form"),p=n(d),h=t("../../component/dialog"),m=n(h);r.default=(0,c.connect)(function(t){return{formState:t.modal.form}})(a)},{"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,preact:490,"preact-redux":489}],669:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.disabledIds,r=t.values,n=t.formState,i=t.type,u=o(t,["disabledIds","values","formState","type"]);return(0,s.h)(f.default,{title:"R-Group",className:"rgroup",params:u,result:function(){return n.result}},(0,s.h)(p.default,a({schema:l.rgroupSchema,init:{values:r}},n),(0,s.h)(d.Field,{name:"values",multiple:"atom"===i,labelPos:!1,component:m.default,disabledIds:e})))}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../data/schema/struct-schema"),c=t("../../component/dialog"),f=n(c),d=t("../../component/form/form"),p=n(d),h=t("../../component/form/buttonlist"),m=n(h);r.default=(0,u.connect)(function(t){return{formState:t.modal.form}})(i)},{"../../component/dialog":621,"../../component/form/buttonlist":622,"../../component/form/form":624,"../../data/schema/struct-schema":647,preact:490,"preact-redux":489}],670:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.title,r=t.name,n=t.schema,i=o(t,["title","name","schema"]),a=Object.keys(n).reduce(function(t,e){return t.enum.push(e),t.enumNames.push(n[e].title||e),t},{title:e,type:"string",default:"",minLength:1,enum:[],enumNames:[]})
  ;return(0,u.h)(c.Field,s({name:r,schema:a,component:m.default},i))}function a(t){var e=t.context,r=t.fieldName,n=t.fieldValue,a=t.type,l=t.radiobuttons,d=t.formState,h=o(t,["context","fieldName","fieldValue","type","radiobuttons","formState"]),m=d.result,b=d.valid,y={context:e,fieldName:r||(0,g.getSdataDefault)(e),type:a,radiobuttons:l};y.fieldValue=n||(0,g.getSdataDefault)(e,y.fieldName);var _=g.sdataSchema[m.context][m.fieldName]||g.sdataCustomSchema,x={context:m.context.trim(),fieldName:m.fieldName.trim(),fieldValue:"string"==typeof m.fieldValue?m.fieldValue.trim():m.fieldValue};return(0,u.h)(p.default,{title:"S-Group Properties",className:"sgroup",result:function(){return m},valid:function(){return b},params:h},(0,u.h)(f.default,s({serialize:x,schema:_,init:y},d),(0,u.h)(c.SelectOneOf,{title:"Context",name:"context",schema:g.sdataSchema}),(0,u.h)("fieldset",{className:"data"},(0,u.h)(i,{title:"Field name",name:"fieldName",schema:g.sdataSchema[m.context]}),v(_,m.context,m.fieldName))))}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},u=t("preact"),l=t("preact-redux"),c=t("../../component/form/form"),f=n(c),d=t("../../component/dialog"),p=n(d),h=t("../../component/form/combobox"),m=n(h),g=t("../../data/schema/sdata-schema"),v=function(t,e,r){return Object.keys(t.properties).filter(function(t){return"type"!==t&&"context"!==t&&"fieldName"!==t}).map(function(t){return"radiobuttons"===t?(0,u.h)(c.Field,{name:t,type:"radio",key:e+"-"+r+"-"+t+"-radio"}):(0,u.h)(c.Field,{name:t,type:"textarea",multiple:!0,size:"10",key:e+"-"+r+"-"+t+"-select"})})};r.default=(0,l.connect)(function(t){return{formState:t.modal.form}})(a)},{"../../component/dialog":621,"../../component/form/combobox":623,"../../component/form/form":624,"../../data/schema/sdata-schema":646,preact:490,"preact-redux":489}],671:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=t.formState,r=o(t,["formState"]),n=e.result,i=e.valid,u=n.type;return(0,s.h)(p.default,{title:"S-Group Properties",className:"sgroup",result:function(){return n},valid:function(){return i},params:r},(0,s.h)(f.default,a({schema:l.sgroupMap[u],init:r},e),(0,s.h)(c.SelectOneOf,{title:"Type",name:"type",schema:l.sgroupMap}),(0,s.h)("fieldset",{className:"DAT"===u?"data":"base"},h(u))))}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=t("preact"),u=t("preact-redux"),l=t("../../data/schema/struct-schema"),c=t("../../component/form/form"),f=n(c),d=t("../../component/dialog"),p=n(d),h=function(t){return Object.keys(l.sgroupMap[t].properties).filter(function(t){return"type"!==t}).map(function(e){var r={};return"name"===e&&(r.maxlength=15),"fieldName"===e&&(r.maxlength=30),"fieldValue"===e&&(r.type="textarea"),"radiobuttons"===e&&(r.type="radio"),(0,s.h)(c.Field,a({name:e,key:t+"-"+e},r))})};r.default=(0,u.connect)(function(t){return{formState:t.modal.form}})(i)},{"../../component/dialog":621,"../../component/form/form":624,"../../data/schema/struct-schema":647,preact:490,"preact-redux":489}],672:[function(t,e,r){"use strict";function n(t,e){var r=document.querySelector("[role=application]")||document.body;return(0,i.default)(r,t,e)}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./app"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);r.default=n},{"./app":616}],673:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){var r=e.action,n=e.editor,o=e.server,i=e.options;if(r.tool){if(n.tool(r.tool,r.opts))return r}else"function"==typeof r?r(n,o,i):console.info("no action");return t}function a(t,e,r){var n=r.editor,o=r.server;return"function"==typeof t.selected?t.selected(n,o):!(!t.action||!t.action.tool)&&(0,h.default)(e,t.action)}function s(t,e){var r=e.editor,n=e.server,o=e.options;return"function"==typeof t.disabled&&t.disabled(r,n,o)}function u(t,e,r){var n=v.default[t];return(0,c.default)(function(t){return t},{selected:a(n,e,r),disabled:s(n,r)})}Object.defineProperty(r,"__esModule",{value:!0});var l=t("lodash/fp/pickBy"),c=n(l),f=t("lodash/fp/isEmpty"),d=n(f),p=t("lodash/fp/isEqual"),h=n(p),m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments[1],r=e.type,n=e.action,a=o(e,["type","action"]);switch(r){case"INIT":n=v.default["select-lasso"].action;case"ACTION":var s=i(t&&t.activeTool,m({},a,{action:n}));case"UPDATE":return Object.keys(v.default).reduce(function(t,e){var r=u(e,t.activeTool,a);return(0,d.default)(r)||(t[e]=r),t},{activeTool:s||t.activeTool});default:return t}};var g=t("../../action"),v=n(g)},{"../../action":609,"lodash/fp/isEmpty":432,"lodash/fp/isEqual":433,"lodash/fp/pickBy":436}],674:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){function r(t,e){var r=e(),o=r.actionState.activeTool.tool;if("select"!==o){var i=r.toolbar.visibleTools.select,a=r.options.settings.resetToSelect;!0===a||a===o?t({type:"ACTION",action:d.default[i].action}):n()}}var n=(0,a.default)(100,function(){return t({type:"UPDATE"})}),o=function(t){return new Promise(function(e){return setTimeout(e,t)})};return{onInit:function(e){t({type:"INIT",editor:e})},onChange:function(e){void 0===e?o(0).then(function(){return t(r)}):t(r)},onSelectionChange:function(){n()},onElementEdit:function(r){var n=(0,c.fromElement)(r),o=null;if(l.default.map[n.label])o=(0,p.openDialog)(t,"atomProps",n);else if(1===Object.keys(n).length&&"ap"in n)o=(0,p.openDialog)(t,"attachmentPoints",n.ap).then(function(t){return{ap:t}});else if("list"===n.type||"not-list"===n.type)o=(0,p.openDialog)(t,"period-table",n);else if("rlabel"===n.type){var i=e().editor.struct().rgroups,a={type:"atom",values:n.values,disabledIds:Array.from(i.entries()).reduce(function(t,e){var r=s(e,2),o=r[0];return r[1].frags.has(n.fragId)&&t.push(o),t},[])};o=(0,p.openDialog)(t,"rgroup",a).then(function(t){return{values:t.values,type:"rlabel"}})}else o=(0,p.openDialog)(t,"period-table",n);return o.then(c.toElement)},onQuickEdit:function(e){return(0,p.openDialog)(t,"labelEdit",e)},onBondEdit:function(e){return(0,p.openDialog)(t,"bondProps",(0,c.fromBond)(e)).then(c.toBond)},onRgroupEdit:function(r){var n=e().editor.struct();if(Object.keys(r).length>2){var o=Array.from(n.rgroups.keys());return r.range||(r.range=">0"),(0,p.openDialog)(t,"rgroupLogic",Object.assign({rgroupLabels:o},r))}var i=Array.from(n.atoms.values()).reduce(function(t,e){return e.fragment===r.fragId&&null!==e.rglabel?t.concat((0,c.fromElement)(e).values):t},[]),a={type:"fragment",values:[r.label],disabledIds:i};return(0,p.openDialog)(t,"rgroup",a).then(function(t){return{label:t.values[0]}})},onSgroupEdit:function(e){return o(0).then(function(){return(0,p.openDialog)(t,"sgroup",(0,c.fromSgroup)(e))}).then(c.toSgroup)},onSdataEdit:function(e){return o(0).then(function(){return(0,p.openDialog)(t,"DAT"===e.type?"sdata":"sgroup",(0,c.fromSgroup)(e))}).then(c.toSgroup)},onMessage:function(t){t.error&&alert(t.error)},onAromatizeStruct:function(t){var r=e(),n=r.options.getServerSettings();return(0,h.serverCall)(r.editor,r.server,"aromatize",n,t)},onDearomatizeStruct:function(t){var r=e(),n=r.options.getServerSettings();return(0,h.serverCall)(r.editor,r.server,"dearomatize",n,t)},onMouseDown:function(){n()}}}Object.defineProperty(r,"__esModule",{value:!0});var i=t("lodash/fp/debounce"),a=n(i),s=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();r.default=o;var u=t("../../../chem/element"),l=n(u),c=t("../../data/convert/structconv"),f=t("../../action"),d=n(f),p=t("../modal"),h=t("../server")},{"../../../chem/element":525,"../../action":609,"../../data/convert/structconv":642,"../modal":678,"../server":681,"lodash/fp/debounce":426}],675:[function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}function i(t){return function(e,r){var n=u();t.addEventListener("keydown",function(t){return a(e,r,n,t)})}}function a(t,e,r,n){var o=e();if(!o.modal){var i=o.editor,a=o.actionState,s=a.activeTool,u=(0,y.default)(n),c=i.selection()&&i.selection().atoms,f=null;if(u&&1===u.length&&c&&u.match(/\w/))console.assert(c.length>0),(0,E.openDialog)(t,"labelEdit",{letter:u}).then(function(e){t((0,j.onAction)({tool:"atom",opts:e}))}).catch(function(){return null}),n.preventDefault();else if(void 0!==(f=y.default.lookup(r,n))){var d=l(f,s);d=(d+1)%f.length;var p=f[d];if(a[p]&&!0===a[p].disabled)return void n.preventDefault();if(-1===S.actions.indexOf(p)){var h=x.default[p].action;t((0,j.onAction)(h)),n.preventDefault()}else window.clipboardData&&S.exec(n)}}}function s(t,e,r){Array.isArray(r[t])?r[t].push(e):r[t]=[e]}function u(){var t={},e=void 0;return Object.keys(x.default).forEach(function(r){e=x.default[r],e.shortcut&&(Array.isArray(e.shortcut)?e.shortcut.forEach(function(e){s(e,r,t)}):s(e.shortcut,r,t))}),(0,y.default)(t)}function l(t,e){var r=t.indexOf(e.tool);return t.forEach(function(t,n){(0,m.default)(x.default[t].action,e)&&(r=n)}),r}function c(t,e){var r=Object.keys(A.map).map(function(t){return A.map[t].mime}),n=(0,p.default)(0,function(e){return t((0,j.onAction)(e))}),o=(0,p.default)(0,function(e,r){return t((0,j.load)(e,r))});return{formats:r,focused:function(){return!e().modal},onCut:function(){var t=e().editor,r=f(t);return r?n({tool:"eraser",opts:1}):t.selection(null),r},onCopy:function(){var t=e().editor,r=f(t);return t.selection(null),r},onPaste:function(t){var r=t["chemical/x-mdl-molfile"]||t["chemical/x-mdl-rxnfile"]||t["text/plain"],n=e().editor.render.ctab.molecule;!r||n.hasRxnArrow()&&P.test(t["text/plain"])||o(r,{fragment:!0})}}}function f(t){var e={},r=t.structSelected();if(r.isBlank())return null;var n=r.isReaction?"chemical/x-mdl-molfile":"chemical/x-mdl-rxnfile";try{var o=v.default.stringify(r);return e["text/plain"]=o,e[n]=o,e}catch(t){alert(t.message)}return null}Object.defineProperty(r,"__esModule",{value:!0});var d=t("lodash/fp/debounce"),p=o(d),h=t("lodash/fp/isEqual"),m=o(h);r.initKeydownListener=i,r.initClipboard=c;var g=t("../../chem/molfile"),v=o(g),b=t("../data/convert/keynorm"),y=o(b),_=t("../action"),x=o(_),w=t("../component/cliparea"),S=n(w),O=t("../data/convert/structformat"),A=n(O),E=t("./modal"),j=t("./shared"),P=/\$RXN\n+\s+0\s+0\s+0\n*/},{"../../chem/molfile":528,"../action":609,"../component/cliparea":620,"../data/convert/keynorm":641,"../data/convert/structformat":643,"./modal":678,"./shared":682,"lodash/fp/debounce":426,"lodash/fp/isEqual":433}],676:[function(t,e,r){(function(e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,r){switch(r.type){case"INIT":e._ui_editor=r.editor;case"UPDATE":var n=(r.type,o(r,["type"]));n&&(t=u({},t,n))}var i=S(t,u({},r,(0,s.default)(["editor","server","options"],t)));return i===t.shared?t:u({},t,i)}Object.defineProperty(r,"__esModule",{value:!0}),r.load=r.onAction=void 0;var a=t("lodash/fp/pick"),s=n(a),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.default=function(t,e){var r={actionState:null,editor:null,modal:null,options:Object.assign(g.initOptionsState,{app:t}),server:e||Promise.reject(new Error("Standalone mode!")),templates:b.initTmplsState},n=[f.default];return(0,l.createStore)(i,r,l.applyMiddleware.apply(void 0,n))};var l=t("redux"),c=t("redux-thunk"),f=n(c),d=(t("redux-logger"),t("./action")),p=n(d),h=t("./modal"),m=n(h),g=t("./options"),v=n(g),b=t("./templates"),y=n(b),_=t("./toolbar"),x=n(_),w=t("./shared");r.onAction=w.onAction,r.load=w.load;var S=(0,l.combineReducers)({actionState:p.default,toolbar:x.default,modal:m.default,server:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},editor:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},options:v.default,templates:y.default})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./action":673,"./modal":678,"./options":680,"./shared":682,"./templates":683,"./toolbar":685,"lodash/fp/pick":435,redux:510,"redux-logger":503,"redux-thunk":504}],677:[function(t,e,r){"use strict";function n(t){return{type:"UPDATE_FORM",data:t}}function o(t){return{type:"UPDATE_FORM",data:{moleculeErrors:t}}}function i(){return{type:"UPDATE_FORM",data:{result:(0,s.getDefaultOptions)(),valid:!0,errors:{}}}}function a(t,e,r){return"sdata"===r?(0,u.sdataReducer)(t,e):Object.assign({},t,e.data)}Object.defineProperty(r,"__esModule",{value:!0}),r.formsState=void 0,r.updateFormState=n,r.checkErrors=o,r.setDefaultSettings=i,r.formReducer=a;var s=t("../../data/schema/options-schema"),u=t("./sdata");r.formsState={atomProps:{errors:{},valid:!0,result:{label:"",charge:0,explicitValence:-1,hCount:0,invRet:0,isotope:0,radical:0,ringBondCount:0,substitutionCount:0}},attachmentPoints:{errors:{},valid:!0,result:{primary:!1,secondary:!1}},automap:{errors:{},valid:!0,result:{mode:"discard"}},bondProps:{errors:{},valid:!0,result:{type:"single",topology:0,center:0}},check:{errors:{},moleculeErrors:{}},labelEdit:{errors:{},valid:!0,result:{label:""}},rgroup:{errors:{},valid:!0,result:{values:[]}},rgroupLogic:{errors:{},valid:!0,result:{ifthen:0,range:">0",resth:!1}},save:{errors:{},valid:!0,result:{filename:"ketcher",format:"mol"}},settings:{errors:{},valid:!0,result:(0,s.getDefaultOptions)()},sgroup:{errors:{},valid:!0,result:{type:"GEN"}},sdata:(0,u.initSdata)()}},{"../../data/schema/options-schema":644,"./sdata":679}],678:[function(t,e,r){"use strict";function n(t,e,r){return new Promise(function(n,o){t({type:"MODAL_OPEN",data:{name:e,prop:i({},r,{onResult:n,onCancel:o})}})})}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments[1],r=e.type,n=e.data;if("UPDATE_FORM"===r){var o=(0,a.formReducer)(t.form,e,t.name);return i({},t,{form:o})}switch(r){case"MODAL_CLOSE":return null;case"MODAL_OPEN":return{name:n.name,form:a.formsState[n.name]||null,prop:n.prop||null};default:return t}}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.openDialog=n;var a=t("./form");r.default=o},{"./form":677}],679:[function(t,e,r){"use strict";function n(t,e){if(e.data.result.init)return a(o({},t,{result:Object.assign({},t.result,e.data.result)}),e.data);var r=e.data.result.context,n=e.data.result.fieldName,i=null;return r!==t.result.context?i=s(t,e.data.result):n!==t.result.fieldName&&(i=u(t,e.data.result)),i=i||o({},t,{result:Object.assign({},t.result,e.data.result)}),a(i,e.data)}Object.defineProperty(r,"__esModule",{value:!0}),r.initSdata=void 0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.sdataReducer=n;var i=t("../../data/schema/sdata-schema"),a=(r.initSdata=function(){var t=(0,i.getSdataDefault)(),e=(0,i.getSdataDefault)(t);return{errors:{},valid:!0,result:{context:t,fieldName:e,fieldValue:(0,i.getSdataDefault)(t,e),radiobuttons:"Absolute",type:"DAT"}}},function(t,e){var r=e.valid,n=e.errors,o=t.result,i=o.fieldName,a=o.fieldValue;return{result:t.result,valid:r&&!!i&&!!a,errors:n}}),s=function(t,e){var r=e.context,n=e.fieldValue,a=(0,i.getSdataDefault)(r),s=n;return s===t.result.fieldValue&&(s=(0,i.getSdataDefault)(r,a)),{result:o({},e,{context:r,fieldName:a,fieldValue:s})}},u=function(t,e){var r=e.fieldName,n=t.result.context,a=e.fieldValue;return i.sdataSchema[n][r]&&(a=(0,i.getSdataDefault)(n,r)),a===t.result.fieldValue&&i.sdataSchema[n][t.result.fieldName]&&(a=""),{result:o({},e,{fieldName:r,fieldValue:a})}}},{"../../data/schema/sdata-schema":646}],680:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return function(e){e({type:"APP_OPTIONS",data:t}),e({type:"UPDATE"})}}function i(t){return v.storage.setItem("ketcher-opts",t),{type:"SAVE_SETTINGS",data:t}}function a(t,e){return{type:"CHANGE_ANALYSE",data:n({},t,e)}}function s(t){return{type:"SET_RECOGNIZE_STRUCT",data:{structStr:t}}}function u(t){return{type:"CHANGE_IMAGO_VERSION",data:{version:t}}}function l(t){return{type:"CHANGE_RECOGNIZE_FILE",data:{file:t,structStr:null}}}function c(t){return{type:"IS_FRAGMENT_RECOGNIZE",data:{fragment:t}}}function f(t){return{type:"SAVE_CHECK_OPTS",data:t}}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],r=e.type,n=e.data;return"APP_OPTIONS"===r?m({},t,{app:m({},t.app,n)}):"SAVE_SETTINGS"===r?m({},t,{settings:n}):"SAVE_CHECK_OPTS"===r?m({},t,{check:n}):"CHANGE_ANALYSE"===r?m({},t,{analyse:m({},t.analyse,n)}):b.includes(r)?m({},t,{recognize:m({},t.recognize,n)}):t}Object.defineProperty(r,"__esModule",{value:!0}),r.initOptionsState=void 0;var p=t("lodash/fp/pick"),h=function(t){return t&&t.__esModule?t:{default:t}}(p),m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.appUpdate=o,r.saveSettings=i,r.changeRound=a,r.setStruct=s,r.changeVersion=u,r.changeImage=l,r.shouldFragment=c,r.checkOpts=f;var g=t("../../data/schema/options-schema"),v=t("../../storage-ext"),b=(r.initOptionsState={app:{server:!1,templates:!1},analyse:{values:null,roundWeight:3,roundMass:3},check:{checkOptions:["valence","radicals","pseudoatoms","stereo","query","overlapping_atoms","overlapping_bonds","rgroups","chiral","3d","chiral_flag"]},recognize:{file:null,structStr:null,fragment:!1,version:null},settings:Object.assign((0,g.getDefaultOptions)(),(0,g.validation)(v.storage.getItem("ketcher-opts"))),getServerSettings:function(){return(0,h.default)(g.SERVER_OPTIONS,this.settings)}},["SET_RECOGNIZE_STRUCT","CHANGE_RECOGNIZE_FILE","CHANGE_IMAGO_VERSION","IS_FRAGMENT_RECOGNIZE"]);r.default=d},{"../../data/schema/options-schema":644,"../../storage-ext":686,"lodash/fp/pick":435}],681:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(){return function(t,e){e().server.then(function(e){return t((0,x.appUpdate)({indigoVersion:e.indigoVersion,imagoVersions:e.imagoVersions,server:!0}))},function(t){return console.info(t)})}}function i(t,e){return function(r,n){var o=n().server.recognize,i=o(t,e).then(function(t){r((0,x.setStruct)(t.struct))},function(){r((0,x.setStruct)(null)),setTimeout(function(){return alert("Error! The picture isn't recognized.")},200)});r((0,x.setStruct)(i))}}function a(t,e){var r={};if(e.includes("chiral_flag")&&t.isChiral&&(r.chiral_flag="Chiral flag is present on the canvas"),e.includes("valence")){var n=0;t.atoms.forEach(function(t){return t.badConn&&n++}),n>0&&(r.valence="Structure contains "+n+" atom"+(1!==n?"s":"")+" with bad valence")}return r}function s(t){return function(e,r){var n=r(),o=n.editor,i=n.server,s=a(o.struct(),t),u=r().options.getServerSettings();return u.data={types:(0,h.default)(["valence","chiral_flag"],t)},f(o,i,"check",u).then(function(t){t=Object.assign(t,s),e((0,w.checkErrors)(t))}).catch(function(t){throw alert("Failed check!\n"+t.message),t})}}function u(t){return c("automap",t)}function l(){return function(t,e){var r=e(),n=r.editor,o=r.server,i=e().options.getServerSettings();return i.data={properties:["molecular-weight","most-abundant-mass","monoisotopic-mass","gross","mass-composition"]},f(n,o,"calculate",i).then(function(e){return t({type:"CHANGE_ANALYSE",data:{values:e}})}).catch(function(t){throw alert(t.message),t})}}function c(t,e,r){return function(n,o){var i=o(),a=i.options.getServerSettings();a.data=e,f(i.editor,i.server,t,a,r).then(function(e){return n((0,S.load)(e.struct,{rescale:"layout"===t,reactionRelayout:"clean"===t}))}).catch(function(t){return alert(t.message)})}}function f(t,e,r,n,o){var i=t.selection(),a=[];if(i&&(a=i.atoms?i.atoms:t.explicitSelected().atoms),!o){var s=new Map;o=t.struct().clone(null,null,!1,s);var u=d(o.getComponents());a=a.map(function(t){return u.get(s.get(t))})}return e.then(function(){return e[r](Object.assign({struct:_.default.stringify(o,{ignoreErrors:!0})},a&&a.length>0?{selected:a}:null,n.data),(0,g.default)("data",n))})}function d(t){return t.reactants.concat(t.products).reduce(function(t,e){return Array.from(e).forEach(function(e){t.add(e)}),t},new b.default)}Object.defineProperty(r,"__esModule",{value:!0});var p=t("lodash/fp/without"),h=n(p),m=t("lodash/fp/omit"),g=n(m);r.checkServer=o,r.recognize=i,r.check=s,r.automap=u,r.analyse=l,r.serverTransform=c,r.serverCall=f;var v=t("../../../util/pool"),b=n(v),y=t("../../../chem/molfile"),_=n(y),x=t("../options"),w=t("../modal/form"),S=t("../shared")},{"../../../chem/molfile":528,"../../../util/pool":689,"../modal/form":677,"../options":680,"../shared":682,"lodash/fp/omit":434,"lodash/fp/without":442}],682:[function(t,e,r){"use strict";function n(t){return t&&t.dialog?{type:"MODAL_OPEN",data:{name:t.dialog}}:t&&t.thunk?t.thunk:{type:"ACTION",action:t}}function o(t,e){return function(r,o){var i=o(),s=i.editor,u=i.server;return e=e||{},a.fromString(t,e,u).then(function(t){console.assert(t,"No molecule to update"),e.rescale&&t.rescale(),t.isBlank()||(e.fragment?r(n({tool:"paste",opts:t})):s.struct(t))},function(t){alert(t.message||"Can't parse molecule!")})}}Object.defineProperty(r,"__esModule",{value:!0}),r.onAction=n,r.load=o;var i=t("../data/convert/structformat"),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(i)},{"../data/convert/structformat":643}],683:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return{type:"TMPL_SELECT",data:{selected:t}}}function i(t){return{type:"TMPL_CHANGE_GROUP",data:{group:t,selected:null}}}function a(t){return{type:"TMPL_CHANGE_FILTER",data:{filter:t.trim(),selected:null}}}function s(t,e){return{type:"INIT_ATTACH",data:{name:t,atomid:e.atomid,bondid:e.bondid}}}function u(t){return{type:"SET_ATTACH_POINTS",data:{atomid:t.atomid,bondid:t.bondid}}}function l(t){return{type:"SET_TMPL_NAME",data:{name:t}}}function c(t){return function(e,r){(0,_.openDialog)(e,"attach",{tmpl:t}).then(function(e){var n=e.name,o=e.attach;t.struct.name=n,t.props=Object.assign({},t.props,o),"User Templates"===t.props.group&&d(r().templates.lib)},function(){return null}).then(function(){return(0,_.openDialog)(e,"templates").catch(function(){return null})})}}function f(t){var e={struct:t.clone(),props:{}};return function(t,r){(0,_.openDialog)(t,"attach",{tmpl:e}).then(function(n){var o=n.name,i=n.attach;e.struct.name=o,e.props=g({},i,{group:"User Templates"});var a=r().templates.lib.concat(e);t((0,x.initLib)(a)),d(a)}).catch(function(){return null})}}function d(t){var e=t.filter(function(t){return"User Templates"===t.props.group}).map(function(t){return{struct:b.default.stringify(t.struct),props:Object.assign({},(0,m.default)(["group"],t.props))}});y.storage.setItem("ketcher-tmpls",e)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:S,e=arguments[1];if(O.includes(e.type))return Object.assign({},t,e.data);if(A.includes(e.type)){var r=Object.assign({},t.attach,e.data);return g({},t,{attach:r})}return t}Object.defineProperty(r,"__esModule",{value:!0}),r.initTmplsState=r.initTmplLib=void 0;var h=t("lodash/fp/omit"),m=n(h),g=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.selectTmpl=o,r.changeGroup=i,r.changeFilter=a,r.initAttach=s,r.setAttachPoints=u,r.setTmplName=l,r.editTmpl=c,r.saveUserTmpl=f;var v=t("../../../chem/molfile"),b=n(v),y=t("../../storage-ext"),_=t("../modal"),x=t("./init-lib"),w=n(x);r.initTmplLib=w.default;var S=r.initTmplsState={lib:[],selected:null,filter:"",group:null,attach:{}},O=["TMPL_INIT","TMPL_SELECT","TMPL_CHANGE_GROUP","TMPL_CHANGE_FILTER"],A=["INIT_ATTACH","SET_ATTACH_POINTS","SET_TMPL_NAME"];r.default=p},{"../../../chem/molfile":528,"../../storage-ext":686,"../modal":678,"./init-lib":684,"lodash/fp/omit":434}],684:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return{type:"TMPL_INIT",data:{lib:t}}}function i(t,e,r){s(e+"library.sdf").then(function(t){var n=d.default.parse(t);return l(n,e,r).then(function(t){return n.map(function(e){var r=u(e);return r.file&&(e.props.prerender=-1!==t.indexOf(r.file)?"#"+r.id:""),e})})}).then(function(e){var r=e.concat(a());t(o(r)),t((0,m.appUpdate)({templates:!0}))})}function a(){var t=c.storage.getItem("ketcher-tmpls");return Array.isArray(t)&&0!==t.length?t.map(function(t){try{return""===t.props&&(t.props={}),t.props.group="User Templates",{struct:h.default.parse(t.struct),props:t.props}}catch(t){return null}}).filter(function(t){return null!==t}):[]}function s(t){return fetch(t,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.text();throw Error("Could not fetch "+t)})}function u(t){var e=t.props.prerender,r=e&&e.split("#",2);return{file:e&&r[0],id:e&&r[1]}}function l(t,e,r){var n=t.reduce(function(t,e){var r=u(e).file;return r&&-1===t.indexOf(r)&&t.push(r),t},[]);return Promise.all(n.map(function(t){return s(e+t).catch(function(){return null})})).then(function(t){return t.forEach(function(t){t&&(r.innerHTML+=t)}),n.filter(function(e,r){return!!t[r]})})}Object.defineProperty(r,"__esModule",{value:!0}),r.initLib=o,r.default=i;var c=t("../../storage-ext"),f=t("../../../chem/sdf"),d=n(f),p=t("../../../chem/molfile"),h=n(p),m=t("../options")},{"../../../chem/molfile":528,"../../../chem/sdf":534,"../../storage-ext":686,"../options":680}],685:[function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=/(bond)(-)(common|stereo|query)/,n=window.innerHeight;return Object.keys(t).reduce(function(e,o){return"bond"===o&&n>700?e:"transform"===o&&n>800?e:"rgroup"===o&&n>850?e:((!o.match(r)||n>700)&&(e[o]=t[o]),e)},b({},e))}function a(){return function(t,e){var r=(0,m.default)(250,function(){var r=e();r.editor.render.update(),t({type:"CLEAR_VISIBLE",data:r.actionState.activeTool})});addEventListener("resize",r)}}function s(t){fetch("ketcher.svg",{credentials:"same-origin"}).then(function(e){if(!e.ok)throw Error("Could not fetch ketcher.svg");e.text().then(function(e){t.innerHTML+=e})})}function u(t,e,r){return t=(0,v.default)(t),y.basic.indexOf(t)>-1||-1!==e.indexOf(t)?{freqAtoms:e}:(e[r]=t,r=(r+1)%S,{freqAtoms:e,currentAtom:r})}function l(t){return{type:"ADD_ATOMS",data:t}}function c(t){var e=Object.keys(x.default).find(function(e){return(0,p.default)(t,x.default[e].action)}),r=document.getElementById(e),n=r&&f(r);return n&&""!==n.id?o({},n.id,r.id):null}function f(t,e){e=e||document.body;for(var r=t;"hidden"!==window.getComputedStyle(r).overflow&&!r.classList.contains("opened");){if(r===e)return null;r=r.parentNode}return r}Object.defineProperty(r,"__esModule",{value:!0});var d=t("lodash/fp/isEqual"),p=n(d),h=t("lodash/fp/throttle"),m=n(h),g=t("lodash/fp/capitalize"),v=n(g),b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};r.initResize=a,r.initIcons=s,r.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w,e=arguments[1],r=e.type,n=e.data;switch(r){case"ACTION":var o=c(e.action);return o?b({},t,{opened:null,visibleTools:b({},t.visibleTools,o)}):b({},t,{opened:null});case"ADD_ATOMS":var a=u(n,t.freqAtoms,t.currentAtom);return b({},t,a);case"CLEAR_VISIBLE":var s=c(e.data),l=i(t.visibleTools,s);return b({},t,{opened:null,visibleTools:b({},l)});case"OPENED":return n.isSelected&&t.opened?b({},t,{opened:null}):b({},t,{opened:n.menuName});case"UPDATE":case"MODAL_OPEN":return b({},t,{opened:null});default:return t}},r.addAtoms=l,r.hiddenAncestor=f;var y=t("../../action/atoms"),_=t("../../action/tools"),x=n(_),w={freqAtoms:[],currentAtom:0,opened:null,visibleTools:{select:"select-lasso"}},S=7},{"../../action/atoms":607,"../../action/tools":612,"lodash/fp/capitalize":423,"lodash/fp/isEqual":433,"lodash/fp/throttle":440}],686:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.storage={warningMessage:"Your changes will be lost after the tab closing. See Help (Note 2).",isAvailable:function(){try{return localStorage}catch(t){return!1}},getItem:function(t){var e=null;try{e=JSON.parse(localStorage.getItem(t))}catch(t){console.info("LocalStorage:",t.name)}return e},setItem:function(t,e){var r=null;try{localStorage.setItem(t,JSON.stringify(e)),r=!0}catch(t){console.info("LocalStorage:",t.name),r=!1}return r}}},{}],687:[function(t,e,r){"use strict";function n(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(1===e.length&&"min"in e[0]&&"max"in e[0]&&(this.p0=e[0].min,this.p1=e[0].max),2===e.length)this.p0=e[0],this.p1=e[1];else if(4===e.length)this.p0=new i.default(e[0],e[1]),this.p1=new i.default(e[2],e[3]);else{if(0!==e.length)return new Error("Box2Abs constructor only accepts 4 numbers or 2 vectors or no args!");this.p0=new i.default,this.p1=new i.default}}Object.defineProperty(r,"__esModule",{value:!0});var o=t("./vec2"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.prototype.toString=function(){return this.p0.toString()+" "+this.p1.toString()},n.prototype.clone=function(){return new n(this.p0,this.p1)},n.prototype.extend=function(t,e){return console.assert(!!t),e=e||t,new n(this.p0.sub(t),this.p1.add(e))},n.prototype.include=function(t){return console.assert(!!t),new n(this.p0.min(t),this.p1.max(t))},n.prototype.contains=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return console.assert(!!t),t.x>=this.p0.x-e&&t.x<=this.p1.x+e&&t.y>=this.p0.y-e&&t.y<=this.p1.y+e},n.prototype.translate=function(t){return console.assert(!!t),new n(this.p0.add(t),this.p1.add(t))},n.prototype.transform=function(t,e){return console.assert(!!t),new n(t(this.p0,e),t(this.p1,e))},n.prototype.sz=function(){return this.p1.sub(this.p0)},n.prototype.centre=function(){return i.default.centre(this.p0,this.p1)},n.prototype.pos=function(){return this.p0},n.fromRelBox=function(t){return console.assert(!!t),new n(t.x,t.y,t.x+t.width,t.y+t.height)},n.union=function(t,e){return console.assert(!!t),console.assert(!!e),new n(i.default.min(t.p0,e.p0),i.default.max(t.p1,e.p1))},
  n.segmentIntersection=function(t,e,r,n){var o=(t.x-r.x)*(e.y-r.y)-(t.y-r.y)*(e.x-r.x),i=(t.x-n.x)*(e.y-n.y)-(t.y-n.y)*(e.x-n.x),a=(r.x-t.x)*(n.y-t.y)-(r.y-t.y)*(n.x-t.x),s=(r.x-e.x)*(n.y-e.y)-(r.y-e.y)*(n.x-e.x);return o*i<=0&&a*s<=0},r.default=n},{"./vec2":691}],688:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=function(t){function e(){return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),a(e,[{key:"find",value:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=this[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;if(t(a))return a}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}return null}},{key:"intersection",value:function(t){var r=new e,n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;this.has(u)&&r.add(u)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}},{key:"equals",value:function(t){return this.isSuperset(t)&&t.isSuperset(this)}},{key:"isSuperset",value:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=t[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;if(!this.has(a))return!1}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}return!0}},{key:"filter",value:function(t){return new e(Array.from(this).filter(t))}},{key:"union",value:function(t){var r=new e(this),n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;r.add(u)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}}]),e}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Set));r.default=s},{}],689:[function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},l=function(t){function e(t){n(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r._nextId=0,r}return i(e,t),s(e,[{key:"add",value:function(t){var r=this._nextId++;return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"set",this).call(this,r,t),r}},{key:"newId",value:function(){return this._nextId++}},{key:"keyOf",value:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=this.entries()[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var s=o.value,u=a(s,2),l=u[0];if(u[1]===t)return l}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}return null}},{key:"find",value:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=this.entries()[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var s=o.value,u=a(s,2),l=u[0];if(t(l,u[1]))return l}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}return null}},{key:"filter",value:function(t){return new e(Array.from(this).filter(function(e){var r=a(e,2),n=r[0],o=r[1];return t(n,o)}))}}]),e}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Map));r.default=l},{}],690:[function(t,e,r){"use strict";function n(t,e){return t.scaled(1/e.scale)}function o(t,e){return t.scaled(e.scale)}Object.defineProperty(r,"__esModule",{value:!0}),r.default={scaled2obj:n,obj2scaled:o}},{}],691:[function(t,e,r){"use strict";function n(t,e,r){if(0===arguments.length)this.x=0,this.y=0,this.z=0;else if(1===arguments.length)this.x=parseFloat(t.x||0),this.y=parseFloat(t.y||0),this.z=parseFloat(t.z||0);else if(2===arguments.length)this.x=parseFloat(t||0),this.y=parseFloat(e||0),this.z=0;else{if(3!==arguments.length)throw new Error("Vec2(): invalid arguments");this.x=parseFloat(t),this.y=parseFloat(e),this.z=parseFloat(r)}}Object.defineProperty(r,"__esModule",{value:!0}),n.ZERO=new n(0,0),n.UNIT=new n(1,1),n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.equals=function(t){return console.assert(!!t),this.x===t.x&&this.y===t.y},n.prototype.add=function(t){return console.assert(!!t),new n(this.x+t.x,this.y+t.y,this.z+t.z)},n.prototype.add_=function(t){console.assert(!!t),this.x+=t.x,this.y+=t.y,this.z+=t.z},n.prototype.get_xy0=function(){return new n(this.x,this.y)},n.prototype.sub=function(t){return console.assert(!!t),new n(this.x-t.x,this.y-t.y,this.z-t.z)},n.prototype.scaled=function(t){return console.assert(0===t||!!t),new n(this.x*t,this.y*t,this.z*t)},n.prototype.negated=function(){return new n(-this.x,-this.y,-this.z)},n.prototype.yComplement=function(t){return t=t||0,new n(this.x,t-this.y,this.z)},n.prototype.addScaled=function(t,e){return console.assert(!!t),console.assert(0===e||!!e),new n(this.x+t.x*e,this.y+t.y*e,this.z+t.z*e)},n.prototype.normalized=function(){return this.scaled(1/this.length())},n.prototype.normalize=function(){var t=this.length();return!(t<1e-6)&&(this.x/=t,this.y/=t,!0)},n.prototype.turnLeft=function(){return new n(-this.y,this.x,this.z)},n.prototype.coordStr=function(){return this.x.toString()+" , "+this.y.toString()},n.prototype.toString=function(){return"("+this.x.toFixed(2)+","+this.y.toFixed(2)+")"},n.prototype.max=function(t){return console.assert(!!t),new n.max(this,t)},n.prototype.min=function(t){return console.assert(!!t),new n.min(this,t)},n.prototype.ceil=function(){return new n(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},n.prototype.rotate=function(t){console.assert(0===t||!!t);var e=Math.sin(t),r=Math.cos(t);return this.rotateSC(e,r)},n.prototype.rotateSC=function(t,e){return console.assert(0===t||!!t),console.assert(0===e||!!e),new n(this.x*e-this.y*t,this.x*t+this.y*e,this.z)},n.prototype.oxAngle=function(){return Math.atan2(this.y,this.x)},n.dist=function(t,e){return console.assert(!!t),console.assert(!!e),n.diff(t,e).length()},n.max=function(t,e){return console.assert(!!t),console.assert(!!e),new n(Math.max(t.x,e.x),Math.max(t.y,e.y),Math.max(t.z,e.z))},n.min=function(t,e){return console.assert(!!t),console.assert(!!e),new n(Math.min(t.x,e.x),Math.min(t.y,e.y),Math.min(t.z,e.z))},n.sum=function(t,e){return console.assert(!!t),console.assert(!!e),new n(t.x+e.x,t.y+e.y,t.z+e.z)},n.dot=function(t,e){return console.assert(!!t),console.assert(!!e),t.x*e.x+t.y*e.y},n.cross=function(t,e){return console.assert(!!t),console.assert(!!e),t.x*e.y-t.y*e.x},n.angle=function(t,e){return console.assert(!!t),console.assert(!!e),Math.atan2(n.cross(t,e),n.dot(t,e))},n.diff=function(t,e){return console.assert(!!t),console.assert(!!e),new n(t.x-e.x,t.y-e.y,t.z-e.z)},n.lc=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var o=new n,i=0;i<arguments.length/2;++i)o=o.addScaled(e[2*i],e[2*i+1]);return o},n.lc2=function(t,e,r,o){return console.assert(!!t),console.assert(!!r),console.assert(0===e||!!e),console.assert(0===o||!!o),new n(t.x*e+r.x*o,t.y*e+r.y*o,t.z*e+r.z*o)},n.centre=function(t,e){return new n.lc2(t,.5,e,.5)},r.default=n},{}],692:[function(t,e,r){(function(r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(){return v.default.stringify(A.editor.struct(),{ignoreErrors:!0})}function i(){var t=A.editor.struct();return y.toString(t,"smiles-ext",A.server).catch(function(){return v.default.stringify(t)})}function a(){return m.default.stringify(A.editor.struct(),{ignoreErrors:!0})}function s(t){"string"==typeof t&&A.ui.load(t,{rescale:!0})}function u(t){"string"==typeof t&&A.ui.load(t,{rescale:!0,fragment:!0})}function l(t,e,r){var n=new S.default(t,Object.assign({scale:r.bondLength||75},r));if(e){var o=m.default.parse(e);n.setMolecule(o)}return n.update(),n}t("core-js/modules/es6.typed.array-buffer"),t("core-js/modules/es6.typed.int8-array"),t("core-js/modules/es6.typed.uint8-array"),t("core-js/modules/es6.typed.uint8-clamped-array"),t("core-js/modules/es6.typed.int16-array"),t("core-js/modules/es6.typed.uint16-array"),t("core-js/modules/es6.typed.int32-array"),t("core-js/modules/es6.typed.uint32-array"),t("core-js/modules/es6.typed.float32-array"),t("core-js/modules/es6.typed.float64-array"),t("core-js/modules/es6.map"),t("core-js/modules/es6.set"),t("core-js/modules/es6.weak-map"),t("core-js/modules/es6.weak-set"),t("core-js/modules/es6.reflect.apply"),t("core-js/modules/es6.reflect.construct"),t("core-js/modules/es6.reflect.define-property"),t("core-js/modules/es6.reflect.delete-property"),t("core-js/modules/es6.reflect.get"),t("core-js/modules/es6.reflect.get-own-property-descriptor"),t("core-js/modules/es6.reflect.get-prototype-of"),t("core-js/modules/es6.reflect.has"),t("core-js/modules/es6.reflect.is-extensible"),t("core-js/modules/es6.reflect.own-keys"),t("core-js/modules/es6.reflect.prevent-extensions"),t("core-js/modules/es6.reflect.set"),t("core-js/modules/es6.reflect.set-prototype-of"),t("core-js/modules/es6.promise"),t("core-js/modules/es6.symbol"),t("core-js/modules/es6.object.assign"),t("core-js/modules/es6.object.is"),t("core-js/modules/es6.object.set-prototype-of"),t("core-js/modules/es6.function.name"),t("core-js/modules/es6.string.raw"),t("core-js/modules/es6.string.from-code-point"),t("core-js/modules/es6.string.code-point-at"),t("core-js/modules/es6.string.repeat"),t("core-js/modules/es6.string.starts-with"),t("core-js/modules/es6.string.ends-with"),t("core-js/modules/es6.string.includes"),t("core-js/modules/es6.regexp.flags"),t("core-js/modules/es6.regexp.match"),t("core-js/modules/es6.regexp.replace"),t("core-js/modules/es6.regexp.split"),t("core-js/modules/es6.regexp.search"),t("core-js/modules/es6.array.from"),t("core-js/modules/es6.array.of"),t("core-js/modules/es6.array.copy-within"),t("core-js/modules/es6.array.find"),t("core-js/modules/es6.array.find-index"),t("core-js/modules/es6.array.fill"),t("core-js/modules/es6.array.iterator"),t("core-js/modules/es6.number.is-finite"),t("core-js/modules/es6.number.is-integer"),t("core-js/modules/es6.number.is-safe-integer"),t("core-js/modules/es6.number.is-nan"),t("core-js/modules/es6.number.epsilon"),t("core-js/modules/es6.number.min-safe-integer"),t("core-js/modules/es6.number.max-safe-integer"),t("core-js/modules/es6.math.acosh"),t("core-js/modules/es6.math.asinh"),t("core-js/modules/es6.math.atanh"),t("core-js/modules/es6.math.cbrt"),t("core-js/modules/es6.math.clz32"),t("core-js/modules/es6.math.cosh"),t("core-js/modules/es6.math.expm1"),t("core-js/modules/es6.math.fround"),t("core-js/modules/es6.math.hypot"),t("core-js/modules/es6.math.imul"),t("core-js/modules/es6.math.log1p"),t("core-js/modules/es6.math.log10"),t("core-js/modules/es6.math.log2"),t("core-js/modules/es6.math.sign"),t("core-js/modules/es6.math.sinh"),t("core-js/modules/es6.math.tanh"),t("core-js/modules/es6.math.trunc"),t("core-js/modules/es7.array.includes"),t("core-js/modules/es7.object.values"),t("core-js/modules/es7.object.entries"),t("core-js/modules/es7.object.get-own-property-descriptors"),t("core-js/modules/es7.string.pad-start"),t("core-js/modules/es7.string.pad-end"),t("core-js/modules/web.timers"),t("core-js/modules/web.immediate"),t("core-js/modules/web.dom.iterable"),t("regenerator-runtime/runtime"),t("whatwg-fetch");var c=t("query-string"),f=n(c),d=t("./api"),p=n(d),h=t("./chem/molfile"),m=n(h),g=t("./chem/smiles"),v=n(g),b=t("./ui/data/convert/structformat"),y=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(b),_=t("./ui"),x=n(_),w=t("./render"),S=n(w);window.onload=function(){var t=f.default.parse(document.location.search);t.api_path&&(A.apiPath=t.api_path),A.server=(0,p.default)(A.apiPath,{"smart-layout":!0,"ignore-stereochemistry-errors":!0,"mass-skip-error-on-pseudoatoms":!1,"gross-formula-add-rsites":!0}),A.ui=(0,x.default)(Object.assign({},t,O),A.server),A.editor=r._ui_editor,A.server.then(function(){t.mol&&A.ui.load(t.mol)},function(){document.title+=" (standalone)"})};var O={version:"2.0.0-RC",apiPath:"",buildDate:"2020-02-10T09:17:42",buildNumber:null},A=e.exports=Object.assign({getSmiles:o,saveSmiles:i,getMolfile:a,setMolecule:s,addFragment:u,showMolfile:l},O)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./api":523,"./chem/molfile":528,"./chem/smiles":537,"./render":591,"./ui":672,"./ui/data/convert/structformat":643,"core-js/modules/es6.array.copy-within":112,"core-js/modules/es6.array.fill":113,"core-js/modules/es6.array.find":115,"core-js/modules/es6.array.find-index":114,"core-js/modules/es6.array.from":116,"core-js/modules/es6.array.iterator":117,"core-js/modules/es6.array.of":118,"core-js/modules/es6.function.name":119,"core-js/modules/es6.map":120,"core-js/modules/es6.math.acosh":121,"core-js/modules/es6.math.asinh":122,"core-js/modules/es6.math.atanh":123,"core-js/modules/es6.math.cbrt":124,"core-js/modules/es6.math.clz32":125,"core-js/modules/es6.math.cosh":126,"core-js/modules/es6.math.expm1":127,"core-js/modules/es6.math.fround":128,"core-js/modules/es6.math.hypot":129,"core-js/modules/es6.math.imul":130,"core-js/modules/es6.math.log10":131,"core-js/modules/es6.math.log1p":132,"core-js/modules/es6.math.log2":133,"core-js/modules/es6.math.sign":134,"core-js/modules/es6.math.sinh":135,"core-js/modules/es6.math.tanh":136,"core-js/modules/es6.math.trunc":137,"core-js/modules/es6.number.epsilon":138,"core-js/modules/es6.number.is-finite":139,"core-js/modules/es6.number.is-integer":140,"core-js/modules/es6.number.is-nan":141,"core-js/modules/es6.number.is-safe-integer":142,"core-js/modules/es6.number.max-safe-integer":143,"core-js/modules/es6.number.min-safe-integer":144,"core-js/modules/es6.object.assign":145,"core-js/modules/es6.object.is":146,"core-js/modules/es6.object.set-prototype-of":147,"core-js/modules/es6.promise":148,"core-js/modules/es6.reflect.apply":149,"core-js/modules/es6.reflect.construct":150,"core-js/modules/es6.reflect.define-property":151,"core-js/modules/es6.reflect.delete-property":152,"core-js/modules/es6.reflect.get":155,"core-js/modules/es6.reflect.get-own-property-descriptor":153,"core-js/modules/es6.reflect.get-prototype-of":154,"core-js/modules/es6.reflect.has":156,"core-js/modules/es6.reflect.is-extensible":157,"core-js/modules/es6.reflect.own-keys":158,"core-js/modules/es6.reflect.prevent-extensions":159,"core-js/modules/es6.reflect.set":161,"core-js/modules/es6.reflect.set-prototype-of":160,"core-js/modules/es6.regexp.flags":163,"core-js/modules/es6.regexp.match":164,"core-js/modules/es6.regexp.replace":165,"core-js/modules/es6.regexp.search":166,"core-js/modules/es6.regexp.split":167,"core-js/modules/es6.set":168,"core-js/modules/es6.string.code-point-at":169,"core-js/modules/es6.string.ends-with":170,"core-js/modules/es6.string.from-code-point":171,"core-js/modules/es6.string.includes":172,"core-js/modules/es6.string.raw":173,"core-js/modules/es6.string.repeat":174,"core-js/modules/es6.string.starts-with":175,"core-js/modules/es6.symbol":176,"core-js/modules/es6.typed.array-buffer":177,"core-js/modules/es6.typed.float32-array":178,"core-js/modules/es6.typed.float64-array":179,"core-js/modules/es6.typed.int16-array":180,"core-js/modules/es6.typed.int32-array":181,"core-js/modules/es6.typed.int8-array":182,"core-js/modules/es6.typed.uint16-array":183,"core-js/modules/es6.typed.uint32-array":184,"core-js/modules/es6.typed.uint8-array":185,"core-js/modules/es6.typed.uint8-clamped-array":186,"core-js/modules/es6.weak-map":187,"core-js/modules/es6.weak-set":188,"core-js/modules/es7.array.includes":189,"core-js/modules/es7.object.entries":190,"core-js/modules/es7.object.get-own-property-descriptors":191,"core-js/modules/es7.object.values":192,"core-js/modules/es7.string.pad-end":193,"core-js/modules/es7.string.pad-start":194,"core-js/modules/web.dom.iterable":195,"core-js/modules/web.immediate":196,"core-js/modules/web.timers":197,"query-string":498,"regenerator-runtime/runtime":512,"whatwg-fetch":522}]},{},[692])(692)});
  //# sourceMappingURL=ketcher.js.map
  