summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitignore2
-rw-r--r--public/build/Cindy.js1027
-rw-r--r--public/build/CindyGL.js140
-rw-r--r--public/build/LICENSE_cindyjs201
-rw-r--r--public/js/extra.js43
-rw-r--r--public/views/hedgedoc/footer.ejs3
6 files changed, 1415 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 9528746e..4fae05f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,7 @@ config.json
.sequelizerc
# ignore webpack build
-public/build
+#public/build
public/views/build
public/uploads/*
diff --git a/public/build/Cindy.js b/public/build/Cindy.js
new file mode 100644
index 00000000..872914b2
--- /dev/null
+++ b/public/build/Cindy.js
@@ -0,0 +1,1027 @@
+/* CindyJS - (C) 2014-2016 The CindyJS Project
+ * Mostly licensed under the Apache License 2.0, but subprojects may use different licensing.
+ * See https://github.com/CindyJS/CindyJS/tree/131b593c48ec6a2c773b580bea773a6298f7e901
+ * for corresponding sources and their respective licensing conditions.
+ */
+/*
+ npm.im/iphone-inline-video 2.0.2 npm.im/intervalometer https://github.com/paulmillr/es6-shim
+ @license es6-shim Copyright 2013-2016 by Paul Miller (http://paulmillr.com)
+ and contributors, MIT License
+ es6-shim: v0.35.4
+ see https://github.com/paulmillr/es6-shim/blob/0.35.3/LICENSE
+ Details and documentation:
+ https://github.com/paulmillr/es6-shim/
+*/
+'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,n,t){d!=Array.prototype&&d!=Object.prototype&&(d[n]=t.value)};$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);
+$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var d=0;return function(n){return $jscomp.SYMBOL_PREFIX+(n||"")+d++}}();
+$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var d=$jscomp.global.Symbol.iterator;d||(d=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&$jscomp.defineProperty(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(d){var n=0;return $jscomp.iteratorPrototype(function(){return n<d.length?{done:!1,value:d[n++]}:{done:!0}})};
+$jscomp.iteratorPrototype=function(d){$jscomp.initSymbolIterator();d={next:d};d[$jscomp.global.Symbol.iterator]=function(){return this};return d};$jscomp.makeIterator=function(d){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var n=d[Symbol.iterator];return n?n.call(d):$jscomp.arrayIterator(d)};$jscomp.arrayFromIterator=function(d){for(var n,t=[];!(n=d.next()).done;)t.push(n.value);return t};$jscomp.arrayFromIterable=function(d){return d instanceof Array?d:$jscomp.arrayFromIterator($jscomp.makeIterator(d))};
+$jscomp.polyfill=function(d,n,t,G){if(n){t=$jscomp.global;d=d.split(".");for(G=0;G<d.length-1;G++){var B=d[G];B in t||(t[B]={});t=t[B]}d=d[d.length-1];G=t[d];n=n(G);n!=G&&null!=n&&$jscomp.defineProperty(t,d,{configurable:!0,writable:!0,value:n})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
+$jscomp.polyfill("Promise",function(d){function n(){this.batch_=null}function t(d){return d instanceof B?d:new B(function(h,n){h(d)})}if(d&&!$jscomp.FORCE_POLYFILL_PROMISE)return d;n.prototype.asyncExecute=function(d){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(d);return this};n.prototype.asyncExecuteBatch_=function(){var d=this;this.asyncExecuteFunction(function(){d.executeBatch_()})};var G=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(d){G(d,
+0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var d=this.batch_;this.batch_=[];for(var h=0;h<d.length;++h){var n=d[h];d[h]=null;try{n()}catch(p){this.asyncThrow_(p)}}}this.batch_=null};n.prototype.asyncThrow_=function(d){this.asyncExecuteFunction(function(){throw d;})};var B=function(d){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var h=this.createResolveAndReject_();try{d(h.resolve,h.reject)}catch(X){h.reject(X)}};B.prototype.createResolveAndReject_=
+function(){function d(d){return function(p){n||(n=!0,d.call(h,p))}}var h=this,n=!1;return{resolve:d(this.resolveTo_),reject:d(this.reject_)}};B.prototype.resolveTo_=function(d){if(d===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof B)this.settleSameAsPromise_(d);else{a:switch(typeof d){case "object":var h=null!=d;break a;case "function":h=!0;break a;default:h=!1}h?this.resolveToNonPromiseObj_(d):this.fulfill_(d)}};B.prototype.resolveToNonPromiseObj_=function(d){var h=
+void 0;try{h=d.then}catch(X){this.reject_(X);return}"function"==typeof h?this.settleSameAsThenable_(h,d):this.fulfill_(d)};B.prototype.reject_=function(d){this.settle_(2,d)};B.prototype.fulfill_=function(d){this.settle_(1,d)};B.prototype.settle_=function(d,h){if(0!=this.state_)throw Error("Cannot settle("+d+", "+h+"): Promise already settled in state"+this.state_);this.state_=d;this.result_=h;this.executeOnSettledCallbacks_()};B.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var d=
+0;d<this.onSettledCallbacks_.length;++d)I.asyncExecute(this.onSettledCallbacks_[d]);this.onSettledCallbacks_=null}};var I=new n;B.prototype.settleSameAsPromise_=function(d){var h=this.createResolveAndReject_();d.callWhenSettled_(h.resolve,h.reject)};B.prototype.settleSameAsThenable_=function(d,h){var n=this.createResolveAndReject_();try{d.call(h,n.resolve,n.reject)}catch(p){n.reject(p)}};B.prototype.then=function(d,h){function n(h,d){return"function"==typeof h?function(d){try{p(h(d))}catch(ta){t(ta)}}:
+d}var p,t,G=new B(function(h,d){p=h;t=d});this.callWhenSettled_(n(d,p),n(h,t));return G};B.prototype.catch=function(d){return this.then(void 0,d)};B.prototype.callWhenSettled_=function(d,h){function n(){switch(p.state_){case 1:d(p.result_);break;case 2:h(p.result_);break;default:throw Error("Unexpected state: "+p.state_);}}var p=this;null==this.onSettledCallbacks_?I.asyncExecute(n):this.onSettledCallbacks_.push(n)};B.resolve=t;B.reject=function(d){return new B(function(h,n){n(d)})};B.race=function(d){return new B(function(h,
+n){for(var p=$jscomp.makeIterator(d),B=p.next();!B.done;B=p.next())t(B.value).callWhenSettled_(h,n)})};B.all=function(d){var h=$jscomp.makeIterator(d),n=h.next();return n.done?t([]):new B(function(d,B){function p(h){return function(n){G[h]=n;X--;0==X&&d(G)}}var G=[],X=0;do G.push(void 0),X++,t(n.value).callWhenSettled_(p(G.length-1),B),n=h.next();while(!n.done)})};return B},"es6","es3");
+$jscomp.iteratorFromArray=function(d,n){$jscomp.initSymbolIterator();d instanceof String&&(d+="");var t=0,G={next:function(){if(t<d.length){var B=t++;return{value:n(B,d[B]),done:!1}}G.next=function(){return{done:!0,value:void 0}};return G.next()}};G[Symbol.iterator]=function(){return G};return G};$jscomp.polyfill("Array.prototype.keys",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(d){return d})}},"es6","es3");
+$jscomp.polyfill("Number.isNaN",function(d){return d?d:function(d){return"number"===typeof d&&isNaN(d)}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(d){return d?d:function(d){return"number"!==typeof d?!1:!isNaN(d)&&Infinity!==d&&-Infinity!==d}},"es6","es3");$jscomp.polyfill("Math.sign",function(d){return d?d:function(d){d=Number(d);return 0===d||isNaN(d)?d:0<d?1:-1}},"es6","es3");$jscomp.polyfill("Number.EPSILON",function(d){return Math.pow(2,-52)},"es6","es3");
+$jscomp.polyfill("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991},"es6","es3");$jscomp.checkStringArgs=function(d,n,t){if(null==d)throw new TypeError("The 'this' value for String.prototype."+t+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+t+" must not be a regular expression");return d+""};
+$jscomp.polyfill("String.prototype.startsWith",function(d){return d?d:function(d,t){var n=$jscomp.checkStringArgs(this,d,"startsWith");d+="";var B=n.length,I=d.length;t=Math.max(0,Math.min(t|0,n.length));for(var O=0;O<I&&t<B;)if(n[t++]!=d[O++])return!1;return O>=I}},"es6","es3");
+$jscomp.polyfill("String.prototype.endsWith",function(d){return d?d:function(d,t){var n=$jscomp.checkStringArgs(this,d,"endsWith");d+="";void 0===t&&(t=n.length);t=Math.max(0,Math.min(t|0,n.length));for(var B=d.length;0<B&&0<t;)if(n[--t]!=d[--B])return!1;return 0>=B}},"es6","es3");$jscomp.polyfill("Object.is",function(d){return d?d:function(d,t){return d===t?0!==d||1/d===1/t:d!==d&&t!==t}},"es6","es3");
+$jscomp.polyfill("Array.prototype.includes",function(d){return d?d:function(d,t){var n=this;n instanceof String&&(n=String(n));var B=n.length;t=t||0;for(0>t&&(t=Math.max(t+B,0));t<B;t++){var I=n[t];if(I===d||Object.is(I,d))return!0}return!1}},"es7","es3");$jscomp.polyfill("String.prototype.includes",function(d){return d?d:function(d,t){return-1!==$jscomp.checkStringArgs(this,d,"includes").indexOf(d,t||0)}},"es6","es3");
+$jscomp.polyfill("Array.prototype.values",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(d,t){return t})}},"es8","es3");$jscomp.polyfill("Array.from",function(d){return d?d:function(d,t,G){$jscomp.initSymbolIterator();t=null!=t?t:function(h){return h};var n=[],I=d[Symbol.iterator];if("function"==typeof I)for(d=I.call(d);!(I=d.next()).done;)n.push(t.call(G,I.value));else{I=d.length;for(var O=0;O<I;O++)n.push(t.call(G,d[O]))}return n}},"es6","es3");
+$jscomp.polyfill("Array.prototype.entries",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(d,t){return[d,t]})}},"es6","es3");$jscomp.polyfill("Number.isInteger",function(d){return d?d:function(d){return Number.isFinite(d)?d===Math.floor(d):!1}},"es6","es3");$jscomp.findInternal=function(d,n,t){d instanceof String&&(d=String(d));for(var G=d.length,B=0;B<G;B++){var I=d[B];if(n.call(t,I,B,d))return{i:B,v:I}}return{i:-1,v:void 0}};
+$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,t){return $jscomp.findInternal(this,d,t).v}},"es6","es3");$jscomp.polyfill("Array.prototype.findIndex",function(d){return d?d:function(d,t){return $jscomp.findInternal(this,d,t).i}},"es6","es3");$jscomp.polyfill("Object.getOwnPropertySymbols",function(d){return d?d:function(){return[]}},"es6","es5");
+$jscomp.polyfill("Math.expm1",function(d){return d?d:function(d){d=Number(d);if(.25>d&&-.25<d){for(var n=d,G=1,B=d,I=0;I!=B;)n*=d/++G,B=(I=B)+n;return B}return Math.exp(d)-1}},"es6","es3");$jscomp.polyfill("Math.sinh",function(d){if(d)return d;var n=Math.exp;return function(d){d=Number(d);return 0===d?d:(n(d)-n(-d))/2}},"es6","es3");$jscomp.polyfill("Math.cosh",function(d){if(d)return d;var n=Math.exp;return function(d){d=Number(d);return(n(d)+n(-d))/2}},"es6","es3");
+$jscomp.polyfill("Math.log1p",function(d){return d?d:function(d){d=Number(d);if(.25>d&&-.25<d){for(var n=d,G=1,B=d,I=0,O=1;I!=B;)n*=d,O*=-1,B=(I=B)+O*n/++G;return B}return Math.log(1+d)}},"es6","es3");$jscomp.polyfill("Math.asinh",function(d){return d?d:function(d){d=Number(d);if(0===d)return d;var n=Math.log(Math.abs(d)+Math.sqrt(d*d+1));return 0>d?-n:n}},"es6","es3");
+$jscomp.polyfill("Math.atanh",function(d){if(d)return d;var n=Math.log1p;return function(d){d=Number(d);return(n(d)-n(-d))/2}},"es6","es3");$jscomp.polyfill("Math.tanh",function(d){return d?d:function(d){d=Number(d);if(0===d)return d;var n=Math.exp(-2*Math.abs(d));n=(1-n)/(1+n);return 0>d?-n:n}},"es6","es3");$jscomp.polyfill("Math.acosh",function(d){return d?d:function(d){d=Number(d);return Math.log(d+Math.sqrt(d*d-1))}},"es6","es3");
+$jscomp.polyfill("Math.cbrt",function(d){return d?d:function(d){if(0===d)return d;d=Number(d);var n=Math.pow(Math.abs(d),1/3);return 0>d?-n:n}},"es6","es3");$jscomp.polyfill("Math.imul",function(d){return d?d:function(d,t){d=Number(d);t=Number(t);var n=d&65535,B=t&65535;return n*B+((d>>>16&65535)*B+n*(t>>>16&65535)<<16>>>0)|0}},"es6","es3");
+$jscomp.checkEs6ConformanceViaProxy=function(){try{var d={},n=Object.create(new $jscomp.global.Proxy(d,{get:function(t,G,B){return t==d&&"q"==G&&B==n}}));return!0===n.q}catch(t){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.owns=function(d,n){return Object.prototype.hasOwnProperty.call(d,n)};
+$jscomp.polyfill("WeakMap",function(d){function n(){if(!d||!Object.seal)return!1;try{var h=Object.seal({}),n=Object.seal({}),p=new d([[h,2],[n,3]]);if(2!=p.get(h)||3!=p.get(n))return!1;p.delete(h);p.set(n,4);return!p.has(h)&&4==p.get(n)}catch(ia){return!1}}function t(d){$jscomp.owns(d,B)||$jscomp.defineProperty(d,B,{value:{}})}function G(d){var h=Object[d];h&&(Object[d]=function(d){t(d);return h(d)})}if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(d&&$jscomp.ES6_CONFORMANCE)return d}else if(n())return d;
+var B="$jscomp_hidden_"+Math.random();G("freeze");G("preventExtensions");G("seal");var I=0,O=function(d){this.id_=(I+=Math.random()+1).toString();if(d){$jscomp.initSymbol();$jscomp.initSymbolIterator();d=$jscomp.makeIterator(d);for(var h;!(h=d.next()).done;)h=h.value,this.set(h[0],h[1])}};O.prototype.set=function(d,n){t(d);if(!$jscomp.owns(d,B))throw Error("WeakMap key fail: "+d);d[B][this.id_]=n;return this};O.prototype.get=function(d){return $jscomp.owns(d,B)?d[B][this.id_]:void 0};O.prototype.has=
+function(d){return $jscomp.owns(d,B)&&$jscomp.owns(d[B],this.id_)};O.prototype.delete=function(d){return $jscomp.owns(d,B)&&$jscomp.owns(d[B],this.id_)?delete d[B][this.id_]:!1};return O},"es6","es3");$jscomp.MapEntry=function(){};
+$jscomp.polyfill("Map",function(d){function n(){if($jscomp.ASSUME_NO_NATIVE_MAP||!d||"function"!=typeof d||!d.prototype.entries||"function"!=typeof Object.seal)return!1;try{var h=Object.seal({x:4}),n=new d($jscomp.makeIterator([[h,"s"]]));if("s"!=n.get(h)||1!=n.size||n.get({x:4})||n.set({x:4},"t")!=n||2!=n.size)return!1;var B=n.entries(),t=B.next();if(t.done||t.value[0]!=h||"s"!=t.value[1])return!1;t=B.next();return t.done||4!=t.value[0].x||"t"!=t.value[1]||!B.next().done?!1:!0}catch(nc){return!1}}
+if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(d&&$jscomp.ES6_CONFORMANCE)return d}else if(n())return d;$jscomp.initSymbol();$jscomp.initSymbolIterator();var t=new WeakMap,G=function(d){this.data_={};this.head_=O();this.size=0;if(d){d=$jscomp.makeIterator(d);for(var h;!(h=d.next()).done;)h=h.value,this.set(h[0],h[1])}};G.prototype.set=function(d,h){d=0===d?0:d;var n=B(this,d);n.list||(n.list=this.data_[n.id]=[]);n.entry?n.entry.value=h:(n.entry={next:this.head_,previous:this.head_.previous,head:this.head_,
+key:d,value:h},n.list.push(n.entry),this.head_.previous.next=n.entry,this.head_.previous=n.entry,this.size++);return this};G.prototype.delete=function(d){d=B(this,d);return d.entry&&d.list?(d.list.splice(d.index,1),d.list.length||delete this.data_[d.id],d.entry.previous.next=d.entry.next,d.entry.next.previous=d.entry.previous,d.entry.head=null,this.size--,!0):!1};G.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=O();this.size=0};G.prototype.has=function(d){return!!B(this,d).entry};
+G.prototype.get=function(d){return(d=B(this,d).entry)&&d.value};G.prototype.entries=function(){return I(this,function(d){return[d.key,d.value]})};G.prototype.keys=function(){return I(this,function(d){return d.key})};G.prototype.values=function(){return I(this,function(d){return d.value})};G.prototype.forEach=function(d,h){for(var n=this.entries(),p;!(p=n.next()).done;)p=p.value,d.call(h,p[1],p[0],this)};G.prototype[Symbol.iterator]=G.prototype.entries;var B=function(d,n){var p=n&&typeof n;"object"==
+p||"function"==p?t.has(n)?p=t.get(n):(p=""+ ++h,t.set(n,p)):p="p_"+n;var B=d.data_[p];if(B&&$jscomp.owns(d.data_,p))for(d=0;d<B.length;d++){var G=B[d];if(n!==n&&G.key!==G.key||n===G.key)return{id:p,list:B,index:d,entry:G}}return{id:p,list:B,index:-1,entry:void 0}},I=function(d,h){var n=d.head_;return $jscomp.iteratorPrototype(function(){if(n){for(;n.head!=d.head_;)n=n.previous;for(;n.next!=n.head;)return n=n.next,{done:!1,value:h(n)};n=null}return{done:!0,value:void 0}})},O=function(){var d={};return d.previous=
+d.next=d.head=d},h=0;return G},"es6","es3");
+$jscomp.polyfill("Set",function(d){function n(){if($jscomp.ASSUME_NO_NATIVE_SET||!d||"function"!=typeof d||!d.prototype.entries||"function"!=typeof Object.seal)return!1;try{var n=Object.seal({x:4}),B=new d($jscomp.makeIterator([n]));if(!B.has(n)||1!=B.size||B.add(n)!=B||1!=B.size||B.add({x:4})!=B||2!=B.size)return!1;var t=B.entries(),O=t.next();if(O.done||O.value[0]!=n||O.value[1]!=n)return!1;O=t.next();return O.done||O.value[0]==n||4!=O.value[0].x||O.value[1]!=O.value[0]?!1:t.next().done}catch(h){return!1}}
+if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(d&&$jscomp.ES6_CONFORMANCE)return d}else if(n())return d;$jscomp.initSymbol();$jscomp.initSymbolIterator();var t=function(d){this.map_=new Map;if(d){d=$jscomp.makeIterator(d);for(var n;!(n=d.next()).done;)this.add(n.value)}this.size=this.map_.size};t.prototype.add=function(d){d=0===d?0:d;this.map_.set(d,d);this.size=this.map_.size;return this};t.prototype.delete=function(d){d=this.map_.delete(d);this.size=this.map_.size;return d};t.prototype.clear=
+function(){this.map_.clear();this.size=0};t.prototype.has=function(d){return this.map_.has(d)};t.prototype.entries=function(){return this.map_.entries()};t.prototype.values=function(){return this.map_.values()};t.prototype.keys=t.prototype.values;t.prototype[Symbol.iterator]=t.prototype.values;t.prototype.forEach=function(d,n){var t=this;this.map_.forEach(function(B){return d.call(n,B,B,t)})};return t},"es6","es3");
+$jscomp.underscoreProtoCanBeSet=function(){var d={a:!0},n={};try{return n.__proto__=d,n.a}catch(t){}return!1};$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(d,n){d.__proto__=n;if(d.__proto__!==n)throw new TypeError(d+" is not extensible");return d}:null;$jscomp.polyfill("Object.setPrototypeOf",function(d){return d||$jscomp.setPrototypeOf},"es6","es5");
+$jscomp.assign="function"==typeof Object.assign?Object.assign:function(d,n){for(var t=1;t<arguments.length;t++){var G=arguments[t];if(G)for(var B in G)$jscomp.owns(G,B)&&(d[B]=G[B])}return d};$jscomp.polyfill("Object.assign",function(d){return d||$jscomp.assign},"es6","es3");$jscomp.polyfill("Object.values",function(d){return d?d:function(d){var n=[],G;for(G in d)$jscomp.owns(d,G)&&n.push(d[G]);return n}},"es8","es3");
+$jscomp.polyfill("Array.prototype.fill",function(d){return d?d:function(d,t,G){var n=this.length||0;0>t&&(t=Math.max(0,n+t));if(null==G||G>n)G=n;G=Number(G);0>G&&(G=Math.max(0,n+G));for(t=Number(t||0);t<G;t++)this[t]=d;return this}},"es6","es3");
+var enableInlineVideo=function(){function d(f,d,h,n){function p(h){t=d(p,n);f(h-(B||h));B=h}var t,B;return{start:function(){t||p(0)},stop:function(){h(t);t=null;B=0}}}function n(f,d,h,n){function p(d){!!f[h]===!!n&&d.stopImmediatePropagation();delete f[h]}return f.addEventListener(d,p,!1),p}function t(f,d,h,n){function p(f){h[d]=f}n&&p(f[d]);Object.defineProperty(f,d,{get:function(){return h[d]},set:p})}function G(f,d,h){h.addEventListener(d,function(){return f.dispatchEvent(new Event(d))})}function B(f,
+d){Promise.resolve().then(function(){f.dispatchEvent(new Event(d))})}function I(f){var d=new Audio;return G(f,"play",d),G(f,"playing",d),G(f,"pause",d),d.crossOrigin=f.crossOrigin,d.src=f.src||f.currentSrc||"data:",d}function O(d,h,n){(Wa||0)+200<Date.now()&&(d[K]=!0,Wa=Date.now());n||(d.currentTime=h);f[++ba%3]=100*h|0}function h(f){this.video.readyState>=this.video.HAVE_FUTURE_DATA?(this.hasAudio||(this.driver.currentTime=this.video.currentTime+f*this.video.playbackRate/1E3,this.video.loop&&this.driver.currentTime>=
+this.video.duration&&(this.driver.currentTime=0)),O(this.video,this.driver.currentTime)):this.video.networkState===this.video.NETWORK_IDLE&&0===this.video.buffered.length&&this.video.load();this.video.ended&&(delete this.video[K],this.video.pause(!0))}function X(){var f=this[db];return this.webkitDisplayingFullscreen?void this[ta]():("data:"!==f.driver.src&&f.driver.src!==this.src&&(O(this,0,!0),f.driver.src=this.src),void(this.paused&&(f.paused=!1,0===this.buffered.length&&this.load(),f.driver.play(),
+f.updater.start(),f.hasAudio||(B(this,"play"),f.video.readyState>=f.video.HAVE_ENOUGH_DATA&&B(this,"playing")))))}function p(f){var d=this[db];d.driver.pause();d.updater.stop();this.webkitDisplayingFullscreen&&this[Na]();d.paused&&!f||(d.paused=!0,d.hasAudio||B(this,"pause"),this.ended&&(this[K]=!0,B(this,"ended")))}function ia(n,p){var t=n[db]={};t.paused=!0;t.hasAudio=p;t.video=n;t.updater=d(h.bind(t),requestAnimationFrame,cancelAnimationFrame);p?t.driver=I(n):(n.addEventListener("canplay",function(){n.paused||
+B(n,"playing")}),t.driver={src:n.src||n.currentSrc||"data:",muted:!0,paused:!0,pause:function(){t.driver.paused=!0},play:function(){t.driver.paused=!1;t.driver.currentTime>=t.video.duration&&O(n,0)},get ended(){return t.driver.currentTime>=t.video.duration}});n.addEventListener("emptied",function(){var f=!t.driver.src||"data:"===t.driver.src;t.driver.src&&t.driver.src!==n.src&&(O(n,0,!0),t.driver.src=n.src,f?t.driver.play():t.updater.stop())},!1);n.addEventListener("webkitbeginfullscreen",function(){n.paused?
+p&&0===t.driver.buffered.length&&t.driver.load():(n.pause(),n[ta]())});p&&(n.addEventListener("webkitendfullscreen",function(){t.driver.currentTime=n.currentTime}),n.addEventListener("seeking",function(){0>f.indexOf(100*n.currentTime|0)&&(t.driver.currentTime=n.currentTime)}))}var Wa,nc="object"==typeof document&&"object-fit"in document.head.style&&!matchMedia("(-webkit-video-playable-inline)").matches,db="bfred-it:iphone-inline-video",K="bfred-it:iphone-inline-video:event",ta="bfred-it:iphone-inline-video:nativeplay",
+Na="bfred-it:iphone-inline-video:nativepause",f=[],ba=0;return function(f,d){if(void 0===d&&(d={}),!f[db])if(d.everywhere||nc&&(d.iPad||d.ipad?/iPhone|iPod|iPad/:/iPhone|iPod/).test(navigator.userAgent))!f.paused&&f.webkitDisplayingFullscreen&&f.pause(),ia(f,!f.muted),d=f[db],f[ta]=f.play,f[Na]=f.pause,f.play=X,f.pause=p,t(f,"paused",d.driver),t(f,"muted",d.driver,!0),t(f,"playbackRate",d.driver,!0),t(f,"ended",d.driver),t(f,"loop",d.driver,!0),n(f,"seeking"),n(f,"seeked"),n(f,"timeupdate",K,!1),
+n(f,"ended",K,!1),f.classList.add("IIV"),f.muted&&f.autoplay&&f.play(),/iPhone|iPod|iPad/.test(navigator.platform)||console.warn("iphone-inline-video is not guaranteed to work in emulated environments")}}();
+(function(){function d(b,c,k){f.biginteger_used=1;null!=b&&("number"==typeof b&&"undefined"==typeof c?this.fromInt(b):"number"==typeof b?this.fromNumber(b,c,k):null==c&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,c))}function n(){return new d(null,void 0,void 0)}function t(b,c,k,U,f,d){for(;0<=--d;){var ca=c*this[b++]+k[U]+f;f=Math.floor(ca/67108864);k[U++]=ca&67108863}return f}function G(b,c,k,U,f,d){var ca=c&32767;for(c>>=15;0<=--d;){var h=this[b]&32767,Z=this[b++]>>15,n=c*h+Z*ca;
+h=ca*h+((n&32767)<<15)+k[U]+(f&1073741823);f=(h>>>30)+(n>>>15)+c*Z+(f>>>30);k[U++]=h&1073741823}return f}function B(b,c,k,U,f,d){var ca=c&16383;for(c>>=14;0<=--d;){var h=this[b]&16383,Z=this[b++]>>14,n=c*h+Z*ca;h=ca*h+((n&16383)<<14)+k[U]+f;f=(h>>28)+(n>>14)+c*Z;k[U++]=h&268435455}return f}function I(b,c){b=Xa[b.charCodeAt(c)];return null==b?-1:b}function O(b){var c=n();c.fromInt(b);return c}function h(b){var c=1,k;0!=(k=b>>>16)&&(b=k,c+=16);0!=(k=b>>8)&&(b=k,c+=8);0!=(k=b>>4)&&(b=k,c+=4);0!=(k=b>>
+2)&&(b=k,c+=2);0!=b>>1&&(c+=1);return c}function X(b){this.m=b}function p(b){this.m=b;this.mp=b.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<b.DB-15)-1;this.mt2=2*b.t}function ia(b,c){return b&c}function Wa(b,c){return b|c}function nc(b,c){return b^c}function db(b,c){return b&~c}function K(){}function ta(b){return b}function Na(b){this.r2=n();this.q3=n();d.ONE.dlShiftTo(2*b.t,this.r2);this.mu=this.r2.divide(b);this.m=b}var f={use_lines:!0,use_xyz:!1},ba=!1;"undefined"!==typeof module&&
+module.exports?(module.exports=f,ba=!0):"undefined"!==typeof document?window.ClipperLib=f:self.ClipperLib=f;if(ba){va="chrome";var ua="Netscape"}else{var va=navigator.userAgent.toString().toLowerCase();ua=navigator.appName}var F=-1!=va.indexOf("chrome")&&-1==va.indexOf("chromium")?1:0;ba=-1!=va.indexOf("chromium")?1:0;var ub=-1!=va.indexOf("safari")&&-1==va.indexOf("chrome")&&-1==va.indexOf("chromium")?1:0;var Wb=-1!=va.indexOf("firefox")?1:0;va.indexOf("firefox/17");va.indexOf("firefox/15");va.indexOf("firefox/3");
+var Ab=-1!=va.indexOf("opera")?1:0;va.indexOf("msie 10");va.indexOf("msie 9");var Bb=-1!=va.indexOf("msie 8")?1:0;var zb=-1!=va.indexOf("msie 7")?1:0;va=-1!=va.indexOf("msie ")?1:0;f.biginteger_used=null;"Microsoft Internet Explorer"==ua?(d.prototype.am=G,ua=30):"Netscape"!=ua?(d.prototype.am=t,ua=26):(d.prototype.am=B,ua=28);d.prototype.DB=ua;d.prototype.DM=(1<<ua)-1;d.prototype.DV=1<<ua;d.prototype.FV=Math.pow(2,52);d.prototype.F1=52-ua;d.prototype.F2=2*ua-52;var Xa=[],Oa;ua=48;for(Oa=0;9>=Oa;++Oa)Xa[ua++]=
+Oa;ua=97;for(Oa=10;36>Oa;++Oa)Xa[ua++]=Oa;ua=65;for(Oa=10;36>Oa;++Oa)Xa[ua++]=Oa;X.prototype.convert=function(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b};X.prototype.revert=function(b){return b};X.prototype.reduce=function(b){b.divRemTo(this.m,null,b)};X.prototype.mulTo=function(b,c,k){b.multiplyTo(c,k);this.reduce(k)};X.prototype.sqrTo=function(b,c){b.squareTo(c);this.reduce(c)};p.prototype.convert=function(b){var c=n();b.abs().dlShiftTo(this.m.t,c);c.divRemTo(this.m,null,c);0>b.s&&
+0<c.compareTo(d.ZERO)&&this.m.subTo(c,c);return c};p.prototype.revert=function(b){var c=n();b.copyTo(c);this.reduce(c);return c};p.prototype.reduce=function(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var c=0;c<this.m.t;++c){var k=b[c]&32767,U=k*this.mpl+((k*this.mph+(b[c]>>15)*this.mpl&this.um)<<15)&b.DM;k=c+this.m.t;for(b[k]+=this.m.am(0,U,b,c,0,this.m.t);b[k]>=b.DV;)b[k]-=b.DV,b[++k]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)};p.prototype.mulTo=function(b,c,k){b.multiplyTo(c,
+k);this.reduce(k)};p.prototype.sqrTo=function(b,c){b.squareTo(c);this.reduce(c)};d.prototype.copyTo=function(b){for(var c=this.t-1;0<=c;--c)b[c]=this[c];b.t=this.t;b.s=this.s};d.prototype.fromInt=function(b){this.t=1;this.s=0>b?-1:0;0<b?this[0]=b:-1>b?this[0]=b+this.DV:this.t=0};d.prototype.fromString=function(b,c){if(16==c)c=4;else if(8==c)c=3;else if(256==c)c=8;else if(2==c)c=1;else if(32==c)c=5;else if(4==c)c=2;else{this.fromRadix(b,c);return}this.s=this.t=0;for(var k=b.length,U=!1,f=0;0<=--k;){var h=
+8==c?b[k]&255:I(b,k);0>h?"-"==b.charAt(k)&&(U=!0):(U=!1,0==f?this[this.t++]=h:f+c>this.DB?(this[this.t-1]|=(h&(1<<this.DB-f)-1)<<f,this[this.t++]=h>>this.DB-f):this[this.t-1]|=h<<f,f+=c,f>=this.DB&&(f-=this.DB))}8==c&&0!=(b[0]&128)&&(this.s=-1,0<f&&(this[this.t-1]|=(1<<this.DB-f)-1<<f));this.clamp();U&&d.ZERO.subTo(this,this)};d.prototype.clamp=function(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t};d.prototype.dlShiftTo=function(b,c){var k;for(k=this.t-1;0<=k;--k)c[k+b]=this[k];
+for(k=b-1;0<=k;--k)c[k]=0;c.t=this.t+b;c.s=this.s};d.prototype.drShiftTo=function(b,c){for(var k=b;k<this.t;++k)c[k-b]=this[k];c.t=Math.max(this.t-b,0);c.s=this.s};d.prototype.lShiftTo=function(b,c){var k=b%this.DB,f=this.DB-k,d=(1<<f)-1;b=Math.floor(b/this.DB);var h=this.s<<k&this.DM,n;for(n=this.t-1;0<=n;--n)c[n+b+1]=this[n]>>f|h,h=(this[n]&d)<<k;for(n=b-1;0<=n;--n)c[n]=0;c[b]=h;c.t=this.t+b+1;c.s=this.s;c.clamp()};d.prototype.rShiftTo=function(b,c){c.s=this.s;var k=Math.floor(b/this.DB);if(k>=
+this.t)c.t=0;else{b%=this.DB;var f=this.DB-b,d=(1<<b)-1;c[0]=this[k]>>b;for(var h=k+1;h<this.t;++h)c[h-k-1]|=(this[h]&d)<<f,c[h-k]=this[h]>>b;0<b&&(c[this.t-k-1]|=(this.s&d)<<f);c.t=this.t-k;c.clamp()}};d.prototype.subTo=function(b,c){for(var k=0,f=0,d=Math.min(b.t,this.t);k<d;)f+=this[k]-b[k],c[k++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f-=b.s;k<this.t;)f+=this[k],c[k++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;k<b.t;)f-=b[k],c[k++]=f&this.DM,f>>=this.DB;f-=b.s}c.s=0>f?-1:0;-1>f?c[k++]=
+this.DV+f:0<f&&(c[k++]=f);c.t=k;c.clamp()};d.prototype.multiplyTo=function(b,c){var k=this.abs(),f=b.abs(),ca=k.t;for(c.t=ca+f.t;0<=--ca;)c[ca]=0;for(ca=0;ca<f.t;++ca)c[ca+k.t]=k.am(0,f[ca],c,ca,0,k.t);c.s=0;c.clamp();this.s!=b.s&&d.ZERO.subTo(c,c)};d.prototype.squareTo=function(b){for(var c=this.abs(),k=b.t=2*c.t;0<=--k;)b[k]=0;for(k=0;k<c.t-1;++k){var f=c.am(k,c[k],b,2*k,0,1);(b[k+c.t]+=c.am(k+1,2*c[k],b,2*k+1,f,c.t-k-1))>=c.DV&&(b[k+c.t]-=c.DV,b[k+c.t+1]=1)}0<b.t&&(b[b.t-1]+=c.am(k,c[k],b,2*k,
+0,1));b.s=0;b.clamp()};d.prototype.divRemTo=function(b,c,k){var f=b.abs();if(!(0>=f.t)){var ca=this.abs();if(ca.t<f.t)null!=c&&c.fromInt(0),null!=k&&this.copyTo(k);else{null==k&&(k=n());var Z=n(),J=this.s;b=b.s;var p=this.DB-h(f[f.t-1]);0<p?(f.lShiftTo(p,Z),ca.lShiftTo(p,k)):(f.copyTo(Z),ca.copyTo(k));f=Z.t;ca=Z[f-1];if(0!=ca){var t=ca*(1<<this.F1)+(1<f?Z[f-2]>>this.F2:0),B=this.FV/t;t=(1<<this.F1)/t;var F=1<<this.F2,G=k.t,I=G-f,K=null==c?n():c;Z.dlShiftTo(I,K);0<=k.compareTo(K)&&(k[k.t++]=1,k.subTo(K,
+k));d.ONE.dlShiftTo(f,K);for(K.subTo(Z,Z);Z.t<f;)Z[Z.t++]=0;for(;0<=--I;){var ia=k[--G]==ca?this.DM:Math.floor(k[G]*B+(k[G-1]+F)*t);if((k[G]+=Z.am(0,ia,k,I,0,f))<ia)for(Z.dlShiftTo(I,K),k.subTo(K,k);k[G]<--ia;)k.subTo(K,k)}null!=c&&(k.drShiftTo(f,c),J!=b&&d.ZERO.subTo(c,c));k.t=f;k.clamp();0<p&&k.rShiftTo(p,k);0>J&&d.ZERO.subTo(k,k)}}}};d.prototype.invDigit=function(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var c=b&3;c=c*(2-(b&15)*c)&15;c=c*(2-(b&255)*c)&255;c=c*(2-((b&65535)*c&65535))&
+65535;c=c*(2-b*c%this.DV)%this.DV;return 0<c?this.DV-c:-c};d.prototype.isEven=function(){return 0==(0<this.t?this[0]&1:this.s)};d.prototype.exp=function(b,c){if(4294967295<b||1>b)return d.ONE;var k=n(),f=n(),ca=c.convert(this),Z=h(b)-1;for(ca.copyTo(k);0<=--Z;)if(c.sqrTo(k,f),0<(b&1<<Z))c.mulTo(f,ca,k);else{var J=k;k=f;f=J}return c.revert(k)};d.prototype.toString=function(b){if(0>this.s)return"-"+this.negate().toString(b);if(16==b)b=4;else if(8==b)b=3;else if(2==b)b=1;else if(32==b)b=5;else if(4==
+b)b=2;else return this.toRadix(b);var c=(1<<b)-1,k,f=!1,d="",h=this.t,n=this.DB-h*this.DB%b;if(0<h--)for(n<this.DB&&0<(k=this[h]>>n)&&(f=!0,d="0123456789abcdefghijklmnopqrstuvwxyz".charAt(k));0<=h;)n<b?(k=(this[h]&(1<<n)-1)<<b-n,k|=this[--h]>>(n+=this.DB-b)):(k=this[h]>>(n-=b)&c,0>=n&&(n+=this.DB,--h)),0<k&&(f=!0),f&&(d+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(k));return f?d:"0"};d.prototype.negate=function(){var b=n();d.ZERO.subTo(this,b);return b};d.prototype.abs=function(){return 0>this.s?
+this.negate():this};d.prototype.compareTo=function(b){var c=this.s-b.s;if(0!=c)return c;var k=this.t;c=k-b.t;if(0!=c)return 0>this.s?-c:c;for(;0<=--k;)if(0!=(c=this[k]-b[k]))return c;return 0};d.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)};d.prototype.mod=function(b){var c=n();this.abs().divRemTo(b,null,c);0>this.s&&0<c.compareTo(d.ZERO)&&b.subTo(c,c);return c};d.prototype.modPowInt=function(b,c){c=256>b||c.isEven()?new X(c):new p(c);return this.exp(b,
+c)};d.ZERO=O(0);d.ONE=O(1);K.prototype.convert=ta;K.prototype.revert=ta;K.prototype.mulTo=function(b,c,k){b.multiplyTo(c,k)};K.prototype.sqrTo=function(b,c){b.squareTo(c)};Na.prototype.convert=function(b){if(0>b.s||b.t>2*this.m.t)return b.mod(this.m);if(0>b.compareTo(this.m))return b;var c=n();b.copyTo(c);this.reduce(c);return c};Na.prototype.revert=function(b){return b};Na.prototype.reduce=function(b){b.drShiftTo(this.m.t-1,this.r2);b.t>this.m.t+1&&(b.t=this.m.t+1,b.clamp());this.mu.multiplyUpperTo(this.r2,
+this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>b.compareTo(this.r2);)b.dAddOffset(1,this.m.t+1);for(b.subTo(this.r2,b);0<=b.compareTo(this.m);)b.subTo(this.m,b)};Na.prototype.mulTo=function(b,c,k){b.multiplyTo(c,k);this.reduce(k)};Na.prototype.sqrTo=function(b,c){b.squareTo(c);this.reduce(c)};var T=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,
+233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Gb=67108864/T[T.length-1];d.prototype.chunkSize=
+function(b){return Math.floor(Math.LN2*this.DB/Math.log(b))};d.prototype.toRadix=function(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var c=this.chunkSize(b);c=Math.pow(b,c);var k=O(c),f=n(),d=n(),h="";for(this.divRemTo(k,f,d);0<f.signum();)h=(c+d.intValue()).toString(b).substr(1)+h,f.divRemTo(k,f,d);return d.intValue().toString(b)+h};d.prototype.fromRadix=function(b,c){this.fromInt(0);null==c&&(c=10);for(var k=this.chunkSize(c),f=Math.pow(c,k),ca=!1,h=0,n=0,p=0;p<b.length;++p){var t=
+I(b,p);0>t?"-"==b.charAt(p)&&0==this.signum()&&(ca=!0):(n=c*n+t,++h>=k&&(this.dMultiply(f),this.dAddOffset(n,0),n=h=0))}0<h&&(this.dMultiply(Math.pow(c,h)),this.dAddOffset(n,0));ca&&d.ZERO.subTo(this,this)};d.prototype.fromNumber=function(b,c,k){if("number"==typeof c)if(2>b)this.fromInt(1);else for(this.fromNumber(b,k),this.testBit(b-1)||this.bitwiseTo(d.ONE.shiftLeft(b-1),Wa,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(d.ONE.shiftLeft(b-
+1),this);else{k=[];var f=b&7;k.length=(b>>3)+1;c.nextBytes(k);k[0]=0<f?k[0]&(1<<f)-1:0;this.fromString(k,256)}};d.prototype.bitwiseTo=function(b,c,k){var f,d=Math.min(b.t,this.t);for(f=0;f<d;++f)k[f]=c(this[f],b[f]);if(b.t<this.t){var h=b.s&this.DM;for(f=d;f<this.t;++f)k[f]=c(this[f],h);k.t=this.t}else{h=this.s&this.DM;for(f=d;f<b.t;++f)k[f]=c(h,b[f]);k.t=b.t}k.s=c(this.s,b.s);k.clamp()};d.prototype.changeBit=function(b,c){b=d.ONE.shiftLeft(b);this.bitwiseTo(b,c,b);return b};d.prototype.addTo=function(b,
+c){for(var k=0,f=0,d=Math.min(b.t,this.t);k<d;)f+=this[k]+b[k],c[k++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f+=b.s;k<this.t;)f+=this[k],c[k++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;k<b.t;)f+=b[k],c[k++]=f&this.DM,f>>=this.DB;f+=b.s}c.s=0>f?-1:0;0<f?c[k++]=f:-1>f&&(c[k++]=this.DV+f);c.t=k;c.clamp()};d.prototype.dMultiply=function(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()};d.prototype.dAddOffset=function(b,c){if(0!=b){for(;this.t<=c;)this[this.t++]=0;for(this[c]+=
+b;this[c]>=this.DV;)this[c]-=this.DV,++c>=this.t&&(this[this.t++]=0),++this[c]}};d.prototype.multiplyLowerTo=function(b,c,k){var f=Math.min(this.t+b.t,c);k.s=0;for(k.t=f;0<f;)k[--f]=0;var d;for(d=k.t-this.t;f<d;++f)k[f+this.t]=this.am(0,b[f],k,f,0,this.t);for(d=Math.min(b.t,c);f<d;++f)this.am(0,b[f],k,f,0,c-f);k.clamp()};d.prototype.multiplyUpperTo=function(b,c,k){--c;var f=k.t=this.t+b.t-c;for(k.s=0;0<=--f;)k[f]=0;for(f=Math.max(c-this.t,0);f<b.t;++f)k[this.t+f-c]=this.am(c-f,b[f],k,0,0,this.t+f-
+c);k.clamp();k.drShiftTo(1,k)};d.prototype.modInt=function(b){if(0>=b)return 0;var c=this.DV%b,k=0>this.s?b-1:0;if(0<this.t)if(0==c)k=this[0]%b;else for(var f=this.t-1;0<=f;--f)k=(c*k+this[f])%b;return k};d.prototype.millerRabin=function(b){var c=this.subtract(d.ONE),k=c.getLowestSetBit();if(0>=k)return!1;var f=c.shiftRight(k);b=b+1>>1;b>T.length&&(b=T.length);for(var ca=n(),h=0;h<b;++h){ca.fromInt(T[Math.floor(Math.random()*T.length)]);var J=ca.modPow(f,this);if(0!=J.compareTo(d.ONE)&&0!=J.compareTo(c)){for(var p=
+1;p++<k&&0!=J.compareTo(c);)if(J=J.modPowInt(2,this),0==J.compareTo(d.ONE))return!1;if(0!=J.compareTo(c))return!1}}return!0};d.prototype.clone=function(){var b=n();this.copyTo(b);return b};d.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]};d.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24};d.prototype.shortValue=function(){return 0==
+this.t?this.s:this[0]<<16>>16};d.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};d.prototype.toByteArray=function(){var b=this.t,c=[];c[0]=this.s;var k=this.DB-b*this.DB%8,f,d=0;if(0<b--)for(k<this.DB&&(f=this[b]>>k)!=(this.s&this.DM)>>k&&(c[d++]=f|this.s<<this.DB-k);0<=b;)if(8>k?(f=(this[b]&(1<<k)-1)<<8-k,f|=this[--b]>>(k+=this.DB-8)):(f=this[b]>>(k-=8)&255,0>=k&&(k+=this.DB,--b)),0!=(f&128)&&(f|=-256),0==d&&(this.s&128)!=(f&128)&&++d,0<d||f!=this.s)c[d++]=f;
+return c};d.prototype.equals=function(b){return 0==this.compareTo(b)};d.prototype.min=function(b){return 0>this.compareTo(b)?this:b};d.prototype.max=function(b){return 0<this.compareTo(b)?this:b};d.prototype.and=function(b){var c=n();this.bitwiseTo(b,ia,c);return c};d.prototype.or=function(b){var c=n();this.bitwiseTo(b,Wa,c);return c};d.prototype.xor=function(b){var c=n();this.bitwiseTo(b,nc,c);return c};d.prototype.andNot=function(b){var c=n();this.bitwiseTo(b,db,c);return c};d.prototype.not=function(){for(var b=
+n(),c=0;c<this.t;++c)b[c]=this.DM&~this[c];b.t=this.t;b.s=~this.s;return b};d.prototype.shiftLeft=function(b){var c=n();0>b?this.rShiftTo(-b,c):this.lShiftTo(b,c);return c};d.prototype.shiftRight=function(b){var c=n();0>b?this.lShiftTo(-b,c):this.rShiftTo(b,c);return c};d.prototype.getLowestSetBit=function(){for(var b=0;b<this.t;++b)if(0!=this[b]){var c=b*this.DB;b=this[b];if(0==b)b=-1;else{var k=0;0==(b&65535)&&(b>>=16,k+=16);0==(b&255)&&(b>>=8,k+=8);0==(b&15)&&(b>>=4,k+=4);0==(b&3)&&(b>>=2,k+=2);
+0==(b&1)&&++k;b=k}return c+b}return 0>this.s?this.t*this.DB:-1};d.prototype.bitCount=function(){for(var b=0,c=this.s&this.DM,k=0;k<this.t;++k){for(var f=this[k]^c,d=0;0!=f;)f&=f-1,++d;b+=d}return b};d.prototype.testBit=function(b){var c=Math.floor(b/this.DB);return c>=this.t?0!=this.s:0!=(this[c]&1<<b%this.DB)};d.prototype.setBit=function(b){return this.changeBit(b,Wa)};d.prototype.clearBit=function(b){return this.changeBit(b,db)};d.prototype.flipBit=function(b){return this.changeBit(b,nc)};d.prototype.add=
+function(b){var c=n();this.addTo(b,c);return c};d.prototype.subtract=function(b){var c=n();this.subTo(b,c);return c};d.prototype.multiply=function(b){var c=n();this.multiplyTo(b,c);return c};d.prototype.divide=function(b){var c=n();this.divRemTo(b,c,null);return c};d.prototype.remainder=function(b){var c=n();this.divRemTo(b,null,c);return c};d.prototype.divideAndRemainder=function(b){var c=n(),k=n();this.divRemTo(b,c,k);return[c,k]};d.prototype.modPow=function(b,c){var k=b.bitLength(),f=O(1);if(0>=
+k)return f;var d=18>k?1:48>k?3:144>k?4:768>k?5:6;c=8>k?new X(c):c.isEven()?new Na(c):new p(c);var Z=[],J=3,t=d-1,B=(1<<d)-1;Z[1]=c.convert(this);if(1<d)for(k=n(),c.sqrTo(Z[1],k);J<=B;)Z[J]=n(),c.mulTo(k,Z[J-2],Z[J]),J+=2;var F=b.t-1,G,K=!0,I=n();for(k=h(b[F])-1;0<=F;){k>=t?G=b[F]>>k-t&B:(G=(b[F]&(1<<k+1)-1)<<t-k,0<F&&(G|=b[F-1]>>this.DB+k-t));for(J=d;0==(G&1);)G>>=1,--J;0>(k-=J)&&(k+=this.DB,--F);if(K)Z[G].copyTo(f),K=!1;else{for(;1<J;)c.sqrTo(f,I),c.sqrTo(I,f),J-=2;0<J?c.sqrTo(f,I):(J=f,f=I,I=J);
+c.mulTo(I,Z[G],f)}for(;0<=F&&0==(b[F]&1<<k);)c.sqrTo(f,I),J=f,f=I,I=J,0>--k&&(k=this.DB-1,--F)}return c.revert(f)};d.prototype.modInverse=function(b){var c=b.isEven();if(this.isEven()&&c||0==b.signum())return d.ZERO;for(var k=b.clone(),f=this.clone(),h=O(1),n=O(0),J=O(0),p=O(1);0!=k.signum();){for(;k.isEven();)k.rShiftTo(1,k),c?(h.isEven()&&n.isEven()||(h.addTo(this,h),n.subTo(b,n)),h.rShiftTo(1,h)):n.isEven()||n.subTo(b,n),n.rShiftTo(1,n);for(;f.isEven();)f.rShiftTo(1,f),c?(J.isEven()&&p.isEven()||
+(J.addTo(this,J),p.subTo(b,p)),J.rShiftTo(1,J)):p.isEven()||p.subTo(b,p),p.rShiftTo(1,p);0<=k.compareTo(f)?(k.subTo(f,k),c&&h.subTo(J,h),n.subTo(p,n)):(f.subTo(k,f),c&&J.subTo(h,J),p.subTo(n,p))}if(0!=f.compareTo(d.ONE))return d.ZERO;if(0<=p.compareTo(b))return p.subtract(b);if(0>p.signum())p.addTo(b,p);else return p;return 0>p.signum()?p.add(b):p};d.prototype.pow=function(b){return this.exp(b,new K)};d.prototype.gcd=function(b){var c=0>this.s?this.negate():this.clone();b=0>b.s?b.negate():b.clone();
+if(0>c.compareTo(b)){var k=c;c=b;b=k}k=c.getLowestSetBit();var f=b.getLowestSetBit();if(0>f)return c;k<f&&(f=k);for(0<f&&(c.rShiftTo(f,c),b.rShiftTo(f,b));0<c.signum();)0<(k=c.getLowestSetBit())&&c.rShiftTo(k,c),0<(k=b.getLowestSetBit())&&b.rShiftTo(k,b),0<=c.compareTo(b)?(c.subTo(b,c),c.rShiftTo(1,c)):(b.subTo(c,b),b.rShiftTo(1,b));0<f&&b.lShiftTo(f,b);return b};d.prototype.isProbablePrime=function(b){var c,k=this.abs();if(1==k.t&&k[0]<=T[T.length-1]){for(c=0;c<T.length;++c)if(k[0]==T[c])return!0;
+return!1}if(k.isEven())return!1;for(c=1;c<T.length;){for(var f=T[c],d=c+1;d<T.length&&f<Gb;)f*=T[d++];for(f=k.modInt(f);c<d;)if(0==f%T[c++])return!1}return k.millerRabin(b)};d.prototype.square=function(){var b=n();this.squareTo(b);return b};d.prototype.IsNegative=function(){return-1==this.compareTo(d.ZERO)?!0:!1};d.op_Equality=function(b,c){return 0==b.compareTo(c)?!0:!1};d.op_Inequality=function(b,c){return 0!=b.compareTo(c)?!0:!1};d.op_GreaterThan=function(b,c){return 0<b.compareTo(c)?!0:!1};d.op_LessThan=
+function(b,c){return 0>b.compareTo(c)?!0:!1};d.op_Addition=function(b,c){return(new d(b)).add(new d(c))};d.op_Subtraction=function(b,c){return(new d(b)).subtract(new d(c))};d.Int128Mul=function(b,c){return(new d(b)).multiply(new d(c))};d.op_Division=function(b,c){return b.divide(c)};d.prototype.ToDouble=function(){return parseFloat(this.toString())};ua=function(b,c){var k;if("undefined"==typeof Object.getOwnPropertyNames)for(k in c.prototype){if("undefined"==typeof b.prototype[k]||b.prototype[k]==
+Object.prototype[k])b.prototype[k]=c.prototype[k]}else for(var f=Object.getOwnPropertyNames(c.prototype),d=0;d<f.length;d++)"undefined"==typeof Object.getOwnPropertyDescriptor(b.prototype,f[d])&&Object.defineProperty(b.prototype,f[d],Object.getOwnPropertyDescriptor(c.prototype,f[d]));for(k in c)"undefined"==typeof b[k]&&(b[k]=c[k]);b.$baseCtor=c};f.Path=function(){return[]};f.Paths=function(){return[]};f.DoublePoint=function(){var b=arguments;this.Y=this.X=0;1==b.length?(this.X=b[0].X,this.Y=b[0].Y):
+2==b.length&&(this.X=b[0],this.Y=b[1])};f.DoublePoint0=function(){this.Y=this.X=0};f.DoublePoint1=function(b){this.X=b.X;this.Y=b.Y};f.DoublePoint2=function(b,c){this.X=b;this.Y=c};f.PolyNode=function(){this.m_Parent=null;this.m_polygon=new f.Path;this.m_endtype=this.m_jointype=this.m_Index=0;this.m_Childs=[];this.IsOpen=!1};f.PolyNode.prototype.IsHoleNode=function(){for(var b=!0,c=this.m_Parent;null!==c;)b=!b,c=c.m_Parent;return b};f.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};
+f.PolyNode.prototype.Contour=function(){return this.m_polygon};f.PolyNode.prototype.AddChild=function(b){var c=this.m_Childs.length;this.m_Childs.push(b);b.m_Parent=this;b.m_Index=c};f.PolyNode.prototype.GetNext=function(){return 0<this.m_Childs.length?this.m_Childs[0]:this.GetNextSiblingUp()};f.PolyNode.prototype.GetNextSiblingUp=function(){return null===this.m_Parent?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};f.PolyNode.prototype.Childs=
+function(){return this.m_Childs};f.PolyNode.prototype.Parent=function(){return this.m_Parent};f.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};f.PolyTree=function(){this.m_AllPolys=[];f.PolyNode.call(this)};f.PolyTree.prototype.Clear=function(){for(var b=0,c=this.m_AllPolys.length;b<c;b++)this.m_AllPolys[b]=null;this.m_AllPolys.length=0;this.m_Childs.length=0};f.PolyTree.prototype.GetFirst=function(){return 0<this.m_Childs.length?this.m_Childs[0]:null};f.PolyTree.prototype.Total=function(){var b=
+this.m_AllPolys.length;0<b&&this.m_Childs[0]!=this.m_AllPolys[0]&&b--;return b};ua(f.PolyTree,f.PolyNode);f.Math_Abs_Int64=f.Math_Abs_Int32=f.Math_Abs_Double=function(b){return Math.abs(b)};f.Math_Max_Int32_Int32=function(b,c){return Math.max(b,c)};f.Cast_Int32=va||Ab||ub?function(b){return b|0}:function(b){return~~b};f.Cast_Int64=F?function(b){return-2147483648>b||2147483647<b?0>b?Math.ceil(b):Math.floor(b):~~b}:Wb&&"function"==typeof Number.toInteger?function(b){return Number.toInteger(b)}:zb||
+Bb?function(b){return parseInt(b,10)}:va?function(b){return-2147483648>b||2147483647<b?0>b?Math.ceil(b):Math.floor(b):b|0}:function(b){return 0>b?Math.ceil(b):Math.floor(b)};f.Clear=function(b){b.length=0};f.PI=3.141592653589793;f.PI2=6.283185307179586;f.IntPoint=function(){var b=arguments,c=b.length;this.Y=this.X=0;f.use_xyz?(this.Z=0,3==c?(this.X=b[0],this.Y=b[1],this.Z=b[2]):2==c?(this.X=b[0],this.Y=b[1],this.Z=0):1==c?b[0]instanceof f.DoublePoint?(b=b[0],this.X=f.Clipper.Round(b.X),this.Y=f.Clipper.Round(b.Y),
+this.Z=0):(b=b[0],"undefined"==typeof b.Z&&(b.Z=0),this.X=b.X,this.Y=b.Y,this.Z=b.Z):this.Z=this.Y=this.X=0):2==c?(this.X=b[0],this.Y=b[1]):1==c?b[0]instanceof f.DoublePoint?(b=b[0],this.X=f.Clipper.Round(b.X),this.Y=f.Clipper.Round(b.Y)):(b=b[0],this.X=b.X,this.Y=b.Y):this.Y=this.X=0};f.IntPoint.op_Equality=function(b,c){return b.X==c.X&&b.Y==c.Y};f.IntPoint.op_Inequality=function(b,c){return b.X!=c.X||b.Y!=c.Y};f.use_xyz?(f.IntPoint0=function(){this.Z=this.Y=this.X=0},f.IntPoint1=function(b){this.X=
+b.X;this.Y=b.Y;this.Z=b.Z},f.IntPoint1dp=function(b){this.X=f.Clipper.Round(b.X);this.Y=f.Clipper.Round(b.Y);this.Z=0},f.IntPoint2=function(b,c){this.X=b;this.Y=c;this.Z=0},f.IntPoint3=function(b,c,k){this.X=b;this.Y=c;this.Z=k}):(f.IntPoint0=function(){this.Y=this.X=0},f.IntPoint1=function(b){this.X=b.X;this.Y=b.Y},f.IntPoint1dp=function(b){this.X=f.Clipper.Round(b.X);this.Y=f.Clipper.Round(b.Y)},f.IntPoint2=function(b,c){this.X=b;this.Y=c});f.IntRect=function(){var b=arguments,c=b.length;4==c?(this.left=
+b[0],this.top=b[1],this.right=b[2],this.bottom=b[3]):1==c?(this.left=b[0].left,this.top=b[0].top,this.right=b[0].right,this.bottom=b[0].bottom):this.bottom=this.right=this.top=this.left=0};f.IntRect0=function(){this.bottom=this.right=this.top=this.left=0};f.IntRect1=function(b){this.left=b.left;this.top=b.top;this.right=b.right;this.bottom=b.bottom};f.IntRect4=function(b,c,k,f){this.left=b;this.top=c;this.right=k;this.bottom=f};f.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};f.PolyType=
+{ptSubject:0,ptClip:1};f.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};f.JoinType={jtSquare:0,jtRound:1,jtMiter:2};f.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};f.EdgeSide={esLeft:0,esRight:1};f.Direction={dRightToLeft:0,dLeftToRight:1};f.TEdge=function(){this.Bot=new f.IntPoint;this.Curr=new f.IntPoint;this.Top=new f.IntPoint;this.Delta=new f.IntPoint;this.Dx=0;this.PolyTyp=f.PolyType.ptSubject;this.Side=f.EdgeSide.esLeft;this.OutIdx=
+this.WindCnt2=this.WindCnt=this.WindDelta=0;this.PrevInSEL=this.NextInSEL=this.PrevInAEL=this.NextInAEL=this.NextInLML=this.Prev=this.Next=null};f.IntersectNode=function(){this.Edge2=this.Edge1=null;this.Pt=new f.IntPoint};f.MyIntersectNodeSort=function(){};f.MyIntersectNodeSort.Compare=function(b,c){b=c.Pt.Y-b.Pt.Y;return 0<b?1:0>b?-1:0};f.LocalMinima=function(){this.Y=0;this.Next=this.RightBound=this.LeftBound=null};f.Scanbeam=function(){this.Y=0;this.Next=null};f.OutRec=function(){this.Idx=0;this.IsOpen=
+this.IsHole=!1;this.PolyNode=this.BottomPt=this.Pts=this.FirstLeft=null};f.OutPt=function(){this.Idx=0;this.Pt=new f.IntPoint;this.Prev=this.Next=null};f.Join=function(){this.OutPt2=this.OutPt1=null;this.OffPt=new f.IntPoint};f.ClipperBase=function(){this.m_CurrentLM=this.m_MinimaList=null;this.m_edges=[];this.PreserveCollinear=this.m_HasOpenPaths=this.m_UseFullRange=!1;this.m_CurrentLM=this.m_MinimaList=null;this.m_HasOpenPaths=this.m_UseFullRange=!1};f.ClipperBase.horizontal=-9007199254740992;f.ClipperBase.Skip=
+-2;f.ClipperBase.Unassigned=-1;f.ClipperBase.tolerance=1E-20;f.ClipperBase.loRange=47453132;f.ClipperBase.hiRange=0xfffffffffffff;f.ClipperBase.near_zero=function(b){return b>-f.ClipperBase.tolerance&&b<f.ClipperBase.tolerance};f.ClipperBase.IsHorizontal=function(b){return 0===b.Delta.Y};f.ClipperBase.prototype.PointIsVertex=function(b,c){var k=c;do{if(f.IntPoint.op_Equality(k.Pt,b))return!0;k=k.Next}while(k!=c);return!1};f.ClipperBase.prototype.PointOnLineSegment=function(b,c,k,f){return f?b.X==
+c.X&&b.Y==c.Y||b.X==k.X&&b.Y==k.Y||b.X>c.X==b.X<k.X&&b.Y>c.Y==b.Y<k.Y&&d.op_Equality(d.Int128Mul(b.X-c.X,k.Y-c.Y),d.Int128Mul(k.X-c.X,b.Y-c.Y)):b.X==c.X&&b.Y==c.Y||b.X==k.X&&b.Y==k.Y||b.X>c.X==b.X<k.X&&b.Y>c.Y==b.Y<k.Y&&(b.X-c.X)*(k.Y-c.Y)==(k.X-c.X)*(b.Y-c.Y)};f.ClipperBase.prototype.PointOnPolygon=function(b,c,k){for(var f=c;;){if(this.PointOnLineSegment(b,f.Pt,f.Next.Pt,k))return!0;f=f.Next;if(f==c)break}return!1};f.ClipperBase.prototype.SlopesEqual=f.ClipperBase.SlopesEqual=function(){var b=arguments,
+c=b.length,k,U;if(3==c)return c=b[0],k=b[1],b[2]?d.op_Equality(d.Int128Mul(c.Delta.Y,k.Delta.X),d.Int128Mul(c.Delta.X,k.Delta.Y)):f.Cast_Int64(c.Delta.Y*k.Delta.X)==f.Cast_Int64(c.Delta.X*k.Delta.Y);if(4==c)return c=b[0],k=b[1],U=b[2],b[3]?d.op_Equality(d.Int128Mul(c.Y-k.Y,k.X-U.X),d.Int128Mul(c.X-k.X,k.Y-U.Y)):0===f.Cast_Int64((c.Y-k.Y)*(k.X-U.X))-f.Cast_Int64((c.X-k.X)*(k.Y-U.Y));c=b[0];k=b[1];U=b[2];var h=b[3];return b[4]?d.op_Equality(d.Int128Mul(c.Y-k.Y,U.X-h.X),d.Int128Mul(c.X-k.X,U.Y-h.Y)):
+0===f.Cast_Int64((c.Y-k.Y)*(U.X-h.X))-f.Cast_Int64((c.X-k.X)*(U.Y-h.Y))};f.ClipperBase.SlopesEqual3=function(b,c,k){return k?d.op_Equality(d.Int128Mul(b.Delta.Y,c.Delta.X),d.Int128Mul(b.Delta.X,c.Delta.Y)):f.Cast_Int64(b.Delta.Y*c.Delta.X)==f.Cast_Int64(b.Delta.X*c.Delta.Y)};f.ClipperBase.SlopesEqual4=function(b,c,k,U){return U?d.op_Equality(d.Int128Mul(b.Y-c.Y,c.X-k.X),d.Int128Mul(b.X-c.X,c.Y-k.Y)):0===f.Cast_Int64((b.Y-c.Y)*(c.X-k.X))-f.Cast_Int64((b.X-c.X)*(c.Y-k.Y))};f.ClipperBase.SlopesEqual5=
+function(b,c,k,U,h){return h?d.op_Equality(d.Int128Mul(b.Y-c.Y,k.X-U.X),d.Int128Mul(b.X-c.X,k.Y-U.Y)):0===f.Cast_Int64((b.Y-c.Y)*(k.X-U.X))-f.Cast_Int64((b.X-c.X)*(k.Y-U.Y))};f.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var b=0,c=this.m_edges.length;b<c;++b){for(var k=0,d=this.m_edges[b].length;k<d;++k)this.m_edges[b][k]=null;f.Clear(this.m_edges[b])}f.Clear(this.m_edges);this.m_HasOpenPaths=this.m_UseFullRange=!1};f.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;null!==
+this.m_MinimaList;){var b=this.m_MinimaList.Next;this.m_MinimaList=null;this.m_MinimaList=b}this.m_CurrentLM=null};f.ClipperBase.prototype.RangeTest=function(b,c){if(c.Value)(b.X>f.ClipperBase.hiRange||b.Y>f.ClipperBase.hiRange||-b.X>f.ClipperBase.hiRange||-b.Y>f.ClipperBase.hiRange)&&f.Error("Coordinate outside allowed range in RangeTest().");else if(b.X>f.ClipperBase.loRange||b.Y>f.ClipperBase.loRange||-b.X>f.ClipperBase.loRange||-b.Y>f.ClipperBase.loRange)c.Value=!0,this.RangeTest(b,c)};f.ClipperBase.prototype.InitEdge=
+function(b,c,k,d){b.Next=c;b.Prev=k;b.Curr.X=d.X;b.Curr.Y=d.Y;f.use_xyz&&(b.Curr.Z=d.Z);b.OutIdx=-1};f.ClipperBase.prototype.InitEdge2=function(b,c){b.Curr.Y>=b.Next.Curr.Y?(b.Bot.X=b.Curr.X,b.Bot.Y=b.Curr.Y,f.use_xyz&&(b.Bot.Z=b.Curr.Z),b.Top.X=b.Next.Curr.X,b.Top.Y=b.Next.Curr.Y,f.use_xyz&&(b.Top.Z=b.Next.Curr.Z)):(b.Top.X=b.Curr.X,b.Top.Y=b.Curr.Y,f.use_xyz&&(b.Top.Z=b.Curr.Z),b.Bot.X=b.Next.Curr.X,b.Bot.Y=b.Next.Curr.Y,f.use_xyz&&(b.Bot.Z=b.Next.Curr.Z));this.SetDx(b);b.PolyTyp=c};f.ClipperBase.prototype.FindNextLocMin=
+function(b){for(var c;;){for(;f.IntPoint.op_Inequality(b.Bot,b.Prev.Bot)||f.IntPoint.op_Equality(b.Curr,b.Top);)b=b.Next;if(b.Dx!=f.ClipperBase.horizontal&&b.Prev.Dx!=f.ClipperBase.horizontal)break;for(;b.Prev.Dx==f.ClipperBase.horizontal;)b=b.Prev;for(c=b;b.Dx==f.ClipperBase.horizontal;)b=b.Next;if(b.Top.Y!=b.Prev.Bot.Y){c.Prev.Bot.X<b.Bot.X&&(b=c);break}}return b};f.ClipperBase.prototype.ProcessBound=function(b,c){var k,d=b,h;if(d.OutIdx==f.ClipperBase.Skip){b=d;if(c){for(;b.Top.Y==b.Next.Bot.Y;)b=
+b.Next;for(;b!=d&&b.Dx==f.ClipperBase.horizontal;)b=b.Prev}else{for(;b.Top.Y==b.Prev.Bot.Y;)b=b.Prev;for(;b!=d&&b.Dx==f.ClipperBase.horizontal;)b=b.Next}b==d?d=c?b.Next:b.Prev:(b=c?d.Next:d.Prev,k=new f.LocalMinima,k.Next=null,k.Y=b.Bot.Y,k.LeftBound=null,k.RightBound=b,b.WindDelta=0,d=this.ProcessBound(b,c),this.InsertLocalMinima(k));return d}b.Dx==f.ClipperBase.horizontal&&(k=c?b.Prev:b.Next,k.OutIdx!=f.ClipperBase.Skip&&(k.Dx==f.ClipperBase.horizontal?k.Bot.X!=b.Bot.X&&k.Top.X!=b.Bot.X&&this.ReverseHorizontal(b):
+k.Bot.X!=b.Bot.X&&this.ReverseHorizontal(b)));k=b;if(c){for(;d.Top.Y==d.Next.Bot.Y&&d.Next.OutIdx!=f.ClipperBase.Skip;)d=d.Next;if(d.Dx==f.ClipperBase.horizontal&&d.Next.OutIdx!=f.ClipperBase.Skip){for(h=d;h.Prev.Dx==f.ClipperBase.horizontal;)h=h.Prev;h.Prev.Top.X==d.Next.Top.X?c||(d=h.Prev):h.Prev.Top.X>d.Next.Top.X&&(d=h.Prev)}for(;b!=d;)b.NextInLML=b.Next,b.Dx==f.ClipperBase.horizontal&&b!=k&&b.Bot.X!=b.Prev.Top.X&&this.ReverseHorizontal(b),b=b.Next;b.Dx==f.ClipperBase.horizontal&&b!=k&&b.Bot.X!=
+b.Prev.Top.X&&this.ReverseHorizontal(b);d=d.Next}else{for(;d.Top.Y==d.Prev.Bot.Y&&d.Prev.OutIdx!=f.ClipperBase.Skip;)d=d.Prev;if(d.Dx==f.ClipperBase.horizontal&&d.Prev.OutIdx!=f.ClipperBase.Skip){for(h=d;h.Next.Dx==f.ClipperBase.horizontal;)h=h.Next;h.Next.Top.X==d.Prev.Top.X?c||(d=h.Next):h.Next.Top.X>d.Prev.Top.X&&(d=h.Next)}for(;b!=d;)b.NextInLML=b.Prev,b.Dx==f.ClipperBase.horizontal&&b!=k&&b.Bot.X!=b.Next.Top.X&&this.ReverseHorizontal(b),b=b.Prev;b.Dx==f.ClipperBase.horizontal&&b!=k&&b.Bot.X!=
+b.Next.Top.X&&this.ReverseHorizontal(b);d=d.Prev}return d};f.ClipperBase.prototype.AddPath=function(b,c,k){f.use_lines?k||c!=f.PolyType.ptClip||f.Error("AddPath: Open paths must be subject."):k||f.Error("AddPath: Open paths have been disabled.");var d=b.length-1;if(k)for(;0<d&&f.IntPoint.op_Equality(b[d],b[0]);)--d;for(;0<d&&f.IntPoint.op_Equality(b[d],b[d-1]);)--d;if(k&&2>d||!k&&1>d)return!1;for(var h=[],n=0;n<=d;n++)h.push(new f.TEdge);var J=!0;h[1].Curr.X=b[1].X;h[1].Curr.Y=b[1].Y;f.use_xyz&&(h[1].Curr.Z=
+b[1].Z);var p={Value:this.m_UseFullRange};this.RangeTest(b[0],p);this.m_UseFullRange=p.Value;p.Value=this.m_UseFullRange;this.RangeTest(b[d],p);this.m_UseFullRange=p.Value;this.InitEdge(h[0],h[1],h[d],b[0]);this.InitEdge(h[d],h[0],h[d-1],b[d]);for(n=d-1;1<=n;--n)p.Value=this.m_UseFullRange,this.RangeTest(b[n],p),this.m_UseFullRange=p.Value,this.InitEdge(h[n],h[n+1],h[n-1],b[n]);for(n=b=d=h[0];;)if(b.Curr!=b.Next.Curr||!k&&b.Next==d){if(b.Prev==b.Next)break;else if(k&&f.ClipperBase.SlopesEqual(b.Prev.Curr,
+b.Curr,b.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(b.Prev.Curr,b.Curr,b.Next.Curr))){b==d&&(d=b.Next);b=this.RemoveEdge(b);n=b=b.Prev;continue}b=b.Next;if(b==n||!k&&b.Next==d)break}else{if(b==b.Next)break;b==d&&(d=b.Next);n=b=this.RemoveEdge(b)}if(!k&&b==b.Next||k&&b.Prev==b.Next)return!1;k||(this.m_HasOpenPaths=!0,d.Prev.OutIdx=f.ClipperBase.Skip);b=d;do this.InitEdge2(b,c),b=b.Next,J&&b.Curr.Y!=d.Curr.Y&&(J=!1);while(b!=d);if(J){if(k)return!1;b.Prev.OutIdx=
+f.ClipperBase.Skip;b.Prev.Bot.X<b.Prev.Top.X&&this.ReverseHorizontal(b.Prev);c=new f.LocalMinima;c.Next=null;c.Y=b.Bot.Y;c.LeftBound=null;c.RightBound=b;c.RightBound.Side=f.EdgeSide.esRight;for(c.RightBound.WindDelta=0;b.Next.OutIdx!=f.ClipperBase.Skip;)b.NextInLML=b.Next,b.Bot.X!=b.Prev.Top.X&&this.ReverseHorizontal(b),b=b.Next;this.InsertLocalMinima(c);this.m_edges.push(h);return!0}this.m_edges.push(h);J=null;for(f.IntPoint.op_Equality(b.Prev.Bot,b.Prev.Top)&&(b=b.Next);;){b=this.FindNextLocMin(b);
+if(b==J)break;else null==J&&(J=b);c=new f.LocalMinima;c.Next=null;c.Y=b.Bot.Y;b.Dx<b.Prev.Dx?(c.LeftBound=b.Prev,c.RightBound=b,h=!1):(c.LeftBound=b,c.RightBound=b.Prev,h=!0);c.LeftBound.Side=f.EdgeSide.esLeft;c.RightBound.Side=f.EdgeSide.esRight;c.LeftBound.WindDelta=k?c.LeftBound.Next==c.RightBound?-1:1:0;c.RightBound.WindDelta=-c.LeftBound.WindDelta;b=this.ProcessBound(c.LeftBound,h);b.OutIdx==f.ClipperBase.Skip&&(b=this.ProcessBound(b,h));d=this.ProcessBound(c.RightBound,!h);d.OutIdx==f.ClipperBase.Skip&&
+(d=this.ProcessBound(d,!h));c.LeftBound.OutIdx==f.ClipperBase.Skip?c.LeftBound=null:c.RightBound.OutIdx==f.ClipperBase.Skip&&(c.RightBound=null);this.InsertLocalMinima(c);h||(b=d)}return!0};f.ClipperBase.prototype.AddPaths=function(b,c,k){for(var f=!1,d=0,h=b.length;d<h;++d)this.AddPath(b[d],c,k)&&(f=!0);return f};f.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(b,c,k){return f.IntPoint.op_Equality(b,k)||f.IntPoint.op_Equality(b,c)||f.IntPoint.op_Equality(k,c)?!1:b.X!=k.X?c.X>b.X==c.X<k.X:c.Y>
+b.Y==c.Y<k.Y};f.ClipperBase.prototype.RemoveEdge=function(b){b.Prev.Next=b.Next;b.Next.Prev=b.Prev;var c=b.Next;b.Prev=null;return c};f.ClipperBase.prototype.SetDx=function(b){b.Delta.X=b.Top.X-b.Bot.X;b.Delta.Y=b.Top.Y-b.Bot.Y;b.Dx=0===b.Delta.Y?f.ClipperBase.horizontal:b.Delta.X/b.Delta.Y};f.ClipperBase.prototype.InsertLocalMinima=function(b){if(null===this.m_MinimaList)this.m_MinimaList=b;else if(b.Y>=this.m_MinimaList.Y)b.Next=this.m_MinimaList,this.m_MinimaList=b;else{for(var c=this.m_MinimaList;null!==
+c.Next&&b.Y<c.Next.Y;)c=c.Next;b.Next=c.Next;c.Next=b}};f.ClipperBase.prototype.PopLocalMinima=function(){null!==this.m_CurrentLM&&(this.m_CurrentLM=this.m_CurrentLM.Next)};f.ClipperBase.prototype.ReverseHorizontal=function(b){var c=b.Top.X;b.Top.X=b.Bot.X;b.Bot.X=c;f.use_xyz&&(c=b.Top.Z,b.Top.Z=b.Bot.Z,b.Bot.Z=c)};f.ClipperBase.prototype.Reset=function(){this.m_CurrentLM=this.m_MinimaList;if(null!=this.m_CurrentLM)for(var b=this.m_MinimaList;null!=b;){var c=b.LeftBound;null!=c&&(c.Curr.X=c.Bot.X,
+c.Curr.Y=c.Bot.Y,f.use_xyz&&(c.Curr.Z=c.Bot.Z),c.Side=f.EdgeSide.esLeft,c.OutIdx=f.ClipperBase.Unassigned);c=b.RightBound;null!=c&&(c.Curr.X=c.Bot.X,c.Curr.Y=c.Bot.Y,f.use_xyz&&(c.Curr.Z=c.Bot.Z),c.Side=f.EdgeSide.esRight,c.OutIdx=f.ClipperBase.Unassigned);b=b.Next}};f.Clipper=function(b){"undefined"==typeof b&&(b=0);this.m_PolyOuts=null;this.m_ClipType=f.ClipType.ctIntersection;this.m_IntersectNodeComparer=this.m_IntersectList=this.m_SortedEdges=this.m_ActiveEdges=this.m_Scanbeam=null;this.m_ExecuteLocked=
+!1;this.m_SubjFillType=this.m_ClipFillType=f.PolyFillType.pftEvenOdd;this.m_GhostJoins=this.m_Joins=null;this.StrictlySimple=this.ReverseSolution=this.m_UsingPolyTree=!1;f.ClipperBase.call(this);this.m_SortedEdges=this.m_ActiveEdges=this.m_Scanbeam=null;this.m_IntersectList=[];this.m_IntersectNodeComparer=f.MyIntersectNodeSort.Compare;this.m_UsingPolyTree=this.m_ExecuteLocked=!1;this.m_PolyOuts=[];this.m_Joins=[];this.m_GhostJoins=[];this.ReverseSolution=0!==(1&b);this.StrictlySimple=0!==(2&b);this.PreserveCollinear=
+0!==(4&b);f.use_xyz&&(this.ZFillFunction=null)};f.Clipper.ioReverseSolution=1;f.Clipper.ioStrictlySimple=2;f.Clipper.ioPreserveCollinear=4;f.Clipper.prototype.Clear=function(){0!==this.m_edges.length&&(this.DisposeAllPolyPts(),f.ClipperBase.prototype.Clear.call(this))};f.Clipper.prototype.DisposeScanbeamList=function(){for(;null!==this.m_Scanbeam;){var b=this.m_Scanbeam.Next;this.m_Scanbeam=null;this.m_Scanbeam=b}};f.Clipper.prototype.Reset=function(){f.ClipperBase.prototype.Reset.call(this);this.m_SortedEdges=
+this.m_ActiveEdges=this.m_Scanbeam=null;for(var b=this.m_MinimaList;null!==b;)this.InsertScanbeam(b.Y),b=b.Next};f.Clipper.prototype.InsertScanbeam=function(b){if(null===this.m_Scanbeam)this.m_Scanbeam=new f.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=b;else if(b>this.m_Scanbeam.Y){var c=new f.Scanbeam;c.Y=b;c.Next=this.m_Scanbeam;this.m_Scanbeam=c}else{for(var k=this.m_Scanbeam;null!==k.Next&&b<=k.Next.Y;)k=k.Next;b!=k.Y&&(c=new f.Scanbeam,c.Y=b,c.Next=k.Next,k.Next=c)}};f.Clipper.prototype.Execute=
+function(){var b=arguments,c=b.length,k=b[1]instanceof f.PolyTree;if(4!=c||k){if(4==c&&k){c=b[0];var d=b[1];k=b[2];b=b[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0;this.m_SubjFillType=k;this.m_ClipFillType=b;this.m_ClipType=c;this.m_UsingPolyTree=!0;try{(h=this.ExecuteInternal())&&this.BuildResult2(d)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return h}if(2==c&&!k||2==c&&k)return c=b[0],d=b[1],this.Execute(c,d,f.PolyFillType.pftEvenOdd,f.PolyFillType.pftEvenOdd)}else{c=
+b[0];d=b[1];k=b[2];b=b[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&f.Error("Error: PolyTree struct is need for open path clipping.");this.m_ExecuteLocked=!0;f.Clear(d);this.m_SubjFillType=k;this.m_ClipFillType=b;this.m_ClipType=c;this.m_UsingPolyTree=!1;try{var h=this.ExecuteInternal();h&&this.BuildResult(d)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return h}};f.Clipper.prototype.FixHoleLinkage=function(b){if(null!==b.FirstLeft&&(b.IsHole==b.FirstLeft.IsHole||null===b.FirstLeft.Pts)){for(var c=
+b.FirstLeft;null!==c&&(c.IsHole==b.IsHole||null===c.Pts);)c=c.FirstLeft;b.FirstLeft=c}};f.Clipper.prototype.ExecuteInternal=function(){try{this.Reset();if(null===this.m_CurrentLM)return!1;var b=this.PopScanbeam();do{this.InsertLocalMinimaIntoAEL(b);f.Clear(this.m_GhostJoins);this.ProcessHorizontals(!1);if(null===this.m_Scanbeam)break;var c=this.PopScanbeam();if(!this.ProcessIntersections(c))return!1;this.ProcessEdgesAtTopOfScanbeam(c);b=c}while(null!==this.m_Scanbeam||null!==this.m_CurrentLM);b=0;
+for(var k=this.m_PolyOuts.length;b<k;b++){var d=this.m_PolyOuts[b];null===d.Pts||d.IsOpen||(d.IsHole^this.ReverseSolution)==0<this.Area(d)&&this.ReversePolyPtLinks(d.Pts)}this.JoinCommonEdges();b=0;for(k=this.m_PolyOuts.length;b<k;b++)d=this.m_PolyOuts[b],null===d.Pts||d.IsOpen||this.FixupOutPolygon(d);this.StrictlySimple&&this.DoSimplePolygons();return!0}finally{f.Clear(this.m_Joins),f.Clear(this.m_GhostJoins)}};f.Clipper.prototype.PopScanbeam=function(){var b=this.m_Scanbeam.Y;this.m_Scanbeam=this.m_Scanbeam.Next;
+return b};f.Clipper.prototype.DisposeAllPolyPts=function(){for(var b=0,c=this.m_PolyOuts.length;b<c;++b)this.DisposeOutRec(b);f.Clear(this.m_PolyOuts)};f.Clipper.prototype.DisposeOutRec=function(b){this.m_PolyOuts[b].Pts=null;this.m_PolyOuts[b]=null};f.Clipper.prototype.AddJoin=function(b,c,k){var d=new f.Join;d.OutPt1=b;d.OutPt2=c;d.OffPt.X=k.X;d.OffPt.Y=k.Y;f.use_xyz&&(d.OffPt.Z=k.Z);this.m_Joins.push(d)};f.Clipper.prototype.AddGhostJoin=function(b,c){var k=new f.Join;k.OutPt1=b;k.OffPt.X=c.X;k.OffPt.Y=
+c.Y;f.use_xyz&&(k.OffPt.Z=c.Z);this.m_GhostJoins.push(k)};f.Clipper.prototype.SetZ=function(b,c,k){null!==this.ZFillFunction&&0==b.Z&&null!==this.ZFillFunction&&(f.IntPoint.op_Equality(b,c.Bot)?b.Z=c.Bot.Z:f.IntPoint.op_Equality(b,c.Top)?b.Z=c.Top.Z:f.IntPoint.op_Equality(b,k.Bot)?b.Z=k.Bot.Z:f.IntPoint.op_Equality(b,k.Top)?b.Z=k.Top.Z:this.ZFillFunction(c.Bot,c.Top,k.Bot,k.Top,b))};f.Clipper.prototype.InsertLocalMinimaIntoAEL=function(b){for(;null!==this.m_CurrentLM&&this.m_CurrentLM.Y==b;){var c=
+this.m_CurrentLM.LeftBound,k=this.m_CurrentLM.RightBound;this.PopLocalMinima();var d=null;null===c?(this.InsertEdgeIntoAEL(k,null),this.SetWindingCount(k),this.IsContributing(k)&&(d=this.AddOutPt(k,k.Bot))):(null==k?(this.InsertEdgeIntoAEL(c,null),this.SetWindingCount(c),this.IsContributing(c)&&(d=this.AddOutPt(c,c.Bot))):(this.InsertEdgeIntoAEL(c,null),this.InsertEdgeIntoAEL(k,c),this.SetWindingCount(c),k.WindCnt=c.WindCnt,k.WindCnt2=c.WindCnt2,this.IsContributing(c)&&(d=this.AddLocalMinPoly(c,k,
+c.Bot))),this.InsertScanbeam(c.Top.Y));null!=k&&(f.ClipperBase.IsHorizontal(k)?this.AddEdgeToSEL(k):this.InsertScanbeam(k.Top.Y));if(null!=c&&null!=k){if(null!==d&&f.ClipperBase.IsHorizontal(k)&&0<this.m_GhostJoins.length&&0!==k.WindDelta)for(var h=0,n=this.m_GhostJoins.length;h<n;h++){var J=this.m_GhostJoins[h];this.HorzSegmentsOverlap(J.OutPt1.Pt.X,J.OffPt.X,k.Bot.X,k.Top.X)&&this.AddJoin(J.OutPt1,d,J.OffPt)}0<=c.OutIdx&&null!==c.PrevInAEL&&c.PrevInAEL.Curr.X==c.Bot.X&&0<=c.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(c.PrevInAEL,
+c,this.m_UseFullRange)&&0!==c.WindDelta&&0!==c.PrevInAEL.WindDelta&&(h=this.AddOutPt(c.PrevInAEL,c.Bot),this.AddJoin(d,h,c.Top));if(c.NextInAEL!=k&&(0<=k.OutIdx&&0<=k.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(k.PrevInAEL,k,this.m_UseFullRange)&&0!==k.WindDelta&&0!==k.PrevInAEL.WindDelta&&(h=this.AddOutPt(k.PrevInAEL,k.Bot),this.AddJoin(d,h,k.Top)),d=c.NextInAEL,null!==d))for(;d!=k;)this.IntersectEdges(k,d,c.Curr,!1),d=d.NextInAEL}}};f.Clipper.prototype.InsertEdgeIntoAEL=function(b,c){if(null===
+this.m_ActiveEdges)b.PrevInAEL=null,b.NextInAEL=null,this.m_ActiveEdges=b;else if(null===c&&this.E2InsertsBeforeE1(this.m_ActiveEdges,b))b.PrevInAEL=null,b.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges=this.m_ActiveEdges.PrevInAEL=b;else{for(null===c&&(c=this.m_ActiveEdges);null!==c.NextInAEL&&!this.E2InsertsBeforeE1(c.NextInAEL,b);)c=c.NextInAEL;b.NextInAEL=c.NextInAEL;null!==c.NextInAEL&&(c.NextInAEL.PrevInAEL=b);b.PrevInAEL=c;c.NextInAEL=b}};f.Clipper.prototype.E2InsertsBeforeE1=function(b,c){return c.Curr.X==
+b.Curr.X?c.Top.Y>b.Top.Y?c.Top.X<f.Clipper.TopX(b,c.Top.Y):b.Top.X>f.Clipper.TopX(c,b.Top.Y):c.Curr.X<b.Curr.X};f.Clipper.prototype.IsEvenOddFillType=function(b){return b.PolyTyp==f.PolyType.ptSubject?this.m_SubjFillType==f.PolyFillType.pftEvenOdd:this.m_ClipFillType==f.PolyFillType.pftEvenOdd};f.Clipper.prototype.IsEvenOddAltFillType=function(b){return b.PolyTyp==f.PolyType.ptSubject?this.m_ClipFillType==f.PolyFillType.pftEvenOdd:this.m_SubjFillType==f.PolyFillType.pftEvenOdd};f.Clipper.prototype.IsContributing=
+function(b){var c,k;b.PolyTyp==f.PolyType.ptSubject?(c=this.m_SubjFillType,k=this.m_ClipFillType):(c=this.m_ClipFillType,k=this.m_SubjFillType);switch(c){case f.PolyFillType.pftEvenOdd:if(0===b.WindDelta&&1!=b.WindCnt)return!1;break;case f.PolyFillType.pftNonZero:if(1!=Math.abs(b.WindCnt))return!1;break;case f.PolyFillType.pftPositive:if(1!=b.WindCnt)return!1;break;default:if(-1!=b.WindCnt)return!1}switch(this.m_ClipType){case f.ClipType.ctIntersection:switch(k){case f.PolyFillType.pftEvenOdd:case f.PolyFillType.pftNonZero:return 0!==
+b.WindCnt2;case f.PolyFillType.pftPositive:return 0<b.WindCnt2;default:return 0>b.WindCnt2}case f.ClipType.ctUnion:switch(k){case f.PolyFillType.pftEvenOdd:case f.PolyFillType.pftNonZero:return 0===b.WindCnt2;case f.PolyFillType.pftPositive:return 0>=b.WindCnt2;default:return 0<=b.WindCnt2}case f.ClipType.ctDifference:if(b.PolyTyp==f.PolyType.ptSubject)switch(k){case f.PolyFillType.pftEvenOdd:case f.PolyFillType.pftNonZero:return 0===b.WindCnt2;case f.PolyFillType.pftPositive:return 0>=b.WindCnt2;
+default:return 0<=b.WindCnt2}else switch(k){case f.PolyFillType.pftEvenOdd:case f.PolyFillType.pftNonZero:return 0!==b.WindCnt2;case f.PolyFillType.pftPositive:return 0<b.WindCnt2;default:return 0>b.WindCnt2}case f.ClipType.ctXor:if(0===b.WindDelta)switch(k){case f.PolyFillType.pftEvenOdd:case f.PolyFillType.pftNonZero:return 0===b.WindCnt2;case f.PolyFillType.pftPositive:return 0>=b.WindCnt2;default:return 0<=b.WindCnt2}}return!0};f.Clipper.prototype.SetWindingCount=function(b){for(var c=b.PrevInAEL;null!==
+c&&(c.PolyTyp!=b.PolyTyp||0===c.WindDelta);)c=c.PrevInAEL;if(null===c)b.WindCnt=0===b.WindDelta?1:b.WindDelta,b.WindCnt2=0,c=this.m_ActiveEdges;else{if(0===b.WindDelta&&this.m_ClipType!=f.ClipType.ctUnion)b.WindCnt=1;else if(this.IsEvenOddFillType(b))if(0===b.WindDelta){for(var k=!0,d=c.PrevInAEL;null!==d;)d.PolyTyp==c.PolyTyp&&0!==d.WindDelta&&(k=!k),d=d.PrevInAEL;b.WindCnt=k?0:1}else b.WindCnt=b.WindDelta;else b.WindCnt=0>c.WindCnt*c.WindDelta?1<Math.abs(c.WindCnt)?0>c.WindDelta*b.WindDelta?c.WindCnt:
+c.WindCnt+b.WindDelta:0===b.WindDelta?1:b.WindDelta:0===b.WindDelta?0>c.WindCnt?c.WindCnt-1:c.WindCnt+1:0>c.WindDelta*b.WindDelta?c.WindCnt:c.WindCnt+b.WindDelta;b.WindCnt2=c.WindCnt2;c=c.NextInAEL}if(this.IsEvenOddAltFillType(b))for(;c!=b;)0!==c.WindDelta&&(b.WindCnt2=0===b.WindCnt2?1:0),c=c.NextInAEL;else for(;c!=b;)b.WindCnt2+=c.WindDelta,c=c.NextInAEL};f.Clipper.prototype.AddEdgeToSEL=function(b){null===this.m_SortedEdges?(this.m_SortedEdges=b,b.PrevInSEL=null,b.NextInSEL=null):(b.NextInSEL=this.m_SortedEdges,
+b.PrevInSEL=null,this.m_SortedEdges=this.m_SortedEdges.PrevInSEL=b)};f.Clipper.prototype.CopyAELToSEL=function(){var b=this.m_ActiveEdges;for(this.m_SortedEdges=b;null!==b;)b.PrevInSEL=b.PrevInAEL,b=b.NextInSEL=b.NextInAEL};f.Clipper.prototype.SwapPositionsInAEL=function(b,c){if(b.NextInAEL!=b.PrevInAEL&&c.NextInAEL!=c.PrevInAEL){if(b.NextInAEL==c){var k=c.NextInAEL;null!==k&&(k.PrevInAEL=b);var f=b.PrevInAEL;null!==f&&(f.NextInAEL=c);c.PrevInAEL=f;c.NextInAEL=b;b.PrevInAEL=c;b.NextInAEL=k}else c.NextInAEL==
+b?(k=b.NextInAEL,null!==k&&(k.PrevInAEL=c),f=c.PrevInAEL,null!==f&&(f.NextInAEL=b),b.PrevInAEL=f,b.NextInAEL=c,c.PrevInAEL=b,c.NextInAEL=k):(k=b.NextInAEL,f=b.PrevInAEL,b.NextInAEL=c.NextInAEL,null!==b.NextInAEL&&(b.NextInAEL.PrevInAEL=b),b.PrevInAEL=c.PrevInAEL,null!==b.PrevInAEL&&(b.PrevInAEL.NextInAEL=b),c.NextInAEL=k,null!==c.NextInAEL&&(c.NextInAEL.PrevInAEL=c),c.PrevInAEL=f,null!==c.PrevInAEL&&(c.PrevInAEL.NextInAEL=c));null===b.PrevInAEL?this.m_ActiveEdges=b:null===c.PrevInAEL&&(this.m_ActiveEdges=
+c)}};f.Clipper.prototype.SwapPositionsInSEL=function(b,c){if(null!==b.NextInSEL||null!==b.PrevInSEL)if(null!==c.NextInSEL||null!==c.PrevInSEL){if(b.NextInSEL==c){var k=c.NextInSEL;null!==k&&(k.PrevInSEL=b);var f=b.PrevInSEL;null!==f&&(f.NextInSEL=c);c.PrevInSEL=f;c.NextInSEL=b;b.PrevInSEL=c;b.NextInSEL=k}else c.NextInSEL==b?(k=b.NextInSEL,null!==k&&(k.PrevInSEL=c),f=c.PrevInSEL,null!==f&&(f.NextInSEL=b),b.PrevInSEL=f,b.NextInSEL=c,c.PrevInSEL=b,c.NextInSEL=k):(k=b.NextInSEL,f=b.PrevInSEL,b.NextInSEL=
+c.NextInSEL,null!==b.NextInSEL&&(b.NextInSEL.PrevInSEL=b),b.PrevInSEL=c.PrevInSEL,null!==b.PrevInSEL&&(b.PrevInSEL.NextInSEL=b),c.NextInSEL=k,null!==c.NextInSEL&&(c.NextInSEL.PrevInSEL=c),c.PrevInSEL=f,null!==c.PrevInSEL&&(c.PrevInSEL.NextInSEL=c));null===b.PrevInSEL?this.m_SortedEdges=b:null===c.PrevInSEL&&(this.m_SortedEdges=c)}};f.Clipper.prototype.AddLocalMaxPoly=function(b,c,k){this.AddOutPt(b,k);0==c.WindDelta&&this.AddOutPt(c,k);b.OutIdx==c.OutIdx?(b.OutIdx=-1,c.OutIdx=-1):b.OutIdx<c.OutIdx?
+this.AppendPolygon(b,c):this.AppendPolygon(c,b)};f.Clipper.prototype.AddLocalMinPoly=function(b,c,k){var d,h;f.ClipperBase.IsHorizontal(c)||b.Dx>c.Dx?(d=this.AddOutPt(b,k),c.OutIdx=b.OutIdx,b.Side=f.EdgeSide.esLeft,c.Side=f.EdgeSide.esRight,h=b,b=h.PrevInAEL==c?c.PrevInAEL:h.PrevInAEL):(d=this.AddOutPt(c,k),b.OutIdx=c.OutIdx,b.Side=f.EdgeSide.esRight,c.Side=f.EdgeSide.esLeft,h=c,b=h.PrevInAEL==b?b.PrevInAEL:h.PrevInAEL);null!==b&&0<=b.OutIdx&&f.Clipper.TopX(b,k.Y)==f.Clipper.TopX(h,k.Y)&&f.ClipperBase.SlopesEqual(h,
+b,this.m_UseFullRange)&&0!==h.WindDelta&&0!==b.WindDelta&&(k=this.AddOutPt(b,k),this.AddJoin(d,k,h.Top));return d};f.Clipper.prototype.CreateOutRec=function(){var b=new f.OutRec;b.Idx=-1;b.IsHole=!1;b.IsOpen=!1;b.FirstLeft=null;b.Pts=null;b.BottomPt=null;b.PolyNode=null;this.m_PolyOuts.push(b);b.Idx=this.m_PolyOuts.length-1;return b};f.Clipper.prototype.AddOutPt=function(b,c){var k=b.Side==f.EdgeSide.esLeft;if(0>b.OutIdx){var d=this.CreateOutRec();d.IsOpen=0===b.WindDelta;var h=new f.OutPt;d.Pts=
+h;h.Idx=d.Idx;h.Pt.X=c.X;h.Pt.Y=c.Y;f.use_xyz&&(h.Pt.Z=c.Z);h.Next=h;h.Prev=h;d.IsOpen||this.SetHoleState(b,d);b.OutIdx=d.Idx}else{d=this.m_PolyOuts[b.OutIdx];b=d.Pts;if(k&&f.IntPoint.op_Equality(c,b.Pt))return b;if(!k&&f.IntPoint.op_Equality(c,b.Prev.Pt))return b.Prev;h=new f.OutPt;h.Idx=d.Idx;h.Pt.X=c.X;h.Pt.Y=c.Y;f.use_xyz&&(h.Pt.Z=c.Z);h.Next=b;h.Prev=b.Prev;h.Prev.Next=h;b.Prev=h;k&&(d.Pts=h)}return h};f.Clipper.prototype.SwapPoints=function(b,c){var k=new f.IntPoint(b.Value);b.Value.X=c.Value.X;
+b.Value.Y=c.Value.Y;f.use_xyz&&(b.Value.Z=c.Value.Z);c.Value.X=k.X;c.Value.Y=k.Y;f.use_xyz&&(c.Value.Z=k.Z)};f.Clipper.prototype.HorzSegmentsOverlap=function(b,c,k,f){var d;b>c&&(d=b,b=c,c=d);k>f&&(d=k,k=f,f=d);return b<f&&k<c};f.Clipper.prototype.SetHoleState=function(b,c){var k=!1;for(b=b.PrevInAEL;null!==b;)0<=b.OutIdx&&0!=b.WindDelta&&(k=!k,null===c.FirstLeft&&(c.FirstLeft=this.m_PolyOuts[b.OutIdx])),b=b.PrevInAEL;k&&(c.IsHole=!0)};f.Clipper.prototype.GetDx=function(b,c){return b.Y==c.Y?f.ClipperBase.horizontal:
+(c.X-b.X)/(c.Y-b.Y)};f.Clipper.prototype.FirstIsBottomPt=function(b,c){for(var k=b.Prev;f.IntPoint.op_Equality(k.Pt,b.Pt)&&k!=b;)k=k.Prev;var d=Math.abs(this.GetDx(b.Pt,k.Pt));for(k=b.Next;f.IntPoint.op_Equality(k.Pt,b.Pt)&&k!=b;)k=k.Next;b=Math.abs(this.GetDx(b.Pt,k.Pt));for(k=c.Prev;f.IntPoint.op_Equality(k.Pt,c.Pt)&&k!=c;)k=k.Prev;var h=Math.abs(this.GetDx(c.Pt,k.Pt));for(k=c.Next;f.IntPoint.op_Equality(k.Pt,c.Pt)&&k!=c;)k=k.Next;k=Math.abs(this.GetDx(c.Pt,k.Pt));return d>=h&&d>=k||b>=h&&b>=k};
+f.Clipper.prototype.GetBottomPt=function(b){for(var c=null,k=b.Next;k!=b;)k.Pt.Y>b.Pt.Y?(b=k,c=null):k.Pt.Y==b.Pt.Y&&k.Pt.X<=b.Pt.X&&(k.Pt.X<b.Pt.X?(c=null,b=k):k.Next!=b&&k.Prev!=b&&(c=k)),k=k.Next;if(null!==c)for(;c!=k;)for(this.FirstIsBottomPt(k,c)||(b=c),c=c.Next;f.IntPoint.op_Inequality(c.Pt,b.Pt);)c=c.Next;return b};f.Clipper.prototype.GetLowermostRec=function(b,c){null===b.BottomPt&&(b.BottomPt=this.GetBottomPt(b.Pts));null===c.BottomPt&&(c.BottomPt=this.GetBottomPt(c.Pts));var k=b.BottomPt,
+f=c.BottomPt;return k.Pt.Y>f.Pt.Y?b:k.Pt.Y<f.Pt.Y?c:k.Pt.X<f.Pt.X?b:k.Pt.X>f.Pt.X?c:k.Next==k?c:f.Next==f?b:this.FirstIsBottomPt(k,f)?b:c};f.Clipper.prototype.Param1RightOfParam2=function(b,c){do if(b=b.FirstLeft,b==c)return!0;while(null!==b);return!1};f.Clipper.prototype.GetOutRec=function(b){for(b=this.m_PolyOuts[b];b!=this.m_PolyOuts[b.Idx];)b=this.m_PolyOuts[b.Idx];return b};f.Clipper.prototype.AppendPolygon=function(b,c){var k=this.m_PolyOuts[b.OutIdx],d=this.m_PolyOuts[c.OutIdx];var h=this.Param1RightOfParam2(k,
+d)?d:this.Param1RightOfParam2(d,k)?k:this.GetLowermostRec(k,d);var n=k.Pts,J=n.Prev,p=d.Pts,t=p.Prev;b.Side==f.EdgeSide.esLeft?(c.Side==f.EdgeSide.esLeft?(this.ReversePolyPtLinks(p),p.Next=n,n.Prev=p,J.Next=t,t.Prev=J,k.Pts=t):(t.Next=n,n.Prev=t,p.Prev=J,J.Next=p,k.Pts=p),n=f.EdgeSide.esLeft):(c.Side==f.EdgeSide.esRight?(this.ReversePolyPtLinks(p),J.Next=t,t.Prev=J,p.Next=n,n.Prev=p):(J.Next=p,p.Prev=J,n.Prev=t,t.Next=n),n=f.EdgeSide.esRight);k.BottomPt=null;h==d&&(d.FirstLeft!=k&&(k.FirstLeft=d.FirstLeft),
+k.IsHole=d.IsHole);d.Pts=null;d.BottomPt=null;d.FirstLeft=k;h=b.OutIdx;J=c.OutIdx;b.OutIdx=-1;c.OutIdx=-1;for(p=this.m_ActiveEdges;null!==p;){if(p.OutIdx==J){p.OutIdx=h;p.Side=n;break}p=p.NextInAEL}d.Idx=k.Idx};f.Clipper.prototype.ReversePolyPtLinks=function(b){if(null!==b){var c=b;do{var k=c.Next;c.Next=c.Prev;c=c.Prev=k}while(c!=b)}};f.Clipper.SwapSides=function(b,c){var k=b.Side;b.Side=c.Side;c.Side=k};f.Clipper.SwapPolyIndexes=function(b,c){var k=b.OutIdx;b.OutIdx=c.OutIdx;c.OutIdx=k};f.Clipper.prototype.IntersectEdges=
+function(b,c,k){var d=0<=b.OutIdx,h=0<=c.OutIdx;f.use_xyz&&this.SetZ(k,b,c);if(!f.use_lines||0!==b.WindDelta&&0!==c.WindDelta){if(b.PolyTyp==c.PolyTyp)if(this.IsEvenOddFillType(b)){var n=b.WindCnt;b.WindCnt=c.WindCnt;c.WindCnt=n}else b.WindCnt=0===b.WindCnt+c.WindDelta?-b.WindCnt:b.WindCnt+c.WindDelta,c.WindCnt=0===c.WindCnt-b.WindDelta?-c.WindCnt:c.WindCnt-b.WindDelta;else this.IsEvenOddFillType(c)?b.WindCnt2=0===b.WindCnt2?1:0:b.WindCnt2+=c.WindDelta,this.IsEvenOddFillType(b)?c.WindCnt2=0===c.WindCnt2?
+1:0:c.WindCnt2-=b.WindDelta;var J,p,t;b.PolyTyp==f.PolyType.ptSubject?(J=this.m_SubjFillType,t=this.m_ClipFillType):(J=this.m_ClipFillType,t=this.m_SubjFillType);c.PolyTyp==f.PolyType.ptSubject?(p=this.m_SubjFillType,n=this.m_ClipFillType):(p=this.m_ClipFillType,n=this.m_SubjFillType);switch(J){case f.PolyFillType.pftPositive:J=b.WindCnt;break;case f.PolyFillType.pftNegative:J=-b.WindCnt;break;default:J=Math.abs(b.WindCnt)}switch(p){case f.PolyFillType.pftPositive:p=c.WindCnt;break;case f.PolyFillType.pftNegative:p=
+-c.WindCnt;break;default:p=Math.abs(c.WindCnt)}if(d&&h)0!=J&&1!=J||0!=p&&1!=p||b.PolyTyp!=c.PolyTyp&&this.m_ClipType!=f.ClipType.ctXor?this.AddLocalMaxPoly(b,c,k):(this.AddOutPt(b,k),this.AddOutPt(c,k),f.Clipper.SwapSides(b,c),f.Clipper.SwapPolyIndexes(b,c));else if(d){if(0===p||1==p)this.AddOutPt(b,k),f.Clipper.SwapSides(b,c),f.Clipper.SwapPolyIndexes(b,c)}else if(h){if(0===J||1==J)this.AddOutPt(c,k),f.Clipper.SwapSides(b,c),f.Clipper.SwapPolyIndexes(b,c)}else if(!(0!=J&&1!=J||0!=p&&1!=p)){switch(t){case f.PolyFillType.pftPositive:d=
+b.WindCnt2;break;case f.PolyFillType.pftNegative:d=-b.WindCnt2;break;default:d=Math.abs(b.WindCnt2)}switch(n){case f.PolyFillType.pftPositive:h=c.WindCnt2;break;case f.PolyFillType.pftNegative:h=-c.WindCnt2;break;default:h=Math.abs(c.WindCnt2)}if(b.PolyTyp!=c.PolyTyp)this.AddLocalMinPoly(b,c,k);else if(1==J&&1==p)switch(this.m_ClipType){case f.ClipType.ctIntersection:0<d&&0<h&&this.AddLocalMinPoly(b,c,k);break;case f.ClipType.ctUnion:0>=d&&0>=h&&this.AddLocalMinPoly(b,c,k);break;case f.ClipType.ctDifference:(b.PolyTyp==
+f.PolyType.ptClip&&0<d&&0<h||b.PolyTyp==f.PolyType.ptSubject&&0>=d&&0>=h)&&this.AddLocalMinPoly(b,c,k);break;case f.ClipType.ctXor:this.AddLocalMinPoly(b,c,k)}else f.Clipper.SwapSides(b,c)}}else if(0!=b.WindDelta||0!=c.WindDelta)b.PolyTyp==c.PolyTyp&&b.WindDelta!=c.WindDelta&&this.m_ClipType==f.ClipType.ctUnion?0===b.WindDelta?h&&(this.AddOutPt(b,k),d&&(b.OutIdx=-1)):d&&(this.AddOutPt(c,k),h&&(c.OutIdx=-1)):b.PolyTyp!=c.PolyTyp&&(0!==b.WindDelta||1!=Math.abs(c.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&
+0!==c.WindCnt2?0!==c.WindDelta||1!=Math.abs(b.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&0!==b.WindCnt2||(this.AddOutPt(c,k),h&&(c.OutIdx=-1)):(this.AddOutPt(b,k),d&&(b.OutIdx=-1)))};f.Clipper.prototype.DeleteFromAEL=function(b){var c=b.PrevInAEL,k=b.NextInAEL;if(null!==c||null!==k||b==this.m_ActiveEdges)null!==c?c.NextInAEL=k:this.m_ActiveEdges=k,null!==k&&(k.PrevInAEL=c),b.NextInAEL=null,b.PrevInAEL=null};f.Clipper.prototype.DeleteFromSEL=function(b){var c=b.PrevInSEL,k=b.NextInSEL;if(null!==
+c||null!==k||b==this.m_SortedEdges)null!==c?c.NextInSEL=k:this.m_SortedEdges=k,null!==k&&(k.PrevInSEL=c),b.NextInSEL=null,b.PrevInSEL=null};f.Clipper.prototype.UpdateEdgeIntoAEL=function(b){null===b.NextInLML&&f.Error("UpdateEdgeIntoAEL: invalid call");var c=b.PrevInAEL,k=b.NextInAEL;b.NextInLML.OutIdx=b.OutIdx;null!==c?c.NextInAEL=b.NextInLML:this.m_ActiveEdges=b.NextInLML;null!==k&&(k.PrevInAEL=b.NextInLML);b.NextInLML.Side=b.Side;b.NextInLML.WindDelta=b.WindDelta;b.NextInLML.WindCnt=b.WindCnt;
+b.NextInLML.WindCnt2=b.WindCnt2;b=b.NextInLML;b.Curr.X=b.Bot.X;b.Curr.Y=b.Bot.Y;f.use_xyz&&(b.Curr.Z=b.Bot.Z);b.PrevInAEL=c;b.NextInAEL=k;f.ClipperBase.IsHorizontal(b)||this.InsertScanbeam(b.Top.Y);return b};f.Clipper.prototype.ProcessHorizontals=function(b){for(var c=this.m_SortedEdges;null!==c;)this.DeleteFromSEL(c),this.ProcessHorizontal(c,b),c=this.m_SortedEdges};f.Clipper.prototype.GetHorzDirection=function(b,c){b.Bot.X<b.Top.X?(c.Left=b.Bot.X,c.Right=b.Top.X,c.Dir=f.Direction.dLeftToRight):
+(c.Left=b.Top.X,c.Right=b.Bot.X,c.Dir=f.Direction.dRightToLeft)};f.Clipper.prototype.ProcessHorizontal=function(b,c){var k={Dir:null,Left:null,Right:null};this.GetHorzDirection(b,k);for(var d=k.Dir,h=k.Left,n=k.Right,J=b,p=null;null!==J.NextInLML&&f.ClipperBase.IsHorizontal(J.NextInLML);)J=J.NextInLML;for(null===J.NextInLML&&(p=this.GetMaximaPair(J));;){for(var t=b==J,B=this.GetNextInAEL(b,d);null!==B&&!(B.Curr.X==b.Top.X&&null!==b.NextInLML&&B.Dx<b.NextInLML.Dx);){k=this.GetNextInAEL(B,d);if(d==
+f.Direction.dLeftToRight&&B.Curr.X<=n||d==f.Direction.dRightToLeft&&B.Curr.X>=h){if(B==p&&t){if(0<=b.OutIdx){d=this.AddOutPt(b,b.Top);for(k=this.m_SortedEdges;null!==k;)0<=k.OutIdx&&this.HorzSegmentsOverlap(b.Bot.X,b.Top.X,k.Bot.X,k.Top.X)&&(h=this.AddOutPt(k,k.Bot),this.AddJoin(h,d,k.Top)),k=k.NextInSEL;this.AddGhostJoin(d,b.Bot);this.AddLocalMaxPoly(b,p,b.Top)}this.DeleteFromAEL(b);this.DeleteFromAEL(p);return}if(d==f.Direction.dLeftToRight){var F=new f.IntPoint(B.Curr.X,b.Curr.Y);this.IntersectEdges(b,
+B,F)}else F=new f.IntPoint(B.Curr.X,b.Curr.Y),this.IntersectEdges(B,b,F);this.SwapPositionsInAEL(b,B)}else if(d==f.Direction.dLeftToRight&&B.Curr.X>=n||d==f.Direction.dRightToLeft&&B.Curr.X<=h)break;B=k}if(null!==b.NextInLML&&f.ClipperBase.IsHorizontal(b.NextInLML))b=this.UpdateEdgeIntoAEL(b),0<=b.OutIdx&&this.AddOutPt(b,b.Bot),k={Dir:d,Left:h,Right:n},this.GetHorzDirection(b,k),d=k.Dir,h=k.Left,n=k.Right;else break}null!==b.NextInLML?0<=b.OutIdx?(d=this.AddOutPt(b,b.Top),c&&this.AddGhostJoin(d,b.Bot),
+b=this.UpdateEdgeIntoAEL(b),0!==b.WindDelta&&(p=b.PrevInAEL,k=b.NextInAEL,null!==p&&p.Curr.X==b.Bot.X&&p.Curr.Y==b.Bot.Y&&0!==p.WindDelta&&0<=p.OutIdx&&p.Curr.Y>p.Top.Y&&f.ClipperBase.SlopesEqual(b,p,this.m_UseFullRange)?(h=this.AddOutPt(p,b.Bot),this.AddJoin(d,h,b.Top)):null!==k&&k.Curr.X==b.Bot.X&&k.Curr.Y==b.Bot.Y&&0!==k.WindDelta&&0<=k.OutIdx&&k.Curr.Y>k.Top.Y&&f.ClipperBase.SlopesEqual(b,k,this.m_UseFullRange)&&(h=this.AddOutPt(k,b.Bot),this.AddJoin(d,h,b.Top)))):this.UpdateEdgeIntoAEL(b):(0<=
+b.OutIdx&&this.AddOutPt(b,b.Top),this.DeleteFromAEL(b))};f.Clipper.prototype.GetNextInAEL=function(b,c){return c==f.Direction.dLeftToRight?b.NextInAEL:b.PrevInAEL};f.Clipper.prototype.IsMinima=function(b){return null!==b&&b.Prev.NextInLML!=b&&b.Next.NextInLML!=b};f.Clipper.prototype.IsMaxima=function(b,c){return null!==b&&b.Top.Y==c&&null===b.NextInLML};f.Clipper.prototype.IsIntermediate=function(b,c){return b.Top.Y==c&&null!==b.NextInLML};f.Clipper.prototype.GetMaximaPair=function(b){var c=null;
+f.IntPoint.op_Equality(b.Next.Top,b.Top)&&null===b.Next.NextInLML?c=b.Next:f.IntPoint.op_Equality(b.Prev.Top,b.Top)&&null===b.Prev.NextInLML&&(c=b.Prev);return null===c||-2!=c.OutIdx&&(c.NextInAEL!=c.PrevInAEL||f.ClipperBase.IsHorizontal(c))?c:null};f.Clipper.prototype.ProcessIntersections=function(b){if(null==this.m_ActiveEdges)return!0;try{this.BuildIntersectList(b);if(0==this.m_IntersectList.length)return!0;if(1==this.m_IntersectList.length||this.FixupIntersectionOrder())this.ProcessIntersectList();
+else return!1}catch(c){this.m_SortedEdges=null,this.m_IntersectList.length=0,f.Error("ProcessIntersections error")}this.m_SortedEdges=null;return!0};f.Clipper.prototype.BuildIntersectList=function(b){if(null!==this.m_ActiveEdges){var c=this.m_ActiveEdges;for(this.m_SortedEdges=c;null!==c;)c.PrevInSEL=c.PrevInAEL,c.NextInSEL=c.NextInAEL,c.Curr.X=f.Clipper.TopX(c,b),c=c.NextInAEL;for(var k=!0;k&&null!==this.m_SortedEdges;){k=!1;for(c=this.m_SortedEdges;null!==c.NextInSEL;){b=c.NextInSEL;var d=new f.IntPoint;
+c.Curr.X>b.Curr.X?(this.IntersectPoint(c,b,d),k=new f.IntersectNode,k.Edge1=c,k.Edge2=b,k.Pt.X=d.X,k.Pt.Y=d.Y,f.use_xyz&&(k.Pt.Z=d.Z),this.m_IntersectList.push(k),this.SwapPositionsInSEL(c,b),k=!0):c=b}if(null!==c.PrevInSEL)c.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};f.Clipper.prototype.EdgesAdjacent=function(b){return b.Edge1.NextInSEL==b.Edge2||b.Edge1.PrevInSEL==b.Edge2};f.Clipper.IntersectNodeSort=function(b,c){return c.Pt.Y-b.Pt.Y};f.Clipper.prototype.FixupIntersectionOrder=
+function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer);this.CopyAELToSEL();for(var b=this.m_IntersectList.length,c=0;c<b;c++){if(!this.EdgesAdjacent(this.m_IntersectList[c])){for(var k=c+1;k<b&&!this.EdgesAdjacent(this.m_IntersectList[k]);)k++;if(k==b)return!1;var f=this.m_IntersectList[c];this.m_IntersectList[c]=this.m_IntersectList[k];this.m_IntersectList[k]=f}this.SwapPositionsInSEL(this.m_IntersectList[c].Edge1,this.m_IntersectList[c].Edge2)}return!0};f.Clipper.prototype.ProcessIntersectList=
+function(){for(var b=0,c=this.m_IntersectList.length;b<c;b++){var k=this.m_IntersectList[b];this.IntersectEdges(k.Edge1,k.Edge2,k.Pt);this.SwapPositionsInAEL(k.Edge1,k.Edge2)}this.m_IntersectList.length=0};F=function(b){return 0>b?Math.ceil(b-.5):Math.round(b)};Wb=function(b){return 0>b?Math.ceil(b-.5):Math.floor(b+.5)};Ab=function(b){return 0>b?-Math.round(Math.abs(b)):Math.round(b)};Bb=function(b){if(0>b)return b-=.5,-2147483648>b?Math.ceil(b):b|0;b+=.5;return 2147483647<b?Math.floor(b):b|0};f.Clipper.Round=
+va?F:ba?Ab:ub?Bb:Wb;f.Clipper.TopX=function(b,c){return c==b.Top.Y?b.Top.X:b.Bot.X+f.Clipper.Round(b.Dx*(c-b.Bot.Y))};f.Clipper.prototype.IntersectPoint=function(b,c,k){k.X=0;k.Y=0;var d,h;if(b.Dx==c.Dx)k.Y=b.Curr.Y,k.X=f.Clipper.TopX(b,k.Y);else{if(0===b.Delta.X)k.X=b.Bot.X,f.ClipperBase.IsHorizontal(c)?k.Y=c.Bot.Y:(h=c.Bot.Y-c.Bot.X/c.Dx,k.Y=f.Clipper.Round(k.X/c.Dx+h));else if(0===c.Delta.X)k.X=c.Bot.X,f.ClipperBase.IsHorizontal(b)?k.Y=b.Bot.Y:(d=b.Bot.Y-b.Bot.X/b.Dx,k.Y=f.Clipper.Round(k.X/b.Dx+
+d));else{d=b.Bot.X-b.Bot.Y*b.Dx;h=c.Bot.X-c.Bot.Y*c.Dx;var n=(h-d)/(b.Dx-c.Dx);k.Y=f.Clipper.Round(n);k.X=Math.abs(b.Dx)<Math.abs(c.Dx)?f.Clipper.Round(b.Dx*n+d):f.Clipper.Round(c.Dx*n+h)}if(k.Y<b.Top.Y||k.Y<c.Top.Y){if(b.Top.Y>c.Top.Y)return k.Y=b.Top.Y,k.X=f.Clipper.TopX(c,b.Top.Y),k.X<b.Top.X;k.Y=c.Top.Y;k.X=Math.abs(b.Dx)<Math.abs(c.Dx)?f.Clipper.TopX(b,k.Y):f.Clipper.TopX(c,k.Y)}k.Y>b.Curr.Y&&(k.Y=b.Curr.Y,k.X=Math.abs(b.Dx)>Math.abs(c.Dx)?f.Clipper.TopX(c,k.Y):f.Clipper.TopX(b,k.Y))}};f.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=
+function(b){for(var c=this.m_ActiveEdges;null!==c;){var k=this.IsMaxima(c,b);k&&(k=this.GetMaximaPair(c),k=null===k||!f.ClipperBase.IsHorizontal(k));if(k){var d=c.PrevInAEL;this.DoMaxima(c);c=null===d?this.m_ActiveEdges:d.NextInAEL}else{this.IsIntermediate(c,b)&&f.ClipperBase.IsHorizontal(c.NextInLML)?(c=this.UpdateEdgeIntoAEL(c),0<=c.OutIdx&&this.AddOutPt(c,c.Bot),this.AddEdgeToSEL(c)):(c.Curr.X=f.Clipper.TopX(c,b),c.Curr.Y=b);if(this.StrictlySimple&&(d=c.PrevInAEL,0<=c.OutIdx&&0!==c.WindDelta&&
+null!==d&&0<=d.OutIdx&&d.Curr.X==c.Curr.X&&0!==d.WindDelta)){var h=new f.IntPoint(c.Curr);f.use_xyz&&this.SetZ(h,d,c);k=this.AddOutPt(d,h);d=this.AddOutPt(c,h);this.AddJoin(k,d,h)}c=c.NextInAEL}}this.ProcessHorizontals(!0);for(c=this.m_ActiveEdges;null!==c;)this.IsIntermediate(c,b)&&(k=null,0<=c.OutIdx&&(k=this.AddOutPt(c,c.Top)),c=this.UpdateEdgeIntoAEL(c),d=c.PrevInAEL,h=c.NextInAEL,null!==d&&d.Curr.X==c.Bot.X&&d.Curr.Y==c.Bot.Y&&null!==k&&0<=d.OutIdx&&d.Curr.Y>d.Top.Y&&f.ClipperBase.SlopesEqual(c,
+d,this.m_UseFullRange)&&0!==c.WindDelta&&0!==d.WindDelta?(d=this.AddOutPt(d,c.Bot),this.AddJoin(k,d,c.Top)):null!==h&&h.Curr.X==c.Bot.X&&h.Curr.Y==c.Bot.Y&&null!==k&&0<=h.OutIdx&&h.Curr.Y>h.Top.Y&&f.ClipperBase.SlopesEqual(c,h,this.m_UseFullRange)&&0!==c.WindDelta&&0!==h.WindDelta&&(d=this.AddOutPt(h,c.Bot),this.AddJoin(k,d,c.Top))),c=c.NextInAEL};f.Clipper.prototype.DoMaxima=function(b){var c=this.GetMaximaPair(b);if(null===c)0<=b.OutIdx&&this.AddOutPt(b,b.Top),this.DeleteFromAEL(b);else{for(var k=
+b.NextInAEL;null!==k&&k!=c;)this.IntersectEdges(b,k,b.Top),this.SwapPositionsInAEL(b,k),k=b.NextInAEL;-1==b.OutIdx&&-1==c.OutIdx?(this.DeleteFromAEL(b),this.DeleteFromAEL(c)):0<=b.OutIdx&&0<=c.OutIdx?(0<=b.OutIdx&&this.AddLocalMaxPoly(b,c,b.Top),this.DeleteFromAEL(b),this.DeleteFromAEL(c)):f.use_lines&&0===b.WindDelta?(0<=b.OutIdx&&(this.AddOutPt(b,b.Top),b.OutIdx=-1),this.DeleteFromAEL(b),0<=c.OutIdx&&(this.AddOutPt(c,b.Top),c.OutIdx=-1),this.DeleteFromAEL(c)):f.Error("DoMaxima error")}};f.Clipper.ReversePaths=
+function(b){for(var c=0,k=b.length;c<k;c++)b[c].reverse()};f.Clipper.Orientation=function(b){return 0<=f.Clipper.Area(b)};f.Clipper.prototype.PointCount=function(b){if(null===b)return 0;var c=0,k=b;do c++,k=k.Next;while(k!=b);return c};f.Clipper.prototype.BuildResult=function(b){f.Clear(b);for(var c=0,k=this.m_PolyOuts.length;c<k;c++){var d=this.m_PolyOuts[c];if(null!==d.Pts){d=d.Pts.Prev;var h=this.PointCount(d);if(!(2>h)){for(var n=Array(h),p=0;p<h;p++)n[p]=d.Pt,d=d.Prev;b.push(n)}}}};f.Clipper.prototype.BuildResult2=
+function(b){b.Clear();for(var c=0,k=this.m_PolyOuts.length;c<k;c++){var d=this.m_PolyOuts[c],h=this.PointCount(d.Pts);if(!(d.IsOpen&&2>h||!d.IsOpen&&3>h)){this.FixHoleLinkage(d);var n=new f.PolyNode;b.m_AllPolys.push(n);d.PolyNode=n;n.m_polygon.length=h;d=d.Pts.Prev;for(var p=0;p<h;p++)n.m_polygon[p]=d.Pt,d=d.Prev}}c=0;for(k=this.m_PolyOuts.length;c<k;c++)d=this.m_PolyOuts[c],null!==d.PolyNode&&(d.IsOpen?(d.PolyNode.IsOpen=!0,b.AddChild(d.PolyNode)):null!==d.FirstLeft&&null!=d.FirstLeft.PolyNode?
+d.FirstLeft.PolyNode.AddChild(d.PolyNode):b.AddChild(d.PolyNode))};f.Clipper.prototype.FixupOutPolygon=function(b){var c=null;b.BottomPt=null;for(var k=b.Pts;;){if(k.Prev==k||k.Prev==k.Next){b.Pts=null;return}if(f.IntPoint.op_Equality(k.Pt,k.Next.Pt)||f.IntPoint.op_Equality(k.Pt,k.Prev.Pt)||f.ClipperBase.SlopesEqual(k.Prev.Pt,k.Pt,k.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(k.Prev.Pt,k.Pt,k.Next.Pt)))c=null,k.Prev.Next=k.Next,k=k.Next.Prev=k.Prev;else if(k==
+c)break;else null===c&&(c=k),k=k.Next}b.Pts=k};f.Clipper.prototype.DupOutPt=function(b,c){var k=new f.OutPt;k.Pt.X=b.Pt.X;k.Pt.Y=b.Pt.Y;f.use_xyz&&(k.Pt.Z=b.Pt.Z);k.Idx=b.Idx;c?(k.Next=b.Next,k.Prev=b,b.Next.Prev=k,b.Next=k):(k.Prev=b.Prev,k.Next=b,b.Prev.Next=k,b.Prev=k);return k};f.Clipper.prototype.GetOverlap=function(b,c,k,f,d){b<c?k<f?(d.Left=Math.max(b,k),d.Right=Math.min(c,f)):(d.Left=Math.max(b,f),d.Right=Math.min(c,k)):k<f?(d.Left=Math.max(c,k),d.Right=Math.min(b,f)):(d.Left=Math.max(c,f),
+d.Right=Math.min(b,k));return d.Left<d.Right};f.Clipper.prototype.JoinHorz=function(b,c,k,d,h,n){var U=b.Pt.X>c.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;d=k.Pt.X>d.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;if(U==d)return!1;if(U==f.Direction.dLeftToRight){for(;b.Next.Pt.X<=h.X&&b.Next.Pt.X>=b.Pt.X&&b.Next.Pt.Y==h.Y;)b=b.Next;n&&b.Pt.X!=h.X&&(b=b.Next);c=this.DupOutPt(b,!n);f.IntPoint.op_Inequality(c.Pt,h)&&(b=c,b.Pt.X=h.X,b.Pt.Y=h.Y,f.use_xyz&&(b.Pt.Z=h.Z),c=this.DupOutPt(b,
+!n))}else{for(;b.Next.Pt.X>=h.X&&b.Next.Pt.X<=b.Pt.X&&b.Next.Pt.Y==h.Y;)b=b.Next;n||b.Pt.X==h.X||(b=b.Next);c=this.DupOutPt(b,n);f.IntPoint.op_Inequality(c.Pt,h)&&(b=c,b.Pt.X=h.X,b.Pt.Y=h.Y,f.use_xyz&&(b.Pt.Z=h.Z),c=this.DupOutPt(b,n))}if(d==f.Direction.dLeftToRight){for(;k.Next.Pt.X<=h.X&&k.Next.Pt.X>=k.Pt.X&&k.Next.Pt.Y==h.Y;)k=k.Next;n&&k.Pt.X!=h.X&&(k=k.Next);d=this.DupOutPt(k,!n);f.IntPoint.op_Inequality(d.Pt,h)&&(k=d,k.Pt.X=h.X,k.Pt.Y=h.Y,f.use_xyz&&(k.Pt.Z=h.Z),d=this.DupOutPt(k,!n))}else{for(;k.Next.Pt.X>=
+h.X&&k.Next.Pt.X<=k.Pt.X&&k.Next.Pt.Y==h.Y;)k=k.Next;n||k.Pt.X==h.X||(k=k.Next);d=this.DupOutPt(k,n);f.IntPoint.op_Inequality(d.Pt,h)&&(k=d,k.Pt.X=h.X,k.Pt.Y=h.Y,f.use_xyz&&(k.Pt.Z=h.Z),d=this.DupOutPt(k,n))}U==f.Direction.dLeftToRight==n?(b.Prev=k,k.Next=b,c.Next=d,d.Prev=c):(b.Next=k,k.Prev=b,c.Prev=d,d.Next=c);return!0};f.Clipper.prototype.JoinPoints=function(b,c,k){var d=b.OutPt1,h;new f.OutPt;var n=b.OutPt2,p;new f.OutPt;if((p=b.OutPt1.Pt.Y==b.OffPt.Y)&&f.IntPoint.op_Equality(b.OffPt,b.OutPt1.Pt)&&
+f.IntPoint.op_Equality(b.OffPt,b.OutPt2.Pt)){if(c!=k)return!1;for(h=b.OutPt1.Next;h!=d&&f.IntPoint.op_Equality(h.Pt,b.OffPt);)h=h.Next;h=h.Pt.Y>b.OffPt.Y;for(p=b.OutPt2.Next;p!=n&&f.IntPoint.op_Equality(p.Pt,b.OffPt);)p=p.Next;if(h==p.Pt.Y>b.OffPt.Y)return!1;h?(h=this.DupOutPt(d,!1),p=this.DupOutPt(n,!0),d.Prev=n,n.Next=d,h.Next=p,p.Prev=h):(h=this.DupOutPt(d,!0),p=this.DupOutPt(n,!1),d.Next=n,n.Prev=d,h.Prev=p,p.Next=h);b.OutPt1=d;b.OutPt2=h;return!0}if(p){for(h=d;d.Prev.Pt.Y==d.Pt.Y&&d.Prev!=h&&
+d.Prev!=n;)d=d.Prev;for(;h.Next.Pt.Y==h.Pt.Y&&h.Next!=d&&h.Next!=n;)h=h.Next;if(h.Next==d||h.Next==n)return!1;for(p=n;n.Prev.Pt.Y==n.Pt.Y&&n.Prev!=p&&n.Prev!=h;)n=n.Prev;for(;p.Next.Pt.Y==p.Pt.Y&&p.Next!=n&&p.Next!=d;)p=p.Next;if(p.Next==n||p.Next==d)return!1;k={Left:null,Right:null};if(!this.GetOverlap(d.Pt.X,h.Pt.X,n.Pt.X,p.Pt.X,k))return!1;c=k.Left;var t=k.Right;k=new f.IntPoint;d.Pt.X>=c&&d.Pt.X<=t?(k.X=d.Pt.X,k.Y=d.Pt.Y,f.use_xyz&&(k.Z=d.Pt.Z),c=d.Pt.X>h.Pt.X):n.Pt.X>=c&&n.Pt.X<=t?(k.X=n.Pt.X,
+k.Y=n.Pt.Y,f.use_xyz&&(k.Z=n.Pt.Z),c=n.Pt.X>p.Pt.X):h.Pt.X>=c&&h.Pt.X<=t?(k.X=h.Pt.X,k.Y=h.Pt.Y,f.use_xyz&&(k.Z=h.Pt.Z),c=h.Pt.X>d.Pt.X):(k.X=p.Pt.X,k.Y=p.Pt.Y,f.use_xyz&&(k.Z=p.Pt.Z),c=p.Pt.X>n.Pt.X);b.OutPt1=d;b.OutPt2=n;return this.JoinHorz(d,h,n,p,k,c)}for(h=d.Next;f.IntPoint.op_Equality(h.Pt,d.Pt)&&h!=d;)h=h.Next;if(t=h.Pt.Y>d.Pt.Y||!f.ClipperBase.SlopesEqual(d.Pt,h.Pt,b.OffPt,this.m_UseFullRange)){for(h=d.Prev;f.IntPoint.op_Equality(h.Pt,d.Pt)&&h!=d;)h=h.Prev;if(h.Pt.Y>d.Pt.Y||!f.ClipperBase.SlopesEqual(d.Pt,
+h.Pt,b.OffPt,this.m_UseFullRange))return!1}for(p=n.Next;f.IntPoint.op_Equality(p.Pt,n.Pt)&&p!=n;)p=p.Next;var B=p.Pt.Y>n.Pt.Y||!f.ClipperBase.SlopesEqual(n.Pt,p.Pt,b.OffPt,this.m_UseFullRange);if(B){for(p=n.Prev;f.IntPoint.op_Equality(p.Pt,n.Pt)&&p!=n;)p=p.Prev;if(p.Pt.Y>n.Pt.Y||!f.ClipperBase.SlopesEqual(n.Pt,p.Pt,b.OffPt,this.m_UseFullRange))return!1}if(h==d||p==n||h==p||c==k&&t==B)return!1;t?(h=this.DupOutPt(d,!1),p=this.DupOutPt(n,!0),d.Prev=n,n.Next=d,h.Next=p,p.Prev=h):(h=this.DupOutPt(d,!0),
+p=this.DupOutPt(n,!1),d.Next=n,n.Prev=d,h.Prev=p,p.Next=h);b.OutPt1=d;b.OutPt2=h;return!0};f.Clipper.GetBounds=function(b){for(var c=0,k=b.length;c<k&&0==b[c].length;)c++;if(c==k)return new f.IntRect(0,0,0,0);var d=new f.IntRect;d.left=b[c][0].X;d.right=d.left;d.top=b[c][0].Y;for(d.bottom=d.top;c<k;c++)for(var h=0,n=b[c].length;h<n;h++)b[c][h].X<d.left?d.left=b[c][h].X:b[c][h].X>d.right&&(d.right=b[c][h].X),b[c][h].Y<d.top?d.top=b[c][h].Y:b[c][h].Y>d.bottom&&(d.bottom=b[c][h].Y);return d};f.Clipper.prototype.GetBounds2=
+function(b){var c=b,k=new f.IntRect;k.left=b.Pt.X;k.right=b.Pt.X;k.top=b.Pt.Y;k.bottom=b.Pt.Y;for(b=b.Next;b!=c;)b.Pt.X<k.left&&(k.left=b.Pt.X),b.Pt.X>k.right&&(k.right=b.Pt.X),b.Pt.Y<k.top&&(k.top=b.Pt.Y),b.Pt.Y>k.bottom&&(k.bottom=b.Pt.Y),b=b.Next;return k};f.Clipper.PointInPolygon=function(b,c){var k=0,f=c.length;if(3>f)return 0;for(var d=c[0],h=1;h<=f;++h){var n=h==f?c[0]:c[h];if(n.Y==b.Y&&(n.X==b.X||d.Y==b.Y&&n.X>b.X==d.X<b.X))return-1;if(d.Y<b.Y!=n.Y<b.Y)if(d.X>=b.X)if(n.X>b.X)k=1-k;else{var p=
+(d.X-b.X)*(n.Y-b.Y)-(n.X-b.X)*(d.Y-b.Y);if(0==p)return-1;0<p==n.Y>d.Y&&(k=1-k)}else if(n.X>b.X){p=(d.X-b.X)*(n.Y-b.Y)-(n.X-b.X)*(d.Y-b.Y);if(0==p)return-1;0<p==n.Y>d.Y&&(k=1-k)}d=n}return k};f.Clipper.prototype.PointInPolygon=function(b,c){var k=0,f=c,d=b.X;b=b.Y;var h=c.Pt.X,n=c.Pt.Y;do{c=c.Next;var p=c.Pt.X,t=c.Pt.Y;if(t==b&&(p==d||n==b&&p>d==h<d))return-1;if(n<b!=t<b)if(h>=d)if(p>d)k=1-k;else{h=(h-d)*(t-b)-(p-d)*(n-b);if(0==h)return-1;0<h==t>n&&(k=1-k)}else if(p>d){h=(h-d)*(t-b)-(p-d)*(n-b);if(0==
+h)return-1;0<h==t>n&&(k=1-k)}h=p;n=t}while(f!=c);return k};f.Clipper.prototype.Poly2ContainsPoly1=function(b,c){var k=b;do{var f=this.PointInPolygon(k.Pt,c);if(0<=f)return 0<f;k=k.Next}while(k!=b);return!0};f.Clipper.prototype.FixupFirstLefts1=function(b,c){for(var k=0,f=this.m_PolyOuts.length;k<f;k++){var d=this.m_PolyOuts[k];null!=d.Pts&&null!=d.FirstLeft&&this.ParseFirstLeft(d.FirstLeft)==b&&this.Poly2ContainsPoly1(d.Pts,c.Pts)&&(d.FirstLeft=c)}};f.Clipper.prototype.FixupFirstLefts2=function(b,
+c){for(var k=0,f=this.m_PolyOuts,d=f.length,h=f[k];k<d;k++,h=f[k])h.FirstLeft==b&&(h.FirstLeft=c)};f.Clipper.ParseFirstLeft=function(b){for(;null!=b&&null==b.Pts;)b=b.FirstLeft;return b};f.Clipper.prototype.JoinCommonEdges=function(){for(var b=0,c=this.m_Joins.length;b<c;b++){var k=this.m_Joins[b],d=this.GetOutRec(k.OutPt1.Idx),h=this.GetOutRec(k.OutPt2.Idx);if(null!=d.Pts&&null!=h.Pts){var n=d==h?d:this.Param1RightOfParam2(d,h)?h:this.Param1RightOfParam2(h,d)?d:this.GetLowermostRec(d,h);if(this.JoinPoints(k,
+d,h))if(d==h){d.Pts=k.OutPt1;d.BottomPt=null;h=this.CreateOutRec();h.Pts=k.OutPt2;this.UpdateOutPtIdxs(h);if(this.m_UsingPolyTree){n=0;for(var p=this.m_PolyOuts.length;n<p-1;n++){var t=this.m_PolyOuts[n];null!=t.Pts&&f.Clipper.ParseFirstLeft(t.FirstLeft)==d&&t.IsHole!=d.IsHole&&this.Poly2ContainsPoly1(t.Pts,k.OutPt2)&&(t.FirstLeft=h)}}this.Poly2ContainsPoly1(h.Pts,d.Pts)?(h.IsHole=!d.IsHole,h.FirstLeft=d,this.m_UsingPolyTree&&this.FixupFirstLefts2(h,d),(h.IsHole^this.ReverseSolution)==0<this.Area(h)&&
+this.ReversePolyPtLinks(h.Pts)):this.Poly2ContainsPoly1(d.Pts,h.Pts)?(h.IsHole=d.IsHole,d.IsHole=!h.IsHole,h.FirstLeft=d.FirstLeft,d.FirstLeft=h,this.m_UsingPolyTree&&this.FixupFirstLefts2(d,h),(d.IsHole^this.ReverseSolution)==0<this.Area(d)&&this.ReversePolyPtLinks(d.Pts)):(h.IsHole=d.IsHole,h.FirstLeft=d.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(d,h))}else h.Pts=null,h.BottomPt=null,h.Idx=d.Idx,d.IsHole=n.IsHole,n==h&&(d.FirstLeft=h.FirstLeft),h.FirstLeft=d,this.m_UsingPolyTree&&this.FixupFirstLefts2(h,
+d)}}};f.Clipper.prototype.UpdateOutPtIdxs=function(b){var c=b.Pts;do c.Idx=b.Idx,c=c.Prev;while(c!=b.Pts)};f.Clipper.prototype.DoSimplePolygons=function(){for(var b=0;b<this.m_PolyOuts.length;){var c=this.m_PolyOuts[b++],k=c.Pts;if(null!=k&&!c.IsOpen){do{for(var d=k.Next;d!=c.Pts;){if(f.IntPoint.op_Equality(k.Pt,d.Pt)&&d.Next!=k&&d.Prev!=k){var h=k.Prev,n=d.Prev;k.Prev=n;n.Next=k;d.Prev=h;h.Next=d;c.Pts=k;h=this.CreateOutRec();h.Pts=d;this.UpdateOutPtIdxs(h);this.Poly2ContainsPoly1(h.Pts,c.Pts)?(h.IsHole=
+!c.IsHole,h.FirstLeft=c,this.m_UsingPolyTree&&this.FixupFirstLefts2(h,c)):this.Poly2ContainsPoly1(c.Pts,h.Pts)?(h.IsHole=c.IsHole,c.IsHole=!h.IsHole,h.FirstLeft=c.FirstLeft,c.FirstLeft=h,this.m_UsingPolyTree&&this.FixupFirstLefts2(c,h)):(h.IsHole=c.IsHole,h.FirstLeft=c.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(c,h));d=k}d=d.Next}k=k.Next}while(k!=c.Pts)}}};f.Clipper.Area=function(b){var c=b.length;if(3>c)return 0;for(var k=0,d=0,f=c-1;d<c;++d)k+=(b[f].X+b[d].X)*(b[f].Y-b[d].Y),f=d;return.5*
+-k};f.Clipper.prototype.Area=function(b){var c=b.Pts;if(null==c)return 0;var k=0;do k+=(c.Prev.Pt.X+c.Pt.X)*(c.Prev.Pt.Y-c.Pt.Y),c=c.Next;while(c!=b.Pts);return.5*k};f.Clipper.SimplifyPolygon=function(b,c){var k=[],d=new f.Clipper(0);d.StrictlySimple=!0;d.AddPath(b,f.PolyType.ptSubject,!0);d.Execute(f.ClipType.ctUnion,k,c,c);return k};f.Clipper.SimplifyPolygons=function(b,c){"undefined"==typeof c&&(c=f.PolyFillType.pftEvenOdd);var k=[],d=new f.Clipper(0);d.StrictlySimple=!0;d.AddPaths(b,f.PolyType.ptSubject,
+!0);d.Execute(f.ClipType.ctUnion,k,c,c);return k};f.Clipper.DistanceSqrd=function(b,c){var k=b.X-c.X;b=b.Y-c.Y;return k*k+b*b};f.Clipper.DistanceFromLineSqrd=function(b,c,k){var d=c.Y-k.Y;k=k.X-c.X;c=d*c.X+k*c.Y;c=d*b.X+k*b.Y-c;return c*c/(d*d+k*k)};f.Clipper.SlopesNearCollinear=function(b,c,k,d){return Math.abs(b.X-c.X)>Math.abs(b.Y-c.Y)?b.X>c.X==b.X<k.X?f.Clipper.DistanceFromLineSqrd(b,c,k)<d:c.X>b.X==c.X<k.X?f.Clipper.DistanceFromLineSqrd(c,b,k)<d:f.Clipper.DistanceFromLineSqrd(k,b,c)<d:b.Y>c.Y==
+b.Y<k.Y?f.Clipper.DistanceFromLineSqrd(b,c,k)<d:c.Y>b.Y==c.Y<k.Y?f.Clipper.DistanceFromLineSqrd(c,b,k)<d:f.Clipper.DistanceFromLineSqrd(k,b,c)<d};f.Clipper.PointsAreClose=function(b,c,k){var d=b.X-c.X;b=b.Y-c.Y;return d*d+b*b<=k};f.Clipper.ExcludeOp=function(b){var c=b.Prev;c.Next=b.Next;b.Next.Prev=c;c.Idx=0;return c};f.Clipper.CleanPolygon=function(b,c){"undefined"==typeof c&&(c=1.415);var k=b.length;if(0==k)return[];for(var d=Array(k),h=0;h<k;++h)d[h]=new f.OutPt;for(h=0;h<k;++h)d[h].Pt=b[h],d[h].Next=
+d[(h+1)%k],d[h].Next.Prev=d[h],d[h].Idx=0;h=c*c;for(d=d[0];0==d.Idx&&d.Next!=d.Prev;)f.Clipper.PointsAreClose(d.Pt,d.Prev.Pt,h)?(d=f.Clipper.ExcludeOp(d),k--):f.Clipper.PointsAreClose(d.Prev.Pt,d.Next.Pt,h)?(f.Clipper.ExcludeOp(d.Next),d=f.Clipper.ExcludeOp(d),k-=2):f.Clipper.SlopesNearCollinear(d.Prev.Pt,d.Pt,d.Next.Pt,h)?(d=f.Clipper.ExcludeOp(d),k--):(d.Idx=1,d=d.Next);3>k&&(k=0);b=Array(k);for(h=0;h<k;++h)b[h]=new f.IntPoint(d.Pt),d=d.Next;return b};f.Clipper.CleanPolygons=function(b,c){for(var d=
+Array(b.length),h=0,n=b.length;h<n;h++)d[h]=f.Clipper.CleanPolygon(b[h],c);return d};f.Clipper.Minkowski=function(b,c,d,h){h=h?1:0;var k=b.length,n=c.length,p=[];if(d)for(d=0;d<n;d++){for(var t=Array(k),B=0,U=b.length,F=b[B];B<U;B++,F=b[B])t[B]=new f.IntPoint(c[d].X+F.X,c[d].Y+F.Y);p.push(t)}else for(d=0;d<n;d++){t=Array(k);B=0;U=b.length;for(F=b[B];B<U;B++,F=b[B])t[B]=new f.IntPoint(c[d].X-F.X,c[d].Y-F.Y);p.push(t)}b=[];for(d=0;d<n-1+h;d++)for(B=0;B<k;B++)c=[],c.push(p[d%n][B%k]),c.push(p[(d+1)%
+n][B%k]),c.push(p[(d+1)%n][(B+1)%k]),c.push(p[d%n][(B+1)%k]),f.Clipper.Orientation(c)||c.reverse(),b.push(c);return b};f.Clipper.MinkowskiSum=function(b,c,d){if(c[0]instanceof Array){p=c;c=new f.Paths;for(var k=new f.Clipper,h=0;h<p.length;++h){var n=f.Clipper.Minkowski(b,p[h],!0,d);k.AddPaths(n,f.PolyType.ptSubject,!0);d&&(n=f.Clipper.TranslatePath(p[h],b[0]),k.AddPath(n,f.PolyType.ptClip,!0))}k.Execute(f.ClipType.ctUnion,c,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return c}var p=f.Clipper.Minkowski(b,
+c,!0,d);k=new f.Clipper;k.AddPaths(p,f.PolyType.ptSubject,!0);k.Execute(f.ClipType.ctUnion,p,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return p};f.Clipper.TranslatePath=function(b,c){for(var d=new f.Path,h=0;h<b.length;h++)d.push(new f.IntPoint(b[h].X+c.X,b[h].Y+c.Y));return d};f.Clipper.MinkowskiDiff=function(b,c){b=f.Clipper.Minkowski(b,c,!1,!0);c=new f.Clipper;c.AddPaths(b,f.PolyType.ptSubject,!0);c.Execute(f.ClipType.ctUnion,b,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return b};
+f.Clipper.PolyTreeToPaths=function(b){var c=[];f.Clipper.AddPolyNodeToPaths(b,f.Clipper.NodeType.ntAny,c);return c};f.Clipper.AddPolyNodeToPaths=function(b,c,d){var k=!0;switch(c){case f.Clipper.NodeType.ntOpen:return;case f.Clipper.NodeType.ntClosed:k=!b.IsOpen}0<b.m_polygon.length&&k&&d.push(b.m_polygon);k=0;b=b.Childs();for(var h=b.length,n=b[k];k<h;k++,n=b[k])f.Clipper.AddPolyNodeToPaths(n,c,d)};f.Clipper.OpenPathsFromPolyTree=function(b){for(var c=new f.Paths,d=0,h=b.ChildCount();d<h;d++)b.Childs()[d].IsOpen&&
+c.push(b.Childs()[d].m_polygon);return c};f.Clipper.ClosedPathsFromPolyTree=function(b){var c=new f.Paths;f.Clipper.AddPolyNodeToPaths(b,f.Clipper.NodeType.ntClosed,c);return c};ua(f.Clipper,f.ClipperBase);f.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};f.ClipperOffset=function(b,c){"undefined"==typeof b&&(b=2);"undefined"==typeof c&&(c=f.ClipperOffset.def_arc_tolerance);this.m_destPolys=new f.Paths;this.m_srcPoly=new f.Path;this.m_destPoly=new f.Path;this.m_normals=[];this.m_StepsPerRad=this.m_miterLim=
+this.m_cos=this.m_sin=this.m_sinA=this.m_delta=0;this.m_lowest=new f.IntPoint;this.m_polyNodes=new f.PolyNode;this.MiterLimit=b;this.ArcTolerance=c;this.m_lowest.X=-1};f.ClipperOffset.two_pi=6.28318530717959;f.ClipperOffset.def_arc_tolerance=.25;f.ClipperOffset.prototype.Clear=function(){f.Clear(this.m_polyNodes.Childs());this.m_lowest.X=-1};f.ClipperOffset.Round=f.Clipper.Round;f.ClipperOffset.prototype.AddPath=function(b,c,d){var k=b.length-1;if(!(0>k)){var h=new f.PolyNode;h.m_jointype=c;h.m_endtype=
+d;if(d==f.EndType.etClosedLine||d==f.EndType.etClosedPolygon)for(;0<k&&f.IntPoint.op_Equality(b[0],b[k]);)k--;h.m_polygon.push(b[0]);var n=0;c=0;for(var p=1;p<=k;p++)f.IntPoint.op_Inequality(h.m_polygon[n],b[p])&&(n++,h.m_polygon.push(b[p]),b[p].Y>h.m_polygon[c].Y||b[p].Y==h.m_polygon[c].Y&&b[p].X<h.m_polygon[c].X)&&(c=n);if(!(d==f.EndType.etClosedPolygon&&2>n)&&(this.m_polyNodes.AddChild(h),d==f.EndType.etClosedPolygon))if(0>this.m_lowest.X)this.m_lowest=new f.IntPoint(this.m_polyNodes.ChildCount()-
+1,c);else if(b=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y],h.m_polygon[c].Y>b.Y||h.m_polygon[c].Y==b.Y&&h.m_polygon[c].X<b.X)this.m_lowest=new f.IntPoint(this.m_polyNodes.ChildCount()-1,c)}};f.ClipperOffset.prototype.AddPaths=function(b,c,d){for(var k=0,f=b.length;k<f;k++)this.AddPath(b[k],c,d)};f.ClipperOffset.prototype.FixOrientations=function(){if(0<=this.m_lowest.X&&!f.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var b=0;b<this.m_polyNodes.ChildCount();b++){var c=
+this.m_polyNodes.Childs()[b];(c.m_endtype==f.EndType.etClosedPolygon||c.m_endtype==f.EndType.etClosedLine&&f.Clipper.Orientation(c.m_polygon))&&c.m_polygon.reverse()}else for(b=0;b<this.m_polyNodes.ChildCount();b++)c=this.m_polyNodes.Childs()[b],c.m_endtype!=f.EndType.etClosedLine||f.Clipper.Orientation(c.m_polygon)||c.m_polygon.reverse()};f.ClipperOffset.GetUnitNormal=function(b,c){var d=c.X-b.X;b=c.Y-b.Y;if(0==d&&0==b)return new f.DoublePoint(0,0);c=1/Math.sqrt(d*d+b*b);return new f.DoublePoint(b*
+c,-(d*c))};f.ClipperOffset.prototype.DoOffset=function(b){this.m_destPolys=[];this.m_delta=b;if(f.ClipperBase.near_zero(b))for(var c=0;c<this.m_polyNodes.ChildCount();c++){var d=this.m_polyNodes.Childs()[c];d.m_endtype==f.EndType.etClosedPolygon&&this.m_destPolys.push(d.m_polygon)}else{this.m_miterLim=2<this.MiterLimit?2/(this.MiterLimit*this.MiterLimit):.5;var h=3.14159265358979/Math.acos(1-(0>=this.ArcTolerance?f.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(b)*f.ClipperOffset.def_arc_tolerance?
+Math.abs(b)*f.ClipperOffset.def_arc_tolerance:this.ArcTolerance)/Math.abs(b));this.m_sin=Math.sin(f.ClipperOffset.two_pi/h);this.m_cos=Math.cos(f.ClipperOffset.two_pi/h);this.m_StepsPerRad=h/f.ClipperOffset.two_pi;0>b&&(this.m_sin=-this.m_sin);for(c=0;c<this.m_polyNodes.ChildCount();c++){d=this.m_polyNodes.Childs()[c];this.m_srcPoly=d.m_polygon;var n=this.m_srcPoly.length;if(!(0==n||0>=b&&(3>n||d.m_endtype!=f.EndType.etClosedPolygon))){this.m_destPoly=[];if(1==n)if(d.m_jointype==f.JoinType.jtRound){d=
+1;n=0;for(var p=1;p<=h;p++){this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+d*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b)));var t=d;d=d*this.m_cos-this.m_sin*n;n=t*this.m_sin+n*this.m_cos}}else for(n=d=-1,p=0;4>p;++p)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+d*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b))),0>d?d=1:0>n?n=1:d=-1;else{for(p=this.m_normals.length=0;p<n-1;p++)this.m_normals.push(f.ClipperOffset.GetUnitNormal(this.m_srcPoly[p],
+this.m_srcPoly[p+1]));d.m_endtype==f.EndType.etClosedLine||d.m_endtype==f.EndType.etClosedPolygon?this.m_normals.push(f.ClipperOffset.GetUnitNormal(this.m_srcPoly[n-1],this.m_srcPoly[0])):this.m_normals.push(new f.DoublePoint(this.m_normals[n-2]));if(d.m_endtype==f.EndType.etClosedPolygon)for(t=n-1,p=0;p<n;p++)t=this.OffsetPoint(p,t,d.m_jointype);else if(d.m_endtype==f.EndType.etClosedLine){t=n-1;for(p=0;p<n;p++)t=this.OffsetPoint(p,t,d.m_jointype);this.m_destPolys.push(this.m_destPoly);this.m_destPoly=
+[];t=this.m_normals[n-1];for(p=n-1;0<p;p--)this.m_normals[p]=new f.DoublePoint(-this.m_normals[p-1].X,-this.m_normals[p-1].Y);this.m_normals[0]=new f.DoublePoint(-t.X,-t.Y);t=0;for(p=n-1;0<=p;p--)t=this.OffsetPoint(p,t,d.m_jointype)}else{t=0;for(p=1;p<n-1;++p)t=this.OffsetPoint(p,t,d.m_jointype);d.m_endtype==f.EndType.etOpenButt?(p=n-1,t=new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_normals[p].X*b),f.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_normals[p].Y*b)),this.m_destPoly.push(t),
+t=new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[p].X-this.m_normals[p].X*b),f.ClipperOffset.Round(this.m_srcPoly[p].Y-this.m_normals[p].Y*b)),this.m_destPoly.push(t)):(p=n-1,t=n-2,this.m_sinA=0,this.m_normals[p]=new f.DoublePoint(-this.m_normals[p].X,-this.m_normals[p].Y),d.m_endtype==f.EndType.etOpenSquare?this.DoSquare(p,t):this.DoRound(p,t));for(p=n-1;0<p;p--)this.m_normals[p]=new f.DoublePoint(-this.m_normals[p-1].X,-this.m_normals[p-1].Y);this.m_normals[0]=new f.DoublePoint(-this.m_normals[1].X,
+-this.m_normals[1].Y);t=n-1;for(p=t-1;0<p;--p)t=this.OffsetPoint(p,t,d.m_jointype);d.m_endtype==f.EndType.etOpenButt?(t=new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*b)),this.m_destPoly.push(t),t=new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*b)),this.m_destPoly.push(t)):(this.m_sinA=0,d.m_endtype==f.EndType.etOpenSquare?
+this.DoSquare(0,1):this.DoRound(0,1))}}this.m_destPolys.push(this.m_destPoly)}}}};f.ClipperOffset.prototype.Execute=function(){var b=arguments;if(b[0]instanceof f.PolyTree)if(c=b[0],d=b[1],c.Clear(),this.FixOrientations(),this.DoOffset(d),b=new f.Clipper(0),b.AddPaths(this.m_destPolys,f.PolyType.ptSubject,!0),0<d)b.Execute(f.ClipType.ctUnion,c,f.PolyFillType.pftPositive,f.PolyFillType.pftPositive);else if(d=f.Clipper.GetBounds(this.m_destPolys),h=new f.Path,h.push(new f.IntPoint(d.left-10,d.bottom+
+10)),h.push(new f.IntPoint(d.right+10,d.bottom+10)),h.push(new f.IntPoint(d.right+10,d.top-10)),h.push(new f.IntPoint(d.left-10,d.top-10)),b.AddPath(h,f.PolyType.ptSubject,!0),b.ReverseSolution=!0,b.Execute(f.ClipType.ctUnion,c,f.PolyFillType.pftNegative,f.PolyFillType.pftNegative),1==c.ChildCount()&&0<c.Childs()[0].ChildCount())for(b=c.Childs()[0],c.Childs()[0]=b.Childs()[0],c.Childs()[0].m_Parent=c,d=1;d<b.ChildCount();d++)c.AddChild(b.Childs()[d]);else c.Clear();else{var c=b[0],d=b[1];f.Clear(c);
+this.FixOrientations();this.DoOffset(d);b=new f.Clipper(0);b.AddPaths(this.m_destPolys,f.PolyType.ptSubject,!0);if(0<d)b.Execute(f.ClipType.ctUnion,c,f.PolyFillType.pftPositive,f.PolyFillType.pftPositive);else{d=f.Clipper.GetBounds(this.m_destPolys);var h=new f.Path;h.push(new f.IntPoint(d.left-10,d.bottom+10));h.push(new f.IntPoint(d.right+10,d.bottom+10));h.push(new f.IntPoint(d.right+10,d.top-10));h.push(new f.IntPoint(d.left-10,d.top-10));b.AddPath(h,f.PolyType.ptSubject,!0);b.ReverseSolution=
+!0;b.Execute(f.ClipType.ctUnion,c,f.PolyFillType.pftNegative,f.PolyFillType.pftNegative);0<c.length&&c.splice(0,1)}}};f.ClipperOffset.prototype.OffsetPoint=function(b,c,d){this.m_sinA=this.m_normals[c].X*this.m_normals[b].Y-this.m_normals[b].X*this.m_normals[c].Y;if(1>Math.abs(this.m_sinA*this.m_delta)){if(0<this.m_normals[c].X*this.m_normals[b].X+this.m_normals[b].Y*this.m_normals[c].Y)return this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_normals[c].X*this.m_delta),
+f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[c].Y*this.m_delta))),c}else 1<this.m_sinA?this.m_sinA=1:-1>this.m_sinA&&(this.m_sinA=-1);if(0>this.m_sinA*this.m_delta)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_normals[c].X*this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[c].Y*this.m_delta))),this.m_destPoly.push(new f.IntPoint(this.m_srcPoly[b])),this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_normals[b].X*
+this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[b].Y*this.m_delta)));else switch(d){case f.JoinType.jtMiter:d=1+(this.m_normals[b].X*this.m_normals[c].X+this.m_normals[b].Y*this.m_normals[c].Y);d>=this.m_miterLim?this.DoMiter(b,c,d):this.DoSquare(b,c);break;case f.JoinType.jtSquare:this.DoSquare(b,c);break;case f.JoinType.jtRound:this.DoRound(b,c)}return b};f.ClipperOffset.prototype.DoSquare=function(b,c){var d=Math.tan(Math.atan2(this.m_sinA,this.m_normals[c].X*this.m_normals[b].X+
+this.m_normals[c].Y*this.m_normals[b].Y)/4);this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_delta*(this.m_normals[c].X-this.m_normals[c].Y*d)),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_delta*(this.m_normals[c].Y+this.m_normals[c].X*d))));this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_delta*(this.m_normals[b].X+this.m_normals[b].Y*d)),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_delta*(this.m_normals[b].Y-this.m_normals[b].X*
+d))))};f.ClipperOffset.prototype.DoMiter=function(b,c,d){d=this.m_delta/d;this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+(this.m_normals[c].X+this.m_normals[b].X)*d),f.ClipperOffset.Round(this.m_srcPoly[b].Y+(this.m_normals[c].Y+this.m_normals[b].Y)*d)))};f.ClipperOffset.prototype.DoRound=function(b,c){var d=Math.max(f.Cast_Int32(f.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(Math.atan2(this.m_sinA,this.m_normals[c].X*this.m_normals[b].X+this.m_normals[c].Y*this.m_normals[b].Y)))),
+1),h=this.m_normals[c].X;c=this.m_normals[c].Y;for(var n,p=0;p<d;++p)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+h*this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+c*this.m_delta))),n=h,h=h*this.m_cos-this.m_sin*c,c=n*this.m_sin+c*this.m_cos;this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+this.m_normals[b].X*this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[b].Y*this.m_delta)))};f.Error=function(b){try{throw Error(b);
+}catch(c){alert(c.message)}};f.JS={};f.JS.AreaOfPolygon=function(b,c){c||(c=1);return f.Clipper.Area(b)/(c*c)};f.JS.AreaOfPolygons=function(b,c){c||(c=1);for(var d=0,h=0;h<b.length;h++)d+=f.Clipper.Area(b[h]);return d/(c*c)};f.JS.BoundsOfPath=function(b,c){return f.JS.BoundsOfPaths([b],c)};f.JS.BoundsOfPaths=function(b,c){c||(c=1);b=f.Clipper.GetBounds(b);b.left/=c;b.bottom/=c;b.right/=c;b.top/=c;return b};f.JS.Clean=function(b,c){if(!(b instanceof Array))return[];var d=b[0]instanceof Array;b=f.JS.Clone(b);
+if("number"!=typeof c||null===c)return f.Error("Delta is not a number in Clean()."),b;if(0===b.length||1==b.length&&0===b[0].length||0>c)return b;d||(b=[b]);for(var h=b.length,n,p,t,B,F,G,I,K=[],ia=0;ia<h;ia++)if(p=b[ia],n=p.length,0!==n)if(3>n)t=p,K.push(t);else{t=p;B=c*c;F=p[0];for(I=G=1;I<n;I++)(p[I].X-F.X)*(p[I].X-F.X)+(p[I].Y-F.Y)*(p[I].Y-F.Y)<=B||(t[G]=p[I],F=p[I],G++);F=p[G-1];(p[0].X-F.X)*(p[0].X-F.X)+(p[0].Y-F.Y)*(p[0].Y-F.Y)<=B&&G--;G<n&&t.splice(G,n-G);t.length&&K.push(t)}!d&&K.length?
+K=K[0]:d||0!==K.length?d&&0===K.length&&(K=[[]]):K=[];return K};f.JS.Clone=function(b){if(!(b instanceof Array)||0===b.length)return[];if(1==b.length&&0===b[0].length)return[[]];var c=b[0]instanceof Array;c||(b=[b]);var d=b.length,f,h,n=Array(d);for(f=0;f<d;f++){var p=b[f].length;var t=Array(p);for(h=0;h<p;h++)t[h]={X:b[f][h].X,Y:b[f][h].Y};n[f]=t}c||(n=n[0]);return n};f.JS.Lighten=function(b,c){if(!(b instanceof Array))return[];if("number"!=typeof c||null===c)return f.Error("Tolerance is not a number in Lighten()."),
+f.JS.Clone(b);if(0===b.length||1==b.length&&0===b[0].length||0>c)return f.JS.Clone(b);b[0]instanceof Array||(b=[b]);var d,h,n,p,t,B=b.length,F=c*c,G=[];for(c=0;c<B;c++)if(h=b[c],p=h.length,0!=p){for(n=0;1E6>n;n++){var I=[];p=h.length;h[p-1].X!=h[0].X||h[p-1].Y!=h[0].Y?(t=1,h.push({X:h[0].X,Y:h[0].Y}),p=h.length):t=0;var K=[];for(d=0;d<p-2;d++){var ia=h[d];var O=h[d+1];var T=h[d+2];var X=ia.X;var Wa=ia.Y;ia=T.X-X;var ba=T.Y-Wa;if(0!==ia||0!==ba){var db=((O.X-X)*ia+(O.Y-Wa)*ba)/(ia*ia+ba*ba);1<db?(X=
+T.X,Wa=T.Y):0<db&&(X+=ia*db,Wa+=ba*db)}ia=O.X-X;ba=O.Y-Wa;T=ia*ia+ba*ba;T<=F&&(K[d+1]=1,d++)}I.push({X:h[0].X,Y:h[0].Y});for(d=1;d<p-1;d++)K[d]||I.push({X:h[d].X,Y:h[d].Y});I.push({X:h[p-1].X,Y:h[p-1].Y});t&&h.pop();if(K.length)h=I;else break}p=I.length;I[p-1].X==I[0].X&&I[p-1].Y==I[0].Y&&I.pop();2<I.length&&G.push(I)}b[0]instanceof Array||(G=G[0]);"undefined"==typeof G&&(G=[[]]);return G};f.JS.PerimeterOfPath=function(b,c,d){if("undefined"==typeof b)return 0;var f=Math.sqrt,k=0,h=b.length;if(2>h)return 0;
+for(c&&(b[h]=b[0],h++);--h;){var n=b[h];var p=n.X;n=n.Y;var t=b[h-1];var B=t.X;t=t.Y;k+=f((p-B)*(p-B)+(n-t)*(n-t))}c&&b.pop();return k/d};f.JS.PerimeterOfPaths=function(b,c,d){d||(d=1);for(var k=0,h=0;h<b.length;h++)k+=f.JS.PerimeterOfPath(b[h],c,d);return k};f.JS.ScaleDownPath=function(b,c){var d;c||(c=1);for(d=b.length;d--;){var f=b[d];f.X/=c;f.Y/=c}};f.JS.ScaleDownPaths=function(b,c){var d,f;c||(c=1);for(d=b.length;d--;)for(f=b[d].length;f--;){var h=b[d][f];h.X/=c;h.Y/=c}};f.JS.ScaleUpPath=function(b,
+c){var d,f=Math.round;c||(c=1);for(d=b.length;d--;){var h=b[d];h.X=f(h.X*c);h.Y=f(h.Y*c)}};f.JS.ScaleUpPaths=function(b,c){var d,f,h=Math.round;c||(c=1);for(d=b.length;d--;)for(f=b[d].length;f--;){var n=b[d][f];n.X=h(n.X*c);n.Y=h(n.Y*c)}};f.ExPolygons=function(){return[]};f.ExPolygon=function(){this.holes=this.outer=null};f.JS.AddOuterPolyNodeToExPolygons=function(b,c){var d=new f.ExPolygon;d.outer=b.Contour();b=b.Childs();var h=b.length;d.holes=Array(h);var n,p;for(n=0;n<h;n++){var t=b[n];d.holes[n]=
+t.Contour();var B=0;var F=t.Childs();for(p=F.length;B<p;B++)t=F[B],f.JS.AddOuterPolyNodeToExPolygons(t,c)}c.push(d)};f.JS.ExPolygonsToPaths=function(b){var c,d,h=new f.Paths;var n=0;for(c=b.length;n<c;n++){h.push(b[n].outer);var p=0;for(d=b[n].holes.length;p<d;p++)h.push(b[n].holes[p])}return h};f.JS.PolyTreeToExPolygons=function(b){var c=new f.ExPolygons,d;var h=0;var n=b.Childs();for(d=n.length;h<d;h++)b=n[h],f.JS.AddOuterPolyNodeToExPolygons(b,c);return c}})();
+(function(d,n){"function"===typeof define&&define.amd?define(n):"object"===typeof exports?module.exports=n():d.returnExports=n()})(this,function(){var d=Function.call.bind(Function.apply),n=Function.call.bind(Function.call),t=Array.isArray,G=Object.keys,B=function(b){try{return b(),!1}catch(Ka){return!0}},I=function(b){try{return b()}catch(Ka){return!1}},O=function(b){return function(){return!d(b,this,arguments)}}(B),h=function(){return!B(function(){return Object.defineProperty({},"x",{get:function(){}})})},
+X=!!Object.defineProperty&&h(),p="foo"===function(){}.name,ia=Function.call.bind(Array.prototype.forEach),Wa=Function.call.bind(Array.prototype.reduce),nc=Function.call.bind(Array.prototype.filter),db=Function.call.bind(Array.prototype.some),K=function(b,c,g,d){!d&&c in b||(X?Object.defineProperty(b,c,{configurable:!0,enumerable:!1,writable:!0,value:g}):b[c]=g)},ta=function(b,c,g){ia(G(c),function(d){K(b,d,c[d],!!g)})},Na=Function.call.bind(Object.prototype.toString),f="function"===typeof/abc/?function(b){return"function"===
+typeof b&&"[object Function]"===Na(b)}:function(b){return"function"===typeof b},ba={getter:function(b,c,g){if(!X)throw new TypeError("getters require true ES5 support");Object.defineProperty(b,c,{configurable:!0,enumerable:!1,get:g})},proxy:function(b,c,g){if(!X)throw new TypeError("getters require true ES5 support");var d=Object.getOwnPropertyDescriptor(b,c);Object.defineProperty(g,c,{configurable:d.configurable,enumerable:d.enumerable,get:function(){return b[c]},set:function(g){b[c]=g}})},redefine:function(b,
+c,g){if(X){var d=Object.getOwnPropertyDescriptor(b,c);d.value=g;Object.defineProperty(b,c,d)}else b[c]=g},defineByDescriptor:function(b,c,g){X?Object.defineProperty(b,c,g):"value"in g&&(b[c]=g.value)},preserveToString:function(b,c){c&&f(c.toString)&&K(b,"toString",c.toString.bind(c),!0)}},ua=Object.create||function(b,c){var g=function(){};g.prototype=b;var d=new g;"undefined"!==typeof c&&G(c).forEach(function(b){ba.defineByDescriptor(d,b,c[b])});return d},va=function(b,c){return Object.setPrototypeOf?
+I(function(){var g=function L(c){c=new b(c);Object.setPrototypeOf(c,L.prototype);return c};Object.setPrototypeOf(g,b);g.prototype=ua(b.prototype,{constructor:{value:g}});return c(g)}):!1},F=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof global)return global;throw Error("unable to locate global object");}(),ub=F.isFinite,Wb=Function.call.bind(String.prototype.indexOf),Ab=Function.apply.bind(Array.prototype.indexOf),Bb=Function.call.bind(Array.prototype.concat),
+zb=Function.call.bind(String.prototype.slice),Xa=Function.call.bind(Array.prototype.push),Oa=Function.apply.bind(Array.prototype.push),T=Function.call.bind(Array.prototype.shift),Gb=Math.max,b=Math.min,c=Math.floor,k=Math.abs,U=Math.exp,ca=Math.log,Z=Math.sqrt,J=Function.call.bind(Object.prototype.hasOwnProperty),Xb=function(){},Ga=F.Map,gd=Ga&&Ga.prototype["delete"],da=Ga&&Ga.prototype.get,Fb=Ga&&Ga.prototype.has,oc=Ga&&Ga.prototype.set,oa=F.Symbol||{},pc=oa.species||"@@species",Sa=Number.isNaN||
+function(b){return b!==b},Ic=Number.isFinite||function(b){return"number"===typeof b&&ub(b)},Yb=f(Math.sign)?Math.sign:function(b){b=Number(b);return 0===b||Sa(b)?b:0>b?-1:1},Hb=function(b){b=Number(b);return-1>b||Sa(b)?NaN:0===b||Infinity===b?b:-1===b?-Infinity:0===1+b-1?b:b*(ca(1+b)/(1+b-1))},hd=function(b){return"[object Arguments]"===Na(b)},Hd=function(b){return null!==b&&"object"===typeof b&&"number"===typeof b.length&&0<=b.length&&"[object Array]"!==Na(b)&&"[object Function]"===Na(b.callee)},
+Jc=hd(arguments)?hd:Hd,Da={primitive:function(b){return null===b||"function"!==typeof b&&"object"!==typeof b},string:function(b){return"[object String]"===Na(b)},regex:function(b){return"[object RegExp]"===Na(b)},symbol:function(b){return"function"===typeof F.Symbol&&"symbol"===typeof b}},R=function(b,c,g){var d=b[c];K(b,c,g,!0);ba.preserveToString(b[c],d)},qc="function"===typeof oa&&"function"===typeof oa["for"]&&Da.symbol(oa()),eb=Da.symbol(oa.iterator)?oa.iterator:"_es6-shim iterator_";F.Set&&
+"function"===typeof(new F.Set)["@@iterator"]&&(eb="@@iterator");F.Reflect||K(F,"Reflect",{},!0);var Ib=F.Reflect,Kc=String,Lc="undefined"!==typeof document&&document?document.all:null,rb=null==Lc?function(b){return null==b}:function(b){return null==b&&b!==Lc},A={Call:function(b,c){var g=2<arguments.length?arguments[2]:[];if(!A.IsCallable(b))throw new TypeError(b+" is not a function");return d(b,c,g)},RequireObjectCoercible:function(b,c){if(rb(b))throw new TypeError(c||"Cannot call method on "+b);
+return b},TypeIsObject:function(b){return void 0===b||null===b||!0===b||!1===b?!1:"function"===typeof b||"object"===typeof b||b===Lc},ToObject:function(b,c){return Object(A.RequireObjectCoercible(b,c))},IsCallable:f,IsConstructor:function(b){return A.IsCallable(b)},ToInt32:function(b){return A.ToNumber(b)>>0},ToUint32:function(b){return A.ToNumber(b)>>>0},ToNumber:function(b){if("[object Symbol]"===Na(b))throw new TypeError("Cannot convert a Symbol value to a number");return+b},ToInteger:function(b){b=
+A.ToNumber(b);return Sa(b)?0:0!==b&&Ic(b)?(0<b?1:-1)*c(k(b)):b},ToLength:function(b){b=A.ToInteger(b);return 0>=b?0:b>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:b},SameValue:function(b,c){return b===c?0===b?1/b===1/c:!0:Sa(b)&&Sa(c)},SameValueZero:function(b,c){return b===c||Sa(b)&&Sa(c)},IsIterable:function(b){return A.TypeIsObject(b)&&("undefined"!==typeof b[eb]||Jc(b))},GetIterator:function(b){if(Jc(b))return new Pa(b,"value");var c=A.GetMethod(b,eb);if(!A.IsCallable(c))throw new TypeError("value is not an iterable");
+b=A.Call(c,b);if(!A.TypeIsObject(b))throw new TypeError("bad iterator");return b},GetMethod:function(b,c){b=A.ToObject(b)[c];if(!rb(b)){if(!A.IsCallable(b))throw new TypeError("Method not callable: "+c);return b}},IteratorComplete:function(b){return!!b.done},IteratorClose:function(b,c){var g=A.GetMethod(b,"return");if(void 0!==g){try{var d=A.Call(g,b)}catch(L){var f=L}if(!c){if(f)throw f;if(!A.TypeIsObject(d))throw new TypeError("Iterator's return method returned a non-object.");}}},IteratorNext:function(b){var c=
+1<arguments.length?b.next(arguments[1]):b.next();if(!A.TypeIsObject(c))throw new TypeError("bad iterator");return c},IteratorStep:function(b){b=A.IteratorNext(b);return A.IteratorComplete(b)?!1:b},Construct:function(b,c,g,d){g="undefined"===typeof g?b:g;if(!d&&Ib.construct)return Ib.construct(b,c,g);d=g.prototype;A.TypeIsObject(d)||(d=Object.prototype);d=ua(d);b=A.Call(b,d,c);return A.TypeIsObject(b)?b:d},SpeciesConstructor:function(b,c){b=b.constructor;if(void 0===b)return c;if(!A.TypeIsObject(b))throw new TypeError("Bad constructor");
+b=b[pc];if(rb(b))return c;if(!A.IsConstructor(b))throw new TypeError("Bad @@species");return b},CreateHTML:function(b,c,g,d){b=A.ToString(b);var f="<"+c;""!==g&&(d=A.ToString(d).replace(/"/g,"&quot;"),f+=" "+g+'="'+d+'"');return f+">"+b+"</"+c+">"},IsRegExp:function(b){if(!A.TypeIsObject(b))return!1;var c=b[oa.match];return"undefined"!==typeof c?!!c:Da.regex(b)},ToString:function(b){return Kc(b)}};if(X&&qc){var Zb=function(b){if(Da.symbol(oa[b]))return oa[b];var c=oa["for"]("Symbol."+b);Object.defineProperty(oa,
+b,{configurable:!1,enumerable:!1,writable:!1,value:c});return c};if(!Da.symbol(oa.search)){var Id=Zb("search"),dc=String.prototype.search;K(RegExp.prototype,Id,function(b){return A.Call(dc,b,[this])});R(String.prototype,"search",function(b){var c=A.RequireObjectCoercible(this);if(!rb(b)){var g=A.GetMethod(b,Id);if("undefined"!==typeof g)return A.Call(g,b,[c])}return A.Call(dc,c,[A.ToString(b)])})}if(!Da.symbol(oa.replace)){var id=Zb("replace"),Ya=String.prototype.replace;K(RegExp.prototype,id,function(b,
+c){return A.Call(Ya,b,[this,c])});R(String.prototype,"replace",function(b,c){var g=A.RequireObjectCoercible(this);if(!rb(b)){var d=A.GetMethod(b,id);if("undefined"!==typeof d)return A.Call(d,b,[g,c])}return A.Call(Ya,g,[A.ToString(b),c])})}if(!Da.symbol(oa.split)){var Jb=Zb("split"),jd=String.prototype.split;K(RegExp.prototype,Jb,function(b,c){return A.Call(jd,b,[this,c])});R(String.prototype,"split",function(b,c){var g=A.RequireObjectCoercible(this);if(!rb(b)){var d=A.GetMethod(b,Jb);if("undefined"!==
+typeof d)return A.Call(d,b,[g,c])}return A.Call(jd,g,[A.ToString(b),c])})}var xa=Da.symbol(oa.match),$b=xa&&function(){var b={};b[oa.match]=function(){return 42};return 42!=="a".match(b)}();if(!xa||$b){var rc=Zb("match"),kd=String.prototype.match;K(RegExp.prototype,rc,function(b){return A.Call(kd,b,[this])});R(String.prototype,"match",function(b){var c=A.RequireObjectCoercible(this);if(!rb(b)){var g=A.GetMethod(b,rc);if("undefined"!==typeof g)return A.Call(g,b,[c])}return A.Call(kd,c,[A.ToString(b)])})}}var ld=
+function(b,c,g){ba.preserveToString(c,b);Object.setPrototypeOf&&Object.setPrototypeOf(b,c);X?ia(Object.getOwnPropertyNames(b),function(d){d in Xb||g[d]||ba.proxy(b,d,c)}):ia(Object.keys(b),function(d){d in Xb||g[d]||(c[d]=b[d])});c.prototype=b.prototype;ba.redefine(b.prototype,"constructor",c)},sc=function(){return this},w=function(b){X&&!J(b,pc)&&ba.getter(b,pc,sc)},D=function(b,c){c=c||function(){return this};K(b,eb,c);!b[eb]&&Da.symbol(eb)&&(b[eb]=c)},Q=function(b,c,g){X?Object.defineProperty(b,
+c,{configurable:!0,enumerable:!0,writable:!0,value:g}):b[c]=g;if(!A.SameValue(b[c],g))throw new TypeError("property is nonconfigurable");},lb=function(b,c,g,d){if(!A.TypeIsObject(b))throw new TypeError("Constructor requires `new`: "+c.name);b=c.prototype;A.TypeIsObject(b)||(b=g);g=ua(b);for(var f in d)J(d,f)&&K(g,f,d[f],!0);return g};if(String.fromCodePoint&&1!==String.fromCodePoint.length){var le=String.fromCodePoint;R(String,"fromCodePoint",function(b){return A.Call(le,this,arguments)})}var sa=
+{fromCodePoint:function(b){for(var c=[],g,d=0,f=arguments.length;d<f;d++){g=Number(arguments[d]);if(!A.SameValue(g,A.ToInteger(g))||0>g||1114111<g)throw new RangeError("Invalid code point "+g);65536>g?Xa(c,String.fromCharCode(g)):(g-=65536,Xa(c,String.fromCharCode((g>>10)+55296)),Xa(c,String.fromCharCode(g%1024+56320)))}return c.join("")},raw:function(b){var c=A.ToObject(b,"bad callSite");c=A.ToObject(c.raw,"bad raw value");var g=A.ToLength(c.length);if(0>=g)return"";for(var d=[],f=0,h;f<g;){h=A.ToString(f);
+h=A.ToString(c[h]);Xa(d,h);if(f+1>=g)break;h=f+1<arguments.length?arguments[f+1]:"";h=A.ToString(h);Xa(d,h);f+=1}return d.join("")}};String.raw&&"xy"!==String.raw({raw:{0:"x",1:"y",length:2}})&&R(String,"raw",sa.raw);ta(String,sa);var Jd=function q(b,c){if(1>c)return"";if(c%2)return q(b,c-1)+b;b=q(b,c/2);return b+b},Kb={repeat:function(b){var c=A.ToString(A.RequireObjectCoercible(this));b=A.ToInteger(b);if(0>b||Infinity<=b)throw new RangeError("repeat count must be less than infinity and not overflow maximum string size");
+return Jd(c,b)},startsWith:function(b){var c=A.ToString(A.RequireObjectCoercible(this));if(A.IsRegExp(b))throw new TypeError('Cannot call method "startsWith" with a regex');var g=A.ToString(b),d;1<arguments.length&&(d=arguments[1]);d=Gb(A.ToInteger(d),0);return zb(c,d,d+g.length)===g},endsWith:function(c){var g=A.ToString(A.RequireObjectCoercible(this));if(A.IsRegExp(c))throw new TypeError('Cannot call method "endsWith" with a regex');var d=A.ToString(c),f=g.length,h;1<arguments.length&&(h=arguments[1]);
+h="undefined"===typeof h?f:A.ToInteger(h);f=b(Gb(h,0),f);return zb(g,f-d.length,f)===d},includes:function(b){if(A.IsRegExp(b))throw new TypeError('"includes" does not accept a RegExp');var c=A.ToString(b),g;1<arguments.length&&(g=arguments[1]);return-1!==Wb(this,c,g)},codePointAt:function(b){var c=A.ToString(A.RequireObjectCoercible(this)),g=A.ToInteger(b),d=c.length;if(0<=g&&g<d){b=c.charCodeAt(g);if(55296>b||56319<b||g+1===d)return b;c=c.charCodeAt(g+1);return 56320>c||57343<c?b:1024*(b-55296)+
+(c-56320)+65536}}};String.prototype.includes&&!1!=="a".includes("a",Infinity)&&R(String.prototype,"includes",Kb.includes);if(String.prototype.startsWith&&String.prototype.endsWith){var Kd=B(function(){return"/a/".startsWith(/a/)}),me=I(function(){return!1==="abc".startsWith("a",Infinity)});Kd&&me||(R(String.prototype,"startsWith",Kb.startsWith),R(String.prototype,"endsWith",Kb.endsWith))}qc&&(I(function(){var b=/a/;b[oa.match]=!1;return"/a/".startsWith(b)})||R(String.prototype,"startsWith",Kb.startsWith),
+I(function(){var b=/a/;b[oa.match]=!1;return"/a/".endsWith(b)})||R(String.prototype,"endsWith",Kb.endsWith),I(function(){var b=/a/;b[oa.match]=!1;return"/a/".includes(b)})||R(String.prototype,"includes",Kb.includes));ta(String.prototype,Kb);var ne=/(^[\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]+)|([\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]+$)/g,
+tc=function(){return A.ToString(A.RequireObjectCoercible(this)).replace(ne,"")},Ld=/[\u0085\u200b\ufffe]/g,Lb=/^[-+]0x[0-9a-f]+$/i;K(String.prototype,"trim",tc,!0);var Mb=function(b){return{value:b,done:0===arguments.length}},Mc=function(b){A.RequireObjectCoercible(b);this._s=A.ToString(b);this._i=0};Mc.prototype.next=function(){var b=this._s,c=this._i;if("undefined"===typeof b||c>=b.length)return this._s=void 0,Mb();var g=b.charCodeAt(c);55296>g||56319<g||c+1===b.length?g=1:(g=b.charCodeAt(c+1),
+g=56320>g||57343<g?1:2);this._i=c+g;return Mb(b.substr(c,g))};D(Mc.prototype);D(String.prototype,function(){return new Mc(this)});var Nb={from:function(b){var c;1<arguments.length&&(c=arguments[1]);var g;if("undefined"===typeof c)var d=!1;else{if(!A.IsCallable(c))throw new TypeError("Array.from: when provided, the second argument must be a function");2<arguments.length&&(g=arguments[2]);d=!0}var f;if("undefined"!==typeof(Jc(b)||A.GetMethod(b,eb))){var h=A.IsConstructor(this)?Object(new this):[];var k=
+A.GetIterator(b);for(f=0;;){var l=A.IteratorStep(k);if(!1===l)break;l=l.value;try{d&&(l="undefined"===typeof g?c(l,f):n(c,g,l,f)),h[f]=l}catch(Oc){throw A.IteratorClose(k,!0),Oc;}f+=1}k=f}else for(l=A.ToObject(b),k=A.ToLength(l.length),h=A.IsConstructor(this)?Object(new this(k)):Array(k),f=0;f<k;++f){var Ka=l[f];d&&(Ka="undefined"===typeof g?c(Ka,f):n(c,g,Ka,f));Q(h,f,Ka)}h.length=k;return h},of:function(){for(var b=arguments.length,c=t(this)||!A.IsCallable(this)?Array(b):A.Construct(this,[b]),g=
+0;g<b;++g)Q(c,g,arguments[g]);c.length=b;return c}};ta(Array,Nb);w(Array);var Pa=function(b,c){this.i=0;this.array=b;this.kind=c};ta(Pa.prototype,{next:function(){var b=this.i,c=this.array;if(!(this instanceof Pa))throw new TypeError("Not an ArrayIterator");if("undefined"!==typeof c)for(var g=A.ToLength(c.length);b<g;){g=this.kind;var d;"key"===g?d=b:"value"===g?d=c[b]:"entry"===g&&(d=[b,c[b]]);this.i=b+1;return Mb(d)}this.array=void 0;return Mb()}});D(Pa.prototype);Array.of===Nb.of||function(){var b=
+function(b){this.length=b};b.prototype=[];var c=Array.of.apply(b,[1,2]);return c instanceof b&&2===c.length}()||R(Array,"of",Nb.of);var Ob={copyWithin:function(c,g){var d=A.ToObject(this),f=A.ToLength(d.length),h=A.ToInteger(c),k=A.ToInteger(g);h=0>h?Gb(f+h,0):b(h,f);k=0>k?Gb(f+k,0):b(k,f);var l;2<arguments.length&&(l=arguments[2]);l="undefined"===typeof l?f:A.ToInteger(l);l=0>l?Gb(f+l,0):b(l,f);f=b(l-k,f-h);l=1;k<h&&h<k+f&&(l=-1,k+=f-1,h+=f-1);for(;0<f;)k in d?d[h]=d[k]:delete d[h],k+=l,h+=l,--f;
+return d},fill:function(c){var g;1<arguments.length&&(g=arguments[1]);var d;2<arguments.length&&(d=arguments[2]);var f=A.ToObject(this),h=A.ToLength(f.length);g=A.ToInteger("undefined"===typeof g?0:g);d=A.ToInteger("undefined"===typeof d?h:d);g=0>g?Gb(h+g,0):b(g,h);for(d=0>d?h+d:d;g<h&&g<d;++g)f[g]=c;return f},find:function(b){var c=A.ToObject(this),g=A.ToLength(c.length);if(!A.IsCallable(b))throw new TypeError("Array#find: predicate must be a function");for(var d=1<arguments.length?arguments[1]:
+null,f=0,h;f<g;f++)if(h=c[f],d){if(n(b,d,h,f,c))return h}else if(b(h,f,c))return h},findIndex:function(b){var c=A.ToObject(this),g=A.ToLength(c.length);if(!A.IsCallable(b))throw new TypeError("Array#findIndex: predicate must be a function");for(var d=1<arguments.length?arguments[1]:null,f=0;f<g;f++)if(d){if(n(b,d,c[f],f,c))return f}else if(b(c[f],f,c))return f;return-1},keys:function(){return new Pa(this,"key")},values:function(){return new Pa(this,"value")},entries:function(){return new Pa(this,
+"entry")}};Array.prototype.keys&&!A.IsCallable([1].keys().next)&&delete Array.prototype.keys;Array.prototype.entries&&!A.IsCallable([1].entries().next)&&delete Array.prototype.entries;Array.prototype.keys&&Array.prototype.entries&&!Array.prototype.values&&Array.prototype[eb]&&(ta(Array.prototype,{values:Array.prototype[eb]}),Da.symbol(oa.unscopables)&&(Array.prototype[oa.unscopables].values=!0));if(p&&Array.prototype.values&&"values"!==Array.prototype.values.name){var nd=Array.prototype.values;R(Array.prototype,
+"values",function(){return A.Call(nd,this,arguments)});K(Array.prototype,eb,Array.prototype.values,!0)}ta(Array.prototype,Ob);0>1/[!0].indexOf(!0,-0)&&K(Array.prototype,"indexOf",function(b){var c=Ab(this,arguments);return 0===c&&0>1/c?0:c},!0);D(Array.prototype,function(){return this.values()});Object.getPrototypeOf&&D(Object.getPrototypeOf([].values()));var Md=function(){return I(function(){return 0===Array.from({length:-1}).length})}(),Nd=function(){var b=Array.from([0].entries());return 1===b.length&&
+t(b[0])&&0===b[0][0]&&0===b[0][1]}();Md&&Nd||R(Array,"from",Nb.from);if(!function(){return I(function(){return Array.from([0],void 0)})}()){var Pc=Array.from;R(Array,"from",function(b){return 1<arguments.length&&"undefined"!==typeof arguments[1]?A.Call(Pc,this,arguments):n(Pc,this,b)})}var ac=-(Math.pow(2,32)-1),Pb=function(b,c){var g={length:ac};g[c?(g.length>>>0)-1:0]=!0;return I(function(){n(b,g,function(){throw new RangeError("should not reach here");},[]);return!0})};if(!Pb(Array.prototype.forEach)){var Od=
+Array.prototype.forEach;R(Array.prototype,"forEach",function(b){return A.Call(Od,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.map)){var ec=Array.prototype.map;R(Array.prototype,"map",function(b){return A.Call(ec,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.filter)){var Qc=Array.prototype.filter;R(Array.prototype,"filter",function(b){return A.Call(Qc,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.some)){var oe=Array.prototype.some;R(Array.prototype,
+"some",function(b){return A.Call(oe,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.every)){var pe=Array.prototype.every;R(Array.prototype,"every",function(b){return A.Call(pe,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.reduce)){var Pd=Array.prototype.reduce;R(Array.prototype,"reduce",function(b){return A.Call(Pd,0<=this.length?this:[],arguments)},!0)}if(!Pb(Array.prototype.reduceRight,!0)){var Qd=Array.prototype.reduceRight;R(Array.prototype,"reduceRight",function(b){return A.Call(Qd,
+0<=this.length?this:[],arguments)},!0)}var fc=8!==Number("0o10"),Rd=2!==Number("0b10"),Sd=db("\u0085\u200b\ufffe",function(b){return 0===Number(b+0+b)});if(fc||Rd||Sd){var vb=Number,Za=/^0b[01]+$/i,od=/^0o[0-7]+$/i,Rc=Za.test.bind(Za),qe=od.test.bind(od),Td=function(b){if("function"===typeof b.valueOf){var c=b.valueOf();if(Da.primitive(c))return c}if("function"===typeof b.toString&&(c=b.toString(),Da.primitive(c)))return c;throw new TypeError("No default value");},pd=Ld.test.bind(Ld),Ud=Lb.test.bind(Lb),
+Sc=function(){var b=function(c){var g=0<arguments.length?Da.primitive(c)?c:Td(c,"number"):0;if("string"===typeof g)if(g=A.Call(tc,g),Rc(g))g=parseInt(zb(g,2),2);else if(qe(g))g=parseInt(zb(g,2),8);else if(pd(g)||Ud(g))g=NaN;var d=this,f=I(function(){vb.prototype.valueOf.call(d);return!0});return d instanceof b&&!f?new vb(g):vb(g)};return b}();ld(vb,Sc,{});ta(Sc,{NaN:vb.NaN,MAX_VALUE:vb.MAX_VALUE,MIN_VALUE:vb.MIN_VALUE,NEGATIVE_INFINITY:vb.NEGATIVE_INFINITY,POSITIVE_INFINITY:vb.POSITIVE_INFINITY});
+Number=Sc;ba.redefine(F,"Number",Sc)}var Vd=Math.pow(2,53)-1;ta(Number,{MAX_SAFE_INTEGER:Vd,MIN_SAFE_INTEGER:-Vd,EPSILON:2.220446049250313E-16,parseInt:F.parseInt,parseFloat:F.parseFloat,isFinite:Ic,isInteger:function(b){return Ic(b)&&A.ToInteger(b)===b},isSafeInteger:function(b){return Number.isInteger(b)&&k(b)<=Number.MAX_SAFE_INTEGER},isNaN:Sa});K(Number,"parseInt",F.parseInt,Number.parseInt!==F.parseInt);1===[,1].find(function(){return!0})&&R(Array.prototype,"find",Ob.find);0!==[,1].findIndex(function(){return!0})&&
+R(Array.prototype,"findIndex",Ob.findIndex);var Cb=Function.bind.call(Function.bind,Object.prototype.propertyIsEnumerable),Tc=function(b,c){X&&Cb(b,c)&&Object.defineProperty(b,c,{enumerable:!1})},gc=function(){var b=Number(this),c=arguments.length,g=c-b;g=Array(0>g?0:g);for(var d=b;d<c;++d)g[d-b]=arguments[d];return g},uc=function(b){return function(c,g){c[g]=b[g];return c}},Wd=function(b,c){var g=G(Object(c)),d;A.IsCallable(Object.getOwnPropertySymbols)&&(d=nc(Object.getOwnPropertySymbols(Object(c)),
+Cb(c)));return Wa(Bb(g,d||[]),uc(c),b)},Xd={assign:function(b,c){var g=A.ToObject(b,"Cannot convert undefined or null to object");return Wa(A.Call(gc,1,arguments),Wd,g)},is:function(b,c){return A.SameValue(b,c)}};Object.assign&&Object.preventExtensions&&function(){var b=Object.preventExtensions({1:2});try{Object.assign(b,"xy")}catch(S){return"y"===b[1]}}()&&R(Object,"assign",Xd.assign);ta(Object,Xd);if(X){var Ta={setPrototypeOf:function(b,c){var g=function(b,c){if(!A.TypeIsObject(b))throw new TypeError("cannot set prototype on a non-object");
+if(null!==c&&!A.TypeIsObject(c))throw new TypeError("can only set prototype to an object or null"+c);n(d,b,c);return b};try{var d=b.getOwnPropertyDescriptor(b.prototype,c).set;n(d,{},null)}catch(L){if(b.prototype!=={}[c])return;d=function(b){this[c]=b};g.polyfill=g(g({},null),b.prototype)instanceof b}return g}(Object,"__proto__")};ta(Object,Ta)}Object.setPrototypeOf&&Object.getPrototypeOf&&null!==Object.getPrototypeOf(Object.setPrototypeOf({},null))&&null===Object.getPrototypeOf(Object.create(null))&&
+function(){var b=Object.create(null),c=Object.getPrototypeOf,g=Object.setPrototypeOf;Object.getPrototypeOf=function(g){g=c(g);return g===b?null:g};Object.setPrototypeOf=function(c,d){return g(c,null===d?b:d)};Object.setPrototypeOf.polyfill=!1}();if(B(function(){return Object.keys("foo")})){var Yd=Object.keys;R(Object,"keys",function(b){return Yd(A.ToObject(b))});G=Object.keys}if(B(function(){return Object.keys(/a/g)})){var Zd=Object.keys;R(Object,"keys",function(b){if(Da.regex(b)){var c=[],g;for(g in b)J(b,
+g)&&Xa(c,g);return c}return Zd(b)});G=Object.keys}if(Object.getOwnPropertyNames&&B(function(){return Object.getOwnPropertyNames("foo")})){var $d="object"===typeof window?Object.getOwnPropertyNames(window):[],ae=Object.getOwnPropertyNames;R(Object,"getOwnPropertyNames",function(b){b=A.ToObject(b);if("[object Window]"===Na(b))try{return ae(b)}catch(S){return Bb([],$d)}return ae(b)})}if(Object.getOwnPropertyDescriptor&&B(function(){return Object.getOwnPropertyDescriptor("foo","bar")})){var re=Object.getOwnPropertyDescriptor;
+R(Object,"getOwnPropertyDescriptor",function(b,c){return re(A.ToObject(b),c)})}if(Object.seal&&B(function(){return Object.seal("foo")})){var hc=Object.seal;R(Object,"seal",function(b){return A.TypeIsObject(b)?hc(b):b})}if(Object.isSealed&&B(function(){return Object.isSealed("foo")})){var ha=Object.isSealed;R(Object,"isSealed",function(b){return A.TypeIsObject(b)?ha(b):!0})}if(Object.freeze&&B(function(){return Object.freeze("foo")})){var wb=Object.freeze;R(Object,"freeze",function(b){return A.TypeIsObject(b)?
+wb(b):b})}if(Object.isFrozen&&B(function(){return Object.isFrozen("foo")})){var ea=Object.isFrozen;R(Object,"isFrozen",function(b){return A.TypeIsObject(b)?ea(b):!0})}if(Object.preventExtensions&&B(function(){return Object.preventExtensions("foo")})){var mb=Object.preventExtensions;R(Object,"preventExtensions",function(b){return A.TypeIsObject(b)?mb(b):b})}if(Object.isExtensible&&B(function(){return Object.isExtensible("foo")})){var qd=Object.isExtensible;R(Object,"isExtensible",function(b){return A.TypeIsObject(b)?
+qd(b):!1})}if(Object.getPrototypeOf&&B(function(){return Object.getPrototypeOf("foo")})){var rd=Object.getPrototypeOf;R(Object,"getPrototypeOf",function(b){return rd(A.ToObject(b))})}var se=X&&function(){var b=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags");return b&&A.IsCallable(b.get)}();X&&!se&&ba.getter(RegExp.prototype,"flags",function(){if(!A.TypeIsObject(this))throw new TypeError("Method called on incompatible type: must be an object.");var b="";this.global&&(b+="g");this.ignoreCase&&
+(b+="i");this.multiline&&(b+="m");this.unicode&&(b+="u");this.sticky&&(b+="y");return b});var be=X&&I(function(){return"/a/i"===String(new RegExp(/a/g,"i"))}),vc=qc&&X&&function(){var b=/./;b[oa.match]=!1;return RegExp(b)===b}(),qa=I(function(){return"/abc/"===RegExp.prototype.toString.call({source:"abc"})}),Qb=qa&&I(function(){return"/a/b"===RegExp.prototype.toString.call({source:"a",flags:"b"})});if(!qa||!Qb){var sd=RegExp.prototype.toString;K(RegExp.prototype,"toString",function(){var b=A.RequireObjectCoercible(this);
+if(Da.regex(b))return n(sd,b);var c=Kc(b.source);b=Kc(b.flags);return"/"+c+"/"+b},!0);ba.preserveToString(RegExp.prototype.toString,sd)}if(X&&(!be||vc)){var wc=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags").get,td=Object.getOwnPropertyDescriptor(RegExp.prototype,"source")||{},ce=function(){return this.source},de=A.IsCallable(td.get)?td.get:ce,Uc=RegExp,fb=function(){return function E(b,c){var g=A.IsRegExp(b);return this instanceof E||!g||"undefined"!==typeof c||b.constructor!==E?Da.regex(b)?
+(g=A.Call(de,b),b="undefined"===typeof c?A.Call(wc,b):c,new E(g,b)):new Uc(b,c):b}}();ld(Uc,fb,{$input:!0});RegExp=fb;ba.redefine(F,"RegExp",fb)}if(X){var ud={input:"$_",lastMatch:"$&",lastParen:"$+",leftContext:"$`",rightContext:"$'"};ia(G(ud),function(b){b in RegExp&&!(ud[b]in RegExp)&&ba.getter(RegExp,ud[b],function(){return RegExp[b]})})}w(RegExp);var Vc=1/Number.EPSILON,Wc=Math.pow(2,-23),te=Math.pow(2,127)*(2-Wc),vd=Math.pow(2,-126),Rb=Math.E,Ia=Math.LOG2E,Qa=Math.LOG10E,V=Number.prototype.clz;
+delete Number.prototype.clz;var Ba={acosh:function(b){var c=Number(b);if(Sa(c)||1>b)return NaN;if(1===c)return 0;if(Infinity===c)return c;b=1/(c*c);if(2>c)return Hb(c-1+Z(1-b)*c);c/=2;return Hb(c+Z(1-b)*c-1)+1/Ia},asinh:function(b){var c=Number(b);if(0===c||!ub(c))return c;b=k(c);var g=b*b;c=Yb(c);return 1>b?c*Hb(b+g/(Z(g+1)+1)):c*(Hb(b/2+Z(1+1/g)*b/2-1)+1/Ia)},atanh:function(b){b=Number(b);if(0===b)return b;if(-1===b)return-Infinity;if(1===b)return Infinity;if(Sa(b)||-1>b||1<b)return NaN;var c=k(b);
+return Yb(b)*Hb(2*c/(1-c))/2},cbrt:function(b){b=Number(b);if(0===b)return b;var c=0>b;c&&(b=-b);if(Infinity===b)var g=Infinity;else g=U(ca(b)/3),g=(b/(g*g)+2*g)/3;return c?-g:g},clz32:function(b){b=A.ToUint32(Number(b));return 0===b?32:V?A.Call(V,b):31-c(ca(b+.5)*Ia)},cosh:function(b){b=Number(b);if(0===b)return 1;if(Sa(b))return NaN;if(!ub(b))return Infinity;b=U(k(b)-1);return Rb/2*(b+1/(b*Rb*Rb))},expm1:function(b){b=Number(b);if(-Infinity===b)return-1;if(!ub(b)||0===b)return b;if(.5<k(b))return U(b)-
+1;for(var c=b,g=0,d=1;g+c!==g;)g+=c,d+=1,c*=b/d;return g},hypot:function(b,c){for(var g=0,d=0,f=0;f<arguments.length;++f){var h=k(Number(arguments[f]));d<h?(g*=d/h*(d/h),g+=1,d=h):g+=0<h?h/d*(h/d):h}return Infinity===d?Infinity:d*Z(g)},log2:function(b){return ca(b)*Ia},log10:function(b){return ca(b)*Qa},log1p:Hb,sign:Yb,sinh:function(b){b=Number(b);if(!ub(b)||0===b)return b;var c=k(b);if(1>c)return c=Math.expm1(c),Yb(b)*c*(1+1/(c+1))/2;c=U(c-1);return Yb(b)*(c-1/(c*Rb*Rb))*(Rb/2)},tanh:function(b){b=
+Number(b);return Sa(b)||0===b?b:20<=b?1:-20>=b?-1:(Math.expm1(b)-Math.expm1(-b))/(U(b)+U(-b))},trunc:function(b){b=Number(b);return 0>b?-c(-b):c(b)},imul:function(b,c){b=A.ToUint32(b);c=A.ToUint32(c);var g=b&65535,d=c&65535;return g*d+((b>>>16&65535)*d+g*(c>>>16&65535)<<16>>>0)|0},fround:function(b){var c=Number(b);if(0===c||Infinity===c||-Infinity===c||Sa(c))return c;b=Yb(c);c=k(c);if(c<vd)return b*(c/vd/Wc+Vc-Vc)*vd*Wc;var g=(1+Wc/Number.EPSILON)*c;c=g-(g-c);return c>te||Sa(c)?Infinity*b:b*c}};
+ta(Math,Ba);K(Math,"sinh",Ba.sinh,Infinity===Math.sinh(710));K(Math,"cosh",Ba.cosh,Infinity===Math.cosh(710));K(Math,"log1p",Ba.log1p,-1E-17!==Math.log1p(-1E-17));K(Math,"asinh",Ba.asinh,Math.asinh(-1E7)!==-Math.asinh(1E7));K(Math,"asinh",Ba.asinh,Infinity===Math.asinh(1E300));K(Math,"atanh",Ba.atanh,0===Math.atanh(1E-300));K(Math,"tanh",Ba.tanh,-2E-17!==Math.tanh(-2E-17));K(Math,"acosh",Ba.acosh,Infinity===Math.acosh(Number.MAX_VALUE));K(Math,"acosh",Ba.acosh,!(8>k(1-Math.acosh(1+Number.EPSILON)/
+Math.sqrt(2*Number.EPSILON))/Number.EPSILON));K(Math,"cbrt",Ba.cbrt,!(8>k(1-Math.cbrt(1E-300)/1E-100)/Number.EPSILON));K(Math,"sinh",Ba.sinh,-2E-17!==Math.sinh(-2E-17));var xc=Math.expm1(10);K(Math,"expm1",Ba.expm1,22025.465794806718<xc||22025.465794806718>xc);var yc=Math.round,ee=0===Math.round(.5-Number.EPSILON/4)&&1===Math.round(-.5+Number.EPSILON/3.99),wd=[Vc+1,2*Vc-1].every(function(b){return Math.round(b)===b});K(Math,"round",function(b){var g=c(b);return.5>b-g?g:-1===g?-0:g+1},!ee||!wd);ba.preserveToString(Math.round,
+yc);var zc=Math.imul;-5!==Math.imul(4294967295,5)&&(Math.imul=Ba.imul,ba.preserveToString(Math.imul,zc));2!==Math.imul.length&&R(Math,"imul",function(b,c){return A.Call(zc,Math,arguments)});var Bc=function(){var b=F.setTimeout;if("function"===typeof b||"object"===typeof b){A.IsPromise=function(b){return A.TypeIsObject(b)&&"undefined"!==typeof b._promise?!0:!1};var c=function(b){if(!A.IsConstructor(b))throw new TypeError("Bad promise constructor");var c=this;c.resolve=void 0;c.reject=void 0;c.promise=
+new b(function(b,g){if(void 0!==c.resolve||void 0!==c.reject)throw new TypeError("Bad Promise implementation!");c.resolve=b;c.reject=g});if(!A.IsCallable(c.resolve)||!A.IsCallable(c.reject))throw new TypeError("Bad promise constructor");},g;"undefined"!==typeof window&&A.IsCallable(window.postMessage)&&(g=function(){var b=[];window.addEventListener("message",function(c){c.source===window&&"zero-timeout-message"===c.data&&(c.stopPropagation(),0!==b.length&&T(b)())},!0);return function(c){Xa(b,c);window.postMessage("zero-timeout-message",
+"*")}});var d=function(){var b=F.Promise,c=b&&b.resolve&&b.resolve();return c&&function(b){return c.then(b)}},f=A.IsCallable(F.setImmediate)?F.setImmediate:"object"===typeof process&&process.nextTick?process.nextTick:d()||(A.IsCallable(g)?g():function(c){b(c,0)}),h=function(b){return b},k=function(b){throw b;},l={},p=function(b,c,g){f(function(){if(c===l)b(g);else{try{var d=b(g);var f=c.resolve}catch(Xc){d=Xc,f=c.reject}f(d)}})},r=function(b,c){var g=b._promise,d=g.reactionLength;if(0<d&&(p(g.fulfillReactionHandler0,
+g.reactionCapability0,c),g.fulfillReactionHandler0=void 0,g.rejectReactions0=void 0,g.reactionCapability0=void 0,1<d))for(var f=1,h=0;f<d;f++,h+=3)p(g[h+0],g[h+2],c),b[h+0]=void 0,b[h+1]=void 0,b[h+2]=void 0;g.result=c;g.state=1;g.reactionLength=0},t=function(b,c){var g=b._promise,d=g.reactionLength;if(0<d&&(p(g.rejectReactionHandler0,g.reactionCapability0,c),g.fulfillReactionHandler0=void 0,g.rejectReactions0=void 0,g.reactionCapability0=void 0,1<d))for(var f=1,h=0;f<d;f++,h+=3)p(g[h+1],g[h+2],c),
+b[h+0]=void 0,b[h+1]=void 0,b[h+2]=void 0;g.result=c;g.state=2;g.reactionLength=0},w=function(b){var c=!1;return{resolve:function(g){if(!c){c=!0;if(g===b)return t(b,new TypeError("Self resolution"));if(!A.TypeIsObject(g))return r(b,g);try{var d=g.then}catch(Ua){return t(b,Ua)}if(!A.IsCallable(d))return r(b,g);f(function(){var c=d,f=w(b),h=f.resolve;f=f.reject;try{z(c,g,h,f)}catch(xe){f(xe)}})}},reject:function(g){if(!c)return c=!0,t(b,g)}}},z=function(b,c,g,d){b===I?n(b,c,g,d,l):n(b,c,g,d)},B=function(){var b=
+function(c){if(!(this instanceof b))throw new TypeError('Constructor Promise requires "new"');if(this&&this._promise)throw new TypeError("Bad construction");if(!A.IsCallable(c))throw new TypeError("not a valid resolver");var g=lb(this,b,D,{_promise:{result:void 0,state:0,reactionLength:0,fulfillReactionHandler0:void 0,rejectReactionHandler0:void 0,reactionCapability0:void 0}}),d=w(g),f=d.reject;try{c(d.resolve,f)}catch(Xc){f(Xc)}return g};return b}();var D=B.prototype;var G=function(b,c,g,d){var f=
+!1;return function(h){f||(f=!0,c[b]=h,0===--d.count&&(h=g.resolve,h(c)))}};ta(B,{all:function(b){if(!A.TypeIsObject(this))throw new TypeError("Promise is not object");var g=new c(this),d;try{var f=A.GetIterator(b);b=d={iterator:f,done:!1};for(var h=b.iterator,k=[],l={count:1},n,p,q=0;;){try{n=A.IteratorStep(h);if(!1===n){b.done=!0;break}p=n.value}catch(zd){throw b.done=!0,zd;}k[q]=void 0;var r=this.resolve(p),t=G(q,k,g,l);l.count+=1;z(r.then,r,t,g.reject);q+=1}if(0===--l.count){var w=g.resolve;w(k)}return g.promise}catch(zd){h=
+zd;if(d&&!d.done)try{A.IteratorClose(f,!0)}catch(Sb){h=Sb}f=g.reject;f(h);return g.promise}},race:function(b){if(!A.TypeIsObject(this))throw new TypeError("Promise is not object");var g=new c(this),d;try{var f=A.GetIterator(b);b=d={iterator:f,done:!1};for(var h=b.iterator,k,l,n;;){try{k=A.IteratorStep(h);if(!1===k){b.done=!0;break}l=k.value}catch(Ac){throw b.done=!0,Ac;}n=this.resolve(l);z(n.then,n,g.resolve,g.reject)}return g.promise}catch(Ac){h=Ac;if(d&&!d.done)try{A.IteratorClose(f,!0)}catch(fe){h=
+fe}f=g.reject;f(h);return g.promise}},reject:function(b){if(!A.TypeIsObject(this))throw new TypeError("Bad promise constructor");var g=new c(this),d=g.reject;d(b);return g.promise},resolve:function(b){if(!A.TypeIsObject(this))throw new TypeError("Bad promise constructor");if(A.IsPromise(b)&&b.constructor===this)return b;var g=new c(this),d=g.resolve;d(b);return g.promise}});ta(D,{"catch":function(b){return this.then(null,b)},then:function(b,g){if(!A.IsPromise(this))throw new TypeError("not a promise");
+var d=A.SpeciesConstructor(this,B);d=2<arguments.length&&arguments[2]===l&&d===B?l:new c(d);var f=A.IsCallable(b)?b:h,n=A.IsCallable(g)?g:k,q=this._promise;if(0===q.state){if(0===q.reactionLength)q.fulfillReactionHandler0=f,q.rejectReactionHandler0=n,q.reactionCapability0=d;else{var r=3*(q.reactionLength-1);q[r+0]=f;q[r+1]=n;q[r+2]=d}q.reactionLength+=1}else if(1===q.state)q=q.result,p(f,d,q);else if(2===q.state)q=q.result,p(n,d,q);else throw new TypeError("unexpected Promise state");return d.promise}});
+l=new c(B);var I=D.then;return B}}();F.Promise&&(delete F.Promise.accept,delete F.Promise.defer,delete F.Promise.prototype.chain);if("function"===typeof Bc){ta(F,{Promise:Bc});var ze=va(F.Promise,function(b){return b.resolve(42).then(function(){})instanceof b}),Yc=!B(function(){return F.Promise.reject(42).then(null,5).then(null,Xb)}),Va=B(function(){return F.Promise.call(3,Xb)}),Ad=function(b){var c=b.resolve(5);c.constructor={};b=b.resolve(c);try{b.then(null,Xb).then(null,Xb)}catch(q){return!0}return c===
+b}(F.Promise),Cc=X&&function(){var b=0,c=Object.defineProperty({},"then",{get:function(){b+=1}});Promise.resolve(c);return 1===b}(),Tb=function q(b){var c=new Promise(b);b(3,function(){});this.then=c.then;this.constructor=q};Tb.prototype=Promise.prototype;Tb.all=Promise.all;var Dc=I(function(){return!!Tb.all([1,2])});ze&&Yc&&Va&&!Ad&&Cc&&!Dc||(Promise=Bc,R(F,"Promise",Bc));if(1!==Promise.all.length){var Zc=Promise.all;R(Promise,"all",function(b){return A.Call(Zc,this,arguments)})}if(1!==Promise.race.length){var $c=
+Promise.race;R(Promise,"race",function(b){return A.Call($c,this,arguments)})}if(1!==Promise.resolve.length){var wa=Promise.resolve;R(Promise,"resolve",function(b){return A.Call(wa,this,arguments)})}if(1!==Promise.reject.length){var ra=Promise.reject;R(Promise,"reject",function(b){return A.Call(ra,this,arguments)})}Tc(Promise,"all");Tc(Promise,"race");Tc(Promise,"resolve");Tc(Promise,"reject");w(Promise)}var ic=function(b){var c=G(Wa(b,function(b,c){b[c]=!0;return b},{}));return b.join(":")===c.join(":")},
+$a=ic(["z","a","bb"]),Ma=ic(["z",1,"a","3",2]);if(X){var z=function(b,c){return c||$a?rb(b)?"^"+A.ToString(b):"string"===typeof b?"$"+b:"number"===typeof b?Ma?b:"n"+b:"boolean"===typeof b?"b"+b:null:null},ma=function(){return Object.create?Object.create(null):{}},pa=function(b,c,g){if(t(g)||Da.string(g))ia(g,function(b){if(!A.TypeIsObject(b))throw new TypeError("Iterator value "+b+" is not an entry object");c.set(b[0],b[1])});else if(g instanceof b)n(b.prototype.forEach,g,function(b,g){c.set(g,b)});
+else{if(!rb(g)){var d=c.set;if(!A.IsCallable(d))throw new TypeError("bad map");var f=A.GetIterator(g)}if("undefined"!==typeof f)for(;;){b=A.IteratorStep(f);if(!1===b)break;b=b.value;try{if(!A.TypeIsObject(b))throw new TypeError("Iterator value "+b+" is not an entry object");n(d,c,b[0],b[1])}catch(Ha){throw A.IteratorClose(f,!0),Ha;}}}},r=function(b,c,g){if(t(g)||Da.string(g))ia(g,function(b){c.add(b)});else if(g instanceof b)n(b.prototype.forEach,g,function(b){c.add(b)});else{if(!rb(g)){var d=c.add;
+if(!A.IsCallable(d))throw new TypeError("bad set");var f=A.GetIterator(g)}if("undefined"!==typeof f)for(;;){b=A.IteratorStep(f);if(!1===b)break;b=b.value;try{n(d,c,b)}catch(Ha){throw A.IteratorClose(f,!0),Ha;}}}},gb={Map:function(){var b={},c=function(b,c){this.key=b;this.value=c;this.prev=this.next=null};c.prototype.isRemoved=function(){return this.key===b};var g=function(b,c){if(!A.TypeIsObject(b)||!b._es6map)throw new TypeError("Method Map.prototype."+c+" called on incompatible receiver "+A.ToString(b));
+},d=function(b,c){g(b,"[[MapIterator]]");this.i=this.head=b._head;this.kind=c};d.prototype={isMapIterator:!0,next:function(){if(!this.isMapIterator)throw new TypeError("Not a MapIterator");var b=this.i,c=this.kind,g=this.head;if("undefined"===typeof this.i)return Mb();for(;b.isRemoved()&&b!==g;)b=b.prev;for(;b.next!==g;)if(b=b.next,!b.isRemoved())return c="key"===c?b.key:"value"===c?b.value:[b.key,b.value],this.i=b,Mb(c);this.i=void 0;return Mb()}};D(d.prototype);var f=function md(){if(!(this instanceof
+md))throw new TypeError('Constructor Map requires "new"');if(this&&this._es6map)throw new TypeError("Bad construction");var b=lb(this,md,h,{_es6map:!0,_head:null,_map:Ga?new Ga:null,_size:0,_storage:ma()}),g=new c(null,null);g.next=g.prev=g;b._head=g;0<arguments.length&&pa(md,b,arguments[0]);return b};var h=f.prototype;ba.getter(h,"size",function(){if("undefined"===typeof this._size)throw new TypeError("size method called on incompatible Map");return this._size});ta(h,{get:function(b){g(this,"get");
+var c=z(b,!0);if(null!==c){if(b=this._storage[c])return b.value}else if(this._map){if(b=da.call(this._map,b))return b.value}else for(var d=c=this._head;(d=d.next)!==c;)if(A.SameValueZero(d.key,b))return d.value},has:function(b){g(this,"has");var c=z(b,!0);if(null!==c)return"undefined"!==typeof this._storage[c];if(this._map)return Fb.call(this._map,b);for(var d=c=this._head;(d=d.next)!==c;)if(A.SameValueZero(d.key,b))return!0;return!1},set:function(b,d){g(this,"set");var f=this._head,h=f,k=z(b,!0);
+if(null!==k){if("undefined"!==typeof this._storage[k])return this._storage[k].value=d,this;var l=this._storage[k]=new c(b,d);h=f.prev}else this._map&&(Fb.call(this._map,b)?da.call(this._map,b).value=d:(l=new c(b,d),oc.call(this._map,b,l),h=f.prev));for(;(h=h.next)!==f;)if(A.SameValueZero(h.key,b))return h.value=d,this;l=l||new c(b,d);A.SameValue(-0,b)&&(l.key=0);l.next=this._head;l.prev=this._head.prev;l.prev.next=l;l.next.prev=l;this._size+=1;return this},"delete":function(c){g(this,"delete");var d=
+this._head,f=d,h=z(c,!0);if(null!==h){if("undefined"===typeof this._storage[h])return!1;f=this._storage[h].prev;delete this._storage[h]}else if(this._map){if(!Fb.call(this._map,c))return!1;f=da.call(this._map,c).prev;gd.call(this._map,c)}for(;(f=f.next)!==d;)if(A.SameValueZero(f.key,c))return f.key=b,f.value=b,f.prev.next=f.next,f.next.prev=f.prev,--this._size,!0;return!1},clear:function(){g(this,"clear");this._map=Ga?new Ga:null;this._size=0;this._storage=ma();for(var c=this._head,d,f=c.next;(d=
+f)!==c;)d.key=b,d.value=b,f=d.next,d.next=d.prev=c;c.next=c.prev=c},keys:function(){g(this,"keys");return new d(this,"key")},values:function(){g(this,"values");return new d(this,"value")},entries:function(){g(this,"entries");return new d(this,"key+value")},forEach:function(b){g(this,"forEach");for(var c=1<arguments.length?arguments[1]:null,d=this.entries(),f=d.next();!f.done;f=d.next())c?n(b,c,f.value[1],f.value[0],this):b(f.value[1],f.value[0],this)}});D(h,h.entries);return f}(),Set:function(){var b=
+function(b,c){if(!A.TypeIsObject(b)||!b._es6set||"undefined"===typeof b._storage)throw new TypeError("Set.prototype."+c+" called on incompatible receiver "+A.ToString(b));},c=function Nc(){if(!(this instanceof Nc))throw new TypeError('Constructor Set requires "new"');if(this&&this._es6set)throw new TypeError("Bad construction");var b=lb(this,Nc,g,{_es6set:!0,"[[SetData]]":null,_storage:ma()});if(!b._es6set)throw new TypeError("bad set");0<arguments.length&&r(Nc,b,arguments[0]);return b};var g=c.prototype;
+var d=function(b){if(!b["[[SetData]]"]){var c=new gb.Map;b["[[SetData]]"]=c;ia(G(b._storage),function(b){if("^null"===b)b=null;else if("^undefined"!==b){var g=b.charAt(0);b="$"===g?zb(b,1):"n"===g?+zb(b,1):"b"===g?"btrue"===b:+b}else b=void 0;c.set(b,b)});b["[[SetData]]"]=c}b._storage=null};ba.getter(c.prototype,"size",function(){b(this,"size");if(this._storage)return G(this._storage).length;d(this);return this["[[SetData]]"].size});ta(c.prototype,{has:function(c){b(this,"has");var g;if(this._storage&&
+null!==(g=z(c)))return!!this._storage[g];d(this);return this["[[SetData]]"].has(c)},add:function(c){b(this,"add");var g;if(this._storage&&null!==(g=z(c)))return this._storage[g]=!0,this;d(this);this["[[SetData]]"].set(c,c);return this},"delete":function(c){b(this,"delete");var g;if(this._storage&&null!==(g=z(c)))return c=J(this._storage,g),delete this._storage[g]&&c;d(this);return this["[[SetData]]"]["delete"](c)},clear:function(){b(this,"clear");this._storage&&(this._storage=ma());this["[[SetData]]"]&&
+this["[[SetData]]"].clear()},values:function(){b(this,"values");d(this);return new f(this["[[SetData]]"].values())},entries:function(){b(this,"entries");d(this);return new f(this["[[SetData]]"].entries())},forEach:function(c){b(this,"forEach");var g=1<arguments.length?arguments[1]:null,f=this;d(f);this["[[SetData]]"].forEach(function(b,d){g?n(c,g,d,d,f):c(d,d,f)})}});K(c.prototype,"keys",c.prototype.values,!0);D(c.prototype,c.prototype.values);var f=function(b){this.it=b};f.prototype={isSetIterator:!0,
+next:function(){if(!this.isSetIterator)throw new TypeError("Not a SetIterator");return this.it.next()}};D(f.prototype);return c}()};F.Set&&!Set.prototype["delete"]&&Set.prototype.remove&&Set.prototype.items&&Set.prototype.map&&Array.isArray((new Set).keys)&&(F.Set=gb.Set);if(F.Map||F.Set){I(function(){return 2===(new Map([[1,2]])).get(1)})||(F.Map=function S(){if(!(this instanceof S))throw new TypeError('Constructor Map requires "new"');var b=new Ga;0<arguments.length&&pa(S,b,arguments[0]);delete b.constructor;
+Object.setPrototypeOf(b,F.Map.prototype);return b},F.Map.prototype=ua(Ga.prototype),K(F.Map.prototype,"constructor",F.Map,!0),ba.preserveToString(F.Map,Ga));var ad=new Map,bd=function(){var b=new Map([[1,0],[2,0],[3,0],[4,0]]);b.set(-0,b);return b.get(0)===b&&b.get(-0)===b&&b.has(0)&&b.has(-0)}(),xb=ad.set(1,2)===ad;bd&&xb||R(Map.prototype,"set",function(b,c){n(oc,this,0===b?0:b,c);return this});bd||(ta(Map.prototype,{get:function(b){return n(da,this,0===b?0:b)},has:function(b){return n(Fb,this,0===
+b?0:b)}},!0),ba.preserveToString(Map.prototype.get,da),ba.preserveToString(Map.prototype.has,Fb));var Ec=new Set,jc=Set.prototype["delete"]&&Set.prototype.add&&Set.prototype.has&&function(b){b["delete"](0);b.add(-0);return!b.has(0)}(Ec),ge=Ec.add(1)===Ec;if(!jc||!ge){var kc=Set.prototype.add;Set.prototype.add=function(b){n(kc,this,0===b?0:b);return this};ba.preserveToString(Set.prototype.add,kc)}if(!jc){var Db=Set.prototype.has;Set.prototype.has=function(b){return n(Db,this,0===b?0:b)};ba.preserveToString(Set.prototype.has,
+Db);var Fc=Set.prototype["delete"];Set.prototype["delete"]=function(b){return n(Fc,this,0===b?0:b)};ba.preserveToString(Set.prototype["delete"],Fc)}var La=va(F.Map,function(b){var c=new b([]);c.set(42,42);return c instanceof b}),Bd=Object.setPrototypeOf&&!La;try{var Gc=!(F.Map()instanceof F.Map)}catch(Ka){Gc=Ka instanceof TypeError}if(0!==F.Map.length||Bd||!Gc)F.Map=function S(){if(!(this instanceof S))throw new TypeError('Constructor Map requires "new"');var b=new Ga;0<arguments.length&&pa(S,b,arguments[0]);
+delete b.constructor;Object.setPrototypeOf(b,S.prototype);return b},F.Map.prototype=Ga.prototype,K(F.Map.prototype,"constructor",F.Map,!0),ba.preserveToString(F.Map,Ga);var ja=va(F.Set,function(b){var c=new b([]);c.add(42,42);return c instanceof b}),ya=Object.setPrototypeOf&&!ja;try{var Cd=!(F.Set()instanceof F.Set)}catch(Ka){Cd=Ka instanceof TypeError}if(0!==F.Set.length||ya||!Cd){var cd=F.Set;F.Set=function S(){if(!(this instanceof S))throw new TypeError('Constructor Set requires "new"');var b=
+new cd;0<arguments.length&&r(S,b,arguments[0]);delete b.constructor;Object.setPrototypeOf(b,S.prototype);return b};F.Set.prototype=cd.prototype;K(F.Set.prototype,"constructor",F.Set,!0);ba.preserveToString(F.Set,cd)}var ab=new F.Map,Eb=!I(function(){return ab.keys().next().done});("function"!==typeof F.Map.prototype.clear||0!==(new F.Set).size||0!==ab.size||"function"!==typeof F.Map.prototype.keys||"function"!==typeof F.Set.prototype.keys||"function"!==typeof F.Map.prototype.forEach||"function"!==
+typeof F.Set.prototype.forEach||O(F.Map)||O(F.Set)||"function"!==typeof ab.keys().next||Eb||!La)&&ta(F,{Map:gb.Map,Set:gb.Set},!0);F.Set.prototype.keys!==F.Set.prototype.values&&K(F.Set.prototype,"keys",F.Set.prototype.values,!0);D(Object.getPrototypeOf((new F.Map).keys()));D(Object.getPrototypeOf((new F.Set).keys()));if(p&&"has"!==F.Set.prototype.has.name){var bc=F.Set.prototype.has;R(F.Set.prototype,"has",function(b){return n(bc,this,b)})}}ta(F,gb);w(F.Map);w(F.Set)}var hb=function(b){if(!A.TypeIsObject(b))throw new TypeError("target must be an object");
+},bb={apply:function(){return A.Call(A.Call,null,arguments)},construct:function(b,c){if(!A.IsConstructor(b))throw new TypeError("First argument must be a constructor.");var g=2<arguments.length?arguments[2]:b;if(!A.IsConstructor(g))throw new TypeError("new.target must be a constructor.");return A.Construct(b,c,g,"internal")},deleteProperty:function(b,c){hb(b);if(X){var g=Object.getOwnPropertyDescriptor(b,c);if(g&&!g.configurable)return!1}return delete b[c]},has:function(b,c){hb(b);return c in b}};
+Object.getOwnPropertyNames&&Object.assign(bb,{ownKeys:function(b){hb(b);var c=Object.getOwnPropertyNames(b);A.IsCallable(Object.getOwnPropertySymbols)&&Oa(c,Object.getOwnPropertySymbols(b));return c}});Object.preventExtensions&&Object.assign(bb,{isExtensible:function(b){hb(b);return Object.isExtensible(b)},preventExtensions:function(b){hb(b);return!B(function(){return Object.preventExtensions(b)})}});if(X){var he=function(b,c,g){var d=Object.getOwnPropertyDescriptor(b,c);if(!d)return b=Object.getPrototypeOf(b),
+null===b?void 0:he(b,c,g);if("value"in d)return d.value;if(d.get)return A.Call(d.get,g)},l=function(b,c,g,d){var f=Object.getOwnPropertyDescriptor(b,c);if(!f){b=Object.getPrototypeOf(b);if(null!==b)return l(b,c,g,d);f={value:void 0,writable:!0,enumerable:!0,configurable:!0}}return"value"in f?f.writable&&A.TypeIsObject(d)?Object.getOwnPropertyDescriptor(d,c)?Ib.defineProperty(d,c,{value:g}):Ib.defineProperty(d,c,{value:g,writable:!0,enumerable:!0,configurable:!0}):!1:f.set?(n(f.set,d,g),!0):!1};Object.assign(bb,
+{defineProperty:function(b,c,g){hb(b);return!B(function(){return Object.defineProperty(b,c,g)})},getOwnPropertyDescriptor:function(b,c){hb(b);return Object.getOwnPropertyDescriptor(b,c)},get:function(b,c){hb(b);return he(b,c,2<arguments.length?arguments[2]:b)},set:function(b,c,g){hb(b);return l(b,c,g,3<arguments.length?arguments[3]:b)}})}if(Object.getPrototypeOf){var Dd=Object.getPrototypeOf;bb.getPrototypeOf=function(b){hb(b);return Dd(b)}}Object.setPrototypeOf&&bb.getPrototypeOf&&Object.assign(bb,
+{setPrototypeOf:function(b,c){hb(b);if(null!==c&&!A.TypeIsObject(c))throw new TypeError("proto must be an object or null");if(c===Ib.getPrototypeOf(b))return!0;if(Ib.isExtensible&&!Ib.isExtensible(b))return!1;var g;a:{for(g=c;g;){if(b===g){g=!0;break a}g=bb.getPrototypeOf(g)}g=!1}if(g)return!1;Object.setPrototypeOf(b,c);return!0}});var Ae=function(b,c){A.IsCallable(F.Reflect[b])?I(function(){F.Reflect[b](1);F.Reflect[b](NaN);F.Reflect[b](!0);return!0})&&R(F.Reflect,b,c):K(F.Reflect,b,c)};Object.keys(bb).forEach(function(b){Ae(b,
+bb[b])});var Hc=F.Reflect.getPrototypeOf;p&&Hc&&"getPrototypeOf"!==Hc.name&&R(F.Reflect,"getPrototypeOf",function(b){return n(Hc,F.Reflect,b)});F.Reflect.setPrototypeOf&&I(function(){F.Reflect.setPrototypeOf(1,{});return!0})&&R(F.Reflect,"setPrototypeOf",bb.setPrototypeOf);F.Reflect.defineProperty&&(I(function(){var b=!F.Reflect.defineProperty(1,"test",{value:1}),c="function"!==typeof Object.preventExtensions||!F.Reflect.defineProperty(Object.preventExtensions({}),"test",{});return b&&c})||R(F.Reflect,
+"defineProperty",bb.defineProperty));F.Reflect.construct&&(I(function(){var b=function(){};return F.Reflect.construct(function(){},[],b)instanceof b})||R(F.Reflect,"construct",bb.construct));if("Invalid Date"!==String(new Date(NaN))){var Be=Date.prototype.toString;R(Date.prototype,"toString",function(){var b=+this;return b!==b?"Invalid Date":A.Call(Be,this)})}var ie={anchor:function(b){return A.CreateHTML(this,"a","name",b)},big:function(){return A.CreateHTML(this,"big","","")},blink:function(){return A.CreateHTML(this,
+"blink","","")},bold:function(){return A.CreateHTML(this,"b","","")},fixed:function(){return A.CreateHTML(this,"tt","","")},fontcolor:function(b){return A.CreateHTML(this,"font","color",b)},fontsize:function(b){return A.CreateHTML(this,"font","size",b)},italics:function(){return A.CreateHTML(this,"i","","")},link:function(b){return A.CreateHTML(this,"a","href",b)},small:function(){return A.CreateHTML(this,"small","","")},strike:function(){return A.CreateHTML(this,"strike","","")},sub:function(){return A.CreateHTML(this,
+"sub","","")},sup:function(){return A.CreateHTML(this,"sup","","")}};ia(Object.keys(ie),function(b){var c=String.prototype[b];if(A.IsCallable(c)){c=n(c,"",' " ');var g=Bb([],c.match(/"/g)).length;c=c!==c.toLowerCase()||2<g}else c=!0;c&&R(String.prototype,b,ie[b])});var g=function(){if(!qc)return!1;var b="object"===typeof JSON&&"function"===typeof JSON.stringify?JSON.stringify:null;if(!b)return!1;if("undefined"!==typeof b(oa())||"[null]"!==b([oa()]))return!0;var c={a:oa()};c[oa()]=!0;return"{}"!==
+b(c)?!0:!1}(),Ea=I(function(){return qc?"{}"===JSON.stringify(Object(oa()))&&"[{}]"===JSON.stringify([Object(oa())]):!0});if(g||!Ea){var nb=JSON.stringify;R(JSON,"stringify",function(b){if("symbol"!==typeof b){var c;1<arguments.length&&(c=arguments[1]);var g=[b];if(t(c))g.push(c);else{var d=A.IsCallable(c)?c:null;g.push(function(b,c){b=d?n(d,this,b,c):c;if("symbol"!==typeof b)return Da.symbol(b)?uc({})(b):b})}2<arguments.length&&g.push(arguments[2]);return nb.apply(this,g)}})}return F});
+var CindyJS=function(){function d(d){if(0===t)return console.error("Waiting for "+d+" after we finished waiting."),function(){};0>t&&(t=0);++t;return function(){--t;0>t&&console.error("Wait count mismatch: "+d);if(0===t)for(var h=0,n=G.length;h<n;)G[h++].startup()}}function n(d){var h=n.newInstance(d);0>=t?h.startup():!1!==d.autostart&&G.push(h);return h}var t=-1,G=[];Math.sign||(Math.sign=function(d){return(0<d)-(0>d)||+d});"undefined"===typeof document||"undefined"===typeof window||"undefined"===
+typeof document.addEventListener||"undefined"!==typeof window.cindyDontWait&&!0===window.cindyDontWait||document.addEventListener("DOMContentLoaded",d("DOMContentLoaded"));var B=null,I=null,O={};n.getBaseDir=function(){if(null!==B)return B;for(var d=document.getElementsByTagName("script"),h=0;h<d.length;++h){var n=d[h],t=n.src;if(t){var G=/Cindy\.js$/.exec(t);if(G)return B=t.substr(0,G.index),console.log("Will load extensions from "+B),I=n,B}}console.error("Could not find <script> tag for Cindy.js");
+return B=I=!1};n.addNewScript=function(d,h){h||console.error.bind(console);var p=n.getBaseDir();if(!1===p)return!1;h=document.createElement("script");h.src=p+d;d=I.nextSibling;p=I.parentElement;d?p.insertBefore(h,d):p.appendChild(h);return h};n.loadScript=function(d,h,t,B){for(var p=String(d).split("."),G=window;p.length&&"object"===typeof G&&null!==G;)G=G[p.shift()];if(G&&!p.length)return t(),!0;B||(B=console.error.bind(console));p=O[d];if(!p){p=n.addNewScript(h,B);if(!1===p)return B("Can't load additional components."),
+!1;O[d]=p}p.addEventListener("load",t);p.addEventListener("error",B);return null};n._autoLoadingPlugin={};n.autoLoadPlugin=function(d,h,t){if(n._pluginRegistry[d])return t(),!0;var p=n._autoLoadingPlugin[d];if(!p){h||(h=d+"-plugin.js");p=n._autoLoadingPlugin[d]=[];d=n.addNewScript(h);if(!1===d)return!1;d.addEventListener("error",console.error.bind(console))}p.push(t);return null};var h={ctype:"undefined"};n.waitFor=d;n._pluginRegistry={};n.instances=[];n.registerPlugin=function(d,h,t){if(1!==d)return console.error("Plugin API version "+
+d+" not supported"),!1;n._pluginRegistry[h]=t;(n._autoLoadingPlugin[h]||[]).forEach(function(d){d()})};var X=0;n.dumpState=function(d){d=n.instances[d||0].saveState();console.log(JSON.stringify(d))};n.debugState=function(d){n.instances.map(function(d){var h=d.config;h=JSON.parse(JSON.stringify(h));var n=d.saveState();console.log(JSON.stringify(n));for(var p in n)h[p]=n[p];d.shutdown();return h}).forEach(function(d){n(d)})};n.newInstance=function(d){function n(){ra.width=ma=ra.clientWidth;ra.height=
+pa=ra.clientHeight;wa=1;if(Zc||$c)wa=Math.max(Zc?Zc/ra.width:0,$c?$c/ra.height:0),ma=wa*ra.clientWidth,pa=wa*ra.clientHeight;z.setTransform(1/wa,0,0,1/wa,0,0);C.setMat(25,0,0,25,250.5,250.5);if(ic)for(var a=0;a<ic.length;a++){var e=ic[a],b=Object.keys(e)[0];"scale"===b&&(Yc=e.scale,C[b](e.scale));if("translate"===b)C[b](e.translate[0],e.translate[1]);"scaleAndOrigin"===b&&(Yc=e[b][0]/25,C[b].apply(null,e[b]));"visibleRect"===b&&(C[b].apply(null,e[b]),Yc=C.drawingstate.initialmatrix.a/25)}C.createnewbackup();
+C.greset();a=1;"undefined"!==typeof window&&window.devicePixelRatio&&(a=window.devicePixelRatio);e=z.webkitBackingStorePixelRatio||z.mozBackingStorePixelRatio||z.msBackingStorePixelRatio||z.oBackingStorePixelRatio||z.backingStorePixelRatio||1;a!==e&&(a/=e,ra.width=ma*a,ra.height=pa*a,z.scale(a,a))}function p(a){if("canvas"!==a.tagName.toLowerCase()){var e=a;for(ra=document.createElement("canvas");e.firstChild;)e.removeChild(e.firstChild)}else{ra=a;e=document.createElement("div");var b=null,v=null;
+Array.prototype.slice.call(ra.attributes).forEach(function(a){"width"===a.name?b=a.value:"height"===a.name?v=a.value:e.setAttributeNodeNS(ra.removeAttributeNode(a))});null===b||e.style.width||(e.style.width=b+"px");null===v||e.style.height||(e.style.height=v+"px");ra.parentNode.replaceChild(e,ra)}e.classList.add("CindyJS-widget");a=ra.style;a.position="absolute";a.border="none";a.margin=a.padding=a.left=a.top="0px";a.width=a.height="100%";a="static";window.getComputedStyle&&(a=window.getComputedStyle(e).getPropertyValue("position"),
+a=String(a||"static"));"static"===a&&(e.style.position="relative");e.appendChild(ra);return ra}function t(){var a=d.cinderella;if(!a||!a.version)return!1;for(var e=0;e<arguments.length;++e){var b=a.version[e],v=arguments[e];if(b!==v)return typeof b===typeof v&&b<v}return!1}function B(){Bd=!0;if(0===Gc){if(d.exclusive)for(c=Ia.instances.length;0<c;)Ia.instances[--c].shutdown();void 0!==d.csconsole&&(Qa=d.csconsole);Qa=null===Qa?new Oa:!0===Qa?new zb:"string"===typeof Qa?new Xa(Qa):"object"===typeof Qa&&
+"function"===typeof Qa.appendChild?new Xa(Qa):new Oa;Ma=[100,100];var a=null;ic=d.transform;if(d.ports&&0<d.ports.length){c=d.ports[0];(a=c.element)||(a=document.getElementById(c.id));a=p(a);var e=a.parentNode.style;"window"===c.fill?(e.width="100vw",e.height="100vh"):"parent"===c.fill?(e.width="100%",e.height="100%"):c.width&&c.height&&(e.width=c.width+"px",e.height=c.height+"px");c.virtualwidth&&(Zc=c.virtualwidth);c.virtualheight&&($c=c.virtualheight);c.background&&(a.style.backgroundColor=c.background);
+void 0!==c.transform&&(ic=c.transform);$a(c.grid)&&0<c.grid&&(Va=c.grid);$a(c.tgrid)&&0<c.tgrid&&(Ad=c.tgrid);c.snap&&(Cc=!0);Number.isFinite(c.snapdistance)&&(Tb=Math.max(c.snapdistance,0));c.axes&&(Dc=!0)}a||(a=d.canvas,a||"undefined"===typeof document||(a=document.getElementById(d.canvasname))&&(a=p(a)));a&&(ra=a,z=a.getContext("2d"),n(),z.setLineDash||(z.setLineDash=function(){}),(d.animation?d.animation.controls:d.animcontrols)&&I(d),d.animation&&$a(d.animation.speed)&&(void 0===d.animation.accuracy&&
+t(2,9,1875)?O(.5*d.animation.speed):O(d.animation.speed)),d.animation&&$a(d.animation.accuracy)&&(zc=d.animation.accuracy));d.statusbar&&(ve="string"===typeof d.statusbar?document.getElementById(d.statusbar):d.statusbar);var b=d.scripts,v=null;"string"===typeof b&&b.search(/\*/)&&(v=b);"object"!==typeof b&&(b=null);"move keydown keyup keytyped keytype mousedown mouseup mousedrag mousemove mouseclick multidown multiup multidrag init tick draw simulationstep simulationstart simulationstop ondrop".split(" ").forEach(function(a){if(null!==
+b&&b[a])var e=b[a];else{e=a+"script";if(d[e])e=document.getElementById(d[e]);else if(v){if(e=document.getElementById(v.replace(/\*/,a)),!e)return}else return;e=e.text}e=lb(e,!1);"error"===e.ctype?console.error("Error compiling "+a+" script: "+e.message):V[a]=le(e,a)});t(2,9,1888)&&!V.keydown&&(V.keydown=V.keytyped,V.keytyped=V.keytype,V.keytype=void 0);$a(d.grid)&&0<d.grid&&(Va=d.grid);d.snap&&(Cc=!0);Number.isFinite(d.snapdistance)&&(Tb=Math.max(d.snapdistance,0));r={};var c=0;gb={};d.geometry||
+(d.geometry=[]);pe(d.geometry);d.behavior||(d.behavior=[]);"function"===typeof Rb&&Rb(d.behavior);for(var g in d.images)c=G(d.images[g],!1),c!==h&&(gb[g]=c);for(var f in d.videos)g=G(d.videos[f],!0),g!==h&&(gb[f]=g);La.canvas=a;if(d.oninit)d.oninit(La);Ia.instances.push(La);d.use&&d.use.forEach(function(a){q.use$1([u.wrap(a)],{})});Sb.convexhull3d$1&&ba("QuickHull3D","QuickHull3D.js");(Sb.colorplot$1||Sb.colorplot$2||Sb.colorplot$3||Sb.colorplot$4)&&ba("CindyGL","CindyGL.js");(Sb.playtone$1||Sb.playmelody$1)&&
+ba("midi","midi-plugin.js");ua()}}function G(a,e){if("string"===typeof a){if(e){var b=document.createElement("video");b.preload="auto";b.loop=!0;b.setAttribute("playsinline","");enableInlineVideo(b)}else b=new Image;b.src=a}else b=a;if(!b.tagName)return console.error("Not a valid image element",b),h;var v={img:b,width:NaN,height:NaN,ready:!0,live:!1,generation:0,whenReady:f};a=b.tagName.toLowerCase();var c=[];if("img"===a)b.complete?(v.width=b.width,v.height=b.height):(v.ready=!1,b.addEventListener("load",
+function(){v.width=b.width;v.height=b.height;v.ready=!0;v.whenReady=f;c.forEach(f);k()}),v.whenReady=c.push.bind(c));else if("video"===a)v.live=!0,b.readyState>=b.HAVE_METADATA?(v.width=b.videoWidth,v.height=b.videoHeight):(v.ready=!1,b.addEventListener("loadedmetadata",function(){v.width=b.videoWidth;v.height=b.videoHeight;v.ready=!0;v.whenReady=f;c.forEach(f);k()}),v.whenReady=c.push.bind(c));else if("canvas"===a)v.width=b.width,v.height=b.height;else return console.error("Not a valid image element",
+a,b),h;return{ctype:"image",value:v}}function I(a){function e(a,e){var b=document.createElement("button"),x=document.createElement("img");b.appendChild(x);k.appendChild(b);jc(x,a);b.addEventListener("click",e);xb[a]=function(a){a?b.classList.add("CindyJS-active"):b.classList.remove("CindyJS-active")}}function b(a){if(l){var e=f.getBoundingClientRect();O(d*(a.clientX-e.left-f.clientLeft+.5)/e.width+c)}}var v=document.createElement("div");v.className="CindyJS-animcontrols";ra.parentNode.appendChild(v);
+var c=0,g=1,d=1;a.animation&&a.animation.speedRange&&$a(a.animation.speedRange[0])&&$a(a.animation.speedRange[1])&&(c=a.animation.speedRange[0],g=a.animation.speedRange[1],d=g-c);var f=document.createElement("div");f.className="CindyJS-animspeed";v.appendChild(f);var h=document.createElement("div");f.appendChild(h);T(f,"mousedown",function(a){l=!0;b(a)});T(f,"mousemove",b);T(ra.parentNode,"mouseup",function(a){l=!1},!0);var k=document.createElement("div");k.className="CindyJS-animbuttons";v.appendChild(k);
+e("play",F);e("pause",ub);e("stop",Wb);xb.stop(!0);Ec=function(a){a=(a-c)/d;a=Math.max(0,Math.min(1,a));a=.1*Math.round(1E3*a);h.style.width=a+"%"};var l=!1}function O(a){ee=a;Ec&&Ec(a)}function f(a){return a()}function ba(a,e,b){var x=null;d.plugins&&(x=d.plugins[a]);x||(x=Ia._pluginRegistry[a]);x?q.use$1([u.wrap(a)],{}):(++ge,Ia.autoLoadPlugin(a,e,function(){q.use$1([u.wrap(a)],{});ua(b)}))}function ua(a){0===--ge&&(a?k():(w(V.init),(d.animation||d).autoplay&&F(),La.canvas&&Gb(La.canvas,d)))}function va(){null!==
+kc&&(Ja.set(kc.state),Object.keys(kc.speeds).forEach(function(a){var e=r.csnames[a];"undefined"!==typeof e.behavior&&(a=kc.speeds[a],e.behavior.vx=a[0],e.behavior.vy=a[1],e.behavior.vz=a[2],e.behavior.fx=0,e.behavior.fy=0,e.behavior.fz=0)}),Zd())}function F(){if(!Ba){if(xc){var a=Ub.backup;a.set(Ja);for(var e={},b=0;b<r.points.length;b++){var v=r.points[b];"undefined"!==typeof v.behavior&&(e[v.name]=[v.behavior.vx,v.behavior.vy,v.behavior.vz])}kc={state:a,speeds:e};yc=0;xc=!1;xb.stop(!1)}else xb.pause(!1);
+wd=Date.now();xb.play(!0);"function"===typeof Rb&&Ce&&vd();Ba=!0;w(V.simulationstart);k()}}function ub(){Ba&&(xb.play(!1),xb.pause(!0),Ba=!1)}function Wb(){xc||(Ba?(w(V.simulationstop),Ba=!1,xb.play(!1)):xb.pause(!1),xb.stop(!0),xc=!0,va())}function Ab(){if(!Fc){Fc=!0;for(var a=Ia.instances.length;0<a;)if(Ia.instances[--a]===La){Ia.instances.splice(a,1);break}for(a=Db.length;0<a;)try{Db[--a]()}catch(e){console.error(e)}}}function Bb(a){this.in=function(a,b){console.log(a);b?this.append(this.createTextNode("span",
+"blue",a)):this.append(this.createTextNode("p","blue",a))};this.out=function(a,b){console.log(a);b?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.err=function(a,b){console.log(a);b?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.createTextNode=function(a,b,v){return"undefined"!==typeof document?(a=document.createElement(a),a.appendChild(document.createTextNode(v)),a.style.color=b,a):v+"\n"}}
+function zb(){var a=this,e=document.createElement("div");e.innerHTML='<div id="console" style="border-top: 1px solid #333333; bottom: 0px; position: absolute; width: 100%;"><div id="log" style="height: 150px; overflow-y: auto;"></div><input id="cmd" type="text" style="box-sizing: border-box; height: 30px; width: 100%;"></div>';document.body.appendChild(e);var b=document.getElementById("cmd");var v=document.getElementById("log");b.onkeydown=function(e){13===e.keyCode&&""!==b.value&&(a.in(b.value),
+e=q.parse$1([u.wrap(b.value)],[]),e=w(e),console.log(da(e)),"undefined"!==e.ctype&&Qa.out(da(e)),b.value="",v.scrollTop=v.scrollHeight)};this.append=function(a){v.appendChild(a)};this.clear=function(){v.innerHTML=""}}function Xa(a){var e=a;"string"===typeof a&&(e=document.getElementById(a));this.append=function(a){e.appendChild(a)};this.clear=function(){e.innerHTML=""}}function Oa(){this.append=function(a){};this.clear=function(){}}function T(a,e,b,v){void 0===v&&(v=!1);Db.push(function(){a.removeEventListener(e,
+b,v)});a.addEventListener(e,b,v)}function Gb(a,e){function b(e,b){for(var x=0;x<e.changedTouches.length;x++){var v=e.changedTouches[x],c=d(v.identifier);if(b||Eb[c]){var g=a.getBoundingClientRect();v=C.to(v.clientX-g.left-a.clientLeft+.5,v.clientY-g.top-a.clientTop+.5);Eb[c]=[v[0],v[1]]}}k()}function v(e){var b=a.getBoundingClientRect();e=C.to(e.clientX-b.left-a.clientLeft+.5,e.clientY-b.top-a.clientTop+.5);ja.prevx=ja.x;ja.prevy=ja.y;ja.x=e[0];ja.y=e[1];Ma[0]=ja.x;Ma[1]=ja.y;k()}function d(a){if(bc.hasOwnProperty(a))return bc[a];
+var e=Object.values(bc);e=e.sort(function(a,e){return a-e});var b=!1,x;for(x in e)!b&&e[x]>(x|0)+1&&(bc[a]=(x|0)+1,b=!0);b||(bc[a]=e.length+1);return bc[a]}function f(a){var e=a.changedTouches;b(a,!1);for(var x=0;x<a.changedTouches.length;x++)ab=d(a.changedTouches[x].identifier),Xb(ab),delete bc[a.changedTouches[x].identifier];x=!1;for(var v=0;v<e.length;v++)e[v].identifier===fa&&(x=!0);x&&(fa=-1,ja.down=!1,ya=void 0,w(V.mouseup),Ob("mouseup"),m||w(V.mouseclick),k(),a.preventDefault())}var l=null,
+za=null,m=!1;"undefined"!==typeof MutationObserver&&(l=MutationObserver);l||"undefined"===typeof WebKitMutationObserver||(l=WebKitMutationObserver);l?(l=new l(function(e){document.body.contains(a)||Ab()}),l.observe(document.documentElement,{childList:!0,subtree:!0}),Db.push(function(){l.disconnect()})):(T(a,"DOMNodeRemovedFromDocument",Ab),T(a,"DOMNodeRemoved",Ab));if(!0===e.keylistener)T(document,"keydown",function(a){Z(a,V.keydown);return!1}),T(document,"keyup",function(a){Z(a,V.keyup);return!1}),
+T(document,"keypress",function(a){Z(a,V.keytyped);return!1});else if(V.keydown||V.keyup||V.keytyped)a.setAttribute("tabindex","0"),T(a,"mousedown",function(){a.focus()}),T(a,"keydown",function(a){9!==a.keyCode&&(Z(a,V.keydown),V.keytyped||a.preventDefault())}),T(a,"keyup",function(a){Z(a,V.keyup);a.preventDefault()}),T(a,"keypress",function(a){9!==a.keyCode&&(Z(a,V.keytyped),a.preventDefault())});T(a,"mousedown",function(a){za=a;m=!1;ja.button=a.which;v(a);J(0);w(V.mousedown);Ob("mousedown");ja.down=
+!0;a.preventDefault()});T(a,"mouseup",function(a){ja.down=!1;ya=void 0;w(V.mouseup);Xb(0);Ob("mouseup");delete Eb[0];k();a.preventDefault()});T(a,"mousemove",function(a){v(a);ja.down?(za&&(2<Math.abs(za.clientX-a.clientX)||2<Math.abs(za.clientY-a.clientY))&&(m=!0),w(V.mousedrag),Eb[0]&&(ab=0,w(V.multidrag),ab=0)):w(V.mousemove);Ob("mousemove");a.preventDefault()});T(a,"click",function(a){v(a);m||w(V.mouseclick);a.preventDefault()});T(a,"dragenter",function(a){a.preventDefault()});T(a,"dragover",function(a){a.preventDefault()});
+T(a,"drop",function(e){function b(a,e){function b(){N.readyState===XMLHttpRequest.DONE&&(200!==N.status?(console.error("GET request for "+a+" failed: "+(N.responseText||"(no error message)")),d(e,h)):v(e,N.responseText))}var g=a.replace(/[?#][^]*/,"");g=g.replace(/[^]*\/([^\/])/,"$1");f[e]={type:"",name:g};var N=new XMLHttpRequest;N.onreadystatechange=function(){if(N.readyState===XMLHttpRequest.DONE)if(200!==N.status)console.error("HEAD request for "+a+" failed: "+(N.responseText||"(no error message)")),
+d(e,h);else{var v=N.getResponseHeader("Content-Type");f[e].type=v;/^image\//.test(v)?c(e,a):x(v)?(N=new XMLHttpRequest,N.onreadystatechange=b,N.open("GET",a),N.send()):d(e,h)}};N.open("HEAD",a);N.send()}function x(a){a=a.replace(/;[^]*/,"");return/^text\//.test(a)?1:"application/json"===a?2:0}function v(a,e){switch(x(f[a].type)){case 1:d(a,u.string(e));break;case 2:try{var b=JSON.parse(e);var v=u.wrapJSON(b)}catch(Xe){console.error(Xe),v=h}d(a,v);break;default:d(a,h)}}function c(a,e){var b=new Image,
+x=!1;b.onload=function(){x||(x=!0,d(a,G(b,!1)))};b.onerror=function(e){x||(x=!0,console.error(e),d(a,h))};b.src=e}function d(a,e,b){Y[a]=g.turnIntoCSList([e,u.string(b||e.ctype),u.string(f[a].type),u.string(f[a].name)]);0===--l&&(a=za,ad=g.turnIntoCSList(Y),bd=a,w(V.ondrop),bd=ad=h,k())}e.preventDefault();var N=e.dataTransfer,f=N.files,Y=Array(f.length),l=f.length,ka=e.currentTarget.getBoundingClientRect(),za=g.realVector(C.to(e.clientX-ka.left-a.clientLeft+.5,e.clientY-ka.top-a.clientTop+.5));if(0<
+f.length)Array.prototype.forEach.call(f,function(a,e){var b=new FileReader;x(a.type)?(b.onload=function(){v(e,b.result)},b.readAsText(a)):/^image\//.test(a.type)?(b.onload=function(){c(e,b.result)},b.readAsDataURL(a)):(console.log("Unknown MIME type: "+a.type),d(e,h))});else if(e=N.getData("text/uri-list"))e=e.split("\n").filter(function(a){return!/^\s*(#|$)/.test(a)}),l=e.length,Y=Array(l),f=Array(l),e.forEach(b)});var fa=-1;T(a,"touchstart",function(a){b(a,!0);for(var e=0;e<a.changedTouches.length;e++)J(d(a.changedTouches[e].identifier));
+-1===fa&&(e=a.changedTouches,0!==e.length&&(fa=e[0].identifier,v(a.targetTouches[0]),w(V.mousedown),ja.down=!0,za=a.targetTouches[0],m=!1,Ob("mousedown"),a.preventDefault()))},!1);T(a,"touchmove",function(a){b(a,!1);for(var e=0;e<a.changedTouches.length;e++)ab=d(a.changedTouches[e].identifier),w(V.multidrag),ab=0;e=a.changedTouches;for(var x=!1,c=0;c<e.length;c++)e[c].identifier===fa&&(x=!0);x&&(v(a.targetTouches[0]),ja.down?(za&&(2<Math.abs(za.clientX-a.targetTouches[0].clientX)||2<Math.abs(za.clientY-
+a.targetTouches[0].clientY))&&(m=!0),ab=d(fa),w(V.mousedrag)):w(V.mousemove),Ob("mousemove"),a.preventDefault())},!0);T(a,"touchend",f,!1);"undefined"!==typeof document&&document.body&&T(document.body,"touchcancel",f,!1);"undefined"!==typeof window&&T(window,"resize",function(){hb(function(){n();k()})},!1);c(a.parentNode);k()}function b(a,e){var b=document.createElement("div");b.setAttribute("style",e);a.appendChild(b);return b}function c(a){function e(){v.scrollLeft=v.scrollTop=c.scrollLeft=c.scrollTop=
+1E5}function x(){if(g!==a.clientWidth||d!==a.clientHeight)g=a.clientWidth,d=a.clientHeight,f||(f=!0,hb(function(){f=!1;n();k()}));e()}if("undefined"!==typeof document){var v=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");b(v,"position: absolute; transition: 0s; left: 0; top: 0; width: 100000px; height: 100000px");var c=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");
+b(c,"position: absolute; transition: 0s; left: 0; top: 0; width: 200%; height: 200%");e();var g=a.clientWidth,d=a.clientHeight,f=!1;v.addEventListener("scroll",x);c.addEventListener("scroll",x)}}function k(){bb||(bb=hb(U))}function U(){bb=null;if(!Fc){if(Ba){var a=Date.now(),e=Math.min(50,a-wd)*ee*ze;wd=a;a=yc+e;Ce&&"undefined"!==typeof cb&&cb.tick(e);yc=a;Ba&&w(V.tick)}ca();Ba&&k()}}function ca(){C.reset();z.save();z.clearRect(0,0,ma,pa);var a=C.drawingstate.matrix,e,b;if(0!==Va){z.beginPath();z.strokeStyle=
+"rgba(0,0,0,0.1)";z.lineWidth=1;z.lineCap="butt";var v=Va*a.a;for(e=Math.ceil(-a.tx/v);(b=e*v+a.tx)<ma;){if(e||!Dc)z.moveTo(b,0),z.lineTo(b,pa);e++}for(e=Math.floor(a.ty/v);(b=e*v-a.ty)<pa;){if(e||!Dc)z.moveTo(0,b),z.lineTo(ma,b);e++}z.stroke()}if(0!==Ad){z.beginPath();z.strokeStyle="rgba(0,0,0,0.1)";z.lineWidth=1;z.lineCap="butt";v=Ad*a.a;var c=Math.sqrt(3);var d=a.ty/c;var f=(pa+a.ty)/c;for(e=Math.ceil(-(a.tx+f)/v);(b=e*v+a.tx)+d<ma;)z.moveTo(b+d,0),z.lineTo(b+f,pa),e++;for(e=Math.ceil(-(a.tx-d)/
+v);(b=e*v+a.tx)-f<ma;)z.moveTo(b-d,0),z.lineTo(b-f,pa),e++;v*=.5*c;for(e=Math.floor(a.ty/v);(b=e*v-a.ty)<pa;){if(e||!Dc)z.moveTo(0,b),z.lineTo(ma,b);e++}z.stroke()}Dc&&(z.beginPath(),z.strokeStyle="rgba(0,0,0,0.2)",z.lineWidth=3,z.lineCap="butt",z.lineJoin="miter",z.miterLimit=10,z.beginPath(),z.moveTo(0,-a.ty),z.lineTo(ma-6,-a.ty),z.moveTo(ma-13,-5-a.ty),z.lineTo(ma-3,-a.ty),z.lineTo(ma-13,5-a.ty),z.moveTo(a.tx,pa),z.lineTo(a.tx,6),z.moveTo(a.tx-5,13),z.lineTo(a.tx,3),z.lineTo(a.tx+5,13),z.stroke());
+Xd();C.greset();Vd();for(a=0;a<r.polygons.length;a++)v=r.polygons[a],v.isshowing&&!1!==v.visible&&(d={color:v.color,alpha:v.alpha,fillcolor:v.fillcolor,fillalpha:v.fillalpha,size:v.size,lineJoin:u.string("miter"),fillrule:u.string(v.fillrule)},E.drawpolygon([v.vertices],d,"D",!0));for(a=0;a<r.conics.length;a++)r.conics[a].isArc?(v=r.conics[a],v.isshowing&&!1!==v.visible&&(d={},d.color=v.color,d.alpha=v.alpha,d.size=v.size,E.drawarc(v,d,v.filled?"F":"D"))):(v=r.conics[a],v.isshowing&&!1!==v.visible&&
+(d={},d.color=v.color,d.alpha=v.alpha,d.size=v.size,E.drawconic(v.matrix,d)));for(a=0;a<r.lines.length;a++)a:if(v=r.lines[a],v.isshowing&&!1!==v.visible&&g._helper.isAlmostReal(v.homog))if("S"===v.kind)d={overhang:v.overhang,dashtype:v.dashtype,size:v.size,color:v.color,alpha:v.alpha,arrow:v.arrow,arrowsize:v.arrowsize,arrowposition:v.arrowposition,arrowshape:v.arrowshape,arrowsides:v.arrowsides},0<=l.mult(v.startpos.value[2],l.conjugate(v.endpos.value[2])).value.real?(q.draw$2([v.startpos,v.endpos],
+d),v.labeled&&!v.tmp&&(d=v.printname||v.name||"S",f=g.scalmult(l.real(Math.sign(v.startpos.value[2].value.real)*Math.sign(v.endpos.value[2].value.real)),g.cross(v.startpos,v.endpos)),f={x:f.value[0].value.real,y:f.value[1].value.real},e=Math.sqrt(f.x*f.x+f.y*f.y),f={x:8*f.x/e-3,y:8*f.y/e-3},f=v.labelpos||f,e=y.makeColor(Aa.textColor),b=m._helper.midpoint(m._helper.midpoint(v.startpos,v.endpos),v.endpos),Ud(v,d,b,f,e))):(y.handleModifs(d,y.lineModifs),y.drawRaySegment(v.startpos,v.endpos));else if("end"===
+v.clip.value&&"Join"===v.type)e=r.csnames[v.args[0]],d=r.csnames[v.args[1]],q.draw$2([e.homog,d.homog],{overhang:v.overhang,dashtype:v.dashtype,size:v.size,color:v.color,alpha:v.alpha});else{if("inci"===v.clip.value){e=[1E6,0];d=[-1E6,0];b=[1E6,0];f=[-1E6,0];for(c=0;c<v.incidences.length;c++){var h=r.csnames[v.incidences[c]].homog,k=h.value[0],fa=h.value[1],n=h.value[2];l._helper.isAlmostZero(n)||(k=l.div(k,n),fa=l.div(fa,n),l._helper.isAlmostReal(k)&&l._helper.isAlmostReal(fa)&&(k.value.real<e[0]&&
+(e=[k.value.real,h]),k.value.real>d[0]&&(d=[k.value.real,h]),fa.value.real<b[0]&&(b=[fa.value.real,h]),fa.value.real>f[0]&&(f=[fa.value.real,h])))}d[0]-e[0]>f[0]-b[0]?(e=e[1],d=d[1]):(e=b[1],d=f[1]);if(e!==d){q.draw$2([e,d],{dashtype:v.dashtype,size:v.size,color:v.color,alpha:v.alpha,overhang:v.overhang});break a}}q.draw$1([v.homog],{dashtype:v.dashtype,size:v.size,color:v.color,alpha:v.alpha})}for(a=0;a<r.points.length;a++)if(v=r.points[a],v.isshowing&&!1!==v.visible&&g._helper.isAlmostReal(v.homog)&&
+(d=v.color,v.behavior&&(d=v.color),q.draw$1([v.homog],{size:v.size,color:d,alpha:v.alpha,noborder:v.noborder,border:v.border}),v.labeled&&!v.tmp)){f=v.printname||v.name||"P";e=v.labelpos||{x:3,y:3};b=y.makeColor(Aa.textColor);if(!0===v.noborder.value||!1===v.border.value)b=d;Ud(v,f,v.homog,e,b)}for(a=0;a<r.texts.length;a++)Sc(r.texts[a]);if(r.ifs.length){if(la.dirty||!u.deeplyEqual(la.mat,C.drawingstate.matrix))m.IFS.updateParameters(),la.dirty=!1;la.img&&z.drawImage(la.img,0,0,ma,pa)}z.restore()}
+function Z(a,e){a=window.event?event:a;a=a.charCode?a.charCode:a.keyCode;Cd=String.fromCharCode(a);cd=a;w(e);k()}function J(a){ab=a;0===a&&(Eb[0]=Ma);w(V.multidown);ab=0}function Xb(a){ab=a;w(V.multiup);delete Eb[a];ab=0}function Ga(a){var e=a.value;a=e[0].value;var b=e[1].value;e=e[2].value;return g.turnIntoCSList([a[0],l.add(a[1],b[0]),l.add(a[2],e[0]),b[1],l.add(b[2],e[1]),e[2]])}function gd(a){var e=!0;return function(b,v){e&&(console.error("Operator "+a+" is not supported yet."),e=!1);return h}}
+function da(a,e){if("undefined"===typeof a)return"_??_";if(null===a)return"_???_";if("undefined"===a.ctype)return"___";if("number"===a.ctype)return l.niceprint(a);if("string"===a.ctype||"boolean"===a.ctype)return a.value;if("list"===a.ctype){e="[";for(var b=0;b<a.value.length;b++)e+=da(w(a.value[b])),b!==a.value.length-1&&(e+=", ");return e+"]"}if("JSON"===a.ctype)try{return Ea.niceprint(a,e)}catch(v){return Ea._helper.handlePrintException(v)}return"dict"===a.ctype?nb.niceprint(a):"function"===a.ctype?
+"FUNCTION":"infix"===a.ctype?"INFIX":"modifier"===a.ctype?a.key+"->"+da(a.value):"shape"===a.ctype?a.type:"error"===a.ctype?"Error: "+a.message:"variable"===a.ctype?da(L.getvar(a.name)):"geo"===a.ctype?a.value.name:"image"===a.ctype?"IMAGE":"_?_"}function Fb(a,e){e="undefined"===a[0].ctype;var b="undefined"===a[1].ctype,v=w(a[1]);if(e||b)return h;"variable"===a[0].ctype?L.setvar(a[0].name,v):"infix"===a[0].ctype?"_"===a[0].oper?E.assigntake(a[0],v):sa("Can't use infix expression as lvalue"):"field"===
+a[0].ctype?E.assigndot(a[0],v):"userdata"===a[0].ctype?E.assigncolon(a[0],v):"function"===a[0].ctype&&"genList"===a[0].oper?"list"===v.ctype?E.assignlist(a[0].args,v.value):sa("Expected list in rhs of assignment"):sa("Left hand side of assignment is not a recognized lvalue");return v}function oc(a,e){e=w(a[0]);a=w(a[1]);if(e.ctype===a.ctype){if("number"===e.ctype)return u.bool(e.value.real===a.value.real&&e.value.imag===a.value.imag);if("string"===e.ctype||"boolean"===e.ctype)return u.bool(e.value===
+a.value);if("list"===e.ctype)return g.equals(e,a);if("geo"===e.ctype)return u.bool(e.value===a.value)}return{ctype:"boolean",value:!1}}function oa(a,e){return u.not(oc(a,e))}function pc(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype?{ctype:"boolean",value:l._helper.isAlmostEqual(e,a)}:"string"===e.ctype&&"string"===a.ctype||"boolean"===e.ctype&&"boolean"===a.ctype?{ctype:"boolean",value:e.value===a.value}:"list"===e.ctype&&"list"===a.ctype?g.almostequals(e,a):{ctype:"boolean",
+value:!1}}function Sa(a,e){e=D(a[0]);a=D(a[1]);return"boolean"===e.ctype&&"boolean"===a.ctype?{ctype:"boolean",value:e.value&&a.value}:h}function Ic(a,e){e=D(a[0]);a=D(a[1]);return"boolean"===e.ctype&&"boolean"===a.ctype?{ctype:"boolean",value:e.value||a.value}:h}function Yb(a,e){e=a[0];"void"!==e.ctype&&(e=D(e));a=D(a[1]);var b=u.add(e,a);"Angle"===e.usage&&"Angle"===a.usage&&(b=u.withUsage(b,"Angle"));return b}function Hb(a,e){e=a[0];"void"!==e.ctype&&(e=D(e));a=D(a[1]);var b=u.sub(e,a);"Angle"===
+e.usage&&"Angle"===a.usage&&(b=u.withUsage(b,"Angle"));return b}function hd(a,e){e=D(a[0]);a=D(a[1]);var b=u.mult(e,a);"Angle"!==e.usage||a.usage?"Angle"!==a.usage||e.usage||(b=u.withUsage(b,"Angle")):b=u.withUsage(b,"Angle");return b}function Hd(a,e){e=D(a[0]);a=D(a[1]);"number"===a.ctype&&l._helper.isZero(a)&&sa("WARNING: Division by zero!");var b=u.div(e,a);"Angle"!==e.usage||a.usage?"Angle"!==a.usage||e.usage||(b=u.withUsage(b,"Angle")):b=u.withUsage(b,"Angle");return b}function Jc(a,e){e=D(a[0]);
+a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype?l.pow(e,a):h}function Da(a,e){e=Q(a[0]);a=Q(a[1]);if(e!==h&&a!==h){var b=g.cross(e,a);"Point"===e.usage&&"Point"===a.usage&&(b=u.withUsage(b,"Line"));"Line"===e.usage&&"Line"===a.usage&&(b=u.withUsage(b,"Point"));return b}return h}function R(a){var e=a.length;if(0===e)return[];if(1===e)return[0];if(2===e)return a[0][0]+a[1][1]<=a[0][1]+a[1][0]?[0,1]:[1,0];if(4<e)return qc(a);for(var b=md[e],v=Number.POSITIVE_INFINITY,c=b[0],g=0;g<b.length;++g){for(var d=
+b[g],f=0,h=0;h<e;++h)f+=a[h][d[h]];f<v&&(v=f,c=d)}return c}function qc(a){function e(){return{matched:-1,prev:-1,start:-1,cost:0,used:!1,leaf:!1}}function b(a){for(var e=0;e<g;++e)0<k[a][e]||l[e].used||(l[e].used=!0,b(l[e].matched))}function v(a){for(var e=0;e<g;++e)0<k[e][a]||h[e].used||(h[e].used=!0,v(h[e].matched))}var c=Math.abs,g=a.length,d,f,h=Array(g),l=Array(g),k=Array(g);for(d=0;d<g;++d)k[d]=Array(g);for(d=0;d<g;++d)for(h[d]=e(),l[d]=e(),h[d].cost=a[d][0],f=1;f<g;++f)h[d].cost>a[d][f]&&(h[d].cost=
+a[d][f]);for(;;){for(d=0;d<g;++d)for(f=0;f<g;++f)k[d][f]=a[d][f]-h[d].cost-l[f].cost,k[d][f]<1E-14*(c(a[d][f])+c(h[d].cost)+c(l[f].cost))&&(k[d][f]=0);for(d=0;d<g;++d)h[d].matched=l[d].matched=-1;for(var m=0;;){for(d=0;d<g;++d)h[d].used=h[d].leaf=l[d].used=l[d].leaf=!1,-1===h[d].matched&&(h[d].start=d,h[d].used=h[d].leaf=!0,h[d].prev=-1);for(var n=!1,p=!1;!p;){for(d=0;d<g;++d)if(h[d].leaf)for(h[d].leaf=!1,f=0;f<g;++f)if(!(l[f].used||0<k[d][f])&&h[d].matched!==f&&(l[f].prev=d,l[f].start=h[d].start,
+l[f].used=l[f].leaf=!0,-1===l[f].matched)){h[l[f].start].prev=f;n=!0;break}if(n)break;p=!0;for(f=0;f<g;++f)l[f].leaf&&(l[f].leaf=!1,d=l[f].matched,h[d].used||(h[d].prev=f,h[d].start=l[f].start,h[d].used=h[d].leaf=!0,p=!1))}if(!n)break;for(n=0;n<g;++n)if(-1===h[n].matched&&-1!==h[n].prev){f=h[n].prev;do d=l[f].prev,l[f].matched=d,h[d].matched=f,f=h[d].prev;while(d!==n);++m}}if(m===g)break;for(d=0;d<g;++d)h[d].used=h[d].leaf=l[d].used=l[d].leaf=!1;for(d=0;d<g;++d)-1===h[d].matched&&b(d);for(f=0;f<g;++f)-1===
+l[f].matched&&v(f);for(d=0;d<g;++d)-1===h[d].matched||h[d].used||l[h[d].matched].used||(h[d].used=!0);m=Number.POSITIVE_INFINITY;for(d=0;d<g;++d)if(!h[d].used)for(f=0;f<g;++f)l[f].used||m>k[d][f]&&(m=k[d][f]);for(d=0;d<g;++d)h[d].used||(h[d].cost+=m),l[d].used&&(l[d].cost-=m)}a=Array(g);for(d=0;d<g;++d)f=h[d].matched,a[d]=f;return a}function eb(a,e){e=w(a[0]);a=D(a[1]);"string"!==e.ctype&&"JSON"!==e.ctype&&(e=g.asList(e));if("JSON"!==e.ctype&&"number"===a.ctype){a=Math.floor(a.value.real);0>a&&(a=
+e.value.length+a+1);if(0<a&&a<e.value.length+1)return"list"===e.ctype?e.value[a-1]:{ctype:"string",value:e.value.charAt(a-1)};sa("WARNING: Index out of range!");return h}if("JSON"===e.ctype){a=da(a);if(-1!==da.errorTypes.indexOf(a))return h;e=e.value[a];return void 0!==e&&e.ctype?e:h}if("list"===a.ctype){for(var b=[],v=0;v<a.value.length;v++){var c=D(a.value[v]);b[v]=eb([e,c],[])}return g.turnIntoCSList(b)}return h}function Ib(a,e){e=w(a[0]);a=w(a[1]);if("shape"===e.ctype&&"shape"===a.ctype)return E.shapeconcat(e,
+a);e=g.asList(e);a=g.asList(a);return"list"===e.ctype&&"list"===a.ctype?g.concat(e,a):h}function Kc(a,e){e=w(a[0]);a=w(a[1]);return"list"===e.ctype&&"list"===a.ctype?g.set(g.common(e,a)):"shape"===e.ctype&&"shape"===a.ctype?E.shapecommon(e,a):h}function Lc(a,e){e=w(a[0]);a=w(a[1]);return"list"===e.ctype&&"list"===a.ctype?g.remove(e,a):"shape"===e.ctype&&"shape"===a.ctype?E.shaperemove(e,a):h}function rb(a,e){e=w(a[0]);a=w(a[1]);return"list"===e.ctype?g.append(e,a):h}function A(a,e){e=w(a[0]);a=w(a[1]);
+return"list"===a.ctype?g.prepend(e,a):h}function Zb(a,e){a|=0;e|=0;if(0===a&&0===e)return 0;for(;0!==e;){var b=a;a=e;e=b%e|0}return a}function Id(a){return 1===a?0:1}function dc(a,e,b){var x=e*e-4*a*b;0<=x?(x=Math.sqrt(x),0<e&&(x=-x),e=[[x-e,2*a],[2*b,x-e]]):e=null;if(null===e)return null;a=e[0][0]/e[0][1];e=e[1][0]/e[1][1];return e<a?[e,a]:[a,e]}function id(a,e,b,v,c,d,g,f){f=void 0===f?0:f;if(-1!==e.indexOf("\n")){var x=Infinity,N=-Infinity,h=Infinity,Y=-Infinity;e.split("\n").forEach(function(e){e=
+id(a,e,b,v,c,d);x>e.left&&(x=e.left);N<e.right&&(N=e.right);h>e.top&&(h=e.top);Y<e.bottom&&(Y=e.bottom);v+=g});return{left:x,right:N,top:h,bottom:Y}}var l=a.measureText(e);f?(a.save(),a.translate(b,v),a.rotate(-f),a.fillText(e,-l.width*c,0),a.restore()):a.fillText(e,b-l.width*c,v);return{left:b-l.width*c,right:b+l.width*(1-c),top:v-.84*d,bottom:v+.36*d}}function Ya(a){return"image"===a.ctype?a.value:"string"===a.ctype&&gb.hasOwnProperty(a.value)?gb[a.value].value:null}function Jb(a,e,b,v,c){var x=
+[];if(a.readPixels)x=a.readPixels(e,b,v,c);else{if(a.img.getContext){var d=a.img.getContext("2d");var g=d.getImageData(e,b,v,c).data}else try{xd||(xd=document.createElement("canvas")),xd.width=v,xd.height=c,d=xd.getContext("2d"),d.drawImage(a.img,e,b,v,c,0,0,v,c),g=d.getImageData(0,0,v,c).data}catch(fa){console.log(fa)}for(var N in g)x.push(g[N]/255)}return x}function jd(a){return a.replace(/[^A-Za-z0-9 \u0080-\uffff]/ig,"\\$&")}function xa(a,e,b){var x=a;e&&(x=x+" at "+e.row+":"+e.col);b&&(x=x+": \u2018"+
+b+"\u2019");x=Error(x);x.name="CindyScriptParseError";x.description=a;x.location=e;x.text=b;return x}function $b(a){this.input=a;this.re=new RegExp(Ke,"g");for(var e=[],b=a.indexOf("\n")+1;b;)e.push(b),b=a.indexOf("\n",b)+1;e.push(a.length);this.bols=e;this.bol=this.pos=0;this.line=1}function rc(a){var e=a[a.length-2],b=a[a.length-3],v=a[a.length-1];if(b){if(b.isSuperscript&&e.precedence<=b.precedence)throw xa("Operator not allowed after superscript",e.start,e.text);if(v){if(!e.op.infix)throw xa("Operator may not be used infix",
+e.start,e.text);}else if(!e.op.postfix)throw xa("Operator may not be used postfix",e.start,e.text);}else if(v){if(!e.op.prefix)throw xa("Operator may not be used prefix",e.start,e.text);}else if(!e.op.bare)throw xa("Operator without operands",e.start,e.text);e.ctype="infix";e.oper=e.op.sym;e.args=[b,v];a.splice(a.length-3,3,e)}function kd(a,e,b,v){a.length&1||a.push(null);for(b=Ua[b];3<=a.length&&a[a.length-2].precedence<=b.precedence;)rc(a);a.push({op:b,precedence:b.precedence+(b.rassoc?1:0),start:e.start,
+end:e.end,text:e.text,rawtext:e.rawtext});b="";for(var x=e.text,c=0;c<x.length;++c)b+="0123456789+-".charAt(v.indexOf(x.charAt(c)));e.ctype="number";e.value={real:+b,imag:0};a.push(e);rc(a)}function ld(a,e){var b=[],v="}"===e;a:for(;;){var c=a.next();switch(c.toktype){case "OP":var d=Ua[c.text];"_"!==d.sym||!b.length||b.length&1||"OP"!==b[b.length-1].toktype||":="!==b[b.length-1].op.sym||(b.pop(),d=Ua[":=_"],c.text=d.sym);c.op=d;c.precedence=d.precedence;for(b.length&1||b.push(null);3<=b.length&&
+b[b.length-2].precedence<=c.precedence;)rc(b);d.rassoc&&c.precedence++;v&&":"===d.sym&&(c.jsonatom=!0,c.precedence=Ua[","].precedence,v=!1);"}"===e&&","===d.sym&&0<b.length&&b[b.length-1].jsonatom&&(v=!0);b.push(c);break;case "ID":c.ctype="variable";c.name=c.text;if(b.length&1)throw xa("Missing operator",c.start,c.text);b.push(c);break;case "NUM":c.ctype="number";c.value={real:+c.text,imag:0};if(b.length&1)throw xa("Missing operator",c.start,c.text);b.push(c);break;case "STR":c.ctype="string";c.value=
+c.raw.substring(1,c.raw.length-1);if(b.length&1)throw xa("Missing operator",c.start,c.text);b.push(c);break;case "SUB":kd(b,c,"_","\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089\u208a\u208b");break;case "SUP":kd(b,c,"^","\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079\u207a\u207b");b[b.length-1].isSuperscript=!0;break;case "BRA":d="[](){}||".indexOf(c.text);if(c.text===e||d&1)break a;d="[](){}||".charAt(d+1);var g=ld(a,d),f=g.closedBy;if(f.text!==d)throw xa("Opening "+c.text+
+" at "+c.start.row+":"+c.start.col+" closed by "+(f.text||"EOF")+" at "+f.start.row+":"+f.start.col);f=c.text+f.text;d=[];if(g=g.expr){for(;g&&"infix"===g.ctype&&","===g.oper;)d.push(g.args[0]),g=g.args[1];d.push(g)}if(b.length&1){if("{}"===f)throw xa("{\u2026} not yet defined for operators.",c.start);g=b[b.length-1];if("variable"!==g.ctype)throw xa("Function name must be an identifier",g.start);if(2<b.length&&b[b.length-2].precedence<Xc)throw xa("Function call in indexing construct must be enclosed in parentheses",
+c.start);g.ctype="function";c=g.args=[];f=g.modifs={};for(var h=0;h<d.length;++h){var l=d[h];if(l&&"infix"===l.ctype&&"->"===l.oper){var k=l.args[0];if("variable"!==k.ctype)throw xa("Modifier name must be an identifier",l.start);f[k.name]=l.args[1]}else c.push(l)}g.oper=g.name.toLowerCase()+"$"+g.args.length}else if("||"===f)if(1===d.length)b.push({ctype:"function",oper:"abs_infix",args:d,modifs:{}});else if(2===d.length)b.push({ctype:"function",oper:"dist_infix",args:d,modifs:{}});else throw xa("Don't support |\u2026| with "+
+d.length+" arguments",c.start);else"{}"===f?b.push({ctype:"function",oper:"genJSON",args:d,modifs:{}}):"[]"!==f&&1===d.length?b.push({ctype:"paren",args:d}):0===d.length?b.push({ctype:"list",value:[]}):b.push({ctype:"function",oper:"genList",args:d,modifs:{}});break;case "EOF":break a}}for(b.length&1||b.push(null);3<=b.length;)rc(b);return{expr:b[0],closedBy:c}}function sc(a){this.usedFunctions={};this.usedVariables={}}function w(a){if(void 0===a)return h;if("infix"===a.ctype)return a.impl(a.args,
+{},a);if("variable"===a.ctype)return w(L.getvar(a.name));if("function"===a.ctype)return Ed.push(a),a=E.evaluate(a.oper,a.args,a.modifs),Ed.pop(),a;if("void"===a.ctype)return h;if("field"===a.ctype){var e=w(a.obj);return"geo"===e.ctype?Ha.getField(e.value,a.key):"list"===e.ctype?g.getField(e,a.key):"JSON"===e.ctype?Ea.getField(e,a.key):h}return"userdata"===a.ctype?(e=w(a.obj),a=u.string(da(w(a.key))),"_?_"===a.value&&(a=h),"geo"===e.ctype?Ha.getuserData(e.value,a):"list"===e.ctype||"string"===e.ctype?
+Ha.getuserData(e,a):h):a}function D(a){a=w(a);if("geo"===a.ctype){var e=a.value;if("P"===e.kind)return Ha.getField(e,"xy");if("V"===e.kind)return e.value}return a}function Q(a){a=w(a);if("geo"===a.ctype){var e=a.value;if("P"===e.kind||"L"===e.kind)return Ha.getField(e,"homog")}return g._helper.isNumberVecN(a,3)?a:g._helper.isNumberVecN(a,2)?(e=g.turnIntoCSList([a.value[0],a.value[1],l.real(1)]),a.usage&&(e=u.withUsage(e,a.usage)),e):h}function lb(a){var e=new sc;e.usedFunctions=Sb;e.infixmap=S;a=
+e.parse(a);for(var b in e.usedVariables)L.create(b);return a}function le(a,e){return{ctype:"infix",args:[],impl:function(){Ed=[{oper:e}];var b=w(a);Ed=[];return b}}}function sa(a){Qa.err(a+Ed.map(function(a){return"\n at "+a.oper}).join("\n"))}function Jd(){this._path=[];this._defs=["<defs>"];this._imgcache=[];this._body=[];this._saveStack=[""];this._clipIndex=0;this._stroke=this._fill="#000";this._strokeOpacity=this._fillOpacity=null;this.height=this.width=0;this.lineWidth=1;this.lineCap="butt";
+this.lineJoin="miter";this.miterLimit=10;this.globalAlpha=1}function Kb(){this._body=[];this._yPos=this._xPos=NaN;this._extGState={Af255:"<< /ca 1 >>",As255:"<< /CA 1 >>"};this._objects=[["%PDF-1.4\n"]];this._offset=this._objects[0][0].length;this._nextIndex=5;this._imgcache=[];this._xobjects={};this._pathUsed=-1;this._fillAlpha=this._strokeAlpha=this._globalAlpha=1;this.height=this.width=0;this.lineWidth=1;this.lineCap="butt";this.lineJoin="miter";this.miterLimit=10}function Kd(a,e){var b=a.width,
+v=a.height,c=document.createElement("canvas");c.setAttribute("width",b);c.setAttribute("height",v);c.setAttribute("style","display:none;");var d=La.canvas;d.parentNode.insertBefore(c,d.nextSibling);try{return c.getContext("2d").drawImage(a,0,0,b,v),c.toDataURL(e||"image/png")}finally{c.parentNode.removeChild(c)}}function me(a){a=a.replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/]+/g,"");var e=new Uint8Array(3*a.length>>2),b,v;for(v=b=0;b+3<a.length;b+=4){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b));
+var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+1));var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+2));var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+3));e[v++]=c<<2|d>>4;e[v++]=d<<4|g>>2;e[v++]=g<<6|f}switch(a.length-b){case 0:break;case 2:c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+
+1));e[v++]=c<<2|d>>4;break;case 3:c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+1));g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b+2));e[v++]=c<<2|d>>4;e[v++]=d<<4|g>>2;break;default:throw Error("Malformed Base64 input: "+(a.length-b)+" chars left: "+a.substr(b));}if(v!==e.length)throw Error("Failed assertion: "+v+" should be "+
+e.length);return e}function ne(a){function e(e){return(a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3])>>>0}if(57>a.length)throw Error("Too short to be a PNG file");if(2303741511!==e(0)||218765834!==e(4))throw Error("PNG signature missing");for(var b=[],v=8;v<a.length;){if(v+12>a.length)throw Error("Incomplete chunk at offset 0x"+v.toString(16));var c=e(v);if(2147483648<=c)throw Error("Chunk too long");var d=v+12+c;if(d>a.length)throw Error("Incomplete chunk at offset 0x"+v.toString(16));var g=a.subarray(v+
+4,v+8);g=String.fromCharCode.apply(String,g);b.push({len:c,type:g,data:a.subarray(v+8,v+8+c),crc:e(v+8+c)});v=d}return b}function tc(a,e){var b;if(b=/^rgba\(([0-9.]+), *([0-9.]+), *([0-9.]+), *([0-9.]+)\)$/.exec(a))e(+b[1],+b[2],+b[3],+b[4]);else if(b=/^rgb\(([0-9.]+), *([0-9.]+), *([0-9.]+)\)$/.exec(a))e(+b[1],+b[2],+b[3],1);else throw Error("Can't handle color style "+a);}function Ld(a){var e=1;Object.keys(gb).forEach(function(b){var x=gb[b].value.img;if(void 0===x.cachedDataURL&&x.src)if("data:"===
+x.src.substr(0,5))x.cachedDataURL=x.src;else{++e;x.cachedDataURL=null;var c=new XMLHttpRequest;c.responseType="blob";c.onreadystatechange=function(){if(c.readyState===XMLHttpRequest.DONE)if(200===c.status){var b=new FileReader;b.onloadend=function(){x.cachedDataURL=b.result;console.log("Cached data for image "+x.src);0===--e&&a()};b.readAsDataURL(c.response)}else console.error("Failed to load "+x.src+": "+c.statusText),0===--e&&a()};c.open("GET",x.src,!0);c.send()}});0===--e&&a()}function Lb(a,e,
+b){for(b||(b="0");a.length<e;)a=b+a;return a}function Mb(){null!==Fd&&(window.URL.revokeObjectURL(Fd),Fd=null)}function Mc(a){Ld(function(){var e=z;try{z=new a;z.width=ma;z.height=pa;ca();var b=z.toBlob();Fd=window.URL.createObjectURL(b);Me(Fd)}finally{z=e}})}function Nb(a){var e=null,b=1E6;console.log("getElementAtMouse");for(var v=0;v<r.gslp.length;v++){var c=r.gslp[v];if(!c.pinned&&!1!==c.visible&&!0!==c.tmp){var d=C.drawingstate.matrix.sdet;if("P"===c.kind){var f=g.normalizeZ(c.homog);if(!g._helper.isAlmostReal(f))continue;
+var h=f.value[0].value.real-a.x;var k=f.value[1].value.real-a.y;var m=Math.sqrt(h*h+k*k);c.narrow&m>20/d&&(m=1E4)}else if("C"===c.kind)k=r.csnames[c.args[0]],m=0,"undefined"!==typeof c.radius&&(m=c.radius.value.real),h=l.div(k.homog.value[0],k.homog.value[2]).value.real,k=l.div(k.homog.value[1],k.homog.value[2]).value.real,h-=a.x,k-=a.y,m=Math.sqrt(h*h+k*k)-m,k=h=0,0>m&&(m=-m),m+=30/d;else if("L"===c.kind||"S"===c.kind)h=c.homog,m=l,k=m.add(m.mult(h.value[0],m.conjugate(h.value[0])),m.mult(h.value[1],
+m.conjugate(h.value[1]))),k=g.scaldiv(m.sqrt(k),h),m=k.value[0].value.real*a.x+k.value[1].value.real*a.y+k.value[2].value.real,h=k.value[0].value.real*m,k=k.value[1].value.real*m,0>m&&(m=-m),m+=1;if(m<b+.2/d){b=m;e=c;var n={x:h,y:k}}}}return null===e?null:{mover:e,offset:n,prev:{x:a.x,y:a.y}}}function Pa(){return"P"+Ye++}function Ob(a){var e=H[De].actions;e[dd].event===a&&e[dd].do()&&(k(),dd===e.length-1?(ib=[],dd=Vb=0):dd++)}function nd(a){return a&&.5>Math.abs(a.offset.x)&&.5>Math.abs(a.offset.y)&&
+!a.mover.tmp}function Md(a){return nd(a)&&"P"===a.mover.kind}function Nd(a){return nd(a)&&("L"===a.mover.kind||"S"===a.mover.kind)}function Pc(a){ya={mover:a,offset:{x:0,y:0},prev:{x:ja.x,y:ja.y}}}function ac(){var a=Nb(ja);Md(a)?ib[Vb]=a.mover:(ib[Vb]={type:"Free",name:Pa(),labeled:!0,pos:[Ma[0],Ma[1],1]},Za(ib[Vb]));Vb++}function Pb(){var a=Nb(ja);return Nd(a)?(ib[Vb]=a.mover,Vb++,!0):!1}function Od(){var a=Nb(ja),e;(e=Nd(a))||(e=nd(a)&&"C"===a.mover.kind);return e?(ib[Vb]=a.mover,Vb++,!0):!1}function ec(){var a=
+Nb(ja);if(Md(a))for(Gd.args[1]=a.mover.name,a=0;a<r.gslp.length;a++){var e=r.gslp[a];!0===e.tmp&&Rc(e.name)}else for(a=0;a<r.gslp.length;a++)e=r.gslp[a],!0===e.tmp&&(e.tmp=!1)}function Qc(a){var e={type:"Free",name:Pa(),labeled:!0,pos:[Ma[0],Ma[1],1],tmp:!0};e=Za(e);Gd=Za({type:a,name:Pa(),labeled:!0,args:[ib[0].name,e.name]});Pc(e)}function oe(a){for(var e in a)null!==a[e]&&(Aa[e]=a[e])}function pe(a){Object.keys(m).forEach(function(a){var e=m[a];Cb(e.signature||"_helper"===a,a+" has no signature");
+void 0!==e.updatePosition&&void 0===e.stateSize&&(e.stateSize=0)});r.gslp=[];r.csnames={};r.points=[];r.lines=[];r.conics=[];r.texts=[];r.free=[];r.polygons=[];r.ifs=[];r.sets={points:[],lines:[],conics:[]};a.forEach(od);de()}function Pd(a){"undefined"===typeof a.tracedim&&(a.tracedim=1);"undefined"===typeof a.tracelength&&(a.tracelength=100);"undefined"===typeof a.traceskip&&(a.traceskip=1);a._traces=Array(a.tracelength);a._traces_index=0;a._traces_tick=0}function Qd(a){void 0===a.size&&(a.size=
+Aa.pointSize);a.size=l.real(a.size);!a.movable||a.pinned?(a.color=g.realVector(a.color||Aa.pointColor),a.color=g.scalmult(l.real(Aa.dimDependent),a.color)):a.color=g.realVector(a.color||Aa.pointColor);void 0===a.alpha&&(a.alpha=Aa.alpha);a.alpha=l.real(a.alpha);"boolean"!==typeof a.noborder&&(a.noborder=Aa.noborder);a.noborder=u.bool(a.noborder);"boolean"!==typeof a.border&&(a.border=!Aa.noborder);a.border=u.bool(a.border);a.drawtrace&&Pd(a)}function fc(a){void 0===a.size&&(a.size=Aa.lineSize);a.size=
+l.real(a.size);a.color=g.realVector(a.color||Aa.lineColor);void 0===a.alpha&&(a.alpha=Aa.alpha);a.alpha=l.real(a.alpha);a.clip=u.string(a.clip||Aa.clip);void 0===a.overhang&&(a.overhang=Aa.overhangLine);a.overhang=l.real(a.overhang);a.dashtype&&(a.dashtype=u.wrap(a.dashtype))}function Rd(a){void 0===a.overhang&&(a.overhang=Aa.overhangSeg);a.arrow&&(a.arrow=u.bool(a.arrow));a.arrowsize&&(a.arrowsize=l.real(a.arrowsize));a.arrowposition&&(a.arrowposition=l.real(a.arrowposition));a.arrowshape&&(a.arrowshape=
+u.string(a.arrowshape));a.arrowsides&&(a.arrowsides=u.string(a.arrowsides));fc(a);a.clip=u.string("end")}function Sd(a){a.size=void 0!==a.textsize?a.textsize:void 0!==a.size?a.size:Aa.textsize;a.size=l.real(+a.size)}function vb(a){a.filled=void 0!==a.filled?u.bool(a.filled):u.bool(!0);a.fillcolor=void 0===a.fillcolor?h:g.realVector(a.fillcolor);void 0===a.fillalpha&&(a.fillalpha=0);a.fillalpha=l.real(a.fillalpha);fc(a)}function Za(a,e){a=od(a);de();return"boolean"===typeof e&&e&&a.Duplicate?(e=a.Duplicate,
+console.log("duplication detected: removing "+a.name+" (type "+a.kind+") (duplicate of "+e.name+")."),Rc(a.name),e):a}function od(a){if(void 0!==r.csnames[a.name]){console.log("Element name '"+a.name+"' already exists");var e=r.csnames[a.name];m[e.type].isMovable&&"P"===m[e.type].kind&&Ta(e,a.pos,"homog");return e}for(;ed.hasOwnProperty(a.type);)a.type=ed[a.type];if(e=Ee[a.type]){var b=e(a),v=null;for(e=0;e<b.length;++e)v=Za(b[e]);return v}var c=m[a.type];b=!1;if(!c)return console.error(a),console.error("Operation "+
+a.type+" not implemented yet"),null;if("**"!==c.signature)if(!Array.isArray(c.signature)&&"*"===c.signature.charAt(1))b=!0,a.args.forEach(function(e){if(r.csnames[e].kind!==c.signature.charAt(0))return console.error("Not all elements in set are of same type: "+a.name+" expects "+c.signature+" but "+e+" is of kind "+r.csnames[e].kind),"undefined"!==typeof window&&window.alert("Not all elements in set are of same type: "+a.name),null});else if(c.signature.length!==(a.args?a.args.length:0))return console.error("Wrong number of arguments for "+
+a.name+" of type "+a.type),"undefined"!==typeof window&&window.alert("Wrong number of arguments for "+a.name),null;if(a.args)for(e=0;e<a.args.length;++e){if(!r.csnames.hasOwnProperty(a.args[e]))return console.log("Dropping "+a.name+" due to missing argument "+a.args[e]),null;if("**"!==c.signature&&!b&&(v=r.csnames[a.args[e]].kind,c.signature[e]!==v&&("S"!==v||"L"!==c.signature[e])))return window.alert("Wrong argument kind "+v+" as argument "+e+" to element "+a.name+" of type "+a.type),null}c.signatureConstraints&&
+!c.signatureConstraints(a)&&window.alert("signature constraints violated for element "+a.name);r.gslp.push(a);r.csnames[a.name]=a;e=ob.length;a.kind=c.kind;a.stateIdx=e;e+=c.stateSize;a.incidences=[];a.isshowing=!0;a.movable=!1;c.isMovable&&(a.movable=!0,r.free.push(a));"P"===a.kind&&(r.points.push(a),Qd(a));"L"===a.kind&&(r.lines.push(a),fc(a));"C"===a.kind&&(r.conics.push(a),fc(a));"S"===a.kind&&(r.lines.push(a),Rd(a));"Text"===a.kind&&(r.texts.push(a),Sd(a));"Poly"===a.kind&&(r.polygons.push(a),
+vb(a));"IFS"===a.kind&&r.ifs.push(a);/^[P|L|S|C]s$/.test(a.kind)&&r.sets[{P:"points",L:"lines",S:"lines",C:"conics"}[a.kind[0]]].push(a);Tc(e);Ja=yb=ob;lc=!0;c.initialize&&(jb=pb=a.stateIdx,a.param=c.initialize(a),Cb(pb===a.stateIdx+c.stateSize,"State fully initialized"));jb=pb=a.stateIdx;c.updatePosition(a,!1);Cb(jb===a.stateIdx+c.stateSize,"State fully consumed");Cb(pb===a.stateIdx+c.stateSize,"State fully updated");lc=!1;Ja=Ub.in;Ja.set(ob);yb=Ub.out;pd(a,c);je={};try{qa(a),Qb(a)}catch(Y){console.error(Y)}return r.csnames[a.name]}
+function Rc(a){if(r.csnames.hasOwnProperty(a)){var e={};Object.keys(r.csnames).forEach(function(a){var b=r.csnames[a];b.hasOwnProperty("args")&&b.args.forEach(function(b){e.hasOwnProperty(b)||(e[b]={});e[b][a]=!0})});var b=function(a,x){x[a]=!0;if(!e.hasOwnProperty(a))return x;for(var c in e[a])x[c]||b(c,x);return x};a=b(a,{});qe(a)}else console.log("removeElement: name "+a+"does not exist.")}function qe(a){var e=Object.keys(a),b=function(a,e){return function(e){return a[e.name]?!1:!0}},c={};e.forEach(function(e){r.csnames[e].incidences.forEach(function(e){c[e]||
+(r.csnames[e].incidences=r.csnames[e].incidences.filter(function(e){return!a[e]}),c[e]=!0)})});"conics free gslp ifs lines points polygons texts".split(" ").map(function(e){r[e]=r[e].filter(b(a,e))});for(var d in r.sets)r.sets[d]=r.sets[d].filter(b(a,"set of "+d));e.forEach(function(a){delete r.csnames[a]});je={}}function Td(a,e){var b=r.csnames[e.args[0]].homog,c=r.csnames[e.args[1]].homog;e=a.homog;a=l.div(b.value[0],b.value[2]);b=l.div(b.value[1],b.value[2]);var d=l.div(c.value[0],c.value[2]);
+c=l.div(c.value[1],c.value[2]);var g=l.div(e.value[0],e.value[2]);e=l.div(e.value[1],e.value[2]);return l._helper.isAlmostReal(a)&&l._helper.isAlmostReal(b)&&l._helper.isAlmostReal(d)&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(g)&&l._helper.isAlmostReal(e)?(a=a.value.real,b=b.value.real,d=d.value.real,c=c.value.real,g=g.value.real,e=e.value.real,a=Math.sqrt((a-d)*(a-d)+(b-c)*(b-c))-Math.sqrt((a-g)*(a-g)+(b-e)*(b-e))-Math.sqrt((d-g)*(d-g)+(c-e)*(c-e)),1E-15>a*a):!1}function pd(a,e){a.isshowing=
+!0;if(a.args)for(var b=0;b<a.args.length;b++)if(!r.csnames[a.args[b]].isshowing){a.isshowing=!1;return}e.visiblecheck&&e.visiblecheck(a)}function Ud(a,e,b,c,d){var x=a.textsize||Aa.textsize,v=!0===a.textbold,g=!0===a.textitalics,f=a.text_fontfamily||Aa.fontFamily,N=c.x*c.x+c.y*c.y,h=1;0<N&&(h=1+a.size.value.real/Math.sqrt(N));a=a.alpha||l.real(Aa.alpha);E.drawtext([b,u.wrap(e)],{x_offset:u.wrap(h*c.x),y_offset:u.wrap(h*c.y),size:u.wrap(x),bold:u.wrap(v),italics:u.wrap(g),family:u.wrap(f),color:d,
+alpha:a})}function Sc(a){a._bbox=null;if(a.isshowing&&!1!==a.visible){var e={size:a.size},b=a.homog,c=a.text,d=m[a.type].getText;c=d?d(a):c.replace(/@[$#]"([^"\\]|\\.)*"/g,function(a){try{var e=JSON.parse(a.substring(2));var b=r.csnames[e];if(!b)return"?"}catch(cf){return"?"}switch(a.charAt(1)){case "$":return b.printname||e;case "#":return"V"!==b.kind?"?":da(b.value)}});d=null;if(a.html){var g=a._textCache||{text:!1},f=a.html,h=f.parentNode,l=h.parentNode;d=function(e,b,x,c,v){b/=wa;x/=wa;v=y.bold+
+y.italics+Math.round(v/wa*10)/10+"px "+y.family;g.invisible&&l.style.removeProperty("display");if(e!==g.text||v!==g.font||b!==g.x||x!==g.y||c!==g.align){v!==g.font&&(f.style.font=v,f.style.lineHeight=Aa.lineHeight);e!==g.text&&!1!==e&&!1===Je(f,e,v)&&(e=!1);l.style.left=b+"px";l.style.top=x+"px";if(c||h.style.transform)h.style.transform="translateX("+-100*c+"%)";a._textCache={text:e,font:v,x:b,y:x,align:c}}}}c=u.string(c);a.dock&&(a.dock.to?b=r.csnames[a.dock.to].homog:Ne.hasOwnProperty(a.dock.corner)&&
+(b=q.screenbounds$0([],{}),b=b.value[Ne[a.dock.corner]]),e.offset=a.dock.offset);a.align&&(e.align=u.string(a.align));b&&(a._bbox=E.drawtext([b,c],e,d))}else a.html&&(a.html.parentNode.parentNode.style.display="none",a._textCache={invisible:!0})}function Vd(){function a(){var a=h++/b._traces.length,e=b._traces[f];e&&(a*=c*a*a,q.draw$1([e],{size:l.real(d),color:b.color,alpha:l.real(a)}));d*=g}for(var e=0;e<r.points.length;e++){var b=r.points[e];if(b.drawtrace){b._traces_tick===b.traceskip?(b._traces[b._traces_index]=
+b.homog,b._traces_index=(b._traces_index+1)%b._traces.length,b._traces_tick=0):b._traces_tick++;var c=b.alpha.value.real,d=b.size.value.real,g=1;1!==b.tracedim&&(d*=b.tracedim,g=Math.pow(b.tracedim,-1/b._traces.length));var f,h=0;for(f=b._traces_index;f<b._traces.length;++f)a();for(f=0;f<b._traces_index;++f)a()}}}function Cb(a,e){e="Assertion failed: "+e;if(!a)throw console.log(e),Ab(),"undefined"!==typeof alert&&alert(e),Error(e);}function Tc(a){if(a!==ob.length){var e,b=Fe.length;if(mc.length<a*
+b){var c=2*a;mc=new Float64Array(b*c)}else c=mc.length/b|0;for(e=0;e<b;++e)Ub[Fe[e]]=mc.subarray(e*c,e*c+a);a=ob;Ja=Ub.in;yb=Ub.out;ob=Ub.good;ob.set(a)}}function gc(){ob.set(Ja);sb=!1;$d(!1);for(var a=ob.length,e=Math.abs,b=0;b<a;b+=2)e(ob[b])>1E12*e(ob[b+1])&&(ob[b+1]=0)}function uc(){if(fd)sb=!0;else throw Oe;}function Wd(a,e,b,c,d){return u.add(c,u.mult(b,u.sub(d,c)))}function Xd(){P&&(P.currentMouseAndScripts=[]);Ge=!0;if(ya){var a=ya.mover,e=g.realVector([ja.x+ya.offset.x,ja.y+ya.offset.y,1]);
+Yd(a,e,"mouse");ya.prev.x=ja.x;ya.prev.y=ja.y}w(V.move);w(V.draw);sb||gc();Ge=!1;P&&(P.fullLog.push(g.turnIntoCSList([g.turnIntoCSList(P.currentMouseAndScripts)])),P.length>P.logLength&&P.splice(0,P.length-P.logLength),P.currentMouseAndScripts=null,P.postMouseHooks.forEach(function(a){a()}))}function Ta(a,e,b){Yd(a,e,b);Ge||sb||gc()}function Yd(a,e,b){P&&P.currentMouseAndScripts&&(P.currentMover=[]);a===Pe?(Ja.set(ob),sb=!1):(Pe=a,gc());yb.set(Ja);var x=1E4;var c=je[a.name];if(!c){var d={},f=0;c=
+[];d[a.name]=a;for(var h=r.gslp,k=0;k<h.length;++k){var n=h[k],na=n.args;if(na)for(var p=0;p<na.length;++p)d.hasOwnProperty(na[p])&&(d[n.name]=n,c[f++]=n)}je[a.name]=c}d=-1;f=.9;var q;h=m[a.type];k=h.parameterPath||Wd;jb=a.stateIdx;n=h.getParamFromState(a);jb=pb=a.stateIdx;na=h.getParamForInput(a,e,b);for(p=d+f;d!==p;){var t=p*p,w=.5/(1+t);w=l.complex(2*p*w+.5,(1-t)*w);fd=d+.5*f<=d||0===x;0===x&&console.log("tracing limit Reached");t=!1;P&&P.currentMouseAndScripts&&(P.currentStep=[]);try{jb=pb=a.stateIdx;
+var y=k(a,p,w,n,na);P&&(P.currentParam=y);w=yb;yb=Ja;h.putParamToState(a,y);yb=w;pb=a.stateIdx;P&&(P.currentElement=a);h.updatePosition(a,!0);Cb(jb===a.stateIdx+h.stateSize,"State fully consumed");Cb(pb===a.stateIdx+h.stateSize,"State fully updated");for(q=0;q<c.length;++q){var z=c[q];var C=m[z.type];jb=pb=z.stateIdx;P&&(P.currentElement=z);C.updatePosition(z,!1);Cb(jb===z.stateIdx+C.stateSize,"State fully consumed");Cb(pb===z.stateIdx+C.stateSize,"State fully updated")}P&&(P.currentElement=null);
+d=p;f*=1.25;p+=f;1<=p&&(p=1);yb=Ja;Ja=w}catch(Le){if(Le!==Oe)throw Le;f*=.5;p=d+f;--x;t=!0}P&&P.currentMouseAndScripts&&(P.currentMover.push(g.turnIntoCSList([g.turnIntoCSList(P.currentStep),u.wrap(t),u.wrap(d),u.wrap(p),u.wrap(P.currentParam)])),P.currentStep=null,P.currentParam=null)}$d(sb);for(q=0;q<c.length;++q)z=c[q],C=m[z.type],pd(z,C);P&&P.currentMouseAndScripts&&(P.currentMouseAndScripts.push(g.turnIntoCSList([g.turnIntoCSList(P.currentMover),u.wrap(sb),u.wrap(a.name),e,u.wrap(b),n,na])),
+P.currentMover=null)}function Zd(){gc();fd=!0;for(var a=r.gslp,e=0;e<a.length;e++){var b=a[e],c=m[b.type];jb=pb=b.stateIdx;c.updatePosition(b,!1);pd(b,c)}a=yb;yb=Ja;Ja=a;gc()}function $d(a){var e=d.tracingStateReport;"string"===typeof e&&(document.getElementById(e).textContent=a?"BAD":"GOOD")}function ae(){return g.turnIntoCSList(P.fullLog.slice())}function re(a){var e=JSON.stringify(P.fullLog);a=new Blob([e],{type:a?"application/octet-stream":"application/json"});return window.URL.createObjectURL(a)}
+function hc(){var a=jb;jb+=2;return l.complex(Ja[a],Ja[a+1])}function ha(a){for(var e=Array(a),b=0;b<a;++b)e[b]=hc();return g.turnIntoCSList(e)}function wb(a){yb[pb]=a.value.real;yb[pb+1]=a.value.imag;pb+=2}function ea(a){for(var e=0,b=a.value.length;e<b;++e)wb(a.value[e])}function mb(a,e){var b=ha(3),c=ha(3);a=qd(a,e,b,c);ea(a[0]);ea(a[1]);return g.turnIntoCSList(a)}function qd(a,e,b,c){if(lc)return[a,e];var x=g.projectiveDistMinScal(b,a),v=g.projectiveDistMinScal(b,e),d=g.projectiveDistMinScal(c,
+a),f=g.projectiveDistMinScal(c,e),l=g.projectiveDistMinScal(b,c),k=g.projectiveDistMinScal(a,e),m=x+f,n=v+d;if(m>n){var p=[e,a];m=n}else p=[a,e];n=function(){};if(P&&P.currentStep){var q=[P.labelTracing2,u.wrap(P.currentElement.name),g.turnIntoCSList(p),g.turnIntoCSList([b,c]),g.realMatrix([[x,v],[d,f]]),u.wrap(m),u.wrap(l),u.wrap(k),h];P.currentStep.push(g.turnIntoCSList(q));n=function(a){P.hasOwnProperty(a)||(P[a]=u.wrap(a));q[q.length-1]=P[a]}}g._helper.isNaN(a)||g._helper.isNaN(e)?(n("Tracing failed due to NaNs."),
+sb=!0):l>3*m&&k>3*m?n("Normal case, everything all right."):1E-5>k?1E-5>l?n("Staying inside singularity."):(n("Moved into singularity."),sb=!0):1E-5>l?n("Moved out of singularity."):(fd?n("Reached refinement limit, giving up."):n("Need to refine."),uc());return p}function rd(a,e,b,c){var x=ha(3),v=ha(3),d=ha(3),f=ha(3);a=se(a,e,b,c,x,v,d,f);ea(a[0]);ea(a[1]);ea(a[2]);ea(a[3]);return g.turnIntoCSList(a)}function se(a,e,b,c,d,f,l,k){var x=function(){};d=[d,f,l,k];a=[a,e,b,c];if(lc)return a;f=0;c=Array(4);
+for(b=0;4>b;b++)for(c[b]=Array(4),k=0;4>k;k++)l=g.projectiveDistMinScal(d[b],a[k]),c[b][k]=l;l=R(c);e=Array(4);for(b=0;4>b;++b)e[b]=a[l[b]],f+=c[b][l[b]];var v=1*f,N=Infinity,Y=Infinity;for(b=0;4>b;b++){if(g._helper.isNaN(a[b]))return x("Tracing failed due to NaNs."),sb=!0,e;for(k=b+1;4>k;k++)l=g.projectiveDistMinScal(d[b],d[k]),N>l&&(N=l),l=g.projectiveDistMinScal(e[b],e[k]),Y>l&&(Y=l)}if(P&&P.currentStep){var m=[P.labelTracing4,u.wrap(P.currentElement.name),g.turnIntoCSList(e),g.turnIntoCSList(d),
+g.realMatrix(c),u.wrap(f),u.wrap(N),u.wrap(Y),h];P.currentStep.push(g.turnIntoCSList(m));x=function(a){P.hasOwnProperty(a)||(P[a]=u.wrap(a));m[m.length-1]=P[a]}}N>v&&Y>v||(1E-5>Y?1E-5>N?x("Staying inside singularity."):(x("Moved into singularity."),sb=!0):1E-5>N?x("Moved out of singularity."):(fd?x("Reached refinement limit, giving up."):x("Need to refine."),uc()));return e}function be(a){var e=a.length,b,c;if(lc){for(b=0;b<e;++b)jb+=2*a[b].value.length,ea(a[b]);return a}var d=Array(e),f=Array(e),
+l=Array(e),k=99,m=99,n=Array(e);for(b=0;b<e;++b)d[b]=ha(a[b].value.length),f[b]=g.normSquared(d[b]).value.real,l[b]=g.normSquared(a[b]).value.real,n[b]=Array(e);for(b=0;b<e;++b){for(c=0;c<e;++c){var na=g.sesquilinearproduct(d[b],a[c]).value;na=(na.real*na.real+na.imag*na.imag)/(f[b]*l[c]);n[b][c]=1-na}for(c=b+1;c<e;++c)na=g.sesquilinearproduct(d[b],d[c]).value,na=(na.real*na.real+na.imag*na.imag)/(f[b]*f[c]),k>1-na&&(k=1-na),na=g.sesquilinearproduct(a[b],a[c]).value,na=(na.real*na.real+na.imag*na.imag)/
+(l[b]*l[c]),m>1-na&&(m=1-na)}na=R(n);c=Array(e);f=0;l=!1;for(b=0;b<e;++b){f+=n[b][na[b]];var p=c[b]=a[na[b]];ea(p);l|=g._helper.isNaN(p)}l|=isNaN(f);a=function(){};if(P&&P.currentStep){var q=[P.labelTracingSesq,u.wrap(P.currentElement.name),g.turnIntoCSList(c),g.turnIntoCSList(d),g.realMatrix(n),u.wrap(f),u.wrap(k),u.wrap(m),h];P.currentStep.push(g.turnIntoCSList(q));a=function(a){P.hasOwnProperty(a)||(P[a]=u.wrap(a));q[q.length-1]=P[a]}}l?(a("Tracing failed due to NaNs."),sb=!0):k>3*f&&m>3*f?a("Normal case, everything all right."):
+1E-5>m?1E-5>k?a("Staying inside singularity."):(a("Moved into singularity."),sb=!0):1E-5>k?a("Moved out of singularity."):(fd?a("Reached refinement limit, giving up."):a("Need to refine."),uc());return c}function vc(a,e){a=m._helper.flattenConicMatrix(a);e=m._helper.flattenConicMatrix(e);var b=ha(6),c=ha(6);e=qd(a,e,b,c);ea(e[0]);ea(e[1]);a=m._helper.buildConicMatrix(e[0].value);e=m._helper.buildConicMatrix(e[1].value);return g.turnIntoCSList([a,e])}function qa(a){if(qa.hasOwnProperty(a.kind))qa[a.kind](a)}
+function Qb(a){Qb.hasOwnProperty(a.kind)&&(a.incidences=[],Qb[a.kind](a))}function sd(a,e){return function(){a.incidences.push(e.name);e.incidences.push(a.name)}}function wc(a,e){return function(){a.Duplicate=e}}function td(a,e){return{getInvolved:function(){return[a,e]},toString:function(){return"point "+a.name+" incident line "+e.name},apply:sd(a,e),holds:function(){var b=g.scaldiv(g.abs(a.homog),a.homog),c=g.scaldiv(g.abs(e.homog),e.homog);return l.abs(g.scalproduct(b,c)).value.real<l.epsbig}}}
+function ce(a,e){return{getInvolved:function(){return[a,e]},toString:function(){return"point "+a.name+" incident conic "+e.name},apply:sd(a,e),holds:function(){var b=u.mult(e.matrix,a.homog);b=u.mult(a.homog,b);b=l.abs(b);return b.value.real<l.epsbig}}}function de(){if(0!==Ra.length){Ub.prover.set(Ja);var a,e=function(){a={};Ra.forEach(function(e){var x;e.getInvolved().forEach(function(e){a[e.name]||(a[e.name]=!0,x=b(e,{}),x.forEach(function(e){a[e]=!0}))})})},b=function(a,e){a.incidences.forEach(function(a){e[a]||
+(e[a]=!0,b(r.csnames[a],e))});return Object.keys(e)};e();var c=function(a){return a.holds()};Object.keys(a).forEach(function(e){e=r.csnames[e].args;"undefined"!==typeof e&&e.forEach(function(e){a[e]=!0})});for(var d,g=0;3>g;g++){for(var f in a){var h=r.csnames[f];!h.pinned&&m[h.type].isMovable&&(d=m[h.type].getRandomMove(h),Ta(h,d.value,d.type),Ra=Ra.filter(c))}e()}Ja.set(Ub.prover);Zd();for(e=0;e<Ra.length;++e)Ra[e].apply();Ra=[]}}function Uc(a,e,b){var x=document.createElement("div"),c=document.createElement("img");
+c.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAPoCAQAAAC1v1zVAAAAGklEQVR42u3BMQEAAADCoPVPbQ0PoAAAgHcDC7gAAVI8ZnwAAAAASUVORK5CYII=";x.className="CindyJS-baseline";x.appendChild(c);c=document.createElement("div");c.className="CindyJS-button";x.appendChild(c);for(var g=2;g<arguments.length;++g)c.appendChild(arguments[g]);ra.parentNode.appendChild(x);a.html=arguments[arguments.length-1];$a(a.fillalpha)||(a.fillalpha=1);a.fillcolor&&(a.html.style.backgroundColor=y.makeColor(a.fillcolor,a.fillalpha));
+$a(a.alpha)||(a.alpha=1);a.color&&(a.html.style.color=y.makeColor(a.color,a.alpha));x=k;if(a.script){var f=lb(a.script);x=function(){w(f);k()}}b.addEventListener(e,x);!d.keylistener&&(V.keydown||V.keyup||V.keytyped)&&(b.addEventListener("keydown",function(a){9!==a.keyCode&&Z(a,V.keydown)}),b.addEventListener("keyup",function(a){Z(a,V.keyup)}),b.addEventListener("keypress",function(a){9!==a.keyCode&&Z(a,V.keytyped)}));m.Text.initialize(a)}function fb(){}function ud(a){if(!/^Select/.test(a.type)&&!m[a.type].isMovable)return null;
+var e=u.unwrap,b=l.add;switch(a.kind){case "P":case "L":case "Text":return e(a.homog);case "C":return a=a.matrix.value,{xx:e(a[0].value[0]),yy:e(a[1].value[1]),zz:e(a[2].value[2]),xy:e(b(a[0].value[1],a[1].value[0])),xz:e(b(a[0].value[2],a[2].value[0])),yz:e(b(a[1].value[2],a[2].value[1]))};default:return null}}function Vc(a){var e={};e.offset=u.unwrap(a.offset);a.to&&(e.to=a.to);a.corner&&(e.corner=a.corner);return e}function Wc(a){var e={},b={pinned:!1,movable:!0};"P"===a.kind&&Qd(b);"L"===a.kind&&
+fc(b);"C"===a.kind&&fc(b);"S"===a.kind&&Rd(b);"Text"===a.kind&&Sd(b);"Poly"===a.kind&&vb(b);Ze.forEach(function(x){if(a.hasOwnProperty(x)){var c=u.unwrap(a[x]),v=u.unwrap(b[x]);null!==c&&void 0!==c&&c!==v&&JSON.stringify(c)!==JSON.stringify(v)&&(e[x]=c)}});if("P"===a.kind&&(!a.movable||a.pinned)&&e.color){var c=l.real(1/Aa.dimDependent);e.color=u.unwrap(g.scalmult(c,a.color))}if(c=ud(a))e.pos=c;a.dock&&(e.dock=Vc(a.dock));return e}function te(){var a=[];r.gslp.forEach(function(e){e.tmp||a.push(Wc(e))});
+return a}function vd(){qb.forEach(function(a){var e=(a.geo||[]).map(function(a){return r.csnames[a]});W[a.type].reset(a,e[0],e)})}function Rb(a){Ce=0!==a.length;qb=[];Ca=[];He=[];W.Environment.init({});a.forEach(function(a){a.behavior?(a.name&&(a.behavior.geo=[a.name]),a=a.behavior,a.gravity&&(a.gravity=-a.gravity)):e=a.geo;var e=(a.geo||[]).map(function(a){return r.csnames[a]}),b=e[0],c=W[a.type];c?(c.init&&c.init(a,b,e),b&&(b.behavior=a,"Mass"===a.type?Ca.push(b):"Spring"===a.type&&He.push(b)),
+qb.push(a)):(console.error(a),console.error("Behavior "+a.type+" not implemented yet"))})}var Ia=this,Qa,V={},Ba=!1,xc=!0,yc=0,ee=.5,wd=0,zc=10,Bc=5/360,ze=.32/Bc/1E3*2,Yc=1,Va=0,Ad=0,Cc=!1,Tb=.2,Dc=!1,Zc=0,$c=0,wa=1,ra,ic,$a=Number.isFinite||function(a){return"number"===typeof a&&isFinite(a)},Ma,z,ma,pa,r,gb,ad=h,bd=h,xb={play:fb,pause:fb,stop:fb},Ec=null,jc=function(a,e){var b=[];jc=function(a,e){b.push({img:a,id:e})};jc(a,e);var c=Ia.getBaseDir()+"images/Icons.svg",d=new XMLHttpRequest;d.onreadystatechange=
+function(){if(d.readyState===XMLHttpRequest.DONE)if(200!==d.status)console.error("Failed to load CindyJS Icons.svg from "+c+": "+d.statusText);else{var a=d.responseXML,e=a.documentElement,x={},v;for(v=e.firstChild;v;v=g){var g=v.nextSibling;v.nodeType===Node.ELEMENT_NODE&&"http://www.w3.org/2000/svg"===v.namespaceURI&&"g"===v.localName.toLowerCase()&&(e.removeChild(v),v.setAttribute("style","display:inline"),x[v.getAttribute("id")]=v)}var f=new XMLSerializer;jc=function(b,c){if(x.hasOwnProperty(c)){c=
+x[c];e.appendChild(c);try{var v=f.serializeToString(a)}finally{e.removeChild(c)}b.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(v)}};b.forEach(function(a){jc(a.img,a.id)});b=null}};d.responseType="document";d.open("GET",c);d.send()},ge=1,kc=null,Db=[],Fc=!1,La={config:d,startup:B,shutdown:Ab,evokeCS:function(a){a=lb(a,!1);w(a);k()},play:F,pause:ub,stop:Wb,evalcs:function(a){return w(lb(a,!1))},parse:function(a){return lb(a)},niceprint:da,canvas:null},Bd=!1,Gc=0;d.use&&d.use.forEach(function(a){var e=
+null;d.plugins&&(e=d.plugins[a]);e||(e=Ia._pluginRegistry[a]);e||(++Gc,console.log("Loading script for plugin "+a),Ia.loadScript(a+"-plugin",a+"-plugin.js",function(){console.log("Successfully loaded plugin "+a);0===--Gc&&Bd&&B()},function(){console.error("Failed to auto-load plugin "+a);0===--Gc&&Bd&&B()}))});zb.prototype=new Bb;Xa.prototype=new Bb;Oa.prototype=new Bb;var ja={},ya,Cd="",cd=0,ab=0,Eb={},bc={};var hb=d.isNode?process.nextTick:window.requestAnimationFrame||window.webkitRequestAnimationFrame||
+window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,0)};var bb=null,he=[0,8,7,501,"g131b593"],l={_helper:{}};l._helper.roundingfactor=1E4;l._helper.angleroundingfactor=10;l._helper.niceround=function(a,e){return Math.round(a*e)/e};l.niceprint=function(a,e){e=e||l._helper.roundingfactor;if("Angle"===a.usage)return l._helper.niceangle(a);var b=l._helper.niceround(a.value.real,e);a=l._helper.niceround(a.value.imag,e);return 0===
+a?""+b:0<a?""+b+" + i*"+a:""+b+" - i*"+-a};var Dd=d.angleUnit||"\u00b0",Ae=Dd.replace(/\s+/g,""),Hc=2*Math.PI,Be=1/Hc,ie={rad:Hc,"\u00b0":360,deg:360,degree:360,gra:400,grad:400,turn:1,cyc:1,rev:1,rot:1,"\u03c0":2,pi:2,quad:4};l._helper.niceangle=function(a){var e=ie[Ae];if(!e)return l.niceprint(u.withUsage(a,null));if("function"===typeof e)return e(a);a=l.niceprint(l.realmult(e*Be,a),200<e?l._helper.angleroundingfactor:null);return-1===a.indexOf("i*")?a+Dd:"("+a+")"+Dd};l.complex=function(a,e){return{ctype:"number",
+value:{real:a,imag:e}}};l.real=function(a){return{ctype:"number",value:{real:a,imag:0}}};l.zero=l.real(0);l.one=l.real(1);l.infinity=l.complex(Infinity,Infinity);l.nan=l.complex(NaN,NaN);l._helper.input=function(a){return"object"===typeof a?l.complex(+a.r,+a.i):l.real(+a)};l.argmax=function(a,e){return a.value.real*a.value.real+a.value.imag*a.value.imag<e.value.real*e.value.real+e.value.imag*e.value.imag?e:a};l.max=function(a,e){return{ctype:"number",value:{real:Math.max(a.value.real,e.value.real),
+imag:Math.max(a.value.imag,e.value.imag)}}};l.min=function(a,e){return{ctype:"number",value:{real:Math.min(a.value.real,e.value.real),imag:Math.min(a.value.imag,e.value.imag)}}};l.add=function(a,e){return{ctype:"number",value:{real:a.value.real+e.value.real,imag:a.value.imag+e.value.imag}}};l.sub=function(a,e){return{ctype:"number",value:{real:a.value.real-e.value.real,imag:a.value.imag-e.value.imag}}};l.neg=function(a){return{ctype:"number",value:{real:-a.value.real,imag:-a.value.imag}}};l.re=function(a){return{ctype:"number",
+value:{real:a.value.real,imag:0}}};l.im=function(a){return{ctype:"number",value:{real:a.value.imag,imag:0}}};l.conjugate=function(a){return{ctype:"number",value:{real:a.value.real,imag:-a.value.imag}}};l.round=function(a){return{ctype:"number",value:{real:Math.round(a.value.real),imag:Math.round(a.value.imag)}}};l.ceil=function(a){return{ctype:"number",value:{real:Math.ceil(a.value.real),imag:Math.ceil(a.value.imag)}}};l.floor=function(a){return{ctype:"number",value:{real:Math.floor(a.value.real),
+imag:Math.floor(a.value.imag)}}};l.mult=function(a,e){return{ctype:"number",value:{real:a.value.real*e.value.real-a.value.imag*e.value.imag,imag:a.value.real*e.value.imag+a.value.imag*e.value.real}}};l.realmult=function(a,e){return{ctype:"number",value:{real:a*e.value.real,imag:a*e.value.imag}}};l.multiMult=function(a){var e=a[0];if("number"!==e.ctype)return h;for(var b=1;b<a.length;b++){if("number"!==a[b].ctype)return h;e=l.mult(e,a[b])}return e};l.abs2=function(a){return{ctype:"number",value:{real:a.value.real*
+a.value.real+a.value.imag*a.value.imag,imag:0}}};l.abs=function(a){return l.sqrt(l.abs2(a))};l.inv=function(a){var e=a.value.real*a.value.real+a.value.imag*a.value.imag;return{ctype:"number",value:{real:a.value.real/e,imag:-a.value.imag/e}}};l.div=function(a,e){var b=a.value.real;a=a.value.imag;var c=e.value.real;e=e.value.imag;var d=c*c+e*e;return{ctype:"number",value:{real:(b*c+a*e)/d,imag:(a*c-b*e)/d}}};l.eps=1E-10;l.epsbig=1E-6;l.snap=function(a){var e=a.value.real;a=a.value.imag;Math.floor(e+
+l.eps)!==Math.floor(e-l.eps)&&(e=Math.round(e));Math.floor(a+l.eps)!==Math.floor(a-l.eps)&&(a=Math.round(a));return{ctype:"number",value:{real:e,imag:a}}};l.exp=function(a){var e=Math.exp(a.value.real);return{ctype:"number",value:{real:e*Math.cos(a.value.imag),imag:e*Math.sin(a.value.imag)}}};l.cos=function(a){var e=a.value.real;a=a.value.imag;var b=Math.exp(a),c=b*Math.sin(-e),d=b*Math.cos(-e);b=Math.exp(-a);return{ctype:"number",value:{real:(d+b*Math.cos(e))/2,imag:(c+b*Math.sin(e))/2}}};l.sin=
+function(a){var e=a.value.real;a=a.value.imag;var b=Math.exp(a),c=b*Math.sin(-e),d=b*Math.cos(-e);b=Math.exp(-a);return{ctype:"number",value:{real:-(c-b*Math.sin(e))/2,imag:(d-b*Math.cos(e))/2}}};l.tan=function(a){var e=l.sin(a);a=l.cos(a);return l.div(e,a)};l.arccos=function(a){var e=l.mult(a,l.neg(a));e=l.sqrt(l.add(l.real(1),e));a=l.add(l.mult(a,l.complex(0,1)),e);a=l.add(l.mult(l.log(a),l.complex(0,1)),l.real(.5*Math.PI));return u.withUsage(a,"Angle")};l.arcsin=function(a){var e=l.mult(a,l.neg(a));
+e=l.sqrt(l.add(l.real(1),e));a=l.add(l.mult(a,l.complex(0,1)),e);a=l.mult(l.log(a),l.complex(0,-1));return u.withUsage(a,"Angle")};l.arctan=function(a){var e=l.log(l.add(l.mult(a,l.complex(0,-1)),l.real(1)));a=l.log(l.add(l.mult(a,l.complex(0,1)),l.real(1)));e=l.mult(l.sub(e,a),l.complex(0,.5));return u.withUsage(e,"Angle")};l.arctan2=function(a,e){if(void 0===e)var b=l.real(Math.atan2(a.value.imag,a.value.real));else l._helper.isReal(a)&&l._helper.isReal(e)?b=l.real(Math.atan2(e.value.real,a.value.real)):
+(b=l.add(a,l.mult(l.complex(0,1),e)),a=l.sqrt(l.add(l.mult(a,a),l.mult(e,e))),b=l.mult(l.complex(0,-1),l.log(l.div(b,a))));return u.withUsage(b,"Angle")};l.sqrt=function(a){var e=a.value.real,b=a.value.imag;a=Math.sqrt(Math.sqrt(e*e+b*b));e=Math.atan2(b,e);return{ctype:"number",value:{real:a*Math.cos(e/2),imag:a*Math.sin(e/2)}}};l.powRealExponent=function(a,e){var b=a.value.real,c=a.value.imag;a=Math.pow(Math.sqrt(b*b+c*c),e);b=Math.atan2(c,b);return{ctype:"number",value:{real:a*Math.cos(b*e),imag:a*
+Math.sin(b*e)}}};l.log=function(a){var e=a.value.real;a=a.value.imag;var b=Math.sqrt(e*e+a*a),c=Math.atan2(a,e);0>a&&(c+=2*Math.PI);0===a&&0>e&&(c=Math.PI);c>Math.PI&&(c-=2*Math.PI);return l.snap({ctype:"number",value:{real:Math.log(b),imag:c}})};l.pow=function(a,e){return l._helper.isZero(e)?l.one:l._helper.isZero(a)?l.zero:l._helper.isReal(e)?l.powRealExponent(a,e.value.real):l.exp(l.mult(l.log(a),e))};l.mod=function(a,e){var b=a.value.real,c=e.value.real;a=a.value.imag;e=e.value.imag;b-=Math.floor(b/
+c)*c;a-=Math.floor(a/e)*e;0===c&&(b=0);0===e&&(a=0);return l.snap({ctype:"number",value:{real:b,imag:a}})};l._helper.seed="NO";l._helper.seedrandom=function(a){a-=Math.floor(a);l._helper.seed=.8*a+.1};l._helper.rand=function(){if("NO"===l._helper.seed)return Math.random();var a=l._helper.seed;a=1E3*Math.sin(1E3*a);a-=Math.floor(a);return l._helper.seed=a};l._helper.randnormal=function(){var a=l._helper.rand(),e=l._helper.rand();return Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*e)};l._helper.isEqual=
+function(a,e){return a.value.real===e.value.real&&a.value.imag===e.value.imag};l._helper.isLessThan=function(a,e){return a.value.real<e.value.real||a.value.real===e.value.real&&a.value.imag<e.value.imag};l._helper.compare=function(a,e){return l._helper.isLessThan(a,e)?-1:l._helper.isEqual(a,e)?0:1};l._helper.isAlmostEqual=function(a,e,b){var x=l.eps;"undefined"!==typeof b&&(x=b);b=a.value.real-e.value.real;a=a.value.imag-e.value.imag;return b<x&&b>-x&&a<x&&a>-x};l._helper.isZero=function(a){return 0===
+a.value.real&&0===a.value.imag};l._helper.isAlmostZero=function(a){var e=a.value.real;a=a.value.imag;return e<l.eps&&e>-l.eps&&a<l.eps&&a>-l.eps};l._helper.isReal=function(a){return 0===a.value.imag};l._helper.isAlmostReal=function(a){a=a.value.imag;return a<l.epsbig&&a>-l.epsbig};l._helper.isNaN=function(a){return isNaN(a.value.real)||isNaN(a.value.imag)};l._helper.isFinite=function(a){return isFinite(a.value.real)&&isFinite(a.value.imag)};l._helper.isAlmostImag=function(a){a=a.value.real;return a<
+l.epsbig&&a>-l.epsbig};l._helper.z3a=l.complex(-.5,.5*Math.sqrt(3));l._helper.z3b=l.complex(-.5,-.5*Math.sqrt(3));l._helper.cub1={ctype:"list",value:[l.one,l.one,l.one]};l._helper.cub2={ctype:"list",value:[l._helper.z3a,l.one,l._helper.z3b]};l._helper.cub3={ctype:"list",value:[l._helper.z3b,l.one,l._helper.z3a]};l.solveCubic=function(a,e,b,c){a=l._helper.solveCubicHelper(a,e,b,c);return[g.scalproduct(l._helper.cub1,a),g.scalproduct(l._helper.cub2,a),g.scalproduct(l._helper.cub3,a)]};l._helper.solveCubicHelper=
+function(a,e,b,c){var x=a.value.real;a=a.value.imag;var v=e.value.real;e=e.value.imag;var d=b.value.real,f=b.value.imag,h=c.value.real,k=c.value.imag,m=x*d-a*f;b=x*f+a*d;c=4*m-(v*v-e*e);var n=4*b-2*v*e,p=x*v-a*e,q=x*e+a*v,r=c*d-n*f-18*(p*h-q*k);n=c*f+n*d-18*(p*k+q*h);c=27*(x*x-a*a);var t=54*a*x,u=c*h-t*k,w=c*k+t*h,y=v*v-e*e,z=2*v*e,C=y*v-z*e,A=y*e+z*v,B=u+4*C;t=w+4*A;c=27*(r*d-n*f+B*h-t*k);n=27*(r*f+n*d+B*k+t*h);B=Math.sqrt(Math.sqrt(c*c+n*n));t=Math.atan2(n,c);n=B*Math.sin(t/2);c=B*Math.cos(t/2);
+C=-2*C+9*(p*d-q*f)-u+(c*x-n*a);A=-2*A+9*(p*f+q*d)-w+(c*a+n*x);c=Math.exp(Math.log(Math.sqrt(C*C+A*A))/3);d=Math.atan2(A,C);t=c*Math.sin(d/3);n=c*Math.cos(d/3);c*=c;d*=2;m=2*y-6*m;b=2*z-6*b;z=-1.5874010519681996*(v*n-e*t);v=-1.5874010519681996*(v*t+e*n);e=1.2599210498948732*c*Math.cos(d/3);d=1.2599210498948732*c*Math.sin(d/3);c=4.762203155904599*(n*x-t*a);n=4.762203155904599*(n*a+t*x);x=c*c+n*n;t=(-m*n+b*c)/x;m=(m*c+b*n)/x;b=t;t=(-z*n+v*c)/x;z=(z*c+v*n)/x;v=t;t=(-e*n+d*c)/x;e=(e*c+d*n)/x;d=t;return g.turnIntoCSList([l.complex(m,
+b),l.complex(z,v),l.complex(e,d)])};l._helper.getRangeRand=function(a,e){return Math.random()*(e-a)+a};l.getRandReal=function(a,e){a=l._helper.getRangeRand(a,e);return l.real(a)};l.getRandComplex=function(a,e){var b=l._helper.getRangeRand(a,e);a=l._helper.getRangeRand(a,e);return l.complex(b,a)};var g={_helper:{},turnIntoCSList:function(a){return{ctype:"list",value:a}}};g.EMPTY=g.turnIntoCSList([]);g.asList=function(a){return"list"===a.ctype?a:"number"===a.ctype||"boolean"===a.ctype||"geo"===a.ctype?
+g.turnIntoCSList([a]):g.EMPTY};g.realVector=function(a){for(var e=[],b=0;b<a.length;b++)e[b]={ctype:"number",value:{real:a[b],imag:0}};return{ctype:"list",value:e}};g._helper.unitvector=function(a,e){a=g.zerovector(a);a.value[Math.floor(e.value.real-1)]=l.real(1);return a};g.idMatrix=function(a){for(var e=g.zeromatrix(a,a),b=l.real(1),c=0;c<a.value.real;c++)e.value[c].value[c]=b;return e};g._helper.flippedidMatrix=function(a){for(var e=g.zeromatrix(a,a),b=l.real(1),c=0;c<a.value.real;c++)e.value[c].value[a.value.real-
+c-1]=b;return e};g.println=function(a){for(var e=[],b=0;b<a.value.length;b++)if("number"===a.value[b].ctype)e[b]=l.niceprint(a.value[b]);else if("list"===a.value[b].ctype)g.println(a.value[b]);else return h;"number"===a.value[0].ctype&&console.log(e)};g.matrix=function(a){return g.turnIntoCSList(a.map(g.turnIntoCSList))};g.realMatrix=function(a){for(var e=a.length,b=Array(e),c=0;c<e;c++)b[c]=g.realVector(a[c]);return g.turnIntoCSList(b)};g.ex=g.realVector([1,0,0]);g.ey=g.realVector([0,1,0]);g.ez=
+g.realVector([0,0,1]);g.linfty=g.realVector([0,0,1]);g.ii=g.turnIntoCSList([l.complex(1,0),l.complex(0,1),l.complex(0,0)]);g.jj=g.turnIntoCSList([l.complex(1,0),l.complex(0,-1),l.complex(0,0)]);g.fundDual=g.realMatrix([[1,0,0],[0,1,0],[0,0,0]]);g.fund=g.realMatrix([[0,0,0],[0,0,0],[0,0,1]]);g.sequence=function(a,e){var b=[],c=0;for(a=Math.round(a.value.real);a<Math.round(e.value.real)+1;a++)b[c]={ctype:"number",value:{real:a,imag:0}},c++;return{ctype:"list",value:b}};g.pairs=function(a){for(var e=
+[],b=0;b<a.value.length-1;b++)for(var c=b+1;c<a.value.length;c++)e.push({ctype:"list",value:[a.value[b],a.value[c]]});return{ctype:"list",value:e}};g.triples=function(a){for(var e=[],b=0;b<a.value.length-2;b++)for(var c=b+1;c<a.value.length-1;c++)for(var d=c+1;d<a.value.length;d++)e.push({ctype:"list",value:[a.value[b],a.value[c],a.value[d]]});return{ctype:"list",value:e}};g.cycle=function(a){for(var e=[],b=0;b<a.value.length-1;b++)e[b]={ctype:"list",value:[a.value[b],a.value[b+1]]};e.push({ctype:"list",
+value:[a.value[a.value.length-1],a.value[0]]});return{ctype:"list",value:e}};g.consecutive=function(a){for(var e=[],b=0;b<a.value.length-1;b++)e[b]={ctype:"list",value:[a.value[b],a.value[b+1]]};return{ctype:"list",value:e}};g.reverse=function(a){for(var e=Array(a.value.length),b=a.value.length-1,c=0;0<=b;b--,c++)e[c]=a.value[b];return{ctype:"list",value:e}};g.directproduct=function(a,e){for(var b=[],c=0;c<a.value.length;c++)for(var d=0;d<e.value.length;d++)b.push({ctype:"list",value:[a.value[c],
+e.value[d]]});return{ctype:"list",value:b}};g.concat=function(a,e){for(var b=[],c=0;c<a.value.length;c++)b.push(a.value[c]);for(a=0;a<e.value.length;a++)b.push(e.value[a]);return{ctype:"list",value:b}};g.prepend=function(a,e){var b=[];b[0]=a;for(a=0;a<e.value.length;a++)b[a+1]=e.value[a];return{ctype:"list",value:b}};g.append=function(a,e){for(var b=[],c=0;c<a.value.length;c++)b[c]=a.value[c];b.push(e);return{ctype:"list",value:b}};g.contains=function(a,e){for(var b=0;b<a.value.length;b++)if(E.equals(a.value[b],
+e).value)return{ctype:"boolean",value:!0};return{ctype:"boolean",value:!1}};g.common=function(a,e){for(var b=[],c=0,d=0;d<a.value.length;d++){for(var g=!1,f=a.value[d],h=0;h<e.value.length;h++)g=g||E.equals(f,e.value[h]).value;g&&(b[c]=a.value[d],c++)}return{ctype:"list",value:b}};g.remove=function(a,e){for(var b=[],c=0,d=0;d<a.value.length;d++){for(var g=!1,f=a.value[d],h=0;h<e.value.length;h++)g=g||E.equals(f,e.value[h]).value;g||(b[c]=a.value[d],c++)}return{ctype:"list",value:b}};g.sort1=function(a){a=
+a.value.slice();a.sort(u.compare);return g.turnIntoCSList(a)};g._helper.isEqual=function(a,e){return g.equals(a,e).value};g._helper.isLessThan=function(a,e){for(var b=a.value.length,c=e.value.length,d=0;!(d>=b||d>=c)&&u.isEqual(a.value[d],e.value[d]);)d++;return d===b&&d<c?!0:d===c&&d<b||d===b&&d===c?!1:u.isLessThan(a.value[d],e.value[d])};g._helper.compare=function(a,e){return g._helper.isLessThan(a,e)?-1:g._helper.isEqual(a,e)?0:1};g.equals=function(a,e){if(a.value.length!==e.value.length)return{ctype:"boolean",
+value:!1};for(var b=!0,c=0;c<a.value.length;c++){var d=a.value[c],f=e.value[c];b="list"===d.ctype&&"list"===f.ctype?b&&g.equals(d,f).value:b&&oc([d,f],[]).value}return{ctype:"boolean",value:b}};g.almostequals=function(a,e){if(a.value.length!==e.value.length)return{ctype:"boolean",value:!1};for(var b=!0,c=0;c<a.value.length;c++){var d=a.value[c],f=e.value[c];b="list"===d.ctype&&"list"===f.ctype?b&&g.almostequals(d,f).value:b&&pc([d,f],[]).value}return{ctype:"boolean",value:b}};g._helper.isAlmostReal=
+function(a){for(var e=!0,b=0;b<a.value.length;b++){var c=a.value[b];e="list"===c.ctype?e&&g._helper.isAlmostReal(c):e&&l._helper.isAlmostReal(c)}return e};g._helper.isAlmostZero=function(a){for(var e=0;e<a.value.length;e++){var b=a.value[e];if("list"===b.ctype){if(!g._helper.isAlmostZero(b))return!1}else if(!l._helper.isAlmostZero(b))return!1}return!0};g._helper.isNaN=function(a){for(var e=!1,b=0;b<a.value.length;b++){var c=a.value[b];e="list"===c.ctype?e||g._helper.isNaN(c):e||l._helper.isNaN(c)}return e};
+g.set=function(a){var e=[],b=0;a=a.value.slice();a.sort(u.compare);for(var c=0;c<a.length;c++)0!==c&&oc([e[e.length-1],a[c]],[]).value||(e[b]=a[c],b++);return{ctype:"list",value:e}};g.maxval=function(a){for(var e=l.zero,b=0;b<a.value.length;b++){var c=a.value[b];"number"===c.ctype&&(e=l.argmax(e,c));"list"===c.ctype&&(e=l.argmax(e,g.maxval(c)))}return e};g.maxIndex=function(a,e,b){var c=0;void 0!==b&&(c=b);b=c;for(var x=e(a.value[c]).value.real;c<a.value.length;++c){var d=e(a.value[c]).value.real;
+d>x&&(b=c,x=d)}return b};g.normalizeMax=function(a){var e=l.inv(g.maxval(a));return l._helper.isFinite(e)?g.scalmult(e,a):a};g.normalizeZ=function(a){var e=l.inv(a.value[2]);return g.scalmult(e,a)};g.dehom=function(a){a=a.value.slice();var e=a.length-1,b=l.inv(a[e]);a.length=e;for(var c=0;c<e;++c)a[c]=l.mult(b,a[c]);return g.turnIntoCSList(a)};g.normalizeAbs=function(a){var e=l.inv(g.abs(a));return g.scalmult(e,a)};g.max=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=[],c=0;c<
+a.value.length;c++)b[c]=u.max(a.value[c],e.value[c]);return{ctype:"list",value:b}};g.min=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=[],c=0;c<a.value.length;c++)b[c]=u.min(a.value[c],e.value[c]);return{ctype:"list",value:b}};g.scaldiv=function(a,e){if("number"!==a.ctype)return h;for(var b=[],c=0;c<e.value.length;c++){var d=e.value[c];b[c]="number"===d.ctype?u.div(d,a):"list"===d.ctype?g.scaldiv(a,d):h}return{ctype:"list",value:b}};g.scalmult=function(a,e){if("number"!==a.ctype)return h;
+for(var b=[],c=0;c<e.value.length;c++){var d=e.value[c];b[c]="number"===d.ctype?u.mult(d,a):"list"===d.ctype?g.scalmult(a,d):h}return{ctype:"list",value:b}};g.add=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=[],c=0;c<a.value.length;c++){var d=a.value[c],f=e.value[c];b[c]="number"===d.ctype&&"number"===f.ctype?u.add(d,f):"list"===d.ctype&&"list"===f.ctype?g.add(d,f):h}return{ctype:"list",value:b}};g.sub=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=[],c=
+0;c<a.value.length;c++){var d=a.value[c],f=e.value[c];b[c]="number"===d.ctype&&"number"===f.ctype?l.sub(d,f):"list"===d.ctype&&"list"===f.ctype?g.sub(d,f):h}return{ctype:"list",value:b}};g.abs2=function(a){for(var e=0,b=0;b<a.value.length;b++){var c=a.value[b];if("number"===c.ctype)e+=l.abs2(c).value.real;else if("list"===c.ctype)e+=g.abs2(c).value.real;else return h}return{ctype:"number",value:{real:e,imag:0}}};g.abs=function(a){return l.sqrt(g.abs2(a))};g.normalizeMaxXX=function(a){for(var e=-1E4,
+b=l.real(1),c=0;c<a.value.length;c++){var d=l.abs(a.value[c]);d.value.real>e&&(b=a.value[c],e=d.value.real)}return g.scaldiv(b,a)};g.recursive=function(a,e){for(var b=[],c=0;c<a.value.length;c++){var d=D(a.value[c]);b[c]="number"===d.ctype?l[e](d):"list"===d.ctype?g[e](d):h}return{ctype:"list",value:b}};g.re=function(a){return g.recursive(a,"re")};g.neg=function(a){return g.recursive(a,"neg")};g.im=function(a){return g.recursive(a,"im")};g.conjugate=function(a){return g.recursive(a,"conjugate")};
+g.transjugate=function(a){return g.transpose(g.conjugate(a))};g.round=function(a){return g.recursive(a,"round")};g.ceil=function(a){return g.recursive(a,"ceil")};g.floor=function(a){return g.recursive(a,"floor")};g._helper.colNumb=function(a){if("list"!==a.ctype)return-1;for(var e=-1,b=0;b<a.value.length;b++){if("list"!==a.value[b].ctype)return-1;if(0===b)e=a.value[b].value.length;else if(e!==a.value[b].value.length)return-1}return e};g._helper.isNumberVecN=function(a,e){if("list"!==a.ctype||a.value.length!==
+e)return!1;for(e=0;e<a.value.length;e++)if("number"!==a.value[e].ctype)return!1;return!0};g.isNumberVector=function(a){if("list"!==a.ctype)return{ctype:"boolean",value:!1};for(var e=0;e<a.value.length;e++)if("number"!==a.value[e].ctype)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};g.isNumberVectorN=function(a,e){if("list"!==a.ctype)return{ctype:"boolean",value:!1};if(a.value)for(e=0;e<a.value.length;e++)if("number"!==a.value[e].ctype)return{ctype:"boolean",value:!1};return{ctype:"boolean",
+value:!0}};g.isNumberMatrix=function(a){if(-1===g._helper.colNumb(a))return{ctype:"boolean",value:!1};for(var e=0;e<a.value.length;e++)if(!g.isNumberVector(a.value[e]).value)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};g._helper.isNumberMatrixMN=function(a,e,b){return g.isNumberMatrix(a).value&&a.value.length===e&&a.value[0].value.length===b};g.scalproduct=function(a,e){if(a.value.length!==e.value.length)return h;for(var b={ctype:"number",value:{real:0,imag:0}},c=0;c<e.value.length;c++){var d=
+a.value[c],g=e.value[c];if("number"===d.ctype&&"number"===g.ctype)b=l.add(l.mult(d,g),b);else return h}return b};g.sesquilinearproduct=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=0,c=0,d=0;d<e.value.length;d++){var g=a.value[d].value,f=e.value[d].value;b+=g.real*f.real+g.imag*f.imag;c+=g.real*f.imag-g.imag*f.real}return l.complex(b,c)};g.normSquared=function(a){for(var e=0,b=0;b<a.value.length;b++){var c=a.value[b].value;e+=c.real*c.real+c.imag*c.imag}return l.real(e)};g.productMV=
+function(a,e){if(a.value[0].value.length!==e.value.length)return h;for(var b=[],c=0;c<a.value.length;c++){for(var d={ctype:"number",value:{real:0,imag:0}},f=a.value[c],k=0;k<e.value.length;k++){var m=f.value[k],n=e.value[k];if("number"===m.ctype&&"number"===n.ctype)d=l.add(l.mult(m,n),d);else return h}b[c]=d}return g.turnIntoCSList(b)};g.productVM=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=[],c=0;c<e.value[0].value.length;c++){for(var d={ctype:"number",value:{real:0,imag:0}},
+f=0;f<a.value.length;f++){var k=a.value[f],m=e.value[f].value[c];if("number"===k.ctype&&"number"===m.ctype)d=l.add(l.mult(k,m),d);else return h}b[c]=d}return g.turnIntoCSList(b)};g.productMM=function(a,e){if(a.value[0].value.length!==e.value.length)return h;for(var b=[],c=0;c<a.value.length;c++){var d=g.productVM(a.value[c],e);b[c]=d}return g.turnIntoCSList(b)};g.mult=function(a,e){return a.value.length===e.value.length&&g.isNumberVector(a).value&&g.isNumberVector(e).value?g.scalproduct(a,e):g.isNumberMatrix(a).value&&
+e.value.length===a.value[0].value.length&&g.isNumberVector(e).value?g.productMV(a,e):g.isNumberMatrix(e).value&&a.value.length===e.value.length&&g.isNumberVector(a).value?g.productVM(a,e):g.isNumberMatrix(a).value&&g.isNumberMatrix(e).value&&e.value.length===a.value[0].value.length?g.productMM(a,e):h};g.projectiveDistMinScal=function(a,e){var b=g.abs(a),c=g.abs(e);if(0===b.value.real||0===c.value.real)return 0;var d=g.conjugate(e);d=g.scalproduct(a,d);d=l._helper.isAlmostZero(d)?l.real(1):l.div(d,
+l.abs(d));a=g.scaldiv(b,a);e=g.scaldiv(c,e);e=g.scalmult(d,e);c=g.abs(g.add(a,e));e=g.abs(g.sub(a,e));return Math.min(c.value.real,e.value.real)};g.conicDist=function(a,e){a=Ga(a);e=Ga(e);return g.projectiveDistMinScal(a,e)};g.crossOperator=function(a){var e=a.value[0],b=a.value[1];a=a.value[2];return g.turnIntoCSList([g.turnIntoCSList([l.zero,l.neg(a),b]),g.turnIntoCSList([a,l.zero,l.neg(e)]),g.turnIntoCSList([l.neg(b),e,l.zero])])};g.cross=function(a,e){var b=l.sub(l.mult(a.value[1],e.value[2]),
+l.mult(a.value[2],e.value[1])),c=l.sub(l.mult(a.value[2],e.value[0]),l.mult(a.value[0],e.value[2]));a=l.sub(l.mult(a.value[0],e.value[1]),l.mult(a.value[1],e.value[0]));return g.turnIntoCSList([b,c,a])};g.crossratio3harm=function(a,e,b,c,d){var x=g.det3(a,b,d),v=g.det3(e,c,d);a=g.det3(a,c,d);e=g.det3(e,b,d);x=l.mult(x,v);v=l.mult(a,e);return g.turnIntoCSList([x,v])};g.crossratio3=function(a,e,b,c,d){a=g.crossratio3harm(a,e,b,c,d);return l.div(a.value[0],a.value[1])};g.veronese=function(a){var e=l.mult(a.value[0],
+a.value[0]),b=l.mult(a.value[1],a.value[1]),c=l.mult(a.value[2],a.value[2]),d=l.mult(a.value[0],a.value[1]),f=l.mult(a.value[0],a.value[2]);a=l.mult(a.value[1],a.value[2]);return g.turnIntoSCList([e,b,c,d,f,a])};g.matrixFromVeronese=function(a){var e=a.value[0],b=a.value[1],c=a.value[2],d=l.realmult(.5,a.value[3]),f=l.realmult(.5,a.value[4]);a=l.realmult(.5,a.value[5]);return g.turnIntoCSList([g.turnIntoCSList([e,d,f]),g.turnIntoCSList([d,b,a]),g.turnIntoCSList([f,a,c])])};g.det2=function(a,e){var b=
+l.mult(a.value[0],e.value[1]);return b=l.sub(b,l.mult(a.value[1],e.value[0]))};g.det3=function(a,e,b){return l.complex(a.value[0].value.real*e.value[1].value.real*b.value[2].value.real-a.value[0].value.imag*e.value[1].value.imag*b.value[2].value.real-a.value[0].value.imag*e.value[1].value.real*b.value[2].value.imag-a.value[0].value.real*e.value[1].value.imag*b.value[2].value.imag+a.value[2].value.real*e.value[0].value.real*b.value[1].value.real-a.value[2].value.imag*e.value[0].value.imag*b.value[1].value.real-
+a.value[2].value.imag*e.value[0].value.real*b.value[1].value.imag-a.value[2].value.real*e.value[0].value.imag*b.value[1].value.imag+a.value[1].value.real*e.value[2].value.real*b.value[0].value.real-a.value[1].value.imag*e.value[2].value.imag*b.value[0].value.real-a.value[1].value.imag*e.value[2].value.real*b.value[0].value.imag-a.value[1].value.real*e.value[2].value.imag*b.value[0].value.imag-a.value[0].value.real*e.value[2].value.real*b.value[1].value.real+a.value[0].value.imag*e.value[2].value.imag*
+b.value[1].value.real+a.value[0].value.imag*e.value[2].value.real*b.value[1].value.imag+a.value[0].value.real*e.value[2].value.imag*b.value[1].value.imag-a.value[2].value.real*e.value[1].value.real*b.value[0].value.real+a.value[2].value.imag*e.value[1].value.imag*b.value[0].value.real+a.value[2].value.imag*e.value[1].value.real*b.value[0].value.imag+a.value[2].value.real*e.value[1].value.imag*b.value[0].value.imag-a.value[1].value.real*e.value[0].value.real*b.value[2].value.real+a.value[1].value.imag*
+e.value[0].value.imag*b.value[2].value.real+a.value[1].value.imag*e.value[0].value.real*b.value[2].value.imag+a.value[1].value.real*e.value[0].value.imag*b.value[2].value.imag,-a.value[0].value.imag*e.value[1].value.imag*b.value[2].value.imag+a.value[0].value.imag*e.value[1].value.real*b.value[2].value.real+a.value[0].value.real*e.value[1].value.real*b.value[2].value.imag+a.value[0].value.real*e.value[1].value.imag*b.value[2].value.real-a.value[2].value.imag*e.value[0].value.imag*b.value[1].value.imag+
+a.value[2].value.imag*e.value[0].value.real*b.value[1].value.real+a.value[2].value.real*e.value[0].value.real*b.value[1].value.imag+a.value[2].value.real*e.value[0].value.imag*b.value[1].value.real-a.value[1].value.imag*e.value[2].value.imag*b.value[0].value.imag+a.value[1].value.imag*e.value[2].value.real*b.value[0].value.real+a.value[1].value.real*e.value[2].value.real*b.value[0].value.imag+a.value[1].value.real*e.value[2].value.imag*b.value[0].value.real+a.value[0].value.imag*e.value[2].value.imag*
+b.value[1].value.imag-a.value[0].value.imag*e.value[2].value.real*b.value[1].value.real-a.value[0].value.real*e.value[2].value.real*b.value[1].value.imag-a.value[0].value.real*e.value[2].value.imag*b.value[1].value.real+a.value[2].value.imag*e.value[1].value.imag*b.value[0].value.imag-a.value[2].value.imag*e.value[1].value.real*b.value[0].value.real-a.value[2].value.real*e.value[1].value.real*b.value[0].value.imag-a.value[2].value.real*e.value[1].value.imag*b.value[0].value.real+a.value[1].value.imag*
+e.value[0].value.imag*b.value[2].value.imag-a.value[1].value.imag*e.value[0].value.real*b.value[2].value.real-a.value[1].value.real*e.value[0].value.real*b.value[2].value.imag-a.value[1].value.real*e.value[0].value.imag*b.value[2].value.real)};g.det4m=function(a){var e=a.value,b=e[0].value,c=b[0].value,d=+c.real,g=+c.imag;c=b[1].value;var f=+c.real,h=+c.imag;c=b[2].value;var k=+c.real,m=+c.imag;c=b[3].value;var n=+c.real,p=+c.imag;b=e[1].value;c=b[0].value;var q=+c.real,r=+c.imag;c=b[1].value;var t=
++c.real,u=+c.imag;c=b[2].value;var w=+c.real,y=+c.imag;c=b[3].value;b=+c.real;c=+c.imag;a=d*t-g*u-f*q+h*r;var z=d*u+g*t-f*r-h*q,C=d*w-g*y-k*q+m*r,A=d*y+g*w-k*r-m*q,B=d*b-g*c-n*q+p*r,D=d*c+g*b-n*r-p*q,E=f*w-h*y-k*t+m*u,F=f*y+h*w-k*u-m*t,G=f*b-h*c-n*t+p*u,H=f*c+h*b-n*u-p*t,I=k*b-m*c-n*w+p*y,J=k*c+m*b-n*y-p*w;b=e[2].value;c=b[0].value;d=+c.real;g=+c.imag;c=b[1].value;f=+c.real;h=+c.imag;c=b[2].value;k=+c.real;m=+c.imag;c=b[3].value;n=+c.real;p=+c.imag;b=e[3].value;c=b[0].value;q=+c.real;r=+c.imag;c=
+b[1].value;t=+c.real;u=+c.imag;c=b[2].value;w=+c.real;y=+c.imag;c=b[3].value;b=+c.real;c=+c.imag;e=d*t-g*u-f*q+h*r;var L=d*u+g*t-f*r-h*q,K=d*w-g*y-k*q+m*r,M=d*y+g*w-k*r-m*q,P=d*b-g*c-n*q+p*r;d=d*c+g*b-n*r-p*q;g=f*w-h*y-k*t+m*u;q=f*y+h*w-k*u-m*t;r=f*b-h*c-n*t+p*u;f=f*c+h*b-n*u-p*t;h=k*b-m*c-n*w+p*y;k=k*c+m*b-n*y-p*w;return l.complex(a*h-z*k-C*r+A*f+B*g-D*q+E*P-F*d-G*K+H*M+I*e-J*L,a*k+z*h-C*f-A*r+B*q+D*g+E*d+F*P-G*M-H*K+I*L+J*e)};g.eucangle=function(a,e){var b=g.cross(a,g.linfty);a=g.cross(e,g.linfty);
+e=g.det3(g.ez,b,g.ii);b=g.det3(g.ez,b,g.jj);var c=g.det3(g.ez,a,g.ii);a=g.det3(g.ez,a,g.jj);e=l.div(l.mult(e,a),l.mult(c,b));e=l.log(e);return e=l.mult(e,l.complex(0,.5))};g.zerovector=function(a){a=Math.floor(a.value.real);for(var e=Array(a),b=0;b<a;b++)e[b]=0;return g.realVector(e)};g.zeromatrix=function(a,e){a=Math.floor(a.value.real);for(var b=Array(a),c=0;c<a;c++)b[c]=g.zerovector(e);return g.turnIntoCSList(b)};g.vandermonde=function(a){for(var e=a.value.length,b=g.zeromatrix(e,e),c=0;c<e;c++)for(var d=
+0;d<e;d++)b.value[c].value[d]=l.pow(a.value[c],l.real(d-1));return b};g.transpose=function(a){for(var e=[],b=a.value[0].value.length,c=a.value.length,d=0;d<b;d++){for(var f=[],h=0;h<c;h++)f[h]=a.value[h].value[d];e[d]=g.turnIntoCSList(f)}return g.turnIntoCSList(e)};g.column=function(a,e){var b=[],c=a.value.length;e=Math.floor(e.value.real-1);for(var d=0;d<c;d++)b[d]=a.value[d].value[e];return g.turnIntoCSList(b)};g.row=function(a,e){var b=[],c=a.value[0].value.length;e=Math.floor(e.value.real-1);
+for(var d=0;d<c;d++)b[d]=a.value[e].value[d];return g.turnIntoCSList(b)};g.adjoint2=function(a){var e=a.value[0].value[0],b=a.value[1].value[0],c=Array(2);c[0]=g.turnIntoCSList([a.value[1].value[1],l.neg(a.value[0].value[1])]);c[1]=g.turnIntoCSList([l.neg(b),e]);return c=g.turnIntoCSList(c)};g.adjoint3=function(a){var e=a.value[0].value;var b=e[0].value;var c=b.real;var d=b.imag;b=e[1].value;var g=b.real;var f=b.imag;b=e[2].value;var h=b.real;var k=b.imag;e=a.value[1].value;b=e[0].value;var l=b.real;
+var m=b.imag;b=e[1].value;var n=b.real;var p=b.imag;b=e[2].value;var q=b.real;var r=b.imag;e=a.value[2].value;b=e[0].value;a=b.real;var t=b.imag;b=e[1].value;var u=b.real;var w=b.imag;b=e[2].value;e=b.real;b=b.imag;return{ctype:"list",value:[{ctype:"list",value:[{ctype:"number",value:{real:n*e-q*u-p*b+r*w,imag:n*b-q*w-u*r+e*p}},{ctype:"number",value:{real:-g*e+h*u+f*b-k*w,imag:-g*b+h*w+u*k-e*f}},{ctype:"number",value:{real:g*q-h*n-f*r+k*p,imag:g*r-h*p-n*k+q*f}}]},{ctype:"list",value:[{ctype:"number",
+value:{real:-l*e+q*a+m*b-r*t,imag:-l*b+q*t+a*r-e*m}},{ctype:"number",value:{real:c*e-h*a-d*b+k*t,imag:c*b-h*t-a*k+e*d}},{ctype:"number",value:{real:-c*q+h*l+d*r-k*m,imag:-c*r+h*m+l*k-q*d}}]},{ctype:"list",value:[{ctype:"number",value:{real:l*u-n*a-m*w+p*t,imag:l*w-n*t-a*p+u*m}},{ctype:"number",value:{real:-c*u+g*a+d*w-f*t,imag:-c*w+g*t+a*f-u*d}},{ctype:"number",value:{real:c*n-g*l-d*p+f*m,imag:c*p-g*m-l*f+n*d}}]}]}};g.inverse=function(a){var e=a.value.length;if(e!==a.value[0].value.length)return console.log("Inverse works only for square matrices"),
+h;if(2===e)return g.scaldiv(g.det(a),g.adjoint2(a));if(3===e)return g.scaldiv(g.det(a),g.adjoint3(a));e=g.LUdecomp(a);a=a.value.length;var b=l.real(0),c=l.real(1),d=g.zerovector(l.real(a));d.value[0]=c;for(var f=Array(a),k=0;k<a;k++)f[k]=g._helper.LUsolve(e,d),d.value[k]=b,d.value[k+1]=c;f=g.turnIntoCSList(f);return f=g.transpose(f)};g.linearsolve=function(a,e){return 2===a.value.length?g.linearsolveCramer2(a,e):3===a.value.length?g.linearsolveCramer3(a,e):g.LUsolve(a,e)};g.getDiag=function(a){if(a.value.length!==
+a.value[0].value.length)return h;for(var e=Array(a.value.length),b=0;b<a.value.length;b++)e[b]=a.value[b].value[b];return g.turnIntoCSList(e)};g.getSubDiag=function(a){if(a.value.length!==a.value[0].value.length)return h;for(var e=Array(a.value.length-1),b=0;b<a.value.length-1;b++)e[b]=a.value[b+1].value[b];return g.turnIntoCSList(e)};g.eig2=function(a){var e=l.add(a.value[0].value[0],a.value[1].value[1]);a=g.det2(a.value[0],a.value[1]);var b=l.mult(e,e),c=e=l.mult(e,l.real(.5));a=l.sqrt(l.sub(l.div(b,
+l.real(4)),a));e=l.add(e,a);c=l.sub(c,a);return g.turnIntoCSList([e,c])};g.eig=function(a,e){var b=e||!0,c=a,d=l.real(c.value.length);e=d.value.real;l.real(0);c=g._helper.QRIteration(c)[0];c=g.getDiag(c);c=g.sort1(c);d=g.idMatrix(d,d);var f=Array(e);f=g.turnIntoCSList(f);if(b){var h,k=0,m=!1;for(b=0;b<e;b++){if(m)var n=p.value[k];else{var p=c.value[b];p=g.sub(a,g.scalmult(p,d));p=g.nullSpace(p);n=p.value[0];void 0!==n&&(h=n)}void 0===n&&(n=h);1E-8>g.abs(n).value.real&&0===k&&(n=g._helper.inverseIteration(a,
+c.value[b]));f.value[b]=g._helper.isAlmostZeroVec(n)?n:g.scaldiv(g.abs(n),n);b<e-1&&((m=1E-6>l.abs(l.sub(c.value[b],c.value[b+1])).value.real)?k++:k=0)}f=g.transpose(f)}return g.turnIntoCSList([c,f])};g._helper.isNormalMatrix=function(a){return 1E-10>g.abs(g.sub(a,g.transjugate(a))).value.real};g._helper.QRIteration=function(a,e){var b=l.real(a.value.length),c=b.value.real,d=b.value.real;l.real(0);g.idMatrix(b,b);var f=g.zeromatrix(b,b);b=g.idMatrix(b,b);var h=e?e:2500,k=0,m=Array(d);for(e=0;e<h;e++){var n=
+g._helper.getBlock(a,[d-2,d-1],[d-2,d-1]);var p=g.eig2(n);n=p.value[0];p=p.value[1];g.abs(n);g.abs(p);var q=a.value[d-1].value[d-1];var r=l.abs(l.sub(q,n)).value.real;q=l.abs(l.sub(q,p)).value.real;p=r<q?n:p;n=g.idMatrix(l.real(d),l.real(d));p=g.scalmult(p,n);n=g.QRdecomp(g.sub(a,p));a=u.mult(n.R,n.Q);a=g.add(a,p);n.Q=g._helper.buildBlockMatrix(n.Q,g.idMatrix(l.real(k),l.real(k)));b=u.mult(b,n.Q);if(1E-48>l.abs2(a.value[a.value.length-1].value[a.value[0].value.length-2]).value.real&&1<d){m[c-k-1]=
+a.value[d-1].value[d-1];for(e=0;e<d;e++)f.value[d-1].value[e]=a.value[d-1].value[e],f.value[e].value[d-1]=a.value[e].value[d-1];a=g._helper.getBlock(a,[0,d-2],[0,d-2]);k++;d--}if(1===d){f.value[0].value[0]=a.value[0].value[0];break}if(g._helper.isUpperTriangular(a)){for(e=0;e<d;e++)f.value[e].value[e]=a.value[e].value[e];break}}return[f,b]};g.rank=function(a,e){return g.RRQRdecomp(a,e).rank};g._helper.isAlmostZeroVec=function(a){for(var e=a.value.length,b=0;b<e;b++)if(!l._helper.isAlmostZero(a.value[b]))return!1;
+return!0};g._helper.isLowerTriangular=function(a){for(var e=a.value.length,b=a.value[0].value.length,c=0;c<e;c++)for(var d=c+1;d<b;d++)if(!l._helper.isAlmostZero(a.value[c].value[d]))return!1;return!0};g._helper.isUpperTriangular=function(a){return g._helper.isLowerTriangular(g.transpose(a))};g._helper.isAlmostId=function(a){var e=a.value.length,b=l.real(e);if(e!==a.value[0].value.length)return!1;a=g.sub(a,g.idMatrix(b),b);for(b=0;b<e;b++)for(var c=0;c<e;c++)if(1E-16<l.abs(a.value[b].value[c]).value.real)return!1;
+return!0};g.nullSpace=function(a,e){var b=a.value.length;e=g.RRQRdecomp(g.transjugate(a),e);a=g.transpose(e.Q);e=b-e.rank.value.real;var c=Array(e);a.value.reverse();for(var d,f=0;f<e;f++)d=a.value[f],c[f]=g.scaldiv(g.abs(d),d);c=g.turnIntoCSList(c);return 0<c.value.length?c:g.turnIntoCSList([g.zerovector(l.real(b))])};g._helper.isAlmostDiagonal=function(a){var e=a.value.length;l.real(e);l.real(0);if(e!==a.value[0].value.length)return!1;for(var b=0;b<e;b++)for(var c=0;c<e;c++)if(b!==c&&1E-16<l.abs(a.value[b].value[c]).value.real)return!1;
+return!0};g._helper.inverseIteration=function(a,e){console.log("warning: code untested");for(var b=a.value.length,c=Array(b),d=0;d<b;d++)c[d]=2*Math.random()-.5;c=g.realVector(c);b=g.idMatrix(l.real(b),l.real(b));e=l.add(e,l.real(.1*Math.random()-.5));for(d=0;100>d;d++)c=g.scaldiv(g.abs(c),c),c=g.LUsolve(g.sub(a,g.scalmult(e,b)),JSON.parse(JSON.stringify(c)));return g.scaldiv(g.abs(c),c)};g._helper.toHessenberg=function(a){var e=JSON.parse(JSON.stringify(a)),b=e.value.length,c=l.real(b-1),d=l.real(b);
+l.real(1);if(g._helper.isUpperTriangular(e))return[g.idMatrix(c,c),a];a=g.idMatrix(d,d);for(d=1;d<b-1;d++){var f=g.column(e,l.real(d));f.value=f.value.splice(d);var h=g.abs2(f).value.real;1E-16<h&&(f=g._helper.getHouseHolder(f),a=u.mult(a,f),e=u.mult(u.mult(f,e),f));c.value.real--}return[a,e]};g._helper.swapEl=function(a,e,b){if("[object Array]"===Object.prototype.toString.call(a)){var c=a[e];a[e]=a[b];a[b]=c}else"list"===a.ctype&&(c=a.value[e],a.value[e]=a.value[b],a.value[b]=c)};g.RRQRdecomp=function(a,
+e){var b=Math.sqrt(l.eps);void 0!==e&&(b=.1*e.value.real);e=b*b;var c;b=a.value.length;var d=l.real(b),f=l.real(1),h=g._helper.unitvector(l.real(a.value.length),f),k=g.idMatrix(d,d),m=JSON.parse(JSON.stringify(a)),n=g.transpose(a);a=Array(b);for(c=0;c<b;c++)a[c]=g.abs2(n.value[c]);a=g.turnIntoCSList(a);n=Array(b);for(c=0;c<b;c++)n[c]=c;c=g.maxIndex(a,l.abs);for(var p=a.value[c],q=0,r=0;1E-16<l.abs2(p).value.real;r++){q++;g._helper.swapColumn(m,r,c);g._helper.swapEl(a,r,c);g._helper.swapEl(n,r,c);
+c=g._helper.getBlock(m,[r],[r]);c=g.column(c,f);p=g.abs2(c).value.real;1E-8<p&&(c=g._helper.getHouseHolder(c),c=g._helper.buildBlockMatrix(g.idMatrix(l.real(r),l.real(r)),c),k=u.mult(k,g.transjugate(c)),m=u.mult(c,m));for(c=r+1;c<b;c++)a.value[c]=l.sub(a.value[c],l.mult(m.value[r].value[c],l.conjugate(m.value[r].value[c])));c=g.maxIndex(a,l.abs2,r+1);p=a.value[c];if(r+2===b){l.abs(p).value.real>e&&q++;break}d=l.sub(d,f);h.value=h.value.splice(0,h.value.length-1)}return{Q:k,R:m,P:g.turnIntoCSList(n),
+rank:l.real(q)}};g._helper.getHouseHolder=function(a){var e=l.real(a.value.length);if(1E-16>g.abs2(a))return g.idMatrix(e,e);var b=l.real(1),c=g._helper.unitvector(l.real(a.value.length),b);var d=g._helper.QRgetAlpha(a,0);d=g.sub(a,g.scalmult(d,c));d=g.scaldiv(g.abs(d),d);a=l.div(g.sesquilinearproduct(a,d),g.sesquilinearproduct(d,a));e=g.idMatrix(e,e);return e=g.sub(e,g.scalmult(l.add(b,a),g._helper.transposeMult(d,g.conjugate(d))))};g._helper.reOrderbyPivots=function(a,e){var b=a.value.length.length;
+a=g.transpose(a);b=Array(b);for(var c=0;c<e.length;c++)b[e[c]]=a.value[c];b=g.turnIntoCSList(b);return g.transpose(b)};g.QRdecomp=function(a){var e=a.value.length,b=l.real(e);if(g._helper.isUpperTriangular(a))return{Q:g.idMatrix(b,b),R:a};var c=l.real(1),d=g._helper.unitvector(l.real(a.value.length),c),f=g.idMatrix(b,b);a=JSON.parse(JSON.stringify(a));for(var h=0;;h++){var k=g._helper.getBlock(a,[h],[h]);k=g.column(k,c);var m=g.abs2(k).value.real;1E-8<m&&(k=g._helper.getHouseHolder(k),k=g._helper.buildBlockMatrix(g.idMatrix(l.real(h),
+l.real(h)),k),f=u.mult(f,g.transjugate(k)),a=u.mult(k,a));if(h+2===e)break;b=l.sub(b,c);d.value=d.value.splice(0,d.value.length-1)}return{Q:f,R:a}};g._helper.swapColumn=function(a,e,b){for(var c,d=0;d<a.value.length;d++)c=a.value[d].value[e],a.value[d].value[e]=a.value[d].value[b],a.value[d].value[b]=c};g._helper.buildBlockMatrix=function(a,e){if(0===a.value.length)return e;if(0===e.value.length)return a;var b=a.value.length,c=a.value[0].value.length,d=c+e.value[0].value.length;d=g.zeromatrix(l.real(b+
+e.value.length),l.real(d));for(var f=0;f<a.value.length;f++)for(var h=0;h<a.value[0].value.length;h++)d.value[f].value[h]=a.value[f].value[h];for(a=0;a<e.value.length;a++)for(f=0;f<e.value[0].value.length;f++)d.value[b+a].value[c+f]=e.value[a].value[f];return d};g._helper.getBlock=function(a,e,b){a=JSON.parse(JSON.stringify(a));var c=e[0],d=b[0];e=void 0===e[1]?a.value.length:e[1];b=void 0===b[1]?a.value[0].value.length:b[1];e++;b++;a.value=a.value.slice(c,e);for(c=0;c<a.value.length;c++)a.value[c].value=
+a.value[c].value.slice(d,b);return a};g._helper.setBlock=function(a,e,b){a=JSON.parse(JSON.stringify(a));var c=b[0];b=b[1];for(var d=e.value.length,x=e.value[0].value.length,g=0;g<d;g++)for(var f=0;f<x;f++)a.value[c+g].value[b+f]=e.value[g].value[f];return a};g._helper.transposeMult=function(a,e){if(a.value.length!==e.value.length)return h;for(var b=a.value.length,c=Array(b),d=0;d<b;d++)c[d]=g.scalmult(a.value[d],e);return g.turnIntoCSList(c)};g._helper.QRgetAlpha=function(a,e){return 0>a.value[e].value.real?
+g.abs(a):l.neg(g.abs(a))};g.LUdecomp=function(a){a=JSON.parse(JSON.stringify(a));var e,b,c=0,d=a.value.length,g=d-1,f=Array(d);for(b=0;b<d;++b){var h=b;var k=a.value[b];var m=l.abs(k.value[b]).value.real;for(e=b+1;e<d;++e){var n=l.abs(a.value[e].value[b]);m<n.value.real&&(m=n.value.real,h=e)}m<l.eps&&console.log("Warning: singular matrix!");f[b]=h;h!==b&&(a.value[b]=a.value[h],a.value[h]=k,k=a.value[b],c++);e=k.value[b];for(n=b+1;n<d;++n)a.value[n].value[b]=l.div(a.value[n].value[b],e);for(n=b+1;n<
+d;++n){h=a.value[n];for(e=b+1;e<g;++e)h.value[e]=l.sub(h.value[e],l.mult(h.value[b],k.value[e])),++e,h.value[e]=l.sub(h.value[e],l.mult(h.value[b],k.value[e]));e===g&&(h.value[e]=l.sub(h.value[e],l.mult(h.value[b],k.value[e])))}}return{LU:a,P:f,TransPos:c}};g.LUsolve=function(a,e){a=g.LUdecomp(a);return g._helper.LUsolve(a,e)};g._helper.LUsolve=function(a,e){var b=JSON.parse(JSON.stringify(e));e=a.LU;var c=e.value.length,d=JSON.parse(JSON.stringify(b)),g=a.P;for(a=c-1;-1!==a;--a)d.value[a]=b.value[a];
+for(a=0;a<c;++a){b=g[a];if(g[a]!==a){var f=d.value[a];d.value[a]=d.value[b];d.value[b]=f}f=e.value[a];for(b=0;b<a;++b)d.value[a]=l.sub(d.value[a],l.mult(d.value[b],f.value[b]))}for(a=c-1;0<=a;--a){f=e.value[a];for(b=a+1;b<c;++b)d.value[a]=l.sub(d.value[a],l.mult(d.value[b],f.value[b]));d.value[a]=l.div(d.value[a],f.value[a])}return d};g.linearsolveCramer2=function(a,e){var b=g.column(a,l.real(1)),c=g.column(a,l.real(2));a=g.det2(b,c);l._helper.isZero(a)&&console.log("A is not regular!");c=g.det2(e,
+c);c=l.div(c,a);e=g.det2(b,e);e=l.div(e,a);return g.turnIntoCSList([c,e])};g.linearsolveCramer3=function(a,e){var b=g.column(a,l.real(1)),c=g.column(a,l.real(2)),d=g.column(a,l.real(3));a=g.det3(b,c,d);l._helper.isZero(a)&&console.log("A is not regular!");var f=g.det3(e,c,d);d=g.det3(b,e,d);e=g.det3(b,c,e);e=g.turnIntoCSList([f,d,e]);return e=g.scaldiv(a,e)};g.linearsolveCGNR=function(a,e){var b=g.transpose(a);a=u.mult(b,a);e=u.mult(b,e);return g.linearsolveCG(a,e)};g.linearsolveCG=function(a,e){var b;
+var c=e;var d=e=g.sub(e,u.mult(a,e));for(var f=Math.ceil(1.2*a.value.length),h=0;h<f;){h++;var k=u.mult(a,d);var m=b=g.scalproduct(e,e);b=l.div(b,g.scalproduct(d,k));c=g.add(c,u.mult(b,d));e=g.sub(e,u.mult(b,k));if(g.abs(e).value.real<l.eps)break;b=g.scalproduct(e,e);b=l.div(b,m);d=g.add(e,u.mult(b,d))}h>=f&&console.log("CG did not converge");return c};g.det=function(a){if(1===a.value.length)return a.value[0].value[0];if(2===a.value.length)return g.det2(a.value[0],a.value[1]);if(3===a.value.length)return g.det3(a.value[0],
+a.value[1],a.value[2]);if(4===a.value.length)return g.det4m(a);var e=a.value.length,b=l.real(1),c,d=JSON.parse(JSON.stringify(a));for(a=0;a<e-1;a++){var f=a;for(c=a+1;c<e;c++)l.abs(d.value[c].value[a]).value.real>l.abs(d.value[f].value[a]).value.real&&(f=c);f!==a&&(c=d.value[f],d.value[f]=d.value[a],d.value[a]=c,b=l.neg(b));var h=d.value[a];for(c=a+1;c<e;c++){var k=d.value[c];var m=l.div(k.value[a],h.value[a]);for(f=a+1;f<e-1;f+=2){var n=f+1;k.value[f]=l.sub(k.value[f],l.mult(h.value[f],m));k.value[n]=
+l.sub(k.value[n],l.mult(h.value[n],m))}f!==e&&(k.value[f]=l.sub(k.value[f],l.mult(h.value[f],m)))}if(l._helper.isZero(h.value[a]))return l.real(0);b=l.mult(b,h.value[a])}return l.mult(b,d.value[a].value[a])};g.LUdet=function(a){a=g.LUdecomp(a);for(var e=a.LU,b=e.value.length,c=e.value[0].value[0],d=1;d<b;d++)c=l.mult(c,e.value[d].value[d]);1===a.TransPos%2&&(c=l.neg(c));return c};g.getField=function(a,e){if("homog"===e){if(g._helper.isNumberVecN(a,3))return a;if(g._helper.isNumberVecN(a,2))return g.turnIntoCSList([a.value[0],
+a.value[1],l.real(1)])}if("xy"===e){if(g._helper.isNumberVecN(a,2))return a;if(g._helper.isNumberVecN(a,3))return g.turnIntoCSList([l.div(a.value[0],a.value[2]),l.div(a.value[1],a.value[2])])}if("x"===e&&g.isNumberVector(a)){var b=a.value.length;if(0<b&&3!==b)return a.value[0];if(3===b)return"Point"===a.usage?l.div(a.value[0],a.value[2]):a.value[0]}if("y"===e&&g.isNumberVector(a)){b=a.value.length;if(1<b&&3!==b)return a.value[1];if(3===b)return"Point"===a.usage?l.div(a.value[1],a.value[2]):a.value[1]}return"z"===
+e&&g.isNumberVector(a)&&(b=a.value.length,2<b)?a.value[2]:h};g.nil=g.turnIntoCSList([]);g.ofGeos=function(a){return g.turnIntoCSList(a.map(function(a){return{ctype:"geo",value:a}}))};g._helper.isAlmostFarpoint=function(a){a=g.normalizeMax(a).value[2];return l.abs(a).value.real<l.eps};g.getRandRealVec3=function(a,e){var b=l.getRandReal;return g.turnIntoCSList([b(a,e),b(a,e),b(a,e)])};g.getRandComplexVec3=function(a,e){var b=l.getRandComplex;return g.turnIntoCSList([b(a,e),b(a,e),b(a,e)])};var Ea={_helper:{},
+turnIntoCSJson:function(a){return{ctype:"JSON",value:a}}};Ea._helper.ShallowClone=function(a){var e;var b=Array.isArray(a)?[]:{};for(e in a){var c=a[e];b[e]=c}return b};Ea.getField=function(a,e){return a.value&&a.value[e]?a.value[e]:h};Ea.setField=function(a,e,b){"undefined"===b.ctype&&a[e]?delete a[e]:a[e]=b};Ea.GenFromUserDataEl=function(a){var e=a.key;a=a.value;if(!e||"string"!==e.ctype)return console.log("Error: JSON keys have to be strings."),h;if(a)return{key:e.value,val:w(a)};console.log("Warning: JSON object not defined.");
+return{key:e.value,val:h}};Ea._helper.GenJSONAtom=function(a,e){return{ctype:"JSON",value:{key:u.string(a),value:e}}};Ea._helper.forall=function(a,e,b,c){var d="value";if(void 0!==c.iterator){c=w(c.iterator);var x=["key","value","pair"];"string"===c.ctype&&-1!==x.indexOf(c.value)&&(d=c.value)}if("value"===d)for(var g in a){L.setvar(e,a[g]);var f=w(b)}else if("key"===d)for(var v in a)L.setvar(e,u.string(v)),f=w(b);else for(var h in a)L.setvar(e,Ea._helper.GenJSONAtom(h,a[h])),f=w(b);return f};Ea._helper.niceprint=
+function(a,e,b){return"JSON"===a.ctype?Ea.niceprint(a,e,b):da(a)};Ea.niceprint=function(a,e,b){if(!b&&(b={printedWarning:!1,visitedMap:{}},b.visitedMap.tracker=new WeakMap,b.visitedMap.level=0,b.visitedMap.maxLevel=1E3,b.visitedMap.maxElVisit=5E3,e&&e.maxDepth)){var c=w(e.maxDepth);"number"===c.ctype&&(b.visitedMap.maxLevel=c.value.real)}var d=b.visitedMap;d.newLevel=!0;d.level+=1;return"{"+Object.keys(a.value).sort().map(function(c){var x=a.value[c];if(d.tracker.has(x)){if(d[x]>d.maxElVisit||d.level>
+d.maxLevel)return b.printedWarning||(console.log("Warning: We visited a key-value pair very often or encountered a very deeply nested dictionary. Dictionary is probably cyclic. Output will be probably incomplete."),b.printedWarning=!0),c+":...";d.newLevel&&(d.tracker.set(x,d.tracker.get(x)+1),d.newLevel=!1)}else d.tracker.set(x,1);return c+":"+Ea._helper.niceprint(x,e,b)}).join(", ")+"}"};Ea._helper.handlePrintException=function(a){a instanceof RangeError?console.log("Warning: Dictionary string could not be generated! Probably large cyclic Dictionary!"):
+a instanceof SyntaxError?console.log("Warning: Dictionary string could not be parsed!"):console.log("Warning: Dictionary printing failed!")};var nb={key:function(a){if("string"===a.ctype)return"s"+a.value.length+":"+a.value+";";if("number"===a.ctype)return"n"+a.value.real+","+a.value.imag+";";if("list"===a.ctype)return"l"+a.value.length+":"+a.value.map(nb.key).join(",")+";";if("boolean"===a.ctype)return"b"+a.value+";";if("dict"===a.ctype)return a=Object.keys(a.value).sort(),"d"+a.length+":"+a.join(",")+
+";";"undefined"!==a.ctype&&Qa.err("Bad dictionary key: "+da(a));return"undef"},create:function(){return{ctype:"dict",value:{}}},clone:function(a){var e=nb.create(),b;for(b in a.value)a.value.hasOwnProperty(b)&&(e.value[b]=a.value[b]);return e},put:function(a,e,b){a.value[nb.key(e)]={key:e,value:b}},get:function(a,e,b){return(a=a.value[nb.key(e)])?a.value:b},niceprint:function(a){return"{"+Object.keys(a.value).sort().map(function(e){e=a.value[e];return da(e.key)+":"+da(e.value)}).join(", ")+"}"}},
+u={_helper:{},order:{undefined:0,boolean:1,number:2,term:3,atomic:4,variable:5,geo:6,string:7,list:8},string:function(a){return{ctype:"string",value:a}},bool:function(a){return{ctype:"boolean",value:a}},not:function(a){return u.bool(!a.value)},isLessThan:function(a,e){return-1===u.compare(a,e)},isEqual:function(a,e){return 0===u.compare(a,e)},compareResults:function(a,e){return u.compare(a.result,e.result)},compare:function(a,e){if(a.ctype!==e.ctype)return u.order[a.ctype]-u.order[e.ctype];if("number"===
+a.ctype)return l._helper.compare(a,e);if("list"===a.ctype)return g._helper.compare(a,e);if("geo"===a.ctype)return a.value.name===e.value.name?0:a.value.name<e.value.name?-1:1;if("string"===a.ctype)return a.value===e.value?0:a.value<e.value?-1:1;if("boolean"===a.ctype)return a.value===e.value?0:!1===a.value?-1:1},add:function(a,e){return"void"===a.ctype&&"number"===e.ctype||"void"===a.ctype&&"list"===e.ctype?e:"number"===a.ctype&&"number"===e.ctype?l.add(a,e):"string"===a.ctype||"string"===e.ctype?
+{ctype:"string",value:da(a)+da(e)}:"list"===a.ctype&&"list"===e.ctype?g.add(a,e):h},sub:function(a,e){return"void"===a.ctype&&"number"===e.ctype?l.neg(e):"void"===a.ctype&&"list"===e.ctype?g.neg(e):"number"===a.ctype&&"number"===e.ctype?l.sub(a,e):"list"===a.ctype&&"list"===e.ctype?g.sub(a,e):h},mult:function(a,e){return"number"===a.ctype&&"number"===e.ctype?l.mult(a,e):"number"===a.ctype&&"list"===e.ctype?g.scalmult(a,e):"list"===a.ctype&&"number"===e.ctype?g.scalmult(e,a):"list"===a.ctype&&"list"===
+e.ctype?g.mult(a,e):h},div:function(a,e){return"number"===a.ctype&&"number"===e.ctype?l.div(a,e):"list"===a.ctype&&"number"===e.ctype?g.scaldiv(e,a):h},max:function(a,e){return"number"===a.ctype&&"number"===e.ctype?l.max(a,e):"list"===a.ctype&&"list"===e.ctype?g.max(a,e):h},min:function(a,e){return"number"===a.ctype&&"number"===e.ctype?l.min(a,e):"list"===a.ctype&&"list"===e.ctype?g.min(a,e):h},wrap:function(a){if("number"===typeof a)return l.real(a);if("object"===typeof a&&void 0!==a.length){for(var e=
+[],b=0;b<a.length;b++)e[b]=u.wrap(a[b]);return g.turnIntoCSList(e)}return"string"===typeof a?{ctype:"string",value:a}:"boolean"===typeof a?{ctype:"boolean",value:a}:h},unwrap:function(a){if("object"!==typeof a||null===a)return a;if(Array.isArray(a))return a.map(u.unwrap);switch(a.ctype){case "string":case "boolean":return a.value;case "number":return 0===a.value.imag?a.value.real:{r:a.value.real,i:a.value.imag};case "list":return a.value.map(u.unwrap);default:return null}},withUsage:function(a,e){return{ctype:a.ctype,
+value:a.value,usage:e}},wrapJSON:function(a){switch(typeof a){case "number":return l.real(a);case "string":return u.string(a);case "boolean":return u.bool(a);case "object":if(null===a)return h;if(Array.isArray(a))return g.turnIntoCSList(a.map(u.wrapJSON));var e=nb.create(),b;for(b in a)nb.put(e,u.string(b),u.wrapJSON(a[b]));return e;default:return console.log("Failed to convert "+typeof a+" to CindyJS data type"),h}},identity:function(a){return a},deeplyEqual:function(a,e){if("object"!==typeof a||
+"object"!==typeof e||null===a||null===e)return a===e;var b=0,c;for(c in a)if(++b,!(c in e&&u.deeplyEqual(a[c],e[c])))return!1;for(c in e)--b;return 0===b}},Ka={},S={};S[":"]=gd(":");S["\u00b0"]=function(a,e){e=D(a[0]);return"number"===e.ctype&&"void"===a[1].ctype?u.withUsage(l.realmult(Math.PI/180,e),"Angle"):h};S._=eb;S["^"]=Jc;S["\u221a"]=function(a,e){return"void"===a[0].ctype?q.sqrt$1([a[1]],e):h};S["*"]=hd;S["\u00d7"]=Da;S["/"]=Hd;S["+"]=Yb;S["-"]=Hb;S["!"]=function(a,e){e=D(a[1]);return"void"===
+a[0].ctype&&"boolean"===e.ctype?{ctype:"boolean",value:!e.value}:h};S["=="]=oc;S["~="]=pc;S["~<"]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real-a.value.real<=-l.eps}:h};S["~>"]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real-a.value.real>=l.eps}:h};S["=:="]=
+gd("=:=");S[">="]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real>=a.value.real}:"string"===e.ctype&&"string"===a.ctype?{ctype:"boolean",value:e.value>=a.value}:h};S["<="]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real<=a.value.real}:"string"===e.ctype&&"string"===
+a.ctype?{ctype:"boolean",value:e.value<=a.value}:h};S["~>="]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real-a.value.real>-l.eps}:h};S["~<="]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real-a.value.real<l.eps}:h};S[">"]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===
+e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real>a.value.real}:"string"===e.ctype&&"string"===a.ctype?{ctype:"boolean",value:e.value>a.value}:h};S["<"]=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(a)?{ctype:"boolean",value:e.value.real<a.value.real}:"string"===e.ctype&&"string"===a.ctype?{ctype:"boolean",value:e.value<a.value}:h};S["<>"]=oa;S["\u2208"]=
+function(a,e){e=w(a[0]);a=w(a[1]);return"list"===a.ctype?g.contains(a,e):h};S["\u2209"]=function(a,e){e=w(a[0]);a=w(a[1]);return"list"===a.ctype?u.not(g.contains(a,e)):h};S["&"]=Sa;S["%"]=Ic;S["!="]=oa;S["~!="]=function(a,e){return u.not(pc(a,e))};S[".."]=function(a,e){e=w(a[0]);a=w(a[1]);return"number"===e.ctype&&"number"===a.ctype?g.sequence(e,a):h};S["++"]=Ib;S["--"]=Lc;S["~~"]=Kc;S[":>"]=rb;S["<:"]=A;S["="]=Fb;S[":="]=function(a,e,b){e="undefined"===a[1].ctype;if("undefined"===a[0].ctype||e)return h;
+if("function"===a[0].ctype){e=a[0].oper;var c=a[0].args,d=a[1],x=1;if(Ka.hasOwnProperty(e)){x=Ka[e];if(x.definer===b)return h;x=x.generation+1}Ka[e]={oper:e,body:d,arglist:c,definer:b,generation:x}}"variable"===a[0].ctype&&L.setvar(a[0].name,a[1]);return h};S[":=_"]=function(a,e){if("void"!==a[1].ctype)return h;"function"===a[0].ctype&&delete Ka[a[0].oper];return h};S["::="]=gd("::=");S[";"]=function(a,e){e="void"===a[0].ctype;var b="void"===a[1].ctype;if(e&&b)return h;if(!e&&b)return w(a[0]);e||
+b||w(a[0]);return b?h:w(a[1])};da.errorTypes=["_?_","_??_","_???_","___"];var q={},E={evaluate:function(a,e,b){if(Ka.hasOwnProperty(a)){a=Ka[a];if(void 0===a)e=h;else{var c=[];for(b=0;b<a.arglist.length;b++)c[b]=w(e[b]);for(b=0;b<a.arglist.length;b++)L.newvar(a.arglist[b].name),L.setvar(a.arglist[b].name,c[b]);L.pushVstack("*");e=w(a.body);L.cleanVstack();for(b=0;b<a.arglist.length;b++)L.removevar(a.arglist[b].name)}return e}if(c=q[a])return c(e,b);var d=a.lastIndexOf("$");if(-1!==d&&(d=a.substr(0,
+d),c=q[d]))return c(e,b);Qa.err("Called undefined function "+d+" (as "+a+")");return h},equals:function(a,e){return"number"===a.ctype&&"number"===e.ctype?{ctype:"boolean",value:a.value.real===e.value.real&&a.value.imag===e.value.imag}:"string"===a.ctype&&"string"===e.ctype||"boolean"===a.ctype&&"boolean"===e.ctype?{ctype:"boolean",value:a.value===e.value}:"list"===a.ctype&&"list"===e.ctype?g.equals(a,e):"geo"===a.ctype&&"geo"===e.ctype?{ctype:"boolean",value:a.value===e.value}:{ctype:"boolean",value:!1}}},
+L={};L.vars=function(){var a={pi:l.real(Math.PI),"\u03c0":l.real(Math.PI),i:l.complex(0,1),"true":u.bool(!0),"false":u.bool(!1),"#":h,nil:g.turnIntoCSList([]),newline:u.string("\n"),tab:u.string("\t")},e=[],b;for(b in a)e[b]=[a[b]];return e}();L.isVariable=function(a){return this.vars.hasOwnProperty(a)};L.create=function(a){if(this.vars.hasOwnProperty(a))return this.vars[a];var e=[null];return this.vars[a]=e};L.newvar=function(a){a=this.vars[a];a.push(h);return a};L.removevar=function(a){var e=this.vars[a];
+0===e.length&&console.error("Removing non-existing "+a);e.pop();0===e.length&&console.warn("Removing last "+a)};L.setvar=function(a,e){var b=this.vars[a];0===b.length&&console.error("Setting non-existing variable "+a);void 0===e&&(console.error("Setting variable "+a+" to undefined value"),e=h);"undefined"===e.ctype?b[b.length-1]=e:(a=e,null===a&&(a=h),b[b.length-1]=a)};L.undefinedWarning={};L.getvar=function(a){var e=this.vars[a]||[];0===e.length&&console.error("Getting non-existing variable "+a);
+e=e[e.length-1];if(null===e){if(r.csnames.hasOwnProperty(a))return{ctype:"geo",value:r.csnames[a]};console&&console.log&&void 0===this.undefinedWarning[a]&&(this.undefinedWarning[a]=!0,console.log("Warning: Accessing undefined variable: "+a));return h}return e};L.dump=function(a){var e=this.vars[a];console.log("*** Dump "+a);for(a=0;a<e.length;a++)console.log(a+":> "+da(e[a]))};L.vstack=[];L.pushVstack=function(a){this.vstack.push(a)};L.popVstack=function(){this.vstack.pop()};L.cleanVstack=function(){for(var a=
+this.vstack;0<a.length&&"*"!==a[a.length-1];)this.removevar(a[a.length-1]),a.pop();0<a.length&&a.pop()};var Ha={generalFields:{color:"color",colorhsb:"",size:"size",alpha:"alpha",fillcolor:"fillcolor",fillalpha:"fillalpha",isshowing:"isshowing",visible:"visible",name:"name",caption:"caption",trace:"",tracelength:"",selected:"",labeled:"labeled",labelled:"labeled"},getGeoField:function(a,e){return"undefined"!==typeof r.csnames[a]?Ha.getField(r.csnames[a],e):h},setGeoField:function(a,e,b){return"undefined"!==
+typeof r.csnames[a]?Ha.setField(r.csnames[a],e,b):h},getField:function(a,e){if("P"===a.kind){if("xy"===e)return a=g.dehom(a.homog),u.withUsage(a,"Point");if("homog"===e)return u.withUsage(a.homog,"Point");if("x"===e)return l.div(a.homog.value[0],a.homog.value[2]);if("y"===e)return l.div(a.homog.value[1],a.homog.value[2]);if("narrow"===e)return u.wrap(a.narrow)}if("L"===a.kind||"S"===a.kind){if("homog"===e)return u.withUsage(a.homog,"Line");if("angle"===e)return a=g.eucangle(g.ey,a.homog),u.withUsage(a,
+"Angle");if("slope"===e)return l.neg(l.div(a.homog.value[0],a.homog.value[1]))}if("Tr"===a.kind&&"matrix"===e)return a.matrix;if("C"===a.kind){if("radius"===e){var b=a.matrix;a=b.value[0].value[0];var c=b.value[0].value[2];e=b.value[1].value[2];b=b.value[2].value[2];l.mult(a,a);c=l.div(c,a);e=l.div(e,a);a=l.div(b,a);return a=l.sqrt(l.sub(l.add(l.mult(c,c),l.mult(e,e)),a))}if("size"===e)return a.size;if("matrix"===e)return a.matrix;if("center"===e)return a=m._helper.CenterOfConic(a.matrix),a=g.dehom(a),
+u.withUsage(a,"Point");if("dualMatrix"===e)return g.normalizeMax(g.adjoint3(a.matrix));if("narrow"===e)return u.wrap(a.narrow)}if("Text"===a.kind){if("pressed"===e)return a.checkbox?u.bool(a.checkbox.checked):u.bool(!1);if("xy"===e)return a=g.dehom(a.homog),u.withUsage(a,"Point");if("homog"===e)return u.withUsage(a.homog,"Point");if("x"===e)return l.div(a.homog.value[0],a.homog.value[2]);if("y"===e)return l.div(a.homog.value[1],a.homog.value[2])}if("trace"===e)return u.bool(!!a.drawtrace);if("pinned"===
+e)return u.bool(!!a.pinned);if(Ha.generalFields[e])return(a=a[Ha.generalFields[e]])&&a.ctype?a:"object"!==typeof a?u.wrap(a):h;if(a.behavior){if("mass"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.mass);if("radius"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.radius);if("charge"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.charge);if("friction"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.friction);if("vx"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.vx);
+if("vy"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.vy);if("v"===e&&"Mass"===a.behavior.type)return g.realVector([a.behavior.vx,a.behavior.vy]);if("fx"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.fx);if("fy"===e&&"Mass"===a.behavior.type)return l.real(a.behavior.fy);if("f"===e&&"Mass"===a.behavior.type)return g.realVector([a.behavior.fx,a.behavior.fy]);if("ldiff"===e&&"Spring"===a.behavior.type)return l.real(a.behavior.ldiff)}e=m[a.type]["get_"+e];return"function"===typeof e?
+e(a):h},setField:function(a,e,b){"color"===e&&g._helper.isNumberVecN(b,3)&&(a.color=b);"size"===e&&"number"===b.ctype&&(a.size=b);"alpha"===e&&"number"===b.ctype&&(a.alpha=b);"fillcolor"===e&&g._helper.isNumberVecN(b,3)&&(a.fillcolor=b);"fillalpha"===e&&"number"===b.ctype&&(a.fillalpha=b);"visible"===e&&"boolean"===b.ctype&&(a.visible=b.value);"pinned"===e&&"boolean"===b.ctype&&(a.pinned=b.value);"labeled"!==e&&"labelled"!==e||"boolean"!==b.ctype||(a.labeled=b.value);"printlabel"===e&&(a.printname=
+da(b));"trace"===e&&"boolean"===b.ctype&&(b.value&&!a.drawtrace?(a.drawtrace=!0,Pd(a)):a.drawtrace=b.value);"P"===a.kind&&a.movable&&("xy"===e&&g._helper.isNumberVecN(b,2)&&Ta(a,g.turnIntoCSList([b.value[0],b.value[1],l.real(1)]),"homog"),"xy"===e&&g._helper.isNumberVecN(b,3)&&Ta(a,b,"homog"),"x"===e&&"number"===b.ctype&&Ta(a,g.turnIntoCSList([l.mult(b,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]),"homog"),"y"===e&&"number"===b.ctype&&Ta(a,g.turnIntoCSList([a.homog.value[0],l.mult(b,a.homog.value[2]),
+a.homog.value[2]]),"homog"),"homog"===e&&g._helper.isNumberVecN(b,3)&&Ta(a,b,"homog"));"homog"===e&&"L"===a.kind&&a.movable&&g._helper.isNumberVecN(b,3)&&Ta(a,b,"homog");"Text"===a.kind&&("pressed"===e&&"boolean"===b.ctype&&a.checkbox&&(a.checkbox.checked=b.value),a.movable&&("xy"===e?g._helper.isNumberVecN(b,2)?a.homog=g.turnIntoCSList([b.value[0],b.value[1],l.real(1)]):g._helper.isNumberVecN(b,3)&&(a.homog=b):"homog"===e&&g._helper.isNumberVecN(b,3)?a.homog=b:"x"===e&&"number"===b.ctype?a.homog=
+g.turnIntoCSList([l.mult(b,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]):"y"===e&&"number"===b.ctype&&(a.homog=g.turnIntoCSList([a.homog.value[0],l.mult(b,a.homog.value[2]),a.homog.value[2]]))));a.behavior&&("mass"===e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.mass=b.value.real),"mass"===e&&"Sun"===a.behavior.type&&"number"===b.ctype&&(a.behavior.mass=b.value.real),"friction"===e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.friction=b.value.real),"charge"===
+e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.charge=b.value.real),"radius"===e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.radius=b.value.real),"vx"===e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.vx=b.value.real),"vy"===e&&"Mass"===a.behavior.type&&"number"===b.ctype&&(a.behavior.vy=b.value.real),"v"===e&&"Mass"===a.behavior.type&&g._helper.isNumberVecN(b,2)&&(a.behavior.vx=b.value[0].value.real,a.behavior.vy=b.value[1].value.real));"narrow"===e&&-1!==
+["P","C"].indexOf(a.kind)&&("boolean"===b.ctype&&(a.narrow=b.value),"number"===b.ctype&&l._helper.isAlmostReal(b)&&(a.narrow=b.value.real));e=m[a.type]["set_"+e];if("function"===typeof e)return e(a,b)},getuserData:function(a,e){var b;"string"===e.ctype&&a.userData&&a.userData[e.value]&&(b=a.userData[e.value]);return b&&b.ctype?b:"object"!==typeof b?u.wrap(b):h},setuserData:function(a,e,b){e&&"string"===e.ctype&&a&&b&&(a.userData||(a.userData={}),a.userData[e.value]=b)}};q.version$0=function(a,e){a=
+["CindyJS"].concat(he);return g.turnIntoCSList(a.map(u.wrap))};q.clearconsole$0=function(a,e){Qa.clear()};q.err$1=function(a,e){e="";"variable"===a[0].ctype?(e=a[0].name,a=L.getvar(a[0].name)):a=a[0];a=e+" ===> "+da(w(a));sa(a);return h};q.errc$1=function(a,e){"variable"===a[0].ctype?(e=w(L.getvar(a[0].name)),console.log(a[0].name+" ===> "+da(e))):(e=w(a[0]),console.log(" ===> "+da(e)));return h};q.print$1=function(a,e){Qa.out(da(w(a[0]),e),!0);return h};q.println$1=function(a,e){Qa.out(da(w(a[0],
+e)));return h};q.assert$2=function(a,e){var b=w(a[0]);if("boolean"===b.ctype){if(!1===b.value)return q.println$1([a[1]],e)}else sa("Condition for assert is not boolean");return h};q.dump$1=function(a,e){console.log(JSON.stringify(a[0]));return h};q.repeat$2=function(a,e){return q.repeat$3([a[0],null,a[1]],e)};q.repeat$3=function(a,e){var b=D(a[0]),c="#";null!==a[1]&&"variable"===a[1].ctype&&(c=a[1].name);if("number"!==b.ctype)return h;b=Math.round(b.value.real);var d=1,g=1,f=b+1,k=!1,l=!1,m=!1;if(void 0!==
+e.start){var n=w(e.start);"number"===n.ctype&&(k=!0,g=n.value.real)}void 0!==e.step&&(n=w(e.step),"number"===n.ctype&&(m=!0,d=n.value.real));void 0!==e.stop&&(n=w(e.stop),"number"===n.ctype&&(l=!0,f=n.value.real));!k||l||m||(f=d*b+g);k||!l||m||(g=-d*(b-1)+f,f+=d);k||l||!m||(f=d*b+g);k&&l&&!m&&(d=(f-g)/(b-1),f+=d);k&&!l&&m&&(f=d*b+g);!k&&l&&m&&(g=-d*(b-1)+f,f+=d);k&&l&&m&&(f+=d);(g<=f&&0<d||g>=f&&0>d)&&k&&l&&m&&(b=Math.floor((f-g)/d));L.newvar(c);e=h;for(f=0;f<b;f++)L.setvar(c,{ctype:"number",value:{real:f*
+d+g,imag:0}}),e=w(a[2]);L.removevar(c);return e};q.while$2=function(a,e){e=a[1];a=a[0];for(var b=w(a),c=h;"list"!==b.ctype&&b.value;)c=w(e),b=w(a);return c};q.apply$2=function(a,e){return q.apply$3([a[0],null,a[1]],e)};q.apply$3=function(a,e){return q.apply$4([a[0],a[1],null,a[2]],e)};q.apply$4=function(a,e){e=D(a[0]);if("list"!==e.ctype&&"JSON"!==e.ctype)return h;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);if(null!==a[2]&&"variable"===a[2].ctype){var c=a[2].name;L.newvar(c)}var d=
+e.value,f="list"===e.ctype?[]:{};L.newvar(b);if(void 0!==c){if("list"===e.ctype)for(var k=0;k<d.length;k++)L.setvar(c,l.real(k+1)),L.setvar(b,d[k]),f[k]=w(a[3]);else for(k in d)L.setvar(c,u.string(k)),L.setvar(b,d[k]),f[k]=w(a[3]);L.removevar(c)}else if("list"===e.ctype)for(f=[],c=0;c<d.length;c++)L.setvar(b,d[c]),f[c]=w(a[3]);else for(var m in d)L.setvar(b,d[m]),f[m]=w(a[3]);L.removevar(b);return"list"===e.ctype?g.turnIntoCSList(f):Ea.turnIntoCSJson(f)};q.forall$2=function(a,e){return q.forall$3([a[0],
+null,a[1]],e)};q.forall$3=function(a,e){var b=D(a[0]);if("list"!==b.ctype&&"JSON"!==b.ctype)return h;var c="#";null!==a[1]&&"variable"===a[1].ctype&&(c=a[1].name);var d=b.value;L.newvar(c);if("list"===b.ctype)for(e=0;e<d.length;e++){L.setvar(c,d[e]);var g=w(a[2])}else g=Ea._helper.forall(d,c,a[2],e);L.removevar(c);return g};q.select$2=function(a,e){return q.select$3([a[0],null,a[1]],e)};q.select$3=function(a,e){var b=D(a[0]);if("list"!==b.ctype&&"JSON"!==b.ctype)return h;e="#";null!==a[1]&&"variable"===
+a[1].ctype&&(e=a[1].name);var c=b.value;L.newvar(e);if("list"===b.ctype){b=[];for(var d=0,g=0;g<c.length;g++){L.setvar(e,c[g]);var f=w(a[2]);"boolean"===f.ctype&&!0===f.value&&(b[d]=c[g],d++)}a={ctype:"list",value:b}}else{b={};for(d in c)L.setvar(e,c[d]),f=w(a[2]),"boolean"===f.ctype&&!0===f.value&&(b[d]=c[d]);a={ctype:"JSON",value:b}}L.removevar(e);return a};q.flatten$1=function(a,e){function b(a,e){return-1===e||"list"!==a.ctype?a:[].concat.apply([],a.value.map(function(a){return b(a,e-1)}))}a=
+D(a[0]);if("list"!==a.ctype)return a;e=e.levels;void 0===e?e=1:(e=w(e),e="number"===e.ctype?e.value.real:"string"===e.ctype&&"all"===e.value?-2:1);return{ctype:"list",value:b(a,e)}};q.createvar$1=function(a,e){"variable"===a[0].ctype&&L.newvar(a[0].name);return h};q.local=function(a,e){for(e=0;e<a.length;e++)"variable"===a[e].ctype&&L.newvar(a[e].name);return h};q.removevar$1=function(a,e){e=w(a[0]);"variable"===a[0].ctype&&L.removevar(a[0].name);return e};q.release=function(a,e){if(0===a.length)return h;
+e=w(a[a.length-1]);for(var b=0;b<a.length;b++)"variable"===a[b].ctype&&L.removevar(a[b].name);return e};q.regional=function(a,e){for(e=0;e<a.length;e++)if("variable"===a[e].ctype){var b=a[e].name;L.newvar(b);L.pushVstack(b)}return h};q.genList=function(a,e){return g.turnIntoCSList(a.map(w))};q.genJSON=function(a,e){e={};for(var b=0;b<a.length;b++){var c=Ea.GenFromUserDataEl(a[b]);c.key&&(e[c.key]=c.val)}return{ctype:"JSON",value:e}};E.assigntake=function(a,e){var b=a.args[0],c=w(b);a=D(a.args[1]);
+var d=h;if("list"===c.ctype||"string"===c.ctype){var f=Math.floor(a.value.real);0>f&&(f=c.value.length+f+1);0<f&&f<=c.value.length&&("list"===c.ctype?(d=c.value.slice(),d[f-1]=w(e),d=g.turnIntoCSList(d),c.userData&&(d.userData=c.userData)):(d=c.value,d=d.substring(0,f-1)+da(w(e))+d.substring(f,d.length),d=u.string(d)))}"JSON"===c.ctype&&(a=da(a),-1===da.errorTypes.indexOf(a)&&(d=Ea._helper.ShallowClone(c),d.value[a]=w(e)));Fb([b,d])};E.assigndot=function(a,e){var b=w(a.obj);a=a.key;"geo"===b.ctype&&
+"string"===typeof a&&Ha.setField(b.value,a,D(e));"JSON"===b.ctype&&"string"===typeof a&&Ea.setField(b.value,a,D(e));return h};E.assigncolon=function(a,e){var b=a.obj,c=w(b);a=u.string(da(w(a.key)));"_?_"===a.value&&(a=h);if("geo"===c.ctype&&a)Ha.setuserData(c.value,a,D(e));else if("list"===c.ctype||"string"===c.ctype&&a){var d={},g;for(g in c)d[g]=c[g];if(d.userData){c={};for(var f in d.userData)c[f]=d.userData[f];d.userData=c}else d.userData={};d.userData[a.value]=D(e);Fb([b,d])}else a&&"string"===
+a.ctype?console.log("User data can only be assigned to geo objects and lists."):console.log("Key is undefined");return h};q.keys$1=function(a,e){e=w(a[0]);var b=e.ctype;return"geo"===b||"list"===b||"JSON"===b?(a=[],(e="geo"===b?e.value.userData:"list"===b?e.userData:e.value)&&(a=Object.keys(e).map(u.string).sort()),g.turnIntoCSList(a)):h};q.values$1=function(a,e){a=w(a[0]);e=a.ctype;if("list"===e)return a;if("geo"===e||"JSON"===e){var b=[],c;(c="geo"===e?a.value.userData:a.value)&&(b=Object.keys(c).sort().map(function(a){return c[a]}));
+return g.turnIntoCSList(b)}return h};E.assignlist=function(a,e){var b=a.length,c=e.length;c<b&&(b=c);for(c=0;c<b;c++)Fb([a[c],e[c]],[])};q.if$2=function(a,e){return q.if$3(a,e)};q.if$3=function(a,e){e=D(a[0]);if("boolean"===e.ctype){if(!0===e.value)return w(a[1]);if(3===a.length)return w(a[2])}else sa("Condition for if is not boolean");return h};q.and$2=Sa;q.or$2=Ic;q.xor$2=function(a,e){e=D(a[0]);a=D(a[1]);return"boolean"===e.ctype&&"boolean"===a.ctype?{ctype:"boolean",value:e.value!==a.value}:h};
+q.not$1=function(a,e){a=D(a[0]);return"boolean"===a.ctype?{ctype:"boolean",value:!a.value}:h};E.genericListMathGen=function(a,e,b){q[a+"$1"]=function(a,c){a=w(a[0]);if("list"!==a.ctype)return h;a=a.value;if(0===a.length)return b;c=a[0];for(var d=1;d<a.length;d++)c=e(c,a[d]);return c};var c=a+"$3";q[a+"$2"]=function(a,e){return q[c]([a[0],null,a[1]])};q[c]=function(a,c){c=D(a[0]);if("list"!==c.ctype)return h;c=c.value;if(0===c.length)return b;var d="#";null!==a[1]&&"variable"===a[1].ctype&&(d=a[1].name);
+L.newvar(d);L.setvar(d,c[0]);for(var g=w(a[2]),x=1;x<c.length;x++){L.setvar(d,c[x]);var f=w(a[2]);g=e(g,f)}L.removevar(d);return g}};E.genericListMathGen("product",u.mult,l.real(1));E.genericListMathGen("sum",u.add,l.real(0));E.genericListMathGen("max",u.max,h);E.genericListMathGen("min",u.min,h);q.max$2=function(a,e){e=D(a[0]);if("list"===e.ctype)return q.max$3([e,null,a[1]]);a=D(a[1]);return q.max$1([g.turnIntoCSList([e,a])])};q.min$2=function(a,e){e=D(a[0]);if("list"===e.ctype)return q.min$3([e,
+null,a[1]]);a=D(a[1]);return q.min$1([g.turnIntoCSList([e,a])])};q.add$2=Yb;q.sub$2=Hb;q.mult$2=hd;q.div$2=Hd;q.mod$2=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype?l.mod(e,a):h};q.pow$2=Jc;q.exp$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.exp(a):h};q.sin$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.sin(a):h};q.sqrt$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.sqrt(a):h};E.laguerre=function(a,e,b){if("list"!==a.ctype)return h;var c=a.value.length-
+1,d;for(d=0;d<=c;d++)if("number"!==a.value[d].ctype)return h;if("number"!==e.ctype)return h;for(var g=[1,.3141,.5926,.5358,.9793,.2385,.6264,.3383,.2795,.0288],x,f,k,m=1;m<=b;m++){f=k=l.zero;x=a.value[c];for(d=c-1;0<=d;d--)k=l.add(f,l.mult(k,e)),f=l.add(x,l.mult(f,e)),x=l.add(a.value[d],l.mult(x,e));if(l._helper.isLessThan(l.abs(x),l.real(1E-14)))break;d=l.div(f,x);f=l.mult(d,d);x=l.sub(f,l.div(l.mult(l.real(2),k),x));k=l.sqrt(l.mult(l.real(c-1),l.sub(l.mult(l.real(c),x),f)));x=l.add(d,k);d=l.sub(d,
+k);l._helper.isLessThan(l.abs(x),l.abs(d))&&(x=d);d=l._helper.isLessThan(l.real(1E-14),l.abs(x))?l.div(l.real(c),x):l.mult(l.add(l.abs(e),l.one),l.complex(Math.cos(m),Math.sin(m)));if(l._helper.isLessThan(l.abs(d),l.real(1E-14)))break;0===m%20&&m<b-19&&(d=l.mult(d,l.real(g[Math.floor(m/20)])));e=l.sub(e,d)}return e};E.quadratic_roots=function(a){if("list"!==a.ctype)return h;var e=a.value[2],b=a.value[1];a=a.value[0];if(l._helper.isZero(a))return[l.zero,l.neg(l.div(b,e))];var c=l.sqrt(l.sub(l.mult(b,
+b),l.mult(l.real(4),l.mult(e,a))));0<=l.re(b)&&(c=l.neg(c));return[l.div(l.sub(c,b),l.mult(l.real(2),e)),l.div(l.mult(l.real(2),a),l.sub(c,b))]};E.roots=function(a){var e=[],b=a,c=a.value.length-1;if(0>=c)return g.turnIntoCSList([]);if(l._helper.isZero(a.value[c]))return e=E.roots(g.turnIntoCSList(a.value.slice(0,c))),g.append(e,l.infinity);if(1===c)e[0]=l.neg(l.div(a.value[0],a.value[1]));else if(2===c)e=E.quadratic_roots(a);else{for(var d=0;d<c-2;d++){e[d]=E.laguerre(a,l.zero,200);e[d]=E.laguerre(b,
+e[d],1);var f=[];f[c-d]=a.value[c-d];for(var h=c-d;0<h;h--)f[h-1]=l.add(a.value[h-1],l.mult(f[h],e[d]));f.shift();a=g.turnIntoCSList(f)}a=E.quadratic_roots(a);e[c-2]=a[0];e[c-1]=a[1]}return g.turnIntoCSList(e)};q.roots$1=function(a,e){a=D(a[0]);if("list"===a.ctype){for(e=0;e<a.value.length;e++)if("number"!==a.value[e].ctype)return h;a=E.roots(a);return g.sort1(a)}return h};q.autodiff$3=function(a,e){e="x";if("function"===a[0].ctype){var b=Ka[a[0].oper].body;e=a[0].args[0].name}else if("function"===
+typeof a[0].impl)b=a[0];else return sa("could not parse function"),h;var c=D(a[1]);a=D(a[2]);if(1>a.value.real)return sa("grade cant be < 1"),h;a=l.add(a,l.real(1));return aa.autodiff(b,e,c,a)};q.cos$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.cos(a):h};q.tan$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.tan(a):h};q.arccos$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.arccos(a):h};q.arcsin$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.arcsin(a):h};q.arctan$1=function(a,
+e){a=D(a[0]);return"number"===a.ctype?l.arctan(a):h};q.arctan2$2=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype?l.arctan2(e,a):h};q.arctan2$1=function(a,e){a=D(a[0]);if("list"===a.ctype&&2===a.value.length){if(a=a.value,"number"===a[0].ctype&&"number"===a[1].ctype)return q.arctan2$2(a,e)}else if("number"===a.ctype)return l.arctan2(a);return h};q.log$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.log(a):h};E.recursiveGen=function(a){var e=l[a],b=g[a];q[a+"$1"]=
+function(a,c){a=D(a[0]);return"number"===a.ctype?e(a):"list"===a.ctype?b(a):h}};E.recursiveGen("im");E.recursiveGen("re");E.recursiveGen("conjugate");E.recursiveGen("round");E.recursiveGen("ceil");E.recursiveGen("floor");E.recursiveGen("abs");q.abs_infix=q.abs$1;q.random$0=function(a,e){return l.real(l._helper.rand())};q.random$1=function(a,e){a=D(a[0]);return"number"===a.ctype?l.complex(a.value.real*l._helper.rand(),a.value.imag*l._helper.rand()):h};q.seedrandom$1=function(a,e){a=D(a[0]);"number"===
+a.ctype&&l._helper.seedrandom(a.value.real);return h};q.randomnormal$0=function(a,e){return l.real(l._helper.randnormal())};q.randominteger$1=function(a,e){e=D(a[0]);return"number"===e.ctype?(a=e.value.real|0,e=e.value.imag|0,a=a*l._helper.rand()|0,e=e*l._helper.rand()|0,l.complex(a,e)):h};q.randomint$1=q.randominteger$1;q.randombool$0=function(a,e){return.5<l._helper.rand()?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isreal$1=function(a,e){a=w(a[0]);return"number"===a.ctype&&l._helper.isAlmostReal(a)?
+{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isinteger$1=function(a,e){a=w(a[0]);return"number"===a.ctype&&l._helper.isAlmostReal(a)&&a.value.real===Math.floor(a.value.real)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.iseven$1=function(a,e){a=w(a[0]);return"number"===a.ctype&&l._helper.isAlmostReal(a)&&a.value.real/2===Math.floor(a.value.real/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isodd$1=function(a,e){a=w(a[0]);return"number"===a.ctype&&l._helper.isAlmostReal(a)&&
+(a.value.real-1)/2===Math.floor((a.value.real-1)/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.iscomplex$1=function(a,e){return"number"===w(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isstring$1=function(a,e){return"string"===w(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.islist$1=function(a,e){return"list"===w(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.ismatrix$1=function(a,e){a=w(a[0]);return-1!==g._helper.colNumb(a)?
+{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.iscircle$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&"C"===a.value.kind&&"Circle"===a.value.matrix.usage?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isconic$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&"C"===a.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isline$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&"L"===a.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.ispoint$1=function(a,
+e){a=w(a[0]);return"geo"===a.ctype&&"P"===a.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isgeometric$1=function(a,e){return"geo"===w(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isnumbermatrix$1=function(a,e){a=w(a[0]);return g.isNumberMatrix(a)};q.isnumbervector$1=function(a,e){a=w(a[0]);return g.isNumberVector(a)};q.issun$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&void 0!==a.value.behavior&&"Sun"===a.value.behavior.type?{ctype:"boolean",value:!0}:
+{ctype:"boolean",value:!1}};q.ismass$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&void 0!==a.value.behavior&&"Mass"===a.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isspring$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&void 0!==a.value.behavior&&"Spring"===a.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};q.isbouncer$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&void 0!==a.value.behavior&&"Bouncer"===a.value.behavior.type?{ctype:"boolean",
+value:!0}:{ctype:"boolean",value:!1}};q.isundefined$1=function(a,e){return"undefined"===w(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};var Nc={ArcBy3:"Arc",CenterOfConic:"Center",ConicBy1p4l:"Conic1P4L",ConicBy4p1l:"Conic4P1L",ConicBy5lines:"Conic5L",ConicBy2Foci1P:"ConicFoci",ConicFromPrincipalDirections:"ConicPrincipleDirs",Free:"FreePoint",PolarOfLine:"PolarLine",PolarOfPoint:"PolarPoint",PointOnSegment:"PointOnLine",Button:"Text",ToggleButton:"Text",TrReflectionL:"TrReflection",
+TrReflectionP:"TrReflection",TrReflectionC:"TrReflection",TrTranslation:"TrProjection",TrSimilarity:"TrProjection",TrAffine:"TrProjection",TransformP:"Transform",TransformL:"Transform",TransformSegment:"Transform",TransformS:"Transform",TransformPolygon:"Transform",TransformArc:"Transform",TransformConic:"Transform",TransformC:"Transform",TrMoebiusP:"Transform",TrMoebiusL:"Transform",TrMoebiusSegment:"Transform",TrMoebiusS:"Transform",TrMoebiusPolygon:"Transform",TrMoebiusArc:"Transform",TrMoebiusCircle:"Transform",
+TrMoebiusC:"Transform",TrInverseMoebius:"TrInverse",Perp:"Orthogonal",Para:"Parallel",AngleBisector:"AngularBisector",IntersectLC:"IntersectionConicLine",IntersectCirCir:"IntersectionCircleCircle",OtherPointOnCircle:"PointOnCircle"};q.algorithm$1=function(a,e){a=w(a[0]);if("geo"===a.ctype){a=a.value;var b=a.type;e=D(e.compatibility);"string"===e.ctype&&/^cinderella$/i.test(e.value)&&(/^Select/.test(b)&&(a=r.csnames[a.args[0]],b=a.type),Nc.hasOwnProperty(b)?b=Nc[b]:"CircleMr"===b&&(b=a.pinned?"CircleByFixedRadius":
+"CircleByRadius"));return u.string(b)}return h};q.inputs$1=function(a,e){a=w(a[0]);if("geo"===a.ctype){a=a.value;e=a.type;var b=[];a.args&&(b=a.args.map(function(a){return{ctype:"geo",value:r.csnames[a]}}));if(/^Select/.test(e)||m[e].isMovable)switch(a.kind){case "P":case "L":b.push(a.homog);break;case "C":b.push(a.matrix)}return g.turnIntoCSList(b)}return h};q.moveto$2=function(a,e){e=w(a[0]);a=D(a[1]);"geo"===e.ctype&&(e=e.value,g._helper.isNumberVecN(a,2)?Ha.setField(e,"xy",a):g._helper.isNumberVecN(a,
+3)&&Ha.setField(e,"homog",a));return h};q.continuefromhere$0=function(a,e){gc();return h};q.matrixrowcolumn$1=function(a,e){a=w(a[0]);return-1!==g._helper.colNumb(a)?g.realVector([a.value.length,a.value[0].value.length]):h};q.rowmatrix$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.turnIntoCSList([a]):h};q.columnmatrix$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.turnIntoCSList(a.value.map(function(a){return g.turnIntoCSList([a])})):h};q.submatrix$3=function(a,e){e=w(a[0]);var b=w(a[1]);
+a=w(a[2]);if("list"===e.ctype&&"number"===b.ctype&&"number"===a.ctype){var c=Math.round(b.value.real);a=Math.round(a.value.real);e=e.value.slice();0<a&&a<=e.length&&e.splice(a-1,1);var d=!0;e=e.map(function(a){if("list"!==a.ctype)d=!1;else return a=a.value.slice(),0<c&&c<=a.length&&a.splice(c-1,1),g.turnIntoCSList(a)});return d?g.turnIntoCSList(e):h}return h};q.complex$1=function(a,e){var b=D(a[0]);if("list"===b.ctype&&g.isNumberVector(b)){if(2===b.value.length)return a=b.value[0],e=b.value[1],l.complex(a.value.real-
+e.value.imag,e.value.real+a.value.imag);if(3===b.value.length)return a=b.value[0],e=b.value[1],b=b.value[2],a=l.div(a,b),e=l.div(e,b),l.complex(a.value.real-e.value.imag,e.value.real+a.value.imag)}return h};q.gauss$1=function(a,e){a=D(a[0]);return"number"===a.ctype?g.realVector([a.value.real,a.value.imag]):h};q.cross$2=Da;q.crossratio$4=function(a,e){e=w(a[0]);var b=w(a[1]),c=w(a[2]);a=w(a[3]);var d=Q(e),f=Q(b),k=Q(c),m=Q(a);return d!==h&&f!==h&&k!==h&&m!==h?g.crossratio3(d,f,k,m,g.ii):"number"===
+e.ctype&&"number"===b.ctype&&"number"===c.ctype&&"number"===a.ctype?l.div(l.mult(l.sub(e,c),l.sub(b,a)),l.mult(l.sub(e,a),l.sub(b,c))):h};q.para$2=function(a,e){e=D(a[0]);var b=D(a[1]);a=Q(e);var c=Q(b);if(e!==h&&b!==h){b=b.usage;var d=a,f=c;if("Line"===e.usage||"Point"===b)d=c,f=a;e=g.cross(g.cross(g.linfty,f),d);return u.withUsage(e,"Line")}return h};q.perp$2=function(a,e){e=D(a[0]);var b=D(a[1]);a=Q(e);var c=Q(b);if(e!==h&&b!==h){var d=b.usage||c.usage;b=a;var f=c;if("Line"===(e.usage||a.usage)||
+"Point"===d)b=c,f=a;e=g.turnIntoCSList([f.value[0],f.value[1],l.zero]);e=g.cross(e,b);return u.withUsage(e,"Line")}return h};q.perp$1=function(a,e){a=D(a[0]);return g._helper.isNumberVecN(a,2)?g.turnIntoCSList([l.neg(a.value[1]),a.value[0]]):h};q.parallel$2=q.para$2;q.perpendicular$2=q.perp$2;q.perpendicular$1=q.perp$1;q.meet$2=function(a,e){e=Q(a[0]);a=Q(a[1]);return e!==h&&a!==h?(a=g.cross(e,a),u.withUsage(a,"Point")):h};q.join$2=function(a,e){e=Q(a[0]);a=Q(a[1]);return e!==h&&a!==h?(a=g.cross(e,
+a),u.withUsage(a,"Line")):h};q.dist$2=function(a,e){e=D(a[0]);a=D(a[1]);a=Hb([e,a],[]);return q.abs$1([a],[])};q.dist_infix=q.dist$2;q.point$1=function(a,e){a=w(a[0]);return g._helper.isNumberVecN(a,3)||g._helper.isNumberVecN(a,2)?u.withUsage(a,"Point"):a};q.line$1=function(a,e){a=w(a[0]);return g._helper.isNumberVecN(a,3)?u.withUsage(a,"Line"):a};q.det$3=function(a,e){e=Q(a[0]);var b=Q(a[1]);a=Q(a[2]);if(e!==h&&b!==h&&a!==h)return g.det3(e,b,a)};q.det$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&
+(e=g._helper.colNumb(a),-1!==e&&e===a.value.length)?g.det(a):h};q.eig$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&(e=g._helper.colNumb(a),-1!==e&&e===a.value.length)?g.eig(a):h};q.eigenvalues$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&(e=g._helper.colNumb(a),-1!==e&&e===a.value.length)?g.eig(a,!1).value[0]:h};q.rank$1=function(a,e){a=D(a[0]);if("list"===a.ctype){var b=g._helper.colNumb(a);if(-1!==b&&b===a.value.length)return g.rank(a,e.precision)}return h};q.kernel$1=function(a,e){a=
+D(a[0]);if("list"===a.ctype){var b=g._helper.colNumb(a);if(-1!==b&&b===a.value.length)return e=g.nullSpace(a,e.precision),g.transpose(e)}return h};q.eigenvectors$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&(e=g._helper.colNumb(a),-1!==e&&e===a.value.length)?g.eig(a).value[1]:h};q.area$3=function(a,e){e=Q(a[0]);var b=Q(a[1]);a=Q(a[2]);if(e!==h&&b!==h&&a!==h){var c=e.value[2],d=b.value[2],f=a.value[2];if(!l._helper.isAlmostZero(c)&&!l._helper.isAlmostZero(d)&&!l._helper.isAlmostZero(f))return e=
+g.scaldiv(c,e),b=g.scaldiv(d,b),a=g.scaldiv(f,a),e=g.det3(e,b,a),l.realmult(.5,e)}return h};q.inverse$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&(e=g._helper.colNumb(a),-1!==e&&e===a.value.length)?g.inverse(a):h};q.linearsolve$2=function(a,e){e=D(a[0]);a=D(a[1]);if("list"===e.ctype){var b=g._helper.colNumb(e);if(-1!==b&&b===e.value.length&&g._helper.isNumberVecN(a,b))return g.linearsolve(e,a)}return h};var md=[[[]],[[0]],[[0,1],[1,0]],[[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]],[[0,1,
+2,3],[0,1,3,2],[0,2,1,3],[0,2,3,1],[0,3,1,2],[0,3,2,1],[1,0,2,3],[1,0,3,2],[1,2,0,3],[1,2,3,0],[1,3,0,2],[1,3,2,0],[2,0,1,3],[2,0,3,1],[2,1,0,3],[2,1,3,0],[2,3,0,1],[2,3,1,0],[3,0,1,2],[3,0,2,1],[3,1,0,2],[3,1,2,0],[3,2,0,1],[3,2,1,0]]];q.mincostmatching$1=function(a,e){var b=w(a[0]);if(g.isNumberMatrix(b).value){a=b.value.length;e=g._helper.colNumb(b);var c=a<e?e:a,d,f,k=Array(c);for(d=0;d<c;++d)for(k[d]=Array(c),f=0;f<c;++f)k[d][f]=d<a&&f<e?b.value[d].value[f].value.real:0;b=R(k);c=Array(a);for(d=
+0;d<a;++d)f=b[d],c[d]=f<e?l.real(f+1):l.real(0);return g.turnIntoCSList(c)}return h};q.take$2=eb;q.length$1=function(a,e){a=w(a[0]);return"list"===a.ctype||"string"===a.ctype?l.real(a.value.length):h};q.pairs$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.pairs(a):h};q.triples$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.triples(a):h};q.cycle$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.cycle(a):h};q.consecutive$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.consecutive(a):h};
+q.reverse$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.reverse(a):h};q.directproduct$2=function(a,e){e=w(a[0]);a=w(a[1]);return"list"===e.ctype&&"list"===a.ctype?g.directproduct(e,a):h};q.concat$2=Ib;q.common$2=Kc;q.remove$2=Lc;q.append$2=rb;q.prepend$2=A;q.contains$2=function(a,e){e=w(a[0]);a=w(a[1]);return"list"===e.ctype?g.contains(e,a):h};q.sort$2=function(a,e){return q.sort$3([a[0],null,a[1]],e)};q.sort$3=function(a,e){var b=D(a[0]);if("list"!==b.ctype)return h;e="#";null!==a[1]&&"variable"===
+a[1].ctype&&(e=a[1].name);b=b.value;var c=[];L.newvar(e);var d;for(d=0;d<b.length;d++)L.setvar(e,b[d]),c[d]={val:b[d],result:w(a[2])};L.removevar(e);c.sort(u.compareResults);a=[];for(d=0;d<b.length;d++)a[d]=c[d].val;return{ctype:"list",value:a}};q.sort$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.sort1(a):h};q.set$1=function(a,e){a=w(a[0]);return"list"===a.ctype?g.set(a):h};q.combinations$2=function(a,e){function b(a,e){a===d?p.push(g.turnIntoCSList(q.slice())):e<f&&(q[a]=c.value[e],b(a+1,e+
+1),b(a,e+1))}var c=w(a[0]);a=w(a[1]);if("number"===a.ctype){var d=a.value.real|0;if("number"===c.ctype){var f=c.value.real|0;f-d<d&&(d=f-d);if(0>d)return l.real(0);if(0===d)return l.real(1);if(1===d)return c;for(var k=e=a=1;k<=d;++k){var m=f-d+k|0,n=k|0,fa=Zb(m,n)|0;m=m/fa|0;n=n/fa|0;fa=Zb(a,n)|0;a=a/fa|0;n=n/fa|0;fa=Zb(m,e)|0;m=m/fa|0;e=e/fa|0;a=a*m|0;e=e*n|0}return l.real(a/e)}if("list"===c.ctype){f=c.value.length;if(0>d||d>f)return g.turnIntoCSList([]);if(0===d)return g.turnIntoCSList([g.turnIntoCSList([])]);
+if(d===f)return g.turnIntoCSList([c]);var p=[];var q=Array(d);b(0,0);return g.turnIntoCSList(p)}}return h};q.zeromatrix$2=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===e.ctype&&"number"===a.ctype?g.zeromatrix(e,a):h};q.zerovector$1=function(a,e){a=D(a[0]);return"number"===a.ctype?g.zerovector(a):h};q.transpose$1=function(a,e){a=D(a[0]);return"list"===a.ctype&&-1!==g._helper.colNumb(a)?g.transpose(a):h};q.row$2=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===a.ctype&&"list"===e.ctype&&-1!==
+g._helper.colNumb(e)?g.row(e,a):h};q.column$2=function(a,e){e=D(a[0]);a=D(a[1]);return"number"===a.ctype&&"list"===e.ctype&&-1!==g._helper.colNumb(e)?g.column(e,a):h};q.dict$0=function(a,e){a=nb.create();for(var b in e)e.hasOwnProperty(b)&&nb.put(a,u.string(b),w(e[b]));return a};q.put$3=function(a,e){e=w(a[0]);var b=w(a[1]);a=w(a[2]);return"dict"===e.ctype?(e=nb.clone(e),nb.put(e,b,a),e):h};q.get$2=function(a,e){e=w(a[0]);a=w(a[1]);return"dict"===e.ctype?nb.get(e,a,h):h};q.red$1=function(a,e){a=w(a[0]);
+return"number"===a.ctype?g.realVector([Math.min(1,Math.max(0,a.value.real)),0,0]):h};q.green$1=function(a,e){a=w(a[0]);return"number"===a.ctype?g.realVector([0,Math.min(1,Math.max(0,a.value.real)),0]):h};q.blue$1=function(a,e){a=w(a[0]);return"number"===a.ctype?g.realVector([0,0,Math.min(1,Math.max(0,a.value.real))]):h};q.gray$1=function(a,e){a=w(a[0]);return"number"===a.ctype?(a=Math.min(1,Math.max(0,a.value.real)),g.realVector([a,a,a])):h};q.grey$1=q.gray$1;E.HSVtoRGB=function(a,e,b){a&&void 0===
+e&&void 0===b&&(e=a.s,b=a.v,a=a.h);var c=Math.floor(6*a);var d=6*a-c;a=b*(1-e);var f=b*(1-d*e);e=b*(1-(1-d)*e);switch(c%6){case 0:var x=b;var h=e;var k=a;break;case 1:x=f;h=b;k=a;break;case 2:x=a;h=b;k=e;break;case 3:x=a;h=f;k=b;break;case 4:x=e;h=a;k=b;break;case 5:x=b,h=a,k=f}return g.realVector([x,h,k])};q.hue$1=function(a,e){a=w(a[0]);return"number"===a.ctype?(a=a.value.real,a-=Math.floor(a),E.HSVtoRGB(a,1,1)):h};E.shapeconvert=function(a){if("circle"===a.type){var e=a.value.value[0];e=u.div(e,
+e.value[2]);var b=e.value[0].value.real,c=e.value[1].value.real;a=a.value.value[1].value.real;var d=Array(125);var g=2*Math.PI/125;for(e=0;125>e;e++)d[e]={X:b+Math.cos(e*g)*a,Y:c+Math.sin(e*g)*a};return[d]}if("polygon"===a.type){b=[];for(e=0;e<a.value.length;e++){c=a.value[e];d=[];for(g=0;g<c.length;g++)d[g]={X:c[g].X,Y:c[g].Y};b[e]=d}return b}};E.shapeop=function(a,e,b){a=E.shapeconvert(a);var c=E.shapeconvert(e);ClipperLib.JS.ScaleUpPaths(a,1E3);ClipperLib.JS.ScaleUpPaths(c,1E3);e=new ClipperLib.Clipper;
+e.AddPaths(a,ClipperLib.PolyType.ptSubject,!0);e.AddPaths(c,ClipperLib.PolyType.ptClip,!0);c=a=ClipperLib.PolyFillType.pftNonZero;var d=new ClipperLib.Paths;e.Execute(b,d,a,c);ClipperLib.JS.ScaleDownPaths(d,1E3);return{ctype:"shape",type:"polygon",value:d}};E.shapecommon=function(a,e){return E.shapeop(a,e,ClipperLib.ClipType.ctIntersection)};E.shaperemove=function(a,e){return E.shapeop(a,e,ClipperLib.ClipType.ctDifference)};E.shapeconcat=function(a,e){return E.shapeop(a,e,ClipperLib.ClipType.ctUnion)};
+q.key$0=function(a,e){return{ctype:"string",value:Cd}};q.keycode$0=function(a,e){return l.real(cd)};q.mouse$0=function(a,e){return e.id?(a=w(e.id),"number"===a.ctype&&(a=a.value.real,Eb[a])?g.realVector(Eb[a]):h):g.realVector(Ma)};q.mover$0=function(a,e){return ya&&ya.mover?{ctype:"geo",value:ya.mover}:h};q.multiid$0=function(a,e){return l.real(ab)};q.multiidlist$0=function(a,e){a=[];for(var b in Eb)a.push(b);return g.realVector(a)};q.translate$1=function(a,e){a=D(a[0]);"list"===a.ctype&&g.isNumberVector(a)&&
+2===a.value.length&&C.translate(a.value[0].value.real,a.value[1].value.real);return h};q.rotate$1=function(a,e){a=D(a[0]);"number"===a.ctype&&C.rotate(a.value.real);return h};q.scale$1=function(a,e){a=D(a[0]);"number"===a.ctype&&C.scale(a.value.real);return h};q.greset$0=function(a,e){a=cc.stack.length;C.greset();for(e=0;e<a;e++)z.restore();return h};q.gsave$0=function(a,e){C.gsave();z.save();return h};q.grestore$0=function(a,e){C.grestore();z.restore();return h};q.color$1=function(a,e){a=D(a[0]);
+"list"===a.ctype&&g.isNumberVector(a).value&&C.setcolor(a);return h};q.linecolor$1=function(a,e){a=D(a[0]);"list"===a.ctype&&g.isNumberVector(a).value&&C.setlinecolor(a);return h};q.pointcolor$1=function(a,e){a=D(a[0]);"list"===a.ctype&&g.isNumberVector(a).value&&C.setpointcolor(a);return h};q.alpha$1=function(a,e){a=D(a[0]);"number"===a.ctype&&C.setalpha(a);return h};q.pointsize$1=function(a,e){a=D(a[0]);"number"===a.ctype&&C.setpointsize(a);return h};q.linesize$1=function(a,e){a=D(a[0]);"number"===
+a.ctype&&C.setlinesize(a);return h};q.textsize$1=function(a,e){a=D(a[0]);"number"===a.ctype&&C.settextsize(a);return h};q.playanimation$0=function(a,e){F();return h};q.pauseanimation$0=function(a,e){ub();return h};q.stopanimation$0=function(a,e){Wb();return h};q.text$1=function(a,e){a=D(a[0]);return u.string(da(a))};q.replace$3=function(a,e){var b=w(a[0]);e=w(a[1]);a=w(a[2]);if("string"===b.ctype&&"string"===e.ctype&&"string"===a.ctype)return b=b.value,e=e.value.replace(/[^A-Za-z0-9]/g,"\\$&"),a=
+a.value.replace(/\$/g,"$$$$"),b=b.replace(new RegExp(e,"g"),a),{ctype:"string",value:b}};q.replace$2=function(a,e){function b(a,e,b){var d="";c=k=-1;for(var g=0;g<e.length;g++){var f=e[g][0],x=a.indexOf(f,b);-1!==x&&(-1===k?(d=f,k=x,c=g):x<k&&(d=f,k=x,c=g))}return d}var c;e=w(a[0]);var d=w(a[1]);if("string"===e.ctype&&"list"===d.ctype){a=e.value;e=[];for(var g=0;g<d.value.length;g++){var f=d.value[g];"list"===f.ctype&&2===f.value.length&&"string"===f.value[0].ctype&&"string"===f.value[1].ctype&&(e[e.length]=
+[f.value[0].value,f.value[1].value])}var k=-1;for(d=b(a,e,0);-1!==k;)a=a.substring(0,k)+e[c][1]+a.substring(k+d.length,a.length),d=k+e[c][1].length,d=b(a,e,d);return{ctype:"string",value:a}}return h};q.substring$3=function(a,e){e=w(a[0]);var b=D(a[1]);a=D(a[2]);return"string"===e.ctype&&"number"===b.ctype&&"number"===a.ctype?{ctype:"string",value:e.value.substring(Math.floor(b.value.real),Math.floor(a.value.real))}:h};q.tokenize$2=function(a,e){var b=w(a[0]);a=w(a[1]);if("string"===b.ctype&&"string"===
+a.ctype)return q.tokenize$2([b,g.turnIntoCSList([a])],e);if("string"===b.ctype&&"list"===a.ctype){b=b.value;if(0===a.value.length){a=!0;if(void 0!==e.autoconvert){var c=w(e.autoconvert);"boolean"===c.ctype&&(a=c.value)}return a&&""!==b&&(a=Number(b),!isNaN(a))?l.real(a):u.string(b)}c=a.value[0];var d=g.turnIntoCSList(a.value.slice(1));b=b.split(c.value);return g.turnIntoCSList(b.map(function(a){return q.tokenize$2([u.string(a),d],e)}))}return h};q.indexof$2=function(a,e){e=w(a[0]);a=w(a[1]);return"string"===
+e.ctype&&"string"===a.ctype?(a=e.value.indexOf(a.value),l.real(a+1)):h};q.indexof$3=function(a,e){e=w(a[0]);var b=w(a[1]);a=w(a[2]);return"string"===e.ctype&&"string"===b.ctype&&"number"===a.ctype?(a=e.value.indexOf(b.value,Math.round(a.value.real)-1),l.real(a+1)):h};q.parse$1=function(a,e){a=w(a[0]);return"string"===a.ctype?(a=lb(a.value),w(a)):h};q.unicode$1=function(a,e){a=w(a[0]);var b=16;e.base&&(e=w(e.base),"number"===e.ctype&&(b=e.value.real));if("string"===a.ctype)e=parseInt(a.value,b);else if("number"===
+a.ctype)e=a.value.real;else return h;"undefined"!==typeof String.fromCodePoint?e=String.fromCodePoint(e):65535>=e?e=String.fromCharCode(e):(e-=65536,e=String.fromCharCode((e>>10)+55296,(e&1023)+56320));return u.string(e)};q.international$1=function(a,e){return q.international$2([a[0],null],e)};q.international$2=function(a,e){e=w(a[0]);if("string"!==e.ctype)return h;var b=(d.translations||{})[d.language||"en"]||{};if(!b.hasOwnProperty(e.value))return e;var c=b[e.value];if("string"===typeof c)return u.string(c);
+if(null===a[1])return e;a=w(a[1]);a="number"===a.ctype?a.value.real:0;a=(b._pluralFormFunction||Id)(a);return a<c.length?u.string(c[a]):e};q.currentlanguage$0=function(a,e){return u.string(d.language||"en")};E.basismap=function(a,e,b,c){var d=g.turnIntoCSList([a,e,b]);d=g.adjoint3(g.transpose(d));c=u.mult(d,c);d=g.turnIntoCSList([u.mult(c.value[0],a),u.mult(c.value[1],e),u.mult(c.value[2],b)]);return g.transpose(d)};q.map$8=function(a,e){e=Q(a[0]);var b=Q(a[1]),c=Q(a[2]),d=Q(a[3]),f=Q(a[4]),k=Q(a[5]),
+l=Q(a[6]);a=Q(a[7]);return f!==h&&k!==h&&l!==h&&a!==h&&e!==h&&b!==h&&c!==h&&d!==h?(a=E.basismap(f,k,l,a),e=E.basismap(e,b,c,d),e=u.mult(a,g.adjoint3(e)),g.normalizeMax(e)):h};q.map$6=function(a,e){e=Q(a[0]);var b=Q(a[1]),c=Q(a[2]),d=g.realVector([0,0,1]),f=g.cross,k=f(f(c,f(d,f(e,b))),f(b,f(d,f(e,c)))),l=Q(a[3]),m=Q(a[4]);a=Q(a[5]);d=f(f(a,f(d,f(l,m))),f(m,f(d,f(l,a))));return l!==h&&m!==h&&a!==h&&d!==h&&e!==h&&b!==h&&c!==h&&k!==h?(l=E.basismap(l,m,a,d),e=E.basismap(e,b,c,k),e=u.mult(l,g.adjoint3(e)),
+g.normalizeMax(e)):h};q.map$4=function(a,e){e=g.ii;var b=g.jj,c=Q(a[0]),d=Q(a[1]),f=Q(a[2]);a=Q(a[3]);return f!==h&&a!==h&&c!==h&&d!==h?(a=E.basismap(f,a,e,b),e=E.basismap(c,d,e,b),e=u.mult(a,g.adjoint3(e)),g.normalizeMax(e)):h};q.map$2=function(a,e){e=g.ii;var b=g.jj,c=Q(a[0]),d=u.add(g.realVector([1,0,0]),c);a=Q(a[1]);var f=u.add(g.realVector([1,0,0]),a);return a!==h&&f!==h&&c!==h&&d!==h?(a=E.basismap(a,f,e,b),e=E.basismap(c,d,e,b),e=u.mult(a,g.adjoint3(e)),g.normalizeMax(e)):h};q.pointreflect$1=
+function(a,e){e=g.ii;var b=g.jj;a=Q(a[0]);var c=u.add(g.realVector([1,0,0]),a),d=u.add(g.realVector([-1,0,0]),a);return d!==h&&a!==h&&c!==h?(d=E.basismap(a,d,e,b),e=E.basismap(a,c,e,b),e=u.mult(d,g.adjoint3(e)),g.normalizeMax(e)):h};q.linereflect$1=function(a,e){e=g.ii;var b=g.jj;a=Q(a[0]);var c=g.realVector([Math.random(),Math.random(),Math.random()]),d=g.realVector([Math.random(),Math.random(),Math.random()]);c=g.cross(c,a);d=g.cross(d,a);return a!==h&&c!==h?(a=E.basismap(c,d,e,b),e=E.basismap(c,
+d,b,e),e=u.mult(a,g.adjoint3(e)),g.normalizeMax(e)):h};E.extractPointVec=function(a){var e={ok:!1};if("geo"===a.ctype){var b=a.value;if("P"===b.kind)return e.x=Ha.getField(b,"x"),e.y=Ha.getField(b,"y"),e.z=l.real(1),e.ok=!0,e}if("list"!==a.ctype)return e;var c=a.value;if(2===c.length&&(a=c[0],b=c[1],"number"===a.ctype&&"number"===b.ctype))return e.x=a,e.y=b,e.z=l.real(1),e.ok=!0,e;3===c.length&&(a=c[0],b=c[1],c=c[2],"number"===a.ctype&&"number"===b.ctype&&"number"===c.ctype&&(e.x=l.div(a,c),e.y=l.div(b,
+c),e.z=l.real(1),e.ok=!0));return e};q.polygon$1=function(a,e){a=w(a[0]);if("list"===a.ctype){e=[];for(var b=0;b<a.value.length;b++){var c=E.extractPoint(a.value[b]);if(!c.ok)return h;e[b]={X:c.x,Y:c.y}}return{ctype:"shape",type:"polygon",value:[e]}}return h};q.circle$2=function(a,e){e=D(a[0]);a=D(a[1]);e=E.extractPointVec(e);if(!e.ok||"number"!==a.ctype)return h;e=g.turnIntoCSList([e.x,e.y,e.z]);return{ctype:"shape",type:"circle",value:g.turnIntoCSList([e,a])}};q.screen$0=function(a,e){var b=C.drawingstate.initialmatrix;
+a=function(a,e){a-=b.tx;e+=b.ty;return{X:(a*b.d-e*b.b)/b.det,Y:-(-a*b.c+e*b.a)/b.det}};return{ctype:"shape",type:"polygon",value:[[a(0,0),a(ma,0),a(ma,pa),a(0,pa)]]}};q.halfplane$2=function(a,e){e=D(a[0]);a=D(a[1]);var b=Q(e),c=Q(a);if(e!==h&&a!==h){var d=a.usage;a=b;var f=c;if("Line"===e.usage||"Point"===d)a=c,f=b;e=g.turnIntoCSList([f.value[0],f.value[1],l.zero]);e=g.cross(e,a);f=g.cross(f,e);f=u.div(f,f.value[2]);a=u.div(a,a.value[2]);a=g.sub(a,f);e=g.abs(a);a=u.div(a,e);e=f.value[0].value.real;
+f=f.value[1].value.real;b=1E3*a.value[0].value.real;a=1E3*a.value[1].value.real;return{ctype:"shape",type:"polygon",value:[[{X:e+a/2,Y:f-b/2},{X:e+a/2+b,Y:f-b/2+a},{X:e-a/2+b,Y:f+b/2+a},{X:e-a/2,Y:f+b/2}]]}}return h};q.element$1=function(a,e){a=w(a[0]);return"string"===a.ctype&&r.csnames.hasOwnProperty(a.value)?{ctype:"geo",value:r.csnames[a.value]}:h};E.all$1=function(a,e){a=w(a[0]);return"geo"===a.ctype&&a.value.incidences?g.ofGeos(a.value.incidences.map(function(a){return r.csnames[a]}).filter(e)):
+g.nil};q.allpoints$0=function(a,e){return g.ofGeos(r.points)};q.allpoints$1=function(a,e){return E.all$1(a,function(a){return"P"===a.kind})};q.allmasses$0=function(a,e){return g.ofGeos(Ca)};q.allmasses$1=function(a,e){return E.all$1(a,function(a){return"P"===a.kind&&a.behavior&&"Mass"===a.behavior.type})};q.allsprings$0=function(a,e){return g.ofGeos(He)};q.allsprings$1=function(a,e){return E.all$1(a,function(a){return"S"===a.kind&&a.behavior&&"Spring"===a.behavior.type})};q.alllines$0=function(a,
+e){return g.ofGeos(r.lines)};q.alllines$1=function(a,e){return E.all$1(a,function(a){return"L"===a.kind||"S"===a.kind})};q.allsegments$0=function(a,e){return g.ofGeos(r.lines.filter(function(a){return"S"===a.kind}))};q.allsegments$1=function(a,e){return E.all$1(a,function(a){return"S"===a.kind})};q.allconics$0=function(a,e){return g.ofGeos(r.conics)};q.allconics$1=function(a,e){return E.all$1(a,function(a){return"C"===a.kind})};q.allcircles$0=function(a,e){return g.ofGeos(r.conics.filter(function(a){return"Circle"===
+a.matrix.usage}))};q.allcircles$1=function(a,e){return E.all$1(a,function(a){return"C"===a.kind&&"Circle"===a.matrix.usage})};q.allelements$0=function(a,e){return g.ofGeos(r.gslp)};q.allelements$1=function(a,e){return E.all$1(a,function(a){return!0})};q.elementsatmouse$0=function(a,e){var b=g.realVector([Ma[0],Ma[1],1]),c=function(a){if(l._helper.isAlmostZero(a.value[2]))return Infinity;a=g.normalizeZ(a);return g.abs(g.sub(a,b)).value.real},d=function(a){a=g.turnIntoCSList([a.value[0],a.value[1],
+l.zero]);return g.normalizeMax(g.cross(b,a))},f=function(a){var e=u.mult(a.matrix,b);e=d(e);a=m._helper.IntersectLC(e,a.matrix).map(function(a){return c(a)});return.5>Math.min(a[0],a[1])};a=r.points.filter(function(a){return.5>c(a.homog)});e=r.lines.filter(function(a){var e=d(a.homog);e=g.normalizeMax(g.cross(a.homog,e));if((e=.5>c(e))&&"S"===a.kind){var f=a.homog;f=g.turnIntoCSList([f.value[0],f.value[1],l.zero]);a=g.crossratio3(a.farpoint,a.startpos,a.endpos,b,f).value.real;if(0>a||1<a)e=!1}return e});
+var h=r.conics.filter(function(a){var e=f(a);if(e&&a.isArc){var c=g.crossratio3harm(a.startPoint,a.endPoint,a.viaPoint,b,g.ii);a=c.value[0];c=c.value[1];l._helper.isAlmostZero(a)?(a=l.div(a,c),c=l.real(1)):(c=l.div(c,a),a=l.real(1));var d=g.abs(g.turnIntoCSList([c,a]));a=l.div(a,d);c=l.div(c,d);c=l.mult(c,a);0>a.value.real&&(c=l.neg(c));0>c.value.real&&(e=!1)}return e});a=a.concat(e,h);return g.ofGeos(a)};q.incidences$1=q.allelements$1;q.createpoint$2=function(a,e){e=w(a[0]);a=Q(a[1]);return"string"!==
+e.ctype?(sa("Name must be a string"),h):"list"!==a.ctype&&g.isNumberVector(a)?(sa("Position must be a number vector"),h):{ctype:"geo",value:Za({name:e.value,type:"Free",labeled:!0,pos:a},!0)}};q.create$3=function(a,e){var b=w(a[0]),c=w(a[1]),d=w(a[2]);a={};for(var f in e)a[f]=D(e[f]);if("string"===b.ctype)f=b.value;else{if("list"!==b.ctype)return sa("Names must be a string or a list of strings"),h;if(1!==b.value.length){f=u.string(b.value.map(function(a){return a.value}).join("__"));d=q.create$3([f,
+c,d],a);var k=[];if(d!==h)for(c=u.string(d.value.kind.replace(/^(.*)s$/,"Select$1")),d=g.turnIntoCSList([u.string(d.value.name)]),e=0;e<b.value.length;++e)a.index=l.real(e+1),k.push(q.create$3([b.value[e],c,d],a));return g.turnIntoCSList(k)}if("string"!==b.value[0].ctype)return sa("Element of names list must be a string"),h;f=b.value[0].value}if("string"!==c.ctype)return sa("Type must be a string"),h;if("list"!==d.ctype)return sa("Arguments must be a list"),h;if(!m.hasOwnProperty(c.value)&&!ed.hasOwnProperty(c.value)&&
+!Ee.hasOwnProperty(c.value))return sa("Invalid geometric operation: '"+c.value+"'"),h;b=[];var n=null;for(e=0;e<d.value.length;e++){var p=d.value[e];if("string"===p.ctype)b.push(p.value);else if("geo"===p.ctype)b.push(p.value.name);else if(n=Q(p),n===h)return sa("Unknown argument type"),h}d={name:f,type:c.value,labeled:!0};n&&(d.pos=n);0<b.length&&(d.args=b);for(k in a)d[k]=u.unwrap(a[k]);return{ctype:"geo",value:Za(d,!0)}};q.create$2=function(a,e){function b(a){function e(a){r.csnames[a]||(b=a)}
+var b=!1,c;if("P"===a)for(c=0;26>c&!b;c++)8!==c&&9!==c&&e(String.fromCharCode(65+c));else if("L"===a||"S"===a)for(c=0;26>c&!b;c++)8!==c&&9!==c&&e(String.fromCharCode(97+c));for(c=0;!b;c++)e(a+c);return b}var c=w(a[0]);a=w(a[1]);var d={};for(f in e)d[f]=D(e[f]);if(!m.hasOwnProperty(c.value)&&!ed.hasOwnProperty(c.value)&&!Ee.hasOwnProperty(c.value))return sa("Invalid geometric operation: '"+c.value+"'"),h;for(;ed.hasOwnProperty(c.value);)c.value=ed[c.value];var f=m[c.value];e=u.string(b(f.kind));if(a.value.length>
+f.signature.length){var k="Operation "+c.value+" requieres only "+f.signature.length+" argument"+(1===f.signature.length?"":"s")+" ("+a.value.length+" argument"+(1===a.value.length?"":"s")+" given) to create "+e.value+". Ignoring the last arguments.";if(!d.pos){var n=Q(a.value[a.value.length-1]);n!==h&&(k+=" Use the last argument as modifier `pos`.",d.pos=n)}sa(k);a=g.turnIntoCSList(a.value.slice(0,f.signature.length))}f=q.create$3([e,c,a],d);if(f!==h&&"s"===f.value.kind[1]&&f.value.results){c=u.string("Select"+
+f.value.kind[0]);a=g.turnIntoCSList([u.string(f.value.name)]);if(d.pos)return e=u.string(b(f.value.kind[0])),q.create$3([e,c,a],d);k=[];for(n=0;n<f.value.results.value.length;n++)d.index=l.real(n+1),e=u.string(b(f.value.kind[0])),k.push(q.create$3([e,c,a],d));return g.turnIntoCSList(k)}f.isDuplicate&&delete f.isDuplicate;return f};q.javascript$1=function(a,e){a=w(a[0]);"string"===a.ctype&&(new Function(a.value)).call(La);return h};q.use$1=function(a,e){function b(a,e,b){q[a.toLowerCase()+"$"+e]=b}
+a=w(a[0]);if("string"===a.ctype){a=a.value;var c;d.plugins&&(c=d.plugins[a]);c||(c=Ia._pluginRegistry[a]);if(c)return c({instance:La,config:d,nada:h,evaluate:w,extractPoint:E.extractPoint,evaluateAndVal:D,defineFunction:b,addShutdownHook:Db.push.bind(Db),addAutoCleaningEventListener:T,getVariable:L.getvar.bind(L),getInitialMatrix:function(){return C.drawingstate.initialmatrix},setTextRenderer:function(a,e){we=a;e&&(Je=e)},getImage:function(a,e){"string"===typeof a&&(a=u.string(a));a=Ya(a);if(!a)return null;
+!e&&a.cdyUpdate&&a.cdyUpdate();return a},getMyfunction:function(a){return Ka.hasOwnProperty(a)?Ka[a]:null},scheduleUpdate:k}),{ctype:"boolean",value:!0};sa("Plugin "+a+" not found");return{ctype:"boolean",value:!1}}return h};q.format$2=function(a,e){function b(a,b){a=a.toFixed(k);do{var c=a;a=a.substring(0,a.length-1)}while(b&&""!==a&&"-"!==a&&+a===+c);b=""+c;e.delimiter&&"string"===e.delimiter.ctype&&(b=b.replace(".",e.delimiter.value));return b}function c(a,e){if("number"===a.ctype){var d=b(a.value.real,
+g);var f=b(a.value.imag,g);a=Math.abs(a.value.imag)<Math.pow(10,-e)?d:"-"===f.substring(0,1)?d+" - i*"+f.substring(1):d+" + i*"+f;return{ctype:"string",value:a}}return"list"===a.ctype?{ctype:"list",value:a.value.map(c)}:{ctype:"string",value:da(a).toString()}}var d=D(a[0]);a=D(a[1]);var g=!0;if(e.truncate){var f=w(e.truncate);"boolean"===f.ctype&&(g=f.value)}if(("number"===d.ctype||"list"===d.ctype)&&"number"===a.ctype){var k=Math.max(0,Math.min(20,Math.round(a.value.real)));return c(d,k)}return h};
+Date.now||(Date.now=function(){return(new Date).getTime()});var Ie=0;q.timestamp$0=function(a,e){return l.real(Date.now())};q.seconds$0=function(a,e){return l.real((Date.now()-Ie)/1E3)};q.resetclock$0=function(a,e){Ie=Date.now();return h};q.time$0=function(a,e){a=new Date;return g.realVector([a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()])};q.date$0=function(a,e){a=new Date;return g.realVector([a.getFullYear(),a.getMonth()+1,a.getDate()])};q.simulationtime$0=function(a,e){return l.real(yc*
+Bc)};q.settimeout$2=function(a,e){function b(){w(c);k()}e=w(a[0]);var c=a[1];"number"===e.ctype&&"undefined"!==typeof window&&window.setTimeout(b,1E3*e.value.real);return h};E.formatForWebGL=function(a){return a.toFixed(10)};q.generateWebGL$2=function(a,e){var b=E.formatForWebGL;e=a[0];a=w(a[1]);console.log(a);if("list"!==a.ctype)return h;for(var c=[],d=0;d<a.value.length;d++)"string"===a.value[d].ctype&&c.push(a.value[d].value);console.log("***********");console.log(c);a=E.plotvars(e);console.log(a);
+-1===a.indexOf("a")&&-1===a.indexOf("b")&&-1===a.indexOf("c")&&-1===a.indexOf("d")&&-1===a.indexOf("e")&&-1===a.indexOf("f")&&(e=D(e));if("number"===e.ctype)return{ctype:"string",value:"vec2("+b(e.value.real)+","+b(e.value.imag)+")"};if("variable"===e.ctype)return{ctype:"string",value:e.name};if("string"===e.ctype||"void"===e.ctype)return e;if(2===e.args.length&&("infix"===e.ctype||"function"===e.ctype)){b=q.compileToWebGL$1([e.args[0]],{});a=q.compileToWebGL$1([e.args[1]],{});if("+"===e.oper||"add"===
+e.oper)return void 0===b.value||"void"===b.ctype?{ctype:"string",value:a.value}:{ctype:"string",value:"addc("+b.value+","+a.value+")"};if("*"===e.oper||"mult"===e.oper)return{ctype:"string",value:"multc("+b.value+","+a.value+")"};if("/"===e.oper||"div"===e.oper)return{ctype:"string",value:"divc("+b.value+","+a.value+")"};if("-"===e.oper||"sub"===e.oper)return void 0===b.value||"void"===b.ctype?{ctype:"string",value:"negc("+a.value+")"}:{ctype:"string",value:"subc("+b.value+","+a.value+")"};if("^"===
+e.oper||"pow"===e.oper)return{ctype:"string",value:"powc("+b.value+","+a.value+")"}}if("function"===e.ctype&&1===e.args.length){b=q.compileToWebGL$1([e.args[0]],{});if("sin$1"===e.oper)return{ctype:"string",value:"sinc("+b.value+")"};if("cos$1"===e.oper)return{ctype:"string",value:"cosc("+b.value+")"};if("tan$1"===e.oper)return{ctype:"string",value:"tanc("+b.value+")"};if("exp$1"===e.oper)return{ctype:"string",value:"expc("+b.value+")"};if("log$1"===e.oper)return{ctype:"string",value:"logc("+b.value+
+")"};if("arctan$1"===e.oper)return{ctype:"string",value:"arctanc("+b.value+")"};if("arcsin$1"===e.oper)return{ctype:"string",value:"arcsinc("+b.value+")"};if("arccos$1"===e.oper)return{ctype:"string",value:"arccosc("+b.value+")"};if("sqrt$1"===e.oper)return{ctype:"string",value:"sqrtc("+b.value+")"}}return h};q.compileToWebGL$1=function(a,e){e=E.formatForWebGL;a=a[0];var b=E.plotvars(a);-1===b.indexOf("a")&&-1===b.indexOf("b")&&-1===b.indexOf("c")&&-1===b.indexOf("d")&&-1===b.indexOf("e")&&-1===b.indexOf("f")&&
+(a=D(a));if("number"===a.ctype)return{ctype:"string",value:"vec2("+e(a.value.real)+","+e(a.value.imag)+")"};if("variable"===a.ctype)return{ctype:"string",value:a.name};if("string"===a.ctype||"void"===a.ctype)return a;if(2===a.args.length&&("infix"===a.ctype||"function"===a.ctype)){e=q.compileToWebGL$1([a.args[0]],{});b=q.compileToWebGL$1([a.args[1]],{});if("+"===a.oper||"add"===a.oper)return void 0===e.value||"void"===e.ctype?{ctype:"string",value:b.value}:{ctype:"string",value:"addc("+e.value+","+
+b.value+")"};if("*"===a.oper||"mult"===a.oper)return{ctype:"string",value:"multc("+e.value+","+b.value+")"};if("/"===a.oper||"div"===a.oper)return{ctype:"string",value:"divc("+e.value+","+b.value+")"};if("-"===a.oper||"sub"===a.oper)return void 0===e.value||"void"===e.ctype?{ctype:"string",value:"negc("+b.value+")"}:{ctype:"string",value:"subc("+e.value+","+b.value+")"};if("^"===a.oper||"pow"===a.oper)return{ctype:"string",value:"powc("+e.value+","+b.value+")"}}if("function"===a.ctype&&1===a.args.length){e=
+q.compileToWebGL$1([a.args[0]],{});if("sin$1"===a.oper)return{ctype:"string",value:"sinc("+e.value+")"};if("cos$1"===a.oper)return{ctype:"string",value:"cosc("+e.value+")"};if("tan$1"===a.oper)return{ctype:"string",value:"tanc("+e.value+")"};if("exp$1"===a.oper)return{ctype:"string",value:"expc("+e.value+")"};if("log$1"===a.oper)return{ctype:"string",value:"logc("+e.value+")"};if("arctan$1"===a.oper)return{ctype:"string",value:"arctanc("+e.value+")"};if("arcsin$1"===a.oper)return{ctype:"string",value:"arcsinc("+
+e.value+")"};if("arccos$1"===a.oper)return{ctype:"string$1",value:"arccosc("+e.value+")"};if("sqrt$1"===a.oper)return{ctype:"string",value:"sqrtc("+e.value+")"}}return h};q.setsimulationspeed$1=function(a,b){a=D(a[0]);"number"===a.ctype&&O(a.value.real);return h};q.setsimulationaccuracy$1=function(a,b){a=D(a[0]);"number"===a.ctype&&"undefined"!==typeof W&&"undefined"!==typeof W.env&&(W.env.accuracy=Math.max(1,a.value.real|0));return h};q.setsimulationquality$1=function(a,b){a=D(a[0]);"number"===a.ctype&&
+"undefined"!==typeof W&&"undefined"!==typeof W.env&&(a=a.value.real,0===a&&(W.env.errorbound=.01,W.env.lowestdeltat=1E-5,W.env.slowdownfactor=2),1===a&&(W.env.errorbound=.001,W.env.lowestdeltat=1E-7,W.env.slowdownfactor=2),2===a&&(W.env.errorbound=1E-5,W.env.lowestdeltat=1E-10,W.env.slowdownfactor=4),3===a&&(W.env.errorbound=1E-6,W.env.lowestdeltat=1E-12,W.env.slowdownfactor=4));return h};var Oc=null,ve=null;q.createtool$3=function(a,b){var e="left",c="top",d=null;if(b.space){var g=w(b.space);"number"===
+g.ctype&&(d=g.value.real/2)}var f=null;b.toolbar&&(g=w(b.toolbar),"string"===g.ctype&&((f=document.getElementById(g.value))||console.warn("Element #"+g.value+" not found")));if(!f){if(b.reference&&(g=w(b.reference),"string"===g.ctype))switch(g.value){case "UR":e="right";break;case "LL":c="bottom";break;case "LR":e="right",c="bottom"}f=document.createElement("div");f.className="CindyJS-toolbar";ra.parentNode.appendChild(f);g=w(a[1]);var k=w(a[2]);"number"===g.ctype&&(f.style[e]=g.value.real+"px");
+"number"===k.ctype&&(f.style[c]=k.value.real+"px");null!==d&&(f.style.margin=-d+"px")}a=w(a[0]);if("string"===a.ctype)a=[[a.value]];else if("list"===a.ctype)a=a.value.map(function(a){return"string"===a.ctype?[a.value]:"list"===a.ctype?a.value.map(function(a){return"string"===a.ctype?a.value:null}):[null]});else return sa("Name must be a string or a list of strings"),h;if(b.flipped&&(g=w(b.flipped),"boolean"===g.ctype&&g.value)){sa("Flipping");var l=0;b=a.length;a.forEach(function(a){a.length>l&&(l=
+a.length)});g=[];for(k=0;k<l;++k){g[k]=[];for(var m=0;m<b;++m)g[k][m]=a[m][k]||null}a=g}"bottom"===c&&a.reverse();a.forEach(function(a){"right"===e&&a.reverse();var b=document.createElement("div");f.appendChild(b);a.forEach(function(a){function e(){Oc&&Oc.classList.remove("CindyJS-active");Oc=g;g.classList.add("CindyJS-active");De=a;var b=H[De].actions;ve&&(ve.textContent=b[0].tooltip||"");ib=[];dd=Vb=0}H.hasOwnProperty(a)||(sa("Tool '"+a+"' not implemented yet."),a=null);if(null===a){var c=document.createElement("span");
+c.className="CindyJS-spacer";b.appendChild(c)}else{var g=document.createElement("button");c=document.createElement("img");c.src=Ia.getBaseDir()+"images/"+a+".png";g.appendChild(c);g.addEventListener("click",e);Oc||e();null!==d&&(g.style.margin=d+"px");b.appendChild(g)}})});return h};q.dropped$0=function(){return ad};q.droppoint$0=function(){return bd};q.parsecsv$1=function(a,b){var e=!0,c=D(b.autoconvert);"boolean"===c.ctype&&(e=c.value);c=null;b=D(b.delimiter);"string"===b.ctype&&/^[^"\r\n]$/.test(b.value)&&
+(c=b.value);a=D(a[0]);if("string"!==a.ctype)return sa("CSV data is not a string"),h;a=a.value;b='(?:"((?:[^"]+|"")*)"|([^]*?))(\r\n|(,)|[\r\n]|$)';c&&(c=c.replace(/[^A-Za-z0-9]/g,"\\$&").replace(/\$/g,"$$$$"),b=b.replace(/,/g,c));b=new RegExp(b,"g");c=[];for(var d=[],f=null;b.lastIndex<a.length;){var k=b.exec(a),m=k[2];"string"===typeof k[1]&&(m=k[1].replace(/""/g,'"'));m=e?/^[Tt]rue$/.test(m)?u.bool(!0):/^[Ff]alse$/.test(m)?u.bool(!1):/^[\-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+|Infinity)$/.test(m)?l.real(Number(m)):
+u.string(m):u.string(m);c.push(m);k[4]&&b.lastIndex===a.length&&(c.push(u.string("")),k={});if(!k[4]){null===f&&(f=c.length);if(f<c.length)for(f=c.length,k=0;k<d.length;++k)for(m=d[k].length;m<f;++m)d[k][m]=h;else if(f>c.length)for(k=c.length;k<f;++k)c[k]=h;d.push(c);c=[]}}return g.turnIntoCSList(d.map(g.turnIntoCSList))};q.load$2=function(a,b){return q.load$3([a[0],null,a[1]],b)};q.load$3=function(a,b){function e(){if(g.readyState===XMLHttpRequest.DONE){if(200===g.status)var b=u.string(String(g.responseText));
+else sa("Failed to load "+d+": "+g.statusText),b=h;L.newvar(c);L.setvar(c,b);w(a[2]);L.removevar(c);k()}}var c="#";null!==a[1]&&"variable"===a[1].ctype&&(c=a[1].name);b=D(a[0]);var d=null,g=null;"string"===b.ctype&&/^https?:\/\//.test(b.value)&&(d=b.value);return null!==d?(g=new XMLHttpRequest,g.onreadystatechange=e,g.open("GET",d),g.send(),u.bool(!0)):h};q.removeelement$1=function(a,b){a=w(a[0]);"geo"===a.ctype?Rc(a.value.name):console.log("argument of removeelement is undefined or not of type <geo>")};
+q.guess$1=function(a,b){function e(a){if((a=kb.doPSLQ([a,1,Math.PI*Math.E],15))&&0===a[2])return[Math.round(a[0]),Math.round(a[1])]}function c(a){if(l._helper.isAlmostZero(a))return"0";if(!l._helper.isAlmostReal(a)){var b=a.value.real,c=a.value.imag,x=e(b),h=e(b*b+c*c);if(x&&h){b=-x[0]*h[0];var v=-x[1]*h[0]*2,m=x[0]*h[1];x=g(-v,2*b);h=v*v-4*m*b;a=f(h);h/=a*a;h=a===2*b?"+i*sqrt("+-h+")":a===-2*b?"+i*sqrt("+-h+")":"+i*"+g(a,2*b).substring(1)+"*sqrt("+-h+")";a="-"+h.substring(1);v=Math.abs((v*v-4*m*
+b)/(4*b*b));b=Math.sqrt(v);v=-Math.sqrt(v);if("+0"===x||"-0"===x)x="";c=Math.abs(c-b)<Math.abs(c-v)?x+h:x+a;c.startsWith("+")&&(c=c.substring(1))}else c=da(a);return c}var n=kb.doPSLQ([Math.PI,a.value.real,1],15);c=""+a.value.real;m=b="";var N=v=1E4;x=1E5;if(n&&3E3>(x=d(n))){b=a.value.real;v=n[0];h=-n[1];n=n[2];var Y="";if(0!==v){var ka=Math.round(v);var p=Math.round(h);Y=g(ka,p)+"*pi"}ka="";0!==n&&(ka=Math.round(n),p=Math.round(h),ka=g(ka,p));k=Math.abs(b-(n/h+Math.PI*v/h));b=ka+Y;""===b?b="0":b.startsWith("+")&&
+(b=b.substring(1));v=k}Y=kb.doPSLQ([a.value.real*a.value.real,a.value.real,1],15);h=1E5;if(Y&&9E3>(h=10+d(Y))){a=a.value.real;N=Y[0];n=Y[1];Y=Y[2];ka=Math.round(N);p=Math.round(n);var za=Math.round(Y);m=g(-p,2*ka);p=p*p-4*za*ka;za=f(p);p/=za*za;ka=za===2*ka?"+sqrt("+p+")":za===-2*ka?"-sqrt("+p+")":g(za,2*ka)+"*sqrt("+p+")";p=-n/(2*N);Y=Math.abs((n*n-4*Y*N)/(4*N*N));ka="+"+ka.substring(1);N="-"+ka.substring(1);n=p+Math.sqrt(Y);Y=p-Math.sqrt(Y);if("+0"===m||"-0"===m)m="";Math.abs(a-n)<Math.abs(a-Y)?
+(k=Math.abs(a-n),a=m+ka):(k=Math.abs(a-Y),a=m+N);a.startsWith("+")&&(a=a.substring(1));m=a;N=k}x<h&&1E-12>v&&(c=b);h<x&&1E-12>N&&(c=m);return c}function d(a){var b=Math.abs(a[0]);Math.abs(a[1])>b&&(b=Math.abs(a[1]));Math.abs(a[2])>b&&(b=Math.abs(a[2]));return b}function g(a,b){var e="+";0>a*b&&(a=Math.abs(a),b=Math.abs(b),e="-");var c=Zb(a,b);a/=c;b/=c;0>a&&0>b&&(a=-a,b=-b);return 1===b?e+a:e+a+"/"+b}function f(a){for(var b=3E3;0<b;b--)if(0===a%(b*b))return b;return 1}var k=0;a=D(a[0]);return"number"===
+a.ctype&&l._helper.isFinite(a)?(a=void 0===c(a)?"no guess":c(a),u.string(a)):h};E.extractPoint=function(a){var b={ok:!1};if("geo"===a.ctype){var c=a.value;if("P"===c.kind)return b.x=Ha.getField(c,"x").value.real,b.y=Ha.getField(c,"y").value.real,b.ok=!0,b}if("list"!==a.ctype)return b;var d=a.value;if(2===d.length&&(a=d[0],c=d[1],"number"===a.ctype&&"number"===c.ctype))return b.x=a.value.real,b.y=c.value.real,b.ok=!0,b;3===d.length&&(a=d[0],c=d[1],d=d[2],"number"===a.ctype&&"number"===c.ctype&&"number"===
+d.ctype&&(a=l.div(a,d),c=l.div(c,d),b.x=a.value.real,b.y=c.value.real,b.ok=!0));return b};q.draw$1=function(a,b){a=D(a[0]);if("shape"===a.ctype)E.drawshape(a,b);else if("Line"===a.usage)y.handleModifs(b,y.lineModifs),y.drawline(a);else{var e=E.extractPoint(a);if(!e.ok){if("undefined"!==typeof a.value&&2===a.value.length)return q.draw$2(a.value,b);return}null!==b&&y.handleModifs(b,y.pointModifs);y.drawpoint(e)}return h};q.draw$2=function(a,b){var e=D(a[0]);a=D(a[1]);e=E.extractPoint(e);a=E.extractPoint(a);
+if(!e.ok||!a.ok)return h;null!==b&&y.handleModifs(b,y.lineModifs);y.drawsegcore(e,a);return h};q.drawcircle$2=function(a,b){return E.drawcircle(a,b,"D")};E.arcHelper=function(a){var b={};b.startPoint=Q(a[0]);b.viaPoint=Q(a[1]);b.endPoint=Q(a[2]);return b};q.fillcircle$2=function(a,b){return E.drawcircle(a,b,"F")};q.drawarc$3=function(a,b){a=E.arcHelper(a);return E.drawarc(a,b,"D")};q.fillarc$3=function(a,b){a=E.arcHelper(a);return E.drawarc(a,b,"F")};E.drawarc=function(a,b,c){var e=a.startPoint,d=
+a.viaPoint;a=a.endPoint;if(!g._helper.isAlmostReal(g.turnIntoCSList([e,d,a])))return h;y.handleModifs(b,y.conicModifs);y.preDrawCurve();b=g.det3(e,d,a);if(1E-12<Math.abs(b.value.real)){b=m._helper.ConicBy5(null,e,d,a,g.ii,g.jj);var f=m._helper.CenterOfConic(b);f=g.normalizeMax(f);b=l.real(0);var x=g.turnIntoCSList([g.turnIntoCSList([f.value[2],b,l.neg(f.value[0])]),g.turnIntoCSList([b,f.value[2],l.neg(f.value[1])]),g.turnIntoCSList([b,b,f.value[2]])]);b=g.normalizeZ(u.mult(x,e));g.normalizeZ(u.mult(x,
+d));x=g.normalizeZ(u.mult(x,a));b=-Math.atan2(b.value[1].value.real,b.value[0].value.real);x=-Math.atan2(x.value[1].value.real,x.value[0].value.real);f=g.normalizeZ(f);e=g.normalizeZ(e);d=g.normalizeZ(d);a=g.normalizeZ(a);var k=g.abs(g.sub(e,f)),n=[f.value[0].value.real,f.value[1].value.real];f=C.drawingstate.matrix;var p=n[0]*f.a-n[1]*f.b+f.tx;n=n[0]*f.c-n[1]*f.d-f.ty;e=0<g.det3(e,d,a).value.real;z.save();z.beginPath();z.translate(p,n);z.arc(0,0,k.value.real*f.sdet,b,x,e);"F"===c&&(z.fillStyle=y.lineColor,
+z.closePath(),z.fill());"D"===c&&z.stroke();z.restore()}else{if("D"!==c)return h;c=E.extractPoint(e);b=E.extractPoint(d);x=E.extractPoint(a);if(!c.ok||!b.ok||!x.ok)return h;k=(c.x-x.x)*(c.x-x.x)+(c.y-x.y)*(c.y-x.y);f=(x.x-b.x)*(x.x-b.x)+(x.y-b.y)*(x.y-b.y);if(1E-12>(c.x-b.x)*(c.x-b.x)+(c.y-b.y)*(c.y-b.y)||1E-12>k||1E-12>f)return h;0>g.crossratio3(e,a,d,g.cross(g.cross(e,d),g.linfty),g.ii).value.real?y.drawsegcore(c,x):y.drawRaySegment(e,a)}return h};E.drawcircle=function(a,b,c){var e=D(a[0]);a=D(a[1]);
+var d=E.extractPoint(e);if(!d.ok||"number"!==a.ctype||!l._helper.isAlmostReal(a))return h;e=C.drawingstate.matrix;var g=d.x*e.a-d.y*e.b+e.tx;d=d.x*e.c-d.y*e.d-e.ty;y.handleModifs(b,y.conicModifs);y.preDrawCurve();z.lineJoin="miter";z.beginPath();z.arc(g,d,Math.abs(a.value.real)*e.sdet,0,2*Math.PI);z.closePath();"D"===c&&z.stroke();"F"===c&&(z.fillStyle=y.lineColor,z.fill());"C"===c&&z.clip();return h};q.drawconic$1=function(a,b){a=D(a[0]);if("list"!==a.ctype||3!==a.value.length&&6!==a.value.length)return console.error("could not parse conic"),
+h;if(6===a.value.length){for(var e=0;6>e;e++)if("number"!==a.value[e].ctype)return console.error("could not parse conic"),h;var c=l.real(.5);e=a.value[0];var d=a.value[2];d=l.mult(d,c);var f=a.value[1],k=a.value[3];k=l.mult(k,c);var m=a.value[4];m=l.mult(m,c);a=a.value[5];a=g.turnIntoCSList([g.turnIntoCSList([e,d,k]),g.turnIntoCSList([d,f,m]),g.turnIntoCSList([k,m,a])])}else{if(!g.isNumberMatrix(a).value||3!==a.value.length||3!==a.value[0].value.length)return h;e=g.transpose(a);g.equals(a,e).value||
+(a=g.add(e,a))}return E.drawconic(a,b)};E.drawconic=function(a,b){function e(a,b){a=(l*a+m*b+n)*a+(p*b+q)*b+r;return 0<=a?1:0>a?-1:NaN}function c(a){L.next=a;a.prev=L;return L=a}function d(a,b,c,d){return{a:a,b1:b,b2:c,vertical:!0,index:d,sign:function(b){return e(a,b)},mkp:function(b){return{x:a,y:b}},sol:dc(p,m*a+q,(l*a+n)*a+r),discr:function(){return dc(D,-2*w,t)},tpt:function(a){return{x:a,y:-.5*(m*a+q)/p}}}}function f(a,b,c,d){return{a:a,b1:b,b2:c,vertical:!1,index:d,sign:function(b){return e(b,
+a)},mkp:function(b){return{x:b,y:a}},sol:dc(l,m*a+n,(p*a+q)*a+r),discr:function(){return dc(D,-2*B,A)},tpt:function(a){return{x:-.5*(m*a+n)/l,y:a}}}}function h(a){var b=Math.min(a.b1,a.b2),e=Math.max(a.b1,a.b2),d=a.sign(b),g=a.sign(e);if(!isFinite(d*g))return!1;var f=a.sol;if(d!==g){if(null===f)return!1;var x=.5*(f[0]+f[1]);x>b&&x<e?(b=a.sign(x),x=f[b===g?0:1]):(d=.5*(b+e),x=f[Math.abs(d-f[0])<Math.abs(d-f[1])?0:1]);J.push(c(a.mkp(x)))}else{if(null===f){if(0>=E)return!0;f=a.discr();if(null===f)return!0;
+a=a.tpt(f[a.index]);a.x>=F&&a.x<=H&&a.y>=G&&a.y<=I&&c(a);return!0}x=.5*(f[0]+f[1]);if(!(x>b&&x<e))return!0;b=a.sign(x);if(b===d||isNaN(b))return!0;a.b1>a.b2&&(f=[f[1],f[0]]);J.push(c(a.mkp(f[0])));J.push(c(a.mkp(f[1])))}return!0}function k(a,b,e,c,d){var g=b-c,f=e-a,x=a*c-b*e,h=w*g+B*f+D*x;if(1E-14>Math.abs(h))return z.lineTo(e,c);var v=(t*g+u*f+w*x)/h;g=(u*g+A*f+B*x)/h;if(!isFinite(v)||!isFinite(g)||.04>Math.abs(a*g+v*c+e*b-e*g-v*b-a*c))return z.lineTo(e,c);do if(!(10<d)){x=.5*(a+e);f=.5*(b+c);var N=
+v-x;h=g-f;if(!(.04>N*N+h*h)){var Y=l*N*N+m*N*h+p*h*h,ka=2*l*N*x+m*(N*f+h*x)+2*p*h*f+n*N+q*h,za=(l*x+m*f+n)*x+(p*f+q)*f+r,fa=dc(Y,ka,za);fa||(fa=[-.5*ka/Y,-2*za/ka]);if(0<fa[0])fa=fa[0];else if(0<=fa[1])fa=fa[1];else break;N=x+fa*N;h=f+fa*h;x=N-.5*(v+x);f=h-.5*(g+f);if(!(.04>x*x+f*f)){k(a,b,N,h,d+1);k(N,h,e,c,d+1);return}}}while(0);z.quadraticCurveTo(v,g,e,c)}y.handleModifs(b,y.conicModifs);if(0!==y.lsize&&(y.preDrawCurve(),a=g.normalizeMax(a),g._helper.isAlmostReal(a))){b=C.toMat();a=g.mult(g.transpose(b),
+a);a=g.mult(a,b);a=g.normalizeMax(a);var l=a.value[0].value[0].value.real,m=2*a.value[0].value[1].value.real,n=2*a.value[0].value[2].value.real,p=a.value[1].value[1].value.real,q=2*a.value[1].value[2].value.real,r=a.value[2].value[2].value.real,t=4*r*p-q*q,u=q*n-2*r*m,w=q*m-2*p*n,A=4*r*l-n*n,B=n*m-2*q*l,D=4*p*l-m*m,E=D;a=p*A+m*u+l*t-r*D;0>a&&(l=-l,m=-m,n=-n,p=-p,q=-q,r=-r,a=-a);a=y.lsize;var F=-a,G=-a,H=ma+a,I=pa+a,J=[],L=a={};if(h(d(F,G,I,0))&&h(f(I,F,H,1))&&h(d(H,I,G,1))&&h(f(G,H,F,0))&&L!==a){L.next=
+a.next;a.next.prev=L;z.beginPath();if(0===J.length){var K=L;z.moveTo(K.x,K.y);do{var M=K.next;k(K.x,K.y,M.x,M.y,0);K=M}while(K!==L);z.closePath()}b=1===e(F,G)?0:1;if(4===J.length){var P=0;for(a=0;2>a;++a){K=J[a];M=J[a+2];var O=M.x-K.x;K=M.y-K.y;K=(l*O+m*K)*O+p*K*K;Math.abs(K)>Math.abs(P)&&(P=K)}if(isNaN(P))return;0<=P&&(b=1-b)}for(a=b;a<J.length;a+=2)for(K=J[a],b=J[(a+1)%J.length],z.moveTo(K.x,K.y),M=K.next;K!==b;M=(K=M).next)k(K.x,K.y,M.x,M.y,0);z.stroke()}}};q.drawall$1=function(a,b){a=w(a[0]);
+if("list"===a.ctype)for(y.handleModifs(b,y.pointAndLineModifs),b=0;b<a.value.length;b++)q.draw$1([a.value[b]],null);return h};q.connect$1=function(a,b){return E.drawpolygon(a,b,"D",!1)};q.drawpoly$1=function(a,b){return E.drawpolygon(a,b,"D",!0)};q.fillpoly$1=function(a,b){return E.drawpolygon(a,b,"F",!0)};q.drawpolygon$1=function(a,b){return E.drawpolygon(a,b,"D",!0)};q.fillpolygon$1=function(a,b){return E.drawpolygon(a,b,"F",!0)};E.drawpolygon=function(a,b,c,d){function e(){for(var a=x.value,b=
+0;b<a.length;b++){var e=a[b],c;for(c=0;c<e.length;c++){var d=e[c],g=d.X*f.a-d.Y*f.b+f.tx;d=d.X*f.c-d.Y*f.d-f.ty;0===c?z.moveTo(g,d):z.lineTo(g,d)}z.closePath()}}function g(){var a;for(a=0;a<x.value.length;a++){var b=E.extractPoint(x.value[a]);if(!b.ok)return;var e=b.x*f.a-b.y*f.b+f.tx;b=b.x*f.c-b.y*f.d-f.ty;0===a?z.moveTo(e,b):z.lineTo(e,b)}d&&z.closePath()}y.handleModifs(b,d?y.conicModifs:y.lineModifs);y.preDrawCurve();var f=C.drawingstate.matrix,x=w(a[0]);z.beginPath();"list"===x.ctype&&g();"shape"===
+x.ctype&&e();"D"===c&&(y.fillColor&&(z.fillStyle=y.fillColor,z.fill(y.fillrule)),z.stroke());"F"===c&&(z.fillStyle=y.lineColor,z.fill(y.fillrule));"C"===c&&z.clip();return h};var we=id,Je=function(a,b,c){if(-1!==b.indexOf("\n"))for(b=b.split("\n"),a.textContent=b[0],c=1;c<b.length;++c)a.appendChild(document.createElement("br")),a.appendChild(document.createTextNode(b[c]));else a.textContent=b};E.drawtext=function(a,b,c){var e=D(a[0]);a=w(a[1]);var d=E.extractPoint(e);if(!d.ok)return null;y.handleModifs(b,
+y.textModifs);b=C.drawingstate.textsize;null===b&&(b=Aa.textsize);null!==y.size&&(b=y.size);z.fillStyle=y.textColor;var g=C.drawingstate.matrix;e=d.x*g.a-d.y*g.b+g.tx+y.xOffset;d=d.x*g.c-d.y*g.d-g.ty-y.yOffset;a=da(a);Ia._pluginRegistry.katex||"string"!==typeof a||3<=a.split("$").length&&ba("katex","katex-plugin.js",!0);z.font=y.bold+y.italics+Math.round(10*b)/10+"px "+y.family;return c?c(a,e,d,y.align,b):we(z,a,e,d,y.align,b,b*Aa.lineHeight,y.angle)};q.drawtext$2=function(a,b){E.drawtext(a,b,null);
+return h};q.drawtable$2=function(a,b){var e=D(a[0]);a=D(a[1]);var c=E.extractPoint(e);if(!c.ok||"list"!==a.ctype)return h;e=a.value;a=e.length;var d=-1,f;for(f=0;f<a;++f)"list"===e[f].ctype&&e[f].value.length>d&&(d=e[f].value.length);-1===d?(e=e.map(function(a){return[a]}),d=1):e=e.map(function(a){return g.asList(a).value});var k=100,l=null,m=!0,n=C.drawingstate.textcolor;y.handleModifs(b,{size:!0,color:function(a){g._helper.isNumberVecN(a,3)&&(n=y.makeColor([a.value[0].value.real,a.value[1].value.real,
+a.value[2].value.real]))},alpha:!0,bold:!0,italics:!0,family:!0,align:!0,x_offset:!0,y_offset:!0,offset:!0,width:function(a){"number"===a.ctype&&(k=a.value.real)},height:function(a){"number"===a.ctype&&(l=a.value.real)},border:function(a){"boolean"===a.ctype&&(m=a.value)}});f=C.drawingstate.textsize;null===f&&(f=Aa.textsize);null!==y.size&&(f=y.size);null===l&&(l=1.6*f);z.font=y.bold+y.italics+Math.round(10*f)/10+"px "+y.family;f=C.drawingstate.matrix;var p=d*k,q=a*l;b=c.x*f.a-c.y*f.b+f.tx+y.xOffset;
+var r=c.x*f.c-c.y*f.d-f.ty-y.yOffset-q;if(m){y.preDrawCurve();z.strokeStyle=y.lineColor;z.beginPath();for(f=1;f<a;++f)z.moveTo(b,r+f*l),z.lineTo(b+p,r+f*l);for(c=1;c<d;++c)z.moveTo(b+c*k,r),z.lineTo(b+c*k,r+q);z.stroke();z.lineWidth=y.lsize+1;z.beginPath();z.rect(b,r,p,q);z.stroke()}b+=y.align*k+(1-2*y.align)*l*.3;r+=.7*l;z.fillStyle=n;for(f=0;f<a;++f)for(c=0;c<d;++c)p=da(e[f][c]),we(z,p,b+c*k,r+f*l,y.align);return h};E.drawshape=function(a,b){return"polygon"===a.type?E.drawpolygon([a],b,"D",1):"circle"===
+a.type?E.drawcircle([a.value.value[0],a.value.value[1]],b,"D"):h};E.fillshape=function(a,b){return"polygon"===a.type?E.drawpolygon([a],b,"F",1):"circle"===a.type?E.drawcircle([a.value.value[0],a.value.value[1]],b,"F"):h};E.clipshape=function(a,b){return"polygon"===a.type?E.drawpolygon([a],b,"C",1):"circle"===a.type?E.drawcircle([a.value.value[0],a.value.value[1]],b,"C"):h};q.fill$1=function(a,b){a=w(a[0]);return"shape"===a.ctype?E.fillshape(a,b):h};q.clip$1=function(a,b){var e=w(a[0]);return"shape"===
+e.ctype?E.clipshape(e,b):"list"===e.ctype?(a=q.polygon$1(a,[]),q.clip$1([a],[])):h};q.plot$1=function(a,b){return q.plot$2([a[0],null],b)};q.plot$2=function(a,b){function e(a){return"number"===a.ctype&&l._helper.isAlmostReal(a)}function c(a,b,e,c,d){m++;b=+b.value.real;d=+c.value.real;c=b*B.a-d*B.b+B.tx;b=b*B.c-d*B.d-B.ty;a=+a.value.real;d=+e.value.real;e=a*B.a-d*B.b+B.tx;a=a*B.c-d*B.d-B.ty;n?(z.lineTo(e,a),z.lineTo(c,b)):(z.beginPath(),z.moveTo(e,a),z.lineTo(c,b),n=!0)}function d(a,b,g,x,h){var v=
+e(g),m=e(x);if(.001>h)!f&&n&&(z.stroke(),n=!1);else if(v||m){var N=l.real((a.value.real+b.value.real)/2);L.setvar(A,N);var Y=w(u),p=e(Y);if(v&&m&&p){var ka=g.value.real;m=Y.value.real;p=x.value.real;if(v=1>Math.abs(ka+p-2*m)/k){var q=l.real((a.value.real+N.value.real)/2);L.setvar(A,q);q=w(u);var za=l.real((N.value.real+b.value.real)/2);L.setvar(A,za);za=w(u);ka=Math.abs(ka+m-2*q.value.real)/k;m=Math.abs(m+p-2*za.value.real)/k;v=v&&1>ka&&1>m}v?(c(a,N,g,Y,h/2),c(N,b,Y,x,h/2)):(d(a,N,g,Y,h/2),d(N,b,
+Y,x,h/2))}else d(a,N,g,Y,h/2),d(N,b,Y,x,h/2)}}var f=!1,k=.2/Yc,m=0,n=!1,p=-10,q=10,r=.1,t=1E3,u=a[0];if(null!==a[1]&&"variable"===a[1].ctype)var A=a[1].name;else a=E.plotvars(u),A="#",-1!==a.indexOf("t")&&(A="t"),-1!==a.indexOf("z")&&(A="z"),-1!==a.indexOf("y")&&(A="y"),-1!==a.indexOf("x")&&(A="x");L.newvar(A);var B=C.drawingstate.matrix;y.handleModifs(b,{color:!0,alpha:!0,size:!0,dashpattern:!0,dashtype:!0,dashing:!0,lineCap:!0,lineJoin:!0,miterLimit:!0,connect:function(a){"boolean"===a.ctype&&(f=
+a.value)},start:function(a){"number"===a.ctype&&(p=a.value.real)},stop:function(a){"number"===a.ctype&&(q=a.value.real)},steps:function(a){"number"===a.ctype&&(t=a.value.real)}});z.strokeStyle=y.lineColor;z.lineWidth=y.lsize;n=!1;b=l.real(14.32);L.setvar(A,b);var D=w(u);if("number"!==D.ctype){if(g.isNumberVector(D).value&&2===D.value.length){n=!1;r=(q-p)/t;for(b=p;b<q;b+=r){L.setvar(A,l.real(b));var F=w(u);if(g.isNumberVector(F).value&&2===F.value.length){var G=+F.value[0].value.real;F=+F.value[1].value.real;
+a=G*B.a-F*B.b+B.tx;G=G*B.c-F*B.d-B.ty;n?z.lineTo(a,G):(z.beginPath(),z.moveTo(a,G),n=!0)}}z.stroke();L.removevar(A)}return h}for(a=p;a<q+r;a+=r)b=l.real(a),L.setvar(A,b),D=w(u),b.value.real>p&&d(G,b,F,D,r),G=b,F=D;L.removevar(A);n&&z.stroke();return h};q.plotX$1=function(a,b){a=a[0];var e=E.plotvars(a);b="#";-1!==e.indexOf("t")&&(b="t");-1!==e.indexOf("z")&&(b="z");-1!==e.indexOf("y")&&(b="y");-1!==e.indexOf("x")&&(b="x");L.newvar(b);e=C.drawingstate.matrix;z.fillStyle=C.drawingstate.linecolor;z.lineWidth=
+1;z.lineCap=y.lineCap;z.lineJoin=y.lineJoin;z.miterLimit=y.miterLimit;for(var c=!1,d=-10;10>d;d+=.01){L.setvar(b,l.real(d));var g=w(a);if("number"===g.ctype){var f=+g.value.real;g=d*e.a-f*e.b+e.tx;f=d*e.c-f*e.d-e.ty;c?z.lineTo(g,f):(z.beginPath(),z.moveTo(g,f),c=!0)}}z.stroke();L.removevar(b);return h};E.plotvars=function(a){function b(a,b){var e={},c;for(c=a.length-1;0<=c;--c)e[a[c]]=a[c];for(c=b.length-1;0<=c;--c)e[b[c]]=b[c];a=[];for(var d in e)e.hasOwnProperty(d)&&a.push(e[d]);return a}function c(a,
+b){for(var e=0;e<a.length;e++)a[e]===b&&(a.splice(e,1),e--);return a}var d;if("variable"===a.ctype)return[a.name];if("infix"===a.ctype){var g=E.plotvars(a.args[0]);a=E.plotvars(a.args[1]);return b(g,a)}if("list"===a.ctype){var f=a.value;var h=[];for(d=0;d<f.length;d++)g=E.plotvars(f[d]),h=b(h,g);return h}if("function"===a.ctype){f=a.args;h=[];for(d=0;d<f.length;d++)g=E.plotvars(f[d]),h=b(h,g);"apply"!==a.oper&&"select"!==a.oper&&"forall"!==a.oper&&"sum"!==a.oper&&"product"!==a.oper&&"repeat"!==a.oper&&
+"min"!==a.oper&&"max"!==a.oper&&"sort"!==a.oper||"variable"!==a.args[1].ctype||(h=c(h,a.args[1].name));return h}return[]};q.clrscr$0=function(a,b){"undefined"!==typeof ma&&"undefined"!==typeof pa&&z.clearRect(0,0,ma,pa);return h};q.repaint$0=function(a,b){k();return h};q.screenbounds$0=function(a,b){a=u.withUsage(g.realVector(C.to(0,0)),"Point");b=u.withUsage(g.realVector(C.to(ra.clientWidth,0)),"Point");var e=u.withUsage(g.realVector(C.to(ra.clientWidth,ra.clientHeight)),"Point"),c=u.withUsage(g.realVector(C.to(0,
+ra.clientHeight)),"Point");return g.turnIntoCSList([a,b,e,c])};q.createimage$3=function(a,b){b=w(a[0]);var e=D(a[1]);a=D(a[2]);if("number"!==e.ctype||"number"!==a.ctype||"string"!==b.ctype)return h;var c=document.createElement("canvas");c.id=b.value;c.width=e.value.real;c.height=a.value.real;c.style.display="none";document.body.appendChild(c);gb[b.value]=G(c,!1);return h};q.clearimage$1=function(a,b){a=w(a[0]);if("string"!==a.ctype&&"image"!==a.ctype)return h;a=Ya(a);if(!a)return h;b=a.img;if("undefined"===
+typeof b||null===b)return h;var e=a.width,c=a.height;b.getContext("2d").clearRect(0,0,e,c);a.generation++;return h};q.canvas$4=function(a,b){var e=D(a[0]),c=D(a[1]);b=w(a[2]);a=a[3];var d=E.extractPoint(e),g=E.extractPoint(c);if(!d.ok||!g.ok||"string"!==b.ctype&&"image"!==b.ctype)return h;b=Ya(b);if(!b||!b.img.getContext)return h;c=b.img;var f=b.width;e=b.height;var k=g.x-d.x,l=g.y-d.y,m=d.x-l*e/f,n=d.y+k*e/f;l=g.x-l*e/f;k=g.y+k*e/f;g=C.from(d.x,d.y,1);m=C.from(m,n,1);l=C.from(l,k,1);d=g[0]*wa;n=
+g[1]*wa;k=m[0]*wa;var p=m[1]*wa,q=l[0]*wa,r=l[1]*wa;m=f*(n-p)/((d-k)*(n-r)-(d-q)*(n-p));f=f*(d-k)/((n-p)*(d-q)-(n-r)*(d-k));l=-m*d-f*n;g=(e*(n-r)-e*(n-p))/((d-k)*(n-r)-(d-q)*(n-p));k=(e*(d-q)-e*(d-k))/((n-p)*(d-q)-(n-r)*(d-k));e=e-g*d-k*n;c=c.getContext("2d");d=z;z=c;z.save();z.transform(m,g,f,k,l,e);b.generation++;w(a);z.restore();z=d};q.canvas$5=function(a,b){var e=D(a[0]),c=D(a[1]),d=D(a[2]);b=w(a[3]);a=a[4];e=E.extractPoint(e);var g=E.extractPoint(c),f=E.extractPoint(d);if(!e.ok||!g.ok||!f.ok||
+"string"!==b.ctype&&"image"!==b.ctype)return h;b=Ya(b);if(!b||!b.img.getContext)return h;d=b.img;var k=b.width;c=b.height;var l=C.from(e.x,e.y,1),m=C.from(g.x,g.y,1);g=C.from(f.x,f.y,1);e=l[0]*wa;f=l[1]*wa;var n=m[0]*wa,p=m[1]*wa,q=g[0]*wa,r=g[1]*wa;g=((0-k)*(f-r)-0*(f-p))/((e-n)*(f-r)-(e-q)*(f-p));k=((0-k)*(e-q)-0*(e-n))/((f-p)*(e-q)-(f-r)*(e-n));m=-(g*e)-k*f;l=((c-c)*(f-r)-(c-0)*(f-p))/((e-n)*(f-r)-(e-q)*(f-p));n=((c-c)*(e-q)-(c-0)*(e-n))/((f-p)*(e-q)-(f-r)*(e-n));c=c-l*e-n*f;d=d.getContext("2d");
+e=z;z=d;z.save();z.transform(g,l,k,n,m,c);b.generation++;w(a);z.restore();z=e};q.screenresolution$0=function(a,b){return l.real(C.drawingstate.matrix.a)};q.layer$1=function(a,b){};q.imagesize$1=function(a,b){return(a=Ya(D(a[0])))?g.realVector([+a.width,+a.height]):h};q.imageready$1=function(a,b){a=Ya(D(a[0]));return u.bool(!(!a||!a.ready))};q.drawimage$2=function(a,b){function e(){var a=1,e=1,c=1,x=1,k=0,v=1,l=E.extractPoint(d);if(!l.ok)return h;f=Ya(f);if(!f)return h;z.save();if(void 0!==b.angle){var m=
+w(b.angle);"number"===m.ctype&&(k=m.value.real)}void 0!==b.rotation&&(m=w(b.rotation),"number"===m.ctype&&(k=m.value.real));void 0!==b.scale&&(m=D(b.scale),"number"===m.ctype&&(e=a=m.value.real),g.isNumberVector(m).value&&2===m.value.length&&(a=m.value[0].value.real,e=m.value[1].value.real));void 0!==b.scalex&&(m=w(b.scalex),"number"===m.ctype&&(a=m.value.real));void 0!==b.scaley&&(m=w(b.scaley),"number"===m.ctype&&(e=m.value.real));void 0!==b.flipx&&(m=w(b.flipx),"boolean"===m.ctype&&m.value&&(c=
+-1));void 0!==b.flipy&&(m=w(b.flipy),"boolean"===m.ctype&&m.value&&(x=-1));void 0!==b.alpha&&(m=w(b.alpha),"number"===m.ctype&&(v=m.value.real));z.imageSmoothingEnabled=!0;void 0!==b.interpolate&&(m=w(b.interpolate),"boolean"===m.ctype&&(z.imageSmoothingEnabled=m.value));var n=C.drawingstate.matrix,N=C.drawingstate.initialmatrix,p=f.width,Y=f.height;m=l.x*n.a-l.y*n.b+n.tx;var q=l.x*n.c-l.y*n.d-n.ty,r=(l.x+1)*n.a-l.y*n.b+n.tx-m;n=(l.x+1)*n.c-l.y*n.d-n.ty-q;var ka=(l.x+1)*N.a-l.y*N.b+N.tx-(l.x*N.a-
+l.y*N.b+N.tx);N=(l.x+1)*N.c-l.y*N.d-N.ty-(l.x*N.c-l.y*N.d-N.ty);l=Math.sqrt(r*r+n*n)/Math.sqrt(ka*ka+N*N);r=-Math.atan2(r,n)+Math.atan2(ka,N);n=C.drawingstate.matrix.sdet/72;a*=n;e*=n;1!==v&&(z.globalAlpha=v);z.translate(m,q);z.scale(a*c*l,e*x*l);z.rotate(k+r);z.translate(-m,-q);z.translate(-p/2,-Y/2);a=f;a.drawTo?a.drawTo(z,m,q):z.drawImage(a.img,m,q);z.globalAlpha=1;z.restore()}function c(){var a=1,e=1,c=1,g=1,x=E.extractPoint(d),v=E.extractPoint(k);if(!x.ok||!v.ok)return h;f=Ya(f);if(!f)return h;
+var m=f.width,n=f.height;if(0===l){var N={};N.x=x.x-(v.y-x.y);N.y=x.y+(v.x-x.x);g=n/m}else if(N=E.extractPoint(l),!x.ok)return h;z.save();if(void 0!==b.alpha){var p=w(b.alpha);"number"===p.ctype&&(a=p.value.real)}void 0!==b.aspect&&(p=w(b.aspect),"number"===p.ctype&&(g=p.value.real));void 0!==b.flipx&&(p=w(b.flipx),"boolean"===p.ctype&&p.value&&(e=-1));void 0!==b.flipy&&(p=w(b.flipy),"boolean"===p.ctype&&p.value&&(c=-1));z.imageSmoothingEnabled=!0;void 0!==b.interpolate&&(p=w(b.interpolate),"boolean"===
+p.ctype&&(z.imageSmoothingEnabled=p.value));p=C.drawingstate.matrix;1!==a&&(z.globalAlpha=a);a=x.x*p.a-x.y*p.b+p.tx;x=x.x*p.c-x.y*p.d-p.ty;z.transform(v.x*p.a-v.y*p.b+p.tx-a,v.x*p.c-v.y*p.d-p.ty-x,N.x*p.a-N.y*p.b+p.tx-a,N.x*p.c-N.y*p.d-p.ty-x,a,x);z.scale(1/m,-1/n*g);z.translate(m/2,-n/2);z.scale(e,c);z.translate(-m/2,n/2);z.translate(0,-n);e=f;e.drawTo?e.drawTo(z,0,0):z.drawImage(e.img,0,0);z.globalAlpha=1;z.restore()}if(2===a.length){var d=D(a[0]);var f=D(a[1]);return e()}if(3===a.length){d=D(a[0]);
+var k=D(a[1]);var l=0;f=D(a[2]);return c()}return 4===a.length?(d=D(a[0]),k=D(a[1]),l=D(a[2]),f=D(a[3]),c()):h};q.drawimage$3=q.drawimage$2;q.drawimage$4=q.drawimage$2;q.allimages$0=function(){var a=[];Object.keys(gb).forEach(function(b){a.push({ctype:"string",value:b})});return g.turnIntoCSList(a)};var yd={};q.cameravideo$0=function(a,b){function e(a){return{video:{width:a,advanced:[{width:{max:a,min:a}},{width:{ideal:a}}]},audio:!1}}a=!0;var c={};void 0!==b.resolution&&(b=w(b.resolution),"string"===
+b.ctype&&"maximal"===b.value?a=!0:"number"===b.ctype?(a=!1,c=e(b.value.real)):g._helper.isNumberVecN(b,2)&&(a=!1,c=e(b.value[0].value.real),b=b.value[1].value.real,10>b||!Number.isInteger(b)?(c.video.aspectRatio=b,c.video.advanced[0].aspectRatio={min:b,max:b},c.video.advanced[1].aspectRatio={ideal:b}):(c.video.height=b,c.video.advanced[0].height={min:b,max:b},c.video.advanced[1].height={ideal:b})));a&&(c=[320,640,1024,1280,1920,2560],c=c.map(function(a){return{width:{min:a}}}),c={video:{width:16E3,
+height:9E3,advanced:c},audio:!1});a=JSON.stringify(c);if(yd[a])return yd[a];b=null;var d=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia;d?b=function(a,b){navigator.mediaDevices.getUserMedia(c).then(a,b)}:(d=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)&&(b=function(a,b){d.call(navigator,c,a,b)});if(!b)return console.warn("getUserMedia call not supported"),yd[a]=h;var f=document.createElement("video");f.autoplay=!0;yd[a]=G(f,
+!0);console.log("Opening stream.");b(function(a){f.srcObject=a;f.setAttribute("autoplay","");f.setAttribute("muted","");f.setAttribute("playsinline","");f.play();f.addEventListener("loadeddata",F)},function(a){console.error("Could not get user video:",String(a),a)});return yd[a]};q.playvideo$1=function(a,b){a=Ya(D(a[0]));a.live&&a.img.play&&a.img.play();return h};q.pausevideo$1=function(a,b){a=Ya(D(a[0]));a.live&&a.img.pause&&a.img.pause();return h};var xd;q.imagergba$3=function(a,b){b=Ya(D(a[0]));
+var e=D(a[1]);a=D(a[2]);if(!b||"number"!==e.ctype||"number"!==a.ctype||!b.ready)return h;e=Math.round(e.value.real);a=Math.round(a.value.real);if(!$a(e)||!$a(a))return h;a=Jb(b,e,a,1,1);return g.realVector([255*a[0],255*a[1],255*a[2],a[3]])};q.imagergb$3=q.imagergba$3;q.imagergba$4=function(a,b){var e=Ya(D(a[2]));if(!e||!e.ready)return h;var c=e.width,d=e.height,f=Q(a[0]),k=Q(a[1]),l=Q(g.realVector([0,d,1]));c=Q(g.realVector([c,d,1]));if(f===h||k===h||m===h)return h;m=g.ii;d=g.jj;l=E.basismap(l,c,
+m,d);f=E.basismap(f,k,d,m);var m=Q(a[3]);d=E.extractPoint(u.mult(l,u.mult(g.adjoint3(f),m)));if(d.ok)if(a=e.width,f=e.height,k=!0,l=!1,void 0!==b.interpolate&&(m=w(b.interpolate),"boolean"===m.ctype&&(k=m.value)),void 0!==b.repeat&&(m=w(b.repeat),"boolean"===m.ctype&&(l=m.value)),k&&(d.x-=.5,d.y-=.5),l&&(d.x=(d.x%a+a)%a,d.y=(d.y%f+f)%f),m=Math.floor(d.x),c=Math.floor(d.y),$a(m)&&$a(c)){b=[0,0,0,0];if(k){k=d.x-m;d=d.y-c;var n=Jb(e,m,c,2,2);if(l){if(m===a-1||c===f-1){l=Jb(e,(m+1)%a,c,1,1);var p=Jb(e,
+m,(c+1)%f,1,1);e=Jb(e,(m+1)%a,(c+1)%f,1,1);n=n.slice(0,4).concat(l,p,e)}}else{if(-1===m||m===a-1)k=Math.round(k);if(-1===c||c===f-1)d=Math.round(d)}for(e=0;4>e;e++)b[e]=(1-d)*((1-k)*n[e]+k*n[e+4])+d*((1-k)*n[e+8]+k*n[e+12])}else b=Jb(e,m,c,1,1);e=g.realVector(b)}else e=h;else e=h;return e};q.imagergb$4=function(a,b){a=q.imagergba$4(a,b);return a===h?h:g.turnIntoCSList(a.value.slice(0,3))};q.readpixels$1=function(a,b){a=Ya(D(a[0]));a=Jb(a,0,0,a.width,a.height);b=[];for(var e=0;e+3<a.length;e+=4)b.push(g.turnIntoCSList([l.real(a[e+
+0]),l.real(a[e+1]),l.real(a[e+2]),l.real(a[e+3])]));return g.turnIntoCSList(b)};"use strict";var Ve=[{key:[":"],field:["."],deg:["\u00b0"],take:["_"]},{functionCall:!0},{rassoc:!0,pow:["^"],sqrt:["\u221a"]},{mul:["*","\u2062","\u22c5","\u00b7"],cross:["\u00d7"],div:["/","\u00f7","\u2215","\u2236"]},{add:["+"],sub:["-","\u2212"],neg:["!","\u00ac"]},{seq:[".."]},{eq:["==","\u225f"],ne:["!=","<>","\u2260"],lt:["<"],gt:[">"],le:["<=","\u2264","\u2266"],ge:[">=","\u2265","\u2267"],aeq:["~=","\u2248"],
+ane:["~!=","\u2249"],alt:["~<","\u2a89"],agt:["~>","\u2a8a"],ale:["~<=","\u2a85"],age:["~>=","\u2a86"],"in":["\u2208"],nin:["\u2209"]},{and:["&","\u2227"],or:["%","\u2228"]},{rassoc:!0,prepend:["<:"]},{concat:["++","\u222a"],remove:["--","\u2216"],common:["~~","\u2229"],append:[":>"]},{rassoc:!0,assign:["="],define:[":="],undefine:[":=_"],bdefine:["::="]},{seq:[";"]},{modif:["->","\u2192"]},{rassoc:!0,list:[","]}],Ue=["+","-"],Qe=["!","\u221a"],Re=["\u00b0",":=_"],Se=[";",","],ue=[],Ua={},Xc;(function(){var a=
+0;Ve.forEach(function(b){a+=2;var e=!!b.rassoc;b.functionCall&&(Xc=a);for(var c in b){var d=b[c];if("boolean"!==typeof d)for(var g={name:c,sym:d[0],symbols:d,rassoc:e,precedence:a,prefix:!1,postfix:!1,infix:!0,bare:!1},f=0;f<d.length;++f){var h=d[f];if(Ua.hasOwnProperty(h))throw Error("Duplicate operator: "+h);Ua[h]=g;ue.push(h)}}});Ue.forEach(function(a){Ua[a].prefix=!0});Qe.forEach(function(a){Ua[a].prefix=!0;Ua[a].infix=!1});Re.forEach(function(a){Ua[a].postfix=!0;Ua[a].infix=!1});Se.forEach(function(a){Ua[a].prefix=
+!0;Ua[a].postfix=!0;Ua[a].infix=!0;Ua[a].bare=!0})})();ue.sort(function(a,b){return b.length-a.length});var Te="(?:[\u207a\u207b] )?[\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079](?: [\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079])*".replace(/ /g,"[ \t]*"),xe="(?:[\u208a\u208b] )?[\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089](?: [\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089])*".replace(/ /g,"[ \t]*"),Ac=function(a,b,c){var e,d=0,g="(?:[",
+f=b.length;for(e=0;e<f;++e){var h=b.charCodeAt(e);55296<=h?(g+="]|"+b.charAt(e)+"[",d=56320):(g+=String.fromCharCode(h=d=a[h-32]+d),d+=a[b.charCodeAt(++e)-32],d!==h&&(d!==h+1&&(g+="-"),g+=String.fromCharCode(d)))}return g+"]|["+c+"][\udc00-\udfff])"}([2,0,106,3,4,1,6,5,7,11,17,8,12,21,9,22,30,10,15,24,25,16,13,42,46,14,18,19,29,37,27,28,35,26,32,36,40,43,47,53,20,48,50,56,33,34,39,51,52,55,63,64,65,68,85,23,31,38,45,49,105,59,66,69,72,88,102,114,117,128,157,191,41,44,54,60,67,70,71,73,74,75,76,80,
+81,82,83,84,86,87,89,93,94,98,99,107,108,116,122,130,132,134,138,160,165,185,195,196,255,268,277,310,332,339,362,365,390,449,457,470,512,513,541,568,582,619,673,726,768,820,921,991,1164,2684,6581,8453,11171,20949],"T4(4I!)!'!&/ 0 \u0096')2$+! !\u0083$ %## !(! ! ; u \u0086.\u0088 =#!+YoA& 87C% } !5%+%) #!*! <0a,!4B1%'!&-'!1!$!33`HsG$!;!+.52'(#%#- & !$#$!*!9% 2%H''%#- & % % %B# !H *+ - & % $$!;!5%3!,(#%#- & % $$!X% 5!:! '$ #$% ! %$%$ $)W!G( / 2$!> &%C( / . $$!L! %5%;( D#!*!* 4'&*$W + !#&]F %6&]% !#% !#!(# & ! !#% # %1!#$ !/#L!S( @?$\u00817-!*''#$!$%+ ',6!:= !&!#7 \u0090 ##& ! ##D ##B ##& ! ##9 K ##^Y2*V#'$\u009d#5 4&p((+, #2*2*2, 5OC!'!Uy.D !&_)0J<#$,E'4Q/1Pv!|8:&K<9%)E>@7 )@\u0080# #$%1gT\u008e#'#=#'#( ! ! ! 0#P & !$ &$##'',& &d!9!*,b!'!#. !$$(! ! ! # 1##&$'!G%\u00a58 8 \u0084(#$%6= !&!#Q+!*/1& & & & & & & &t!\u0097%E$&%'V( z #&D${:Aj2\u0099\u00a6q\u00a9E\u00a4UZ#\u008d$2)%-8*0#_J+#b#M#(S1 # /0O2[R'$! !6>)/A?+8<!*$ .)$ D3 (-/$!$[ !$%#$#! !4 #1+ 6'#'#'1& & 7 .)c0\u00a86/'I\u00a7\u0093#\\N&6$&! . , $ ! % % \u007fM\u0092;R#Gh)d$ \u0085=4(4,a$'#'#'# \ud800!) 4 : % 9#6@\u0082\u0094?$IIX*5 ((=)<#@'(\ud801!f~N.Of\u008f1-)(\ud802!'#! E %$!#/)/10^: %)-)4nQ(%T!5# AZ?$?C( >?G)-):9*\ud803!`KJ9J\ud804#PriL3>@7M$!6F2#/! !C* 3V& ! # 9 .+8N(#%#- & % $$!;!6$\ud805eF-% !\u008987#=F-!k7x4\ud806\u0087RB!\u0095K\ud808!\u00a2\ud809e\u008a\ud80d!8\ud811!\u009c\ud81a!\u009b+0c<;F*#BH&:\ud81b\u00a0U,!l,\ud82c!%\ud82f!\"&,$++.\ud835!w m %#!#%## ) ! & S ##( & > # $ !$& \u0091#3 3 0 3 0 3 0 3 0 3 (\ud83a!\u008b\ud83b\u0098# A % !#! . # ! !(!'! ! ! % !#! ! ! ! ! % !## & # # ! . 5& $ 5\ud869!\u009f7\u008c\ud86d!\u00a1,g\ud86e!<#\u00a3\ud873!\u009e\ud87e!\u009a",
+"\ud80c\ud840-\ud868\ud86a-\ud86c\ud86f-\ud872"),fe=("#(?: [1-9])?|(?:'|"+Ac+")(?: (?:[0-9']|"+Ac+"))*").replace(/ /g,"[ \t]*"),Ke=["([ \t\n\r]+)|(//.*)|(/\\*)","("+("(?:[0-9](?: [0-9])*(?: \\.(?! \\.)(?:(?! "+fe+")|(?= (?: [Ee](?: [+-])?(?: [0-9])+)))(?: [0-9])*)?|\\.(?: [0-9])+)(?: [Ee](?: [+-])?(?: [0-9])+)?").replace(/ /g,"[ \t]*")+")","("+ue.map(jd).join("|")+")","("+"[](){}||".split("").map(jd).join("|")+")","("+xe+")","("+Te+")","("+fe+")",'("[^"]*")|($)'].join("|"),We=new RegExp("[ \t]*".replace(/\*$/,
+"+"),"g"),ye="ANY WS COMMENT START_COMMENT NUM OP BRA SUB SUP ID STR EOF".split(" ");(function(){var a=(new RegExp(Ke,"g")).exec("");if(a.hasOwnProperty(ye.length))throw Error("RE has more groups than expected");if(!a.hasOwnProperty(ye.length-1))throw Error("RE has fewer groups than expected");})();$b.prototype.advanceBy=function(a){this.advanceTo(this.pos+a)};$b.prototype.advanceTo=function(a){for(this.pos=a;this.bols[0]<=a;)this.bol=this.bols.shift(),this.line++};$b.prototype.curPos=function(){return{row:this.line,
+col:this.pos-this.bol,pos:this.pos}};$b.prototype.nextInternal=function(){var a=this.re.exec(this.input);if(a.index!==this.pos)throw xa("Invalid token",this.curPos(),this.input.substring(this.pos,a.index));var b=this.curPos();this.advanceBy(a[0].length);var c=this.curPos(),d;for(d=1;null==a[d];++d);return{start:b,end:c,raw:a[0],text:a[0].replace(We,""),toktype:ye[d]}};$b.prototype.next=function(){do{var a=this.nextInternal();if("START_COMMENT"===a.toktype){var b=/\*\/|\/\*/g;b.lastIndex=a.start.pos+
+2;for(var c=1,d;0<c;)if(d=b.exec(this.input))"/*"===d[0]?++c:--c;else throw xa("Unterminated comment",a.start,a.text);this.re.lastIndex=b.lastIndex;this.advanceTo(b.lastIndex);a.end=this.curPos();a.raw=this.input.substring(a.start.pos,a.end.pos);a.text=a.raw;a.toktype="COMMENT"}}while("WS"===a.toktype||"COMMENT"===a.toktype);return a};var zd={ctype:"void"};sc.prototype.postprocess=function(a){if(null===a)return zd;if(a){if("infix"===a.ctype)if(":="===a.oper){var b=a.args[0];if("function"===b.ctype)b.args.forEach(function(b){if(null===
+b||"variable"!==b.ctype)throw xa("Function argument must be an identifier",b.start||a.start);});else if("variable"!==b.ctype)throw xa(a.oper+" can only be used to define functions or variables",a.start);}else if(","===a.oper)throw xa("comma may only be used to delimit list elements",a.start);a.args&&(a.args=a.args.map(this.postprocess,this));if(a.modifs)for(var c in a.modifs)a.modifs[c]=this.postprocess(a.modifs[c]);if("paren"===a.ctype)return a.args[0];if("infix"===a.ctype){if("."===a.oper){if(!a.args[1]||
+"variable"!==a.args[1].ctype)throw xa("Field name must be identifier",a.start,a.text);a.ctype="field";a.obj=a.args[0];a.key=a.args[1].name;delete a.args}if(":"===a.oper){if(a.jsonatom){if(!a.args[1])throw xa("JSON: Value undefined",a.start,a.text);a.ctype="jsonatom";a.key=a.args[0];a.value=a.args[1];delete a.jsonatom}else{if(!a.args[1])throw xa("UserData: Key undefined",a.start,a.text);a.ctype="userdata";a.obj=a.args[0];a.key=a.args[1]}delete a.args}this.infixmap&&(a.impl=this.infixmap[a.oper])}else"variable"===
+a.ctype?this.usedVariables[a.name]=!0:"function"===a.ctype&&(this.usedFunctions[a.oper]=!0)}if("infix"===a.ctype)return{ctype:"infix",oper:String(a.oper),args:[a.args[0],a.args[1]],impl:a.impl};if("variable"===a.ctype)return{ctype:"variable",name:String(a.name)};if("number"===a.ctype)return{ctype:"number",value:{real:+a.value.real,imag:+a.value.imag}};if("string"===a.ctype)return{ctype:"string",value:String(a.value)};if("list"===a.ctype)return{ctype:"list",value:a.value};if("function"===a.ctype)return{ctype:"function",
+oper:String(a.oper),args:a.args,modifs:a.modifs};if("field"===a.ctype)return{ctype:"field",obj:a.obj,key:String(a.key)};if("userdata"===a.ctype)return{ctype:"userdata",obj:a.obj,key:a.key};if("jsonatom"===a.ctype)return{ctype:"jsonatom",key:a.key,value:a.value};throw Error("Unsupported AST node of type "+a.ctype);};sc.prototype.parse=function(a){try{var b=ld(new $b(a));if("EOF"!==b.closedBy.toktype)throw xa("Closing bracket never opened.",b.closedBy.start,b.closedBy.text);return this.postprocess(b.expr)}catch(x){return x.ctype=
+"error",x}};"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===typeof window&&(module.exports.Parser=sc,module.exports.Tokenizer=$b,module.exports.unicodeLetters=Ac,module.exports.parse=function(a){return(new sc).parse(a)});var Sb={},Ed=[],M={lines:{},audioCtx:null,getAudioContext:function(){if(this.audioCtx)return this.audioCtx;window.AudioContext||window.webkitAudioContext?this.audioCtx=new (window.AudioContext||window.webkitAudioContext):
+console.warn("Web Audio API not supported in this browser");return this.audioCtx},handleModif:function(a,b,c){if(void 0!==a){if(a=w(a),a.ctype===b){if("number"===a.ctype)return a.value.real;if("list"===a.ctype){b=a.value;a=[];for(c=0;c<b.length;c++)a[c]=b[c].value.real;return a}return a.value}}else return c},handleLineModif:function(a,b){return void 0!==a?(a=w(a),da(a)):b},getBufferNode:function(a,b){var e=this.getAudioContext();if(b*e.sampleRate>a.length){for(var c=[],d=0,g=0;d<e.sampleRate*b;d++,
+g++)g>a.length&&(g=0),c[d]=a[g];a=c}b=new Float32Array(a);a=e.createBuffer(1,b.length,e.sampleRate);a.copyToChannel(b,0);e=e.createBufferSource();e.buffer=a;return e},createMonoOscillator:function(a,b){var e=this.getAudioContext().createOscillator();if(0!==b){var c=new Float32Array(2),d=new Float32Array(2);c[1]=Math.sin(b);d[1]=Math.cos(b);b=this.getAudioContext().createPeriodicWave(c,d,{disableNormalization:!0});e.setPeriodicWave(b)}else e.type="sine";e.mono=!0;e.frequency.value=a;return e},createWaveOscillator:function(a,
+b,c){for(var e=this.getAudioContext().createOscillator(),d=new Float32Array(b.length+1),g=new Float32Array(b.length+1),f=0;f<b.length;f++)g[f+1]=b[f]*Math.cos(c[f]),d[f+1]=b[f]*Math.sin(c[f]);b=this.getAudioContext().createPeriodicWave(d,g,{disableNormalization:!0});e.setPeriodicWave(b);e.frequency.value=a;return e},cleanup:function(){for(var a in this.lines)if("sin"===this.lines[a].lineType)if(this.lines[a].oscNodes.every(function(a){return!a.oscNode.isplaying}))delete this.lines[a];else for(var b=
+0;b<this.lines[a].oscNodes.length;b++)this.lines[a].oscNodes[b]&&!this.lines[a].oscNodes[b].oscNode.isplaying&&delete this.lines[a].oscNodes[b]},registerInput:function(a){a.cnt?a.cnt++:a.cnt=1},deregisterInput:function(a){a.cnt&&a.cnt--},hasRegisteredInput:function(a){return a.cnt&&0!==a.cnt},playOscillator:function(a,b,c,d,g,f){var e=this.getAudioContext(),h=e.createGain();h.gain.value=0;a.connect(h);h.connect(b);M.registerInput(b);a.start(0);a.isplaying=!0;a.onended=function(){this.isplaying=!1;
+h.disconnect();M.deregisterInput(b);M.hasRegisteredInput(b)||(b.disconnect(),b.panNode&&b.panNode.disconnect());M.cleanup()};h.gain.linearRampToValueAtTime(c,e.currentTime+d);0<=g&&(h.gain.setValueAtTime(c,e.currentTime+d+g),h.gain.linearRampToValueAtTime(0,e.currentTime+d+g+f),this.triggerStop(a,g+d+f));return{oscNode:a,gainNode:h}},softStop:function(a,b){var e=this.getAudioContext();a.gainNode.gain.cancelScheduledValues(e.currentTime);a.gainNode.gain.setValueAtTime(a.gainNode.gain.value,e.currentTime);
+a.gainNode.gain.linearRampToValueAtTime(0,e.currentTime+b);this.triggerStop(a.oscNode,b)},extendDuration:function(a,b,c){var e=this.getAudioContext();a.gainNode.gain.cancelScheduledValues(e.currentTime);a.gainNode.gain.setValueAtTime(a.gainNode.gain.value,e.currentTime);a.gainNode.gain.setValueAtTime(a.gainNode.gain.value,e.currentTime+b);a.gainNode.gain.linearRampToValueAtTime(0,e.currentTime+b+c);this.triggerStop(a.oscNode,b+c)},triggerStop:function(a,b){a.timeoutId&&clearTimeout(a.timeoutId);a.timeoutId=
+setTimeout(function(){a.stop(0)},1E3*b+10)}},tb=function(a){this.audioCtx=a;this.lineType="sin";this.oscNodes=[]};tb.prototype.handleModif=function(a,b,c,d){if("phaseshift"===b)d=this.handlePhaseshiftModif(a.phaseshift,this.harmonics.length);else if(void 0!==a[b]&&(a=w(a[b]),a.ctype===c))if("number"===a.ctype)d=a.value.real;else if("list"===a.ctype){c=a.value;a=[];for(d=0;d<c.length;d++)a[d]=c[d].value.real;d=a}else d=a.value;return this[b]=d};tb.prototype.handlePhaseshiftModif=function(a,b){this.phaseshift=
+Array(b).fill(0);if(void 0!==a)if(a=w(a),"list"===a.ctype)for(b=a.value,a=0;a<b.length;a++)this.phaseshift[a]=b[a].value.real;else if("number"===a.ctype)for(var e=0;e<b;e++)this.phaseshift[e]=(e+1)*a.value.real;return this.phaseshift};tb.prototype.cleanparameters=function(a){this.partials.length<this.harmonics.length&&(this.partials=Array(this.harmonics.length).fill(1),a.partials&&console.warn("Ignore partials because the given length does not match with the length of harmonics"));this.phaseshift.length<
+this.harmonics.length&&(this.phaseshift=Array(this.harmonics.length).fill(0),a.phaseshift&&console.warn("Ignore phaseshift because the given length does not match with the length of harmonics"));this.precompute&=this.partials.every(function(a){return 1E-8>Math.abs(a-1)});0<this.damp&&(this.duration=Math.min(this.duration,6/this.damp))};tb.prototype.panit=function(){0===this.pan||this.masterGain.panNode||(this.masterGain.disconnect(this.audioCtx.destination),this.masterGain.panNode=this.audioCtx.createStereoPanner(),
+this.masterGain.connect(this.masterGain.panNode),this.masterGain.panNode.connect(this.audioCtx.destination));this.masterGain.panNode&&(this.masterGain.panNode.pan.value=this.pan)};tb.prototype.dampit=function(){this.masterGain.gain.cancelScheduledValues(this.audioCtx.currentTime);this.masterGain.gain.setValueAtTime(this.masterGain.gain.value,this.audioCtx.currentTime);0<this.damp?this.masterGain.gain.setTargetAtTime(0,this.audioCtx.currentTime+this.attack,1/this.damp):0>this.damp&&this.masterGain.gain.setTargetAtTime(1,
+this.audioCtx.currentTime+this.attack,-this.damp)};tb.prototype.startOscillators=function(){if(this.precompute)this.oscNodes[0]=M.playOscillator(M.createWaveOscillator(this.freq,this.harmonics,this.phaseshift),this.masterGain,1,this.attack,this.duration,this.release);else for(var a=0;a<this.harmonics.length;a++)this.oscNodes[a]=M.playOscillator(M.createMonoOscillator(this.partials[a]*(a+1)*this.freq,this.phaseshift[a]),this.masterGain,this.harmonics[a],this.attack,this.duration,this.release)};tb.prototype.stopOscillators=
+function(){for(var a in this.oscNodes)M.softStop(this.oscNodes[a],this.release),delete this.oscNodes[a]};tb.prototype.stop=function(){this.stopOscillators()};tb.prototype.updateFrequencyAndGain=function(){if(this.precompute)this.harmonicsdidnotchange()&&this.oscNodes[0]&&this.oscNodes[0].oscNode.isplaying&&!this.oscNodes[0].oscNode.mono?(this.oscNodes[0].oscNode.frequency.value=this.freq,M.extendDuration(this.oscNodes[0],this.duration,this.release)):(this.stopOscillators(),this.startOscillators());
+else{for(var a=0;a<this.harmonics.length;a++)0<this.harmonics[a]&&(this.oscNodes[a]&&this.oscNodes[a].oscNode.isplaying&&this.oscNodes[a].oscNode.mono?(this.oscNodes[a].oscNode.frequency.value=this.partials[a]*(a+1)*this.freq,this.oscNodes[a].gainNode.gain.value=this.harmonics[a],M.extendDuration(this.oscNodes[a],this.duration,this.release)):(this.oscNodes[a]&&this.oscNodes[a].oscNode.isplaying&&!this.oscNodes[a].oscNode.mono&&M.softStop(this.oscNodes[a],this.release),this.oscNodes[a]=M.playOscillator(M.createMonoOscillator(this.partials[a]*
+(a+1)*this.freq,this.phaseshift[a]),this.masterGain,this.harmonics[a],this.attack,this.duration,this.release)));for(var b in this.oscNodes)this.harmonics[b]||(M.softStop(this.oscNodes[b],this.release),delete this.oscNodes[b])}};tb.prototype.generateNewMasterGain=function(a){this.masterGain=this.audioCtx.createGain();this.masterGain.connect(this.audioCtx.destination);this.masterGain.gain.value=a};tb.prototype.harmonicsdidnotchange=function(){if(this.lastharmonics){var a=1&this.lastharmonics.length===
+this.harmonics.length;for(var b in this.harmonics)a&&(a&=this.harmonics[b]===this.lastharmonics[b])}else a=!1;return a};tb.prototype.evokeplaysin=function(a,b,c){this.cleanparameters(c);if(0===this.duration)return this.stop(),h;a||b&&0!==this.damp?(b&&!a&&this.stopOscillators(),this.generateNewMasterGain(this.amp),this.startOscillators()):(this.masterGain||this.generateNewMasterGain(this.amp),this.updateFrequencyAndGain());this.panit();this.dampit();this.lastharmonics=this.harmonics};q.stopsound$0=
+function(){if(M.audioCtx){for(var a in M.lines)M.lines[a].stop(),delete M.lines[a];M.audioCtx.close();M.audioCtx=null}};q.playsin$1=function(a,b){var e=M.getAudioContext(),c=M.handleLineModif(b.line,"0"),d=!1;M.lines[c]&&"sin"===M.lines[c].lineType||(M.lines[c]&&M.lines[c].stop(),M.lines[c]=new tb(e),d=!0);e=M.lines[c];e.freq=w(a[0]).value.real;e.handleModif(b,"amp","number",.5);e.handleModif(b,"damp","number",0);e.handleModif(b,"duration","number",M.handleModif(b.stop,"number",1));e.handleModif(b,
+"harmonics","list",[1]);e.handleModif(b,"partials","list",[1]);e.handleModif(b,"attack","number",.01);e.handleModif(b,"release","number",.01);e.handleModif(b,"pan","number",0);e.handleModif(b,"precompute","boolean",!1);e.handleModif(b,"phaseshift","phaseshift",Array(e.harmonics.length).fill(0));a=M.handleModif(b.restart,"boolean",!0);e.evokeplaysin(d,a,b);return h};q.playsin$0=function(a,b){if(void 0!==b.line&&(a=M.handleLineModif(b.line,"0"),a=M.lines[a])){a.handleModif(b,"freq","number",a.freq);
+a.handleModif(b,"amp","number",a.amp);a.handleModif(b,"damp","number",a.damp);a.handleModif(b,"duration","number",M.handleModif(b.stop,"number",a.duration));a.handleModif(b,"harmonics","list",a.harmonics);a.handleModif(b,"partials","list",a.partials);a.handleModif(b,"attack","number",a.attack);a.handleModif(b,"release","number",a.release);a.handleModif(b,"pan","number",a.pan);a.handleModif(b,"precompute","boolean",a.precompute);a.handleModif(b,"phaseshift","phaseshift",a.phaseshift);var e=M.handleModif(b.restart,
+"boolean",!1);a.evokeplaysin(!1,e,b)}return h};q.playfunction$1=function(a,b){var e=M.getAudioContext(),c=a[0];a=function(a){var b=[];for(b.push(a);0!==b.length;){a=b.pop();if("variable"===a.ctype&&w(a)===h&&-1!==["x","y","t"].indexOf(a.name))return a.name;if(a.args)for(var e in a.args)b.push(a.args[e])}return h}(c);a!==h&&L.newvar(a);var d=M.handleLineModif(b.line,"0"),g=M.handleModif(b.start,"number",0),f=M.handleModif(b.amp,"number",.5),k=M.handleModif(b.damp,"number",0);M.handleModif(b.stop,"number",
+1);var m=M.handleModif(b.duration,"number",1),n=M.handleModif(b.attack,"number",.01),p=M.handleModif(b.release,"number",.01),q=M.handleModif(b.export,"boolean",!1),r=M.handleModif(b.silent,"boolean",!1);b=[];for(var t=0;t<e.sampleRate*m;t++){a!==h&&L.setvar(a,l.real(t/e.sampleRate));var u=w(c);b[t]=u.value.real*f*Math.exp(-k*t/e.sampleRate)}r||(M.lines[d]&&"function"===M.lines[d].lineType?(c=M.lines[d],c.masterGain.gain.linearRampToValueAtTime(0,e.currentTime+p),c.bufferNode.stop(e.currentTime+p),
+c.bufferNode=M.getBufferNode(b,m),c.bufferNode.connect(c.masterGain),c.bufferNode.start(g+p),c.masterGain.gain.linearRampToValueAtTime(f,e.currentTime+p+n)):(M.lines[d]&&M.lines[d].stop(),M.lines[d]={lineType:"function",bufferNode:M.getBufferNode(b,m),masterGain:e.createGain(),stop:function(){this.bufferNode.stop()}},m=M.lines[d],m.masterGain.gain.value=0,m.masterGain.connect(e.destination),m.bufferNode.connect(m.masterGain),m.bufferNode.start(g),m.masterGain.gain.linearRampToValueAtTime(f,e.currentTime+
+n)));a!==h&&L.removevar(a);return q?b:h};q.playwave$1=function(a,b){var e=M.getAudioContext(),c=w(a[0]),d=M.handleLineModif(b.line,"0");a=M.handleModif(b.amp,"number",.5);M.handleModif(b.damp,"number",0);var g=M.handleModif(b.duration,"number",1),f=M.handleModif(b.attack,"number",.01),k=M.handleModif(b.release,"number",.01);b=M.handleModif(b.start,"number",0);if("list"!==c.ctype)return h;M.lines[d]&&"wave"===M.lines[d].lineType?(d=M.lines[d],d.masterGain.gain.linearRampToValueAtTime(0,e.currentTime+
+k),d.bufferNode.stop(e.currentTime+k),d.bufferNode=M.getBufferNode(u.unwrap(c),g),d.bufferNode.connect(d.masterGain),d.bufferNode.start(b+k),d.masterGain.gain.linearRampToValueAtTime(a,e.currentTime+k+f)):(M.lines[d]&&M.lines[d].stop(),M.lines[d]={lineType:"wave",bufferNode:M.getBufferNode(u.unwrap(c),g),masterGain:e.createGain(),stop:function(){this.bufferNode.stop()}},c=M.lines[d],c.masterGain.gain.value=0,c.masterGain.connect(e.destination),c.bufferNode.connect(c.masterGain),c.bufferNode.start(0),
+c.masterGain.gain.linearRampToValueAtTime(a,e.currentTime+f));return h};var aa={printArr:function(a){for(var b=a.value.length,c=[],d=[],g=!1,f=0;f<b;f++)c[f]=a.value[f].value.real,d[f]=a.value[f].value.imag,0!==d[f]&&(g=!0);console.log(c);g&&console.log(d)},zero:function(a){for(var b=[],c=l.real(0),d=0;d<a.value.real;d++)b[d]=c;return g.turnIntoCSList(b)},number:function(a,b){b=aa.zero(b);b.value[0]=a;return b},variable:function(a,b){b=aa.zero(b);b.value[0]=a;b.value[1]=l.real(1);return b},add:function(a,
+b){return g.add(a,b)},sub:function(a,b){return g.sub(a,b)},mult:function(a,b){if(a.value.length!==b.value.length)return console.error("dims don't fit return nada"),h;for(var e=a.value.length,c=aa.zero(l.real(e)),d=l.real(0),g=0;g<e;g++){for(var f=0;f<=g;f++)d=l.add(d,l.mult(a.value[f],b.value[g-f]));c.value[g]=d;d=l.real(0)}return c},pow:function(a,b){if(0>b.value.real||b.value.real!==Math.floor(b.value.real))return aa.root(a,b);for(var e=a,c=1;c<b.value.real;c++)e=aa.mult(e,a);return e},root:function(a,
+b){var e=l.real(0),c=l.real(1),d=l.add(c,b),g=a.value.length,f=aa.zero(l.real(g));f.value[0]=l.pow(a.value[0],b);var h=e;for(b=1;b<g;b++){var k=l.real(b);for(var m=1;m<=b;m++){var n=l.mult(d,l.real(m));n=l.div(n,k);n=l.sub(n,c);n=l.mult(n,a.value[m]);n=l.mult(n,f.value[b-m]);h=l.add(h,n)}h=l.div(h,a.value[0]);f.value[b]=h;h=e}return f},findFirstNoneZero:function(a,b,c){for(var e=Infinity,d=Infinity,g=c;g<a.value.length;g++)if(1E-12<l.abs2(a.value[g]).value.real){e=g;break}for(a=c;a<b.value.length;a++)if(1E-12<
+l.abs2(b.value[a]).value.real){d=a;break}return[e,d]},div:function(a,b){if(a.value.length!==b.value.length)return console.log("dims don't fit - return nada"),h;for(var e=a.value.length,c=l.real(0),d=aa.zero(l.real(e)),g=c,f,k=0;k<e;k++){f=aa.findFirstNoneZero(a,b,k);k<f[0]&&f[0]===f[1]&&Infinity!==f[0]&&(a.value.splice(k,f[0]),b.value.splice(k,f[0]),d.value.splice(k,f[0]),e-=f[0]);f=a.value[k];for(var m=0;m<k;m++)g=l.add(g,l.mult(d.value[m],b.value[k-m]));f=l.sub(f,g);f=l.div(f,b.value[0]);d.value[k]=
+f;g=c}return d},exp:function(a){var b=l.real(0),c=a.value.length,d=aa.zero(l.real(c)),g=b;d.value[0]=l.exp(a.value[0]);for(var f=1;f<c;f++){for(var h=1;h<=f;h++){var k=l.mult(l.real(h),a.value[h]);k=l.mult(k,d.value[f-h]);g=l.add(g,k)}d.value[f]=l.div(g,l.real(f));g=b}return d},log:function(a){var b=l.real(0),c=a.value.length,d=aa.zero(l.real(c));d.value[0]=l.log(a.value[0]);for(var g=b,f,h,k=1;k<c;k++){f=a.value[k];for(var m=1;m<k;m++)h=l.mult(l.real(m),d.value[m]),h=l.mult(h,a.value[k-m]),g=l.add(g,
+h);g=l.div(g,l.real(k));f=l.sub(f,g);f=l.div(f,a.value[0]);d.value[k]=f;g=b}return d},sincos:function(a){var b=l.real(0),c=a.value.length,d=aa.zero(l.real(c)),g=aa.zero(l.real(c));d.value[0]=l.sin(a.value[0]);g.value[0]=l.cos(a.value[0]);for(var f=b,h=b,k,m,n,p=1;p<c;p++){n=l.real(p);for(var q=1;q<=p;q++)m=l.mult(l.real(q),a.value[q]),k=l.mult(m,g.value[p-q]),m=l.mult(m,d.value[p-q]),h=l.add(h,k),f=l.add(f,m);h=l.div(h,n);f=l.div(f,l.neg(n));d.value[p]=h;g.value[p]=f;f=h=b}aa.sinsave=d;aa.cossave=
+g;return[d,g]},sin:function(a){return aa.sincos(a)[0]},cos:function(a){return aa.sincos(a)[1]},faculty:function(a){var b=[];b[0]=l.real(1);for(var c=1,d=1;d<=a.value.real;d++)c*=d,b[d]=l.real(c);return b=g.turnIntoCSList(b)},diff:function(a,b,c,d){if("variable"===a.ctype)var e=a.name!==b?aa.number(w(a),d):aa.variable(c,d);else if("number"===a.ctype)e=aa.number(a,d);else{if("infix"===a.ctype){if("*"===a.oper)return aa.mult(aa.diff(a.args[0],b,c,d),aa.diff(a.args[1],b,c,d));if("^"===a.oper)return aa.pow(aa.diff(a.args[0],
+b,c,d),aa.diff(a.args[1],b,c,d).value[0]);if("/"===a.oper)return aa.div(aa.diff(a.args[0],b,c,d),aa.diff(a.args[1],b,c,d));if("+"===a.oper)return aa.add(aa.diff(a.args[0],b,c,d),aa.diff(a.args[1],b,c,d));if("-"===a.oper)return aa.sub(aa.diff(a.args[0],b,c,d),aa.diff(a.args[1],b,c,d));console.log("infix not found",a.oper);return h}if("function"===a.ctype){if("exp$1"===a.oper)return aa.exp(aa.diff(a.args[0],b,c,d));if("log$1"===a.oper)return aa.log(aa.diff(a.args[0],b,c,d));if("sin$1"===a.oper)return aa.sin(aa.diff(a.args[0],
+b,c,d));if("cos$1"===a.oper)return aa.cos(aa.diff(a.args[0],b,c,d))}else return console.log("ctype not found",a.ctype),h}return e},adevaluate:function(a,b,c,d){a=aa.diff(a,b,c,d);d=aa.faculty(d);for(b=2;b<a.value.length;b++)a.value[b]=l.mult(a.value[b],d.value[b]);return a},autodiff:function(a,b,c,d){for(var e=[],f=c.value.length,h,k=0;k<f;k++)h=aa.adevaluate(a,b,c.value[k],d),e[k]=h;return e=g.turnIntoCSList(e)}},y={handleModifs:function(a,b){y.dashing&&y.unSetDash();y.colorraw=null;y.fillcolorraw=
+null;y.fillrule="nonzero";y.size=null;0>=y.psize&&(y.psize=0);0>=y.lsize&&(y.lsize=0);y.overhang=1;y.dashing=!1;y.isArrow=!1;y.arrowSides="==>";y.arrowposition=1;y.headlen=10;y.arrowShape=y.arrowShapes.line;y.alpha=C.drawingstate.alpha;y.fillalpha=0;y.bold="";y.italics="";y.family="sans-serif";y.align=0;y.angle=0;y.xOffset=0;y.yOffset=0;y.lineCap="round";y.lineJoin="round";y.miterLimit=10;y.noborder=!1;var e,c;for(e in a){var d=a[e];d&&((c=b[e])?(!0===c&&(c=y.modifHandlers[e]),c(w(d))):console.log("Modifier not supported: "+
+e))}null!==y.size?y.psize=y.lsize=y.size:(y.psize=C.drawingstate.pointsize,y.lsize=C.drawingstate.linesize);y.dashing&&y.dashing(y.lsize);null!==y.colorraw?y.pointColor=y.lineColor=y.textColor=y.makeColor(y.colorraw):1===y.alpha?(y.pointColor=C.drawingstate.pointcolor,y.lineColor=C.drawingstate.linecolor,y.textColor=C.drawingstate.textcolor):(y.pointColor=y.makeColor(C.drawingstate.pointcolorraw),y.lineColor=y.makeColor(C.drawingstate.linecolorraw),y.textColor=y.makeColor(C.drawingstate.textcolorraw));
+y.black=1===y.alpha?"rgb(0,0,0)":"rgba(0,0,0,"+y.alpha+")";y.fillColor=y.fillcolorraw&&0<y.fillalpha?y.makeColor(y.fillcolorraw,y.fillalpha):null},modifHandlers:{size:function(a){"number"===a.ctype&&(y.size=a.value.real,0>y.size&&(y.size=0),1E3<y.size&&(y.size=1E3))},color:function(a){g.isNumberVector(a).value&&3===a.value.length&&(y.colorraw=[a.value[0].value.real,a.value[1].value.real,a.value[2].value.real])},fillcolor:function(a){g.isNumberVector(a).value&&3===a.value.length&&(y.fillcolorraw=[a.value[0].value.real,
+a.value[1].value.real,a.value[2].value.real])},alpha:function(a){"number"===a.ctype&&(y.alpha=a.value.real)},fillalpha:function(a){"number"===a.ctype&&(y.fillalpha=a.value.real)},dashpattern:function(a){if("list"===a.ctype){for(var b=[],c=0,d=0;c<a.value.length;c++)"number"===a.value[c].ctype&&(b[d++]=a.value[c].value.real);y.dashing=y.setDash.bind(null,b)}},dashtype:function(a){if("number"===a.ctype)a=Math.floor(a.value.real);else if("string"===a.ctype)a=a.value;else return;if(a=y.dashTypes[a])y.dashing=
+y.setDash.bind(null,a)},dashing:function(a){"number"===a.ctype&&(a=Math.floor(a.value.real),y.dashing=y.setDash.bind(null,[2*a,a]))},overhang:function(a){"number"===a.ctype&&(y.overhang=y.overhang*a.value.real+(1-y.overhang)*(1-a.value.real))},arrow:function(a){"boolean"===a.ctype?y.isArrow=a.value:console.error("arrow needs to be of type boolean")},arrowshape:function(a){"string"!==a.ctype?console.error("arrowshape needs to be of type string"):y.arrowShapes.hasOwnProperty(a.value)?(y.arrowShape=
+y.arrowShapes[a.value],y.isArrow=!0,y.arrowShape.deprecated&&(console.log("arrowshape "+a.value+" is deprecated, use "+y.arrowShape.deprecated+" instead."),y.arrowShape.deprecated=null)):(a=Object.keys(y.arrowShapes),a.sort(),a=a.join(", "),console.error("arrowshape needs to be one of "+a))},arrowsides:function(a){"string"!==a.ctype?console.error("arrowsides is not of type string"):"==>"!==a.value&&"<==>"!==a.value&&"<=="!==a.value?console.error("arrowsides is unknows"):(y.arrowSides=a.value,y.isArrow=
+!0)},arrowposition:function(a){"number"!==a.ctype?console.error("arrowposition is not of type number"):0>a.value.real?console.error("arrowposition has to be positive"):1<a.value.real?y.overhang=y.overhang*a.value.real+(1-y.overhang)*(1-a.value.real):(y.arrowposition=a.value.real,y.isArrow=!0)},arrowsize:function(a){"number"!==a.ctype?console.error("arrowsize is not of type number"):0>a.value.real?console.error("arrowsize has to be positive"):y.headlen*=a.value.real},bold:function(a){"boolean"===a.ctype&&
+a.value&&(y.bold="bold ")},italics:function(a){"boolean"===a.ctype&&a.value&&(y.italics="italic ")},family:function(a){"string"===a.ctype&&(y.family=a.value)},align:function(a){"string"===a.ctype&&(a=a.value,"left"===a&&(y.align=0),"right"===a&&(y.align=1),"mid"===a||"center"===a)&&(y.align=.5)},angle:function(a){"number"===a.ctype&&(y.angle=a.value.real)},x_offset:function(a){"number"===a.ctype&&(y.xOffset=a.value.real)},y_offset:function(a){"number"===a.ctype&&(y.yOffset=a.value.real)},offset:function(a){"list"===
+a.ctype&&2===a.value.length&&"number"===a.value[0].ctype&&"number"===a.value[1].ctype&&(y.xOffset=a.value[0].value.real,y.yOffset=a.value[1].value.real)},lineCap:function(a){"string"!==a.ctype||"round"!==a.value&&"square"!==a.value&&"butt"!==a.value||(y.lineCap=a.value)},lineJoin:function(a){"string"!==a.ctype||"round"!==a.value&&"bevel"!==a.value&&"miter"!==a.value||(y.lineJoin=a.value)},fillrule:function(a){"string"!==a.ctype||"nonzero"!==a.value&&"evenodd"!==a.value||(y.fillrule=a.value)},miterLimit:function(a){"number"===
+a.ctype&&0<a.value.real&&(y.miterLimit=Math.round(a.value.real))},noborder:function(a){"boolean"===a.ctype?y.noborder=a.value:console.error("noborder needs to be of type boolean")},border:function(a){"boolean"===a.ctype?y.noborder=!a.value:console.error("border needs to be of type boolean")}},lineModifs:{size:!0,color:!0,alpha:!0,dashpattern:!0,dashtype:!0,dashing:!0,overhang:!0,arrow:!0,arrowshape:!0,arrowsides:!0,arrowposition:!0,arrowsize:!0,lineCap:!0,lineJoin:!0,miterLimit:!0},pointModifs:{size:!0,
+color:!0,alpha:!0,noborder:!0,border:!0}};y.pointAndLineModifs=y.lineModifs;y.conicModifs={size:!0,color:!0,alpha:!0,dashing:!0,dashpattern:!0,dashtype:!0,fillcolor:!0,fillrule:!0,fillalpha:!0,lineCap:!0,lineJoin:!0,miterLimit:!0};y.textModifs={size:!0,color:!0,alpha:!0,bold:!0,italics:!0,family:!0,align:!0,angle:!0,x_offset:!0,y_offset:!0,offset:!0};y.makeColor=function(a,b){void 0===b&&(b=y.alpha);return"rgba("+Math.floor(255*a[0])+","+Math.floor(255*a[1])+","+Math.floor(255*a[2])+","+b+")"};y.preDrawCurve=
+function(){z.lineWidth=y.lsize;z.lineCap=y.lineCap;z.lineJoin=y.lineJoin;z.mozFillRule=y.fillrule;z.fillrule=y.fillrule;z.miterLimit=y.miterLimit;z.strokeStyle=y.lineColor};y.arrowShapes={"default":{close:!1,fill:!1,ratio:1,deprecated:"line"},line:{close:!1,fill:!1,ratio:1},empty:{close:!0,fill:!1,ratio:1},hollow:{close:!0,fill:!1,ratio:1,deprecated:"empty"},full:{close:!0,fill:!0,ratio:1},jet:{close:!0,fill:!0,ratio:1.5},delta:{close:!0,fill:!0,ratio:1.5,deprecated:"jet"}};y.clipSegment=function(a,
+b){var e=b.x-a.x,c=b.y-a.y,d=y.clipLineCore(-c,e,a.x*b.y-b.x*a.y);if(2!==d.length)return[];var g=d[0];d=d[1];var f=1/(e*e+c*c),h=((g.x-a.x)*e+(g.y-a.y)*c)*f;e=((d.x-a.x)*e+(d.y-a.y)*c)*f;0>h&&(g=a);1<h&&(g=b);0>e&&(d=a);1<e&&(d=b);return g===d?[]:[g,d]};y.drawsegcore=function(a,b){function e(a,b,e,c){var d=a-c*m+.5*n,g=b-c*n-.5*m,f=a-c*m-.5*n;c=b-c*n+.5*m;z.beginPath();y.arrowShape.fill&&(z.lineWidth=y.lsize/2);z.moveTo(d,g);z.lineTo(a,b);z.lineTo(f,c);y.arrowShape.close&&(z.fillStyle=y.lineColor,
+z.lineTo(a-e*m,b-e*n),z.closePath(),y.arrowShape.fill&&z.fill());z.stroke()}var c=C.drawingstate.matrix,d=a.x*c.a-a.y*c.b+c.tx,g=a.x*c.c-a.y*c.d-c.ty,f=b.x*c.a-b.y*c.b+c.tx,h=b.x*c.c-b.y*c.d-c.ty,k=y.overhang,l=1-k;b=k*d+l*f;c=k*g+l*h;a=k*f+l*d;k=k*h+l*g;if(0>b||b>ma||0>c||c>pa||0>a||a>ma||0>k||k>pa){k=y.clipSegment({x:b,y:c},{x:a,y:k});if(2!==k.length||.01>y.lsize)return;b=k[0].x;c=k[0].y;a=k[1].x;k=k[1].y}y.preDrawCurve();if(!y.isArrow||d===g&&f===h).01>y.lsize||(z.beginPath(),z.moveTo(b,c),z.lineTo(a,
+k),z.stroke());else{d=f-d;g=h-g;f=y.headlen/Math.sqrt(d*d+g*g);var m=d*f,n=g*f;h=y.arrowposition;l=1-h;d=h*b+l*a;g=h*c+l*k;f=h*a+l*b;h=h*k+l*c;l=y.arrowSides;z.beginPath();y.arrowShape.close?("<==>"===l||"<=="===l?(1>y.arrowposition&&(z.moveTo(b,c),z.lineTo(d,g)),z.moveTo(d+m,g+n)):z.moveTo(b,c),"==>"===l||"<==>"===l?(z.lineTo(f-m,h-n),1>y.arrowposition&&(z.moveTo(f,h),z.lineTo(a,k))):z.lineTo(a,k)):(z.moveTo(b,c),z.lineTo(a,k));z.stroke();"==>"!==l&&"<==>"!==l||e(f,h,1,y.arrowShape.ratio);"<=="!==
+l&&"<==>"!==l||e(d,g,-1,-y.arrowShape.ratio)}};y.drawpoint=function(a){var b=C.drawingstate.matrix,c=a.x*b.a-a.y*b.b+b.tx;a=a.x*b.c-a.y*b.d-b.ty;z.lineWidth=.3*y.psize;z.beginPath();z.arc(c,a,y.psize,0,2*Math.PI);z.fillStyle=y.pointColor;z.fill();y.noborder||(z.beginPath(),z.arc(c,a,1.15*y.psize,0,2*Math.PI),z.fillStyle=y.black,z.strokeStyle=y.black,z.stroke())};y.clipLineCore=function(a,b,c){var e=Math.SQRT1_2*y.lsize,d=0-e,g=ma+e,f=0-e;e=pa+e;var h=0>d*a+f*b+c,k=0>g*a+f*b+c,l=0>d*a+e*b+c,x=0>g*
+a+e*b+c,m=[];h!==k&&m.push({x:(-c-b*f)/a,y:f});k!==x&&m.push({x:g,y:(-c-a*g)/b});l!==x&&m.push({x:(-c-b*e)/a,y:e});h!==l&&m.push({x:d,y:(-c-a*d)/b});return m};y.clipLine=function(a){a=g.normalizeMax(g.productVM(a,C.toMat()));return y.clipLineCore(a.value[0].value.real,a.value[1].value.real,a.value[2].value.real)};y.drawline=function(a){g._helper.isAlmostReal(a)&&(a=y.clipLine(a),2===a.length&&.01<=y.lsize&&(y.preDrawCurve(),z.beginPath(),z.moveTo(a[0].x,a[0].y),z.lineTo(a[1].x,a[1].y),z.stroke()))};
+y.drawRaySegment=function(a,b){a=E.extractPoint(a);b=E.extractPoint(b);if(a.ok&&b.ok){var e=a.x-b.x,c=a.y-b.y,d=25E3/C.drawingstate.matrix.sdet/Math.sqrt(e*e+c*c);e*=d;c*=d;y.drawsegcore(a,{x:a.x+e,y:a.y+c});y.drawsegcore(b,{x:b.x-e,y:b.y-c})}};y.dashTypes={solid:[],dashed:[10,10],tightdash:[10,4],dotted:[1,3],dashdot:[10,5,1,5],"dashvalue.solid":[],"dashvalue.dashed":[10,10],"dashvalue.tightdash":[10,4],"dashvalue.dotted":[1,3],"dashvalue.dashdot":[10,5,1,5],0:[],1:[10,10],2:[10,4],3:[1,3],4:[10,
+5,1,5]};y.setDash=function(a,b){b=Math.sqrt(b);a=a.slice();for(var e=0;e<a.length;e++)a[e]*=b;z.webkitLineDash=a;z.setLineDash(a);z.mozDash=a};y.unSetDash=function(){z.webkitLineDash=[];z.setLineDash([]);z.mozDash=[]};Jd.prototype={set fillStyle(a){var b=this;tc(a,function(a,e,c,d){b._fill="#"+Lb(a.toString(16),2)+Lb(e.toString(16),2)+Lb(c.toString(16),2);b._fillOpacity=255===d?null:d})},set strokeStyle(a){var b=this;tc(a,function(a,e,c,d){b._stroke="#"+Lb(a.toString(16),2)+Lb(e.toString(16),2)+Lb(c.toString(16),
+2);b._strokeOpacity=255===d?null:d})},clearRect:function(){},beginPath:function(){this._path=[]},_pathcmd:function(){this._path.push.apply(this._path,arguments)},closePath:function(){this._pathcmd("Z")},moveTo:function(a,b){this._pathcmd("M",a,b)},lineTo:function(a,b){this._pathcmd("L",a,b)},bezierCurveTo:function(a,b,c,d,g,f){this._pathcmd("C",a,b,c,d,g,f)},quadraticCurveTo:function(a,b,c,d){this._pathcmd("Q",a,b,c,d)},arc:function(a,b,c,d,g,f){var e=c*Math.cos(d)+a,h=c*Math.sin(d)+b,k=c*Math.cos(g)+
+a,l=c*Math.sin(g)+b;g=f?d-g:g-d;g>=2*Math.PI?this._pathcmd(this._path.length?"L":"M",e,h,"A",c,c,0,0,f?1:0,a-c*Math.cos(d),b-c*Math.sin(d),"A",c,c,0,0,f?1:0,e,h):this._pathcmd(this._path.length?"L":"M",e,h,"A",c,c,0,g>Math.PI?1:0,f?1:0,k,l)},rect:function(a,b,c,d){this._pathcmd("M",a,b,"h",c,"v",d,"h",-c,"z")},_cmd:function(a){1!==this.globalAlpha?(this._body.push('<g opacity="'+this.globalAlpha+'">'),this._body.push(a),this._body.push("</g>")):this._body.push(a)},_attrs:function(a){var b="",c;for(c in a)null!==
+a[c]&&(b+=" "+c+'="'+a[c]+'"');return b},fill:function(){this._cmd("<path"+this._attrs({d:this._path.join(" "),fill:this._fill,"fill-opacity":this._fillOpacity})+"/>")},stroke:function(){this._cmd("<path"+this._attrs({d:this._path.join(" "),stroke:this._stroke,"stroke-opacity":this._strokeOpacity,"stroke-width":this.lineWidth,"stroke-linecap":this.lineCap,"stroke-linejoin":this.lineJoin,"stroke-miterlimit":"miter"===this.lineJoin?this.miterLimit:null})+"/>")},clip:function(){++this._clipIndex;this._body.push('<clipPath id="clip'+
+this._clipIndex+'"><path d="'+this._path.join(" ")+'"/></clipPath>','<g clip-path="url(#clip'+this._clipIndex+')">');this._saveStack[this._saveStack.length-1]+="</g>"},save:function(){this._saveStack.push("")},restore:function(){this._body.push(this._saveStack.pop());0===this._saveStack.length&&this._saveStack.push("")},_transform:function(a){this._body.push('<g transform="'+a+'">');this._saveStack[this._saveStack.length-1]+="</g>"},translate:function(a,b){this._transform("translate("+a+" "+b+")")},
+rotate:function(a){this._transform("rotate("+Math.PI/180*a+")")},scale:function(a,b){this._transform("scale("+a+" "+b+")")},transform:function(a,b,c,d,g,f){this._transform("matrix("+[a,b,c,d,g,f].join(" ")+")")},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("SvgWriterContext only supports 3-argument version of drawImage");var e=this._imgcache.indexOf(a);if(-1===e){e=this._imgcache.length;var d=a.cachedDataURL?a.cachedDataURL:Kd(a);this._defs.push('<image id="img'+e+'" x="0" y="0" width="'+
+a.width+'" height="'+a.height+'" xlink:href="'+d+'"/>');this._imgcache.push(a)}this._cmd('<use x="'+b+'" y="'+c+'" xlink:href="#img'+e+'"/>')},toBlob:function(){for(;1<this._saveStack.length||""!==this._saveStack[0];)this.restore();var a='<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="'+this.width+'px" height="'+this.height+'px">\n'+this._defs.join("\n")+'\n</defs>\n<g stroke="none" fill="none">\n'+
+this._body.join("\n")+"\n</g>\n</svg>\n";return new Blob([a],{type:"image/svg+xml"})}};Kb.prototype={_cmd:function(){this._body.push(Array.prototype.join.call(arguments," "))},_setAlpha:function(a,b,c){var e=Math.round(255*a*this._globalAlpha);b+=e;this._extGState[b]="<< /"+c+" "+e/255+" >>";this._cmd("/"+b,"gs");return a},set globalAlpha(a){this._globalAlpha=a;this._setAlpha(this._strokeAlpha,"As","CA");this._setAlpha(this._fillAlpha,"Af","ca")},set fillStyle(a){var b=this;tc(a,function(a,e,c,d){b._cmd(a/
+255,e/255,c/255,"rg");b._setAlpha(b._fillAlpha=d,"Af","ca")})},set strokeStyle(a){var b=this;tc(a,function(a,e,c,d){b._cmd(a/255,e/255,c/255,"RG");b._setAlpha(b._strokeAlpha=d,"As","CA")})},set lineWidth(a){this._cmd(a,"w")},set lineCap(a){this._cmd({butt:0,round:1,square:2}[a],"J")},set lineJoin(a){this._cmd({miter:0,round:1,bevel:2}[a],"j")},set miterLimit(a){this._cmd(a,"M")},clearRect:function(){},beginPath:function(){this._pathUsed=!1},closePath:function(){this._cmd("h")},moveTo:function(a,b){this._cmd(this._xPos=
+a,this._yPos=-b,"m")},lineTo:function(a,b){this._cmd(this._xPos=a,this._yPos=-b,"l")},bezierCurveTo:function(a,b,c,d,g,f){this._cmd(a,-b,c,-d,this._xPos=g,this._yPos=-f,"c")},quadraticCurveTo:function(a,b,c,d){this.bezierCurveTo((2*a+this._xPos)/3,(2*b-this._yPos)/3,(c+2*a)/3,(d+2*b)/3,c,d)},_kappa:.5522847498307935,arc:function(a,b,c,d,g,f){if(0===d&&g===2*Math.PI)d=this._kappa*c,this.moveTo(a+c,b),this.bezierCurveTo(a+c,b+d,a+d,b+c,a,b+c),this.bezierCurveTo(a-d,b+c,a-c,b+d,a-c,b),this.bezierCurveTo(a-
+c,b-d,a-d,b-c,a,b-c),this.bezierCurveTo(a+d,b-c,a+c,b-d,a+c,b);else throw Error("PdfWriterContext.arc only supports full circles");},rect:function(a,b,c,d){this._cmd(a,-b,c,-d,"re")},_usePath:function(a){if(this._pathUsed){var b=this._body[this._pathUsed],c={"S + f":"B","f + S":"B","W n + S":"W S","W n + f":"W f","S + W n":"W S","f + W n":"W f","B + W n":"W B","W S + f":"W B","W f + S":"W B"}[b+" + "+a];if(!c)throw Error("Don't know how to combine '"+b+"' and '"+a+"'");this._body.splice(this._pathUsed,
+1);a=c}this._pathUsed=this._body.length;this._cmd(a)},fill:function(){this._usePath("f")},stroke:function(){this._usePath("S")},clip:function(){this._usePath("W n")},save:function(){this._cmd("q")},restore:function(){this._cmd("Q")},translate:function(a,b){this.transform(1,0,0,1,a,b)},rotate:function(a){var b=Math.cos(a);a=Math.sin(a);this.transform(b,a,-a,b,0,0)},scale:function(a,b){this.transform(a,0,0,b,0,0)},transform:function(a,b,c,d,g,f){this._cmd(a,-b,-c,d,g,-f,"cm")},_png:function(a){if("data:image/png;base64,"!==
+a.substr(0,22))return{error:"Not a base64-encoded PNG file"};a=me(a.substr(22));var b=ne(a);console.log("PNG chunks:",b.map(function(a){return a.type}));if("IHDR"!==b[0].type)throw Error("Image does not start with an IHDR");var c=b[0].data;a=(c[0]<<24|c[1]<<16|c[2]<<8|c[3])>>>0;var d=(c[4]<<24|c[5]<<16|c[6]<<8|c[7])>>>0,g=c[8],f=c[9],h=0===(f&2),k=0!==(f&4),l=c[10],m=c[11];c=c[12];if(0!==l)throw Error("Unsupported PNG compression method: "+l);if(0!==m)throw Error("Unsupported PNG filter method: "+
+m);if(0!==c)return{error:"Interlaced image not supported"};if(0!==(f&1))return{error:"Indexed PNG image not supported"};m=null;f=h?1:3;l=b.filter(function(a){return"IDAT"===a.type}).map(function(a){return a.data});if(k){k=window.pako;m=new k.Inflate;for(b=0;b<l.length;++b)m.push(l[b],b+1===l.length);if(m.err)throw Error(m.err);m=m.result;c=g>>>3;if(m.length!==d*(a*(f+1)*c+1))throw Error("Data length mismatch");var n=f*c;l=new Uint8Array(d*(a*n+1));for(var p=new Uint8Array(d*(a*c+1)),q=0,r=0,t=0,u=
+0;u<d;++u){l[r++]=p[t++]=m[q++];for(var w=0;w<a;++w){for(b=0;b<n;++b)l[r++]=m[q++];for(b=0;b<c;++b)p[t++]=m[q++]}}if(q!==m.length||r!==l.length||t!==p.length)throw Error("Seems we garbled our index computation somehow");p=k.deflate(p);m=this._strm({Type:"/XObject",Subtype:"/Image",Width:a,Height:d,ColorSpace:"/DeviceGray",BitsPerComponent:g,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:1,BitsPerComponent:g,Columns:a})},p).ref;l=[k.deflate(l)]}var y=0;l.forEach(function(a){y+=a.length});
+return this._obj([this._dict({Type:"/XObject",Subtype:"/Image",Name:"/img"+this._imgcache.length,Width:a,Height:d,ColorSpace:h?"/DeviceGray":"/DeviceRGB",SMask:m,BitsPerComponent:g,Length:y,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:f,BitsPerComponent:g,Columns:a})}),"\nstream\n"].concat(l,["\nendstream"]))},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("PdfWriterContext only supports 3-argument version of drawImage");var e=this._imgcache.indexOf(a);if(-1===
+e){e=this._imgcache.length;this._imgcache.push(a);var d=this._png(a.cachedDataURL||"");d.hasOwnProperty("error")&&(d=this._png(Kd(a)));if(d.hasOwnProperty("error"))throw Error(d.error);this._xobjects["img"+e]=d.ref}this._cmd("q");this._setAlpha(1,"Af","ca");this._cmd(a.width,0,0,a.height,b,-c-a.height,"cm");this._cmd("/img"+e,"Do");this._cmd("Q")},_dict:function(a){var b="<<",c;for(c in a)b+=" /"+c+" "+a[c];return b+" >>"},_obj:function(a,b){b||(b=this._nextIndex++);Array.isArray(a)||(a=[this._dict(a)]);
+a.index=b;a.ref=b+" 0 R";a.offset=this._offset;var e=0;a.unshift(b+" 0 obj\n");a.push("\nendobj\n");for(b=0;b<a.length;++b)e+=a[b].length;this._offset+=e;this._objects.push(a);return a},_strm:function(a,b,c){a.Length=b.length;return this._obj([this._dict(a),"\nstream\n",b,"\nendstream"],c)},toBlob:function(){var a="["+[0,-this.height,this.width,0].join(" ")+"]";this._obj({Type:"/Catalog",Pages:"2 0 R"},1);this._obj({Type:"/Pages",Kids:"[3 0 R]",Count:1},2);this._obj({Type:"/Page",Parent:"2 0 R",MediaBox:a,
+Contents:"4 0 R",Resources:this._dict({ProcSet:"[/PDF /Text /ImageB /ImageC /ImageI]",XObject:this._dict(this._xobjects),ExtGState:this._dict(this._extGState)})},3);var b=this._body.join("\n"),c=new Uint8Array(b.length);for(a=0;a<b.length;++a)c[a]=b.charCodeAt(a)&255;b=window.pako.deflate(c);this._strm({Filter:"/FlateDecode"},b,4);b=this._objects;var d=[];for(a=1;a<b.length;++a)d[b[a].index]=b[a];c="xref\n0 "+d.length+"\n";for(a=0;a<d.length;++a)c=d[a]?c+(Lb(String(d[a].offset),10)+" 00000 n \n"):
+c+"0000000000 65535 f \n";a="trailer\n"+this._dict({Size:d.length,Root:"1 0 R"})+"\nstartxref\n"+this._offset+"\n%%EOF\n";b=Array.prototype.concat.apply([],b);b.push(c,a);return new Blob(b,{type:"application/pdf"})}};var Fd=null;Db.push(Mb);La.exportSVG=function(){Mc(Jd)};La.exportPDF=function(){Ia.loadScript("pako","pako.min.js",function(){Mc(Kb)})};La.exportPNG=function(){Me(z.canvas.toDataURL())};var Me=function(a){var b=document.createElement("a");document.body.appendChild(b);b.style="display: none";
+b.href=a;b.download="CindyJSExport";b.click();setTimeout(function(){document.body.removeChild(b);Mb()},100)},De="Move",Gd,ib=[],Vb=0,Ye=0,dd=0,H={Delete:{}};H.Delete.actions=[];H.Delete.actions[0]={};H.Delete.actions[0].event="mousedown";H.Delete.actions[0].tooltip="...";H.Delete.actions[0].do=function(){ya=Nb(ja);null!==ya&&Rc(ya.mover.name);return!0};H.Move={};H.Move.actions=[];H.Move.actions[0]={};H.Move.actions[0].event="mousedown";H.Move.actions[0].tooltip="Move free elements by dragging the mouse";
+H.Move.actions[0].do=function(){for(var a=ja,b=null,c=1E6,d,f=0;f<r.free.length;f++){var h=r.free[f];if(!h.pinned&&!1!==h.visible&&!0!==h.tmp){var k=C.drawingstate.matrix.sdet;if("P"===h.kind){var m=g.normalizeZ(h.homog);if(!g._helper.isAlmostReal(m))continue;var n=m.value[0].value.real-a.x;m=m.value[1].value.real-a.y;var p=Math.sqrt(n*n+m*m);if(h.narrow&&p>("number"===typeof h.narrow?h.narrow:20)/k)continue}else if("C"===h.kind){m=g.normalizeZ(r.csnames[h.args[0]].homog);n=h.radius;if(!g._helper.isAlmostReal(m)||
+!l._helper.isAlmostReal(n))continue;p=m.value[0].value.real;var q=m.value[1].value.real;m=a.x-p;var t=a.y-q,u=Math.sqrt(m*m+t*t);if(0===u)continue;q+=t/u*n.value.real;n=p+m/u*n.value.real-a.x;m=q-a.y;p=Math.sqrt(n*n+m*m);p+=30/k;if(h.narrow&&p>(("number"===typeof h.narrow?h.narrow:20)+30)/k)continue}else if("L"===h.kind)n=h.homog,p=l,m=p.add(p.mult(n.value[0],p.conjugate(n.value[0])),p.mult(n.value[1],p.conjugate(n.value[1]))),m=g.scaldiv(p.sqrt(m),n),p=m.value[0].value.real*a.x+m.value[1].value.real*
+a.y+m.value[2].value.real,n=-m.value[0].value.real*p,m=-m.value[1].value.real*p,0>p&&(p=-p),p+=25/k;else if("Text"===h.kind){if(!h.homog||h.dock||!h._bbox)continue;m=C.from(a.x,a.y,1);n=Math.max(0,m[0]-h._bbox.right,h._bbox.left-m[0]);m=Math.max(0,m[1]-h._bbox.bottom,h._bbox.top-m[1]);p=Math.sqrt(n*n+m*m);if(20<p)continue;p/=k;m=g.normalizeZ(h.homog);if(!g._helper.isAlmostReal(m))continue;n=m.value[0].value.real-a.x;m=m.value[1].value.real-a.y}else continue;p<c+.2/k&&(c=p,b=h,d={x:n,y:m})}}console.log("Moving "+
+(b?b.name:"nothing"));ya=null===b?null:{mover:b,offset:d,prev:{x:a.x,y:a.y}};return!0};H.Point={};H.Point.actions=[];H.Point.actions[0]={};H.Point.actions[0].event="mousedown";H.Point.actions[0].tooltip="Add a single point with the mouse";H.Point.actions[0].do=function(){Za({type:"Free",name:Pa(),labeled:!0,pos:[Ma[0],Ma[1],1]});return!0};H.Mid={};H.Mid.actions=[];H.Mid.actions[0]={};H.Mid.actions[0].event="mousedown";H.Mid.actions[0].tooltip="Construct two points and their midpoint by dragging";
+H.Mid.actions[0].do=function(){ac();return!0};H.Mid.actions[1]={};H.Mid.actions[1].event="mousemove";H.Mid.actions[1].do=function(){Qc("Mid");return!0};H.Mid.actions[2]={};H.Mid.actions[2].event="mouseup";H.Mid.actions[2].do=function(){ec();return!0};H.Circle={};H.Circle.actions=[];H.Circle.actions[0]={};H.Circle.actions[0].event="mousedown";H.Circle.actions[0].tooltip="Construct two points and a circle by dragging the mouse";H.Circle.actions[0].do=function(){ac();return!0};H.Circle.actions[1]={};
+H.Circle.actions[1].event="mousemove";H.Circle.actions[1].do=function(){Qc("CircleMP");return!0};H.Circle.actions[2]={};H.Circle.actions[2].event="mouseup";H.Circle.actions[2].do=function(){ec();return!0};H.Compass={};H.Compass.actions=[];H.Compass.actions[0]={};H.Compass.actions[0].event="mousedown";H.Compass.actions[0].tooltip="...";H.Compass.actions[0].do=function(){ac();return!0};H.Compass.actions[1]={};H.Compass.actions[1].event="mousedown";H.Compass.actions[1].tooltip="...";H.Compass.actions[1].do=
+function(){ac();return!0};H.Compass.actions[2]={};H.Compass.actions[2].event="mousedown";H.Compass.actions[2].tooltip="...";H.Compass.actions[2].do=function(){ac();Za({type:"Compass",name:Pa(),labeled:!0,args:[ib[0].name,ib[1].name,ib[2].name]});return!0};H.Line={};H.Line.actions=[];H.Line.actions[0]={};H.Line.actions[0].event="mousedown";H.Line.actions[0].tooltip="Construct two points and their connecting line by dragging the mouse";H.Line.actions[0].do=function(){ac();return!0};H.Line.actions[1]=
+{};H.Line.actions[1].event="mousemove";H.Line.actions[1].do=function(){Qc("Join");return!0};H.Line.actions[2]={};H.Line.actions[2].event="mouseup";H.Line.actions[2].do=function(){ec();return!0};H.Segment={};H.Segment.actions=[];H.Segment.actions[0]={};H.Segment.actions[0].event="mousedown";H.Segment.actions[0].tooltip="Draw a segment by dragging the mouse";H.Segment.actions[0].do=function(){ac();return!0};H.Segment.actions[1]={};H.Segment.actions[1].event="mousemove";H.Segment.actions[1].do=function(){Qc("Segment");
+return!0};H.Segment.actions[2]={};H.Segment.actions[2].event="mouseup";H.Segment.actions[2].do=function(){ec();return!0};H.Parallel={};H.Parallel.actions=[];H.Parallel.actions[0]={};H.Parallel.actions[0].event="mousedown";H.Parallel.actions[0].tooltip="Construct a parallel line by dragging a line";H.Parallel.actions[0].do=function(){return Pb()};H.Parallel.actions[1]={};H.Parallel.actions[1].event="mousemove";H.Parallel.actions[1].do=function(){var a={type:"Free",name:Pa(),labeled:!0,pos:[Ma[0],Ma[1],
+1],tmp:!0};a=Za(a);Gd=Za({type:"Para",name:Pa(),labeled:!0,args:[ib[0].name,a.name]});Pc(a);return!0};H.Parallel.actions[2]={};H.Parallel.actions[2].event="mouseup";H.Parallel.actions[2].do=function(){ec();return!0};H.Orthogonal={};H.Orthogonal.actions=[];H.Orthogonal.actions[0]={};H.Orthogonal.actions[0].event="mousedown";H.Orthogonal.actions[0].tooltip="Construct a orthogonal line by dragging a line";H.Orthogonal.actions[0].do=function(){if(Pb()){var a={type:"Free",name:Pa(),labeled:!0,pos:[Ma[0],
+Ma[1],1],tmp:!0};a=Za(a);Gd=Za({type:"Perp",name:Pa(),labeled:!0,args:[ib[0].name,a.name]});Pc(a);return!0}return!1};H.Orthogonal.actions[1]={};H.Orthogonal.actions[1].event="mouseup";H.Orthogonal.actions[1].do=function(){ec();return!0};H.Intersection={};H.Intersection.actions=[];H.Intersection.actions[0]={};H.Intersection.actions[0].event="mousedown";H.Intersection.actions[0].tooltip="Select two elements to define their intersection";H.Intersection.actions[0].do=function(){return Od()};H.Intersection.actions[1]=
+{};H.Intersection.actions[1].event="mousedown";H.Intersection.actions[1].do=function(){return Od()?(Gd=Za({type:"Meet",name:Pa(),labeled:!0,args:[ib[0].name,ib[1].name]}),!0):!1};var Fa=function(a){a?(this._e=[],this._e[0]=a[0][0],this._e[1]=a[1][0],this._e[2]=a[2][0],this._e[3]=a[0][1],this._e[4]=a[1][1],this._e[5]=a[2][1],this._e[6]=a[0][2],this._e[7]=a[1][2],this._e[8]=a[2][2]):this._e=[1,0,0,0,1,0,0,0,1]};Fa.prototype.clone=function(){var a=[].concat($jscomp.arrayFromIterable(this._e)),b=new Fa;
+b.set(a);return b};Fa.prototype.get=function(a){return this._e[a]};Fa.prototype.getRow=function(a){var b=this._e;return[b[a],b[3+a],b[6+a]]};Fa.prototype.set=function(a,b){1===arguments.length&&(this._e=a);2===arguments.length&&(this._e[a]=b)};Fa.prototype.exchange=function(a,b){var e=$jscomp.makeIterator([this._e[b],this._e[a]]);this._e[a]=e.next().value;this._e[b]=e.next().value};Fa.prototype.inverse=function(){var a=this._e,b=-a[2]*a[4]*a[6]+a[1]*a[5]*a[6]+a[2]*a[3]*a[7]-a[0]*a[5]*a[7]-a[1]*a[3]*
+a[8]+a[0]*a[4]*a[8];a=[-a[4]*a[7]+a[4]*a[8],a[5]*a[6]-a[3]*a[8],-a[4]*a[6]+a[3]*a[7],a[2]*a[7]-a[1]*a[8],-a[2]*a[6]+a[0]*a[8],a[1]*a[6]-a[0]*a[7],-a[2]*a[4]+a[1]*a[5],a[2]*a[3]-a[0]*a[5],-a[1]*a[3]+a[0]*a[4]];1E-10>Math.abs(b)&&console.log("PSLQ: inverting singular matrix!");this._e=a.map(function(a){return a/b});return this};Fa.prototype.swRow=function(a,b){for(var e=0;9>e;)this.exchange(e+a,e+b),e+=3};Fa.prototype.swCol=function(a,b){for(var e=0;3>e;++e)this.exchange(3*a+e,3*b+e)};Fa.mult=function(a,
+b,c){a=[a.get(0)*b.get(0)+a.get(3)*b.get(1)+a.get(6)*b.get(2),a.get(1)*b.get(0)+a.get(4)*b.get(1)+a.get(7)*b.get(2),a.get(2)*b.get(0)+a.get(5)*b.get(1)+a.get(8)*b.get(2),a.get(0)*b.get(3)+a.get(3)*b.get(4)+a.get(6)*b.get(5),a.get(1)*b.get(3)+a.get(4)*b.get(4)+a.get(7)*b.get(5),a.get(2)*b.get(3)+a.get(5)*b.get(4)+a.get(8)*b.get(5),a.get(0)*b.get(6)+a.get(3)*b.get(7)+a.get(6)*b.get(8),a.get(1)*b.get(6)+a.get(4)*b.get(7)+a.get(7)*b.get(8),a.get(2)*b.get(6)+a.get(5)*b.get(7)+a.get(8)*b.get(8)];c.set(a)};
+Fa.prototype.getString=function(){var a=this._e;return"/"+a[0]+"\t "+a[3]+"\t "+a[6]+"\\\n|"+a[1]+"\t "+a[4]+"\t "+a[7]+"|\n\\"+a[2]+"\t "+a[5]+"\t "+a[8]+"/\n"};Fa.prototype.transpose=function(){this.exchange(1,3);this.exchange(2,6);this.exchange(5,7);return this};Fa.VMmult=function(a,b,c){c[0]=b.get(0)*a[0]+b.get(1)*a[1]+b.get(2)*a[2];c[1]=b.get(3)*a[0]+b.get(4)*a[1]+b.get(5)*a[2];c[2]=b.get(6)*a[0]+b.get(7)*a[1]+b.get(8)*a[2]};var kb=function(){};kb.dot=function(a,b){for(var e=0,c=0;c<a.length;c++)e+=
+a[c]*b[c];return e};kb.scale=function(a,b){for(var e=0;e<a.length;++e)a[e]*=b};kb.maxIndex=function(a){for(var b=0,c=1;c<a.length;++c)a[c]>a[b]&&(b=c);return b};kb.hermiteReduce=function(a){for(var b=[[1,0,0],[0,1,0],[0,0,1]],c=a.length,d=a.map(function(a){return[].concat($jscomp.arrayFromIterable(a))}),g,f=1;f<c;f++)for(var h=f-1;0<=h;h--){g=Math.round(a[f][h]/a[h][h]);for(var k=0;k<=h;k++)d[f][k]-=g*d[h][k];for(k=0;k<c;k++)b[f][k]-=g*b[h][k]}for(c=0;3>c;c++)a[c]=d[c];return new Fa(b)};kb.doPSLQ=
+function(a,b){for(var e=a.length,c=[],d=[],g=0;g<e;++g){c[g]=a[g]/Math.sqrt(kb.dot(a,a));for(var f=0,h=g;h<e;++h)f+=Math.pow(a[h],2);d[g]=Math.sqrt(f)}kb.scale(d,1/d[0]);g=new Fa;a=new Fa;f=[];for(h=0;h<e;h++)f[h]=[];for(h=0;h<e;++h)for(var k=0;k<e-1;++k)f[h][k]=h>k?-c[h]*c[k]/d[k]/d[k+1]:h===k?d[h+1]/d[h]:0;h=kb.hermiteReduce(f);k=h.clone().inverse().transpose();Fa.VMmult(c,k,c);Fa.mult(h,g,g);Fa.mult(a,k,a);for(d=0;d<kb.MAX_ITER;++d){k=[f[0][0],f[1][1]];h=0;Math.pow(this.GAMMA,2)*Math.abs(k[1])>
+Math.pow(this.GAMMA,1)*Math.abs(k[0])&&(h=1);var l=k=0,m=0;h<e-2&&(k=f[h+1][h],l=f[h+1][h+1],m=Math.sqrt(Math.pow(k,2)+Math.pow(l,2)));var n=c[h];c[h]=c[h+1];c[h+1]=n;n=[].concat($jscomp.arrayFromIterable(f[h]));f[h]=f[h+1];f[h+1]=n;g.swRow(h,h+1);a.swCol(h,h+1);n=Array(2);for(var p=0;3>p;p++)n[p]=[];if(h<e-2){for(p=0;p<e-1;++p)for(var q=0;q<e-1;++q)n[p][q]=p===h&&q===h?k/m:p===h&&q===h+1?-l/m:p===h+1&&q===h?l/m:p===h+1&&q===h+1?k/m:p===q&&q!==h||p===q&&q!==h+1?1:0;f=[[f[0][0]*n[0][0]+f[0][1]*n[1][0],
+f[0][0]*n[0][1]+f[0][1]*n[1][1]],[f[1][0]*n[0][0]+f[1][1]*n[1][0],f[1][0]*n[0][1]+f[1][1]*n[1][1]],[f[2][0]*n[0][0]+f[2][1]*n[1][0],f[2][0]*n[0][1]+f[2][1]*n[1][1]]]}h=kb.hermiteReduce(f);k=h.clone().inverse().transpose();Fa.VMmult(c,k,c);Fa.mult(h,g,g);Fa.mult(a,k,a);h=[c[0],c[1],c[2],f[0][0],f[1][1]];for(k=0;k<h.length;++k)if(Math.abs(h[k])<=Math.pow(10,-b+5)){a.transpose();for(b=0;b<c.length;++b)c[b]=-Math.abs(c[b]);return a.getRow(kb.maxIndex(c))}}};$jscomp.global.Object.defineProperties(kb,{MAX_ITER:{configurable:!0,
+enumerable:!0,get:function(){return 20}},GAMMA:{configurable:!0,enumerable:!0,get:function(){return 2/Math.sqrt(3)}}});var cc={},C={drawingstate:{}};C.drawingstate.linecolor="rgb(0,0,255)";C.drawingstate.linecolorraw=[0,0,1];C.drawingstate.pointcolor="rgb(0,255,0)";C.drawingstate.pointcolorraw=[0,1,0];C.drawingstate.textcolor="rgb(0,0,0)";C.drawingstate.textcolorraw=[0,0,0];C.drawingstate.alpha=1;C.drawingstate.pointsize=4;C.drawingstate.linesize=1;C.drawingstate.textsize=null;C.drawingstate.matrix=
+{};C.drawingstate.matrix.a=25;C.drawingstate.matrix.b=0;C.drawingstate.matrix.c=0;C.drawingstate.matrix.d=25;C.drawingstate.matrix.tx=250.5;C.drawingstate.matrix.ty=250.5;C.drawingstate.matrix.det=C.drawingstate.matrix.a*C.drawingstate.matrix.d-C.drawingstate.matrix.b*C.drawingstate.matrix.c;C.drawingstate.matrix.sdet=Math.sqrt(C.drawingstate.matrix.det);C.drawingstate.initialmatrix={};C.drawingstate.initialmatrix.a=C.drawingstate.matrix.a;C.drawingstate.initialmatrix.b=C.drawingstate.matrix.b;C.drawingstate.initialmatrix.c=
+C.drawingstate.matrix.c;C.drawingstate.initialmatrix.d=C.drawingstate.matrix.d;C.drawingstate.initialmatrix.tx=C.drawingstate.matrix.tx;C.drawingstate.initialmatrix.ty=C.drawingstate.matrix.ty;C.drawingstate.initialmatrix.det=C.drawingstate.matrix.det;C.drawingstate.initialmatrix.sdet=C.drawingstate.matrix.sdet;C.clone=function(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),c;for(c in a)b[c]=C.clone(a[c]);return b};cc.backup=C.clone(C.drawingstate);cc.stack=[];C.clone(C.drawingstate);
+C.reset=function(){C.drawingstate.matrix.a=C.drawingstate.initialmatrix.a;C.drawingstate.matrix.b=C.drawingstate.initialmatrix.b;C.drawingstate.matrix.c=C.drawingstate.initialmatrix.c;C.drawingstate.matrix.d=C.drawingstate.initialmatrix.d;C.drawingstate.matrix.tx=C.drawingstate.initialmatrix.tx;C.drawingstate.matrix.ty=C.drawingstate.initialmatrix.ty;C.drawingstate.matrix.det=C.drawingstate.initialmatrix.det;C.drawingstate.matrix.sdet=C.drawingstate.initialmatrix.sdet};C.from=function(a,b,c){a/=c;
+b/=c;c=C.drawingstate.matrix;return[(a*c.a-b*c.b+c.tx)/wa,(a*c.c-b*c.d-c.ty)/wa]};C.to=function(a,b){var e=C.drawingstate.matrix;a=a*wa-e.tx;b=b*wa+e.ty;return[(a*e.d-b*e.b)/e.det,-(-a*e.c+b*e.a)/e.det,1]};C.toMat=function(){var a=C.drawingstate.matrix;return g.realMatrix([[a.d,-a.b,-a.tx*a.d-a.ty*a.b],[a.c,-a.a,-a.tx*a.c-a.ty*a.a],[0,0,a.det]])};C.dumpTrafo=function(){function a(a){return Math.round(1E3*a)/1E3}var b=C.drawingstate.matrix;console.log("a:"+a(b.a)+" b:"+a(b.b)+" c:"+a(b.c)+" d:"+a(b.d)+
+" tx:"+a(b.ty)+" ty:"+a(b.tx))};C.setMat=function(a,b,c,d,g,f){var e=C.drawingstate.matrix;e.a=a;e.b=b;e.c=c;e.d=d;e.tx=g;e.ty=f;e.det=a*d-b*c;e.sdet=Math.sqrt(e.det)};C.scaleAndOrigin=function(a,b,c){C.setMat(a,0,0,a,b,c)};C.visibleRect=function(a,b,c,d){var e=c-a,g=b-d;e=ma*g<pa*e?ma/e:pa/g;C.setMat(e,0,0,e,(ma-e*(a+c))/2,(pa-e*(b+d))/2)};C.applyMat=function(a,b,c,d,g,f){var e=C.drawingstate.matrix;C.setMat(e.a*a+e.c*b,e.b*a+e.d*b,e.a*c+e.c*d,e.b*c+e.d*d,e.a*g+e.c*f+e.tx,e.b*g+e.d*f+e.ty)};C.translate=
+function(a,b){C.applyMat(1,0,0,1,a,b)};C.rotate=function(a){var b=Math.cos(a);a=Math.sin(a);C.applyMat(b,a,-a,b,0,0)};C.scale=function(a){C.applyMat(a,0,0,a,0,0)};C.gsave=function(){cc.stack.push(C.clone(C.drawingstate))};C.grestore=function(){0!==cc.stack.length&&(C.drawingstate=cc.stack.pop())};C.greset=function(){C.drawingstate=C.clone(cc.backup);C.drawingstate.matrix.ty-=pa;C.drawingstate.initialmatrix.ty-=pa;cc.stack=[]};C.createnewbackup=function(){C.drawingstate.initialmatrix.a=C.drawingstate.matrix.a;
+C.drawingstate.initialmatrix.b=C.drawingstate.matrix.b;C.drawingstate.initialmatrix.c=C.drawingstate.matrix.c;C.drawingstate.initialmatrix.d=C.drawingstate.matrix.d;C.drawingstate.initialmatrix.tx=C.drawingstate.matrix.tx;C.drawingstate.initialmatrix.ty=C.drawingstate.matrix.ty;C.drawingstate.initialmatrix.det=C.drawingstate.matrix.det;C.drawingstate.initialmatrix.sdet=C.drawingstate.matrix.sdet;cc.backup=C.clone(C.drawingstate)};C.makecolor=function(a,b,c){a=Math.floor(255*a);b=Math.floor(255*b);
+c=Math.floor(255*c);return 1===C.drawingstate.alpha?"rgb("+a+","+b+","+c+")":"rgba("+a+","+b+","+c+","+C.drawingstate.alpha+")"};C.setcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;C.drawingstate.linecolor=C.drawingstate.pointcolor=C.makecolor(b,c,a);C.drawingstate.linecolorraw=C.drawingstate.pointcolorraw=[b,c,a]};C.setlinecolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;C.drawingstate.linecolor=C.makecolor(b,
+c,a);C.drawingstate.linecolorraw=[b,c,a]};C.settextcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;C.drawingstate.textcolor=C.makecolor(b,c,a);C.drawingstate.textcolorraw=[b,c,a]};C.setpointcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;C.drawingstate.pointcolor=C.makecolor(b,c,a);C.drawingstate.pointcolorraw=[b,c,a]};C.setalpha=function(a){C.drawingstate.alpha=a.value.real;C.drawingstate.linecolor=C.makecolor(C.drawingstate.linecolorraw[0],
+C.drawingstate.linecolorraw[1],C.drawingstate.linecolorraw[2]);C.drawingstate.pointcolor=C.makecolor(C.drawingstate.pointcolorraw[0],C.drawingstate.pointcolorraw[1],C.drawingstate.pointcolorraw[2]);C.drawingstate.textcolor=C.makecolor(C.drawingstate.textcolorraw[0],C.drawingstate.textcolorraw[1],C.drawingstate.textcolorraw[2])};C.setpointsize=function(a){C.drawingstate.pointsize=a.value.real};C.setlinesize=function(a){C.drawingstate.linesize=a.value.real};C.settextsize=function(a){C.drawingstate.textsize=
+a.value.real};var Aa={clip:"none",pointColor:[1,0,0],lineColor:[0,0,1],pointSize:5,lineSize:1,alpha:1,overhangLine:1,overhangSeg:1,dimDependent:.7,fontFamily:"sans-serif",textColor:[0,0,0],textsize:20,noborder:!1,lineHeight:1.45};d.defaultAppearance&&oe(d.defaultAppearance);var je={},Ne={UL:0,UR:1,LR:2,LL:3},Fe=["in","out","good","backup","prover"],mc=new Float64Array(0),Ub={};Fe.forEach(function(a){Ub[a]=mc});var Ja=mc,yb=mc,ob=mc,jb,pb,lc,sb,fd,Ge=!1,Oe={toString:function(){return"RefineException"}},
+Pe=null,P=null;d.enableTraceLog&&(P={logLength:Infinity,fullLog:[],currentMouseAndScripts:null,currentMover:null,currentStep:null,currentElement:null,currentParam:null,labelTracing2:u.wrap("tracing2"),labelTracing4:u.wrap("tracing4"),labelTracingSesq:u.wrap("tracingSesq"),postMouseHooks:[]},"number"===typeof d.enableTraceLog&&(P.logLength=d.enableTraceLog),La.getTraceLog=ae,La.formatTraceLog=re,La.addTraceHook=P.postMouseHooks.push.bind(P.postMouseHooks));mb.stateSize=12;rd.stateSize=24;vc.stateSize=
+24;var Ra=[];qa._helper={};qa._helper.duplicatePPLL=function(a,b){return{getInvolved:function(){return[a,b]},toString:function(){return{P:"point",L:"line"}[a.kind]+" "+a.name+" is duplicate of "+b.name},apply:wc(a,b),holds:function(){return g.projectiveDistMinScal(a.homog,b.homog)<l.epsbig}}};qa._helper.duplicatePsLs=function(a,b){return{getInvolved:function(){return[a,b]},toString:function(){return{Ps:"point set",Ls:"line set"}[a.kind]+" "+a.name+" is duplicate of "+b.name},apply:wc(a,b),holds:function(){return qa._helper.isSetEq(a.results.value,
+b.results.value,g.projectiveDistMinScal)}}};qa._helper.duplicateCC=function(a,b){return{getInvolved:function(){return[a,b]},toString:function(){return"Conic "+a.name+" is duplicate of "+b.name},apply:wc(a,b),holds:function(){return g.conicDist(a.matrix,b.matrix)<l.epsbig}}};qa._helper.duplicateCs=function(a,b){return{getInvolved:function(){return[a,b]},toString:function(){return"Conic set"+a.name+" is duplicate of "+b.name},apply:wc(a,b),holds:function(){return qa._helper.isSetEq(a.results,b.results,
+g.conicDist)}}};qa._helper.duplicateSS=function(a,b){return{getInvolved:function(){return[a,b]},toString:function(){return"Segment "+a.name+" is duplicate of "+b.name},apply:wc(a,b),holds:function(){var e=a.startpos,c=a.endpos,d=b.startpos,f=b.endpos,h=g.projectiveDistMinScal(e,d);h+=g.projectiveDistMinScal(c,f);c=g.projectiveDistMinScal(c,d);c+=g.projectiveDistMinScal(e,f);return Math.min(h,c)<l.epsbig}}};qa.P=function(a){r.points.forEach(function(b){a.name!==b.name&&(b=qa._helper.duplicatePPLL(a,
+b),b.holds()&&Ra.push(b))})};qa.Ps=function(a){r.sets.points.forEach(function(b){a.name!==b.name&&(b=qa._helper.duplicatePsLs(a,b),b.holds()&&Ra.push(b))})};qa.Ls=function(a){r.sets.lines.forEach(function(b){a.name!==b.name&&(b=qa._helper.duplicatePsLs(a,b),b.holds()&&Ra.push(b))})};qa.Cs=function(a){r.sets.conics.forEach(function(b){a.name!==b.name&&(b=qa._helper.duplicateCs(a,b),b.holds()&&Ra.push(b))})};qa.L=function(a){r.lines.forEach(function(b){a.name!==b.name&&a.kind===b.kind&&(b=qa._helper.duplicatePPLL(a,
+b),b.holds()&&Ra.push(b))})};qa.S=function(a){r.lines.forEach(function(b){a.name!==b.name&&"S"===b.kind&&(b=qa._helper.duplicateSS(a,b),b.holds()&&Ra.push(b))})};qa.C=function(a){r.conics.forEach(function(b){a.name!==b.name&&(b=qa._helper.duplicateCC(a,b),b.holds()&&Ra.push(b))})};qa._helper.isSetEq=function(a,b,c){a=a.slice();b=b.slice();if(a.length!==b.length)return!1;if(0===a.length&&0===b.length)return!0;var e=a.shift(),d=b.reduce(function(a,b,d,g){return c(b,e)<c(g[a],e)?d:a},0);return c(b[d],
+e)<l.epsbig?(b.splice(d,1),qa._helper.isSetEq(a,b,c)):!1};Qb.P=function(a){r.lines.forEach(function(b){b=td(a,b);b.holds()&&Ra.push(b)});r.conics.forEach(function(b){b=ce(a,b);b.holds()&&Ra.push(b)})};Qb.L=function(a){r.points.forEach(function(b){b=td(b,a);b.holds()&&Ra.push(b)})};Qb.S=Qb.L;Qb.C=function(a){r.points.forEach(function(b){b=ce(b,a);b.holds()&&Ra.push(b)})};var m={_helper:{},RandomLine:{}};m.RandomLine.kind="L";m.RandomLine.signature=[];m.RandomLine.updatePosition=function(a){a.homog=
+g.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};m._helper.getRandMove=function(a){a=a.homog;var b=g.getRandComplexVec3(-.05,.05);return{type:"homog",value:g.add(a,b)}};m._helper.getRandPointMove=function(a){a=g.normalizeMax(a.homog);var b=a.value[2],c=l.abs(b).value.real,d=l.real(0);c<l.eps&&(d=l.getRandComplex(-.05,.05),b=l.real(1));c=g.turnIntoCSList([l.getRandComplex(-.1,.1),l.getRandComplex(-.1,.1),d]);b=g.scalmult(b,
+c);b=g.add(a,b);return{type:"homog",value:b}};m.FreeLine={};m.FreeLine.kind="L";m.FreeLine.signature=[];m.FreeLine.isMovable=!0;m.FreeLine.initialize=function(a){a=m._helper.initializeLine(a);ea(a)};m.FreeLine.getParamForInput=function(a,b,c){"mouse"===c?(a=g.cross(b,g.ez),a=g.cross(a,b)):a="homog"===c?b:g.turnIntoCSList([l.zero,l.zero,l.zero]);return g.normalizeMax(a)};m.FreeLine.getParamFromState=function(a){return ha(3)};m.FreeLine.putParamToState=function(a,b){ea(b)};m.FreeLine.updatePosition=
+function(a){var b=ha(3);ea(b);a.homog=u.withUsage(b,"Line")};m.FreeLine.getRandomMove=m._helper.getRandMove;m.FreeLine.stateSize=6;m.RandomPoint={};m.RandomPoint.kind="P";m.RandomPoint.signature=[];m.RandomPoint.updatePosition=function(a){a.homog=g.realVector([100*Math.random(),100*Math.random(),100*Math.random()]);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Point")};m.Join={};m.Join.kind="L";m.Join.signature=["P","P"];m.Join.updatePosition=function(a){a.homog=g.cross(r.csnames[a.args[0]].homog,
+r.csnames[a.args[1]].homog);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};m.Segment={};m.Segment.kind="S";m.Segment.signature=["P","P"];m.Segment.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]];m.Segment.setSegmentPos(a,g.cross(b.homog,c.homog),g.scalmult(c.homog.value[2],b.homog),g.scalmult(b.homog.value[2],c.homog))};m.Segment.setSegmentPos=function(a,b,c,d){b=g.normalizeMax(b);a.homog=u.withUsage(b,"Line");b=g.turnIntoCSList([c,d]);b=g.normalizeMax(b);
+a.startpos=b.value[0];a.endpos=b.value[1]};m.Meet={};m.Meet.kind="P";m.Meet.signature=["L","L"];m.Meet.updatePosition=function(a){a.homog=g.cross(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Point")};m.Meet.visiblecheck=function(a){var b=!0,c=r.csnames[a.args[0]],d=r.csnames[a.args[1]];"S"===c.kind&&(b=Td(a,c));b&&"S"===d.kind&&(b=Td(a,d));a.isshowing=b};m._helper.midpoint=function(a,b){return g.normalizeMax(g.add(g.scalmult(b.value[2],
+a),g.scalmult(a.value[2],b)))};m.Mid={};m.Mid.kind="P";m.Mid.signature=["P","P"];m.Mid.updatePosition=function(a){var b=m._helper.midpoint(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog);a.homog=u.withUsage(b,"Point")};m.Perp={};m.Perp.kind="L";m.Perp.signature=["L","P"];m.Perp.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog;b=g.turnIntoCSList([b.value[0],b.value[1],l.zero]);a.homog=g.cross(b,c);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,
+"Line")};m.Para={};m.Para.kind="L";m.Para.signature=["L","P"];m.Para.updatePosition=function(a){var b=r.csnames[a.args[1]].homog;a.homog=g.cross(g.cross(g.linfty,r.csnames[a.args[0]].homog),b);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};m.Horizontal={};m.Horizontal.kind="L";m.Horizontal.signature=["P"];m.Horizontal.updatePosition=function(a){a.homog=g.cross(g.ex,r.csnames[a.args[0]].homog);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};m.HorizontalLine=
+{};m.HorizontalLine.kind="L";m.HorizontalLine.signature=[];m.HorizontalLine.isMovable=!0;m.HorizontalLine.initialize=function(a){a=m._helper.initializeLine(a);a=g.turnIntoCSList([l.zero,a.value[1],a.value[2]]);a=g.normalizeMax(a);ea(a)};m.HorizontalLine.getParamForInput=function(a,b,c){if("mouse"===c)b=g.cross(b,g.ex);else if("homog"===c){if(0!==b.value[0].real||0!==b.value[0].imag)b=g.turnIntoCSList([l.zero,b.value[1],b.value[2]])}else b=g.turnIntoCSList([l.zero,l.zero,l.zero]);return g.normalizeMax(b)};
+m.HorizontalLine.getParamFromState=function(a){return ha(3)};m.HorizontalLine.putParamToState=function(a,b){ea(b)};m.HorizontalLine.updatePosition=function(a){var b=ha(3);ea(b);a.homog=u.withUsage(b,"Line")};m.HorizontalLine.getRandomMove=m._helper.getRandMove;m.HorizontalLine.stateSize=6;m.Vertical={};m.Vertical.kind="L";m.Vertical.signature=["P"];m.Vertical.updatePosition=function(a){a.homog=g.cross(g.ey,r.csnames[a.args[0]].homog);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};
+m.VerticalLine={};m.VerticalLine.kind="L";m.VerticalLine.signature=[];m.VerticalLine.isMovable=!0;m.VerticalLine.initialize=function(a){a=m._helper.initializeLine(a);a=g.turnIntoCSList([a.value[0],l.zero,a.value[2]]);a=g.normalizeMax(a);ea(a)};m.VerticalLine.getParamForInput=function(a,b,c){if("mouse"===c)b=g.cross(b,g.ey);else if("homog"===c){if(0!==b.value[1].real||0!==b.value[1].imag)b=g.turnIntoCSList([b.value[0],l.zero,b.value[2]])}else b=g.turnIntoCSList([l.zero,l.zero,l.zero]);return g.normalizeMax(b)};
+m.VerticalLine.getParamFromState=function(a){return ha(3)};m.VerticalLine.putParamToState=function(a,b){ea(b)};m.VerticalLine.updatePosition=function(a){var b=ha(3);ea(b);a.homog=u.withUsage(b,"Line")};m.VerticalLine.getRandomMove=m._helper.getRandMove;m.VerticalLine.stateSize=6;m.LineByFixedAngle={};m.LineByFixedAngle.kind="L";m.LineByFixedAngle.signature=["L","P"];m.LineByFixedAngle.initialize=function(a){var b=l._helper.input(a.angle),c=l.cos(b);b=l.sin(b);a.rot=g.turnIntoCSList([g.turnIntoCSList([b,
+c,l.zero]),g.turnIntoCSList([l.neg(c),b,l.zero]),g.turnIntoCSList([l.zero,l.zero,l.zero])])};m.LineByFixedAngle.updatePosition=function(a){var b=r.csnames[a.args[1]],c=g.productMV(a.rot,r.csnames[a.args[0]].homog);a.homog=g.cross(b.homog,c);a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Line")};m.Through={};m.Through.kind="L";m.Through.signature=["P"];m.Through.isMovable=!0;m.Through.initialize=function(a){a=a.dir?u.wrap(a.dir):g.realVector([a.pos[1],-a.pos[0],0]);ea(a)};m.Through.getParamForInput=
+function(a,b,c){a="dir"===c||"mouse"===c?g.cross(r.csnames[a.args[0]].homog,b):"homog"===c?b:g.turnIntoCSList([l.zero,l.zero,l.zero]);a=g.cross(g.linfty,a);return g.normalizeMax(a)};m.Through.getParamFromState=function(a){return ha(3)};m.Through.putParamToState=function(a,b){ea(b)};m.Through.updatePosition=function(a){var b=ha(3);ea(b);b=g.cross(r.csnames[a.args[0]].homog,b);b=g.normalizeMax(b);a.homog=u.withUsage(b,"Line")};m.Through.getRandomMove=m._helper.getRandMove;m.Through.stateSize=6;m.Through.set_angle=
+function(a,b){if("number"===b.ctype){var e=l.cos(b);b=l.sin(b);e=g.turnIntoCSList([e,b,l.real(0)]);Ta(a,e,"dir")}};m.Through.set_slope=function(a,b){"number"===b.ctype&&(b=g.turnIntoCSList([l.real(1),b,l.real(0)]),Ta(a,b,"dir"))};m.Free={};m.Free.kind="P";m.Free.signature=[];m.Free.isMovable=!0;m.Free.initialize=function(a){a=m._helper.initializePoint(a);ea(a)};m.Free.getParamForInput=function(a,b,c){if("mouse"===c&&Cc&&0!==Va){b=g.normalizeZ(b);a=b.value[0].value.real;c=b.value[1].value.real;var e=
+Math.round(a/Va)*Va,d=Math.round(c/Va)*Va;Math.abs(e-a)<Tb&&Math.abs(d-c)<Tb&&(b=g.realVector([e,d,1]))}return g.normalizeMax(b)};m.Free.getParamFromState=function(a){return ha(3)};m.Free.putParamToState=function(a,b){ea(b)};m.Free.updatePosition=function(a){var b=ha(3);ea(b);a.homog=u.withUsage(b,"Point")};m.Free.getRandomMove=m._helper.getRandPointMove;m.Free.stateSize=6;m._helper.projectPointToLine=function(a,b){var e=g.turnIntoCSList([b.value[0],b.value[1],l.zero]);a=g.cross(e,a);return g.normalizeMax(g.cross(a,
+b))};m.PointOnLine={};m.PointOnLine.kind="P";m.PointOnLine.signature=["L"];m.PointOnLine.isMovable=!0;m.PointOnLine.initialize=function(a){var b=m._helper.initializePoint(a);a=r.csnames[a.args[0]].homog;b=m._helper.projectPointToLine(b,a);b=g.normalizeMax(b);var c=g.cross(g.linfty,b);g.normalizeMax(c);ea(b);ea(a);lc=!1};m.PointOnLine.updatePosition=function(a,b){var e=r.csnames[a.args[0]].homog;var c=ha(3);ha(3);if(!b){jb=a.stateIdx;var d=Ja;Ja=ob;b=ha(3);var f=ha(3);Ja=d;d=g.cross(f,e);g._helper.isAlmostZero(d)&&
+(d=g.cross(g.linfty,e));b=m._helper.CircleMP(d,b);b=m._helper.IntersectLC(e,b);d=m._helper.pointReflection(d,c);c=qd(b[0],b[1],c,d)[0]}c=g.normalizeMax(c);ea(c);ea(e);a.homog=u.withUsage(c,"Point")};m.PointOnLine.getParamForInput=function(a,b,c){a=r.csnames[a.args[0]].homog;b=m._helper.projectPointToLine(b,a);"mouse"===c&&Cc&&0!==Va&&(b=m._helper.snapPointToLine(b,a));return b};m.PointOnLine.getParamFromState=function(a){return ha(3)};m.PointOnLine.putParamToState=function(a,b){return ea(b)};m.PointOnLine.getRandomMove=
+m._helper.getRandPointMove;m.PointOnLine.stateSize=12;m.PointOnCircle={};m.PointOnCircle.kind="P";m.PointOnCircle.signature=["C"];m.PointOnCircle.isMovable=!0;m.PointOnCircle.initialize=function(a){var b=r.csnames[a.args[0]];a=g.normalizeZ(m._helper.initializePoint(a));var c=g.normalizeZ(m._helper.CenterOfCircle(b.matrix)),d=g.sub(a,c);d=g.turnIntoCSList([d.value[1],l.neg(d.value[0]),l.zero]);c=g.cross(a,c);b=m._helper.IntersectLC(c,b.matrix);c=g.projectiveDistMinScal(a,b[0]);g.projectiveDistMinScal(a,
+b[1])<c?(a=b[1],b=b[0]):(a=b[0],b=b[1]);ea(d);ea(a);ea(b);lc=!1};m.PointOnCircle.putParamToState=function(a,b){ea(b)};m.PointOnCircle.getParamFromState=function(a){return ha(3)};m.PointOnCircle.getParamForInput=function(a,b,c){c=g.normalizeZ(m._helper.CenterOfCircle(r.csnames[a.args[0]].matrix));b=g.sub(b,c);jb=a.stateIdx;a=ha(3);var e=g.normalizeZ(ha(3));c=g.sub(e,c);0>l.sub(l.mult(a.value[0],c.value[1]),l.mult(a.value[1],c.value[0])).value.real&&(b=g.neg(b));return g.turnIntoCSList([b.value[1],
+l.neg(b.value[0]),l.zero])};m.PointOnCircle.parameterPath=function(a,b,c,d,f){d=g.normalizeAbs(d);f=g.normalizeAbs(f);var e=g.scalproduct(d,f);if(0<=e.value.real)return Wd(a,b,c,d,f);a=g.turnIntoCSList([l.sub(d.value[1],f.value[1]),l.sub(f.value[0],d.value[0]),l.zero]);e=g.scalproduct(d,a);0>e.value.real&&(a=g.neg(a));0>b?(b=2*b+1,c=b*b,e=.25/(1+c),c=l.complex(2*b*e+.25,(1-c)*e)):(b=2*b-1,c=b*b,e=.25/(1+c),c=l.complex(2*b*e+.75,(1-c)*e));var h=l.sub(l.real(1),c);b=l.mult(c,c);e=l.mult(h,h);c=l.mult(c,
+h);d=g.scalmult(e,d);d=g.add(d,g.scalmult(c,a));return d=g.add(d,g.scalmult(b,f))};m.PointOnCircle.updatePosition=function(a){var b=ha(3);ea(b);var c=r.csnames[a.args[0]];b=g.productMV(c.matrix,b);c=m._helper.IntersectLC(b,c.matrix);c=mb(c[0],c[1]);b=g.normalizeMax(c.value[0]);a.homog=u.withUsage(b,"Point");a.antipodalPoint=c.value[1]};m.PointOnCircle.getRandomMove=m._helper.getRandPointMove;m.PointOnCircle.stateSize=6+mb.stateSize;m.PointOnCircle.get_angle=function(a){var b=m._helper.CenterOfCircle(r.csnames[a.args[0]].matrix),
+c=g._helper.isAlmostFarpoint;if(c(a.homog)||c(b))return h;a=g.normalizeZ(a.homog);b=g.normalizeZ(b);b=g.sub(a,b);b=l.arctan2(b.value[0],b.value[1]);a=l.real(Hc);b=l.mod(l.add(b,a),a);return u.withUsage(b,"Angle")};m.PointOnCircle.set_angle=function(a,b){if("number"===b.ctype){var e=r.csnames[a.args[0]],c=m._helper.CenterOfCircle(e.matrix);if(!g._helper.isAlmostFarpoint(c)){c=g.normalizeZ(c);var d=l.cos(b);b=l.sin(b);e=g.turnIntoCSList([l.mult(d,e.radius),l.mult(b,e.radius),l.real(0)]);Ta(a,g.add(c,
+e),"homog")}}return h};m.OtherPointOnCircle={};m.OtherPointOnCircle.kind="P";m.OtherPointOnCircle.signature=["P"];m.OtherPointOnCircle.signatureConstraints=function(a){return"PointOnCircle"===r.csnames[a.args[0]].type};m.OtherPointOnCircle.updatePosition=function(a){var b=r.csnames[a.args[0]].antipodalPoint;b=g.normalizeMax(b);a.homog=u.withUsage(b,"Point")};m.PointOnSegment={};m.PointOnSegment.kind="P";m.PointOnSegment.signature=["S"];m.PointOnSegment.isMovable=!0;m.PointOnSegment.initialize=function(a){var b=
+m._helper.initializePoint(a);a=m.PointOnSegment.getParamForInput(a,b);wb(a)};m.PointOnSegment.getParamForInput=function(a,b,c){a=r.csnames[a.args[0]];var e=a.homog;"mouse"===c&&Cc&&0!==Va&&(b=m._helper.snapPointToLine(b,e));c=g.turnIntoCSList([e.value[0],e.value[1],l.zero]);e=g.sub(a.startpos,a.endpos);b=g.crossratio3(e,a.startpos,a.endpos,b,c);0>b.value.real&&(b=l.complex(0,b.value.imag));1<b.value.real&&(b=l.complex(1,b.value.imag));return b};m.PointOnSegment.getParamFromState=function(a){return hc()};
+m.PointOnSegment.putParamToState=function(a,b){wb(b)};m.PointOnSegment.updatePosition=function(a){var b=hc();wb(b);var c=r.csnames[a.args[0]],d=c.startpos;c=g.sub(c.endpos,d);b=g.add(d,g.scalmult(b,c));b=g.normalizeMax(b);a.homog=u.withUsage(b,"Point")};m.PointOnSegment.getRandomMove=m._helper.getRandPointMove;m.PointOnSegment.stateSize=2;m._helper.projectPointToCircle=function(a,b){var e=m._helper.CenterOfCircle(a.matrix);e=g.normalizeMax(e);e=g.normalizeMax(g.cross(b,e));a=m._helper.IntersectLC(e,
+a.matrix);e=g.projectiveDistMinScal(b,a[0]);b=g.projectiveDistMinScal(b,a[1]);return e<b?a[0]:a[1]};m.PointOnArc={};m.PointOnArc.kind="P";m.PointOnArc.signature=["C"];m.PointOnArc.signatureConstraints=function(a){return r.csnames[a.args[0]].isArc};m.PointOnArc.isMovable=!0;m.PointOnArc.initialize=function(a){var b=m._helper.initializePoint(a);a=m.PointOnArc.getParamForInput(a,b);ea(a)};m.PointOnArc.getParamForInput=function(a,b){a=r.csnames[a.args[0]];b=m._helper.projectPointToCircle(a,b);b=g.normalizeMax(g.crossratio3harm(a.startPoint,
+a.endPoint,a.viaPoint,b,g.ii));a=l.div(b.value[0],b.value[1]);0>a.value.real&&(b=-1>a.value.real?g.realVector([1,0]):g.realVector([0,1]));return b};m.PointOnArc.getParamFromState=function(a){return ha(2)};m.PointOnArc.putParamToState=function(a,b){ea(b)};m.PointOnArc.updatePosition=function(a){var b=r.csnames[a.args[0]],c=b.startPoint,d=b.viaPoint,f=b.endPoint,h=g.ii,k=g.cross(c,h);d=g.cross(d,h);var n=g.cross(f,h);n=g.turnIntoCSList([k,n]);k=g.transpose(n);n=g.conjugate(n);k=g.productMM(n,k);d=g.productMV(n,
+d);k=g.productMV(g.adjoint2(k),d);d=k.value[0];k=k.value[1];n=ha(2);ea(n);c=g.normalizeMax(g.add(g.scalmult(l.mult(d,n.value[0]),c),g.scalmult(l.mult(k,n.value[1]),f)));b=m._helper.conicOtherIntersection(b.matrix,h,c);a.homog=u.withUsage(b,"Point")};m.PointOnArc.getRandomMove=m._helper.getRandPointMove;m.PointOnArc.stateSize=4;m._helper.CenterOfCircle=function(a){return g.turnIntoCSList([a.value[2].value[0],a.value[2].value[1],l.neg(a.value[0].value[0])])};m._helper.CenterOfConic=function(a){a=g.adjoint3(a);
+return{ctype:"list",value:[a.value[2].value[0],a.value[2].value[1],a.value[2].value[2]]}};m.CenterOfConic={};m.CenterOfConic.kind="P";m.CenterOfConic.signature=["C"];m.CenterOfConic.updatePosition=function(a){var b=m._helper.CenterOfConic(r.csnames[a.args[0]].matrix);a.homog=b;a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Point")};m._helper.CircleMP=function(a,b){var e=a.value[0],c=a.value[1];a=l.neg(a.value[2]);var d=l.zero;e=g.turnIntoCSList([g.turnIntoCSList([a,d,e]),g.turnIntoCSList([d,
+a,c]),g.turnIntoCSList([e,c,d])]);c=u.mult(u.mult(b,e),b);b=u.mult(u.mult(b,g.fund),b);c=u.mult(c,g.fund);b=u.mult(b,e);return g.sub(c,b)};m.CircleMP={};m.CircleMP.kind="C";m.CircleMP.signature=["P","P"];m.CircleMP.updatePosition=function(a){a.matrix=m._helper.CircleMP(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog);a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Circle")};m.CircleMr={};m.CircleMr.kind="C";m.CircleMr.signature=["P"];m.CircleMr.isMovable=!0;m.CircleMr.initialize=
+function(a){wb(l.real(a.radius))};m.CircleMr.getParamForInput=function(a,b,c){if("radius"===c)return b;a=r.csnames[a.args[0]].homog;a=g.normalizeZ(a);b=g.normalizeZ(b);b=g.sub(a,b);return b=g.abs(b)};m.CircleMr.getParamFromState=function(a){return hc()};m.CircleMr.putParamToState=function(a,b){wb(b)};m.CircleMr.updatePosition=function(a){var b=hc();wb(b);var c=r.csnames[a.args[0]].homog,d=l.mult(c.value[2],b);d=l.mult(d,d);if(!l._helper.isFinite(d)&&!l._helper.isNaN(d))return g.fund;c=m._helper.ScaledCircleMrr(c,
+d);a.matrix=u.withUsage(c,"Circle");a.radius=b};m.CircleMr.getRandomMove=function(a){a=a.radius;return{type:"radius",value:l.abs(a).value.real<l.eps?l.getRandComplex(.05,.1):l.mult(a,l.getRandReal(.95,1.05))}};m.CircleMr.stateSize=2;m.CircleMr.set_radius=function(a,b){"number"===b.ctype&&Ta(a,b,"radius")};m._helper.ScaledCircleMrr=function(a,b){var e=a.value[0],c=a.value[1];a=l.neg(a.value[2]);a=g.scalmult(a,g.turnIntoCSList([e,c,a])).value;e=g.turnIntoCSList([e,c]);b=l.sub(g.scalproduct(e,e),b);
+b=m._helper.buildConicMatrix([a[2],l.zero,a[2],a[0],a[1],b]);return g.normalizeMax(b)};m.Compass={};m.Compass.kind="C";m.Compass.signature=["P","P","P"];m.Compass.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=b.value[2],h=c.value[2],k=d.value[2];b=g.scalmult(l.mult(h,k),b);c=g.scalmult(l.mult(f,k),c);d=g.scalmult(l.mult(f,h),d);b=g.sub(c,b);d=m._helper.ScaledCircleMrr(d,g.scalproduct(b,b));a.matrix=u.withUsage(d,"Circle")};
+m._helper.getConicType=function(a){if(1E-16>l.abs(g.det(a)).value.real)return"degenerate";var b=l.mult(a.value[0].value[0],a.value[1].value[1]);b=l.sub(b,l.pow(a.value[0].value[1],l.real(2)));b=b.value.real;return 1E-16>Math.abs(b)?"parabola":1E-16<b?"ellipsoid":"hyperbola"};m._helper.ConicBy5=function(a,b,c,d,f,h){a=g.turnIntoCSList([g.cross(c,d)]);var e=g.turnIntoCSList([g.cross(b,f)]);b=g.turnIntoCSList([g.cross(b,c)]);d=g.turnIntoCSList([g.cross(d,f)]);return m._helper.conicFromTwoDegenerates(a,
+e,b,d,h)};m._helper.conicFromTwoDegenerates=function(a,b,c,d,f){a=u.mult(g.transpose(b),a);c=u.mult(g.transpose(d),c);a=g.add(a,g.transpose(a));c=g.add(c,g.transpose(c));d=u.mult(u.mult(f,a),f);f=u.mult(u.mult(f,c),f);c=u.mult(d,c);f=u.mult(f,a);return g.sub(c,f)};m.ConicBy5={};m.ConicBy5.kind="C";m.ConicBy5.signature=["P","P","P","P","P"];m.ConicBy5.updatePosition=function(a){var b=m._helper.ConicBy5(a,r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,
+r.csnames[a.args[4]].homog);a.matrix=b;a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Conic")};m.FreeConic={};m.FreeConic.kind="C";m.FreeConic.signature=[];m.FreeConic.initialize=function(a){var b=a.pos?m._helper.inputConic(a.pos):g.zeromatrix(l.real(3),l.real(3));m.FreeConic.putParamToState(a,b)};m.FreeConic.getParamForInput=function(a,b,c){return g.normalizeMax(b)};m.FreeConic.getParamFromState=function(a){return m._helper.buildConicMatrix(ha(6).value)};m.FreeConic.putParamToState=
+function(a,b){for(a=0;3>a;++a)for(var e=0;e<=a;++e)wb(b.value[a].value[e])};m.FreeConic.updatePosition=function(a){var b=ha(6);ea(b);a.matrix=m._helper.buildConicMatrix(b.value);a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Conic")};m.FreeConic.set_matrix=function(a,b){g._helper.isNumberMatrixMN(b,3,3)&&Ta(a,g.add(b,g.transpose(b)),"matrix")};m.FreeConic.stateSize=12;m._helper.buildConicMatrix=function(a){var b=a[1],c=a[2],d=a[3],f=a[4],h=a[5];return g.turnIntoCSList([g.turnIntoCSList([a[0],
+b,d]),g.turnIntoCSList([b,c,f]),g.turnIntoCSList([d,f,h])])};m._helper.flattenConicMatrix=function(a){return g.turnIntoCSList([a.value[0].value[0],a.value[0].value[1],a.value[1].value[1],a.value[0].value[2],a.value[1].value[2],a.value[2].value[2]])};m._helper.splitDegenConic=function(a){var b=g.adjoint3(a),c=0,d,f=l.abs2(b.value[0].value[0]).value.real;for(d=1;3>d;d++){var h=l.abs2(b.value[d].value[d]).value.real;h>f&&(c=d,f=h)}d=l.sqrt(l.mult(l.real(-1),b.value[c].value[c]));if(1E-16>l.abs2(d).value.real)return a=
+g.turnIntoCSList([l.zero,l.zero,l.zero]),[a,a];c=l.real(c+1);h=g.column(b,c);h=g.scaldiv(d,h);d=h.value[0];f=h.value[1];h=h.value[2];d=g.turnIntoCSList([g.turnIntoCSList([l.real(0),h,l.mult(l.real(-1),f)]),g.turnIntoCSList([l.mult(l.real(-1),h),l.real(0),d]),g.turnIntoCSList([f,l.mult(l.real(-1),d),l.real(0)])]);a=g.add(a,d);var k=0;for(d=f=b=0;3>d;d++)for(c=0;3>c;c++)h=l.abs2(a.value[d].value[c]).value.real,h>f&&(k=d,b=c,f=h);d=a.value[k];a=g.transpose(a);a=a.value[b];d=g.normalizeMax(d);a=g.normalizeMax(a);
+d=u.withUsage(d,"Line");a=u.withUsage(a,"Line");return[d,a]};m._helper.inputConic=function(a){var b="xx xy yy xz yz zz".split(" ").map(function(b){var e=l._helper.input(a[b]);b[0]!==b[1]&&(e=l.realmult(.5,e));return e});return m._helper.buildConicMatrix(b)};m.SelectConic={};m.SelectConic.kind="C";m.SelectConic.signature=["Cs"];m.SelectConic.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=m._helper.inputConic(a.pos);a=r.csnames[a.args[0]].results;for(var c=g.conicDist(b,a[0]),d=0,
+f=1;f<a.length;++f){var h=g.conicDist(b,a[f]);h<c&&(c=h,d=f)}return d};m.SelectConic.updatePosition=function(a){a.matrix=r.csnames[a.args[0]].results[a.param];a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Conic")};m._helper.ConicBy4p1l=function(a,b,c,d,f,h){var e=g.scalproduct(b,h),k=g.scalproduct(c,h),n=g.scalproduct(d,h),x=g.scalproduct(f,h),v=g.det3(c,d,f),p=g.det3(b,c,f),q=g.det3(b,d,f),r=g.det3(b,c,d),t=l.mult;k=l.sqrt(t(t(k,x),t(v,p)));e=l.sqrt(t(t(e,n),t(q,r)));n=g.cross(g.cross(b,
+d),h);h=g.cross(g.cross(c,f),h);n=g.scalmult(k,n);e=g.scalmult(e,h);h=g.normalizeMax(g.add(n,e));e=g.normalizeMax(g.sub(n,e));e=mb(h,e);h=m._helper.ConicBy5(a,b,c,d,f,e.value[0]);a=m._helper.ConicBy5(a,b,c,d,f,e.value[1]);return[g.normalizeMax(h),g.normalizeMax(a)]};m.ConicBy4p1l={};m.ConicBy4p1l.kind="Cs";m.ConicBy4p1l.signature=["P","P","P","P","L"];m.ConicBy4p1l.updatePosition=function(a){var b=m._helper.ConicBy4p1l(a,r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,
+r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog);a.results=b};m.ConicBy4p1l.stateSize=mb.stateSize;m._helper.ConicBy3p2l=function(a,b,c,d,f){function e(a,b,e,c){return l.sub(l.mult(a,c),l.mult(b,e))}var h=g.cross(a,b),k=g.cross(d,f);d=g.cross(d,h);f=g.cross(f,h);h=g.turnIntoCSList([d,f,k]);c=g.productVM(c,g.adjoint3(h));k=g.adjoint3(g.turnIntoCSList([g.scalmult(c.value[0],d),g.scalmult(c.value[1],f),g.scalmult(c.value[2],k)]));c=g.transpose(k);d=l.mult;f=g.productMV(c,a);a=f.value[0];f=f.value[1];
+h=g.productMV(c,b);b=h.value[0];h=h.value[1];var m=l.sqrt(d(a,f)),n=l.sqrt(d(b,h)),x,v=Array(4);for(x=0;4>x;++x){var p=(x&2)-1,q=d(l.real(((x&1)<<1)-1),m),r=d(l.real(p),n),t=e(f,q,h,r),u=e(b,r,a,q);p=e(a,f,b,h);var N=l.add(l.add(e(b,h,a,f),e(h,r,f,q)),e(r,b,q,a));q=d(t,t);r=d(u,u);var w=d(N,N),y=d(t,u);t=d(t,N);u=d(u,N);y=l.sub(y,d(l.real(.5),d(p,p)));p=g.turnIntoCSList([g.turnIntoCSList([q,y,t]),g.turnIntoCSList([y,r,u]),g.turnIntoCSList([t,u,w])]);p=g.productMM(k,g.productMM(p,c));p=g.turnIntoCSList([p.value[0].value[0],
+p.value[0].value[1],p.value[0].value[2],p.value[1].value[1],p.value[1].value[2],p.value[2].value[2]]);v[x]=p}return v};m.ConicBy3p2l={};m.ConicBy3p2l.kind="Cs";m.ConicBy3p2l.signature=["P","P","P","L","L"];m.ConicBy3p2l.updatePosition=function(a){var b=m._helper.ConicBy3p2l(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog);b=be(b);for(var c=Array(4),d=0;4>d;++d){var f=b[d].value;c[d]=g.turnIntoCSList([g.turnIntoCSList([f[0],
+f[1],f[2]]),g.turnIntoCSList([f[1],f[3],f[4]]),g.turnIntoCSList([f[2],f[4],f[5]])])}a.results=c};m.ConicBy3p2l.stateSize=48;m.ConicBy2p3l={};m.ConicBy2p3l.kind="Cs";m.ConicBy2p3l.signature=["P","P","L","L","L"];m.ConicBy2p3l.updatePosition=function(a){var b=m._helper.ConicBy3p2l(r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog,r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog);b=be(b);for(var c=Array(4),d=0;4>d;++d){var f=b[d].value;f=g.turnIntoCSList([g.turnIntoCSList([f[0],
+f[1],f[2]]),g.turnIntoCSList([f[1],f[3],f[4]]),g.turnIntoCSList([f[2],f[4],f[5]])]);c[d]=g.normalizeMax(g.adjoint3(f))}a.results=c};m.ConicBy2p3l.stateSize=48;m.ConicBy1p4l={};m.ConicBy1p4l.kind="Cs";m.ConicBy1p4l.signature=["P","L","L","L","L"];m.ConicBy1p4l.updatePosition=function(a){var b=m._helper.ConicBy4p1l(a,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog,r.csnames[a.args[0]].homog),c=b[0];b=b[1];c=g.adjoint3(c);b=g.adjoint3(b);b=
+[c,b];a.results=b};m.ConicBy1p4l.stateSize=mb.stateSize;m.ConicParabolaPL={};m.ConicParabolaPL.kind="C";m.ConicParabolaPL.signature=["P","L"];m.ConicParabolaPL.updatePosition=function(a){var b=r.csnames[a.args[0]].homog.value,c=r.csnames[a.args[1]].homog.value,d=l.mult,f=l.neg,h=l.add,k=l.sub,n=b[0],p=b[1],q=b[2],t=c[0];b=c[1];c=c[2];var w=d(q,q),y=d(t,t),z=d(b,b),A=d(q,c),B=f(q);q=h(y,z);z=d(w,z);y=d(w,y);f=d(f(w),d(t,b));t=d(B,h(d(n,q),d(A,t)));b=d(B,h(d(p,q),d(A,b)));d=k(d(h(d(n,n),d(p,p)),q),
+d(w,d(c,c)));d=m._helper.buildConicMatrix([z,f,y,t,b,d]);d=g.normalizeMax(d);a.matrix=u.withUsage(d,"Conic")};m.ConicBy2Foci1P={};m.ConicBy2Foci1P.kind="Cs";m.ConicBy2Foci1P.signature=["P","P","P"];m.ConicBy2Foci1P.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=g.ii,h=g.jj,k=g.normalizeMax(g.cross(b,d)),n=g.normalizeMax(g.cross(c,d)),p=g.normalizeMax(g.cross(d,f));d=g.normalizeMax(g.cross(d,h));n=m._helper.coHarmonic(p,d,k,n);
+k=g.normalizeMax(n[0]);n=g.normalizeMax(n[1]);f=g.turnIntoCSList([f]);p=g.turnIntoCSList([h]);d=g.turnIntoCSList([b]);var q=g.turnIntoCSList([c]);h=m._helper.conicFromTwoDegenerates(f,p,d,q,k);h=g.normalizeMax(h);f=m._helper.conicFromTwoDegenerates(f,p,d,q,n);f=g.normalizeMax(f);h=g.normalizeMax(g.adjoint3(h));f=g.normalizeMax(g.adjoint3(f));"ellipsoid"!==m._helper.getConicType(h)&&(k=h,h=f,f=k);g.almostequals(b,c).value&&(b=l.real(3),f=g.zeromatrix(b,b));a.results=[h,f]};m.ConicBy2Pol1P={};m.ConicBy2Pol1P.kind=
+"C";m.ConicBy2Pol1P.signature=["P","L","P","L","P"];m.ConicBy2Pol1P.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=r.csnames[a.args[3]].homog,h=r.csnames[a.args[4]].homog,k=g.scalproduct,m=g.scalmult,n=g.sub,p=g.productMM,q=l.realmult,t=g.transpose,w=g.turnIntoCSList,y=n(m(k(c,b),h),m(q(2,k(c,h)),b)),z=n(m(k(f,d),h),m(q(2,k(f,h)),d)),A=w([g.cross(b,h)]);h=w([g.cross(d,h)]);z=p(t(A),w([g.cross(b,z)]));w=p(t(h),w([g.cross(d,y)]));
+p=p(t(A),h);b=k(b,f);c=k(d,c);d=g.add(m(c,z),m(b,w));d=n(d,m(q(2,l.mult(b,c)),p));d=g.add(d,t(d));d=g.normalizeMax(d);d=u.withUsage(d,"Conic");a.matrix=d};m.ConicBy2Pol1L={};m.ConicBy2Pol1L.kind="C";m.ConicBy2Pol1L.signature=["P","L","P","L","L"];m.ConicBy2Pol1L.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=r.csnames[a.args[3]].homog,h=r.csnames[a.args[4]].homog,k=g.scalproduct,m=g.scalmult,n=g.productMM,p=l.mult,q=g.transpose,
+t=g.turnIntoCSList,w=k(c,b),y=k(c,d),z=k(f,b),A=k(f,d),B=k(h,b);k=k(h,d);var C=t([g.sub(m(p(z,k),c),m(p(y,B),f))]);b=g.add(n(q(t([m(p(z,y),h)])),t([g.sub(g.add(m(l.sub(p(w,k),p(y,B)),f),m(l.sub(p(A,B),p(z,k)),c)),m(g.det3(c,f,h),g.cross(b,d)))])),n(q(C),C));b=g.add(b,q(b));b=g.normalizeMax(b);b=u.withUsage(b,"Conic");a.matrix=b};m._helper.conic1Pol3Inc=function(a,b,c,d,f){var e=g.scalproduct,h=g.scalmult,k=g.productMM,m=g.cross,n=l.realmult,x=l.mult,p=g.transpose,v=g.turnIntoCSList,q=g.det3,r=q(a,
+c,d),t=v([m(c,f)]),u=v([m(a,f)]),w=v([m(c,d)]),y=e(b,a),z=e(b,c);b=e(b,f);m=v([m(d,g.sub(h(y,f),h(n(2,b),a)))]);t=h(r,k(p(t),m));a=n(2,l.add(x(q(a,d,f),z),x(r,b)));a=l.sub(x(q(c,d,f),y),a);t=g.add(t,h(a,k(p(u),w)));t=g.add(t,p(t));return t=g.normalizeMax(t)};m.ConicBy1Pol3P={};m.ConicBy1Pol3P.kind="C";m.ConicBy1Pol3P.signature=["P","L","P","P","P"];m.ConicBy1Pol3P.updatePosition=function(a){var b=m._helper.conic1Pol3Inc(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,
+r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog);b=u.withUsage(b,"Conic");a.matrix=b};m.ConicBy1Pol3L={};m.ConicBy1Pol3L.kind="C";m.ConicBy1Pol3L.signature=["P","L","L","L","L"];m.ConicBy1Pol3L.updatePosition=function(a){var b=m._helper.conic1Pol3Inc(r.csnames[a.args[1]].homog,r.csnames[a.args[0]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog);b=g.normalizeMax(g.adjoint3(b));b=u.withUsage(b,"Conic");a.matrix=b};m.ConicBy1Pol2P1L={};m.ConicBy1Pol2P1L.kind=
+"Cs";m.ConicBy1Pol2P1L.signature=["P","L","P","P","L"];m.ConicBy1Pol2P1L.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=r.csnames[a.args[3]].homog,h=r.csnames[a.args[4]].homog,k=l.add,m=g.turnIntoCSList,n=g.cross,p=g.productMM,q=l.mult,t=l.realmult,u=g.scalmult,w=g.scalproduct,y=l.sub,z=g.transpose,A=w(c,b),B=w(c,d),C=w(c,f);c=w(h,b);var D=w(h,d);w=w(h,f);h=m([n(b,d)]);b=m([n(b,f)]);d=m([n(d,f)]);f=l.sqrt(q(q(D,w),q(y(q(A,D),
+t(2,q(c,B))),y(q(A,w),t(2,q(c,C))))));m=p(z(h),b);f=u(f,g.add(m,z(m)));k=u(y(q(A,q(D,w)),k(q(c,q(B,w)),q(c,q(D,C)))),m);t=g.add(g.sub(u(C,h),u(B,b)),u(t(.5,A),d));k=g.add(k,u(q(c,c),p(z(d),t)));k=g.add(k,z(k));p=g.normalizeMax(g.add(f,k));q=g.normalizeMax(g.sub(f,k));a.results=vc(p,q).value};m.ConicBy1Pol2P1L.stateSize=vc.stateSize;m.ConicBy1Pol1P2L={};m.ConicBy1Pol1P2L.kind="Cs";m.ConicBy1Pol1P2L.signature=["P","L","P","L","L"];m.ConicBy1Pol1P2L.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,
+c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=r.csnames[a.args[3]].homog,h=r.csnames[a.args[4]].homog,k=l.add,m=g.turnIntoCSList,n=g.cross,p=g.productMM,q=l.mult,t=l.realmult,u=g.scalmult,w=g.scalproduct,y=l.sub,z=g.transpose,A=w(c,b),B=w(c,d),C=w(f,b),D=w(f,d),E=w(h,b),F=w(h,d),G=q(A,A),H=q(A,B);w=q(B,B);var I=q(C,C),J=q(C,D),K=q(D,D),L=q(E,E),M=q(E,F),P=q(F,F),O=q(q(G,K),P);O=y(O,t(2,q(q(H,J),P)));O=y(O,t(2,q(q(H,K),M)));O=k(O,t(.5,q(q(w,I),P)));O=k(O,t(3,q(q(w,J),M)));O=k(O,t(.5,
+q(q(w,K),L)));M=q(q(A,D),F);M=y(M,q(q(B,C),F));M=y(M,q(q(B,D),E));M=q(M,q(w,E));P=y(q(A,D),t(2,q(B,C)));P=q(P,q(w,q(D,E)));O=p(z(m([c])),m([g.add(g.add(u(O,c),u(M,f)),u(P,h))]));M=m([f]);O=g.add(O,u(t(.5,q(q(w,w),L)),p(z(M),M)));O=g.add(O,u(w,p(z(m([h])),m([g.add(u(y(y(t(2,q(H,J)),q(G,K)),t(.5,q(w,I))),h),u(q(g.det3(c,f,h),y(q(A,D),q(B,C))),n(b,d)))]))));O=g.add(O,z(O));b=l.sqrt(q(q(D,F),q(y(q(A,D),t(2,q(B,C))),y(q(A,F),t(2,q(B,E))))));c=p(z(m([c])),m([g.sub(u(y(q(B,k(q(C,F),q(D,E))),q(A,q(D,F))),
+c),u(w,g.add(u(E,f),u(C,h))))]));c=g.add(c,u(q(A,w),p(z(m([f])),m([h]))));c=u(b,c);c=g.add(c,z(c));f=g.normalizeMax(g.add(O,c));h=g.normalizeMax(g.sub(O,c));a.results=vc(f,h).value};m.ConicBy1Pol1P2L.stateSize=vc.stateSize;m._helper.coHarmonic=function(a,b,c,d){var e=g.realVector([100*Math.random(),100*Math.random(),1]),f=g.det3(e,c,a),h=g.det3(e,c,b);c=g.det3(e,d,a);d=g.det3(e,d,b);d=l.sqrt(l.mult(d,h));f=l.sqrt(l.mult(c,f));a=u.mult(a,d);f=u.mult(b,f);b=g.add(a,f);a=g.sub(a,f);return[b,a]};m.ConicInSquare=
+{};m.ConicInSquare.kind="C";m.ConicInSquare.signature=["P","P","P","P"];m.ConicInSquare.updatePosition=function(a){var b=E.basismap(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog),c=l.one;c=m._helper.buildConicMatrix([c,c,c,l.real(-3),c,c]);b=g.adjoint3(b);b=g.productMM(g.productMM(g.transpose(b),c),b);b=g.normalizeMax(b);a.matrix=u.withUsage(b,"Conic")};m.ConicBy5lines={};m.ConicBy5lines.kind="C";m.ConicBy5lines.signature=["L","L","L",
+"L","L"];m.ConicBy5lines.updatePosition=function(a){var b=m._helper.ConicBy5(a,r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[4]].homog);b=g.adjoint3(b);a.matrix=b;a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Conic")};m.ConicFromPrincipalDirections={};m.ConicFromPrincipalDirections.kind="C";m.ConicFromPrincipalDirections.signature=["P","P","P"];m.ConicFromPrincipalDirections.updatePosition=function(a){var b=
+r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=m._helper.pointReflection(b,c),h=g.cross(c,b);b=g.turnIntoCSList([h.value[0],h.value[1],l.zero]);h=g.turnIntoCSList([h]);c=g.turnIntoCSList([g.cross(c,b)]);f=g.turnIntoCSList([g.cross(f,b)]);a.matrix=m._helper.conicFromTwoDegenerates(h,h,c,f,d);a.matrix=g.normalizeMax(a.matrix);a.matrix=u.withUsage(a.matrix,"Conic")};m.CircleBy3={};m.CircleBy3.kind="C";m.CircleBy3.signature=["P","P","P"];m.CircleBy3.updatePosition=
+function(a){var b=m._helper.ConicBy5(a,r.csnames[a.args[0]].homog,r.csnames[a.args[1]].homog,g.ii,g.jj,r.csnames[a.args[2]].homog);a.matrix=g.normalizeMax(b);a.matrix=u.withUsage(a.matrix,"Circle")};m.ArcBy3={};m.ArcBy3.kind="C";m.ArcBy3.signature=["P","P","P"];m.ArcBy3.updatePosition=function(a){m.CircleBy3.updatePosition(a);a.startPoint=r.csnames[a.args[0]].homog;a.viaPoint=r.csnames[a.args[1]].homog;a.endPoint=r.csnames[a.args[2]].homog};m.ArcBy3.initialize=function(a){a.startPoint=r.csnames[a.args[0]].homog;
+a.viaPoint=r.csnames[a.args[1]].homog;a.endPoint=r.csnames[a.args[2]].homog;a.isArc=!0};m.PolarOfPoint={};m.PolarOfPoint.kind="L";m.PolarOfPoint.signature=["P","C"];m.PolarOfPoint.updatePosition=function(a){var b=u.mult(r.csnames[a.args[1]].matrix,r.csnames[a.args[0]].homog);b=g.normalizeMax(b);a.homog=u.withUsage(b,"Line")};m.PolarOfLine={};m.PolarOfLine.kind="P";m.PolarOfLine.signature=["L","C"];m.PolarOfLine.updatePosition=function(a){var b=r.csnames[a.args[0]],c=g.adjoint3(r.csnames[a.args[1]].matrix);
+b=u.mult(c,b.homog);b=g.normalizeMax(b);a.homog=u.withUsage(b,"Point")};m.AngleBisector={};m.AngleBisector.kind="Ls";m.AngleBisector.signature=["L","L","P"];m.AngleBisector.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=r.csnames[a.args[2]].homog,f=g.add,h=g.sub,k=g.abs,l=g.cross,m=g.scalmult,n=g.normalizeMax,p=g._helper.isAlmostZero,q=g.linfty,t=m(k(l(l(q,c),q)),b);b=m(k(l(l(q,b),q)),c);h=h(t,b);f=f(t,b);p(h)&&(h=l(l(l(q,f),q),d));p(f)&&(f=l(l(l(q,h),q),
+d));a.results=mb(n(h),n(f))};m.AngleBisector.stateSize=mb.stateSize;m._helper.IntersectLC=function(a,b){var c=l,e=g.crossOperator(a),d=g.transpose(e);b=u.mult(d,u.mult(b,e));d=g.maxIndex(a,l.abs2);if(0===d){d=b.value[1].value[1];var f=b.value[1].value[2];var h=b.value[2].value[1];var k=b.value[2].value[2];a=a.value[0]}else 1===d?(d=b.value[0].value[0],f=b.value[0].value[2],h=b.value[2].value[0],k=b.value[2].value[2],a=a.value[1]):(d=b.value[0].value[0],f=b.value[0].value[1],h=b.value[1].value[0],
+k=b.value[1].value[1],a=a.value[2]);c=c.div(c.sqrt(c.sub(c.mult(f,h),c.mult(d,k))),a);c=g.add(b,g.scalmult(c,e));d=g.maxIndex(c,g.abs2);e=c.value[d];e=g.normalizeMax(e);e=u.withUsage(e,"Point");c=g.transpose(c);d=g.maxIndex(c,g.abs2);c=c.value[d];c=g.normalizeMax(c);c=u.withUsage(c,"Point");return[e,c]};m.IntersectLC={};m.IntersectLC.kind="Ps";m.IntersectLC.signature=["L","C"];m.IntersectLC.updatePosition=function(a){var b=m._helper.IntersectLC(r.csnames[a.args[0]].homog,r.csnames[a.args[1]].matrix);
+a.results=mb(b[0],b[1])};m.IntersectLC.stateSize=mb.stateSize;m.OtherIntersectionCL={};m.OtherIntersectionCL.kind="P";m.OtherIntersectionCL.signature=["C","L","P"];m.OtherIntersectionCL.updatePosition=function(a){var b=r.csnames[a.args[2]].homog,c=m._helper.IntersectLC(r.csnames[a.args[1]].homog,r.csnames[a.args[0]].matrix),d=c[0];c=c[1];var f=g.projectiveDistMinScal(d,b);b=g.projectiveDistMinScal(c,b);a.homog=f<b?c:d;a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Point")};m.IntersectCirCir=
+{};m.IntersectCirCir.kind="Ps";m.IntersectCirCir.signature=["C","C"];m.IntersectCirCir.updatePosition=function(a){var b=r.csnames[a.args[0]].matrix,c=r.csnames[a.args[1]].matrix,d=g.scalmult(c.value[0].value[0],b.value[2]);c=g.scalmult(b.value[0].value[0],c.value[2]);d=g.sub(d,c);d=g.turnIntoCSList([d.value[0],d.value[1],l.realmult(.5,d.value[2])]);d=g.normalizeMax(d);b=m._helper.IntersectLC(d,b);a.results=mb(b[0],b[1])};m.IntersectCirCir.stateSize=mb.stateSize;m.OtherIntersectionCC={};m.OtherIntersectionCC.kind=
+"P";m.OtherIntersectionCC.signature=["C","C","P"];m.OtherIntersectionCC.updatePosition=function(a){var b=r.csnames[a.args[0]].matrix,c=r.csnames[a.args[1]].matrix,d=r.csnames[a.args[2]].homog,f=g.scalmult(c.value[0].value[0],b.value[2]);c=g.scalmult(b.value[0].value[0],c.value[2]);f=g.sub(f,c);f=g.turnIntoCSList([f.value[0],f.value[1],l.realmult(.5,f.value[2])]);f=g.normalizeMax(f);f=m._helper.IntersectLC(f,b);b=f[0];f=f[1];c=g.projectiveDistMinScal(b,d);d=g.projectiveDistMinScal(f,d);a.homog=c<d?
+f:b;a.homog=g.normalizeMax(a.homog);a.homog=u.withUsage(a.homog,"Point")};m._helper.IntersectConicConic=function(a,b){var c=a.value[0],e=a.value[1],d=a.value[2],f=b.value[0],h=b.value[1],k=b.value[2],n=g.det3(c,e,d),p=l.add(l.add(g.det3(c,e,k),g.det3(c,h,d)),g.det3(f,e,d));c=l.add(l.add(g.det3(c,h,k),g.det3(f,e,k)),g.det3(f,h,d));f=g.det3(f,h,k);k=l.abs2(n).value.real;h=l.abs2(f).value.real;k<h&&(k=a,a=b,b=k,k=f,f=n,n=k,k=c,c=p,p=k,k=h);1E-24>k?(n=a,p=b):(p=l.solveCubic(n,p,c,f),c=l.abs2(l.sub(p[0],
+p[1])).value.real,f=l.abs2(l.sub(p[0],p[2])).value.real,h=l.abs2(l.sub(p[1],p[2])).value.real,c>f?(n=p[1],p=c>h?p[0]:p[2]):(n=p[2],p=f>h?p[0]:p[1]),n=g.add(g.scalmult(n,a),b),p=g.add(g.scalmult(p,a),b));b=m._helper.splitDegenConic(n);a=b[0];b=b[1];n=m._helper.splitDegenConic(p);c=n[0];p=n[1];n=g.cross(a,c);c=g.cross(b,c);a=g.cross(a,p);b=g.cross(b,p);n=g.normalizeMax(n);c=g.normalizeMax(c);a=g.normalizeMax(a);b=g.normalizeMax(b);n=u.withUsage(n,"Point");c=u.withUsage(c,"Point");a=u.withUsage(a,"Point");
+b=u.withUsage(b,"Point");return[n,c,a,b]};m.IntersectConicConic={};m.IntersectConicConic.kind="Ps";m.IntersectConicConic.signature=["C","C"];m.IntersectConicConic.updatePosition=function(a){var b=m._helper.IntersectConicConic(r.csnames[a.args[0]].matrix,r.csnames[a.args[1]].matrix);b=rd(b[0],b[1],b[2],b[3]);a.results=b};m.IntersectConicConic.stateSize=rd.stateSize;m.SelectP={};m.SelectP.kind="P";m.SelectP.signature=["Ps"];m.SelectP.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=
+r.csnames[a.args[0]].results.value;a=m._helper.initializePoint(a);for(var c=g.projectiveDistMinScal(a,b[0]),d=0,f=1;f<b.length;++f){var h=g.projectiveDistMinScal(a,b[f]);h<c&&(c=h,d=f)}return d};m.SelectP.updatePosition=function(a){a.homog=r.csnames[a.args[0]].results.value[a.param]};m.SelectL={};m.SelectL.kind="L";m.SelectL.signature=["Ls"];m.SelectL.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=r.csnames[a.args[0]].results.value;a=m._helper.initializeLine(a);for(var c=g.projectiveDistMinScal(a,
+b[0]),d=0,f=1;f<b.length;++f){var h=g.projectiveDistMinScal(a,b[f]);h<c&&(c=h,d=f)}return d};m.SelectL.updatePosition=function(a){a.homog=r.csnames[a.args[0]].results.value[a.param];a.homog=u.withUsage(a.homog,"Line")};m._helper.moebiusStep=function(a,b,c){var e=l.add,d=l.sub,f=l.mult,g=a.value[0],h=a.value[1];a=a.value[2];var k=b.value[0],m=b.value[1];b=b.value[2];var n=c.value[0],p=c.value[1],x=c.value[2];c=d(f(b,n),f(k,x));var q=d(f(b,p),f(m,x));n=d(f(g,x),f(a,n));p=d(f(h,x),f(a,p));return[d(f(g,
+c),f(h,q)),e(f(h,c),f(g,q)),f(a,c),f(a,q),d(f(k,n),f(m,p)),e(f(m,n),f(k,p)),f(b,n),f(b,p)]};m.TrMoebius={};m.TrMoebius.kind="Mt";m.TrMoebius.signature="PPPPPP".split("");m.TrMoebius.updatePosition=function(a){var b=l.neg,c=m._helper.moebiusStep(r.csnames[a.args[0]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[4]].homog),d=m._helper.moebiusStep(r.csnames[a.args[1]].homog,r.csnames[a.args[3]].homog,r.csnames[a.args[5]].homog);d=g.normalizeMax(g.matrix([[d[0],b(d[1]),d[4],b(d[5])],[d[1],d[0],d[5],
+d[4]],[d[2],b(d[3]),d[6],b(d[7])],[d[3],d[2],d[7],d[6]]]));b=g.normalizeMax(g.matrix([[c[6],b(c[4])],[c[7],b(c[5])],[b(c[2]),c[0]],[b(c[3]),c[1]]]));b=g.normalizeMax(g.productMM(d,b));a.moebius={anti:!1,ar:b.value[0].value[0],ai:b.value[1].value[0],br:b.value[0].value[1],bi:b.value[1].value[1],cr:b.value[2].value[0],ci:b.value[3].value[0],dr:b.value[2].value[1],di:b.value[3].value[1]};m._helper.moebiusPair(a)};m._helper.moebiusPair=function(a){var b=a.moebius,c=l.neg,d=b.anti?c:u.identity;b=g.normalizeMax(g.turnIntoCSList([g.matrix([[c(b.cr),
+d(b.ci),c(b.dr)],[b.ci,d(b.cr),b.di],[b.ar,c(d(b.ai)),b.br]]),g.matrix([[c(b.ci),c(d(b.cr)),c(b.di)],[c(b.cr),d(b.ci),c(b.dr)],[b.ai,d(b.ar),b.bi]])]));a.mat1=b.value[0];a.mat2=b.value[1]};m._helper.inverseMoebius=function(a){var b=l.neg,c=a.anti?b:u.identity;return{anti:a.anti,ar:a.dr,ai:c(a.di),br:b(a.br),bi:b(c(a.bi)),cr:b(a.cr),ci:b(c(a.ci)),dr:a.ar,di:c(a.ai)}};m.TrInverseMoebius={};m.TrInverseMoebius.kind="Mt";m.TrInverseMoebius.signature=["Mt"];m.TrInverseMoebius.updatePosition=function(a){a.moebius=
+m._helper.inverseMoebius(r.csnames[a.args[0]].moebius);m._helper.moebiusPair(a)};m.TrMoebiusP={};m.TrMoebiusP.kind="P";m.TrMoebiusP.signature=["Mt","P"];m.TrMoebiusP.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]].homog,d=g.productMV(b.mat1,c);b=g.productMV(b.mat2,c);a.homog=g.normalizeMax(g.cross(d,b));a.homog=u.withUsage(a.homog,"Point")};m._helper.TrMoebiusP=function(a,b){var c=g.productMV(b.mat1,a);a=g.productMV(b.mat2,a);return g.normalizeMax(g.cross(c,a))};m.TrMoebiusL=
+{};m.TrMoebiusL.kind="C";m.TrMoebiusL.signature=["Mt","L"];m.TrMoebiusL.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]].homog,d=function(){var a=g.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);return g.normalizeMax(a)},f=g.cross(d(),c),h=g.cross(d(),c);c=g.cross(d(),c);f=m._helper.TrMoebiusP(f,b);h=m._helper.TrMoebiusP(h,b);b=m._helper.TrMoebiusP(c,b);a.matrix=g.normalizeMax(m._helper.ConicBy5(null,f,h,b,g.ii,g.jj));a.matrix=u.withUsage(a.matrix,"Circle")};
+m.TrMoebiusS={};m.TrMoebiusS.kind="C";m.TrMoebiusS.signature=["Mt","S"];m.TrMoebiusS.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]],d=c.startpos;c=c.endpos;var f=g.add(d,c);d=m._helper.TrMoebiusP(d,b);f=m._helper.TrMoebiusP(f,b);b=m._helper.TrMoebiusP(c,b);a.startPoint=d;a.viaPoint=f;a.endPoint=b;a.isArc=!0;a.matrix=g.normalizeMax(m._helper.ConicBy5(null,d,f,b,g.ii,g.jj));a.matrix=u.withUsage(a.matrix,"Circle")};m.TrMoebiusC={};m.TrMoebiusC.kind="C";m.TrMoebiusC.signature=
+["Mt","C"];m.TrMoebiusC.signatureConstraints=function(a){return"Circle"===r.csnames[a.args[1]].matrix.usage};m.TrMoebiusC.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]].matrix,d=function(){var a=g.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);return g.normalizeMax(a)},f=m._helper.IntersectLC(d(),c);d=m._helper.IntersectLC(d(),c);c=f[1];d=d[1];f=m._helper.TrMoebiusP(f[0],b);c=m._helper.TrMoebiusP(c,b);b=m._helper.TrMoebiusP(d,b);a.matrix=g.normalizeMax(m._helper.ConicBy5(null,
+f,c,b,g.ii,g.jj));a.matrix=u.withUsage(a.matrix,"Circle")};m.TrMoebiusArc={};m.TrMoebiusArc.kind="C";m.TrMoebiusArc.signature=["Mt","C"];m.TrMoebiusArc.signatureConstraints=function(a){return r.csnames[a.args[1]].isArc};m.TrMoebiusArc.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]],d=c.viaPoint,f=c.endPoint;c=m._helper.TrMoebiusP(c.startPoint,b);d=m._helper.TrMoebiusP(d,b);b=m._helper.TrMoebiusP(f,b);a.startPoint=c;a.viaPoint=d;a.endPoint=b;a.isArc=!0;a.matrix=g.normalizeMax(m._helper.ConicBy5(null,
+c,d,b,g.ii,g.jj));a.matrix=u.withUsage(a.matrix,"Circle")};m._helper.trBuildMatrix=function(a,b){var c=b(0);b=b(1);var e=g.productMM(b,g.adjoint3(c));a.matrix=g.normalizeMax(e);e=g.transpose(g.productMM(c,g.adjoint3(b)));a.dualMatrix=g.normalizeMax(e)};m.TrProjection={};m.TrProjection.kind="Tr";m.TrProjection.signature="PPPPPPPP".split("");m.TrProjection.initialize=function(a){a.isEuclidean=0};m.TrProjection.updatePosition=function(a){m._helper.trBuildMatrix(a,function(b){return E.basismap(r.csnames[a.args[0+
+b]].homog,r.csnames[a.args[2+b]].homog,r.csnames[a.args[4+b]].homog,r.csnames[a.args[6+b]].homog)})};m.TrAffine={};m.TrAffine.kind="Tr";m.TrAffine.signature="PPPPPP".split("");m.TrAffine.initialize=function(a){a.isEuclidean=0};m.TrAffine.updatePosition=function(a){var b=l.mult,c=g.scalmult,d=g.turnIntoCSList,f=g.transpose,h=g.normalizeMax,k=g.productMM,m=g.adjoint3,n=d([r.csnames[a.args[0]].homog,r.csnames[a.args[2]].homog,r.csnames[a.args[4]].homog]),p=d([r.csnames[a.args[1]].homog,r.csnames[a.args[3]].homog,
+r.csnames[a.args[5]].homog]),q=f(n);f=f(p);var t=q.value[2].value,u=f.value[2].value,w=[b(t[0],u[2]),b(t[1],u[0]),b(t[2],u[1])];q=m(q).value;a.matrix=h(k(f,d([c(b(w[0],u[1]),q[0]),c(b(w[1],u[2]),q[1]),c(b(w[2],u[0]),q[2])])));q=n.value;a.dualMatrix=h(k(m(p),d([c(b(t[2],w[1]),q[0]),c(b(t[0],w[2]),q[1]),c(b(t[1],w[0]),q[2])])))};m.TrSimilarity={};m.TrSimilarity.kind="Tr";m.TrSimilarity.signature=["P","P","P","P"];m.TrSimilarity.initialize=function(a){a.isEuclidean=1};m.TrSimilarity.updatePosition=function(a){m._helper.trBuildMatrix(a,
+function(b){return E.basismap(r.csnames[a.args[0+b]].homog,r.csnames[a.args[2+b]].homog,g.ii,g.jj)})};m.TrTranslation={};m.TrTranslation.kind="Tr";m.TrTranslation.signature=["P","P"];m.TrTranslation.initialize=function(a){a.isEuclidean=1};m.TrTranslation.updatePosition=function(a){var b=r.csnames[a.args[0]].homog,c=r.csnames[a.args[1]].homog,d=g.cross(b,c).value;b=l.mult(b.value[2],c.value[2]);c=g.turnIntoCSList;var f=l.neg,h=l.zero;d=c([c([b,h,d[1]]),c([h,b,f(d[0])]),c([h,h,b])]);d=g.normalizeMax(d);
+a.matrix=d;b=f(d.value[0].value[0]);d=c([c([b,h,h]),c([h,b,h]),c([d.value[0].value[2],d.value[1].value[2],b])]);a.dualMatrix=d};m.TrRotationPNumb={};m.TrRotationPNumb.kind="Tr";m.TrRotationPNumb.signature=["P","V"];m.TrRotationPNumb.updatePosition=function(a){var b=r.csnames[a.args[0]].homog.value,c=r.csnames[a.args[1]].value,d=l.mult,f=l.add,h=l.sub,k=g.turnIntoCSList,m=g.normalizeMax,n=l.zero,p=b[0],q=b[1];b=b[2];var t=l.cos(c),u=l.sin(c),w=h(l.real(1),t);c=d(w,p);w=d(w,q);p=d(u,p);q=d(u,q);t=d(t,
+b);d=d(u,b);u=l.neg(d);a.matrix=m(k([k([t,u,f(c,q)]),k([d,t,h(w,p)]),k([n,n,b])]));a.dualMatrix=m(k([k([t,u,n]),k([d,t,n]),k([h(c,q),f(w,p),b])]))};m.TrReflectionP={};m.TrReflectionP.kind="Tr";m.TrReflectionP.signature=["P"];m.TrReflectionP.initialize=function(a){a.isEuclidean=1};m.TrReflectionP.updatePosition=function(a){var b=r.csnames[a.args[0]].homog.value,c=l.realmult(-.5,b[2]),d=l.zero;b=g.turnIntoCSList([g.turnIntoCSList([c,d,b[0]]),g.turnIntoCSList([d,c,b[1]]),g.turnIntoCSList([d,d,l.neg(c)])]);
+b=g.normalizeMax(b);a.matrix=b;a.dualMatrix=g.transpose(b)};m.TrReflectionL={};m.TrReflectionL.kind="Tr";m.TrReflectionL.signature=["L"];m.TrReflectionL.initialize=function(a){a.isEuclidean=-1};m.TrReflectionL.updatePosition=function(a){var b=l.mult,c=l.realmult,d=l.zero,f=r.csnames[a.args[0]].homog.value,h=f[0],k=f[1];f=f[2];var m=b(h,h),n=b(k,k),p=c(-.5,l.sub(m,n)),q=b(h,k);b=g.turnIntoCSList([g.turnIntoCSList([l.neg(p),q,b(h,f)]),g.turnIntoCSList([q,p,b(k,f)]),g.turnIntoCSList([d,d,c(-.5,l.add(m,
+n))])]);b=g.normalizeMax(b);a.matrix=b;a.dualMatrix=g.transpose(b)};m.TrReflectionS={};m.TrReflectionS.kind="Tr";m.TrReflectionS.signature=["S"];m.TrReflectionS.updatePosition=m.TrReflectionL.updatePosition;m.TrReflectionC={};m.TrReflectionC.kind="Mt";m.TrReflectionC.signature=["C"];m.TrReflectionC.signatureConstraints=function(a){return"Circle"===r.csnames[a.args[0]].matrix.usage};m.TrReflectionC.updatePosition=function(a){var b=r.csnames[a.args[0]].matrix,c=b.value[0].value[2],d=b.value[1].value[2],
+f=l.neg;a.moebius={anti:!0,ar:c,ai:d,br:b.value[2].value[2],bi:l.zero,cr:f(b.value[0].value[0]),ci:l.zero,dr:f(c),di:d};m._helper.moebiusPair(a)};m.TrInverse={};m.TrInverse.kind="Tr";m.TrInverse.signature=["Tr"];m.TrInverse.initialize=function(a){a.isEuclidean=r.csnames[a.args[0]].isEuclidean};m.TrInverse.updatePosition=function(a){var b=r.csnames[a.args[0]];a.dualMatrix=g.transpose(b.matrix);a.matrix=g.transpose(b.dualMatrix)};m.TransformC={};m.TransformC.kind="C";m.TransformC.signature=["Tr","C"];
+m.TransformC.updatePosition=function(a){var b=r.csnames[a.args[0]].dualMatrix;b=g.productMM(g.productMM(b,r.csnames[a.args[1]].matrix),g.transpose(b));b=g.normalizeMax(b);a.matrix=u.withUsage(b,"Conic")};m.TransformArc={};m.TransformArc.kind="C";m.TransformArc.signature=["Tr","C"];m.TransformArc.signatureConstraints=function(a){return r.csnames[a.args[0]].isArc};m.TransformArc.updatePosition=function(a){var b=r.csnames[a.args[0]].matrix,c=r.csnames[a.args[1]],d=c.viaPoint,f=c.endPoint;c=g.normalizeMax(g.productMV(b,
+c.startPoint));d=g.normalizeMax(g.productMV(b,d));b=g.normalizeMax(g.productMV(b,f));a.startPoint=c;a.viaPoint=d;a.endPoint=b;a.isArc=!0;a.matrix=g.normalizeMax(m._helper.ConicBy5(null,c,d,b,g.ii,g.jj));a.matrix=u.withUsage(a.matrix,"Circle")};m.TransformP={};m.TransformP.kind="P";m.TransformP.signature=["Tr","P"];m.TransformP.updatePosition=function(a){a.homog=g.normalizeMax(g.productMV(r.csnames[a.args[0]].matrix,r.csnames[a.args[1]].homog));a.homog=u.withUsage(a.homog,"Point")};m.TransformL={};
+m.TransformL.kind="L";m.TransformL.signature=["Tr","L"];m.TransformL.updatePosition=function(a){a.homog=g.normalizeMax(g.productMV(r.csnames[a.args[0]].dualMatrix,r.csnames[a.args[1]].homog));a.homog=u.withUsage(a.homog,"Line")};m.TransformS={};m.TransformS.kind="S";m.TransformS.signature=["Tr","S"];m.TransformS.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]];m.Segment.setSegmentPos(a,g.productMV(b.dualMatrix,c.homog),g.productMV(b.matrix,c.startpos),g.productMV(b.matrix,
+c.endpos))};m.TransformPolygon={};m.TransformPolygon.kind="Poly";m.TransformPolygon.signature=["Tr","Poly"];m.TransformPolygon.updatePosition=function(a){var b=r.csnames[a.args[0]].matrix;a.vertices=g.turnIntoCSList(r.csnames[a.args[1]].vertices.value.map(function(a){a=g.normalizeMax(g.productMV(b,a));return a=u.withUsage(a,"Point")}))};m.TrComposeTrTr={};m.TrComposeTrTr.kind="Tr";m.TrComposeTrTr.signature=["Tr","Tr"];m.TrComposeTrTr.initialize=function(a){a.isEuclidean=r.csnames[a.args[0]].isEuclidean*
+r.csnames[a.args[1]].isEuclidean};m.TrComposeTrTr.updatePosition=function(a){var b=r.csnames[a.args[0]],c=r.csnames[a.args[1]];a.matrix=g.normalizeMax(g.productMM(c.matrix,b.matrix));a.dualMatrix=g.normalizeMax(g.productMM(c.dualMatrix,b.dualMatrix))};m._helper.composeMtMt=function(a,b,c){function e(a,b,c,e){return h(n(a,b),n(c,e))}function d(a,b,c,d,f,g,k,l){return h(e(a,b,c,d),e(f,g,k,l))}function f(a,b,c,d,f,g,h,l){return k(e(a,b,c,d),e(f,g,h,l))}var h=l.add,k=l.sub,n=l.mult,p=c.anti?f:d,q=c.anti?
+d:f;p=g.normalizeMax(g.turnIntoCSList([q(b.ar,c.ar,b.cr,c.br,b.ai,c.ai,b.ci,c.bi),p(b.ar,c.ai,b.cr,c.bi,b.ai,c.ar,b.ci,c.br),q(b.br,c.ar,b.dr,c.br,b.bi,c.ai,b.di,c.bi),p(b.br,c.ai,b.dr,c.bi,b.bi,c.ar,b.di,c.br),q(b.ar,c.cr,b.cr,c.dr,b.ai,c.ci,b.ci,c.di),p(b.ar,c.ci,b.cr,c.di,b.ai,c.cr,b.ci,c.dr),q(b.br,c.cr,b.dr,c.dr,b.bi,c.ci,b.di,c.di),p(b.br,c.ci,b.dr,c.di,b.bi,c.cr,b.di,c.dr)])).value;a.moebius={anti:b.anti!==c.anti,ar:p[0],ai:p[1],br:p[2],bi:p[3],cr:p[4],ci:p[5],dr:p[6],di:p[7]};m._helper.moebiusPair(a)};
+m._helper.euc2moeb=function(a){var b=a.matrix.value;return{anti:0>a.isEuclidean,ar:b[0].value[0],ai:b[1].value[0],br:b[0].value[2],bi:b[1].value[2],cr:l.zero,ci:l.zero,dr:b[2].value[2],di:l.zero}};m.TrComposeMtMt={};m.TrComposeMtMt.kind="Mt";m.TrComposeMtMt.signature=["Mt","Mt"];m.TrComposeMtMt.updatePosition=function(a){m._helper.composeMtMt(a,r.csnames[a.args[0]].moebius,r.csnames[a.args[1]].moebius)};m.TrComposeTrMt={};m.TrComposeTrMt.kind="Mt";m.TrComposeTrMt.signature=["Tr","Mt"];m.TrComposeTrMt.signatureConstraints=
+function(a){return!!r.csnames[a.args[0]].isEuclidean};m.TrComposeTrMt.updatePosition=function(a){m._helper.composeMtMt(a,m._helper.euc2moeb(r.csnames[a.args[0]]),r.csnames[a.args[1]].moebius)};m.TrComposeMtTr={};m.TrComposeMtTr.kind="Mt";m.TrComposeMtTr.signature=["Mt","Tr"];m.TrComposeMtTr.signatureConstraints=function(a){return!!r.csnames[a.args[1]].isEuclidean};m.TrComposeMtTr.updatePosition=function(a){m._helper.composeMtMt(a,r.csnames[a.args[0]].moebius,m._helper.euc2moeb(r.csnames[a.args[1]]))};
+m._helper.pointReflection=function(a,b){return g.normalizeMax(g.sub(g.scalmult(l.realmult(2,b.value[2]),a),g.scalmult(a.value[2],b)))};m._helper.conicOtherIntersection=function(a,b,c){var e=g.productMV(a,c);a=g.scalproduct(c,e);e=g.scalproduct(b,e);e=l.realmult(-2,e);b=g.scalmult(a,b);c=g.scalmult(e,c);c=g.add(b,c);return c=g.normalizeMax(c)};m.Dist={};m.Dist.kind="V";m.Dist.signature=["P","P"];m.Dist.updatePosition=function(a){var b=r.csnames[a.args[1]].homog;a.value=g.abs(g.sub(g.normalizeZ(r.csnames[a.args[0]].homog),
+g.normalizeZ(b)))};m.Angle={};m.Angle.kind="V";m.Angle.signature=["L","L","P"];m.Angle.initialize=function(a){void 0===a.angle&&(a.angle=.5*Math.PI);wb(l._helper.input(a.angle))};m.Angle.updatePosition=function(a){var b=r.csnames[a.args[1]].homog,c=r.csnames[a.args[2]].homog,d=g.cross(r.csnames[a.args[0]].homog,g.linfty);b=g.cross(b,g.linfty);c=g.crossratio3(d,b,g.ii,g.jj,c);c=l.mult(l.complex(0,.5),l.log(c));d=(hc().value.real-c.value.real)/Math.PI;b=Math.round(d);!lc&&.01<Math.abs(b-d)&&uc();c=
+l.complex(b*Math.PI+c.value.real,c.value.imag);wb(c);a.value=u.withUsage(c,"Angle")};m.Angle.stateSize=2;m.Text={};m.Text.kind="Text";m.Text.signature="**";m.Text.isMovable=!0;m.Text.updatePosition=fb;m.Text.initialize=function(a){a.text=String(a.text);a.pos&&(a.homog=m._helper.initializePoint(a));a.dock&&(a.dock.offset=a.dock.offset&&2===a.dock.offset.length?g.realVector([+a.dock.offset[0],+a.dock.offset[1]]):g.realVector([0,0]))};m.Text.getParamForInput=function(a,b,c){return m.Free.getParamForInput(a,
+b,c)};m.Text.getParamFromState=function(a){return a.homog};m.Text.putParamToState=function(a,b){a.homog=b};m.Calculation={};m.Calculation.kind="Text";m.Calculation.signature="**";m.Calculation.isMovable=!0;m.Calculation.updatePosition=fb;m.Calculation.initialize=function(a){m.Text.initialize(a);a.calculation=lb(a.text)};m.Calculation.getText=function(a){return da(w(a.calculation))};m.Calculation.getParamForInput=m.Text.getParamForInput;m.Calculation.getParamFromState=m.Text.getParamFromState;m.Calculation.putParamToState=
+m.Text.putParamToState;m.Equation={};m.Equation.kind="Text";m.Equation.isMovable=!0;m.Equation.signature="**";m.Equation.updatePosition=fb;m.Equation.initialize=function(a){m.Text.initialize(a);a.calculation=lb(a.text)};m.Equation.getText=function(a){return a.text+" = "+da(w(a.calculation))};m.Equation.getParamForInput=m.Text.getParamForInput;m.Equation.getParamFromState=m.Text.getParamFromState;m.Equation.putParamToState=m.Text.putParamToState;m.Evaluate={};m.Evaluate.kind="Text";m.Evaluate.isMovable=
+!0;m.Evaluate.signature="**";m.Evaluate.updatePosition=fb;m.Evaluate.initialize=function(a){m.Text.initialize(a);a.calculation=lb(a.text)};m.Evaluate.getText=function(a){w(a.calculation);return a.text};m.Evaluate.getParamForInput=m.Text.getParamForInput;m.Evaluate.getParamFromState=m.Text.getParamFromState;m.Evaluate.putParamToState=m.Text.putParamToState;m.Plot={};m.Plot.kind="Text";m.Plot.isMovable=!0;m.Plot.signature="**";m.Plot.updatePosition=fb;m.Plot.initialize=function(a){m.Text.initialize(a);
+a.calculation=lb("plot(("+a.text+"))")};m.Plot.getText=function(a){w(a.calculation);return a.text};m.Plot.getParamForInput=m.Text.getParamForInput;m.Plot.getParamFromState=m.Text.getParamFromState;m.Plot.putParamToState=m.Text.putParamToState;m.Button={};m.Button.kind="Text";m.Button.signature="**";m.Button.isMovable=!0;m.Button.updatePosition=fb;m.Button.initialize=function(a){var b=document.createElement("button");Uc(a,"click",b)};m.Button.getParamForInput=m.Text.getParamForInput;m.Button.getParamFromState=
+m.Text.getParamFromState;m.Button.putParamToState=m.Text.putParamToState;m.Button.set_fillcolor=function(a,b){g._helper.isNumberVecN(b,3)&&(a.fillcolor=b.value.map(function(a){return a.value.real}),a.html.style.backgroundColor=y.makeColor(a.fillcolor,a.fillalpha))};m.Button.set_color=function(a,b){g._helper.isNumberVecN(b,3)&&(a.color=b.value.map(function(a){return a.value.real}),a.html.style.color=y.makeColor(a.color,a.alpha))};m.ToggleButton={};m.ToggleButton.kind="Text";m.ToggleButton.signature=
+"**";m.ToggleButton.isMovable=!0;m.ToggleButton.updatePosition=fb;m.ToggleButton.initialize=function(a){var b=void 0;void 0===b&&(b="CindyJSid");b+=++X;var c=document.createElement("input"),d=document.createElement("label");c.setAttribute("id",b);d.setAttribute("for",b);c.setAttribute("type","checkbox");a.pressed&&(c.checked=!0);a.checkbox=c;Uc(a,"change",c,d)};m.ToggleButton.get_text=function(a){return u.string(String(a.text))};m.ToggleButton.set_currenttext=function(a,b){a.html.value=a.text=da(b)};
+m.ToggleButton.getParamForInput=m.Text.getParamForInput;m.ToggleButton.getParamFromState=m.Text.getParamFromState;m.ToggleButton.putParamToState=m.Text.putParamToState;m.ToggleButton.set_fillcolor=m.Button.set_fillcolor;m.ToggleButton.set_color=m.Button.set_color;m.ToggleButton.set_text=m.ToggleButton.set_currenttext;m.ToggleButton.get_val=m.ToggleButton.get_text;m.ToggleButton.set_val=m.ToggleButton.set_currenttext;m.EditableText={};m.EditableText.kind="Text";m.EditableText.isMovable=!0;m.EditableText.signature=
+[];m.EditableText.updatePosition=fb;m.EditableText.initialize=function(a){var b=document.createElement("input");b.setAttribute("type","text");b.className="CindyJS-editabletext";$a(a.minwidth)&&(b.style.width=a.minwidth-3+"px");"string"===typeof a.text&&(b.value=a.text);b.addEventListener("keydown",function(c){13===c.keyCode&&(a.text=a.html.value,b.blur())});b.addEventListener("change",function(b){a.text=a.html.value});Uc(a,"change",b)};m.EditableText.getText=function(a){return!1};m.EditableText.getParamForInput=
+m.Text.getParamForInput;m.EditableText.getParamFromState=m.Text.getParamFromState;m.EditableText.putParamToState=m.Text.putParamToState;m.EditableText.set_fillcolor=m.Button.set_fillcolor;m.EditableText.set_color=m.Button.set_color;m.EditableText.get_currenttext=function(a){return u.string(String(a.html.value))};m.EditableText.get_text=m.ToggleButton.get_text;m.EditableText.set_currenttext=m.ToggleButton.set_currenttext;m.EditableText.set_text=m.EditableText.set_currenttext;m.EditableText.get_val=
+m.EditableText.get_text;m.EditableText.set_val=m.EditableText.set_currenttext;m._helper.initializePoint=function(a){var b=0,c=0,d=0;if(a.pos){if("list"===a.pos.ctype&&g.isNumberVector(a.pos))return a.pos;2===a.pos.length&&(b=a.pos[0],c=a.pos[1],d=1);3===a.pos.length&&(b=a.pos[0],c=a.pos[1],d=a.pos[2])}a=g.turnIntoCSList([l._helper.input(b),l._helper.input(c),l._helper.input(d)]);return a=g.normalizeMax(a)};m._helper.initializeLine=function(a){var b=0,c=0,d=0;if(a.pos){if("list"===a.pos.ctype&&g.isNumberVector(a.pos))return a.pos;
+3===a.pos.length&&(b=a.pos[0],c=a.pos[1],d=a.pos[2])}a=g.turnIntoCSList([l._helper.input(b),l._helper.input(c),l._helper.input(d)]);return a=g.normalizeMax(a)};m.Poly={};m.Poly.kind="Poly";m.Poly.signature="P*";m.Poly.updatePosition=function(a){a.vertices=g.turnIntoCSList(a.args.map(function(a){return r.csnames[a].homog}))};var la=null;m.IFS={};m.IFS.kind="IFS";m.IFS.signature="**";m.IFS.signatureConstraints=function(a){for(var b=0;b<a.args.length;++b){var c=r.csnames[a.args[b]].kind;if("Tr"!==c&&
+"Mt"!==c)return!1}return 0<a.args.length};m.IFS.initialize=function(a){if(la)la.dirty=!0;else if(a=Ia.getBaseDir(),!1!==a){la={dirty:!1,params:{generation:0}};var b=la.worker=new Worker(a+"ifs.js");b.onmessage=function(a){la.img&&"function"===typeof la.img.close&&la.img.close();if(!Fc){a=a.data;if(a.generation===la.params.generation){if(a.buffer){la.canvas||(la.canvas=document.createElement("canvas"),la.ctx=la.canvas.getContext("2d"));la.canvas.width=a.width;la.canvas.height=a.height;var c=new Uint8ClampedArray(a.buffer,
+a.imgPtr,a.width*a.height*4);c=new ImageData(c,a.width,a.height);la.ctx.putImageData(c,0,0);la.img=la.canvas}else la.img=a.img;k()}else la.img=null;a.buffer?b.postMessage({cmd:"next",buffer:a.buffer},[a.buffer]):b.postMessage({cmd:"next"})}};Db.push(b.terminate.bind(b))}};m.IFS.updatePosition=function(a){la.dirty=!0};m.IFS.updateParameters=function(){if(la.worker){var a={cmd:"init",generation:la.params.generation,width:Math.round(4*ma),height:Math.round(4*pa)};a.systems=r.ifs.map(function(a){var b=
+0,c,e=a.ifs||[],d=a.args.map(function(a,b){a=e[b]||{};return{prob:a.prob||1,color:a.color||[0,0,0]}});for(c=0;c<d.length;++c)b+=d[c].prob;c=g.realMatrix([[1,0,0],[0,1,0],[0,0,4]]);var f=g.productMM(C.toMat(),c);for(c=0;c<a.args.length;++c){var h=r.csnames[a.args[c]],k=h.kind,n=d[c];n.kind=k;n.prob/=b;if("Tr"===k)h=g.normalizeMax(g.productMM(g.adjoint3(f),g.productMM(h.matrix,f))),g._helper.isAlmostReal(h)?n.mat=h.value.map(function(a){return a.value.map(function(a){return a.value.real})}):n.kind=
+"cplx";else if("Mt"===k){k=C.drawingstate.matrix;k={anti:0<k.det,ar:l.real(k.a),ai:l.real(k.c),br:l.real(k.tx),bi:l.real(-k.ty),cr:l.zero,ci:l.zero,dr:l.real(.25),di:l.zero};var p={};m._helper.composeMtMt(p,h.moebius,k);k=m._helper.inverseMoebius(k);m._helper.composeMtMt(p,k,p.moebius);k=p.moebius;k=g.turnIntoCSList([k.ar,k.ai,k.br,k.bi,k.cr,k.ci,k.dr,k.di]);g._helper.isAlmostReal(k)?(k=k.value,n.moebius={ar:k[0].value.real,ai:k[1].value.real,br:k[2].value.real,bi:k[3].value.real,cr:k[4].value.real,
+ci:k[5].value.real,dr:k[6].value.real,di:k[7].value.real,sign:h.moebius.anti?-1:1}):n.kind="cplx"}}return{trafos:d}});u.deeplyEqual(a,la.params)||(++a.generation,la.img=null,la.params=a,la.mat=C.drawingstate.matrix,la.worker.postMessage(a))}};m.IFS.probSetter=function(a,b,c){"number"===c.ctype&&(b.ifs[a].prob=c.value.real,la.dirty=!0)};(function(){for(var a=0;10>a;++a)m.IFS["set_prob"+a]=m.IFS.probSetter.bind(null,a)})();m._helper.snapPointToLine=function(a,b){if(l._helper.isAlmostZero(a.value[2]))return a;
+var c=m._helper.projectPointToLine(a,b);c=g.normalizeZ(c);var e=c.value[0].value.real;c=c.value[1].value.real;var d=Math.round(e/Va)*Va,f=Math.round(c/Va)*Va,h=g.realVector([d,f,1]);Math.abs(d-e)<Tb&&Math.abs(f-c)<Tb&&l._helper.isAlmostZero(g.scalproduct(b,h))&&(a=m._helper.projectPointToLine(h,b));return a};var ed={CircleByRadius:"CircleMr",IntersectionCircleCircle:"IntersectCirCir",IntersectionConicConic:"IntersectConicConic",FreePoint:"Free",Orthogonal:"Perp",Parallel:"Para",Pole:"PolarOfLine",
+Polar:"PolarOfPoint",Arc:"ArcBy3",EuclideanMid:"Mid",AngularBisector:"AngleBisector",TransformConic:"TransformC",TransformSegment:"TransformS",TrMoebiusSegment:"TrMoebiusS",ReflectCC:"TrMoebiusC",ReflectCL:"TrMoebiusL",ReflectCP:"TrMoebiusP",ReflectCArc:"TrMoebiusArc",ReflectCS:"TrMoebiusS",TrMoebiusCircle:"TrMoebiusC"},Ee={CircleMFixedr:function(a){a.pinned=!0;a.type="CircleMr";return[a]},CircleByFixedRadius:function(a){a.pinned=!0;a.type="CircleMr";return[a]},IntersectionConicLine:function(a){a.args=
+[a.args[1],a.args[0]];a.type="IntersectLC";return[a]},angleBisector:function(a){var b={name:a.name+"_Intersection",type:"Meet",args:a.args,visible:!1};a.type="AngleBisector";a.args=[a.args[0],a.args[1],b.name];return[b,a]},Transform:function(a){var b=r.csnames[a.args[1]];b={Tr:"Transform",Mt:"TrMoebius"}[r.csnames[a.args[0]].kind]+(b.isArc?"Arc":b.kind);if(m.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");return[]},TrReflection:function(a){var b="TrReflection"+r.csnames[a.args[0]].kind;
+if(m.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");return[]},TrCompose:function(a){var b="TrCompose"+a.args.map(function(a){return r.csnames[a].kind}).join("");if(m.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");return[]}},Ze="align alpha angle args arrow arrowposition arrowshape arrowsides arrowsize clip color dashtype drawtrace fillalpha fillcolor filled labeled labelpos name overhang pinned printname radius size text text_fontfamily textbold textitalics textsize tracedim tracelength traceskip tracing type visible".split(" ");
+La.saveState=function(){return{geometry:te()}};var cb={};var $e=[[],[.2],[.075,.225],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]];var ke=[0,.2,.3,.8,8/9,1,1];var af=[35/384,0,500/1113,125/192,-2187/6784,11/84,0];var bf=[5179/57600,0,7571/16695,.6140625,-92097/339200,187/2100,.025];var qb,Ca=[],He=[],Ce=!1;cb.tick=function(a){a/=zc;for(var b=0;b<zc;b++)cb.tick1(a),yc+=a,w(V.simulationstep)};
+cb.tick1=function(a){for(var b=a,c=0;0<a&&c<.999*a||0>a&&c>.999*a;)b=cb.oneRKStep(b),c+=b,b=Math.min(2*b,a-c),b=Math.max(b,1E-16),cb.restorePosition(),cb.doCollisions(),cb.calculateForces(),cb.moveToFinalPos();return!0};cb.restorePosition=function(){qb.forEach(function(a){W[a.type].restorePos(a,9)})};cb.doCollisions=function(){qb.forEach(function(a){W[a.type].doCollisions(a)})};cb.calculateForces=function(){qb.forEach(function(a){W[a.type].calculateForces(a)})};cb.moveToFinalPos=function(){qb.forEach(function(a){W[a.type].move(a)})};
+cb.oneRKStep=function(a){for(var b=function(a){qb.forEach(function(b){W[b.type].initRK(b,a);W[b.type].storePosition(b)})},c=function(a){qb.forEach(function(b){W[b.type].setToTimestep(b,ke[a])})},d=function(a){qb.forEach(function(b){W[b.type].proceedMotion(b,ke[a],a,$e[a])})},f=function(){qb.forEach(function(a){W[a.type].resetForces(a)})},g=function(a){qb.forEach(function(b){W[b.type].calculateDelta(b,a)})},h=function(b){var c=0;qb.forEach(function(a){W[a.type].proceedMotion(a,ke[6],7,af);W[a.type].savePos(a,
+8);W[a.type].proceedMotion(a,ke[6],7,bf);W[a.type].savePos(a,9);c+=W[a.type].sqDist(a,8,9)});return c=Math.sqrt(c)/a},k=function(a){qb.forEach(function(a){W[a.type].recallPosition(a)})},l=!1;!l;){b(a);for(var m=0;7>m;m++)c(m),d(m),f(),cb.calculateForces(),g(m);h(a)>W.env.errorbound&&a>W.env.lowestdeltat?(a/=W.env.slowdownfactor,k()):l=!0}return a};var W={Mass:{reset:function(a,b){a.vel=[0,0,0];a.pos=[0,0,0,0];a.el=b;"undefined"===typeof a.mass&&(a.mass=1);"undefined"===typeof a.charge&&(a.charge=
+0);"undefined"===typeof a.friction&&(a.friction=0);a.lnfrict=0;"undefined"===typeof a.limitspeed&&(a.limitspeed=!1);"undefined"===typeof a.fixed&&(a.fixed=!1);"undefined"===typeof a.radius&&(a.radius=1);a.internalmove=!1;a.fx=0;a.fy=0;a.fz=0;a.vx=a.vx||0;a.vy=a.vy||0;a.vz=a.vz||0;a.mtype=0;a.env=W.env;a.deltat=0;a.mx=0;a.my=0;a.mz=0;a.mvx=0;a.mvy=0;a.mvz=0;a.dx=[0,0,0,0,0,0,0,0,0,0];a.dy=[0,0,0,0,0,0,0,0,0,0];a.dz=[0,0,0,0,0,0,0,0,0,0];a.dvx=[0,0,0,0,0,0,0,0,0,0];a.dvy=[0,0,0,0,0,0,0,0,0,0];a.dvz=
+[0,0,0,0,0,0,0,0,0,0];a.midx=0;a.midy=0;a.midz=0;a.lx=0;a.ly=0;a.lz=0},resetForces:function(a){a.fx=0;a.fy=0;a.fz=0},getBlock:!1,setToTimestep:function(a,b,c){},initRK:function(a,b){var c=E.extractPoint(a.el.homog);a.x=c.x;a.y=c.y;a.z=0;a.xo=a.x;a.yo=a.y;a.zo=a.z;a.vxo=a.vx;a.vyo=a.vy;a.vzo=a.vz;a.deltat=b;a.fx=0;a.fy=0;a.fz=0},setVelocity:function(a,b,c,d){d||(d=0);a.vx=b;a.vy=c;a.vz=d},move:function(a){a.pos=[a.x,a.y,1];a.internalmove=!0;ya&&ja.down&&a.el===ya.mover||Ta(a.el,g.realVector(a.pos),
+"homog");a.el.sx=a.x;a.el.sy=a.y;a.internalmove=!1},proceedMotion:function(a,b,c,d){if(!a.fixed)for(a.x=a.mx,a.y=a.my,a.z=a.mz,a.vx=a.mvx,a.vy=a.mvy,a.vz=a.mvz,b=0;b<c;b++)a.x+=d[b]*a.dx[b]*a.deltat,a.y+=d[b]*a.dy[b]*a.deltat,a.z+=d[b]*a.dz[b]*a.deltat,a.vx+=d[b]*a.dvx[b]*a.deltat,a.vy+=d[b]*a.dvy[b]*a.deltat,a.vz+=d[b]*a.dvz[b]*a.deltat},calculateForces:function(a){var b=Math.sqrt(a.vx*a.vx+a.vy*a.vy+a.vz*a.vz);a.lnfrict=-Math.log((1-a.friction)*(1-a.env.friction)*(.1<b&&a.limitSpeed?.1/b:1));a.fx+=
+-a.vx*a.lnfrict*a.mass;a.fy+=-a.vy*a.lnfrict*a.mass;a.fz+=-a.vz*a.lnfrict*a.mass},calculateDelta:function(a,b){a.dx[b]=a.vx;a.dy[b]=a.vy;a.dz[b]=a.vz;a.dvx[b]=a.fx/a.mass;a.dvy[b]=a.fy/a.mass;a.dvz[b]=a.fz/a.mass},savePos:function(a,b){a.dx[b]=a.x;a.dy[b]=a.y;a.dz[b]=a.z;a.dvx[b]=a.vx;a.dvy[b]=a.vy;a.dvz[b]=a.vz},restorePos:function(a,b){a.fixed||(a.x=a.dx[b],a.y=a.dy[b],a.z=a.dz[b],a.vx=a.dvx[b],a.vy=a.dvy[b],a.vz=a.dvz[b])},sqDist:function(a,b,c){var d=(a.dx[b]-a.dx[c])*(a.dx[b]-a.dx[c]);d+=(a.dy[b]-
+a.dy[c])*(a.dy[b]-a.dy[c]);d+=(a.dz[b]-a.dz[c])*(a.dz[b]-a.dz[c]);d+=(a.dvx[b]-a.dvx[c])*(a.dvx[b]-a.dvx[c]);d+=(a.dvy[b]-a.dvy[c])*(a.dvy[b]-a.dvy[c]);return d+=(a.dvz[b]-a.dvz[c])*(a.dvz[b]-a.dvz[c])},kineticEnergy:function(a){return.5*a.mass*(a.vx*a.vx+a.vy*a.vy+a.vz*a.vz)},storePosition:function(a){a.mx=a.x;a.my=a.y;a.mz=a.z;a.mvx=a.vx;a.mvy=a.vy;a.mvz=a.vz},recallPosition:function(a){a.fixed||(a.x=a.mx,a.y=a.my,a.z=a.mz,a.vx=a.mvx,a.vy=a.mvy,a.vz=a.mvz)},doCollisions:function(a){}},Sun:{reset:function(a,
+b){a.vel=[0,0,0];a.pos=[0,0,0,0];a.el=b;"undefined"===typeof a.mass&&(a.mass=10);"undefined"===typeof a.friction&&(a.friction=0);a.charge=0;a.x=0;a.y=0;a.z=0},resetForces:function(a){},getBlock:!1,setToTimestep:function(a,b,c){},initRK:function(a,b){b=E.extractPoint(a.el.homog);a.x=b.x;a.y=b.y;a.z=0},setVelocity:function(a,b,c,d){},move:function(a){},proceedMotion:function(a,b,c,d){},calculateDelta:function(a,b){},calculateForces:function(a){for(var b=a.x,c=a.y,d=a.z,f=0;f<Ca.length;f++){var g=Ca[f],
+h=g.behavior.x,k=g.behavior.y,l=g.behavior.z,m=Math.sqrt((b-h)*(b-h)+(c-k)*(c-k)+(d-l)*(d-l));k=(c-k)*a.mass*g.behavior.mass/(m*m*m);l=(d-l)*a.mass*g.behavior.mass/(m*m*m);g.behavior.fx+=(b-h)*a.mass*g.behavior.mass/(m*m*m)*g.behavior.mass;g.behavior.fy+=k*g.behavior.mass;g.behavior.fz+=l*g.behavior.mass}},savePos:function(a,b){},restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){}},
+Velocity:{reset:function(a){var b=r.csnames[a.geo[1]];console.log(b);var c=E.extractPoint(b.homog);a=E.extractPoint(r.csnames[a.geo[2]].homog);b=b.behavior;W[b.type].setVelocity(b,a.x-c.x,a.y-c.y,0)},resetForces:function(a){},getBlock:!1,setToTimestep:function(a,b,c){},initRK:function(a,b){},setVelocity:function(a,b,c,d){},move:function(a){var b=r.csnames[a.geo[2]];if(!ya||!ja.down||b!==ya.mover){var c=r.csnames[a.geo[1]];a=E.extractPoint(c.homog);c=c.behavior;a=g.realVector([a.x+c.vx,a.y+c.vy,1]);
+Ta(b,a,"homog")}},proceedMotion:function(a,b,c,d){},calculateForces:function(a){},calculateDelta:function(a,b){},savePos:function(a,b){},restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){}},Gravity:{reset:function(a,b){a.vel=[0,0,0];a.pos=[0,0,0,0];a.el=b;"undefined"===typeof a.strength&&(a.strength=1);a.namea=b.args[0];a.nameb=b.args[1];a.ma=r.csnames[a.namea];a.mb=r.csnames[a.nameb]},
+resetForces:function(a){},getBlock:!1,setToTimestep:function(a,b,c){},initRK:function(a,b){},setVelocity:function(a,b,c,d){},move:function(a){},proceedMotion:function(a,b,c,d){},calculateDelta:function(a,b){},calculateForces:function(a){var b=E.extractPoint(a.ma.homog),c=E.extractPoint(a.mb.homog),d=(c.x-b.x)*a.strength;a=(c.y-b.y)*a.strength;for(b=0;b<Ca.length;b++)c=Ca[b],c.behavior.fx+=d*c.behavior.mass,c.behavior.fy+=a*c.behavior.mass,c.behavior.fz+=0*c.behavior.mass},savePos:function(a,b){},
+restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){}},Spring:{reset:function(a,b){a.el=b;"undefined"===typeof a.strength&&(a.strength=1);"undefined"===typeof a.amplitude&&(a.amplitude=0);"undefined"===typeof a.phase&&(a.phase=0);"undefined"===typeof a.speed&&(a.speed=1);"undefined"===typeof a.l0&&(a.l0=0);"undefined"===typeof a.stype&&(a.stype=1);"undefined"===typeof a.readOnInit&&
+(a.readOnInit=!1);a.namea=b.args[0];a.nameb=b.args[1];a.ma=r.csnames[a.namea];a.mb=r.csnames[a.nameb];b=E.extractPoint(a.ma.homog);var c=E.extractPoint(a.mb.homog);a.l0=Math.sqrt((b.x-c.x)*(b.x-c.x)+(b.y-c.y)*(b.y-c.y));a.env=W.env;a.ldiff=0},resetForces:function(a){},getBlock:!1,setToTimestep:function(a,b,c){},initRK:function(a,b){},setVelocity:function(a,b,c,d){},move:function(a){},proceedMotion:function(a,b,c,d){},calculateForces:function(a){if(!a.ma.behavior||ya&&ja.down&&a.ma===ya.mover){var b=
+E.extractPoint(a.ma.homog);var c=b.x;var d=b.y}else c=a.ma.behavior.x,d=a.ma.behavior.y;if(!a.mb.behavior||ya&&ja.down&&a.mb===ya.mover){var f=E.extractPoint(a.mb.homog);b=f.x;f=f.y}else b=a.mb.behavior.x,f=a.mb.behavior.y;var g=Math.sqrt((c-b)*(c-b)+(d-f)*(d-f)),h=a.l0;a.ldiff=g-h;var k=a.stype;1===k&&(h=0);var l=0;if(2===k||3===k)l=a.ma.behavior.mass*a.mb.behavior.mass*a.strength;2===k&&(l=-l);if(0===g||0!==k&&1!==k)if(a.ma.behavior&&a.mb.behavior&&0!==g){if(g*=g*g,2===k||3===k){var m=(c-b)*l/g;
+var n=(d-f)*l/g}}else m=n=0;else m=-(c-b)*a.strength*(g-h)/g*a.env.springstrength,n=-(d-f)*a.strength*(g-h)/g*a.env.springstrength;a.ma.behavior&&(a.ma.behavior.fx+=m,a.ma.behavior.fy+=n);a.mb.behavior&&(a.mb.behavior.fx-=m,a.mb.behavior.fy-=n)},calculateDelta:function(a,b){},savePos:function(a,b){},restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){}},det:function(a,b,c,d,f,g){return c*
+g-f*d+f*b-a*g+a*d-c*b},Bouncer:{reset:function(a,b){a.el=b;"undefined"===typeof a.xdamp&&(a.xdamp=0);"undefined"===typeof a.ydamp&&(a.ydamp=0);"undefined"===typeof a.motorchanger&&(a.motorchanger=!0);a.namea=b.args[0];a.nameb=b.args[1];a.ma=r.csnames[a.namea];a.mb=r.csnames[a.nameb];b=E.extractPoint(a.ma.homog);var c=E.extractPoint(a.mb.homog);a.x1o=1.01*b.x-.01*c.x;a.y1o=1.01*b.y-.01*c.y;a.x2o=1.01*c.x-.01*b.x;a.y2o=1.01*c.y-.01*b.y;a.env=W.env},resetForces:function(a){},getBlock:!1,setToTimestep:function(a,
+b,c){},initRK:function(a,b){a.deltat=b},setVelocity:function(a,b,c,d){},move:function(a){},proceedMotion:function(a,b,c,d){},calculateForces:function(a){},calculateDelta:function(a,b){},savePos:function(a,b){},restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){var b=E.extractPoint(a.ma.homog),c=E.extractPoint(a.mb.homog),d=b.x;b=b.y;var f=c.x;c=c.y;var g=a.x1o,h=a.y1o,k=a.x2o,m=a.y2o,
+n=Math.sqrt((d-f)*(d-f)+(b-c)*(b-c)),p=(d-f)/n;n=(b-c)/n;for(var q=0;q<Ca.length;q++){var r=Ca[q],t=r.behavior.xo,u=r.behavior.yo,w=r.behavior.x,y=r.behavior.y,z=l.mult(l.complex(g,h),l.complex(f,c)),A=l.mult(l.complex(k,m),l.complex(d,b));z=l.sub(z,A);A=l.mult(l.complex(t,u),l.complex(d,b));z=l.add(z,A);A=l.mult(l.complex(t,u),l.complex(f,c));z=l.sub(z,A);A=l.sub(l.complex(g,h),l.complex(k,m));z=l.div(z,A);0>W.det(d,b,f,c,w,y)*W.det(d,b,f,c,z.value.real,z.value.imag)&&0>W.det(d,b,w,y,z.value.real,
+z.value.imag)*W.det(f,c,w,y,z.value.real,z.value.imag)&&(u=r.behavior.mvx+a.deltat*(-z.value.real+r.behavior.xo),w=r.behavior.mvy+a.deltat*(-z.value.imag+r.behavior.yo),t=p*u+n*w,u=n*u-p*w,r.behavior.x=z.value.real,r.behavior.y=z.value.imag,r.behavior.vx=p*t*(1-a.xdamp),r.behavior.vy=n*t*(1-a.xdamp),r.behavior.vx+=-n*u*(1-a.ydamp),r.behavior.vy+=p*u*(1-a.ydamp))}a.x1o=d;a.y1o=b;a.x2o=f;a.y2o=c}},Environment:{init:function(a){"undefined"===typeof a.gravity&&(a.gravity=0);"undefined"===typeof a.friction&&
+(a.friction=0);"undefined"===typeof a.springstrength&&(a.springstrength=1);"undefined"!==typeof a.accuracy&&(zc=a.accuracy);"undefined"!==typeof a.deltat&&O(a.deltat/.6);"undefined"===typeof a.charges&&(a.charges=!1);"undefined"===typeof a.balls&&(a.balls=!1);"undefined"===typeof a.newton&&(a.newton=!1);"undefined"===typeof a.ballInteractionBoosting&&(a.ballInteractionBoosting=1);W.env=a;a.errorbound=.001;a.lowestdeltat=1E-7;a.slowdownfactor=2},reset:function(a){},resetForces:function(a){},getBlock:!1,
+setToTimestep:function(a,b,c){},initRK:function(a,b){},setVelocity:function(a,b,c,d){},move:function(a){},proceedMotion:function(a,b,c,d){},calculateForces:function(a){var b,c;if(a.newton)for(b=0;b<Ca.length-1;b++){var d=Ca[b];var f=d.behavior.x;var g=d.behavior.y;for(c=b+1;c<Ca.length;c++){var h=Ca[c];var k=h.behavior.x;var l=h.behavior.y;var m=Math.sqrt((f-k)*(f-k)+(g-l)*(g-l));k=(f-k)*d.behavior.mass*h.behavior.mass/(m*m*m);l=(g-l)*d.behavior.mass*h.behavior.mass/(m*m*m);d.behavior.fx-=k;d.behavior.fy-=
+l;h.behavior.fx+=k;h.behavior.fy+=l}}if(a.charges)for(b=0;b<Ca.length-1;b++)for(d=Ca[b],f=d.behavior.x,g=d.behavior.y,c=b+1;c<Ca.length;c++)h=Ca[c],k=h.behavior.x,l=h.behavior.y,m=Math.sqrt((f-k)*(f-k)+(g-l)*(g-l)),k=(f-k)*d.behavior.charge*h.behavior.charge/(m*m*m),l=(g-l)*d.behavior.charge*h.behavior.charge/(m*m*m),d.behavior.fx+=k,d.behavior.fy+=l,h.behavior.fx-=k,h.behavior.fy-=l;if(a.balls)for(b=0;b<Ca.length-1;b++)if(d=Ca[b],0!==d.behavior.radius)for(f=d.behavior.x,g=d.behavior.y,c=b+1;c<Ca.length;c++)if(h=
+Ca[c],0!==h.behavior.radius){k=h.behavior.x;l=h.behavior.y;var n=d.behavior.radius+h.behavior.radius;m=Math.sqrt((f-k)*(f-k)+(g-l)*(g-l));0===a.ballInteractionBoosting?(k=(f-k)/(m*m*m)*(m>n?0:(m-n)*(m-n)),l=(g-l)/(m*m*m)*(m>n?0:(m-n)*(m-n))):1===a.ballInteractionBoosting?(k=(f-k)/(m*m*m*m)*(m>n?0:(m-n)*(m-n)),l=(g-l)/(m*m*m*m)*(m>n?0:(m-n)*(m-n))):(k=(f-k)/(m*m*m*m*m)*(m>n?0:(m-n)*(m-n)),l=(g-l)/(m*m*m*m*m)*(m>n?0:(m-n)*(m-n)));d.behavior.fx+=k;d.behavior.fy+=l;h.behavior.fx-=k;h.behavior.fy-=l}for(b=
+0;b<Ca.length;b++)d=Ca[b],d.behavior.fx+=0,d.behavior.fy+=-a.gravity*d.behavior.mass,d.behavior.fz+=0},calculateDelta:function(a,b){},savePos:function(a,b){},restorePos:function(a,b){},sqDist:function(a,b,c){return 0},kineticEnergy:function(a){},storePosition:function(a){},recallPosition:function(a){},doCollisions:function(a){}}};return La};return n}(),createCindy=CindyJS;
+"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===typeof window&&(module.exports=CindyJS);
+//# sourceMappingURL=Cindy.js.map
+
diff --git a/public/build/CindyGL.js b/public/build/CindyGL.js
new file mode 100644
index 00000000..84e25c99
--- /dev/null
+++ b/public/build/CindyGL.js
@@ -0,0 +1,140 @@
+(function(){
+'use strict';var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},d="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function ba(){ba=function(){};d.Symbol||(d.Symbol=ca)}var ca=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();
+function da(){ba();var a=d.Symbol.iterator;a||(a=d.Symbol.iterator=d.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(this)}});da=function(){}}function fa(a){var b=0;return ha(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function ha(a){da();a={next:a};a[d.Symbol.iterator]=function(){return this};return a}
+function ia(a,b){if(b){var c=d;a=a.split(".");for(var e=0;e<a.length-1;e++){var f=a[e];f in c||(c[f]={});c=c[f]}a=a[a.length-1];e=c[a];b=b(e);b!=e&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}ia("Array.from",function(a){return a?a:function(a,c,e){da();c=null!=c?c:function(a){return a};var b=[],h=a[Symbol.iterator];if("function"==typeof h)for(a=h.call(a);!(h=a.next()).done;)b.push(c.call(e,h.value));else{h=a.length;for(var k=0;k<h;k++)b.push(c.call(e,a[k]))}return b}});
+function ja(a,b){da();a instanceof String&&(a+="");var c=0,e={next:function(){if(c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}e.next=function(){return{done:!0,value:void 0}};return e.next()}};e[Symbol.iterator]=function(){return e};return e}ia("Array.prototype.keys",function(a){return a?a:function(){return ja(this,function(a){return a})}});
+ia("Array.prototype.fill",function(a){return a?a:function(a,c,e){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==e||e>b)e=b;e=Number(e);0>e&&(e=Math.max(0,b+e));for(c=Number(c||0);c<e;c++)this[c]=a;return this}});
+var ka={addc:"vec2 addc(vec2 a,vec2 b){\nreturn a+b;\n}\n",addpoints:"vec2 addpoints(vec3 a,vec3 b){\nreturn dehomogenize(a) +dehomogenize(b);\n}\n",arccosc:"vec2 arccosc(vec2 a){\nvec2 t2=multc(a,negc(a));\nvec2 tmp=sqrtc(addc(vec2(1.0,0.0),t2));\nvec2 tmp1=addc(multc(a,vec2(0.0,1.0)),tmp);\nvec2 erg=addc(multc(logc(tmp1),vec2(0.0,1.0)),vec2(pi*0.5,0.0));\nreturn erg;\n}\n",arccosf:"vec2 arccosf(float z){\nif(abs(z)<=1.)return vec2(acos(z),0.);\nelse if(z>1.)return vec2(0,log(z+sqrt(z*z-1.)));\nelse return vec2(pi, -log(-z+sqrt(z*z-1.)));\n}\n",
+arcsinc:"vec2 arcsinc(vec2 a){\nvec2 t2=multc(a,negc(a));\nvec2 tmp=sqrtc(addc(vec2(1.0,0.0),t2));\nvec2 tmp1=addc(multc(a,vec2(0.0,1.0)),tmp);\nvec2 erg=multc(logc(tmp1),vec2(0.0,-1.0));\nreturn erg;\n}\n",arcsinf:"vec2 arcsinf(float z){\nif(abs(z)<=1.)return vec2(asin(z),0.);\nelse if(z>1.)return vec2(pi*.5, -log(z+sqrt(z*z-1.)));\nelse return vec2(-pi*.5,log(-z+sqrt(z*z-1.)));\n}\n",arctan2c:"\n\n\n\nvec2 arctan2c(vec2 x,vec2 y){\nvec2 r=logc(divc(x+vec2(-y.y,y.x),sqrtc(multc(x,x)+multc(y,y))));\nreturn vec2(r.y, -r.x);\n}\n",
+arctan2cvec2:"vec2 arctan2cvec2(cvec2 v){\nreturn arctan2c(v.real,v.imag);\n}\n",arctan2vec2:"float arctan2vec2(vec2 v){\nreturn atan(v.y,v.x);\n}\n",arctanc:"vec2 arctanc(vec2 a){\nvec2 t1=logc(addc(multc(a,vec2(0.0,-1.0)),vec2(1.0,0.0)));\nvec2 t2=logc(addc(multc(a,vec2(0.0,1.0)),vec2(1.0,0.0)));\nvec2 erg=multc(subc(t1,t2),vec2(0.0,0.5));\nreturn erg;\n}\n",blue:"vec3 blue(float f)\n{\nreturn vec3(0.,0.,clamp(f,0.,1.));\n}\n",cimag:"float imagc(vec2 a){\nreturn a.y;\n}\n",conjugate:"vec2 conjugate(vec2 a){\nreturn vec2(a.x, -a.y);\n}\n",
+copytexture_f:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D sampler;\nvarying vec2 cgl_pixel;\n\nvoid main(void){\ngl_FragColor=texture2D(sampler,cgl_pixel);\n}\n",copytexture_v:"attribute vec3 aPos;\nattribute vec2 aTexCoord;\nvarying vec2 cgl_pixel;\n\nvoid main(void){\ngl_Position=vec4(aPos,1.);\ncgl_pixel=aTexCoord;\n}\n",cosc:"vec2 cosc(vec2 a){\n\nfloat n=exp(a.y);\nfloat imag1=n*sin(-a.x);\nfloat real1=n*cos(-a.x);\nn=exp(-a.y);\nfloat imag2=n*sin(a.x);\nfloat real2=n*cos(a.x);\nfloat i= (imag1+imag2) /2.0;\nfloat r= (real1+real2) /2.0;\n\nreturn vec2(r,i);\n}\n",
+creal:"float realc(vec2 a){\nreturn a.x;\n}\n",dehomogenize:"vec2 dehomogenize(vec3 z){\nreturn vec2(z.x,z.y)/z.z;\n}\n",dehomogenizex:"float dehomogenizex(vec3 z){\nreturn z.x/z.z;\n}\n",dehomogenizey:"float dehomogenizey(vec3 z){\nreturn z.y/z.z;\n}\n",det2:"float det2(mat2 a){\nreturn a[0][0]*a[1][1] -a[0][1]*a[1][0];\n}\n",det3:"float det3(mat3 a){\nreturn dot(cross(a[0],a[1]),a[2]);\n}\n",det3v:"float det3v(vec3 a,vec3 b,vec3 c){\nreturn dot(cross(a,b),c);\n}\n",det4:"float det4(mat4 a){\nfloat s00=a[0][0]*a[1][1] -a[0][1]*a[1][0],\ns01=a[0][0]*a[1][2] -a[0][2]*a[1][0],\ns02=a[0][0]*a[1][3] -a[0][3]*a[1][0],\ns03=a[0][1]*a[1][2] -a[0][2]*a[1][1],\ns04=a[0][1]*a[1][3] -a[0][3]*a[1][1],\ns05=a[0][2]*a[1][3] -a[0][3]*a[1][2],\ns06=a[2][0]*a[3][1] -a[2][1]*a[3][0],\ns07=a[2][0]*a[3][2] -a[2][2]*a[3][0],\ns08=a[2][0]*a[3][3] -a[2][3]*a[3][0],\ns09=a[2][1]*a[3][2] -a[2][2]*a[3][1],\ns10=a[2][1]*a[3][3] -a[2][3]*a[3][1],\ns11=a[2][2]*a[3][3] -a[2][3]*a[3][2];\nreturn s00*s11-s01*s10+s02*s09+s03*s08-s04*s07+s05*s06;\n}\n",
+divc:"vec2 divc(vec2 a,vec2 b){\nreturn vec2(dot(a,b),dot(a,vec2(-b.y,b.x)))/dot(b,b);\n}\n",divfc:"vec2 divfc(float a,vec2 b){\nreturn a*vec2(b.x,-b.y)/dot(b,b);\n}\n",expc:"vec2 expc(vec2 a){\nfloat n=exp(a.x);\nfloat r=n*cos(a.y);\nfloat i=n*sin(a.y);\nreturn vec2(r,i);\n}\n",float2color:"vec4 float2color(float f)\n{\nreturn vec4(f,f,f,1.);\n}\n",gray:"vec3 gray(float f)\n{\nf=clamp(f,0.,1.);\nreturn vec3(f,f,f);\n}\n",green:"vec3 green(float f)\n{\nreturn vec3(0.,clamp(f,0.,1.),0.);\n}\n",hsv2rgb:"vec3 hsv2rgb(vec3 c)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(c.xxx+K.xyz) *6.0-K.www);\nreturn c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);\n}\n",
+hue:"vec3 hue(float a){\nreturn hsv2rgb(vec3(a,1.,1.));\n}\n",imagc:"float imagc(vec2 a){\nreturn a.y;\n}\n",invc:"vec2 invc(vec2 a){\nfloat n=a.x*a.x+a.y*a.y;\nreturn vec2(a.x/n,-a.y/n);\n}\n",logc:"vec2 logc(vec2 a){\nfloat re=a.x;\nfloat im=a.y;\nfloat s=sqrt(re*re+im*im);\nfloat i=im;\nfloat imag=atan(im,re);\nif(i<0.0){\nimag+= (2.0*pi);\n}\nif(i==0.0&&re<0.0){\nimag=pi;\n}\nif(imag>pi){\nimag-= (2.0*pi);\n};\nfloat real=log(s);\n\nreturn vec2(real,imag);\n}\n",logr:"vec2 logr(float a){\nif(a>=0.)return vec2(log(a),0);\nelse return vec2(log(-a),pi);\n}\n",
+mat2complex:"mat4 mat2complex(mat2 a)\n{\nreturn mat4(\nvec4(a[0][0],0,a[0][1],0),\nvec4(0,a[0][0],0,a[0][1]),\nvec4(a[1][0],0,a[1][1],0),\nvec4(0,a[1][0],0,a[1][1])\n);\n}\n",multc:"vec2 multc(vec2 a,vec2 b){\nreturn vec2(dot(a,vec2(b.x,-b.y)),dot(a,b.yx));\n}\n",negc:"vec2 negc(vec2 a){\nreturn vec2(-a.x,-a.y);\n}\n",powc:"vec2 powc(vec2 a,vec2 b){\nreturn(b.x==0. &&b.y==0.) ?vec2(1.,0.) : ((a.x==0. &&a.y==0.) ?vec2(0.) :expc(multc(logc(a),b)));\n}\n",powi:"float powi(float a,int b){\nif(mod(float(b),2.) < .5)\nreturn pow(abs(a),float(b));\nelse\nreturn sign(a)*pow(abs(a),float(b));\n}\n",
+random:"uniform float rnd_;\n\nfloat last_rnd= .1231;\nfloat random(){\nfloat a=fract(132422.21*sin(dot(plain_pixel,343433.671228*vec2(.176574+last_rnd, .1131+rnd_))));\nfloat b=fract(last_rnd*2321.2312*sin(dot(plain_pixel+vec2(rnd_,last_rnd),plain_pixel) *43758.5453));\nlast_rnd=fract(rnd_ +last_rnd+a+b);\nreturn last_rnd;\n}\n",randomnormal:"float randomnormal(){\nreturn sqrt(-2. *log(random())) *cos(6.283185307179586*random());\n}\n",realc:"float realc(vec2 a){\nreturn a.x;\n}\n",red:"vec3 red(float f)\n{\nreturn vec3(clamp(f,0.,1.),0.,0.);\n}\n",
+rgb2hsv:"vec3 rgb2hsv(vec3 c)\n{\nvec4 K=vec4(0.0, -1.0/3.0,2.0/3.0, -1.0);\nvec4 p=mix(vec4(c.bg,K.wz),vec4(c.gb,K.xy),step(c.b,c.g));\nvec4 q=mix(vec4(p.xyw,c.r),vec4(c.r,p.yzx),step(p.x,c.r));\n\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nreturn vec3(abs(q.z+ (q.w-q.y) / (6.0*d+e)),d/ (q.x+e),q.x);\n}\n",sinc:"\n\nvec2 sinc(vec2 a){\n\nfloat n=exp(a.y);\nfloat imag1=n*sin(-a.x);\nfloat real1=n*cos(-a.x);\nn=exp(-a.y);\nfloat imag2=n*sin(a.x);\nfloat real2=n*cos(a.x);\nfloat r= -(imag1-imag2) /2.0;\nfloat i= (real1-real2) /2.0;\n\nreturn vec2(r,i);\n}\n",
+sqrtc:"vec2 sqrtc(vec2 a){\nreturn expc(multc(logc(a),vec2(0.5,0.0)));\n}\n",sqrtf:"vec2 sqrtf(float a){\nif(a>=0.)return vec2(sqrt(a),0.);\nelse return vec2(0.,sqrt(-a));\n}\n",standardFragmentHeader:"#ifdef GL_ES\nprecision highp float;\nprecision highp int;\n#endif\n\n#define pi 3.141592653589793\n\nvarying vec2 cgl_pixel;\nvarying vec2 plain_pixel;\n",subc:"vec2 subc(vec2 a,vec2 b){\nreturn a-b;\n}\n",subpoints:"vec2 subpoints(vec3 a,vec3 b){\nreturn dehomogenize(a) -dehomogenize(b);\n}\n",tanc:"vec2 tanc(vec2 a){\nvec2 s=sinc(a);\nvec2 c=cosc(a);\nreturn divc(s,c);\n}\n",
+vec2complex:"vec4 vec2complex(vec2 a)\n{\nreturn vec4(a.x,0.,a.y,0);\n}\n",vshader:"attribute vec3 aPos;\nattribute vec2 aTexCoord;\nvarying vec2 cgl_pixel;\nvarying vec2 plain_pixel;\nuniform mat3 transformMatrix;\nvoid main(void){\ngl_Position=vec4(aPos,1.);\nplain_pixel=aTexCoord;\nvec3 r=transformMatrix*vec3(plain_pixel,1);\ncgl_pixel=r.xy/r.z;\n}\n"};var la=!1,g,m,n,ma,r,t,w=!1,na,x=!1,oa=!1,pa=1;
+function qa(){function a(c){g.removeEventListener("webglcontextcreationerror",a,!1);c.statusMessage&&(b=c.statusMessage)}if(!la){g=document.createElement("canvas");g.id="glcanvas";g.style.display="none";g.width=g.height=0;document.body.appendChild(g);m=document.createElement("canvas");m.id="tmpcanvas";m.style.display="none";m.width=m.height=0;document.body.appendChild(m);n=document.createElement("canvas");n.id="dummycanvas";n.style.display="none";n.width=n.height=1;document.body.appendChild(n);ma=
+{ctype:"image",value:{img:n,width:1,height:1,ready:!0,live:!1,generation:0,whenReady:function(){}}};var b="Unknown";g.addEventListener("webglcontextcreationerror",a,!1);var c={};"undefined"!==typeof CindyJS._pluginRegistry.CindyXR&&(c.xrCompatible=!0);(r=g.getContext("webgl",c))||(r=g.getContext("experimental-webgl",c));if(!r)throw new ta("Could not obtain a WebGL context.\nReason: "+b);ua.gl=r;g.removeEventListener("webglcontextcreationerror",a,!1);oa||(x=r.getExtension("OES_texture_float")&&r.getExtension("OES_texture_float_linear"),
+x||(console.error("Your browser does not suppert OES_texture_float, trying OES_texture_half_float..."),(w=(na=r.getExtension("OES_texture_half_float"))&&r.getExtension("OES_texture_half_float_linear"))||console.error("Your browser does not suppert OES_texture_half_float, will use 8-bit textures.")),navigator.userAgent.match(/(iPad|iPhone)/i)&&(console.log("You are using an iPhone/iPad."),x=w=!1,r.getExtension("OES_texture_half_float")&&r.getExtension("OES_texture_half_float_linear")&&r.getExtension("EXT_color_buffer_half_float")?
+w=!0:console.error("Your browser does not suppert writing to half_float textures, we will use 8-bit textures.")));la=!0}};function va(a){if(null==a||"object"!=typeof a)return a;if(a instanceof Array){var b=[];for(var c=0,e=a.length;c<e;c++)b[c]=va(a[c]);return b}if(a instanceof Object){b={};for(c in a)a.hasOwnProperty(c)&&(0<="oper impl args ctype stack name arglist value real imag key obj body".split(" ").indexOf(c)&&(b[c]=va(a[c])),a.modifs&&(b.modifs=a.modifs));return b}}
+function wa(a,b){if(null==a||"object"!=typeof a)return a===b;if(a instanceof Array&&b instanceof Array){if(a.length!=b.length)return!1;for(var c=0,e=a.length;c<e;c++)if(!wa(a[c],b[c]))return!1;return!0}if(a instanceof Object&&b instanceof Object){c="oper impl args ctype stack name modifs arglist value real imag key obj body".split(" ");for(e=0;e<c.length;e++){var f=c[e];if(!wa(a[f],b[f]))return!1}return!0}return!1}function y(a){return-1===a.indexOf("$")?a:a.substr(0,a.indexOf("$"))}
+function xa(a){if("boolean"===a.ctype)return z.A;if("number"===a.ctype)return a=a.value,1E-5>Math.abs(a.imag)?(a.real|0)===a.real?z.u:z.f:z.h;if("list"===a.ctype){var b=a.value;if(3===b.length){if("Point"===a.usage)return z.w;if("Line"===a.usage)return z.line}if(0<b.length){for(var c=xa(b[0]),e=1;e<b.length;e++)c=A(c,xa(b[e]));if(c)return{type:"list",length:b.length,parameters:c}}}else{if("string"===a.ctype||"image"===a.ctype)return z.image;if("geo"===a.ctype&&"L"===a.value.kind)return z.line}console.error("Cannot guess type of the following type:");
+console.log(a);return!1}var ya=0;function za(){ya++;return"_h"+ya}function Aa(a,b){if(a>g.width||b>g.height)g.width=Math.ceil(a),g.height=Math.ceil(b)}function Ba(a,b){a.instance.ha||(a.instance.ha={});a.instance.ha[b]||(a.instance.ha[b]=a.instance.parse(b));a=a.evaluate(a.instance.ha[b]);return a.ctype&&"number"===a.ctype?a.value.real:0}function Ca(a){return{x:Ba(a,"(screenbounds()_4).x"),y:Ba(a,"(screenbounds()_4).y")}}
+function Da(a){return{x:Ba(a,"(screenbounds()_3).x"),y:Ba(a,"(screenbounds()_3).y")}}var Ea=new Float32Array(1),Fa=new Int32Array(Ea.buffer);function Ga(a){Ea[0]=a;a=Fa[0];var b=a>>16&32768,c=(a&2147483647)+4096;if(1199570944<=c)return 1199570944<=(a&2147483647)?2139095040>c?b|31744:b|31744|(a&8388607)>>13:b|31743;if(947912704<=c)return b|c-939524096>>13;if(855638016>c)return b;c=(a&2147483647)>>23;return b|(a&8388607|8388608)+(8388608>>>c-102)>>126-c}
+function Ha(a){if(x)return new Float32Array(a);if(w){for(var b=new Uint16Array(a.length),c=0;c<a.length;c++)b[c]=Ga(a[c]);return b}b=new Uint8Array(a.length);for(c=0;c<a.length;c++)b[c]=255*a[c];return b}function Ia(a){return x?new Float32Array(a):w?new Uint16Array(a):new Uint8Array(a)}function Ja(){return x?r.FLOAT:w?na.HALF_FLOAT_OES:r.UNSIGNED_BYTE}
+function Ka(a){for(var b=[],c=0;c<a.length;c++)if(x)b.push(a[c]);else if(w){var e=a[c],f=(e&31744)>>10,h=e&1023;b.push((e>>15?-1:1)*(f?31===f?h?NaN:Infinity:Math.pow(2,f-15)*(1+h/1024):h/1024*6.103515625E-5))}else b.push(a[c]/255);return b}function La(a){for(var b=1;b<a;)b<<=1;return b};function Ma(a,b,c){if(a.canvaswrapper){if(!a.ready||a.canvaswrapper.canvas!=ma&&a.canvaswrapper.L==a.width&&a.canvaswrapper.G==a.height||(delete a.canvaswrapper,a.canvaswrapper=Ma(a,b,c)),c){b=a.canvaswrapper;var e=b.j;if(c&&(c.repeat!=e.repeat||c.clamptoedge!=e.clamptoedge||c.mipmap!=e.mipmap||c.interpolate!=e.interpolate))for(b.j=c,e=0;2>e;e++)r.bindTexture(r.TEXTURE_2D,b.textures[e]),c.mipmap?r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,c.interpolate?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_LINEAR):
+r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,c.interpolate?r.LINEAR:r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,c.interpolate?r.LINEAR:r.NEAREST),c.clamptoedge&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE))}}else a.canvaswrapper=new Oa(a.ready?a:ma,c||{interpolate:!0,mipmap:!1,repeat:!1,clamptoedge:!1}),a.ready||console.log("Image is not ready yet.");return a.canvaswrapper}
+function Oa(a,b){this.canvas=a;this.j=b;this.L=a.width;this.G=a.height;Pa(this);this.it=0;this.textures=[];this.X=[];this.generation=-1;this.bindTexture();a.drawTo=this.drawTo.bind(this);a.readPixels=this.la.bind(this);a.cdyUpdate=this.pa.bind(this);a=Ia(this.P*this.M*4);for(var c=0;2>c;c++)this.textures[c]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.textures[c]),r.pixelStorei(r.UNPACK_ALIGNMENT,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.P,this.M,0,r.RGBA,Ja(),a),b.mipmap?r.texParameteri(r.TEXTURE_2D,
+r.TEXTURE_MIN_FILTER,b.interpolate?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_LINEAR):r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,b.interpolate?r.LINEAR:r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,b.interpolate?r.LINEAR:r.NEAREST),b.clamptoedge&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)),this.X[c]=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.X[c]),r.framebufferTexture2D(r.FRAMEBUFFER,
+r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.textures[c],0);this.B=new Qa(ka.copytexture_v,ka.copytexture_f);b=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,b);b=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);a=r.getAttribLocation(this.B.handle,"aPos");r.enableVertexAttribArray(a);c=r.getAttribLocation(this.B.handle,"aTexCoord");r.enableVertexAttribArray(c);var e=new Float32Array([0,0,1,0,0,1,1,1]),f=b.byteLength;r.bufferData(r.ARRAY_BUFFER,f+e.byteLength,r.STATIC_DRAW);r.bufferSubData(r.ARRAY_BUFFER,0,
+b);r.bufferSubData(r.ARRAY_BUFFER,f,e);r.vertexAttribPointer(a,3,r.FLOAT,!1,0,0);r.vertexAttribPointer(c,2,r.FLOAT,!1,0,f)}function Pa(a){a.j.clamptoedge&&a.j.interpolate&&!a.j.repeat&&!a.j.mipmap?(a.P=a.L,a.M=a.G):(a.P=La(a.L+a.L/2*(a.j.mipmap&&a.j.repeat)),a.M=La(a.G+a.G/2*(a.j.mipmap&&a.j.repeat)))}Oa.prototype.bindTexture=function(){r.bindTexture(r.TEXTURE_2D,this.textures[this.it])};Oa.prototype.bindFramebuffer=function(){r.bindFramebuffer(r.FRAMEBUFFER,this.X[this.it^1]);this.it^=1};
+Oa.prototype.pa=function(){if(this.canvas.img.hasOwnProperty("getContext"))var a=this.canvas.img.getContext("2d");else this.canvas.img=document.createElement("canvas"),this.canvas.img.style.display="none",this.canvas.img.width=this.L,this.canvas.img.height=this.G,a=this.canvas.img.getContext("2d");a.clearRect(0,0,this.L,this.G);this.drawTo(a,0,0);this.canvas.img.generation++};
+Oa.prototype.reloadIfRequired=function(){if(!(this.canvas.live&&(this.canvas.img.webkitDecodedFrameCount||this.canvas.img.j)&&this.fa>=(this.canvas.img.webkitDecodedFrameCount||this.canvas.img.j)||!this.canvas.live&&(!this.canvas.ready||this.generation>=this.canvas.generation))){if(this.L!=this.canvas.width||this.G!=this.canvas.height){this.L=this.canvas.width;this.G=this.canvas.height;Pa(this);for(var a=Ia(this.P*this.M*4),b=0;2>b;b++)r.bindTexture(r.TEXTURE_2D,this.textures[b]),r.texImage2D(r.TEXTURE_2D,
+0,r.RGBA,this.P,this.M,0,r.RGBA,Ja(),a)}this.bindTexture();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,1);this.j.repeat?(m.width=this.P,m.height=this.M,a=m.getContext("2d"),a.drawImage(this.canvas.img,0,this.M-this.G),a.drawImage(this.canvas.img,this.L,this.M-this.G),a.drawImage(this.canvas.img,0,this.M-2*this.G),a.drawImage(this.canvas.img,this.L,this.M-2*this.G),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,Ja(),m)):r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,Ja(),this.canvas.img);this.j.mipmap&&r.generateMipmap(r.TEXTURE_2D);
+r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,0);this.generation=this.canvas.generation;this.fa=Math.min(this.fa+1,this.canvas.img.webkitDecodedFrameCount||this.canvas.img.j)}};
+Oa.prototype.drawTo=function(a,b,c){Aa(this.P,this.M);r.viewport(0,0,this.P,this.M);this.B.use(r);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,this.textures[this.it]);this.B.uniform.sampler([0]);r.bindFramebuffer(r.FRAMEBUFFER,null);r.drawArrays(r.TRIANGLE_STRIP,0,4);r.flush();a.drawImage(g,0,g.height-this.G,this.L,this.G,b,c,this.L,this.G)};
+Oa.prototype.la=function(a,b,c,e){r.bindFramebuffer(r.FRAMEBUFFER,this.X[this.it]);r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.textures[this.it],0);var f=Ia(c*e*4);r.readPixels(a,this.G-b-e,c,e,r.RGBA,Ja(),f);a=[];for(--e;0<=e;e--)a=a.concat(Ka(f.slice(e*c*4,(e+1)*c*4)));return a};function Ra(a,b){this.C=a;this.X=b;Sa(this)}
+function Sa(a){var b=Ta(new Ua(a.C),a.X);a.B=b.D;a.N=b.N;a.ea=b.ea;a.fa=ka.standardFragmentHeader+b.code;a.la=ka.vshader;a.j=new Qa(a.la,a.fa);b=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,b);b=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);var c=r.getAttribLocation(a.j.handle,"aPos");r.enableVertexAttribArray(c);a=r.getAttribLocation(a.j.handle,"aTexCoord");r.enableVertexAttribArray(a);var e=new Float32Array([0,0,1,0,0,1,1,1]),f=b.byteLength;r.bufferData(r.ARRAY_BUFFER,f+e.byteLength,r.STATIC_DRAW);
+r.bufferSubData(r.ARRAY_BUFFER,0,b);r.bufferSubData(r.ARRAY_BUFFER,f,e);r.vertexAttribPointer(c,3,r.FLOAT,!1,0,0);r.vertexAttribPointer(a,2,r.FLOAT,!1,0,f)}function Va(a,b,c,e){b=[c.x-b.x,e.x-b.x,b.x,c.y-b.y,e.y-b.y,b.y,0,0,1];a.j.uniform.hasOwnProperty("transformMatrix")&&a.j.uniform.transformMatrix([b[0],b[3],b[6],b[1],b[4],b[7],b[2],b[5],b[8]])}
+function Wa(a){function b(a,c,e){if(a)if("function"===typeof a)switch(c){case z.h:a([e.value.real,e.value.imag]);break;case z.A:e.value?a([1]):a([0]);break;case z.u:case z.f:a([e.value.real]);break;case z.w:case z.line:"geo"===e.ctype?a(e.value.homog.value.map(function(a){return a.value.real})):"list"===e.ctype&&2===e.value.length?a(e.value.map(function(a){return a.value.real}).concat([1])):"list"===e.ctype&&3===e.value.length&&a(e.value.map(function(a){return a.value.real}));break;default:if("list"===
+c.type&&c.parameters===z.f)a(e.value.map(function(a){return a.value.real}));else if("list"===c.type&&"list"===c.parameters.type&&c.parameters.parameters===z.f){for(var f=[],h=0;h<c.length;h++)for(var k=0;k<c.parameters.length;k++)f.push(e.value[h].value[k].value.real);a(f)}else console.error("Don't know how to set uniform of type "+B(c)+", to "+e)}else if("list"===c.type)if(h=Xa(c),1===C(c)&&h===z.f){c=Ya(c.length);var l=0;for(f in c)b(a["a"+f],z.aa(c[f]),{ctype:"list",value:E(c[f]).map(function(a){return e.value[l+
+a]})}),l+=c[f]}else for(f=0;f<c.length;f++)b(a["a"+f],c.parameters,{ctype:"list",value:e.value[f].value});else console.error("Don't know how to set uniform of type "+B(c)+", to"),console.log(e)}for(var c in a.B){var e=a.C.evaluateAndVal(a.B[c].U),f=a.B[c].type;if(!F(Za(e),f)){console.log("Type of "+c+" changed ("+B(Za(e))+" is no subtype of "+B(f)+"); forcing rebuild.");Sa(a);a.j.use(r);Wa(a);return}a.j.uniform[c]&&b(a.j.uniform[c],f,e)}[["rnd_",function(){return[Math.random()]}],["_lowerleft",function(){var b=
+Ca(a.C);return[b.x,b.y]}],["_lowerright",function(){var b=Da(a.C);return[b.x,b.y]}]].map(function(b){return a.j.uniform[b[0]]&&a.j.uniform[b[0]](b[1]())})}function $a(a){var b=0,c;for(c in a.N){r.activeTexture(r.TEXTURE0+b);var e=a.N[c],f=e.name;e=ab(e);e.reloadIfRequired();e.bindTexture();[["_sampler"+f,[b]],["_ratio"+f,[e.L/e.G]],["_cropfact"+f,[e.L/e.P,e.G/e.M]]].map(function(b){return a.j.uniform[b[0]]&&a.j.uniform[b[0]](b[1])});b++}}
+function bb(a){for(var b in a.ea)if(a.C.getMyfunction(b).generation>a.ea[b])return console.log(b+" is outdated; forcing rebuild."),!1;return!0};function ua(a){function b(b,e,f,h,k,l){if(!b.ka||b.ja<pa)b.ka=!0,b.ja=pa,b.ma=new Ra(a,b);b=b.ma;bb(b)||Sa(b);var c=k/h;c={x:e.x+-(f.y-e.y)*c,y:e.y+(f.x-e.x)*c};Aa(h,k);l?r.viewport(0,0,h,k):r.viewport(0,g.height-k,h,k);b.j.use(r);Wa(b);Va(b,e,f,c);$a(b);l?(l.bindFramebuffer(),l.generation=++l.canvas.generation):r.bindFramebuffer(r.FRAMEBUFFER,null);r.drawArrays(r.TRIANGLE_STRIP,0,4);r.flush();l&&(l.generation=Math.max(l.generation,l.canvas.generation+1))}t=a.nada;a.defineFunction("compile",1,function(b){b=
+Ta(new Ua(a),b[0]);console.log(b);return{ctype:"string",value:b}});a.defineFunction("use8bittextures",0,function(){oa=!0;x=w=!1;console.log("Switching to 8-bit textures mode.");return a.nada});a.defineFunction("forcerecompile",0,function(){pa++;return t});a.defineFunction("colorplot",1,function(c){qa();var e=a.instance.canvas.width,f=a.instance.canvas.height;b(c[0],Ca(a),Da(a),e,f,null);c=a.instance.canvas.getContext("2d");c.save();c.setTransform(1,0,0,1,0,0);c.drawImage(g,0,0,e,f,0,0,e,f);c.restore();
+return t});a.defineFunction("colorplot",3,function(c){qa();var e=c[0],f=a.extractPoint(a.evaluateAndVal(c[1])),h=a.extractPoint(a.evaluateAndVal(c[2])),k={x:Math.min(f.x,h.x),y:Math.min(f.y,h.y)},l={x:Math.max(f.x,h.x),y:Math.min(f.y,h.y)},q=Math.min(f.x,h.x),u=Math.max(f.y,h.y);c=a.instance.canvas.width;var p=a.instance.canvas.height;var v=Ba(a,"(screenbounds()_1).x");var D=Ba(a,"(screenbounds()_1).y");var ea=Da(a),Na=Math.abs((f.x-h.x)/(ea.x-v));f=Math.abs((f.y-h.y)/(ea.y-D));b(e,k,l,c*Na,p*f,null);
+e=a.instance.canvas.getContext("2d");a.getInitialMatrix();v=c*(q-v)/(ea.x-v);D=p*(u-D)/(ea.y-D);e.save();e.setTransform(1,0,0,1,0,0);e.drawImage(g,0,0,c*Na,p*f,v,D,c*Na,p*f);e.restore();return t});a.defineFunction("colorplot",4,function(c){qa();var e=a.extractPoint(a.evaluateAndVal(c[0])),f=a.extractPoint(a.evaluateAndVal(c[1])),h=a.evaluateAndVal(c[2]);c=c[3];if(!e.ok||!f.ok||"string"!==h.ctype)return t;h=a.getImage(h.value,!0);var k=Ma(h,a,!1);b(c,e,f,h.width,h.height,k);return t});a.defineFunction("colorplot",
+2,function(c){qa();var e=Ca(a),f=Da(a),h=a.evaluateAndVal(c[0]);c=c[1];if("string"!==h.ctype)return t;h=a.getImage(h.value,!0);var k=Ma(h,a,!1);b(c,e,f,h.width,h.height,k);return t});a.defineFunction("setpixel",4,function(b){var c=a.evaluateAndVal(b[0]);var f=void 0===f?null:f;if("string"===c.ctype)var h=c.value;else console.log("argument is not a string"),h=f;c=cb(a.evaluateAndVal(b[1]));f=cb(a.evaluateAndVal(b[2]));b=db(a.evaluateAndVal(b[3]));if(!h)return t;var k=a.getImage(h,!0);k=Ma(k,a,!1);
+isFinite(c)&&isFinite(f)&&h&&k&&b&&(k.bindTexture(),h=[b[0],b[1],b[2],1],r.texSubImage2D(r.TEXTURE_2D,0,c,f,1,1,r.RGBA,Ja(),Ha(h)),b=k.canvas.img.getContext("2d"),k=b.createImageData(1,1),k.data.d=h,b.putImageData(k,c,f));return t});a.defineFunction("colorplotxr",2,function(b){qa();var c=a.evaluate(b[0]).value.real;b=b[1];if(!b.ka||b.ja<pa)b.ka=!0,b.ja=pa,b.ma=new Ra(a,b);b=b.ma;if(0==c){r.clearColor(0,0,0,1);r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT);var f=r.getAttribLocation(b.j.handle,"aPos");
+r.enableVertexAttribArray(f);var h=r.getAttribLocation(b.j.handle,"aTexCoord");r.enableVertexAttribArray(h);r.vertexAttribPointer(f,3,r.FLOAT,!1,0,0);r.vertexAttribPointer(h,2,r.FLOAT,!1,0,48)}bb(b)||Sa(b);b.j.use(r);Wa(b);Va(b,{x:-1,y:-1},{x:1,y:-1},{x:-1,y:1});$a(b);CindyJS._pluginRegistry.CindyXR.xrUpdateCindyGLView(r,c);r.drawArrays(r.TRIANGLE_STRIP,0,4);r.flush();return t})}ua.gl=null;ua.generateCanvasWrapperIfRequired=Ma;ua.initGLIfRequired=qa;CindyJS.registerPlugin(1,"CindyGL",ua);function G(a,b){return{type:"list",length:a,parameters:b}}function Za(a){return{type:"constant",value:a}}function eb(a){return Za({ctype:"number",value:{real:a,imag:0}})}var z={A:1,u:2,f:3,h:4,T:5,color:6,w:7,line:8,K:9,image:10,F:G(2,3),J:G(3,3),O:G(4,3),aa:function(a){return G(a,3)},da:function(a){return G(a,4)},Y:G(2,G(2,3)),Z:G(3,G(3,3)),$:G(4,G(4,3))};Object.freeze(z);
+function B(a){return 1<=a&&10>=a?"bool int float complex voidt color point line coordinate2d image".split(" ")[a-1]:"list"===a.type?B(a.parameters)+"["+a.length+"]":"constant"===a.type?"const["+JSON.stringify(a.value.value)+"]":JSON.stringify(a)}function H(a){return"list"===a.type&&H(a.parameters)||F(a,z.f)}function I(a){return"list"===a.type&&I(a.parameters)||F(a,z.h)}function fb(a){return"constant"===a.type&&F(a,z.u)}function J(a){return"constant"===a.type?xa(a.value):a}
+function C(a){return"list"===a.type?C(a.parameters)+1:0}function Xa(a){return void 0!==a.parameters?Xa(a.parameters):a}function gb(a,b){return C(a)===C(b)&&(0===C(a)||a.length===b.length&&gb(a.parameters,b.parameters))}function K(a){return F(a,z.f)?z.f:F(a,z.h)?z.h:{type:"list",length:a.length,parameters:K(a.parameters)}}function hb(a){return F(a,z.h)?z.h:{type:"list",length:a.length,parameters:hb(a.parameters)}}
+function L(a){return"constant"===a.type&&L(J(a))||a===z.A||a===z.u||a===z.f||a===z.h||a===z.w||a===z.line||"list"===a.type&&a.parameters===z.f&&1<=a.length&&4>=a.length||"list"===a.type&&"list"===a.parameters.type&&a.parameters.parameters===z.f&&a.length===a.parameters.length&&2<=a.length&&4>=a.length}function ib(a){return-1!==[z.A,z.u,z.f,z.h].indexOf(a)}
+function jb(a,b){return a===b||"constant"===a.type&&"constant"===b.type&&wa(a.value,b.value)||"list"===a.type&&"list"===b.type&&a.length===b.length&&jb(a.parameters,b.parameters)}
+function F(a,b){return jb(a,b)?!0:a?ib(a)&&ib(b)?a<=b:"constant"===b.type?!1:"constant"===a.type?F(xa(a.value),b):b===z.K?F(a,z.h)||F(a,z.F)||F(a,z.w):b===z.w?F(a,z.J)||F(a,z.F):b===z.line?F(a,z.J):b===z.color?F(a,z.f)||"list"===a.type&&(3===a.length||4===a.length)&&F(a.parameters,z.f):"list"===a.type&&"list"===b.type&&a.length===b.length?F(a.parameters,b.parameters):!1:!1}
+function A(a,b){if(!a)return b;if(!b||jb(a,b))return a;"constant"===a.type&&(a=xa(a.value));"constant"===b.type&&(b=xa(b.value));return ib(a)&&ib(b)?Math.max(a,b):"list"===a.type&&"list"===b.type&&a.length===b.length&&(b=A(a.parameters,b.parameters))?{type:"list",length:a.length,parameters:b}:!1}
+function M(a){return function(b){var c={},e;for(e in a){var f=a[e];c.ca=f[0];if(b.length==c.ca.length&&b.every(function(a){return function(b,c){return F(b,a.ca[c])}}(c)))return{o:c.ca,s:f[1],l:f[2]};c={ca:c.ca}}return!1}}
+function kb(a){switch(a){case z.u:return M([[[z.A],z.u,N("int")]]);case z.f:return M([[[z.A],z.f,N("float")],[[z.u],z.f,N("float")]]);case z.h:return M([[[z.f],z.h,function(a){return"vec2("+a+", 0.)"}]]);case z.color:return M([[[z.f],z.color,O("float2color")],[[z.J],z.color,function(a){return"vec4("+a+",1.0)"}],[[z.O],z.color,P]]);case z.w:return M([[[z.F],z.w,function(a){return"vec3("+a+",1.0)"}],[[z.J],z.w,P]]);case z.line:return M([[[z.F],z.line,function(a){return"vec3("+a+",1.0)"}],[[z.J],z.line,
+P]]);case z.K:return M([[[z.h],z.K,P],[[z.F],z.K,P],[[z.w],z.K,O("dehomogenize")]]);default:if("list"===a.type)return function(b){var c=b[0],e=kb(a.parameters)([c.parameters]).l;return{o:b,s:a,l:function(b,h,k){return lb(a)(E(a.length).map(function(a){return e([Q(c,a)([b],h,k)],h,k)}),h,k)}}}}console.log("no inclusionfunction ->"+B(a)+" implemented yet; using identity...");return function(b){return{o:b,s:a,l:P}}}
+function R(a){a=J(a);switch(a){case z.A:return"bool";case z.u:return"int";case z.f:return"float";case z.h:case z.K:return"vec2";case z.T:return"void";case z.color:return"vec4";case z.w:case z.line:return"vec3"}if("list"===a.type&&a.parameters===z.f)return 1==a.length?"float":"vec"+a.length;if("list"===a.type&&a.parameters===z.h)return"cvec"+a.length;if("list"===a.type&&"list"===a.parameters.type&&a.length===a.parameters.length&&a.parameters.parameters===z.f)switch(a.length){case 2:return"mat2";case 3:return"mat3";
+case 4:return"mat4"}if("list"===a.type)return"l"+a.length+"_"+R(a.parameters);console.error("No WebGL implementation for type "+B(a)+" found")}function mb(a,b){switch(b){case z.A:return R(b)+"("+a.value+")";case z.u:return""+(a.value.real|0);case z.f:return R(b)+"("+a.value.real+")";case z.h:return R(b)+"("+a.value.real+", "+a.value.imag+")";case z.color:return a=a.value.real,"vec4("+a+","+a+","+a+",1.)";default:console.error("Dont know how to paste values of Type "+B(b)+" yet.")}};var S={};function nb(a,b,c){if(!c.mark("includedfunctions",a)){for(var e in S[a])nb(S[a][e],b,c);c.add("includedfunctions",a,function(){return ka[a]})}}function O(a){return function(b,c,e){nb(a,c,e);return N(a)(b)}};function E(a){return Array.from(Array(a).keys())}function Ya(a){return 4>=a?[a]:5==a?[2,3]:Ya(a-4).concat([4])}function ob(a){var b=Xa(a),c=C(a);return 1==c&&b===z.f?Ya(a.length).map(function(a,b){return{type:z.aa(a),name:"a"+b}}):1<=c?E(a.length).map(function(b){return{type:a.parameters,name:"a"+b}}):[]}function pb(a,b){if(!L(a)){var c=R(a);b.add("structs",c,function(){return"struct "+c+" { "+ob(a).map(function(a){return pb(a.type,b)||R(a.type)+" "+a.name+";"}).join("")+"};"})}}
+function qb(a,b,c){if(!L(a)){var e=a.length,f=a.parameters.length;c.add("functions","mult"+e+"_"+f,function(){return R(z.aa(e))+" mult"+e+"_"+f+"("+R(a)+" a, "+R(z.aa(f))+" b){return "+rb(e)(E(e).map(function(a){return sb(f)(["a.a"+a,"b"],b,c)}),b,c)+";}"})}}
+function tb(a,b,c){if(!(L(a)&&1>=C(a))){var e=a.length,f="sum"+R(a);c.add("functions",f,function(){return R(a.parameters)+" "+f+"("+R(a)+" a){"+(R(a.parameters)+" res = "+ub(a.parameters,0)([],b,c)+";\n "+E(e).map(function(e){return"res = "+vb(a.parameters)(["res",Q(a,e)(["a",e],b,c)],b,c)+";"}).join("\n")+"\n return res;\n }")})}}
+function wb(a,b,c){var e=a.length,f=a.parameters.length;c.add("functions","multc"+e+"_"+f,function(){return R(z.da(e))+" multc"+e+"_"+f+"("+R(a)+" a, "+R(z.da(f))+" b){\n return cvec"+e+"("+E(e).map(function(a){return xb(f)(["a.a"+a,"b"],b,c)})+");\n }\n "})}function yb(a,b){2<=a&&4>=a||b.add("functions","dot"+a,function(){return"float dot"+a+"(vec"+a+" a, vec"+a+" b) {\n return "+Ya(a).map(function(a,b){return"dot(a.a"+b+",b.a"+b+")"}).join("+")+"; }\n "})}
+function zb(a,b){b.add("functions","cdot"+a,function(){return"vec2 cdot"+a+"(cvec"+a+" a, cvec"+a+" b) {\n return "+E(a).map(function(a){return"vec2(dot(a.a"+a+",vec2(b.a"+a+".x,-b.a"+a+".y)), dot(a.a"+a+",b.a"+a+".yx))"}).join("+\n")+";\n }\n "})}
+function Ab(a,b,c){var e="add"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"("+R(a)+" a, "+R(a)+" b) {\n return "+R(a)+"("+ob(a).map(function(a){return R(a.type)+"("+vb(a.type)(["a."+a.name,"b."+a.name],b,c)+")"}).join(",")+");\n }"})}
+function Bb(a,b,c){var e="sub"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"("+R(a)+" a, "+R(a)+" b) {\n return "+R(a)+"("+ob(a).map(function(a){return R(a.type)+"("+Cb(a.type)(["a."+a.name,"b."+a.name],b,c)+")"}).join(",")+");\n }"})}function Db(a,b,c){var e="scalarmult"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"(float a, "+R(a)+" b) {\n return "+R(a)+"("+ob(a).map(function(a){return R(a.type)+"("+Eb(a.type)(["a","b."+a.name],b,c)+")"}).join(",")+");\n }"})}
+function Fb(a,b,c){nb("multc",b,c);var e="cscalarmult"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"(vec2 a, "+R(a)+" b) {\n return "+R(a)+"("+ob(a).map(function(a){return""+Gb(a.type)(["a","b."+a.name],b,c)}).join(",")+");\n }"})}
+function Hb(a){if(a===z.h)return O("multc");if(L(a))return function(a){return T("*")([a[1],a[0]])};var b=Xa(a);if(F(b,z.f))return function(b,e,f){return qb(a,e,f)||"mult"+a.length+"_"+a.parameters.length+"("+b.join(",")+")"};if(b===z.h)return function(b,e,f){return wb(a,e,f)||"multc"+a.length+"_"+a.parameters.length+"("+b.join(",")+")"}}function sb(a){return function(b,c,e){return yb(a,e)||"dot"+(2<=a&&4>=a?"":a)+"("+b.join(",")+")"}}
+function xb(a){return function(b,c,e){return zb(a,e)||"cdot"+a+"("+b.join(",")+")"}}function vb(a){return L(a)?T("+"):function(b,c,e){return Ab(a,c,e)||"add"+R(a)+"("+b.join(",")+")"}}function Cb(a){return L(a)?T("-"):function(b,c,e){return Bb(a,c,e)||"sub"+R(a)+"("+b.join(",")+")"}}function Ib(a){return H(a)&&1==C(a)?function(b,c,e){return sb(a.length)([b[0],rb(a.length)(Array(a.length).fill("1."),c,e)],c,e)}:function(b,c,e){return tb(a,c,e)||"sum"+R(a)+"("+b.join(",")+")"}}
+function rb(a){if(2<=a&&4>=a)return function(b){return"vec"+a+"("+b.join(",")+")"};if(1==a)return function(a){return"float("+a.join(",")+")"};var b=0;return function(c,e,f){return pb(z.aa(a),f)||"vec"+a+"("+Ya(a).map(function(a){return"vec"+a+"("+E(a).map(function(){return++b&&c[b-1]}).join(",")+")"}).join(",")+")"}}function lb(a){var b=C(a);return L(a)?function(b){return R(a)+"("+b.join(",")+")"}:1==b&&a.parameters===z.f?rb(a.length):function(b,e,f){return pb(a,f)||R(a)+"("+b.join(",")+")"}}
+function Q(a,b){var c=Xa(a);return 1==C(a)&&c===z.f?Jb(a.length,b):L(a)?function(a){return"("+a[0]+")["+b+"]"}:function(a){return"("+a[0]+").a"+b}}function ub(a,b){return L(a)?function(){return R(a)+"(float("+b+"))"}:function(c,e,f){return lb(a)+"("+ob(a).map(function(a){return ub(a.type,b)(c,e,f)}).join(",")+")"}}
+function Jb(a,b){return function(c){if(1==a)return c[0];if(2<=a&&4>=a)return"("+c[0]+")["+b+"]";a:{var e=b;var f=Ya(a),h;for(h in f)if(f[h]<=e)e-=f[h];else{e={first:h,second:e};break a}console.error("Accessing index out of range");e=void 0}return"("+c[0]+").a"+e.first+"["+e.second+"]"}}function Eb(a){return L(a)?T("*"):function(b,c,e){return Db(a,c,e)||"scalarmult"+R(a)+"("+b.join(",")+")"}}
+function Gb(a){return a===z.h?O("multc"):function(b,c,e){return Fb(a,c,e)||"cscalarmult"+R(a)+"("+b.join(",")+")"}}function Kb(a,b,c){var e="reverse"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"("+R(a)+" a){"+(R(a.parameters)+" m;\n")+E(Math.floor(a.length/2)).map(function(e){var f=Q(a,e)(["a",e],b,c);e=Q(a,a.length-1-e)(["a",a.length-1-e],b,c);return"m = "+f+"; "+f+" = "+e+"; "+e+" = m;"}).join("\n")+"return a;\n }"})}
+function Lb(a){return function(b,c,e){return Kb(a,c,e)||"reverse"+R(a)+"("+b.join(",")+")"}}function Mb(a,b,c){var e="max"+R(a);c.add("functions",e,function(){return R(a.parameters)+" "+e+"("+R(a)+" a){"+(R(a.parameters)+" m = "+Q(a,a.length-1)(["a",a.length-1],b,c)+";\n")+E(a.length-1).map(function(e){return"m = max(m,"+Q(a,e)(["a",e],b,c)+");"}).join("\n")+"return m;\n }"})}function Nb(a){return function(b,c,e){return Mb(a,c,e)||"max"+R(a)+"("+b.join(",")+")"}}
+function Ob(a,b,c){var e="min"+R(a);c.add("functions",e,function(){return R(a.parameters)+" "+e+"("+R(a)+" a){"+(R(a.parameters)+" m = "+Q(a,a.length-1)(["a",a.length-1],b,c)+";\n")+E(a.length-1).map(function(e){return"m = min(m,"+Q(a,e)(["a",e],b,c)+");"}).join("\n")+"return m;\n }"})}function Pb(a){return function(b,c,e){return Ob(a,c,e)||"min"+R(a)+"("+b.join(",")+")"}}
+function Qb(a,b,c){var e="transpose"+R(a),f=G(a.parameters.length,G(a.length,a.parameters.parameters));c.add("functions",e,function(){return R(f)+" "+e+"("+R(a)+" a){return "+lb(f)(E(f.length).map(function(e){return lb(f.parameters)(E(f.parameters.length).map(function(f){return Q(a.parameters,e)([Q(a,f)(["a",f],b,c),e],b,c)}),b,c)}),b,c)+";}"})}function Rb(a){return function(b,c,e){return Qb(a,c,e)||"transpose"+R(a)+"("+b.join(",")+")"}};function Sb(a){function b(a,e,k){if(1<e){var f=e/2|0;b(a,f,!k);b(a+f,e-f,k);c(a,e,k)}}function c(a,b,k){if(1<b){var f;for(f=1;f<b;)f<<=1;f>>=1;for(var h=a;h<a+b-f;h++){var u=h,p=h+f;k?e.push([u,p]):e.push([p,u])}c(a,f,k);c(a+f,b-f,k)}}var e=[];b(0,a,!0);return e}
+function Tb(a,b,c){var e="sort"+R(a);c.add("functions",e,function(){return R(a)+" "+e+"("+R(a)+" a){"+(R(a.parameters)+" m;\n")+Sb(a.length).map(function(e){var f=Q(a,e[0])(["a",e[0]],b,c);e=Q(a,e[1])(["a",e[1]],b,c);return"m = min("+f+","+e+"); "+e+" = max("+f+","+e+"); "+f+" = m;"}).join("\n")+"return a;\n }"})}function Ub(a){return function(b,c,e){return Tb(a,c,e)||"sort"+R(a)+"("+b.join(",")+")"}};function N(a){return function(b){return y(a)+"("+b+")"}}function T(a){return function(b){return"("+b.join(a)+")"}}function U(){return function(a){return"("+a.reverse().join("*")+")"}}function P(a){return a}var V={};V.join=M([[[z.w,z.w],z.line,N("cross")]]);V.meet=M([[[z.line,z.line],z.w,N("cross")]]);V.gauss=M([[[z.h],z.F,P]]);V.complex=M([[[z.F],z.h,P],[[z.w],z.h,O("dehomogenize")]]);
+V["if"]=function(a){if(!a.every(function(a){return a}))return!1;if(2===a.length)return{o:a,s:a[1],l:function(a){return"if("+a[0]+") {"+a[1]+";}"}};if(3===a.length){var b=A(a[1],a[2]);return b?{o:[z.A,b,b],s:b,l:function(a){return"("+a[0]+" ? "+a[1]+" : "+a[2]+")"}}:{o:a,s:z.T,l:function(a){return"if("+a[0]+") {"+a[1]+";} else {"+a[2]+";}"}}}return!1};V["="]=function(a){a=A(a[0],a[1]);return{o:a,s:a,l:function(a){return a[0]+" = "+a[1]+";"}}};
+V[";"]=function(a){return{o:a,s:a[1]!==z.T?a[1]:a[0],l:function(a){return a[0]+" ; "+a[1]+";"}}};V.repeat=function(a){return 2!=a.length&&3!=a.length||!fb(a[0])?!1:{o:a,s:a[a.length-1],l:function(){return""}}};V.forall=function(a){return 2!=a.length&&3!=a.length||"list"!==J(a[0]).type?!1:{o:a,s:a[a.length-1],l:function(){return""}}};V.apply=function(a){return 2!=a.length&&3!=a.length||"list"!==J(a[0]).type?!1:{o:a,s:G(J(a[0]).length,a[a.length-1]),l:function(){return""}}};
+V.sum=function(a){return 1==a.length&&(H(a[0])||I(a[0]))?{o:a,s:a[0].parameters,l:Ib(a[0])}:!1};V.regional=function(a){return{o:a,s:z.T,l:function(){return""}}};V.sqrt=M([[[z.f],z.h,O("sqrtf")],[[z.h],z.h,O("sqrtc")]]);V.abs=M([[[z.f],z.f,N("abs")],[[z.h],z.f,N("length")],[[z.F],z.f,N("length")],[[z.J],z.f,N("length")],[[z.O],z.f,N("length")]]);V.abs_infix=V.abs;
+V.dist=M([[[z.f,z.f],z.f,function(a){return N("abs")(T("-")(a))}],[[z.h,z.h],z.f,function(a){return N("length")(T("-")(a))}],[[z.F,z.F],z.f,function(a){return N("length")(T("-")(a))}],[[z.J,z.J],z.f,function(a){return N("length")(T("-")(a))}],[[z.O,z.O],z.f,function(a){return N("length")(T("-")(a))}]]);V.dist_infix=V.dist;V.sin=M([[[z.f],z.f,N("sin")],[[z.h],z.h,O("sinc")]]);V.cos=M([[[z.f],z.f,N("cos")],[[z.h],z.h,O("cosc")]]);V.tan=M([[[z.f],z.f,N("tan")],[[z.h],z.h,O("tanc")]]);
+V.exp=M([[[z.f],z.f,N("exp")],[[z.h],z.h,O("expc")]]);V.arctan=M([[[z.f],z.f,N("atan")],[[z.h],z.h,O("arctanc")]]);V.arcsin=M([[[z.f],z.h,O("arcsinf")],[[z.h],z.h,O("arcsinc")]]);V.arccos=M([[[z.f],z.h,O("arccosf")],[[z.h],z.h,O("arccosc")]]);V.log=M([[[z.f],z.h,O("logr")],[[z.h],z.h,O("logc")]]);var Vb=[2,3,4].map(function(a){return G(a,z.f)}).concat([2,3,4].map(function(a){return G(a,G(a,z.f))})),Wb=[z.u,z.f,z.h].concat(Vb);
+V.add=function(a){var b=M(Wb.map(function(a){return[[a,a],a,T("+")]}).concat([[[z.w,z.w],z.F,O("addpoints")]]))(a);if(b)return b;b=a[0];a=a[1];if([b,a].every(function(a){return H(a)||I(a)})&&gb(b,a))return a=A(K(b),K(a)),{o:[a,a],s:a,l:vb(a)}};
+V.sub=function(a){var b=M(Wb.map(function(a){return[[a,a],a,T("-")]}).concat(Wb.map(function(a){return[[z.T,a],a,T("-")]})).concat([[[z.w,z.w],z.F,O("subpoints")]]))(a);if(b)return b;b=a[0];a=a[1];if([b,a].every(function(a){return H(a)||I(a)})&&gb(b,a))return a=A(K(b),K(a)),{o:[a,a],s:a,l:Cb(a)}};V["+"]=V.add;V["-"]=V.sub;
+V._=function(a){var b=J(a[0]);if(b===z.w||b===z.line)b=z.J;if("list"===b.type&&fb(a[1])){var c=Number(a[1].value.value.real);return 1<=Math.abs(c)&&Math.abs(c)<=b.length?(0<c&&--c,0>c&&(c=b.length+c),{o:a,s:b.parameters,l:Q(b,c)}):{o:a,s:b.parameters,l:function(){return console.error("try to access "+c+"-th Element of "+b.length+"-list "+JSON.stringify(a[0]))}}}return!1};
+V.mult=function(a){var b=M([[[z.u,z.u],z.u,T("*")],[[z.f,z.f],z.f,T("*")],[[z.h,z.f],z.h,T("*")],[[z.f,z.h],z.h,T("*")],[[z.h,z.h],z.h,O("multc")],[[z.Y,z.Y],z.Y,U()],[[z.Z,z.Z],z.Z,U()],[[z.$,z.$],z.$,U()],[[z.Y,z.F],z.F,U()],[[z.Z,z.J],z.J,U()],[[z.$,z.O],z.O,U()],[[z.F,z.Y],z.F,U()],[[z.J,z.Z],z.J,U()],[[z.O,z.$],z.O,U()]])(a);if(b)return b;if(2!==a.length)return!1;b=a[0];var c=a[1];if([b,c].every(function(a){return"list"===a.type&&F(a.parameters,z.f)})&&b.length===c.length)return a=K(b),L(a)?
+{o:[a,a],s:z.f,l:N("dot")}:{o:[a,a],s:z.f,l:sb(b.length)};if([b,c].every(function(a){return"list"===a.type&&F(a.parameters,z.h)})&&b.length===c.length)return a=hb(b),{o:[a,a],s:z.h,l:xb(b.length)};if(H(b)&&2===C(b)&&H(c)&&1===C(c)&&b.parameters.length===c.length)return{o:[K(b),K(c)],s:z.aa(b.length),l:Hb(K(b))};if(I(b)&&2===C(b)&&I(c)&&1===C(c)&&b.parameters.length===c.length)return{o:[hb(b),hb(c)],s:z.da(b.length),l:Hb(hb(b))};for(b={H:0};2>b.H;b={V:b.V,H:b.H,ba:b.ba},b.H++){if(F(a[0^b.H],z.f)&&
+(H(a[1^b.H])||I(a[1^b.H])))return b.V=K(a[1^b.H]),{o:b.H?[b.V,z.f]:[z.f,b.V],s:b.V,l:function(a){return function(b,c,e){return Eb(a.V)([b[0^a.H],b[1^a.H]],c,e)}}(b)};if(F(a[0^b.H],z.h)&&I(a[1^b.H]))return b.ba=hb(a[1^b.H]),{o:b.H?[b.ba,z.h]:[z.h,b.ba],s:b.ba,l:function(a){return function(b,c,e){return Gb(a.ba)([b[0^a.H],b[1^a.H]],c,e)}}(b)}}};V["*"]=V.mult;
+V.div=function(a){var b=M([[[z.f,z.f],z.f,T("/")],[[z.f,z.h],z.h,O("divfc")],[[z.h,z.f],z.h,T("/")],[[z.h,z.h],z.h,O("divc")]])(a);return b?b:F(a[1],z.f)&&I(a[0])&&(a=K(a[0]),L(a))?{o:[a,z.f],s:a,l:T("/")}:!1};V["/"]=V.div;V.re=M([[[z.h],z.f,O("realc")]]);V.im=M([[[z.h],z.f,O("imagc")]]);V.floor=M([[[z.f],z.u,function(a){return"int(floor("+a+"))"}],[[z.h],z.h,N("floor")]]);V.round=M([[[z.f],z.u,function(a){return"int(floor("+a+"+.5))"}],[[z.h],z.h,function(a){return"floor("+a+"+vec2(.5))"}]]);
+V.ceil=M([[[z.f],z.u,function(a){return"int(ceil("+a+"))"}],[[z.h],z.h,N("ceil")]]);V.mod=M([[[z.u,z.u],z.u,function(a,b){return"int("+N("mod")("float("+a[0]+"), float("+a[1]+")",b)+")"}],[[z.f,z.f],z.f,N("mod")],[[z.h,z.h],z.h,O("mod")]]);V.random=M([[[],z.f,O("random")],[[z.f],z.f,function(a,b,c){return O("random")([],b,c)+"*"+a[0]}],[[z.h],z.h,function(a,b,c){return"vec2("+O("random")([],b,c)+","+O("random")([],b,c)+")*"+a[0]}]]);
+V.randomint=M([[[z.u],z.u,function(a,b,c){return"int(floor("+O("random")([],b,c)+"*float("+a[0]+")))"}],[[z.f],z.u,function(a,b,c){return"int(floor("+O("random")([],b,c)+"*floor("+a[0]+")))"}]]);V.randominteger=V.randomint;V.randombool=M([[[],z.A,function(a,b,c){return"("+O("random")([],b,c)+">.5)"}]]);V.randomnormal=M([[[],z.f,O("randomnormal")]]);
+V.arctan2=M([[[z.f,z.f],z.f,function(a){return"atan("+a[1]+", "+a[0]+")"}],[[z.h,z.h],z.h,O("arctan2c")],[[z.h],z.f,O("arctan2vec2")],[[z.F],z.f,O("arctan2vec2")],[[z.da(2)],z.h,O("arctan2cvec2")]]);["red","green","blue","gray","hue"].forEach(function(a){V[a]=M([[[z.f],z.J,O(a)]])});V.grey=V.gray;V.min=function(a){var b=M([[[z.f,z.f],z.f,N("min")]])(a);if(b)return b;if(1===a.length&&1===C(a[0])&&H(a[0]))return{o:a,s:a[0].parameters,l:Pb(a[0])}};
+V.max=function(a){var b=M([[[z.u,z.u],z.u,N("max")],[[z.f,z.f],z.f,N("max")]])(a);if(b)return b;if(1===a.length&&1===C(a[0])&&H(a[0]))return{o:a,s:a[0].parameters,l:Nb(a[0])}};function Xb(a,b){if(!(1>=a))if(2==a)b.add("functions","raise2",function(){return"float raise2(float a) { return a*a; }"});else{Xb(2,b);var c=function(a,b){return 1==b?a:b&1?c(a,b-1)+"*a":"raise2("+c(a,b/2)+")"},e="raise"+a;b.add("functions",e,function(){return"float "+e+"(float a) { return "+c("a",a)+";}"})}}
+function Yb(a){return function(b,c,e){return 0==a?"1.":1==a?b[0]:Xb(a,e)||"raise"+a+"("+b[0]+")"}}V.pow=function(a){if(fb(a[1])&&F(a[0],z.f)){var b=Number(a[1].value.value.real);if(0<=b)return{o:[z.f,a[1]],s:z.f,l:Yb(b)}}return M([[[z.f,z.u],z.f,O("powi")],[[z.h,z.h],z.h,O("powc")]])(a)};V["^"]=V.pow;V.re=M([[[z.h],z.f,function(a){return"("+a+").x"}]]);V.conjugate=M([[[z.h],z.h,O("conjugate")]]);V.im=M([[[z.h],z.f,function(a){return"("+a+").y"}]]);
+V.genList=function(a){var b=a.length;if(0<b){var c=!1,e;for(e in a)c=A(c,a[e]);if(c)return a=G(b,c),{o:Array(b).fill(c),s:a,l:lb(a)}}return!1};V["&"]=M([[[z.A,z.A],z.A,T("&&")]]);V["%"]=M([[[z.A,z.A],z.A,T("||")]]);"> < >= <= == !=".split(" ").forEach(function(a){V[a]=M([[[z.u,z.u],z.A,T(a)],[[z.f,z.f],z.A,T(a)]])});V["!"]=M([[[z.A],z.A,N("!")],[[z.T,z.A],z.A,function(a){return N("!")([a[1]])}]]);V.not=V["!"];V.imagergb=M([[[z.image,z.K],z.J,Zb],[[z.K,z.K,z.image,z.K],z.J,$b]]);
+V.imagergba=M([[[z.image,z.K],z.O,ac],[[z.K,z.K,z.image,z.K],z.O,bc]]);V.reverse=function(a){return 1===a.length&&"list"===a[0].type?{o:a,s:a[0],l:Lb(a[0])}:!1};V.sort=function(a){return 1===a.length&&1===C(a[0])&&H(a[0])?{o:a,s:a[0],l:Ub(a[0])}:!1};V.transpose=function(a){return 1===a.length&&2<=C(a[0])?{o:a,s:G(a[0].parameters.length,G(a[0].length,a[0].parameters.parameters)),l:Rb(a[0])}:!1};V.det=M([[[z.Y],z.f,O("det2")],[[z.Z],z.f,O("det3")],[[z.$],z.f,O("det4")],[[z.w,z.w,z.w],z.f,O("det3v")]]);
+Object.freeze(V);S.powc=["expc","multc","logc"];S.sqrtc=["expc","multc","logc"];S.arccosc=["multc","negc","sqrtc","addc","logc"];S.arcsinc=["multc","negc","sqrtc","addc","logc"];S.tanc=["sinc","cosc","divc"];S.arctanc=["logc","addc","multc","subc"];S.arctan2c=["logc","divc","sqrtc","multc"];S.arctan2vec2c=["arctan2c"];S.hue=["hsv2rgb"];S.randomnormal=["random"];S.subpoints=["dehomogenize"];S.addpoints=["dehomogenize"];Object.freeze(S);function Ua(a){this.i={};this.D={};this.j={};this.R=0;this.B={};this.C=a;this.N={}}Ua.prototype.add=function(a,b,c){this.mark(a,b);this.j[a].ia[b]||(this.j[a].ia[b]=c(),this.j[a].ga[b]=!0,this.j[a].order.push(b))};Ua.prototype.mark=function(a,b){this.j[a]||(this.j[a]={order:[],ga:{},ia:{}});var c=this.j[a].ga[b]||!1;this.j[a].ga[b]=!0;return c};function cc(a,b){return a.j[b]?a.j[b].order.map(function(c){return a.j[b].ia[c]}).join("\n"):"\n"}
+function W(a,b,c,e){if(jb(c,e))return b;if(F(c,e)){if("constant"===c.type)return mb(c.value,e);var f=kb(e)([c]);if(!f)return console.error("cannot find an implementation for "+B(c)+" -> "+B(e)+", using identity"),b;e=f.l;return e(W(a,b,c,f.o[0]),{},a)}console.error(B(c)+" is no subtype of "+B(e)+" (trying to cast the term "+b+")");return b}function X(a,b,c){a.i[b]||(a.i[b]={});a.i[b].S||(a.i[b].S=[]);a.i[b].v||(a.i[b].v=!1);a.hasOwnProperty("global")||(a.i[b].global=c)}
+function dc(a,b){var c=b.I;if(b.isuniform)return a.D[b.uvariable].type;if("variable"===b.ctype)return b=b.name,b=c[b]||b,a.i[b].v;if("function"===b.ctype&&a.B.hasOwnProperty(b.oper))return a.i[c[b.oper]].v;if("number"===b.ctype)return Za(b);if("void"===b.ctype)return z.T;if("field"===b.ctype){a=J(Y(a,b.obj));if(1==b.key.length){if("list"===a.type)return a.parameters;if(F(a,z.w))return z.f}else if("xy"==b.key&&F(a,z.w))return z.F;if(!a)return!1}else{if("string"===b.ctype)return z.image;if("function"===
+b.ctype||"infix"===b.ctype){c=Array(b.args.length);for(var e=!0,f=0;f<b.args.length;f++)c[f]=Y(a,b.args[f]),e&="constant"===c[f].type;if(e&&b.impl)return b={ctype:b.ctype,oper:b.oper,impl:b.impl,args:c.map(function(a){return a.value})},b=a.C.evaluateAndVal(b),Za(b);a=y(b.oper);e=V[a]?V[a](c):!1;if(!e&&c.every(function(a){return Xa(a)}))throw console.error("Could not find an implementation for "+a+" with args ("+c.map(B).join(", ")+")"),console.log(b),"error";return e?e.s:!1}}console.error("Don't know how to compute type of");
+console.log(b);return!1}function Y(a,b){if(!b.na||!b.R||a.R>b.R)b.na=dc(a,b),b.R=a.R;return b.na}
+function ec(a,b,c){function e(a,b,c){var e={},f;for(f in a)e[f]=a[f];a=za();X(l,a,!1);h[a].v=c;h[a].oa=!0;e[b]=a;return e}function f(a,b,c,v){a.I=b;for(var p in a.args){var q=v||"repeat$2"===a.oper&&0==p||"repeat$3"===a.oper&&0==p||"_"===a.oper&&1==p,u=b;-1!==["repeat","forall","apply"].indexOf(y(a.oper))&&(1==p?u="repeat$2"===a.oper?e(b,"#",z.u):"repeat$3"===a.oper?e(b,a.args[1].name,z.u):"forall$2"===a.oper||"apply$2"===a.oper?e(b,"#",!1):"forall$3"===a.oper||"apply$3"===a.oper?e(b,a.args[1].name,
+!1):b:2==p&&(u=a.args[1].I));f(a.args[p],u,c,q)}"field"===a.ctype&&f(a.obj,b,c,v);"variable"===a.ctype&&(p=a.name,p=b[p]||p,v&&l.i[p]&&(l.i[p].W=!0));if("="===a.oper)v=a.args[0].name,v=b[v]||v,X(l,v,!0),h[v].S.push(a.args[1]);else if(a.oper&&"regional"===y(a.oper)&&"global"!=c)for(var ra in a.args){v=a.args[ra].name;var sa=za();b[v]=sa;k[c].i||(k[c].i=[]);k[c].i.push(sa);X(l,sa,!1)}else if("forall$2"===a.oper||"apply$2"===a.oper||"forall$3"===a.oper||"apply$3"===a.oper)h[2===a.args.length?a.args[1].I["#"]:
+a.args[2].I[a.args[1].name]].S.push({ctype:"infix",oper:"_",args:[a.args[0],{ctype:"number",value:{real:1,imag:0}}],I:a.args[0].I});else if("function"===a.ctype&&k.hasOwnProperty(a.oper)){c=a.oper;ra=c.replace("$","_");X(l,ra,!1);b[c]=ra;b={};for(sa in k[c].arglist)p=k[c].arglist[sa].name,q=ra+"_"+p,b[p]=q,X(l,q,!1),h[q].S.push(a.args[sa]);k[c].qa||(k[c].qa=!0,f(k[c].body,b,c,v),h[ra].S.push(k[c].body))}}var h=a.i,k=a.B,l=a;f(b,c,"global",!1)}
+function fc(a,b){function c(a){if(a.hasOwnProperty("dependsOnPixel"))return a.dependsOnPixel;if("variable"===a.ctype){var b=a.name;b=a.I[b]||b;return k[b]?a.dependsOnPixel=!0:a.dependsOnPixel=!1}b="random randomint randominteger randombool randomnormal verbatimglsl".split(" ");if("function"===a.ctype&&-1!==b.indexOf(y(a.oper)))return a.dependsOnPixel=!0;if("repeat$2"===a.oper||"forall$2"===a.oper||"apply$2"===a.oper)return c(a.args[1])?(k[a.args[1].I["#"]]=!0,a.dependsOnPixel=!0):a.dependsOnPixel=
+!1;if("repeat$3"===a.oper||"forall$3"===a.oper||"apply$3"===a.oper)return c(a.args[2])?(k[a.args[2].I[a.args[1].name]]=!0,a.args[1].dependsOnPixel=!0,a.dependsOnPixel=!0):a.dependsOnPixel=!1;for(var e in a.args)if(c(a.args[e]))return a.dependsOnPixel=!0;return"function"===a.ctype&&h.hasOwnProperty(a.oper)&&c(h[a.oper].body)?a.dependsOnPixel=!0:"field"===a.ctype?a.dependsOnPixel=c(a.obj):a.dependsOnPixel=!1}function e(a,b){if(c(a)){for(var f in a.args)e(a.args[f],b||"repeat$2"===a.oper&&0==f||"repeat$3"===
+a.oper&&0==f||"_"===a.oper&&1==f);"field"===a.ctype&&e(a.obj,b);"function"===a.ctype&&h.hasOwnProperty(a.oper)&&(a=a.oper,q.hasOwnProperty(a)||(q[a]=!0,e(h[a].body,b)))}else if("boolean"!==a.ctype&&"number"!==a.ctype&&"void"!==a.ctype){".."===a.oper&&(b=!0);f=!1;var k;for(k in u)if(!f&&wa(a,u[k].U)){f=!0;var l=k}f||(l=za(),u[l]={U:a,type:!1,W:b});u[l].W=u[l].W||b;a.isuniform=!0;a.uvariable=l}}var f=a.i,h=a.B,k={cgl_pixel:!0,"cgl_pixel.x":!0,"cgl_pixel.y":!0},l;for(l in f)if(1<=f[l].S.length||f[l].oa)k[l]=
+!0;c(b);var q={"":!0},u=a.D;e(b,!1)}function gc(a,b){if("function"===b.ctype&&!a.B.hasOwnProperty(b.oper)&&null!==a.C.getMyfunction(b.oper)){var c=b.oper;a.B[c]=va(a.C.getMyfunction(c));gc(a,a.B[c].body)}for(var e in b.args)gc(a,b.args[e])}
+function hc(a,b){function c(a){var b={},c;for(c in a)b[c]=a[c];return b}function e(a,b){"repeat$2"===a.oper||"forall$2"===a.oper||"apply$2"===a.oper?(b=c(b),b["#"]=!0):"repeat$3"===a.oper||"forall$3"===a.oper||"apply$3"===a.oper?(b=c(b),b[a.args[1].name]=!0):"="===a.oper&&(b[a.args[0].name]=!0);for(var f in a.args)e(a.args[f],b);"field"===a.ctype&&e(a.obj,b);"variable"===a.ctype&&(a=a.name,b[a]||(h[a]=!0))}var f={},h={};e(b,{});X(a,"cgl_pixel",!1);a.i.cgl_pixel.v=z.F;if(1==Object.keys(h).length)f[Object.keys(h)[0]]=
+"cgl_pixel";else if(h["#"])f["#"]="cgl_pixel";else if(h.x&&h.y)X(a,"cgl_pixel.x",!1),a.i["cgl_pixel.x"].v=z.f,f.x="cgl_pixel.x",X(a,"cgl_pixel.y",!1),a.i["cgl_pixel.y"].v=z.f,f.y="cgl_pixel.y";else{b=[];for(var k in h)a.C.nada==a.C.evaluateAndVal({ctype:"variable",name:k})&&b.push(k);1==b.length?f[b[0]]="cgl_pixel":h.p?f.p="cgl_pixel":h.z&&(f.z="cgl_pixel")}"cgl_pixel"===f.z&&(a.i.cgl_pixel.v=z.h);return f}
+function Z(a,b,c){var e=Y(a,b);if(b.isuniform)return b=b.uvariable,c?{code:"",m:"constant"===e.type?mb(e.value,J(e)):b}:{code:""};if(";"===b.oper){e={m:""};for(var f="",h=b.args.length-1,k=h;0<=k;k--)"void"===b.args[k].ctype&&(h=k-1);for(k=0;k<=h;k++)e=Z(a,b.args[k],c&&k===h),f+=e.code;return c?{code:f,m:e.m}:{code:f}}if("constant"===e.type)return c?{m:mb(e.value,J(e)),code:""}:{code:""};if("="===b.oper)return e=Z(a,b.args[1],!0),b=Z(a,b.args[0],!0).m+" = "+W(a,e.m,Y(a,b.args[1]),Y(a,b.args[0])),
+c?{code:e.code,m:b}:{code:e.code+b+";\n"};if("repeat$2"===b.oper||"repeat$3"===b.oper){f=Z(a,b.args[0],!0);if("constant"!==Y(a,b.args[0]).type)return console.error("repeat possible only for fixed constant number in GLSL"),!1;e="repeat$2"===b.oper?b.args[1].I["#"]:b.args[2].I[b.args[1].name];f=Number(f.m);h="";if("constant"===a.i[e].v.type)for(k=1;k<=f;k++){a.i[e].v=eb(k);a.R++;var l=Z(a,b.args["repeat$2"===b.oper?1:2],k===f&&c);h+=l.code;if(k===f&&c)return{code:h,m:l.m}}else if(k="",l=Z(a,b.args["repeat$2"===
+b.oper?1:2],c),b=Y(a,b.args["repeat$2"===b.oper?1:2]),c&&(k=za(),a.i[k]||(X(a,k,!0),a.i[k].v=b)),h=h+("for(int "+e+"=1; "+e+" <= "+f+"; "+e+"++) {\n")+l.code,c&&(h+=k+" = "+l.m+";\n"),h+="}\n",c)return{code:h,m:k};return{code:h}}if("forall$2"===b.oper||"forall$3"===b.oper||"apply$2"===b.oper||"apply$3"===b.oper){var q=Y(a,b.args[0]);if("list"!==q.type&&("constant"!==q.type||"list"!==q.value.ctype))return console.error(b.oper+" only possible for lists"),!1;f=q.length||q.value.value.length;k=2===b.args.length?
+b.args[1].I["#"]:b.args[2].I[b.args[1].name];var u=a.i[k].v,p=l="";c&&(p=za(),l+=R(e)+" "+p+";\n");"list"===e.type&&pb(e,a);if("constant"===a.i[k].v.type||"constant"===q.type)for(q=a.C.evaluateAndVal(b.args[0]),u=0;u<f;u++)a.i[k].v=Za(q.value[u]),a.R++,h=Z(a,b.args[2===b.args.length?1:2],c),l+=h.code,"forall$2"===b.oper||"forall$3"===b.oper?u+1===f&&c&&(l+=p+" = "+h.m+";\n"):c&&(l+=Q(e,u)([p],[],a)+" = "+h.m+";\n");else{h=Z(a,b.args[2===b.args.length?1:2],c);var v=Z(a,b.args[0],!0);l+=v.code;var D=
+v.m;!a.i[D]&&!a.D[D]&&2<=q.length&&(D=za(),l+=R(q)+" "+D+" = "+v.m+";\n");a.i[k].global=!0;for(v=0;v<f;v++)l+=k+" = "+Q(q,v)([D],[],a)+";\n",l+=h.code,c&&("forall$2"===b.oper||"forall$3"===b.oper?v===f-1&&(l+=p+" = "+h.m+";\n"):l+=Q(e,v)([p],[],a)+" = "+h.m+";\n");"list"===u.type&&pb(u,a)}return c?{code:l,m:p}:{code:l}}if("if$2"===b.oper||"if$3"===b.oper){l=Z(a,b.args[0],!0);f=Y(a,b.args[0]);k=h="";p=Z(a,b.args[1],c);c&&(k=za(),a.i[k]||(X(a,k,!0),a.i[k].v=e));"constant"!=f.type&&(h+=l.code,h+="if("+
+l.m+") {\n");if("constant"!=f.type||"constant"==f.type&&f.value.value)h+=p.code,c&&(h+=k+" = "+W(a,p.m,Y(a,b.args[1]),e)+";\n");"if$3"===b.oper&&(l=Z(a,b.args[2],c),"constant"!=f.type&&(h+="} else {\n"),"constant"!=f.type||"constant"==f.type&&!f.value.value)&&(h+=l.code,c&&(h+=k+" = "+W(a,l.m,Y(a,b.args[2]),e)+";\n"));"constant"!=f.type&&(h+="}\n");return c?{code:h,m:k}:{code:h}}if("function"===b.ctype||"infix"===b.ctype){l=b.oper;if("verbatimglsl"===y(l))return b=a.C.evaluateAndVal(b.args[0]).value,
+c?{m:b,code:""}:{code:b};e=b.args.map(function(b){return Z(a,b,!0)});f=b.args.map(function(b){return Y(a,b)});if(a.B.hasOwnProperty(l))for(k=ic(a,l),h=Array(e.length),p=0;p<e.length;p++)h[p]=a.i[a.B[l].body.I[a.B[l].arglist[p].name]].v;else{l=y(l);if("regional"===l)return c?{m:"",code:""}:{code:""};k=V[l](f);if(!k)return console.error("Could not find an implementation for "+l+"("+f.map(B).join(", ")+").\nReturning empty code"),c?{m:"",code:""}:{code:""};h=k.o;k=k.l}l="";p=Array(e.length);for(q=0;q<
+e.length;q++)l+=e[q].code,p[q]=W(a,e[q].m,f[q],h[q]);b=k(p,b.modifs,a);return c?{m:b,code:l}:{code:l+b+";\n"}}if("variable"===b.ctype)return e=b.name,e=b.I[e]||e,c?{m:e,code:""}:{code:e+";\n"};if("void"===b.ctype)return c?{m:"",code:""}:{code:""};if("field"===b.ctype&&(e=Y(a,b.obj),k={x:0,y:1,z:2,r:0,g:1,b:2,a:3}[b.key],f=!1,h=Z(a,b.obj,!0).m,void 0!=k&&"list"===e.type?f=Q(e,k)([h],null,a):"xy"===b.key&&"list"===e.type?(2===e.length&&(f=h),3===e.length&&(f=O("dehomogenize")([W(a,h,e,z.w)],null,a))):
+e===z.w&&(k={xy:"dehomogenize",x:"dehomogenizex",y:"dehomogenizey"},k[b.key]&&(f=O(k[b.key])([W(a,h,e,z.w)],null,a))),f))return c?{m:f,code:""}:{code:f+";\n"};console.error("dont know how to this.compile "+JSON.stringify(b))}function ic(a,b){jc(a,b,a.B[b].arglist.length);return N(b.replace("$","_"))}
+function jc(a,b,c){if(!a.mark("compiledfunctions",b)){for(var e=a.B[b],f=b.replace("$","_"),h=e.body.I,k=Array(c),l=0;l<c;l++)k[l]=e.arglist[l].name;c=a.i[f].v===z.T;var q=R(a.i[f].v)+" "+f+"("+k.map(function(b){return R(a.i[h[b]].v)+" "+h[b]}).join(", ")+"){\n";for(u in e.i)k=e.i[u],q+=R(a.i[k].v)+" "+k+";\n";var u=Z(a,e.body,!c);e=Y(a,e.body);q+=u.code;c||(q+="return "+W(a,u.m,e,a.i[f].v)+";\n");q+="}\n";a.add("compiledfunctions",b,function(){return q})}}
+function Ta(a,b){ya=0;var c=b=va(b);gc(a,c);ec(a,c,hc(a,c));fc(a,c);for(var e in a.D){c=a.C.evaluateAndVal(a.D[e].U);if(!c.ctype||"undefined"===c.ctype){console.error("can not evaluate:");console.log(a.D[e].U);break}a.D[e].type=a.D[e].W?Za(c):xa(c)}e=!0;for(var f in a.i)a.i[f].v=a.i[f].v||!1,a.i[f].W&&(a.i[f].v=eb(1),a.R++);for(;e;){e=!1;for(var h in a.i)if(!a.i[h].W)for(var k in a.i[h].S){f=J(Y(a,a.i[h].S[k]));var l=c=a.i[h].v||!1;f&&(c?F(f,c)?l=c:l=A(c,f):l=f,l&&l!==c&&(a.i[h].v=l,a.R++,e=!0))}}for(var q in a.D)"list"===
+a.D[q].type.type&&pb(a.D[q].type,a);for(var u in a.i)"list"===a.i[u].v.type&&pb(a.i[u].v,a);h=Z(a,b,!0);k=Y(a,b);b=W(a,h.m,k,z.color);F(k,z.color)||console.error("expression does not generate a color");k=cc(a,"structs");k+=cc(a,"uniforms");q=[];for(var p in a.D)"constant"!=a.D[p].type.type&&a.D[p].type!=z.image&&q.push("uniform "+R(a.D[p].type)+" "+p+";");k+=q.join("\n");p="";for(var v in a.N)p+=a.N[v].code+"\n";k=k+p+cc(a,"includedfunctions");k+=cc(a,"functions");for(var D in a.i)a.i[D].v&&a.i[D].global&&
+(k+=R(a.i[D].v)+" "+D+";\n");k+=cc(a,"compiledfunctions");k+="void main(void) {\n"+h.code+"gl_FragColor = "+b+";\n}\n";console.log(k);v={};if(a.j.compiledfunctions)for(var ea in a.j.compiledfunctions.ga)v[ea]=a.C.getMyfunction(ea).generation;return{code:k,D:a.D,N:a.N,ea:v}};function kc(a,b,c,e){this.U=b;this.C=e;this.B=c;lc(this);b=this.j;this.name=a;this.code="uniform sampler2D _sampler"+a+";\nuniform float _ratio"+a+";\nuniform vec2 _cropfact"+a+";\nvec4 _imagergba"+a+"(vec2 A, vec2 B, vec2 p) {\n p -= A; B -= A;\n float b = dot(B,B);\n p = vec2(dot(p,B),_ratio"+a+"*dot(p,vec2(-B.y,B.x)))/b;\n "+(b.repeat?"p = mod(p, vec2(1.));":"")+"\n "+(b.repeat&&b.mipmap?"vec4 color = vec4(0.);\n float totalWeight = 0.;\n for(int dx=0; dx<2; dx++) for(int dy=0; dy<2; dy++) {\n vec2 delta = .5*vec2(dx, dy);\n vec2 center = delta+vec2(.5);\n vec2 tc = fract(p-delta)+delta;\n float dst = dot(abs(tc-center),vec2(1.));\n float w = max(.5-dst,0.);\n w=w*w;\n color += w * texture2D(_sampler"+
+a+", tc*_cropfact"+a+");\n totalWeight += w;\n }\n return color/totalWeight;":b.repeat?"return texture2D(_sampler"+a+", p*_cropfact"+a+");":"if(0. <= p.x && p.x <= 1. && 0. <= p.y && p.y <= 1.)\n return texture2D(_sampler"+a+", p*_cropfact"+a+");\n else\n return vec4(0.);")+"\n }"}
+function lc(a){var b=a.B,c=a.C;b={interpolate:b.hasOwnProperty("interpolate")?c.evaluateAndVal(b.interpolate).value:!0,mipmap:b.hasOwnProperty("mipmap")?c.evaluateAndVal(b.mipmap).value:!1,repeat:b.hasOwnProperty("repeat")?c.evaluateAndVal(b.repeat).value:!1};!a.j||a.j.mipmap==b.mipmap&&a.j.repeat==b.repeat||(console.log("enfore recompilation because texture modifiers changed."),pa++);a.j=b}
+function ab(a){var b=a.C.evaluateAndVal(a.U).value,c="string"===typeof b?a.C.getImage(b,!0):b;if(null==c)return console.error("Could not find image "+b+"."),t;lc(a);return Ma(c,a.C,a.j)}function mc(a,b,c){c.N.hasOwnProperty(a)||(c.N[a]=new kc(a,c.D[a].U,b,c.C));return a}function bc(a,b,c){return["_imagergba",mc(a[2],b,c),"(",a[0],",",a[1],",",a[3],")"].join("")}function $b(a,b,c){return["(_imagergba",mc(a[2],b,c),"(",a[0],",",a[1],",",a[3],").rgb)"].join("")}
+function ac(a,b,c){c.add("uniforms","corners",function(){return"uniform vec2 _lowerleft, _lowerright;"});return["_imagergba",mc(a[0],b,c),"(_lowerleft, _lowerright, ",a[1],")"].join("")}function Zb(a,b,c){c.add("uniforms","corners",function(){return"uniform vec2 _lowerleft, _lowerright;"});return["(_imagergba",mc(a[0],b,c),"(_lowerleft, _lowerright, ",a[1],").rgb)"].join("")};function nc(a){var b=void 0===b?null:b;return"list"!==a.ctype?(console.log("argument is not a list"),b):a.value}function db(a){var b=void 0===b?[.5,.5,.5]:b;if("number"===a.ctype){var c=oc(a);if(!isNaN(c))return[c,c,c]}a=nc(a);return null===a?b:3!=a.length?(console.log("Not an RGB color vector"),b):a.map(function(a){return oc(a)})}
+function cb(a){var b=void 0===b?Number.NaN:b;if("number"!==a.ctype)return console.log("argument is not a number"),b;b=a.value;a=b.real;b=b.imag;0!==b&&console.log("complex number is not real");b=Math.round(a);b!==a&&console.log("number is not an integer");return b}
+function oc(a){var b=void 0===b?Number.NaN:b;b=void 0===b?Number.NaN:b;"number"!==a.ctype?(console.log("argument is not a number"),a=b):(a=a.value,b=a.real,0!==a.imag&&console.log("complex number is not real"),a=b);return 0>a?0:1<a?1:a};function ta(a){this.message=a}ta.prototype.toString=function(){return this.message};
+function Qa(a,b){var c=r;this.handle=c.createProgram();c.j&&(a="#version 300 es\n"+a.replace(/attribute/g,"in").replace(/varying/g,"out"),b="#version 300 es\n"+b.replace(/varying/g,"in").replace(/gl_FragColor/g,"FragColor").replace(/texture2D/g,"texture").replace(/precision highp float;/g,"precision highp float;\n#define webgl2 true\nout vec4 FragColor;"));this.V=pc(this,c,c.VERTEX_SHADER,a);pc(this,c,c.FRAGMENT_SHADER,b);a=this.handle;c.linkProgram(a);if(!c.getProgramParameter(a,c.LINK_STATUS))throw new ta("Error linking shader:\n"+
+c.getProgramInfoLog(a));c.validateProgram(a);if(!c.getProgramParameter(a,c.VALIDATE_STATUS))throw new ta("Error validating shader:\n"+c.getProgramInfoLog(a));var e=this.handle,f,h,k={},l;b=c.getProgramParameter(e,c.ACTIVE_UNIFORMS);for(a=0;a<b;++a){var q=c.getActiveUniform(e,a);if(null!==q&&(f=q.name.replace(/\]/g,""))){for(l=k;null!==(h=/[.\[]/.exec(f));){var u=f.substr(0,h.index);l.hasOwnProperty(u)?l=l[u]:"."===h[0]?l=l[u]={}:l=l[u]=[];f=f.substr(h.index+1)}if(1<q.size){h=q.size;var p=Array(h);
+for(u=0;u<h;++u){var v=q.name+"["+u+"]";v=qc(this,c,v,q);p[u]=v}l[f]=p}else v=qc(this,c,q.name,q),l[f]=v}}this.uniform=k}function pc(a,b,c,e){c=b.createShader(c);b.shaderSource(c,e);b.compileShader(c);if(!b.getShaderParameter(c,b.COMPILE_STATUS))throw console.warn(e.split("\n")),new ta("Error compiling shader:\n"+b.getShaderInfoLog(c));b.attachShader(a.handle,c);return c}Qa.prototype.use=function(a){a.useProgram(this.handle);return this};
+function qc(a,b,c,e){a=b.getUniformLocation(a.handle,c);switch(e.type){case b.FLOAT:return b.uniform1fv.bind(b,a);case b.FLOAT_VEC2:return b.uniform2fv.bind(b,a);case b.FLOAT_VEC3:return b.uniform3fv.bind(b,a);case b.FLOAT_VEC4:return b.uniform4fv.bind(b,a);case b.BOOL:case b.INT:case b.SAMPLER_2D:case b.SAMPLER_CUBE:return b.uniform1iv.bind(b,a);case b.BOOL_VEC2:case b.INT_VEC2:return b.uniform2iv.bind(b,a);case b.BOOL_VEC3:case b.INT_VEC3:return b.uniform3iv.bind(b,a);case b.BOOL_VEC4:case b.INT_VEC4:return b.uniform4iv.bind(b,
+a);case b.FLOAT_MAT2:return b.uniformMatrix2fv.bind(b,a,!1);case b.FLOAT_MAT3:return b.uniformMatrix3fv.bind(b,a,!1);case b.FLOAT_MAT4:return b.uniformMatrix4fv.bind(b,a,!1);default:throw new ta("Unknown data type for uniform "+c);}};
+}).call(this);//# sourceMappingURL=CindyGL.js.map
+
+
diff --git a/public/build/LICENSE_cindyjs b/public/build/LICENSE_cindyjs
new file mode 100644
index 00000000..66b0c460
--- /dev/null
+++ b/public/build/LICENSE_cindyjs
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright {yyyy} {name of copyright owner}
+
+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.
diff --git a/public/js/extra.js b/public/js/extra.js
index c71475b5..633413eb 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -403,6 +403,49 @@ export function finishView (view) {
console.warn(errormessage)
}
})
+ // cindy.js
+ const cindys = view.find('code.cindy.hljs.raw').removeClass('raw').removeClass("hljs")
+ cindys.each((key, value) => {
+ try {
+ var $value = $(value)
+ let drawscript = $value.text();
+ let canvas = document.createElement("div")
+ let debug = document.createElement("div")
+ var $ele = $(value).closest("pre")[0]
+
+ // remove current children (to remove the pre-formatted code text)
+ while ($ele.lastChild)
+ $ele.removeChild($ele.lastChild)
+
+ // append debug output (error messages) and canvas
+ $ele.appendChild(debug)
+ $ele.appendChild(canvas)
+ $ele.style.height = "30em";
+
+ console.log("cindyscript code is:", drawscript, $ele[0])
+ console.error = (err) => {
+ debug.innerText = err
+ $ele.removeChild(canvas)
+ }
+ CindyJS({
+ scripts: {draw: drawscript},
+ autoplay: true,
+ ports: [{
+ element: canvas,
+ fill: "parent",
+ transform: [{
+ visibleRect: [0, 1, 1, 0]
+ }]
+ }]
+ });
+
+ console.log("the cindy render hook was executed!")
+ } catch (err) {
+ $value.unwrap()
+ $value.parent().append(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
+ console.warn(err)
+ }
+ })
// abc.js
const abcs = view.find('div.abc.raw').removeClass('raw')
abcs.each((key, value) => {
diff --git a/public/views/hedgedoc/footer.ejs b/public/views/hedgedoc/footer.ejs
index 51d47221..ebe7ab6d 100644
--- a/public/views/hedgedoc/footer.ejs
+++ b/public/views/hedgedoc/footer.ejs
@@ -20,10 +20,13 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/1.7.0/viz.js" integrity="sha256-8t+rndrF+TU4JtelmOH1lDHTMe2ovhO2UbzDArp5lY8=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.8/validator.min.js" integrity="sha256-LHeY7YoYJ0SSXbCx7sR14Pqna+52moaH3bhv0Mjzd/M=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/abcjs/3.1.1/abcjs_basic-min.js" integrity="sha256-Sq1r2XXWXQoShQKsS0Wrf5r7fRkErd9Fat9vHYeU68s=" crossorigin="anonymous"></script>
+<script type="text/javascript" src="https://cindyjs.org/dist/latest/Cindy.js"></script>
<%- include('../build/index-scripts') %>
<% } else { %>
<script src="<%- serverURL %>/build/MathJax/MathJax.js" defer></script>
<script src="<%- serverURL %>/build/MathJax/config/TeX-AMS-MML_HTMLorMML.js" defer></script>
<script src="<%- serverURL %>/build/MathJax/config/Safe.js" defer></script>
+<script src="<%- serverURL %>/build/Cindy.js"></script>
+<script src="<%- serverURL %>/build/CindyGL.js"></script>
<%- include('../build/index-pack-scripts') %>
<% } %>