summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js')
-rw-r--r--Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js1462
1 files changed, 745 insertions, 717 deletions
diff --git a/Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js b/Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js
index 04aa2fd9134..2be04890fd5 100644
--- a/Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js
+++ b/Master/texmf-dist/doc/support/ketcindy/ketcindyjs/Cindy.js
@@ -1,159 +1,159 @@
/* 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/bb244cab7fdc8d4ea030751ec40c6d384c09f464
+ * See https://github.com/CindyJS/CindyJS/tree/8c01b8d1d336e92934ad80c44aafc5510a1aea36
* for corresponding sources and their respective licensing conditions.
*/
-var enableInlineVideo=function(){function p(f,k,p,F){function E(p){ea=k(E,F);f(p-(K||p));K=p}var ea,K;return{start:function(){ea||E(0)},stop:function(){p(ea);ea=null;K=0}}}function E(f,k,p,F){function E(k){!!f[p]===!!F&&k.stopImmediatePropagation();delete f[p]}return f.addEventListener(k,E,!1),E}function ja(f,k,p,F){function E(f){p[k]=f}F&&E(f[k]);Object.defineProperty(f,k,{get:function(){return p[k]},set:E})}function Ca(f,k,p){p.addEventListener(k,function(){return f.dispatchEvent(new Event(k))})}
-function pa(f,k){Promise.resolve().then(function(){f.dispatchEvent(new Event(k))})}function Da(f){var k=new Audio;return Ca(f,"play",k),Ca(f,"playing",k),Ca(f,"pause",k),k.crossOrigin=f.crossOrigin,k.src=f.src||f.currentSrc||"data:",k}function aa(k,p,F){(K||0)+200<Date.now()&&(k[Ea]=!0,K=Date.now());F||(k.currentTime=p);f[++nb%3]=100*p|0}function k(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)),aa(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[Ea],this.video.pause(!0))}function Oa(){var f=this[W];return this.webkitDisplayingFullscreen?void this[ob]():("data:"!==f.driver.src&&f.driver.src!==this.src&&(aa(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||(pa(this,"play"),f.video.readyState>=f.video.HAVE_ENOUGH_DATA&&pa(this,"playing")))))}function F(f){var k=this[W];k.driver.pause();k.updater.stop();this.webkitDisplayingFullscreen&&this[sa]();k.paused&&!f||(k.paused=!0,k.hasAudio||pa(this,"pause"),this.ended&&(this[Ea]=!0,pa(this,"ended")))}function ea(F,E){var I=F[W]={};I.paused=!0;I.hasAudio=E;I.video=F;I.updater=p(k.bind(I),requestAnimationFrame,cancelAnimationFrame);E?I.driver=Da(F):(F.addEventListener("canplay",
-function(){F.paused||pa(F,"playing")}),I.driver={src:F.src||F.currentSrc||"data:",muted:!0,paused:!0,pause:function(){I.driver.paused=!0},play:function(){I.driver.paused=!1;I.driver.currentTime>=I.video.duration&&aa(F,0)},get ended(){return I.driver.currentTime>=I.video.duration}});F.addEventListener("emptied",function(){var f=!I.driver.src||"data:"===I.driver.src;I.driver.src&&I.driver.src!==F.src&&(aa(F,0,!0),I.driver.src=F.src,f?I.driver.play():I.updater.stop())},!1);F.addEventListener("webkitbeginfullscreen",
-function(){F.paused?E&&0===I.driver.buffered.length&&I.driver.load():(F.pause(),F[ob]())});E&&(F.addEventListener("webkitendfullscreen",function(){I.driver.currentTime=F.currentTime}),F.addEventListener("seeking",function(){0>f.indexOf(100*F.currentTime|0)&&(I.driver.currentTime=F.currentTime)}))}var K,U="object"==typeof document&&"object-fit"in document.head.style&&!matchMedia("(-webkit-video-playable-inline)").matches,W="bfred-it:iphone-inline-video",Ea="bfred-it:iphone-inline-video:event",ob="bfred-it:iphone-inline-video:nativeplay",
-sa="bfred-it:iphone-inline-video:nativepause",f=[],nb=0;return function(f,k){if(void 0===k&&(k={}),!f[W])if(k.everywhere||U&&(k.iPad||k.ipad?/iPhone|iPod|iPad/:/iPhone|iPod/).test(navigator.userAgent)){!f.paused&&f.webkitDisplayingFullscreen&&f.pause();ea(f,!f.muted);var p=f[W];f[ob]=f.play;f[sa]=f.pause;f.play=Oa;f.pause=F;ja(f,"paused",p.driver);ja(f,"muted",p.driver,!0);ja(f,"playbackRate",p.driver,!0);ja(f,"ended",p.driver);ja(f,"loop",p.driver,!0);E(f,"seeking");E(f,"seeked");E(f,"timeupdate",
-Ea,!1);E(f,"ended",Ea,!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 p(b,d,e){f.biginteger_used=1;null!=b&&("number"==typeof b&&"undefined"==typeof d?this.fromInt(b):"number"==typeof b?this.fromNumber(b,d,e):null==d&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,d))}function E(){return new p(null,void 0,void 0)}function ja(b,d,e,q,f,k){for(;0<=--k;){var v=d*this[b++]+e[q]+f;f=Math.floor(v/67108864);e[q++]=v&67108863}return f}function Ca(b,d,e,q,f,k){var v=d&32767;for(d>>=15;0<=--k;){var C=this[b]&32767,p=this[b++]>>15,F=d*C+p*v,C=
-v*C+((F&32767)<<15)+e[q]+(f&1073741823);f=(C>>>30)+(F>>>15)+d*p+(f>>>30);e[q++]=C&1073741823}return f}function pa(b,d,e,q,f,k){var v=d&16383;for(d>>=14;0<=--k;){var C=this[b]&16383,p=this[b++]>>14,F=d*C+p*v,C=v*C+((F&16383)<<14)+e[q]+f;f=(C>>28)+(F>>14)+d*p;e[q++]=C&268435455}return f}function Da(b,d){var e=cb[b.charCodeAt(d)];return null==e?-1:e}function aa(b){var d=E();d.fromInt(b);return d}function k(b){var d=1,e;0!=(e=b>>>16)&&(b=e,d+=16);0!=(e=b>>8)&&(b=e,d+=8);0!=(e=b>>4)&&(b=e,d+=4);0!=(e=
-b>>2)&&(b=e,d+=2);0!=b>>1&&(d+=1);return d}function Oa(b){this.m=b}function F(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 ea(b,d){return b&d}function K(b,d){return b|d}function U(b,d){return b^d}function W(b,d){return b&~d}function Ea(){}function ob(b){return b}function sa(b){this.r2=E();this.q3=E();p.ONE.dlShiftTo(2*b.t,this.r2);this.mu=this.r2.divide(b);this.m=b}var f={use_lines:!0,use_xyz:!1},nb=!1;"undefined"!==typeof module&&
-module.exports?(module.exports=f,nb=!0):"undefined"!==typeof document?window.ClipperLib=f:self.ClipperLib=f;var V;if(nb)Y="chrome",V="Netscape";else{var Y=navigator.userAgent.toString().toLowerCase();V=navigator.appName}var I,Xb,Jb,Qa,ab,xb;I=-1!=Y.indexOf("chrome")&&-1==Y.indexOf("chromium")?1:0;nb=-1!=Y.indexOf("chromium")?1:0;Xb=-1!=Y.indexOf("safari")&&-1==Y.indexOf("chrome")&&-1==Y.indexOf("chromium")?1:0;Jb=-1!=Y.indexOf("firefox")?1:0;Y.indexOf("firefox/17");Y.indexOf("firefox/15");Y.indexOf("firefox/3");
-Qa=-1!=Y.indexOf("opera")?1:0;Y.indexOf("msie 10");Y.indexOf("msie 9");ab=-1!=Y.indexOf("msie 8")?1:0;xb=-1!=Y.indexOf("msie 7")?1:0;Y=-1!=Y.indexOf("msie ")?1:0;f.biginteger_used=null;"Microsoft Internet Explorer"==V?(p.prototype.am=Ca,V=30):"Netscape"!=V?(p.prototype.am=ja,V=26):(p.prototype.am=pa,V=28);p.prototype.DB=V;p.prototype.DM=(1<<V)-1;p.prototype.DV=1<<V;p.prototype.FV=Math.pow(2,52);p.prototype.F1=52-V;p.prototype.F2=2*V-52;var cb=[],qa;V=48;for(qa=0;9>=qa;++qa)cb[V++]=qa;V=97;for(qa=
-10;36>qa;++qa)cb[V++]=qa;V=65;for(qa=10;36>qa;++qa)cb[V++]=qa;Oa.prototype.convert=function(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b};Oa.prototype.revert=function(b){return b};Oa.prototype.reduce=function(b){b.divRemTo(this.m,null,b)};Oa.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e);this.reduce(e)};Oa.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};F.prototype.convert=function(b){var d=E();b.abs().dlShiftTo(this.m.t,d);d.divRemTo(this.m,null,d);0>b.s&&0<d.compareTo(p.ZERO)&&
-this.m.subTo(d,d);return d};F.prototype.revert=function(b){var d=E();b.copyTo(d);this.reduce(d);return d};F.prototype.reduce=function(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var d=0;d<this.m.t;++d){var e=b[d]&32767,q=e*this.mpl+((e*this.mph+(b[d]>>15)*this.mpl&this.um)<<15)&b.DM,e=d+this.m.t;for(b[e]+=this.m.am(0,q,b,d,0,this.m.t);b[e]>=b.DV;)b[e]-=b.DV,b[++e]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)};F.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e);this.reduce(e)};
-F.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};p.prototype.copyTo=function(b){for(var d=this.t-1;0<=d;--d)b[d]=this[d];b.t=this.t;b.s=this.s};p.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};p.prototype.fromString=function(b,d){var e;if(16==d)e=4;else if(8==d)e=3;else if(256==d)e=8;else if(2==d)e=1;else if(32==d)e=5;else if(4==d)e=2;else{this.fromRadix(b,d);return}this.s=this.t=0;for(var q=b.length,f=!1,k=0;0<=--q;){var v=8==e?
-b[q]&255:Da(b,q);0>v?"-"==b.charAt(q)&&(f=!0):(f=!1,0==k?this[this.t++]=v:k+e>this.DB?(this[this.t-1]|=(v&(1<<this.DB-k)-1)<<k,this[this.t++]=v>>this.DB-k):this[this.t-1]|=v<<k,k+=e,k>=this.DB&&(k-=this.DB))}8==e&&0!=(b[0]&128)&&(this.s=-1,0<k&&(this[this.t-1]|=(1<<this.DB-k)-1<<k));this.clamp();f&&p.ZERO.subTo(this,this)};p.prototype.clamp=function(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t};p.prototype.dlShiftTo=function(b,d){var e;for(e=this.t-1;0<=e;--e)d[e+b]=this[e];for(e=
-b-1;0<=e;--e)d[e]=0;d.t=this.t+b;d.s=this.s};p.prototype.drShiftTo=function(b,d){for(var e=b;e<this.t;++e)d[e-b]=this[e];d.t=Math.max(this.t-b,0);d.s=this.s};p.prototype.lShiftTo=function(b,d){var e=b%this.DB,q=this.DB-e,f=(1<<q)-1,k=Math.floor(b/this.DB),v=this.s<<e&this.DM,C;for(C=this.t-1;0<=C;--C)d[C+k+1]=this[C]>>q|v,v=(this[C]&f)<<e;for(C=k-1;0<=C;--C)d[C]=0;d[k]=v;d.t=this.t+k+1;d.s=this.s;d.clamp()};p.prototype.rShiftTo=function(b,d){d.s=this.s;var e=Math.floor(b/this.DB);if(e>=this.t)d.t=
-0;else{var q=b%this.DB,f=this.DB-q,k=(1<<q)-1;d[0]=this[e]>>q;for(var v=e+1;v<this.t;++v)d[v-e-1]|=(this[v]&k)<<f,d[v-e]=this[v]>>q;0<q&&(d[this.t-e-1]|=(this.s&k)<<f);d.t=this.t-e;d.clamp()}};p.prototype.subTo=function(b,d){for(var e=0,f=0,n=Math.min(b.t,this.t);e<n;)f+=this[e]-b[e],d[e++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f-=b.s;e<this.t;)f+=this[e],d[e++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;e<b.t;)f-=b[e],d[e++]=f&this.DM,f>>=this.DB;f-=b.s}d.s=0>f?-1:0;-1>f?d[e++]=this.DV+
-f:0<f&&(d[e++]=f);d.t=e;d.clamp()};p.prototype.multiplyTo=function(b,d){var e=this.abs(),f=b.abs(),n=e.t;for(d.t=n+f.t;0<=--n;)d[n]=0;for(n=0;n<f.t;++n)d[n+e.t]=e.am(0,f[n],d,n,0,e.t);d.s=0;d.clamp();this.s!=b.s&&p.ZERO.subTo(d,d)};p.prototype.squareTo=function(b){for(var d=this.abs(),e=b.t=2*d.t;0<=--e;)b[e]=0;for(e=0;e<d.t-1;++e){var f=d.am(e,d[e],b,2*e,0,1);(b[e+d.t]+=d.am(e+1,2*d[e],b,2*e+1,f,d.t-e-1))>=d.DV&&(b[e+d.t]-=d.DV,b[e+d.t+1]=1)}0<b.t&&(b[b.t-1]+=d.am(e,d[e],b,2*e,0,1));b.s=0;b.clamp()};
-p.prototype.divRemTo=function(b,d,e){var f=b.abs();if(!(0>=f.t)){var n=this.abs();if(n.t<f.t)null!=d&&d.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=E());var N=E(),v=this.s;b=b.s;var C=this.DB-k(f[f.t-1]);0<C?(f.lShiftTo(C,N),n.lShiftTo(C,e)):(f.copyTo(N),n.copyTo(e));f=N.t;n=N[f-1];if(0!=n){var F=n*(1<<this.F1)+(1<f?N[f-2]>>this.F2:0),bb=this.FV/F,F=(1<<this.F1)/F,pb=1<<this.F2,H=e.t,ea=H-f,K=null==d?E():d;N.dlShiftTo(ea,K);0<=e.compareTo(K)&&(e[e.t++]=1,e.subTo(K,e));p.ONE.dlShiftTo(f,K);
-for(K.subTo(N,N);N.t<f;)N[N.t++]=0;for(;0<=--ea;){var I=e[--H]==n?this.DM:Math.floor(e[H]*bb+(e[H-1]+pb)*F);if((e[H]+=N.am(0,I,e,ea,0,f))<I)for(N.dlShiftTo(ea,K),e.subTo(K,e);e[H]<--I;)e.subTo(K,e)}null!=d&&(e.drShiftTo(f,d),v!=b&&p.ZERO.subTo(d,d));e.t=f;e.clamp();0<C&&e.rShiftTo(C,e);0>v&&p.ZERO.subTo(e,e)}}}};p.prototype.invDigit=function(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var d=b&3,d=d*(2-(b&15)*d)&15,d=d*(2-(b&255)*d)&255,d=d*(2-((b&65535)*d&65535))&65535,d=d*(2-b*d%this.DV)%
-this.DV;return 0<d?this.DV-d:-d};p.prototype.isEven=function(){return 0==(0<this.t?this[0]&1:this.s)};p.prototype.exp=function(b,d){if(4294967295<b||1>b)return p.ONE;var e=E(),f=E(),n=d.convert(this),N=k(b)-1;for(n.copyTo(e);0<=--N;)if(d.sqrTo(e,f),0<(b&1<<N))d.mulTo(f,n,e);else var v=e,e=f,f=v;return d.revert(e)};p.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 d=(1<<b)-1,e,f=!1,n="",k=this.t,v=this.DB-k*this.DB%b;if(0<k--)for(v<this.DB&&0<(e=this[k]>>v)&&(f=!0,n="0123456789abcdefghijklmnopqrstuvwxyz".charAt(e));0<=k;)v<b?(e=(this[k]&(1<<v)-1)<<b-v,e|=this[--k]>>(v+=this.DB-b)):(e=this[k]>>(v-=b)&d,0>=v&&(v+=this.DB,--k)),0<e&&(f=!0),f&&(n+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(e));return f?n:"0"};p.prototype.negate=function(){var b=E();p.ZERO.subTo(this,b);return b};p.prototype.abs=function(){return 0>this.s?this.negate():this};p.prototype.compareTo=
-function(b){var d=this.s-b.s;if(0!=d)return d;var e=this.t,d=e-b.t;if(0!=d)return 0>this.s?-d:d;for(;0<=--e;)if(0!=(d=this[e]-b[e]))return d;return 0};p.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)};p.prototype.mod=function(b){var d=E();this.abs().divRemTo(b,null,d);0>this.s&&0<d.compareTo(p.ZERO)&&b.subTo(d,d);return d};p.prototype.modPowInt=function(b,d){var e;e=256>b||d.isEven()?new Oa(d):new F(d);return this.exp(b,e)};p.ZERO=aa(0);p.ONE=
-aa(1);Ea.prototype.convert=ob;Ea.prototype.revert=ob;Ea.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e)};Ea.prototype.sqrTo=function(b,d){b.squareTo(d)};sa.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 d=E();b.copyTo(d);this.reduce(d);return d};sa.prototype.revert=function(b){return b};sa.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)};sa.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e);this.reduce(e)};sa.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};var H=[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],Zb=67108864/H[H.length-1];p.prototype.chunkSize=
-function(b){return Math.floor(Math.LN2*this.DB/Math.log(b))};p.prototype.toRadix=function(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var d=this.chunkSize(b),d=Math.pow(b,d),e=aa(d),f=E(),n=E(),k="";for(this.divRemTo(e,f,n);0<f.signum();)k=(d+n.intValue()).toString(b).substr(1)+k,f.divRemTo(e,f,n);return n.intValue().toString(b)+k};p.prototype.fromRadix=function(b,d){this.fromInt(0);null==d&&(d=10);for(var e=this.chunkSize(d),f=Math.pow(d,e),n=!1,k=0,v=0,C=0;C<b.length;++C){var F=
-Da(b,C);0>F?"-"==b.charAt(C)&&0==this.signum()&&(n=!0):(v=d*v+F,++k>=e&&(this.dMultiply(f),this.dAddOffset(v,0),v=k=0))}0<k&&(this.dMultiply(Math.pow(d,k)),this.dAddOffset(v,0));n&&p.ZERO.subTo(this,this)};p.prototype.fromNumber=function(b,d,e){if("number"==typeof d)if(2>b)this.fromInt(1);else for(this.fromNumber(b,e),this.testBit(b-1)||this.bitwiseTo(p.ONE.shiftLeft(b-1),K,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(d);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(p.ONE.shiftLeft(b-
-1),this);else{e=[];var f=b&7;e.length=(b>>3)+1;d.nextBytes(e);e[0]=0<f?e[0]&(1<<f)-1:0;this.fromString(e,256)}};p.prototype.bitwiseTo=function(b,d,e){var f,n,k=Math.min(b.t,this.t);for(f=0;f<k;++f)e[f]=d(this[f],b[f]);if(b.t<this.t){n=b.s&this.DM;for(f=k;f<this.t;++f)e[f]=d(this[f],n);e.t=this.t}else{n=this.s&this.DM;for(f=k;f<b.t;++f)e[f]=d(n,b[f]);e.t=b.t}e.s=d(this.s,b.s);e.clamp()};p.prototype.changeBit=function(b,d){var e=p.ONE.shiftLeft(b);this.bitwiseTo(e,d,e);return e};p.prototype.addTo=function(b,
-d){for(var e=0,f=0,n=Math.min(b.t,this.t);e<n;)f+=this[e]+b[e],d[e++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f+=b.s;e<this.t;)f+=this[e],d[e++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;e<b.t;)f+=b[e],d[e++]=f&this.DM,f>>=this.DB;f+=b.s}d.s=0>f?-1:0;0<f?d[e++]=f:-1>f&&(d[e++]=this.DV+f);d.t=e;d.clamp()};p.prototype.dMultiply=function(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()};p.prototype.dAddOffset=function(b,d){if(0!=b){for(;this.t<=d;)this[this.t++]=0;for(this[d]+=
-b;this[d]>=this.DV;)this[d]-=this.DV,++d>=this.t&&(this[this.t++]=0),++this[d]}};p.prototype.multiplyLowerTo=function(b,d,e){var f=Math.min(this.t+b.t,d);e.s=0;for(e.t=f;0<f;)e[--f]=0;var n;for(n=e.t-this.t;f<n;++f)e[f+this.t]=this.am(0,b[f],e,f,0,this.t);for(n=Math.min(b.t,d);f<n;++f)this.am(0,b[f],e,f,0,d-f);e.clamp()};p.prototype.multiplyUpperTo=function(b,d,e){--d;var f=e.t=this.t+b.t-d;for(e.s=0;0<=--f;)e[f]=0;for(f=Math.max(d-this.t,0);f<b.t;++f)e[this.t+f-d]=this.am(d-f,b[f],e,0,0,this.t+f-
-d);e.clamp();e.drShiftTo(1,e)};p.prototype.modInt=function(b){if(0>=b)return 0;var d=this.DV%b,e=0>this.s?b-1:0;if(0<this.t)if(0==d)e=this[0]%b;else for(var f=this.t-1;0<=f;--f)e=(d*e+this[f])%b;return e};p.prototype.millerRabin=function(b){var d=this.subtract(p.ONE),e=d.getLowestSetBit();if(0>=e)return!1;var f=d.shiftRight(e);b=b+1>>1;b>H.length&&(b=H.length);for(var n=E(),k=0;k<b;++k){n.fromInt(H[Math.floor(Math.random()*H.length)]);var v=n.modPow(f,this);if(0!=v.compareTo(p.ONE)&&0!=v.compareTo(d)){for(var C=
-1;C++<e&&0!=v.compareTo(d);)if(v=v.modPowInt(2,this),0==v.compareTo(p.ONE))return!1;if(0!=v.compareTo(d))return!1}}return!0};p.prototype.clone=function(){var b=E();this.copyTo(b);return b};p.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]};p.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24};p.prototype.shortValue=function(){return 0==
-this.t?this.s:this[0]<<16>>16};p.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};p.prototype.toByteArray=function(){var b=this.t,d=[];d[0]=this.s;var e=this.DB-b*this.DB%8,f,n=0;if(0<b--)for(e<this.DB&&(f=this[b]>>e)!=(this.s&this.DM)>>e&&(d[n++]=f|this.s<<this.DB-e);0<=b;)if(8>e?(f=(this[b]&(1<<e)-1)<<8-e,f|=this[--b]>>(e+=this.DB-8)):(f=this[b]>>(e-=8)&255,0>=e&&(e+=this.DB,--b)),0!=(f&128)&&(f|=-256),0==n&&(this.s&128)!=(f&128)&&++n,0<n||f!=this.s)d[n++]=f;
-return d};p.prototype.equals=function(b){return 0==this.compareTo(b)};p.prototype.min=function(b){return 0>this.compareTo(b)?this:b};p.prototype.max=function(b){return 0<this.compareTo(b)?this:b};p.prototype.and=function(b){var d=E();this.bitwiseTo(b,ea,d);return d};p.prototype.or=function(b){var d=E();this.bitwiseTo(b,K,d);return d};p.prototype.xor=function(b){var d=E();this.bitwiseTo(b,U,d);return d};p.prototype.andNot=function(b){var d=E();this.bitwiseTo(b,W,d);return d};p.prototype.not=function(){for(var b=
-E(),d=0;d<this.t;++d)b[d]=this.DM&~this[d];b.t=this.t;b.s=~this.s;return b};p.prototype.shiftLeft=function(b){var d=E();0>b?this.rShiftTo(-b,d):this.lShiftTo(b,d);return d};p.prototype.shiftRight=function(b){var d=E();0>b?this.lShiftTo(-b,d):this.rShiftTo(b,d);return d};p.prototype.getLowestSetBit=function(){for(var b=0;b<this.t;++b)if(0!=this[b]){var d=b*this.DB,b=this[b];if(0==b)b=-1;else{var e=0;0==(b&65535)&&(b>>=16,e+=16);0==(b&255)&&(b>>=8,e+=8);0==(b&15)&&(b>>=4,e+=4);0==(b&3)&&(b>>=2,e+=2);
-0==(b&1)&&++e;b=e}return d+b}return 0>this.s?this.t*this.DB:-1};p.prototype.bitCount=function(){for(var b=0,d=this.s&this.DM,e=0;e<this.t;++e){for(var f=this[e]^d,n=0;0!=f;)f&=f-1,++n;b+=n}return b};p.prototype.testBit=function(b){var d=Math.floor(b/this.DB);return d>=this.t?0!=this.s:0!=(this[d]&1<<b%this.DB)};p.prototype.setBit=function(b){return this.changeBit(b,K)};p.prototype.clearBit=function(b){return this.changeBit(b,W)};p.prototype.flipBit=function(b){return this.changeBit(b,U)};p.prototype.add=
-function(b){var d=E();this.addTo(b,d);return d};p.prototype.subtract=function(b){var d=E();this.subTo(b,d);return d};p.prototype.multiply=function(b){var d=E();this.multiplyTo(b,d);return d};p.prototype.divide=function(b){var d=E();this.divRemTo(b,d,null);return d};p.prototype.remainder=function(b){var d=E();this.divRemTo(b,null,d);return d};p.prototype.divideAndRemainder=function(b){var d=E(),e=E();this.divRemTo(b,d,e);return[d,e]};p.prototype.modPow=function(b,d){var e=b.bitLength(),f,n=aa(1),N;
-if(0>=e)return n;f=18>e?1:48>e?3:144>e?4:768>e?5:6;N=8>e?new Oa(d):d.isEven()?new sa(d):new F(d);var v=[],C=3,p=f-1,bb=(1<<f)-1;v[1]=N.convert(this);if(1<f)for(e=E(),N.sqrTo(v[1],e);C<=bb;)v[C]=E(),N.mulTo(e,v[C-2],v[C]),C+=2;for(var H=b.t-1,K,ea=!0,I=E(),e=k(b[H])-1;0<=H;){e>=p?K=b[H]>>e-p&bb:(K=(b[H]&(1<<e+1)-1)<<p-e,0<H&&(K|=b[H-1]>>this.DB+e-p));for(C=f;0==(K&1);)K>>=1,--C;0>(e-=C)&&(e+=this.DB,--H);if(ea)v[K].copyTo(n),ea=!1;else{for(;1<C;)N.sqrTo(n,I),N.sqrTo(I,n),C-=2;0<C?N.sqrTo(n,I):(C=n,
-n=I,I=C);N.mulTo(I,v[K],n)}for(;0<=H&&0==(b[H]&1<<e);)N.sqrTo(n,I),C=n,n=I,I=C,0>--e&&(e=this.DB-1,--H)}return N.revert(n)};p.prototype.modInverse=function(b){var d=b.isEven();if(this.isEven()&&d||0==b.signum())return p.ZERO;for(var e=b.clone(),f=this.clone(),n=aa(1),k=aa(0),v=aa(0),C=aa(1);0!=e.signum();){for(;e.isEven();)e.rShiftTo(1,e),d?(n.isEven()&&k.isEven()||(n.addTo(this,n),k.subTo(b,k)),n.rShiftTo(1,n)):k.isEven()||k.subTo(b,k),k.rShiftTo(1,k);for(;f.isEven();)f.rShiftTo(1,f),d?(v.isEven()&&
-C.isEven()||(v.addTo(this,v),C.subTo(b,C)),v.rShiftTo(1,v)):C.isEven()||C.subTo(b,C),C.rShiftTo(1,C);0<=e.compareTo(f)?(e.subTo(f,e),d&&n.subTo(v,n),k.subTo(C,k)):(f.subTo(e,f),d&&v.subTo(n,v),C.subTo(k,C))}if(0!=f.compareTo(p.ONE))return p.ZERO;if(0<=C.compareTo(b))return C.subtract(b);if(0>C.signum())C.addTo(b,C);else return C;return 0>C.signum()?C.add(b):C};p.prototype.pow=function(b){return this.exp(b,new Ea)};p.prototype.gcd=function(b){var d=0>this.s?this.negate():this.clone();b=0>b.s?b.negate():
-b.clone();if(0>d.compareTo(b)){var e=d,d=b;b=e}var e=d.getLowestSetBit(),f=b.getLowestSetBit();if(0>f)return d;e<f&&(f=e);for(0<f&&(d.rShiftTo(f,d),b.rShiftTo(f,b));0<d.signum();)0<(e=d.getLowestSetBit())&&d.rShiftTo(e,d),0<(e=b.getLowestSetBit())&&b.rShiftTo(e,b),0<=d.compareTo(b)?(d.subTo(b,d),d.rShiftTo(1,d)):(b.subTo(d,b),b.rShiftTo(1,b));0<f&&b.lShiftTo(f,b);return b};p.prototype.isProbablePrime=function(b){var d,e=this.abs();if(1==e.t&&e[0]<=H[H.length-1]){for(d=0;d<H.length;++d)if(e[0]==H[d])return!0;
-return!1}if(e.isEven())return!1;for(d=1;d<H.length;){for(var f=H[d],n=d+1;n<H.length&&f<Zb;)f*=H[n++];for(f=e.modInt(f);d<n;)if(0==f%H[d++])return!1}return e.millerRabin(b)};p.prototype.square=function(){var b=E();this.squareTo(b);return b};p.prototype.IsNegative=function(){return-1==this.compareTo(p.ZERO)?!0:!1};p.op_Equality=function(b,d){return 0==b.compareTo(d)?!0:!1};p.op_Inequality=function(b,d){return 0!=b.compareTo(d)?!0:!1};p.op_GreaterThan=function(b,d){return 0<b.compareTo(d)?!0:!1};p.op_LessThan=
-function(b,d){return 0>b.compareTo(d)?!0:!1};p.op_Addition=function(b,d){return(new p(b)).add(new p(d))};p.op_Subtraction=function(b,d){return(new p(b)).subtract(new p(d))};p.Int128Mul=function(b,d){return(new p(b)).multiply(new p(d))};p.op_Division=function(b,d){return b.divide(d)};p.prototype.ToDouble=function(){return parseFloat(this.toString())};V=function(b,d){var e;if("undefined"==typeof Object.getOwnPropertyNames)for(e in d.prototype){if("undefined"==typeof b.prototype[e]||b.prototype[e]==
-Object.prototype[e])b.prototype[e]=d.prototype[e]}else for(var f=Object.getOwnPropertyNames(d.prototype),n=0;n<f.length;n++)"undefined"==typeof Object.getOwnPropertyDescriptor(b.prototype,f[n])&&Object.defineProperty(b.prototype,f[n],Object.getOwnPropertyDescriptor(d.prototype,f[n]));for(e in d)"undefined"==typeof b[e]&&(b[e]=d[e]);b.$baseCtor=d};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,d){this.X=b;this.Y=d};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,d=this.m_Parent;null!==d;)b=!b,d=d.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 d=this.m_Childs.length;this.m_Childs.push(b);b.m_Parent=this;b.m_Index=d};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,d=this.m_AllPolys.length;b<d;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};V(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,d){return Math.max(b,d)};f.Cast_Int32=Y||Qa||Xb?function(b){return b|0}:function(b){return~~b};f.Cast_Int64=I?function(b){return-2147483648>b||2147483647<b?0>b?Math.ceil(b):Math.floor(b):~~b}:Jb&&"function"==typeof Number.toInteger?function(b){return Number.toInteger(b)}:xb||ab?
-function(b){return parseInt(b,10)}:Y?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,d=b.length;this.Y=this.X=0;f.use_xyz?(this.Z=0,3==d?(this.X=b[0],this.Y=b[1],this.Z=b[2]):2==d?(this.X=b[0],this.Y=b[1],this.Z=0):1==d?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==d?(this.X=b[0],this.Y=b[1]):1==d?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,d){return b.X==d.X&&b.Y==d.Y};f.IntPoint.op_Inequality=function(b,d){return b.X!=d.X||b.Y!=d.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,d){this.X=b;this.Y=d;this.Z=0},f.IntPoint3=function(b,d,e){this.X=b;this.Y=d;this.Z=e}):(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,d){this.X=b;this.Y=d});f.IntRect=function(){var b=arguments,d=b.length;4==d?(this.left=
-b[0],this.top=b[1],this.right=b[2],this.bottom=b[3]):1==d?(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,d,e,f){this.left=b;this.top=d;this.right=e;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,d){var e=d.Pt.Y-b.Pt.Y;return 0<e?1:0>e?-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=
+var enableInlineVideo=function(){function p(f,k,p,E){function F(p){ia=k(F,E);f(p-(N||p));N=p}var ia,N;return{start:function(){ia||F(0)},stop:function(){p(ia);ia=null;N=0}}}function F(f,k,p,E){function F(k){!!f[p]===!!E&&k.stopImmediatePropagation();delete f[p]}return f.addEventListener(k,F,!1),F}function ha(f,k,p,E){function F(f){p[k]=f}E&&F(f[k]);Object.defineProperty(f,k,{get:function(){return p[k]},set:F})}function Ga(f,k,p){p.addEventListener(k,function(){return f.dispatchEvent(new Event(k))})}
+function pa(f,k){Promise.resolve().then(function(){f.dispatchEvent(new Event(k))})}function Ha(f){var k=new Audio;return Ga(f,"play",k),Ga(f,"playing",k),Ga(f,"pause",k),k.crossOrigin=f.crossOrigin,k.src=f.src||f.currentSrc||"data:",k}function ea(k,p,E){(N||0)+200<Date.now()&&(k[fa]=!0,N=Date.now());E||(k.currentTime=p);f[++tb%3]=100*p|0}function k(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)),ea(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[fa],this.video.pause(!0))}function Qa(){var f=this[S];return this.webkitDisplayingFullscreen?void this[ub]():("data:"!==f.driver.src&&f.driver.src!==this.src&&(ea(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||(pa(this,"play"),f.video.readyState>=f.video.HAVE_ENOUGH_DATA&&pa(this,"playing")))))}function E(f){var k=this[S];k.driver.pause();k.updater.stop();this.webkitDisplayingFullscreen&&this[$a]();k.paused&&!f||(k.paused=!0,k.hasAudio||pa(this,"pause"),this.ended&&(this[fa]=!0,pa(this,"ended")))}function ia(E,F){var M=E[S]={};M.paused=!0;M.hasAudio=F;M.video=E;M.updater=p(k.bind(M),requestAnimationFrame,cancelAnimationFrame);F?M.driver=Ha(E):(E.addEventListener("canplay",
+function(){E.paused||pa(E,"playing")}),M.driver={src:E.src||E.currentSrc||"data:",muted:!0,paused:!0,pause:function(){M.driver.paused=!0},play:function(){M.driver.paused=!1;M.driver.currentTime>=M.video.duration&&ea(E,0)},get ended(){return M.driver.currentTime>=M.video.duration}});E.addEventListener("emptied",function(){var f=!M.driver.src||"data:"===M.driver.src;M.driver.src&&M.driver.src!==E.src&&(ea(E,0,!0),M.driver.src=E.src,f?M.driver.play():M.updater.stop())},!1);E.addEventListener("webkitbeginfullscreen",
+function(){E.paused?F&&0===M.driver.buffered.length&&M.driver.load():(E.pause(),E[ub]())});F&&(E.addEventListener("webkitendfullscreen",function(){M.driver.currentTime=E.currentTime}),E.addEventListener("seeking",function(){0>f.indexOf(100*E.currentTime|0)&&(M.driver.currentTime=E.currentTime)}))}var N,V="object"==typeof document&&"object-fit"in document.head.style&&!matchMedia("(-webkit-video-playable-inline)").matches,S="bfred-it:iphone-inline-video",fa="bfred-it:iphone-inline-video:event",ub="bfred-it:iphone-inline-video:nativeplay",
+$a="bfred-it:iphone-inline-video:nativepause",f=[],tb=0;return function(f,k){if(void 0===k&&(k={}),!f[S])if(k.everywhere||V&&(k.iPad||k.ipad?/iPhone|iPod|iPad/:/iPhone|iPod/).test(navigator.userAgent)){!f.paused&&f.webkitDisplayingFullscreen&&f.pause();ia(f,!f.muted);var p=f[S];f[ub]=f.play;f[$a]=f.pause;f.play=Qa;f.pause=E;ha(f,"paused",p.driver);ha(f,"muted",p.driver,!0);ha(f,"playbackRate",p.driver,!0);ha(f,"ended",p.driver);ha(f,"loop",p.driver,!0);F(f,"seeking");F(f,"seeked");F(f,"timeupdate",
+fa,!1);F(f,"ended",fa,!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 p(b,d,e){f.biginteger_used=1;null!=b&&("number"==typeof b&&"undefined"==typeof d?this.fromInt(b):"number"==typeof b?this.fromNumber(b,d,e):null==d&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,d))}function F(){return new p(null,void 0,void 0)}function ha(b,d,e,r,f,k){for(;0<=--k;){var u=d*this[b++]+e[r]+f;f=Math.floor(u/67108864);e[r++]=u&67108863}return f}function Ga(b,d,e,r,f,k){var u=d&32767;for(d>>=15;0<=--k;){var C=this[b]&32767,p=this[b++]>>15,E=d*C+p*u,C=
+u*C+((E&32767)<<15)+e[r]+(f&1073741823);f=(C>>>30)+(E>>>15)+d*p+(f>>>30);e[r++]=C&1073741823}return f}function pa(b,d,e,r,f,k){var u=d&16383;for(d>>=14;0<=--k;){var C=this[b]&16383,p=this[b++]>>14,E=d*C+p*u,C=u*C+((E&16383)<<14)+e[r]+f;f=(C>>28)+(E>>14)+d*p;e[r++]=C&268435455}return f}function Ha(b,d){var e=gb[b.charCodeAt(d)];return null==e?-1:e}function ea(b){var d=F();d.fromInt(b);return d}function k(b){var d=1,e;0!=(e=b>>>16)&&(b=e,d+=16);0!=(e=b>>8)&&(b=e,d+=8);0!=(e=b>>4)&&(b=e,d+=4);0!=(e=
+b>>2)&&(b=e,d+=2);0!=b>>1&&(d+=1);return d}function Qa(b){this.m=b}function E(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,d){return b&d}function N(b,d){return b|d}function V(b,d){return b^d}function S(b,d){return b&~d}function fa(){}function ub(b){return b}function $a(b){this.r2=F();this.q3=F();p.ONE.dlShiftTo(2*b.t,this.r2);this.mu=this.r2.divide(b);this.m=b}var f={use_lines:!0,use_xyz:!1},tb=!1;"undefined"!==typeof module&&
+module.exports?(module.exports=f,tb=!0):"undefined"!==typeof document?window.ClipperLib=f:self.ClipperLib=f;var Y;if(tb)ba="chrome",Y="Netscape";else{var ba=navigator.userAgent.toString().toLowerCase();Y=navigator.appName}var M,gc,Sb,Ta,fb,Cb;M=-1!=ba.indexOf("chrome")&&-1==ba.indexOf("chromium")?1:0;tb=-1!=ba.indexOf("chromium")?1:0;gc=-1!=ba.indexOf("safari")&&-1==ba.indexOf("chrome")&&-1==ba.indexOf("chromium")?1:0;Sb=-1!=ba.indexOf("firefox")?1:0;ba.indexOf("firefox/17");ba.indexOf("firefox/15");
+ba.indexOf("firefox/3");Ta=-1!=ba.indexOf("opera")?1:0;ba.indexOf("msie 10");ba.indexOf("msie 9");fb=-1!=ba.indexOf("msie 8")?1:0;Cb=-1!=ba.indexOf("msie 7")?1:0;ba=-1!=ba.indexOf("msie ")?1:0;f.biginteger_used=null;"Microsoft Internet Explorer"==Y?(p.prototype.am=Ga,Y=30):"Netscape"!=Y?(p.prototype.am=ha,Y=26):(p.prototype.am=pa,Y=28);p.prototype.DB=Y;p.prototype.DM=(1<<Y)-1;p.prototype.DV=1<<Y;p.prototype.FV=Math.pow(2,52);p.prototype.F1=52-Y;p.prototype.F2=2*Y-52;var gb=[],ua;Y=48;for(ua=0;9>=
+ua;++ua)gb[Y++]=ua;Y=97;for(ua=10;36>ua;++ua)gb[Y++]=ua;Y=65;for(ua=10;36>ua;++ua)gb[Y++]=ua;Qa.prototype.convert=function(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b};Qa.prototype.revert=function(b){return b};Qa.prototype.reduce=function(b){b.divRemTo(this.m,null,b)};Qa.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e);this.reduce(e)};Qa.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};E.prototype.convert=function(b){var d=F();b.abs().dlShiftTo(this.m.t,d);d.divRemTo(this.m,
+null,d);0>b.s&&0<d.compareTo(p.ZERO)&&this.m.subTo(d,d);return d};E.prototype.revert=function(b){var d=F();b.copyTo(d);this.reduce(d);return d};E.prototype.reduce=function(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var d=0;d<this.m.t;++d){var e=b[d]&32767,r=e*this.mpl+((e*this.mph+(b[d]>>15)*this.mpl&this.um)<<15)&b.DM,e=d+this.m.t;for(b[e]+=this.m.am(0,r,b,d,0,this.m.t);b[e]>=b.DV;)b[e]-=b.DV,b[++e]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)};E.prototype.mulTo=function(b,
+d,e){b.multiplyTo(d,e);this.reduce(e)};E.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};p.prototype.copyTo=function(b){for(var d=this.t-1;0<=d;--d)b[d]=this[d];b.t=this.t;b.s=this.s};p.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};p.prototype.fromString=function(b,d){var e;if(16==d)e=4;else if(8==d)e=3;else if(256==d)e=8;else if(2==d)e=1;else if(32==d)e=5;else if(4==d)e=2;else{this.fromRadix(b,d);return}this.s=this.t=0;for(var r=
+b.length,f=!1,k=0;0<=--r;){var u=8==e?b[r]&255:Ha(b,r);0>u?"-"==b.charAt(r)&&(f=!0):(f=!1,0==k?this[this.t++]=u:k+e>this.DB?(this[this.t-1]|=(u&(1<<this.DB-k)-1)<<k,this[this.t++]=u>>this.DB-k):this[this.t-1]|=u<<k,k+=e,k>=this.DB&&(k-=this.DB))}8==e&&0!=(b[0]&128)&&(this.s=-1,0<k&&(this[this.t-1]|=(1<<this.DB-k)-1<<k));this.clamp();f&&p.ZERO.subTo(this,this)};p.prototype.clamp=function(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t};p.prototype.dlShiftTo=function(b,d){var e;for(e=
+this.t-1;0<=e;--e)d[e+b]=this[e];for(e=b-1;0<=e;--e)d[e]=0;d.t=this.t+b;d.s=this.s};p.prototype.drShiftTo=function(b,d){for(var e=b;e<this.t;++e)d[e-b]=this[e];d.t=Math.max(this.t-b,0);d.s=this.s};p.prototype.lShiftTo=function(b,d){var e=b%this.DB,r=this.DB-e,f=(1<<r)-1,k=Math.floor(b/this.DB),u=this.s<<e&this.DM,C;for(C=this.t-1;0<=C;--C)d[C+k+1]=this[C]>>r|u,u=(this[C]&f)<<e;for(C=k-1;0<=C;--C)d[C]=0;d[k]=u;d.t=this.t+k+1;d.s=this.s;d.clamp()};p.prototype.rShiftTo=function(b,d){d.s=this.s;var e=
+Math.floor(b/this.DB);if(e>=this.t)d.t=0;else{var r=b%this.DB,f=this.DB-r,k=(1<<r)-1;d[0]=this[e]>>r;for(var u=e+1;u<this.t;++u)d[u-e-1]|=(this[u]&k)<<f,d[u-e]=this[u]>>r;0<r&&(d[this.t-e-1]|=(this.s&k)<<f);d.t=this.t-e;d.clamp()}};p.prototype.subTo=function(b,d){for(var e=0,f=0,n=Math.min(b.t,this.t);e<n;)f+=this[e]-b[e],d[e++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f-=b.s;e<this.t;)f+=this[e],d[e++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;e<b.t;)f-=b[e],d[e++]=f&this.DM,f>>=this.DB;
+f-=b.s}d.s=0>f?-1:0;-1>f?d[e++]=this.DV+f:0<f&&(d[e++]=f);d.t=e;d.clamp()};p.prototype.multiplyTo=function(b,d){var e=this.abs(),f=b.abs(),n=e.t;for(d.t=n+f.t;0<=--n;)d[n]=0;for(n=0;n<f.t;++n)d[n+e.t]=e.am(0,f[n],d,n,0,e.t);d.s=0;d.clamp();this.s!=b.s&&p.ZERO.subTo(d,d)};p.prototype.squareTo=function(b){for(var d=this.abs(),e=b.t=2*d.t;0<=--e;)b[e]=0;for(e=0;e<d.t-1;++e){var f=d.am(e,d[e],b,2*e,0,1);(b[e+d.t]+=d.am(e+1,2*d[e],b,2*e+1,f,d.t-e-1))>=d.DV&&(b[e+d.t]-=d.DV,b[e+d.t+1]=1)}0<b.t&&(b[b.t-
+1]+=d.am(e,d[e],b,2*e,0,1));b.s=0;b.clamp()};p.prototype.divRemTo=function(b,d,e){var f=b.abs();if(!(0>=f.t)){var n=this.abs();if(n.t<f.t)null!=d&&d.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=F());var I=F(),u=this.s;b=b.s;var C=this.DB-k(f[f.t-1]);0<C?(f.lShiftTo(C,I),n.lShiftTo(C,e)):(f.copyTo(I),n.copyTo(e));f=I.t;n=I[f-1];if(0!=n){var E=n*(1<<this.F1)+(1<f?I[f-2]>>this.F2:0),ab=this.FV/E,E=(1<<this.F1)/E,vb=1<<this.F2,H=e.t,ia=H-f,N=null==d?F():d;I.dlShiftTo(ia,N);0<=e.compareTo(N)&&(e[e.t++]=
+1,e.subTo(N,e));p.ONE.dlShiftTo(f,N);for(N.subTo(I,I);I.t<f;)I[I.t++]=0;for(;0<=--ia;){var M=e[--H]==n?this.DM:Math.floor(e[H]*ab+(e[H-1]+vb)*E);if((e[H]+=I.am(0,M,e,ia,0,f))<M)for(I.dlShiftTo(ia,N),e.subTo(N,e);e[H]<--M;)e.subTo(N,e)}null!=d&&(e.drShiftTo(f,d),u!=b&&p.ZERO.subTo(d,d));e.t=f;e.clamp();0<C&&e.rShiftTo(C,e);0>u&&p.ZERO.subTo(e,e)}}}};p.prototype.invDigit=function(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var d=b&3,d=d*(2-(b&15)*d)&15,d=d*(2-(b&255)*d)&255,d=d*(2-((b&
+65535)*d&65535))&65535,d=d*(2-b*d%this.DV)%this.DV;return 0<d?this.DV-d:-d};p.prototype.isEven=function(){return 0==(0<this.t?this[0]&1:this.s)};p.prototype.exp=function(b,d){if(4294967295<b||1>b)return p.ONE;var e=F(),f=F(),n=d.convert(this),I=k(b)-1;for(n.copyTo(e);0<=--I;)if(d.sqrTo(e,f),0<(b&1<<I))d.mulTo(f,n,e);else var u=e,e=f,f=u;return d.revert(e)};p.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 d=(1<<b)-1,e,f=!1,n="",k=this.t,u=this.DB-k*this.DB%b;if(0<k--)for(u<this.DB&&0<(e=this[k]>>u)&&(f=!0,n="0123456789abcdefghijklmnopqrstuvwxyz".charAt(e));0<=k;)u<b?(e=(this[k]&(1<<u)-1)<<b-u,e|=this[--k]>>(u+=this.DB-b)):(e=this[k]>>(u-=b)&d,0>=u&&(u+=this.DB,--k)),0<e&&(f=!0),f&&(n+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(e));return f?n:"0"};p.prototype.negate=function(){var b=F();p.ZERO.subTo(this,b);return b};p.prototype.abs=function(){return 0>
+this.s?this.negate():this};p.prototype.compareTo=function(b){var d=this.s-b.s;if(0!=d)return d;var e=this.t,d=e-b.t;if(0!=d)return 0>this.s?-d:d;for(;0<=--e;)if(0!=(d=this[e]-b[e]))return d;return 0};p.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)};p.prototype.mod=function(b){var d=F();this.abs().divRemTo(b,null,d);0>this.s&&0<d.compareTo(p.ZERO)&&b.subTo(d,d);return d};p.prototype.modPowInt=function(b,d){var e;e=256>b||d.isEven()?new Qa(d):
+new E(d);return this.exp(b,e)};p.ZERO=ea(0);p.ONE=ea(1);fa.prototype.convert=ub;fa.prototype.revert=ub;fa.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e)};fa.prototype.sqrTo=function(b,d){b.squareTo(d)};$a.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 d=F();b.copyTo(d);this.reduce(d);return d};$a.prototype.revert=function(b){return b};$a.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)};$a.prototype.mulTo=function(b,d,e){b.multiplyTo(d,e);this.reduce(e)};$a.prototype.sqrTo=function(b,d){b.squareTo(d);this.reduce(d)};var H=[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],ic=67108864/H[H.length-1];p.prototype.chunkSize=function(b){return Math.floor(Math.LN2*this.DB/Math.log(b))};p.prototype.toRadix=function(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var d=this.chunkSize(b),d=Math.pow(b,d),e=ea(d),f=F(),n=F(),k="";for(this.divRemTo(e,f,n);0<f.signum();)k=(d+n.intValue()).toString(b).substr(1)+k,f.divRemTo(e,f,n);return n.intValue().toString(b)+k};p.prototype.fromRadix=function(b,d){this.fromInt(0);null==d&&(d=10);for(var e=this.chunkSize(d),
+f=Math.pow(d,e),n=!1,k=0,u=0,C=0;C<b.length;++C){var E=Ha(b,C);0>E?"-"==b.charAt(C)&&0==this.signum()&&(n=!0):(u=d*u+E,++k>=e&&(this.dMultiply(f),this.dAddOffset(u,0),u=k=0))}0<k&&(this.dMultiply(Math.pow(d,k)),this.dAddOffset(u,0));n&&p.ZERO.subTo(this,this)};p.prototype.fromNumber=function(b,d,e){if("number"==typeof d)if(2>b)this.fromInt(1);else for(this.fromNumber(b,e),this.testBit(b-1)||this.bitwiseTo(p.ONE.shiftLeft(b-1),N,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(d);)this.dAddOffset(2,
+0),this.bitLength()>b&&this.subTo(p.ONE.shiftLeft(b-1),this);else{e=[];var f=b&7;e.length=(b>>3)+1;d.nextBytes(e);e[0]=0<f?e[0]&(1<<f)-1:0;this.fromString(e,256)}};p.prototype.bitwiseTo=function(b,d,e){var f,n,k=Math.min(b.t,this.t);for(f=0;f<k;++f)e[f]=d(this[f],b[f]);if(b.t<this.t){n=b.s&this.DM;for(f=k;f<this.t;++f)e[f]=d(this[f],n);e.t=this.t}else{n=this.s&this.DM;for(f=k;f<b.t;++f)e[f]=d(n,b[f]);e.t=b.t}e.s=d(this.s,b.s);e.clamp()};p.prototype.changeBit=function(b,d){var e=p.ONE.shiftLeft(b);
+this.bitwiseTo(e,d,e);return e};p.prototype.addTo=function(b,d){for(var e=0,f=0,n=Math.min(b.t,this.t);e<n;)f+=this[e]+b[e],d[e++]=f&this.DM,f>>=this.DB;if(b.t<this.t){for(f+=b.s;e<this.t;)f+=this[e],d[e++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;e<b.t;)f+=b[e],d[e++]=f&this.DM,f>>=this.DB;f+=b.s}d.s=0>f?-1:0;0<f?d[e++]=f:-1>f&&(d[e++]=this.DV+f);d.t=e;d.clamp()};p.prototype.dMultiply=function(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()};p.prototype.dAddOffset=
+function(b,d){if(0!=b){for(;this.t<=d;)this[this.t++]=0;for(this[d]+=b;this[d]>=this.DV;)this[d]-=this.DV,++d>=this.t&&(this[this.t++]=0),++this[d]}};p.prototype.multiplyLowerTo=function(b,d,e){var f=Math.min(this.t+b.t,d);e.s=0;for(e.t=f;0<f;)e[--f]=0;var n;for(n=e.t-this.t;f<n;++f)e[f+this.t]=this.am(0,b[f],e,f,0,this.t);for(n=Math.min(b.t,d);f<n;++f)this.am(0,b[f],e,f,0,d-f);e.clamp()};p.prototype.multiplyUpperTo=function(b,d,e){--d;var f=e.t=this.t+b.t-d;for(e.s=0;0<=--f;)e[f]=0;for(f=Math.max(d-
+this.t,0);f<b.t;++f)e[this.t+f-d]=this.am(d-f,b[f],e,0,0,this.t+f-d);e.clamp();e.drShiftTo(1,e)};p.prototype.modInt=function(b){if(0>=b)return 0;var d=this.DV%b,e=0>this.s?b-1:0;if(0<this.t)if(0==d)e=this[0]%b;else for(var f=this.t-1;0<=f;--f)e=(d*e+this[f])%b;return e};p.prototype.millerRabin=function(b){var d=this.subtract(p.ONE),e=d.getLowestSetBit();if(0>=e)return!1;var f=d.shiftRight(e);b=b+1>>1;b>H.length&&(b=H.length);for(var n=F(),k=0;k<b;++k){n.fromInt(H[Math.floor(Math.random()*H.length)]);
+var u=n.modPow(f,this);if(0!=u.compareTo(p.ONE)&&0!=u.compareTo(d)){for(var C=1;C++<e&&0!=u.compareTo(d);)if(u=u.modPowInt(2,this),0==u.compareTo(p.ONE))return!1;if(0!=u.compareTo(d))return!1}}return!0};p.prototype.clone=function(){var b=F();this.copyTo(b);return b};p.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]};p.prototype.byteValue=function(){return 0==
+this.t?this.s:this[0]<<24>>24};p.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16};p.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};p.prototype.toByteArray=function(){var b=this.t,d=[];d[0]=this.s;var e=this.DB-b*this.DB%8,f,n=0;if(0<b--)for(e<this.DB&&(f=this[b]>>e)!=(this.s&this.DM)>>e&&(d[n++]=f|this.s<<this.DB-e);0<=b;)if(8>e?(f=(this[b]&(1<<e)-1)<<8-e,f|=this[--b]>>(e+=this.DB-8)):(f=this[b]>>(e-=8)&255,0>=e&&(e+=this.DB,--b)),0!=(f&
+128)&&(f|=-256),0==n&&(this.s&128)!=(f&128)&&++n,0<n||f!=this.s)d[n++]=f;return d};p.prototype.equals=function(b){return 0==this.compareTo(b)};p.prototype.min=function(b){return 0>this.compareTo(b)?this:b};p.prototype.max=function(b){return 0<this.compareTo(b)?this:b};p.prototype.and=function(b){var d=F();this.bitwiseTo(b,ia,d);return d};p.prototype.or=function(b){var d=F();this.bitwiseTo(b,N,d);return d};p.prototype.xor=function(b){var d=F();this.bitwiseTo(b,V,d);return d};p.prototype.andNot=function(b){var d=
+F();this.bitwiseTo(b,S,d);return d};p.prototype.not=function(){for(var b=F(),d=0;d<this.t;++d)b[d]=this.DM&~this[d];b.t=this.t;b.s=~this.s;return b};p.prototype.shiftLeft=function(b){var d=F();0>b?this.rShiftTo(-b,d):this.lShiftTo(b,d);return d};p.prototype.shiftRight=function(b){var d=F();0>b?this.lShiftTo(-b,d):this.rShiftTo(b,d);return d};p.prototype.getLowestSetBit=function(){for(var b=0;b<this.t;++b)if(0!=this[b]){var d=b*this.DB,b=this[b];if(0==b)b=-1;else{var e=0;0==(b&65535)&&(b>>=16,e+=16);
+0==(b&255)&&(b>>=8,e+=8);0==(b&15)&&(b>>=4,e+=4);0==(b&3)&&(b>>=2,e+=2);0==(b&1)&&++e;b=e}return d+b}return 0>this.s?this.t*this.DB:-1};p.prototype.bitCount=function(){for(var b=0,d=this.s&this.DM,e=0;e<this.t;++e){for(var f=this[e]^d,n=0;0!=f;)f&=f-1,++n;b+=n}return b};p.prototype.testBit=function(b){var d=Math.floor(b/this.DB);return d>=this.t?0!=this.s:0!=(this[d]&1<<b%this.DB)};p.prototype.setBit=function(b){return this.changeBit(b,N)};p.prototype.clearBit=function(b){return this.changeBit(b,
+S)};p.prototype.flipBit=function(b){return this.changeBit(b,V)};p.prototype.add=function(b){var d=F();this.addTo(b,d);return d};p.prototype.subtract=function(b){var d=F();this.subTo(b,d);return d};p.prototype.multiply=function(b){var d=F();this.multiplyTo(b,d);return d};p.prototype.divide=function(b){var d=F();this.divRemTo(b,d,null);return d};p.prototype.remainder=function(b){var d=F();this.divRemTo(b,null,d);return d};p.prototype.divideAndRemainder=function(b){var d=F(),e=F();this.divRemTo(b,d,
+e);return[d,e]};p.prototype.modPow=function(b,d){var e=b.bitLength(),f,n=ea(1),I;if(0>=e)return n;f=18>e?1:48>e?3:144>e?4:768>e?5:6;I=8>e?new Qa(d):d.isEven()?new $a(d):new E(d);var u=[],C=3,p=f-1,ab=(1<<f)-1;u[1]=I.convert(this);if(1<f)for(e=F(),I.sqrTo(u[1],e);C<=ab;)u[C]=F(),I.mulTo(e,u[C-2],u[C]),C+=2;for(var H=b.t-1,N,ia=!0,M=F(),e=k(b[H])-1;0<=H;){e>=p?N=b[H]>>e-p&ab:(N=(b[H]&(1<<e+1)-1)<<p-e,0<H&&(N|=b[H-1]>>this.DB+e-p));for(C=f;0==(N&1);)N>>=1,--C;0>(e-=C)&&(e+=this.DB,--H);if(ia)u[N].copyTo(n),
+ia=!1;else{for(;1<C;)I.sqrTo(n,M),I.sqrTo(M,n),C-=2;0<C?I.sqrTo(n,M):(C=n,n=M,M=C);I.mulTo(M,u[N],n)}for(;0<=H&&0==(b[H]&1<<e);)I.sqrTo(n,M),C=n,n=M,M=C,0>--e&&(e=this.DB-1,--H)}return I.revert(n)};p.prototype.modInverse=function(b){var d=b.isEven();if(this.isEven()&&d||0==b.signum())return p.ZERO;for(var e=b.clone(),f=this.clone(),n=ea(1),k=ea(0),u=ea(0),C=ea(1);0!=e.signum();){for(;e.isEven();)e.rShiftTo(1,e),d?(n.isEven()&&k.isEven()||(n.addTo(this,n),k.subTo(b,k)),n.rShiftTo(1,n)):k.isEven()||
+k.subTo(b,k),k.rShiftTo(1,k);for(;f.isEven();)f.rShiftTo(1,f),d?(u.isEven()&&C.isEven()||(u.addTo(this,u),C.subTo(b,C)),u.rShiftTo(1,u)):C.isEven()||C.subTo(b,C),C.rShiftTo(1,C);0<=e.compareTo(f)?(e.subTo(f,e),d&&n.subTo(u,n),k.subTo(C,k)):(f.subTo(e,f),d&&u.subTo(n,u),C.subTo(k,C))}if(0!=f.compareTo(p.ONE))return p.ZERO;if(0<=C.compareTo(b))return C.subtract(b);if(0>C.signum())C.addTo(b,C);else return C;return 0>C.signum()?C.add(b):C};p.prototype.pow=function(b){return this.exp(b,new fa)};p.prototype.gcd=
+function(b){var d=0>this.s?this.negate():this.clone();b=0>b.s?b.negate():b.clone();if(0>d.compareTo(b)){var e=d,d=b;b=e}var e=d.getLowestSetBit(),f=b.getLowestSetBit();if(0>f)return d;e<f&&(f=e);for(0<f&&(d.rShiftTo(f,d),b.rShiftTo(f,b));0<d.signum();)0<(e=d.getLowestSetBit())&&d.rShiftTo(e,d),0<(e=b.getLowestSetBit())&&b.rShiftTo(e,b),0<=d.compareTo(b)?(d.subTo(b,d),d.rShiftTo(1,d)):(b.subTo(d,b),b.rShiftTo(1,b));0<f&&b.lShiftTo(f,b);return b};p.prototype.isProbablePrime=function(b){var d,e=this.abs();
+if(1==e.t&&e[0]<=H[H.length-1]){for(d=0;d<H.length;++d)if(e[0]==H[d])return!0;return!1}if(e.isEven())return!1;for(d=1;d<H.length;){for(var f=H[d],n=d+1;n<H.length&&f<ic;)f*=H[n++];for(f=e.modInt(f);d<n;)if(0==f%H[d++])return!1}return e.millerRabin(b)};p.prototype.square=function(){var b=F();this.squareTo(b);return b};p.prototype.IsNegative=function(){return-1==this.compareTo(p.ZERO)?!0:!1};p.op_Equality=function(b,d){return 0==b.compareTo(d)?!0:!1};p.op_Inequality=function(b,d){return 0!=b.compareTo(d)?
+!0:!1};p.op_GreaterThan=function(b,d){return 0<b.compareTo(d)?!0:!1};p.op_LessThan=function(b,d){return 0>b.compareTo(d)?!0:!1};p.op_Addition=function(b,d){return(new p(b)).add(new p(d))};p.op_Subtraction=function(b,d){return(new p(b)).subtract(new p(d))};p.Int128Mul=function(b,d){return(new p(b)).multiply(new p(d))};p.op_Division=function(b,d){return b.divide(d)};p.prototype.ToDouble=function(){return parseFloat(this.toString())};Y=function(b,d){var e;if("undefined"==typeof Object.getOwnPropertyNames)for(e in d.prototype){if("undefined"==
+typeof b.prototype[e]||b.prototype[e]==Object.prototype[e])b.prototype[e]=d.prototype[e]}else for(var f=Object.getOwnPropertyNames(d.prototype),n=0;n<f.length;n++)"undefined"==typeof Object.getOwnPropertyDescriptor(b.prototype,f[n])&&Object.defineProperty(b.prototype,f[n],Object.getOwnPropertyDescriptor(d.prototype,f[n]));for(e in d)"undefined"==typeof b[e]&&(b[e]=d[e]);b.$baseCtor=d};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,d){this.X=b;this.Y=d};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,d=this.m_Parent;null!==d;)b=!b,d=d.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 d=this.m_Childs.length;this.m_Childs.push(b);b.m_Parent=this;b.m_Index=d};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,d=this.m_AllPolys.length;b<d;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};Y(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,d){return Math.max(b,d)};f.Cast_Int32=ba||Ta||gc?function(b){return b|0}:function(b){return~~b};f.Cast_Int64=M?function(b){return-2147483648>b||2147483647<b?0>b?Math.ceil(b):Math.floor(b):~~b}:Sb&&"function"==typeof Number.toInteger?function(b){return Number.toInteger(b)}:
+Cb||fb?function(b){return parseInt(b,10)}:ba?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,d=b.length;this.Y=this.X=0;f.use_xyz?(this.Z=0,3==d?(this.X=b[0],this.Y=b[1],this.Z=b[2]):2==d?(this.X=b[0],this.Y=b[1],this.Z=0):1==d?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==d?(this.X=b[0],this.Y=b[1]):1==d?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,d){return b.X==d.X&&b.Y==d.Y};f.IntPoint.op_Inequality=function(b,d){return b.X!=d.X||b.Y!=d.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,d){this.X=b;this.Y=d;this.Z=0},f.IntPoint3=function(b,d,e){this.X=b;this.Y=d;this.Z=e}):(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,d){this.X=b;this.Y=d});f.IntRect=function(){var b=arguments,
+d=b.length;4==d?(this.left=b[0],this.top=b[1],this.right=b[2],this.bottom=b[3]):1==d?(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,d,e,f){this.left=b;this.top=d;this.right=e;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,d){var e=d.Pt.Y-b.Pt.Y;return 0<e?1:0>e?-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,d){var e=d;do{if(f.IntPoint.op_Equality(e.Pt,b))return!0;e=e.Next}while(e!=d);return!1};f.ClipperBase.prototype.PointOnLineSegment=function(b,d,
e,f){return f?b.X==d.X&&b.Y==d.Y||b.X==e.X&&b.Y==e.Y||b.X>d.X==b.X<e.X&&b.Y>d.Y==b.Y<e.Y&&p.op_Equality(p.Int128Mul(b.X-d.X,e.Y-d.Y),p.Int128Mul(e.X-d.X,b.Y-d.Y)):b.X==d.X&&b.Y==d.Y||b.X==e.X&&b.Y==e.Y||b.X>d.X==b.X<e.X&&b.Y>d.Y==b.Y<e.Y&&(b.X-d.X)*(e.Y-d.Y)==(e.X-d.X)*(b.Y-d.Y)};f.ClipperBase.prototype.PointOnPolygon=function(b,d,e){for(var f=d;;){if(this.PointOnLineSegment(b,f.Pt,f.Next.Pt,e))return!0;f=f.Next;if(f==d)break}return!1};f.ClipperBase.prototype.SlopesEqual=f.ClipperBase.SlopesEqual=
-function(){var b=arguments,d=b.length,e,q,n;if(3==d)return d=b[0],e=b[1],b[2]?p.op_Equality(p.Int128Mul(d.Delta.Y,e.Delta.X),p.Int128Mul(d.Delta.X,e.Delta.Y)):f.Cast_Int64(d.Delta.Y*e.Delta.X)==f.Cast_Int64(d.Delta.X*e.Delta.Y);if(4==d)return d=b[0],e=b[1],q=b[2],b[3]?p.op_Equality(p.Int128Mul(d.Y-e.Y,e.X-q.X),p.Int128Mul(d.X-e.X,e.Y-q.Y)):0===f.Cast_Int64((d.Y-e.Y)*(e.X-q.X))-f.Cast_Int64((d.X-e.X)*(e.Y-q.Y));d=b[0];e=b[1];q=b[2];n=b[3];return b[4]?p.op_Equality(p.Int128Mul(d.Y-e.Y,q.X-n.X),p.Int128Mul(d.X-
-e.X,q.Y-n.Y)):0===f.Cast_Int64((d.Y-e.Y)*(q.X-n.X))-f.Cast_Int64((d.X-e.X)*(q.Y-n.Y))};f.ClipperBase.SlopesEqual3=function(b,d,e){return e?p.op_Equality(p.Int128Mul(b.Delta.Y,d.Delta.X),p.Int128Mul(b.Delta.X,d.Delta.Y)):f.Cast_Int64(b.Delta.Y*d.Delta.X)==f.Cast_Int64(b.Delta.X*d.Delta.Y)};f.ClipperBase.SlopesEqual4=function(b,d,e,q){return q?p.op_Equality(p.Int128Mul(b.Y-d.Y,d.X-e.X),p.Int128Mul(b.X-d.X,d.Y-e.Y)):0===f.Cast_Int64((b.Y-d.Y)*(d.X-e.X))-f.Cast_Int64((b.X-d.X)*(d.Y-e.Y))};f.ClipperBase.SlopesEqual5=
-function(b,d,e,q,n){return n?p.op_Equality(p.Int128Mul(b.Y-d.Y,e.X-q.X),p.Int128Mul(b.X-d.X,e.Y-q.Y)):0===f.Cast_Int64((b.Y-d.Y)*(e.X-q.X))-f.Cast_Int64((b.X-d.X)*(e.Y-q.Y))};f.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var b=0,d=this.m_edges.length;b<d;++b){for(var e=0,q=this.m_edges[b].length;e<q;++e)this.m_edges[b][e]=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!==
+function(){var b=arguments,d=b.length,e,r,n;if(3==d)return d=b[0],e=b[1],b[2]?p.op_Equality(p.Int128Mul(d.Delta.Y,e.Delta.X),p.Int128Mul(d.Delta.X,e.Delta.Y)):f.Cast_Int64(d.Delta.Y*e.Delta.X)==f.Cast_Int64(d.Delta.X*e.Delta.Y);if(4==d)return d=b[0],e=b[1],r=b[2],b[3]?p.op_Equality(p.Int128Mul(d.Y-e.Y,e.X-r.X),p.Int128Mul(d.X-e.X,e.Y-r.Y)):0===f.Cast_Int64((d.Y-e.Y)*(e.X-r.X))-f.Cast_Int64((d.X-e.X)*(e.Y-r.Y));d=b[0];e=b[1];r=b[2];n=b[3];return b[4]?p.op_Equality(p.Int128Mul(d.Y-e.Y,r.X-n.X),p.Int128Mul(d.X-
+e.X,r.Y-n.Y)):0===f.Cast_Int64((d.Y-e.Y)*(r.X-n.X))-f.Cast_Int64((d.X-e.X)*(r.Y-n.Y))};f.ClipperBase.SlopesEqual3=function(b,d,e){return e?p.op_Equality(p.Int128Mul(b.Delta.Y,d.Delta.X),p.Int128Mul(b.Delta.X,d.Delta.Y)):f.Cast_Int64(b.Delta.Y*d.Delta.X)==f.Cast_Int64(b.Delta.X*d.Delta.Y)};f.ClipperBase.SlopesEqual4=function(b,d,e,r){return r?p.op_Equality(p.Int128Mul(b.Y-d.Y,d.X-e.X),p.Int128Mul(b.X-d.X,d.Y-e.Y)):0===f.Cast_Int64((b.Y-d.Y)*(d.X-e.X))-f.Cast_Int64((b.X-d.X)*(d.Y-e.Y))};f.ClipperBase.SlopesEqual5=
+function(b,d,e,r,n){return n?p.op_Equality(p.Int128Mul(b.Y-d.Y,e.X-r.X),p.Int128Mul(b.X-d.X,e.Y-r.Y)):0===f.Cast_Int64((b.Y-d.Y)*(e.X-r.X))-f.Cast_Int64((b.X-d.X)*(e.Y-r.Y))};f.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var b=0,d=this.m_edges.length;b<d;++b){for(var e=0,r=this.m_edges[b].length;e<r;++e)this.m_edges[b][e]=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,d){if(d.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)d.Value=!0,this.RangeTest(b,d)};f.ClipperBase.prototype.InitEdge=
-function(b,d,e,q){b.Next=d;b.Prev=e;b.Curr.X=q.X;b.Curr.Y=q.Y;f.use_xyz&&(b.Curr.Z=q.Z);b.OutIdx=-1};f.ClipperBase.prototype.InitEdge2=function(b,d){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=d};f.ClipperBase.prototype.FindNextLocMin=
-function(b){for(var d;;){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(d=b;b.Dx==f.ClipperBase.horizontal;)b=b.Next;if(b.Top.Y!=b.Prev.Bot.Y){d.Prev.Bot.X<b.Bot.X&&(b=d);break}}return b};f.ClipperBase.prototype.ProcessBound=function(b,d){var e,q=b,n;if(q.OutIdx==f.ClipperBase.Skip){b=q;if(d){for(;b.Top.Y==b.Next.Bot.Y;)b=
-b.Next;for(;b!=q&&b.Dx==f.ClipperBase.horizontal;)b=b.Prev}else{for(;b.Top.Y==b.Prev.Bot.Y;)b=b.Prev;for(;b!=q&&b.Dx==f.ClipperBase.horizontal;)b=b.Next}b==q?q=d?b.Next:b.Prev:(b=d?q.Next:q.Prev,e=new f.LocalMinima,e.Next=null,e.Y=b.Bot.Y,e.LeftBound=null,e.RightBound=b,b.WindDelta=0,q=this.ProcessBound(b,d),this.InsertLocalMinima(e));return q}b.Dx==f.ClipperBase.horizontal&&(e=d?b.Prev:b.Next,e.OutIdx!=f.ClipperBase.Skip&&(e.Dx==f.ClipperBase.horizontal?e.Bot.X!=b.Bot.X&&e.Top.X!=b.Bot.X&&this.ReverseHorizontal(b):
-e.Bot.X!=b.Bot.X&&this.ReverseHorizontal(b)));e=b;if(d){for(;q.Top.Y==q.Next.Bot.Y&&q.Next.OutIdx!=f.ClipperBase.Skip;)q=q.Next;if(q.Dx==f.ClipperBase.horizontal&&q.Next.OutIdx!=f.ClipperBase.Skip){for(n=q;n.Prev.Dx==f.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==q.Next.Top.X?d||(q=n.Prev):n.Prev.Top.X>q.Next.Top.X&&(q=n.Prev)}for(;b!=q;)b.NextInLML=b.Next,b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=b.Prev.Top.X&&this.ReverseHorizontal(b),b=b.Next;b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=
-b.Prev.Top.X&&this.ReverseHorizontal(b);q=q.Next}else{for(;q.Top.Y==q.Prev.Bot.Y&&q.Prev.OutIdx!=f.ClipperBase.Skip;)q=q.Prev;if(q.Dx==f.ClipperBase.horizontal&&q.Prev.OutIdx!=f.ClipperBase.Skip){for(n=q;n.Next.Dx==f.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==q.Prev.Top.X?d||(q=n.Next):n.Next.Top.X>q.Prev.Top.X&&(q=n.Next)}for(;b!=q;)b.NextInLML=b.Prev,b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=b.Next.Top.X&&this.ReverseHorizontal(b),b=b.Prev;b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=
-b.Next.Top.X&&this.ReverseHorizontal(b);q=q.Prev}return q};f.ClipperBase.prototype.AddPath=function(b,d,e){f.use_lines?e||d!=f.PolyType.ptClip||f.Error("AddPath: Open paths must be subject."):e||f.Error("AddPath: Open paths have been disabled.");var q=b.length-1;if(e)for(;0<q&&f.IntPoint.op_Equality(b[q],b[0]);)--q;for(;0<q&&f.IntPoint.op_Equality(b[q],b[q-1]);)--q;if(e&&2>q||!e&&1>q)return!1;for(var n=[],k=0;k<=q;k++)n.push(new f.TEdge);var v=!0;n[1].Curr.X=b[1].X;n[1].Curr.Y=b[1].Y;f.use_xyz&&(n[1].Curr.Z=
-b[1].Z);var C={Value:this.m_UseFullRange};this.RangeTest(b[0],C);this.m_UseFullRange=C.Value;C.Value=this.m_UseFullRange;this.RangeTest(b[q],C);this.m_UseFullRange=C.Value;this.InitEdge(n[0],n[1],n[q],b[0]);this.InitEdge(n[q],n[0],n[q-1],b[q]);for(k=q-1;1<=k;--k)C.Value=this.m_UseFullRange,this.RangeTest(b[k],C),this.m_UseFullRange=C.Value,this.InitEdge(n[k],n[k+1],n[k-1],b[k]);for(k=b=q=n[0];;)if(b.Curr!=b.Next.Curr||!e&&b.Next==q){if(b.Prev==b.Next)break;else if(e&&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==q&&(q=b.Next);b=this.RemoveEdge(b);k=b=b.Prev;continue}b=b.Next;if(b==k||!e&&b.Next==q)break}else{if(b==b.Next)break;b==q&&(q=b.Next);k=b=this.RemoveEdge(b)}if(!e&&b==b.Next||e&&b.Prev==b.Next)return!1;e||(this.m_HasOpenPaths=!0,q.Prev.OutIdx=f.ClipperBase.Skip);b=q;do this.InitEdge2(b,d),b=b.Next,v&&b.Curr.Y!=q.Curr.Y&&(v=!1);while(b!=q);if(v){if(e)return!1;b.Prev.OutIdx=
-f.ClipperBase.Skip;b.Prev.Bot.X<b.Prev.Top.X&&this.ReverseHorizontal(b.Prev);d=new f.LocalMinima;d.Next=null;d.Y=b.Bot.Y;d.LeftBound=null;d.RightBound=b;d.RightBound.Side=f.EdgeSide.esRight;for(d.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(d);this.m_edges.push(n);return!0}this.m_edges.push(n);v=null;for(f.IntPoint.op_Equality(b.Prev.Bot,b.Prev.Top)&&(b=b.Next);;){b=this.FindNextLocMin(b);
-if(b==v)break;else null==v&&(v=b);d=new f.LocalMinima;d.Next=null;d.Y=b.Bot.Y;b.Dx<b.Prev.Dx?(d.LeftBound=b.Prev,d.RightBound=b,n=!1):(d.LeftBound=b,d.RightBound=b.Prev,n=!0);d.LeftBound.Side=f.EdgeSide.esLeft;d.RightBound.Side=f.EdgeSide.esRight;d.LeftBound.WindDelta=e?d.LeftBound.Next==d.RightBound?-1:1:0;d.RightBound.WindDelta=-d.LeftBound.WindDelta;b=this.ProcessBound(d.LeftBound,n);b.OutIdx==f.ClipperBase.Skip&&(b=this.ProcessBound(b,n));q=this.ProcessBound(d.RightBound,!n);q.OutIdx==f.ClipperBase.Skip&&
-(q=this.ProcessBound(q,!n));d.LeftBound.OutIdx==f.ClipperBase.Skip?d.LeftBound=null:d.RightBound.OutIdx==f.ClipperBase.Skip&&(d.RightBound=null);this.InsertLocalMinima(d);n||(b=q)}return!0};f.ClipperBase.prototype.AddPaths=function(b,d,e){for(var f=!1,n=0,k=b.length;n<k;++n)this.AddPath(b[n],d,e)&&(f=!0);return f};f.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(b,d,e){return f.IntPoint.op_Equality(b,e)||f.IntPoint.op_Equality(b,d)||f.IntPoint.op_Equality(e,d)?!1:b.X!=e.X?d.X>b.X==d.X<e.X:d.Y>
+function(b,d,e,r){b.Next=d;b.Prev=e;b.Curr.X=r.X;b.Curr.Y=r.Y;f.use_xyz&&(b.Curr.Z=r.Z);b.OutIdx=-1};f.ClipperBase.prototype.InitEdge2=function(b,d){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=d};f.ClipperBase.prototype.FindNextLocMin=
+function(b){for(var d;;){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(d=b;b.Dx==f.ClipperBase.horizontal;)b=b.Next;if(b.Top.Y!=b.Prev.Bot.Y){d.Prev.Bot.X<b.Bot.X&&(b=d);break}}return b};f.ClipperBase.prototype.ProcessBound=function(b,d){var e,r=b,n;if(r.OutIdx==f.ClipperBase.Skip){b=r;if(d){for(;b.Top.Y==b.Next.Bot.Y;)b=
+b.Next;for(;b!=r&&b.Dx==f.ClipperBase.horizontal;)b=b.Prev}else{for(;b.Top.Y==b.Prev.Bot.Y;)b=b.Prev;for(;b!=r&&b.Dx==f.ClipperBase.horizontal;)b=b.Next}b==r?r=d?b.Next:b.Prev:(b=d?r.Next:r.Prev,e=new f.LocalMinima,e.Next=null,e.Y=b.Bot.Y,e.LeftBound=null,e.RightBound=b,b.WindDelta=0,r=this.ProcessBound(b,d),this.InsertLocalMinima(e));return r}b.Dx==f.ClipperBase.horizontal&&(e=d?b.Prev:b.Next,e.OutIdx!=f.ClipperBase.Skip&&(e.Dx==f.ClipperBase.horizontal?e.Bot.X!=b.Bot.X&&e.Top.X!=b.Bot.X&&this.ReverseHorizontal(b):
+e.Bot.X!=b.Bot.X&&this.ReverseHorizontal(b)));e=b;if(d){for(;r.Top.Y==r.Next.Bot.Y&&r.Next.OutIdx!=f.ClipperBase.Skip;)r=r.Next;if(r.Dx==f.ClipperBase.horizontal&&r.Next.OutIdx!=f.ClipperBase.Skip){for(n=r;n.Prev.Dx==f.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==r.Next.Top.X?d||(r=n.Prev):n.Prev.Top.X>r.Next.Top.X&&(r=n.Prev)}for(;b!=r;)b.NextInLML=b.Next,b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=b.Prev.Top.X&&this.ReverseHorizontal(b),b=b.Next;b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=
+b.Prev.Top.X&&this.ReverseHorizontal(b);r=r.Next}else{for(;r.Top.Y==r.Prev.Bot.Y&&r.Prev.OutIdx!=f.ClipperBase.Skip;)r=r.Prev;if(r.Dx==f.ClipperBase.horizontal&&r.Prev.OutIdx!=f.ClipperBase.Skip){for(n=r;n.Next.Dx==f.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==r.Prev.Top.X?d||(r=n.Next):n.Next.Top.X>r.Prev.Top.X&&(r=n.Next)}for(;b!=r;)b.NextInLML=b.Prev,b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=b.Next.Top.X&&this.ReverseHorizontal(b),b=b.Prev;b.Dx==f.ClipperBase.horizontal&&b!=e&&b.Bot.X!=
+b.Next.Top.X&&this.ReverseHorizontal(b);r=r.Prev}return r};f.ClipperBase.prototype.AddPath=function(b,d,e){f.use_lines?e||d!=f.PolyType.ptClip||f.Error("AddPath: Open paths must be subject."):e||f.Error("AddPath: Open paths have been disabled.");var r=b.length-1;if(e)for(;0<r&&f.IntPoint.op_Equality(b[r],b[0]);)--r;for(;0<r&&f.IntPoint.op_Equality(b[r],b[r-1]);)--r;if(e&&2>r||!e&&1>r)return!1;for(var n=[],k=0;k<=r;k++)n.push(new f.TEdge);var u=!0;n[1].Curr.X=b[1].X;n[1].Curr.Y=b[1].Y;f.use_xyz&&(n[1].Curr.Z=
+b[1].Z);var C={Value:this.m_UseFullRange};this.RangeTest(b[0],C);this.m_UseFullRange=C.Value;C.Value=this.m_UseFullRange;this.RangeTest(b[r],C);this.m_UseFullRange=C.Value;this.InitEdge(n[0],n[1],n[r],b[0]);this.InitEdge(n[r],n[0],n[r-1],b[r]);for(k=r-1;1<=k;--k)C.Value=this.m_UseFullRange,this.RangeTest(b[k],C),this.m_UseFullRange=C.Value,this.InitEdge(n[k],n[k+1],n[k-1],b[k]);for(k=b=r=n[0];;)if(b.Curr!=b.Next.Curr||!e&&b.Next==r){if(b.Prev==b.Next)break;else if(e&&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==r&&(r=b.Next);b=this.RemoveEdge(b);k=b=b.Prev;continue}b=b.Next;if(b==k||!e&&b.Next==r)break}else{if(b==b.Next)break;b==r&&(r=b.Next);k=b=this.RemoveEdge(b)}if(!e&&b==b.Next||e&&b.Prev==b.Next)return!1;e||(this.m_HasOpenPaths=!0,r.Prev.OutIdx=f.ClipperBase.Skip);b=r;do this.InitEdge2(b,d),b=b.Next,u&&b.Curr.Y!=r.Curr.Y&&(u=!1);while(b!=r);if(u){if(e)return!1;b.Prev.OutIdx=
+f.ClipperBase.Skip;b.Prev.Bot.X<b.Prev.Top.X&&this.ReverseHorizontal(b.Prev);d=new f.LocalMinima;d.Next=null;d.Y=b.Bot.Y;d.LeftBound=null;d.RightBound=b;d.RightBound.Side=f.EdgeSide.esRight;for(d.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(d);this.m_edges.push(n);return!0}this.m_edges.push(n);u=null;for(f.IntPoint.op_Equality(b.Prev.Bot,b.Prev.Top)&&(b=b.Next);;){b=this.FindNextLocMin(b);
+if(b==u)break;else null==u&&(u=b);d=new f.LocalMinima;d.Next=null;d.Y=b.Bot.Y;b.Dx<b.Prev.Dx?(d.LeftBound=b.Prev,d.RightBound=b,n=!1):(d.LeftBound=b,d.RightBound=b.Prev,n=!0);d.LeftBound.Side=f.EdgeSide.esLeft;d.RightBound.Side=f.EdgeSide.esRight;d.LeftBound.WindDelta=e?d.LeftBound.Next==d.RightBound?-1:1:0;d.RightBound.WindDelta=-d.LeftBound.WindDelta;b=this.ProcessBound(d.LeftBound,n);b.OutIdx==f.ClipperBase.Skip&&(b=this.ProcessBound(b,n));r=this.ProcessBound(d.RightBound,!n);r.OutIdx==f.ClipperBase.Skip&&
+(r=this.ProcessBound(r,!n));d.LeftBound.OutIdx==f.ClipperBase.Skip?d.LeftBound=null:d.RightBound.OutIdx==f.ClipperBase.Skip&&(d.RightBound=null);this.InsertLocalMinima(d);n||(b=r)}return!0};f.ClipperBase.prototype.AddPaths=function(b,d,e){for(var f=!1,n=0,k=b.length;n<k;++n)this.AddPath(b[n],d,e)&&(f=!0);return f};f.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(b,d,e){return f.IntPoint.op_Equality(b,e)||f.IntPoint.op_Equality(b,d)||f.IntPoint.op_Equality(e,d)?!1:b.X!=e.X?d.X>b.X==d.X<e.X:d.Y>
b.Y==d.Y<e.Y};f.ClipperBase.prototype.RemoveEdge=function(b){b.Prev.Next=b.Next;b.Next.Prev=b.Prev;var d=b.Next;b.Prev=null;return d};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 d=this.m_MinimaList;null!==
d.Next&&b.Y<d.Next.Y;)d=d.Next;b.Next=d.Next;d.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 d=b.Top.X;b.Top.X=b.Bot.X;b.Bot.X=d;f.use_xyz&&(d=b.Top.Z,b.Top.Z=b.Bot.Z,b.Bot.Z=d)};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 d=b.LeftBound;null!=d&&(d.Curr.X=d.Bot.X,
d.Curr.Y=d.Bot.Y,f.use_xyz&&(d.Curr.Z=d.Bot.Z),d.Side=f.EdgeSide.esLeft,d.OutIdx=f.ClipperBase.Unassigned);d=b.RightBound;null!=d&&(d.Curr.X=d.Bot.X,d.Curr.Y=d.Bot.Y,f.use_xyz&&(d.Curr.Z=d.Bot.Z),d.Side=f.EdgeSide.esRight,d.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 d=new f.Scanbeam;d.Y=b;d.Next=this.m_Scanbeam;this.m_Scanbeam=d}else{for(var e=this.m_Scanbeam;null!==e.Next&&b<=e.Next.Y;)e=e.Next;b!=e.Y&&(d=new f.Scanbeam,d.Y=b,d.Next=e.Next,e.Next=d)}};f.Clipper.prototype.Execute=
-function(){var b=arguments,d=b.length,e=b[1]instanceof f.PolyTree;if(4!=d||e){if(4==d&&e){var d=b[0],q=b[1],e=b[2],b=b[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0;this.m_SubjFillType=e;this.m_ClipFillType=b;this.m_ClipType=d;this.m_UsingPolyTree=!0;try{(n=this.ExecuteInternal())&&this.BuildResult2(q)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return n}if(2==d&&!e||2==d&&e)return d=b[0],q=b[1],this.Execute(d,q,f.PolyFillType.pftEvenOdd,f.PolyFillType.pftEvenOdd)}else{d=
-b[0];q=b[1];e=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(q);this.m_SubjFillType=e;this.m_ClipFillType=b;this.m_ClipType=d;this.m_UsingPolyTree=!1;try{var n=this.ExecuteInternal();n&&this.BuildResult(q)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return n}};f.Clipper.prototype.FixHoleLinkage=function(b){if(null!==b.FirstLeft&&(b.IsHole==b.FirstLeft.IsHole||null===b.FirstLeft.Pts)){for(var d=
+function(){var b=arguments,d=b.length,e=b[1]instanceof f.PolyTree;if(4!=d||e){if(4==d&&e){var d=b[0],r=b[1],e=b[2],b=b[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0;this.m_SubjFillType=e;this.m_ClipFillType=b;this.m_ClipType=d;this.m_UsingPolyTree=!0;try{(n=this.ExecuteInternal())&&this.BuildResult2(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return n}if(2==d&&!e||2==d&&e)return d=b[0],r=b[1],this.Execute(d,r,f.PolyFillType.pftEvenOdd,f.PolyFillType.pftEvenOdd)}else{d=
+b[0];r=b[1];e=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(r);this.m_SubjFillType=e;this.m_ClipFillType=b;this.m_ClipType=d;this.m_UsingPolyTree=!1;try{var n=this.ExecuteInternal();n&&this.BuildResult(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return n}};f.Clipper.prototype.FixHoleLinkage=function(b){if(null!==b.FirstLeft&&(b.IsHole==b.FirstLeft.IsHole||null===b.FirstLeft.Pts)){for(var d=
b.FirstLeft;null!==d&&(d.IsHole==b.IsHole||null===d.Pts);)d=d.FirstLeft;b.FirstLeft=d}};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 d=this.PopScanbeam();if(!this.ProcessIntersections(d))return!1;this.ProcessEdgesAtTopOfScanbeam(d);b=d}while(null!==this.m_Scanbeam||null!==this.m_CurrentLM);for(var b=
-0,e=this.m_PolyOuts.length;b<e;b++){var q=this.m_PolyOuts[b];null===q.Pts||q.IsOpen||(q.IsHole^this.ReverseSolution)==0<this.Area(q)&&this.ReversePolyPtLinks(q.Pts)}this.JoinCommonEdges();b=0;for(e=this.m_PolyOuts.length;b<e;b++)q=this.m_PolyOuts[b],null===q.Pts||q.IsOpen||this.FixupOutPolygon(q);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,d=this.m_PolyOuts.length;b<d;++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,d,e){var q=new f.Join;q.OutPt1=b;q.OutPt2=d;q.OffPt.X=e.X;q.OffPt.Y=e.Y;f.use_xyz&&(q.OffPt.Z=e.Z);this.m_Joins.push(q)};f.Clipper.prototype.AddGhostJoin=function(b,d){var e=new f.Join;e.OutPt1=b;e.OffPt.X=d.X;e.OffPt.Y=
+0,e=this.m_PolyOuts.length;b<e;b++){var r=this.m_PolyOuts[b];null===r.Pts||r.IsOpen||(r.IsHole^this.ReverseSolution)==0<this.Area(r)&&this.ReversePolyPtLinks(r.Pts)}this.JoinCommonEdges();b=0;for(e=this.m_PolyOuts.length;b<e;b++)r=this.m_PolyOuts[b],null===r.Pts||r.IsOpen||this.FixupOutPolygon(r);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,d=this.m_PolyOuts.length;b<d;++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,d,e){var r=new f.Join;r.OutPt1=b;r.OutPt2=d;r.OffPt.X=e.X;r.OffPt.Y=e.Y;f.use_xyz&&(r.OffPt.Z=e.Z);this.m_Joins.push(r)};f.Clipper.prototype.AddGhostJoin=function(b,d){var e=new f.Join;e.OutPt1=b;e.OffPt.X=d.X;e.OffPt.Y=
d.Y;f.use_xyz&&(e.OffPt.Z=d.Z);this.m_GhostJoins.push(e)};f.Clipper.prototype.SetZ=function(b,d,e){null!==this.ZFillFunction&&0==b.Z&&null!==this.ZFillFunction&&(f.IntPoint.op_Equality(b,d.Bot)?b.Z=d.Bot.Z:f.IntPoint.op_Equality(b,d.Top)?b.Z=d.Top.Z:f.IntPoint.op_Equality(b,e.Bot)?b.Z=e.Bot.Z:f.IntPoint.op_Equality(b,e.Top)?b.Z=e.Top.Z:this.ZFillFunction(d.Bot,d.Top,e.Bot,e.Top,b))};f.Clipper.prototype.InsertLocalMinimaIntoAEL=function(b){for(;null!==this.m_CurrentLM&&this.m_CurrentLM.Y==b;){var d=
-this.m_CurrentLM.LeftBound,e=this.m_CurrentLM.RightBound;this.PopLocalMinima();var q=null;null===d?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(q=this.AddOutPt(e,e.Bot))):(null==e?(this.InsertEdgeIntoAEL(d,null),this.SetWindingCount(d),this.IsContributing(d)&&(q=this.AddOutPt(d,d.Bot))):(this.InsertEdgeIntoAEL(d,null),this.InsertEdgeIntoAEL(e,d),this.SetWindingCount(d),e.WindCnt=d.WindCnt,e.WindCnt2=d.WindCnt2,this.IsContributing(d)&&(q=this.AddLocalMinPoly(d,e,
-d.Bot))),this.InsertScanbeam(d.Top.Y));null!=e&&(f.ClipperBase.IsHorizontal(e)?this.AddEdgeToSEL(e):this.InsertScanbeam(e.Top.Y));if(null!=d&&null!=e){if(null!==q&&f.ClipperBase.IsHorizontal(e)&&0<this.m_GhostJoins.length&&0!==e.WindDelta)for(var n=0,k=this.m_GhostJoins.length;n<k;n++){var v=this.m_GhostJoins[n];this.HorzSegmentsOverlap(v.OutPt1.Pt.X,v.OffPt.X,e.Bot.X,e.Top.X)&&this.AddJoin(v.OutPt1,q,v.OffPt)}0<=d.OutIdx&&null!==d.PrevInAEL&&d.PrevInAEL.Curr.X==d.Bot.X&&0<=d.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(d.PrevInAEL,
-d,this.m_UseFullRange)&&0!==d.WindDelta&&0!==d.PrevInAEL.WindDelta&&(n=this.AddOutPt(d.PrevInAEL,d.Bot),this.AddJoin(q,n,d.Top));if(d.NextInAEL!=e&&(0<=e.OutIdx&&0<=e.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&0!==e.WindDelta&&0!==e.PrevInAEL.WindDelta&&(n=this.AddOutPt(e.PrevInAEL,e.Bot),this.AddJoin(q,n,e.Top)),q=d.NextInAEL,null!==q))for(;q!=e;)this.IntersectEdges(e,q,d.Curr,!1),q=q.NextInAEL}}};f.Clipper.prototype.InsertEdgeIntoAEL=function(b,d){if(null===
+this.m_CurrentLM.LeftBound,e=this.m_CurrentLM.RightBound;this.PopLocalMinima();var r=null;null===d?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(r=this.AddOutPt(e,e.Bot))):(null==e?(this.InsertEdgeIntoAEL(d,null),this.SetWindingCount(d),this.IsContributing(d)&&(r=this.AddOutPt(d,d.Bot))):(this.InsertEdgeIntoAEL(d,null),this.InsertEdgeIntoAEL(e,d),this.SetWindingCount(d),e.WindCnt=d.WindCnt,e.WindCnt2=d.WindCnt2,this.IsContributing(d)&&(r=this.AddLocalMinPoly(d,e,
+d.Bot))),this.InsertScanbeam(d.Top.Y));null!=e&&(f.ClipperBase.IsHorizontal(e)?this.AddEdgeToSEL(e):this.InsertScanbeam(e.Top.Y));if(null!=d&&null!=e){if(null!==r&&f.ClipperBase.IsHorizontal(e)&&0<this.m_GhostJoins.length&&0!==e.WindDelta)for(var n=0,k=this.m_GhostJoins.length;n<k;n++){var u=this.m_GhostJoins[n];this.HorzSegmentsOverlap(u.OutPt1.Pt.X,u.OffPt.X,e.Bot.X,e.Top.X)&&this.AddJoin(u.OutPt1,r,u.OffPt)}0<=d.OutIdx&&null!==d.PrevInAEL&&d.PrevInAEL.Curr.X==d.Bot.X&&0<=d.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(d.PrevInAEL,
+d,this.m_UseFullRange)&&0!==d.WindDelta&&0!==d.PrevInAEL.WindDelta&&(n=this.AddOutPt(d.PrevInAEL,d.Bot),this.AddJoin(r,n,d.Top));if(d.NextInAEL!=e&&(0<=e.OutIdx&&0<=e.PrevInAEL.OutIdx&&f.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&0!==e.WindDelta&&0!==e.PrevInAEL.WindDelta&&(n=this.AddOutPt(e.PrevInAEL,e.Bot),this.AddJoin(r,n,e.Top)),r=d.NextInAEL,null!==r))for(;r!=e;)this.IntersectEdges(e,r,d.Curr,!1),r=r.NextInAEL}}};f.Clipper.prototype.InsertEdgeIntoAEL=function(b,d){if(null===
this.m_ActiveEdges)b.PrevInAEL=null,b.NextInAEL=null,this.m_ActiveEdges=b;else if(null===d&&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===d&&(d=this.m_ActiveEdges);null!==d.NextInAEL&&!this.E2InsertsBeforeE1(d.NextInAEL,b);)d=d.NextInAEL;b.NextInAEL=d.NextInAEL;null!==d.NextInAEL&&(d.NextInAEL.PrevInAEL=b);b.PrevInAEL=d;d.NextInAEL=b}};f.Clipper.prototype.E2InsertsBeforeE1=function(b,d){return d.Curr.X==
b.Curr.X?d.Top.Y>b.Top.Y?d.Top.X<f.Clipper.TopX(b,d.Top.Y):b.Top.X>f.Clipper.TopX(d,b.Top.Y):d.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 d,e;b.PolyTyp==f.PolyType.ptSubject?(d=this.m_SubjFillType,e=this.m_ClipFillType):(d=this.m_ClipFillType,e=this.m_SubjFillType);switch(d){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(e){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(e){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(e){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(e){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(e){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 d=b.PrevInAEL;null!==
-d&&(d.PolyTyp!=b.PolyTyp||0===d.WindDelta);)d=d.PrevInAEL;if(null===d)b.WindCnt=0===b.WindDelta?1:b.WindDelta,b.WindCnt2=0,d=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 e=!0,q=d.PrevInAEL;null!==q;)q.PolyTyp==d.PolyTyp&&0!==q.WindDelta&&(e=!e),q=q.PrevInAEL;b.WindCnt=e?0:1}else b.WindCnt=b.WindDelta;else b.WindCnt=0>d.WindCnt*d.WindDelta?1<Math.abs(d.WindCnt)?0>d.WindDelta*b.WindDelta?d.WindCnt:
+d&&(d.PolyTyp!=b.PolyTyp||0===d.WindDelta);)d=d.PrevInAEL;if(null===d)b.WindCnt=0===b.WindDelta?1:b.WindDelta,b.WindCnt2=0,d=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 e=!0,r=d.PrevInAEL;null!==r;)r.PolyTyp==d.PolyTyp&&0!==r.WindDelta&&(e=!e),r=r.PrevInAEL;b.WindCnt=e?0:1}else b.WindCnt=b.WindDelta;else b.WindCnt=0>d.WindCnt*d.WindDelta?1<Math.abs(d.WindCnt)?0>d.WindDelta*b.WindDelta?d.WindCnt:
d.WindCnt+b.WindDelta:0===b.WindDelta?1:b.WindDelta:0===b.WindDelta?0>d.WindCnt?d.WindCnt-1:d.WindCnt+1:0>d.WindDelta*b.WindDelta?d.WindCnt:d.WindCnt+b.WindDelta;b.WindCnt2=d.WindCnt2;d=d.NextInAEL}if(this.IsEvenOddAltFillType(b))for(;d!=b;)0!==d.WindDelta&&(b.WindCnt2=0===b.WindCnt2?1:0),d=d.NextInAEL;else for(;d!=b;)b.WindCnt2+=d.WindDelta,d=d.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,d){if(b.NextInAEL!=b.PrevInAEL&&d.NextInAEL!=d.PrevInAEL){if(b.NextInAEL==d){var e=d.NextInAEL;null!==e&&(e.PrevInAEL=b);var f=b.PrevInAEL;null!==f&&(f.NextInAEL=d);d.PrevInAEL=f;d.NextInAEL=b;b.PrevInAEL=d;b.NextInAEL=e}else d.NextInAEL==
b?(e=b.NextInAEL,null!==e&&(e.PrevInAEL=d),f=d.PrevInAEL,null!==f&&(f.NextInAEL=b),b.PrevInAEL=f,b.NextInAEL=d,d.PrevInAEL=b,d.NextInAEL=e):(e=b.NextInAEL,f=b.PrevInAEL,b.NextInAEL=d.NextInAEL,null!==b.NextInAEL&&(b.NextInAEL.PrevInAEL=b),b.PrevInAEL=d.PrevInAEL,null!==b.PrevInAEL&&(b.PrevInAEL.NextInAEL=b),d.NextInAEL=e,null!==d.NextInAEL&&(d.NextInAEL.PrevInAEL=d),d.PrevInAEL=f,null!==d.PrevInAEL&&(d.PrevInAEL.NextInAEL=d));null===b.PrevInAEL?this.m_ActiveEdges=b:null===d.PrevInAEL&&(this.m_ActiveEdges=
d)}};f.Clipper.prototype.SwapPositionsInSEL=function(b,d){if(null!==b.NextInSEL||null!==b.PrevInSEL)if(null!==d.NextInSEL||null!==d.PrevInSEL){if(b.NextInSEL==d){var e=d.NextInSEL;null!==e&&(e.PrevInSEL=b);var f=b.PrevInSEL;null!==f&&(f.NextInSEL=d);d.PrevInSEL=f;d.NextInSEL=b;b.PrevInSEL=d;b.NextInSEL=e}else d.NextInSEL==b?(e=b.NextInSEL,null!==e&&(e.PrevInSEL=d),f=d.PrevInSEL,null!==f&&(f.NextInSEL=b),b.PrevInSEL=f,b.NextInSEL=d,d.PrevInSEL=b,d.NextInSEL=e):(e=b.NextInSEL,f=b.PrevInSEL,b.NextInSEL=
d.NextInSEL,null!==b.NextInSEL&&(b.NextInSEL.PrevInSEL=b),b.PrevInSEL=d.PrevInSEL,null!==b.PrevInSEL&&(b.PrevInSEL.NextInSEL=b),d.NextInSEL=e,null!==d.NextInSEL&&(d.NextInSEL.PrevInSEL=d),d.PrevInSEL=f,null!==d.PrevInSEL&&(d.PrevInSEL.NextInSEL=d));null===b.PrevInSEL?this.m_SortedEdges=b:null===d.PrevInSEL&&(this.m_SortedEdges=d)}};f.Clipper.prototype.AddLocalMaxPoly=function(b,d,e){this.AddOutPt(b,e);0==d.WindDelta&&this.AddOutPt(d,e);b.OutIdx==d.OutIdx?(b.OutIdx=-1,d.OutIdx=-1):b.OutIdx<d.OutIdx?
-this.AppendPolygon(b,d):this.AppendPolygon(d,b)};f.Clipper.prototype.AddLocalMinPoly=function(b,d,e){var q,n;f.ClipperBase.IsHorizontal(d)||b.Dx>d.Dx?(q=this.AddOutPt(b,e),d.OutIdx=b.OutIdx,b.Side=f.EdgeSide.esLeft,d.Side=f.EdgeSide.esRight,n=b,b=n.PrevInAEL==d?d.PrevInAEL:n.PrevInAEL):(q=this.AddOutPt(d,e),b.OutIdx=d.OutIdx,b.Side=f.EdgeSide.esRight,d.Side=f.EdgeSide.esLeft,n=d,b=n.PrevInAEL==b?b.PrevInAEL:n.PrevInAEL);null!==b&&0<=b.OutIdx&&f.Clipper.TopX(b,e.Y)==f.Clipper.TopX(n,e.Y)&&f.ClipperBase.SlopesEqual(n,
-b,this.m_UseFullRange)&&0!==n.WindDelta&&0!==b.WindDelta&&(e=this.AddOutPt(b,e),this.AddJoin(q,e,n.Top));return q};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,d){var e=b.Side==f.EdgeSide.esLeft;if(0>b.OutIdx){var q=this.CreateOutRec();q.IsOpen=0===b.WindDelta;var n=new f.OutPt;q.Pts=
-n;n.Idx=q.Idx;n.Pt.X=d.X;n.Pt.Y=d.Y;f.use_xyz&&(n.Pt.Z=d.Z);n.Next=n;n.Prev=n;q.IsOpen||this.SetHoleState(b,q);b.OutIdx=q.Idx}else{var q=this.m_PolyOuts[b.OutIdx],k=q.Pts;if(e&&f.IntPoint.op_Equality(d,k.Pt))return k;if(!e&&f.IntPoint.op_Equality(d,k.Prev.Pt))return k.Prev;n=new f.OutPt;n.Idx=q.Idx;n.Pt.X=d.X;n.Pt.Y=d.Y;f.use_xyz&&(n.Pt.Z=d.Z);n.Next=k;n.Prev=k.Prev;n.Prev.Next=n;k.Prev=n;e&&(q.Pts=n)}return n};f.Clipper.prototype.SwapPoints=function(b,d){var e=new f.IntPoint(b.Value);b.Value.X=d.Value.X;
+this.AppendPolygon(b,d):this.AppendPolygon(d,b)};f.Clipper.prototype.AddLocalMinPoly=function(b,d,e){var r,n;f.ClipperBase.IsHorizontal(d)||b.Dx>d.Dx?(r=this.AddOutPt(b,e),d.OutIdx=b.OutIdx,b.Side=f.EdgeSide.esLeft,d.Side=f.EdgeSide.esRight,n=b,b=n.PrevInAEL==d?d.PrevInAEL:n.PrevInAEL):(r=this.AddOutPt(d,e),b.OutIdx=d.OutIdx,b.Side=f.EdgeSide.esRight,d.Side=f.EdgeSide.esLeft,n=d,b=n.PrevInAEL==b?b.PrevInAEL:n.PrevInAEL);null!==b&&0<=b.OutIdx&&f.Clipper.TopX(b,e.Y)==f.Clipper.TopX(n,e.Y)&&f.ClipperBase.SlopesEqual(n,
+b,this.m_UseFullRange)&&0!==n.WindDelta&&0!==b.WindDelta&&(e=this.AddOutPt(b,e),this.AddJoin(r,e,n.Top));return r};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,d){var e=b.Side==f.EdgeSide.esLeft;if(0>b.OutIdx){var r=this.CreateOutRec();r.IsOpen=0===b.WindDelta;var n=new f.OutPt;r.Pts=
+n;n.Idx=r.Idx;n.Pt.X=d.X;n.Pt.Y=d.Y;f.use_xyz&&(n.Pt.Z=d.Z);n.Next=n;n.Prev=n;r.IsOpen||this.SetHoleState(b,r);b.OutIdx=r.Idx}else{var r=this.m_PolyOuts[b.OutIdx],k=r.Pts;if(e&&f.IntPoint.op_Equality(d,k.Pt))return k;if(!e&&f.IntPoint.op_Equality(d,k.Prev.Pt))return k.Prev;n=new f.OutPt;n.Idx=r.Idx;n.Pt.X=d.X;n.Pt.Y=d.Y;f.use_xyz&&(n.Pt.Z=d.Z);n.Next=k;n.Prev=k.Prev;n.Prev.Next=n;k.Prev=n;e&&(r.Pts=n)}return n};f.Clipper.prototype.SwapPoints=function(b,d){var e=new f.IntPoint(b.Value);b.Value.X=d.Value.X;
b.Value.Y=d.Value.Y;f.use_xyz&&(b.Value.Z=d.Value.Z);d.Value.X=e.X;d.Value.Y=e.Y;f.use_xyz&&(d.Value.Z=e.Z)};f.Clipper.prototype.HorzSegmentsOverlap=function(b,d,e,f){var n;b>d&&(n=b,b=d,d=n);e>f&&(n=e,e=f,f=n);return b<f&&e<d};f.Clipper.prototype.SetHoleState=function(b,d){for(var e=!1,f=b.PrevInAEL;null!==f;)0<=f.OutIdx&&0!=f.WindDelta&&(e=!e,null===d.FirstLeft&&(d.FirstLeft=this.m_PolyOuts[f.OutIdx])),f=f.PrevInAEL;e&&(d.IsHole=!0)};f.Clipper.prototype.GetDx=function(b,d){return b.Y==d.Y?f.ClipperBase.horizontal:
-(d.X-b.X)/(d.Y-b.Y)};f.Clipper.prototype.FirstIsBottomPt=function(b,d){for(var e=b.Prev;f.IntPoint.op_Equality(e.Pt,b.Pt)&&e!=b;)e=e.Prev;for(var q=Math.abs(this.GetDx(b.Pt,e.Pt)),e=b.Next;f.IntPoint.op_Equality(e.Pt,b.Pt)&&e!=b;)e=e.Next;for(var n=Math.abs(this.GetDx(b.Pt,e.Pt)),e=d.Prev;f.IntPoint.op_Equality(e.Pt,d.Pt)&&e!=d;)e=e.Prev;for(var k=Math.abs(this.GetDx(d.Pt,e.Pt)),e=d.Next;f.IntPoint.op_Equality(e.Pt,d.Pt)&&e!=d;)e=e.Next;e=Math.abs(this.GetDx(d.Pt,e.Pt));return q>=k&&q>=e||n>=k&&n>=
+(d.X-b.X)/(d.Y-b.Y)};f.Clipper.prototype.FirstIsBottomPt=function(b,d){for(var e=b.Prev;f.IntPoint.op_Equality(e.Pt,b.Pt)&&e!=b;)e=e.Prev;for(var r=Math.abs(this.GetDx(b.Pt,e.Pt)),e=b.Next;f.IntPoint.op_Equality(e.Pt,b.Pt)&&e!=b;)e=e.Next;for(var n=Math.abs(this.GetDx(b.Pt,e.Pt)),e=d.Prev;f.IntPoint.op_Equality(e.Pt,d.Pt)&&e!=d;)e=e.Prev;for(var k=Math.abs(this.GetDx(d.Pt,e.Pt)),e=d.Next;f.IntPoint.op_Equality(e.Pt,d.Pt)&&e!=d;)e=e.Next;e=Math.abs(this.GetDx(d.Pt,e.Pt));return r>=k&&r>=e||n>=k&&n>=
e};f.Clipper.prototype.GetBottomPt=function(b){for(var d=null,e=b.Next;e!=b;)e.Pt.Y>b.Pt.Y?(b=e,d=null):e.Pt.Y==b.Pt.Y&&e.Pt.X<=b.Pt.X&&(e.Pt.X<b.Pt.X?(d=null,b=e):e.Next!=b&&e.Prev!=b&&(d=e)),e=e.Next;if(null!==d)for(;d!=e;)for(this.FirstIsBottomPt(e,d)||(b=d),d=d.Next;f.IntPoint.op_Inequality(d.Pt,b.Pt);)d=d.Next;return b};f.Clipper.prototype.GetLowermostRec=function(b,d){null===b.BottomPt&&(b.BottomPt=this.GetBottomPt(b.Pts));null===d.BottomPt&&(d.BottomPt=this.GetBottomPt(d.Pts));var e=b.BottomPt,
-f=d.BottomPt;return e.Pt.Y>f.Pt.Y?b:e.Pt.Y<f.Pt.Y?d:e.Pt.X<f.Pt.X?b:e.Pt.X>f.Pt.X?d:e.Next==e?d:f.Next==f?b:this.FirstIsBottomPt(e,f)?b:d};f.Clipper.prototype.Param1RightOfParam2=function(b,d){do if(b=b.FirstLeft,b==d)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,d){var e=this.m_PolyOuts[b.OutIdx],q=this.m_PolyOuts[d.OutIdx],n;n=this.Param1RightOfParam2(e,
-q)?q:this.Param1RightOfParam2(q,e)?e:this.GetLowermostRec(e,q);var k=e.Pts,v=k.Prev,C=q.Pts,p=C.Prev;b.Side==f.EdgeSide.esLeft?(d.Side==f.EdgeSide.esLeft?(this.ReversePolyPtLinks(C),C.Next=k,k.Prev=C,v.Next=p,p.Prev=v,e.Pts=p):(p.Next=k,k.Prev=p,C.Prev=v,v.Next=C,e.Pts=C),k=f.EdgeSide.esLeft):(d.Side==f.EdgeSide.esRight?(this.ReversePolyPtLinks(C),v.Next=p,p.Prev=v,C.Next=k,k.Prev=C):(v.Next=C,C.Prev=v,k.Prev=p,p.Next=k),k=f.EdgeSide.esRight);e.BottomPt=null;n==q&&(q.FirstLeft!=e&&(e.FirstLeft=q.FirstLeft),
-e.IsHole=q.IsHole);q.Pts=null;q.BottomPt=null;q.FirstLeft=e;n=b.OutIdx;v=d.OutIdx;b.OutIdx=-1;d.OutIdx=-1;for(C=this.m_ActiveEdges;null!==C;){if(C.OutIdx==v){C.OutIdx=n;C.Side=k;break}C=C.NextInAEL}q.Idx=e.Idx};f.Clipper.prototype.ReversePolyPtLinks=function(b){if(null!==b){var d,e;d=b;do e=d.Next,d.Next=d.Prev,d=d.Prev=e;while(d!=b)}};f.Clipper.SwapSides=function(b,d){var e=b.Side;b.Side=d.Side;d.Side=e};f.Clipper.SwapPolyIndexes=function(b,d){var e=b.OutIdx;b.OutIdx=d.OutIdx;d.OutIdx=e};f.Clipper.prototype.IntersectEdges=
-function(b,d,e){var q=0<=b.OutIdx,n=0<=d.OutIdx;f.use_xyz&&this.SetZ(e,b,d);if(!f.use_lines||0!==b.WindDelta&&0!==d.WindDelta){if(b.PolyTyp==d.PolyTyp)if(this.IsEvenOddFillType(b)){var k=b.WindCnt;b.WindCnt=d.WindCnt;d.WindCnt=k}else b.WindCnt=0===b.WindCnt+d.WindDelta?-b.WindCnt:b.WindCnt+d.WindDelta,d.WindCnt=0===d.WindCnt-b.WindDelta?-d.WindCnt:d.WindCnt-b.WindDelta;else this.IsEvenOddFillType(d)?b.WindCnt2=0===b.WindCnt2?1:0:b.WindCnt2+=d.WindDelta,this.IsEvenOddFillType(b)?d.WindCnt2=0===d.WindCnt2?
-1:0:d.WindCnt2-=b.WindDelta;var v,C,p;b.PolyTyp==f.PolyType.ptSubject?(v=this.m_SubjFillType,p=this.m_ClipFillType):(v=this.m_ClipFillType,p=this.m_SubjFillType);d.PolyTyp==f.PolyType.ptSubject?(C=this.m_SubjFillType,k=this.m_ClipFillType):(C=this.m_ClipFillType,k=this.m_SubjFillType);switch(v){case f.PolyFillType.pftPositive:v=b.WindCnt;break;case f.PolyFillType.pftNegative:v=-b.WindCnt;break;default:v=Math.abs(b.WindCnt)}switch(C){case f.PolyFillType.pftPositive:C=d.WindCnt;break;case f.PolyFillType.pftNegative:C=
--d.WindCnt;break;default:C=Math.abs(d.WindCnt)}if(q&&n)0!=v&&1!=v||0!=C&&1!=C||b.PolyTyp!=d.PolyTyp&&this.m_ClipType!=f.ClipType.ctXor?this.AddLocalMaxPoly(b,d,e):(this.AddOutPt(b,e),this.AddOutPt(d,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d));else if(q){if(0===C||1==C)this.AddOutPt(b,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d)}else if(n){if(0===v||1==v)this.AddOutPt(d,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d)}else if(!(0!=v&&1!=v||0!=C&&1!=C)){switch(p){case f.PolyFillType.pftPositive:q=
-b.WindCnt2;break;case f.PolyFillType.pftNegative:q=-b.WindCnt2;break;default:q=Math.abs(b.WindCnt2)}switch(k){case f.PolyFillType.pftPositive:n=d.WindCnt2;break;case f.PolyFillType.pftNegative:n=-d.WindCnt2;break;default:n=Math.abs(d.WindCnt2)}if(b.PolyTyp!=d.PolyTyp)this.AddLocalMinPoly(b,d,e);else if(1==v&&1==C)switch(this.m_ClipType){case f.ClipType.ctIntersection:0<q&&0<n&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctUnion:0>=q&&0>=n&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctDifference:(b.PolyTyp==
-f.PolyType.ptClip&&0<q&&0<n||b.PolyTyp==f.PolyType.ptSubject&&0>=q&&0>=n)&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctXor:this.AddLocalMinPoly(b,d,e)}else f.Clipper.SwapSides(b,d)}}else if(0!=b.WindDelta||0!=d.WindDelta)b.PolyTyp==d.PolyTyp&&b.WindDelta!=d.WindDelta&&this.m_ClipType==f.ClipType.ctUnion?0===b.WindDelta?n&&(this.AddOutPt(b,e),q&&(b.OutIdx=-1)):q&&(this.AddOutPt(d,e),n&&(d.OutIdx=-1)):b.PolyTyp!=d.PolyTyp&&(0!==b.WindDelta||1!=Math.abs(d.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&
-0!==d.WindCnt2?0!==d.WindDelta||1!=Math.abs(b.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&0!==b.WindCnt2||(this.AddOutPt(d,e),n&&(d.OutIdx=-1)):(this.AddOutPt(b,e),q&&(b.OutIdx=-1)))};f.Clipper.prototype.DeleteFromAEL=function(b){var d=b.PrevInAEL,e=b.NextInAEL;if(null!==d||null!==e||b==this.m_ActiveEdges)null!==d?d.NextInAEL=e:this.m_ActiveEdges=e,null!==e&&(e.PrevInAEL=d),b.NextInAEL=null,b.PrevInAEL=null};f.Clipper.prototype.DeleteFromSEL=function(b){var d=b.PrevInSEL,e=b.NextInSEL;if(null!==
+f=d.BottomPt;return e.Pt.Y>f.Pt.Y?b:e.Pt.Y<f.Pt.Y?d:e.Pt.X<f.Pt.X?b:e.Pt.X>f.Pt.X?d:e.Next==e?d:f.Next==f?b:this.FirstIsBottomPt(e,f)?b:d};f.Clipper.prototype.Param1RightOfParam2=function(b,d){do if(b=b.FirstLeft,b==d)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,d){var e=this.m_PolyOuts[b.OutIdx],r=this.m_PolyOuts[d.OutIdx],n;n=this.Param1RightOfParam2(e,
+r)?r:this.Param1RightOfParam2(r,e)?e:this.GetLowermostRec(e,r);var k=e.Pts,u=k.Prev,C=r.Pts,p=C.Prev;b.Side==f.EdgeSide.esLeft?(d.Side==f.EdgeSide.esLeft?(this.ReversePolyPtLinks(C),C.Next=k,k.Prev=C,u.Next=p,p.Prev=u,e.Pts=p):(p.Next=k,k.Prev=p,C.Prev=u,u.Next=C,e.Pts=C),k=f.EdgeSide.esLeft):(d.Side==f.EdgeSide.esRight?(this.ReversePolyPtLinks(C),u.Next=p,p.Prev=u,C.Next=k,k.Prev=C):(u.Next=C,C.Prev=u,k.Prev=p,p.Next=k),k=f.EdgeSide.esRight);e.BottomPt=null;n==r&&(r.FirstLeft!=e&&(e.FirstLeft=r.FirstLeft),
+e.IsHole=r.IsHole);r.Pts=null;r.BottomPt=null;r.FirstLeft=e;n=b.OutIdx;u=d.OutIdx;b.OutIdx=-1;d.OutIdx=-1;for(C=this.m_ActiveEdges;null!==C;){if(C.OutIdx==u){C.OutIdx=n;C.Side=k;break}C=C.NextInAEL}r.Idx=e.Idx};f.Clipper.prototype.ReversePolyPtLinks=function(b){if(null!==b){var d,e;d=b;do e=d.Next,d.Next=d.Prev,d=d.Prev=e;while(d!=b)}};f.Clipper.SwapSides=function(b,d){var e=b.Side;b.Side=d.Side;d.Side=e};f.Clipper.SwapPolyIndexes=function(b,d){var e=b.OutIdx;b.OutIdx=d.OutIdx;d.OutIdx=e};f.Clipper.prototype.IntersectEdges=
+function(b,d,e){var r=0<=b.OutIdx,n=0<=d.OutIdx;f.use_xyz&&this.SetZ(e,b,d);if(!f.use_lines||0!==b.WindDelta&&0!==d.WindDelta){if(b.PolyTyp==d.PolyTyp)if(this.IsEvenOddFillType(b)){var k=b.WindCnt;b.WindCnt=d.WindCnt;d.WindCnt=k}else b.WindCnt=0===b.WindCnt+d.WindDelta?-b.WindCnt:b.WindCnt+d.WindDelta,d.WindCnt=0===d.WindCnt-b.WindDelta?-d.WindCnt:d.WindCnt-b.WindDelta;else this.IsEvenOddFillType(d)?b.WindCnt2=0===b.WindCnt2?1:0:b.WindCnt2+=d.WindDelta,this.IsEvenOddFillType(b)?d.WindCnt2=0===d.WindCnt2?
+1:0:d.WindCnt2-=b.WindDelta;var u,C,p;b.PolyTyp==f.PolyType.ptSubject?(u=this.m_SubjFillType,p=this.m_ClipFillType):(u=this.m_ClipFillType,p=this.m_SubjFillType);d.PolyTyp==f.PolyType.ptSubject?(C=this.m_SubjFillType,k=this.m_ClipFillType):(C=this.m_ClipFillType,k=this.m_SubjFillType);switch(u){case f.PolyFillType.pftPositive:u=b.WindCnt;break;case f.PolyFillType.pftNegative:u=-b.WindCnt;break;default:u=Math.abs(b.WindCnt)}switch(C){case f.PolyFillType.pftPositive:C=d.WindCnt;break;case f.PolyFillType.pftNegative:C=
+-d.WindCnt;break;default:C=Math.abs(d.WindCnt)}if(r&&n)0!=u&&1!=u||0!=C&&1!=C||b.PolyTyp!=d.PolyTyp&&this.m_ClipType!=f.ClipType.ctXor?this.AddLocalMaxPoly(b,d,e):(this.AddOutPt(b,e),this.AddOutPt(d,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d));else if(r){if(0===C||1==C)this.AddOutPt(b,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d)}else if(n){if(0===u||1==u)this.AddOutPt(d,e),f.Clipper.SwapSides(b,d),f.Clipper.SwapPolyIndexes(b,d)}else if(!(0!=u&&1!=u||0!=C&&1!=C)){switch(p){case f.PolyFillType.pftPositive:r=
+b.WindCnt2;break;case f.PolyFillType.pftNegative:r=-b.WindCnt2;break;default:r=Math.abs(b.WindCnt2)}switch(k){case f.PolyFillType.pftPositive:n=d.WindCnt2;break;case f.PolyFillType.pftNegative:n=-d.WindCnt2;break;default:n=Math.abs(d.WindCnt2)}if(b.PolyTyp!=d.PolyTyp)this.AddLocalMinPoly(b,d,e);else if(1==u&&1==C)switch(this.m_ClipType){case f.ClipType.ctIntersection:0<r&&0<n&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctUnion:0>=r&&0>=n&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctDifference:(b.PolyTyp==
+f.PolyType.ptClip&&0<r&&0<n||b.PolyTyp==f.PolyType.ptSubject&&0>=r&&0>=n)&&this.AddLocalMinPoly(b,d,e);break;case f.ClipType.ctXor:this.AddLocalMinPoly(b,d,e)}else f.Clipper.SwapSides(b,d)}}else if(0!=b.WindDelta||0!=d.WindDelta)b.PolyTyp==d.PolyTyp&&b.WindDelta!=d.WindDelta&&this.m_ClipType==f.ClipType.ctUnion?0===b.WindDelta?n&&(this.AddOutPt(b,e),r&&(b.OutIdx=-1)):r&&(this.AddOutPt(d,e),n&&(d.OutIdx=-1)):b.PolyTyp!=d.PolyTyp&&(0!==b.WindDelta||1!=Math.abs(d.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&
+0!==d.WindCnt2?0!==d.WindDelta||1!=Math.abs(b.WindCnt)||this.m_ClipType==f.ClipType.ctUnion&&0!==b.WindCnt2||(this.AddOutPt(d,e),n&&(d.OutIdx=-1)):(this.AddOutPt(b,e),r&&(b.OutIdx=-1)))};f.Clipper.prototype.DeleteFromAEL=function(b){var d=b.PrevInAEL,e=b.NextInAEL;if(null!==d||null!==e||b==this.m_ActiveEdges)null!==d?d.NextInAEL=e:this.m_ActiveEdges=e,null!==e&&(e.PrevInAEL=d),b.NextInAEL=null,b.PrevInAEL=null};f.Clipper.prototype.DeleteFromSEL=function(b){var d=b.PrevInSEL,e=b.NextInSEL;if(null!==
d||null!==e||b==this.m_SortedEdges)null!==d?d.NextInSEL=e:this.m_SortedEdges=e,null!==e&&(e.PrevInSEL=d),b.NextInSEL=null,b.PrevInSEL=null};f.Clipper.prototype.UpdateEdgeIntoAEL=function(b){null===b.NextInLML&&f.Error("UpdateEdgeIntoAEL: invalid call");var d=b.PrevInAEL,e=b.NextInAEL;b.NextInLML.OutIdx=b.OutIdx;null!==d?d.NextInAEL=b.NextInLML:this.m_ActiveEdges=b.NextInLML;null!==e&&(e.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=d;b.NextInAEL=e;f.ClipperBase.IsHorizontal(b)||this.InsertScanbeam(b.Top.Y);return b};f.Clipper.prototype.ProcessHorizontals=function(b){for(var d=this.m_SortedEdges;null!==d;)this.DeleteFromSEL(d),this.ProcessHorizontal(d,b),d=this.m_SortedEdges};f.Clipper.prototype.GetHorzDirection=function(b,d){b.Bot.X<b.Top.X?(d.Left=b.Bot.X,d.Right=b.Top.X,d.Dir=f.Direction.dLeftToRight):
-(d.Left=b.Top.X,d.Right=b.Bot.X,d.Dir=f.Direction.dRightToLeft)};f.Clipper.prototype.ProcessHorizontal=function(b,d){var e={Dir:null,Left:null,Right:null};this.GetHorzDirection(b,e);for(var q=e.Dir,n=e.Left,k=e.Right,v=b,C=null;null!==v.NextInLML&&f.ClipperBase.IsHorizontal(v.NextInLML);)v=v.NextInLML;for(null===v.NextInLML&&(C=this.GetMaximaPair(v));;){for(var p=b==v,F=this.GetNextInAEL(b,q);null!==F&&!(F.Curr.X==b.Top.X&&null!==b.NextInLML&&F.Dx<b.NextInLML.Dx);){e=this.GetNextInAEL(F,q);if(q==
-f.Direction.dLeftToRight&&F.Curr.X<=k||q==f.Direction.dRightToLeft&&F.Curr.X>=n){if(F==C&&p){if(0<=b.OutIdx){q=this.AddOutPt(b,b.Top);for(e=this.m_SortedEdges;null!==e;)0<=e.OutIdx&&this.HorzSegmentsOverlap(b.Bot.X,b.Top.X,e.Bot.X,e.Top.X)&&(n=this.AddOutPt(e,e.Bot),this.AddJoin(n,q,e.Top)),e=e.NextInSEL;this.AddGhostJoin(q,b.Bot);this.AddLocalMaxPoly(b,C,b.Top)}this.DeleteFromAEL(b);this.DeleteFromAEL(C);return}if(q==f.Direction.dLeftToRight){var E=new f.IntPoint(F.Curr.X,b.Curr.Y);this.IntersectEdges(b,
-F,E)}else E=new f.IntPoint(F.Curr.X,b.Curr.Y),this.IntersectEdges(F,b,E);this.SwapPositionsInAEL(b,F)}else if(q==f.Direction.dLeftToRight&&F.Curr.X>=k||q==f.Direction.dRightToLeft&&F.Curr.X<=n)break;F=e}if(null!==b.NextInLML&&f.ClipperBase.IsHorizontal(b.NextInLML))b=this.UpdateEdgeIntoAEL(b),0<=b.OutIdx&&this.AddOutPt(b,b.Bot),e={Dir:q,Left:n,Right:k},this.GetHorzDirection(b,e),q=e.Dir,n=e.Left,k=e.Right;else break}null!==b.NextInLML?0<=b.OutIdx?(q=this.AddOutPt(b,b.Top),d&&this.AddGhostJoin(q,b.Bot),
-b=this.UpdateEdgeIntoAEL(b),0!==b.WindDelta&&(C=b.PrevInAEL,e=b.NextInAEL,null!==C&&C.Curr.X==b.Bot.X&&C.Curr.Y==b.Bot.Y&&0!==C.WindDelta&&0<=C.OutIdx&&C.Curr.Y>C.Top.Y&&f.ClipperBase.SlopesEqual(b,C,this.m_UseFullRange)?(n=this.AddOutPt(C,b.Bot),this.AddJoin(q,n,b.Top)):null!==e&&e.Curr.X==b.Bot.X&&e.Curr.Y==b.Bot.Y&&0!==e.WindDelta&&0<=e.OutIdx&&e.Curr.Y>e.Top.Y&&f.ClipperBase.SlopesEqual(b,e,this.m_UseFullRange)&&(n=this.AddOutPt(e,b.Bot),this.AddJoin(q,n,b.Top)))):this.UpdateEdgeIntoAEL(b):(0<=
+(d.Left=b.Top.X,d.Right=b.Bot.X,d.Dir=f.Direction.dRightToLeft)};f.Clipper.prototype.ProcessHorizontal=function(b,d){var e={Dir:null,Left:null,Right:null};this.GetHorzDirection(b,e);for(var r=e.Dir,n=e.Left,k=e.Right,u=b,C=null;null!==u.NextInLML&&f.ClipperBase.IsHorizontal(u.NextInLML);)u=u.NextInLML;for(null===u.NextInLML&&(C=this.GetMaximaPair(u));;){for(var p=b==u,E=this.GetNextInAEL(b,r);null!==E&&!(E.Curr.X==b.Top.X&&null!==b.NextInLML&&E.Dx<b.NextInLML.Dx);){e=this.GetNextInAEL(E,r);if(r==
+f.Direction.dLeftToRight&&E.Curr.X<=k||r==f.Direction.dRightToLeft&&E.Curr.X>=n){if(E==C&&p){if(0<=b.OutIdx){r=this.AddOutPt(b,b.Top);for(e=this.m_SortedEdges;null!==e;)0<=e.OutIdx&&this.HorzSegmentsOverlap(b.Bot.X,b.Top.X,e.Bot.X,e.Top.X)&&(n=this.AddOutPt(e,e.Bot),this.AddJoin(n,r,e.Top)),e=e.NextInSEL;this.AddGhostJoin(r,b.Bot);this.AddLocalMaxPoly(b,C,b.Top)}this.DeleteFromAEL(b);this.DeleteFromAEL(C);return}if(r==f.Direction.dLeftToRight){var F=new f.IntPoint(E.Curr.X,b.Curr.Y);this.IntersectEdges(b,
+E,F)}else F=new f.IntPoint(E.Curr.X,b.Curr.Y),this.IntersectEdges(E,b,F);this.SwapPositionsInAEL(b,E)}else if(r==f.Direction.dLeftToRight&&E.Curr.X>=k||r==f.Direction.dRightToLeft&&E.Curr.X<=n)break;E=e}if(null!==b.NextInLML&&f.ClipperBase.IsHorizontal(b.NextInLML))b=this.UpdateEdgeIntoAEL(b),0<=b.OutIdx&&this.AddOutPt(b,b.Bot),e={Dir:r,Left:n,Right:k},this.GetHorzDirection(b,e),r=e.Dir,n=e.Left,k=e.Right;else break}null!==b.NextInLML?0<=b.OutIdx?(r=this.AddOutPt(b,b.Top),d&&this.AddGhostJoin(r,b.Bot),
+b=this.UpdateEdgeIntoAEL(b),0!==b.WindDelta&&(C=b.PrevInAEL,e=b.NextInAEL,null!==C&&C.Curr.X==b.Bot.X&&C.Curr.Y==b.Bot.Y&&0!==C.WindDelta&&0<=C.OutIdx&&C.Curr.Y>C.Top.Y&&f.ClipperBase.SlopesEqual(b,C,this.m_UseFullRange)?(n=this.AddOutPt(C,b.Bot),this.AddJoin(r,n,b.Top)):null!==e&&e.Curr.X==b.Bot.X&&e.Curr.Y==b.Bot.Y&&0!==e.WindDelta&&0<=e.OutIdx&&e.Curr.Y>e.Top.Y&&f.ClipperBase.SlopesEqual(b,e,this.m_UseFullRange)&&(n=this.AddOutPt(e,b.Bot),this.AddJoin(r,n,b.Top)))):this.UpdateEdgeIntoAEL(b):(0<=
b.OutIdx&&this.AddOutPt(b,b.Top),this.DeleteFromAEL(b))};f.Clipper.prototype.GetNextInAEL=function(b,d){return d==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,d){return null!==b&&b.Top.Y==d&&null===b.NextInLML};f.Clipper.prototype.IsIntermediate=function(b,d){return b.Top.Y==d&&null!==b.NextInLML};f.Clipper.prototype.GetMaximaPair=function(b){var d=null;
f.IntPoint.op_Equality(b.Next.Top,b.Top)&&null===b.Next.NextInLML?d=b.Next:f.IntPoint.op_Equality(b.Prev.Top,b.Top)&&null===b.Prev.NextInLML&&(d=b.Prev);return null===d||-2!=d.OutIdx&&(d.NextInAEL!=d.PrevInAEL||f.ClipperBase.IsHorizontal(d))?d: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(d){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 d=this.m_ActiveEdges;for(this.m_SortedEdges=d;null!==d;)d.PrevInSEL=d.PrevInAEL,d.NextInSEL=d.NextInAEL,d.Curr.X=f.Clipper.TopX(d,b),d=d.NextInAEL;for(var e=!0;e&&null!==this.m_SortedEdges;){e=!1;for(d=this.m_SortedEdges;null!==d.NextInSEL;){b=d.NextInSEL;var q=new f.IntPoint;
-d.Curr.X>b.Curr.X?(this.IntersectPoint(d,b,q),e=new f.IntersectNode,e.Edge1=d,e.Edge2=b,e.Pt.X=q.X,e.Pt.Y=q.Y,f.use_xyz&&(e.Pt.Z=q.Z),this.m_IntersectList.push(e),this.SwapPositionsInSEL(d,b),e=!0):d=b}if(null!==d.PrevInSEL)d.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,d){return d.Pt.Y-b.Pt.Y};f.Clipper.prototype.FixupIntersectionOrder=
+else return!1}catch(d){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 d=this.m_ActiveEdges;for(this.m_SortedEdges=d;null!==d;)d.PrevInSEL=d.PrevInAEL,d.NextInSEL=d.NextInAEL,d.Curr.X=f.Clipper.TopX(d,b),d=d.NextInAEL;for(var e=!0;e&&null!==this.m_SortedEdges;){e=!1;for(d=this.m_SortedEdges;null!==d.NextInSEL;){b=d.NextInSEL;var r=new f.IntPoint;
+d.Curr.X>b.Curr.X?(this.IntersectPoint(d,b,r),e=new f.IntersectNode,e.Edge1=d,e.Edge2=b,e.Pt.X=r.X,e.Pt.Y=r.Y,f.use_xyz&&(e.Pt.Z=r.Z),this.m_IntersectList.push(e),this.SwapPositionsInSEL(d,b),e=!0):d=b}if(null!==d.PrevInSEL)d.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,d){return d.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,d=0;d<b;d++){if(!this.EdgesAdjacent(this.m_IntersectList[d])){for(var e=d+1;e<b&&!this.EdgesAdjacent(this.m_IntersectList[e]);)e++;if(e==b)return!1;var f=this.m_IntersectList[d];this.m_IntersectList[d]=this.m_IntersectList[e];this.m_IntersectList[e]=f}this.SwapPositionsInSEL(this.m_IntersectList[d].Edge1,this.m_IntersectList[d].Edge2)}return!0};f.Clipper.prototype.ProcessIntersectList=
-function(){for(var b=0,d=this.m_IntersectList.length;b<d;b++){var e=this.m_IntersectList[b];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt);this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};I=function(b){return 0>b?Math.ceil(b-.5):Math.round(b)};Jb=function(b){return 0>b?Math.ceil(b-.5):Math.floor(b+.5)};Qa=function(b){return 0>b?-Math.round(Math.abs(b)):Math.round(b)};ab=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=
-Y?I:nb?Qa:Xb?ab:Jb;f.Clipper.TopX=function(b,d){return d==b.Top.Y?b.Top.X:b.Bot.X+f.Clipper.Round(b.Dx*(d-b.Bot.Y))};f.Clipper.prototype.IntersectPoint=function(b,d,e){e.X=0;e.Y=0;var q,n;if(b.Dx==d.Dx)e.Y=b.Curr.Y,e.X=f.Clipper.TopX(b,e.Y);else{if(0===b.Delta.X)e.X=b.Bot.X,f.ClipperBase.IsHorizontal(d)?e.Y=d.Bot.Y:(n=d.Bot.Y-d.Bot.X/d.Dx,e.Y=f.Clipper.Round(e.X/d.Dx+n));else if(0===d.Delta.X)e.X=d.Bot.X,f.ClipperBase.IsHorizontal(b)?e.Y=b.Bot.Y:(q=b.Bot.Y-b.Bot.X/b.Dx,e.Y=f.Clipper.Round(e.X/b.Dx+
-q));else{q=b.Bot.X-b.Bot.Y*b.Dx;n=d.Bot.X-d.Bot.Y*d.Dx;var k=(n-q)/(b.Dx-d.Dx);e.Y=f.Clipper.Round(k);e.X=Math.abs(b.Dx)<Math.abs(d.Dx)?f.Clipper.Round(b.Dx*k+q):f.Clipper.Round(d.Dx*k+n)}if(e.Y<b.Top.Y||e.Y<d.Top.Y){if(b.Top.Y>d.Top.Y)return e.Y=b.Top.Y,e.X=f.Clipper.TopX(d,b.Top.Y),e.X<b.Top.X;e.Y=d.Top.Y;e.X=Math.abs(b.Dx)<Math.abs(d.Dx)?f.Clipper.TopX(b,e.Y):f.Clipper.TopX(d,e.Y)}e.Y>b.Curr.Y&&(e.Y=b.Curr.Y,e.X=Math.abs(b.Dx)>Math.abs(d.Dx)?f.Clipper.TopX(d,e.Y):f.Clipper.TopX(b,e.Y))}};f.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=
-function(b){for(var d=this.m_ActiveEdges;null!==d;){var e=this.IsMaxima(d,b);e&&(e=this.GetMaximaPair(d),e=null===e||!f.ClipperBase.IsHorizontal(e));if(e){var q=d.PrevInAEL;this.DoMaxima(d);d=null===q?this.m_ActiveEdges:q.NextInAEL}else{this.IsIntermediate(d,b)&&f.ClipperBase.IsHorizontal(d.NextInLML)?(d=this.UpdateEdgeIntoAEL(d),0<=d.OutIdx&&this.AddOutPt(d,d.Bot),this.AddEdgeToSEL(d)):(d.Curr.X=f.Clipper.TopX(d,b),d.Curr.Y=b);if(this.StrictlySimple&&(q=d.PrevInAEL,0<=d.OutIdx&&0!==d.WindDelta&&
-null!==q&&0<=q.OutIdx&&q.Curr.X==d.Curr.X&&0!==q.WindDelta)){var n=new f.IntPoint(d.Curr);f.use_xyz&&this.SetZ(n,q,d);e=this.AddOutPt(q,n);q=this.AddOutPt(d,n);this.AddJoin(e,q,n)}d=d.NextInAEL}}this.ProcessHorizontals(!0);for(d=this.m_ActiveEdges;null!==d;)this.IsIntermediate(d,b)&&(e=null,0<=d.OutIdx&&(e=this.AddOutPt(d,d.Top)),d=this.UpdateEdgeIntoAEL(d),q=d.PrevInAEL,n=d.NextInAEL,null!==q&&q.Curr.X==d.Bot.X&&q.Curr.Y==d.Bot.Y&&null!==e&&0<=q.OutIdx&&q.Curr.Y>q.Top.Y&&f.ClipperBase.SlopesEqual(d,
-q,this.m_UseFullRange)&&0!==d.WindDelta&&0!==q.WindDelta?(q=this.AddOutPt(q,d.Bot),this.AddJoin(e,q,d.Top)):null!==n&&n.Curr.X==d.Bot.X&&n.Curr.Y==d.Bot.Y&&null!==e&&0<=n.OutIdx&&n.Curr.Y>n.Top.Y&&f.ClipperBase.SlopesEqual(d,n,this.m_UseFullRange)&&0!==d.WindDelta&&0!==n.WindDelta&&(q=this.AddOutPt(n,d.Bot),this.AddJoin(e,q,d.Top))),d=d.NextInAEL};f.Clipper.prototype.DoMaxima=function(b){var d=this.GetMaximaPair(b);if(null===d)0<=b.OutIdx&&this.AddOutPt(b,b.Top),this.DeleteFromAEL(b);else{for(var e=
+function(){for(var b=0,d=this.m_IntersectList.length;b<d;b++){var e=this.m_IntersectList[b];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt);this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};M=function(b){return 0>b?Math.ceil(b-.5):Math.round(b)};Sb=function(b){return 0>b?Math.ceil(b-.5):Math.floor(b+.5)};Ta=function(b){return 0>b?-Math.round(Math.abs(b)):Math.round(b)};fb=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=
+ba?M:tb?Ta:gc?fb:Sb;f.Clipper.TopX=function(b,d){return d==b.Top.Y?b.Top.X:b.Bot.X+f.Clipper.Round(b.Dx*(d-b.Bot.Y))};f.Clipper.prototype.IntersectPoint=function(b,d,e){e.X=0;e.Y=0;var r,n;if(b.Dx==d.Dx)e.Y=b.Curr.Y,e.X=f.Clipper.TopX(b,e.Y);else{if(0===b.Delta.X)e.X=b.Bot.X,f.ClipperBase.IsHorizontal(d)?e.Y=d.Bot.Y:(n=d.Bot.Y-d.Bot.X/d.Dx,e.Y=f.Clipper.Round(e.X/d.Dx+n));else if(0===d.Delta.X)e.X=d.Bot.X,f.ClipperBase.IsHorizontal(b)?e.Y=b.Bot.Y:(r=b.Bot.Y-b.Bot.X/b.Dx,e.Y=f.Clipper.Round(e.X/b.Dx+
+r));else{r=b.Bot.X-b.Bot.Y*b.Dx;n=d.Bot.X-d.Bot.Y*d.Dx;var k=(n-r)/(b.Dx-d.Dx);e.Y=f.Clipper.Round(k);e.X=Math.abs(b.Dx)<Math.abs(d.Dx)?f.Clipper.Round(b.Dx*k+r):f.Clipper.Round(d.Dx*k+n)}if(e.Y<b.Top.Y||e.Y<d.Top.Y){if(b.Top.Y>d.Top.Y)return e.Y=b.Top.Y,e.X=f.Clipper.TopX(d,b.Top.Y),e.X<b.Top.X;e.Y=d.Top.Y;e.X=Math.abs(b.Dx)<Math.abs(d.Dx)?f.Clipper.TopX(b,e.Y):f.Clipper.TopX(d,e.Y)}e.Y>b.Curr.Y&&(e.Y=b.Curr.Y,e.X=Math.abs(b.Dx)>Math.abs(d.Dx)?f.Clipper.TopX(d,e.Y):f.Clipper.TopX(b,e.Y))}};f.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=
+function(b){for(var d=this.m_ActiveEdges;null!==d;){var e=this.IsMaxima(d,b);e&&(e=this.GetMaximaPair(d),e=null===e||!f.ClipperBase.IsHorizontal(e));if(e){var r=d.PrevInAEL;this.DoMaxima(d);d=null===r?this.m_ActiveEdges:r.NextInAEL}else{this.IsIntermediate(d,b)&&f.ClipperBase.IsHorizontal(d.NextInLML)?(d=this.UpdateEdgeIntoAEL(d),0<=d.OutIdx&&this.AddOutPt(d,d.Bot),this.AddEdgeToSEL(d)):(d.Curr.X=f.Clipper.TopX(d,b),d.Curr.Y=b);if(this.StrictlySimple&&(r=d.PrevInAEL,0<=d.OutIdx&&0!==d.WindDelta&&
+null!==r&&0<=r.OutIdx&&r.Curr.X==d.Curr.X&&0!==r.WindDelta)){var n=new f.IntPoint(d.Curr);f.use_xyz&&this.SetZ(n,r,d);e=this.AddOutPt(r,n);r=this.AddOutPt(d,n);this.AddJoin(e,r,n)}d=d.NextInAEL}}this.ProcessHorizontals(!0);for(d=this.m_ActiveEdges;null!==d;)this.IsIntermediate(d,b)&&(e=null,0<=d.OutIdx&&(e=this.AddOutPt(d,d.Top)),d=this.UpdateEdgeIntoAEL(d),r=d.PrevInAEL,n=d.NextInAEL,null!==r&&r.Curr.X==d.Bot.X&&r.Curr.Y==d.Bot.Y&&null!==e&&0<=r.OutIdx&&r.Curr.Y>r.Top.Y&&f.ClipperBase.SlopesEqual(d,
+r,this.m_UseFullRange)&&0!==d.WindDelta&&0!==r.WindDelta?(r=this.AddOutPt(r,d.Bot),this.AddJoin(e,r,d.Top)):null!==n&&n.Curr.X==d.Bot.X&&n.Curr.Y==d.Bot.Y&&null!==e&&0<=n.OutIdx&&n.Curr.Y>n.Top.Y&&f.ClipperBase.SlopesEqual(d,n,this.m_UseFullRange)&&0!==d.WindDelta&&0!==n.WindDelta&&(r=this.AddOutPt(n,d.Bot),this.AddJoin(e,r,d.Top))),d=d.NextInAEL};f.Clipper.prototype.DoMaxima=function(b){var d=this.GetMaximaPair(b);if(null===d)0<=b.OutIdx&&this.AddOutPt(b,b.Top),this.DeleteFromAEL(b);else{for(var e=
b.NextInAEL;null!==e&&e!=d;)this.IntersectEdges(b,e,b.Top),this.SwapPositionsInAEL(b,e),e=b.NextInAEL;-1==b.OutIdx&&-1==d.OutIdx?(this.DeleteFromAEL(b),this.DeleteFromAEL(d)):0<=b.OutIdx&&0<=d.OutIdx?(0<=b.OutIdx&&this.AddLocalMaxPoly(b,d,b.Top),this.DeleteFromAEL(b),this.DeleteFromAEL(d)):f.use_lines&&0===b.WindDelta?(0<=b.OutIdx&&(this.AddOutPt(b,b.Top),b.OutIdx=-1),this.DeleteFromAEL(b),0<=d.OutIdx&&(this.AddOutPt(d,b.Top),d.OutIdx=-1),this.DeleteFromAEL(d)):f.Error("DoMaxima error")}};f.Clipper.ReversePaths=
-function(b){for(var d=0,e=b.length;d<e;d++)b[d].reverse()};f.Clipper.Orientation=function(b){return 0<=f.Clipper.Area(b)};f.Clipper.prototype.PointCount=function(b){if(null===b)return 0;var d=0,e=b;do d++,e=e.Next;while(e!=b);return d};f.Clipper.prototype.BuildResult=function(b){f.Clear(b);for(var d=0,e=this.m_PolyOuts.length;d<e;d++){var q=this.m_PolyOuts[d];if(null!==q.Pts){var q=q.Pts.Prev,n=this.PointCount(q);if(!(2>n)){for(var k=Array(n),v=0;v<n;v++)k[v]=q.Pt,q=q.Prev;b.push(k)}}}};f.Clipper.prototype.BuildResult2=
-function(b){b.Clear();for(var d=0,e=this.m_PolyOuts.length;d<e;d++){var q=this.m_PolyOuts[d],n=this.PointCount(q.Pts);if(!(q.IsOpen&&2>n||!q.IsOpen&&3>n)){this.FixHoleLinkage(q);var k=new f.PolyNode;b.m_AllPolys.push(k);q.PolyNode=k;k.m_polygon.length=n;for(var q=q.Pts.Prev,v=0;v<n;v++)k.m_polygon[v]=q.Pt,q=q.Prev}}d=0;for(e=this.m_PolyOuts.length;d<e;d++)q=this.m_PolyOuts[d],null!==q.PolyNode&&(q.IsOpen?(q.PolyNode.IsOpen=!0,b.AddChild(q.PolyNode)):null!==q.FirstLeft&&null!=q.FirstLeft.PolyNode?
-q.FirstLeft.PolyNode.AddChild(q.PolyNode):b.AddChild(q.PolyNode))};f.Clipper.prototype.FixupOutPolygon=function(b){var d=null;b.BottomPt=null;for(var e=b.Pts;;){if(e.Prev==e||e.Prev==e.Next){b.Pts=null;return}if(f.IntPoint.op_Equality(e.Pt,e.Next.Pt)||f.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||f.ClipperBase.SlopesEqual(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt)))d=null,e.Prev.Next=e.Next,e=e.Next.Prev=e.Prev;else if(e==
+function(b){for(var d=0,e=b.length;d<e;d++)b[d].reverse()};f.Clipper.Orientation=function(b){return 0<=f.Clipper.Area(b)};f.Clipper.prototype.PointCount=function(b){if(null===b)return 0;var d=0,e=b;do d++,e=e.Next;while(e!=b);return d};f.Clipper.prototype.BuildResult=function(b){f.Clear(b);for(var d=0,e=this.m_PolyOuts.length;d<e;d++){var r=this.m_PolyOuts[d];if(null!==r.Pts){var r=r.Pts.Prev,n=this.PointCount(r);if(!(2>n)){for(var k=Array(n),u=0;u<n;u++)k[u]=r.Pt,r=r.Prev;b.push(k)}}}};f.Clipper.prototype.BuildResult2=
+function(b){b.Clear();for(var d=0,e=this.m_PolyOuts.length;d<e;d++){var r=this.m_PolyOuts[d],n=this.PointCount(r.Pts);if(!(r.IsOpen&&2>n||!r.IsOpen&&3>n)){this.FixHoleLinkage(r);var k=new f.PolyNode;b.m_AllPolys.push(k);r.PolyNode=k;k.m_polygon.length=n;for(var r=r.Pts.Prev,u=0;u<n;u++)k.m_polygon[u]=r.Pt,r=r.Prev}}d=0;for(e=this.m_PolyOuts.length;d<e;d++)r=this.m_PolyOuts[d],null!==r.PolyNode&&(r.IsOpen?(r.PolyNode.IsOpen=!0,b.AddChild(r.PolyNode)):null!==r.FirstLeft&&null!=r.FirstLeft.PolyNode?
+r.FirstLeft.PolyNode.AddChild(r.PolyNode):b.AddChild(r.PolyNode))};f.Clipper.prototype.FixupOutPolygon=function(b){var d=null;b.BottomPt=null;for(var e=b.Pts;;){if(e.Prev==e||e.Prev==e.Next){b.Pts=null;return}if(f.IntPoint.op_Equality(e.Pt,e.Next.Pt)||f.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||f.ClipperBase.SlopesEqual(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt)))d=null,e.Prev.Next=e.Next,e=e.Next.Prev=e.Prev;else if(e==
d)break;else null===d&&(d=e),e=e.Next}b.Pts=e};f.Clipper.prototype.DupOutPt=function(b,d){var e=new f.OutPt;e.Pt.X=b.Pt.X;e.Pt.Y=b.Pt.Y;f.use_xyz&&(e.Pt.Z=b.Pt.Z);e.Idx=b.Idx;d?(e.Next=b.Next,e.Prev=b,b.Next.Prev=e,b.Next=e):(e.Prev=b.Prev,e.Next=b,b.Prev.Next=e,b.Prev=e);return e};f.Clipper.prototype.GetOverlap=function(b,d,e,f,n){b<d?e<f?(n.Left=Math.max(b,e),n.Right=Math.min(d,f)):(n.Left=Math.max(b,f),n.Right=Math.min(d,e)):e<f?(n.Left=Math.max(d,e),n.Right=Math.min(b,f)):(n.Left=Math.max(d,f),
-n.Right=Math.min(b,e));return n.Left<n.Right};f.Clipper.prototype.JoinHorz=function(b,d,e,q,n,k){var v=b.Pt.X>d.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;q=e.Pt.X>q.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;if(v==q)return!1;if(v==f.Direction.dLeftToRight){for(;b.Next.Pt.X<=n.X&&b.Next.Pt.X>=b.Pt.X&&b.Next.Pt.Y==n.Y;)b=b.Next;k&&b.Pt.X!=n.X&&(b=b.Next);d=this.DupOutPt(b,!k);f.IntPoint.op_Inequality(d.Pt,n)&&(b=d,b.Pt.X=n.X,b.Pt.Y=n.Y,f.use_xyz&&(b.Pt.Z=n.Z),d=this.DupOutPt(b,
-!k))}else{for(;b.Next.Pt.X>=n.X&&b.Next.Pt.X<=b.Pt.X&&b.Next.Pt.Y==n.Y;)b=b.Next;k||b.Pt.X==n.X||(b=b.Next);d=this.DupOutPt(b,k);f.IntPoint.op_Inequality(d.Pt,n)&&(b=d,b.Pt.X=n.X,b.Pt.Y=n.Y,f.use_xyz&&(b.Pt.Z=n.Z),d=this.DupOutPt(b,k))}if(q==f.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;k&&e.Pt.X!=n.X&&(e=e.Next);q=this.DupOutPt(e,!k);f.IntPoint.op_Inequality(q.Pt,n)&&(e=q,e.Pt.X=n.X,e.Pt.Y=n.Y,f.use_xyz&&(e.Pt.Z=n.Z),q=this.DupOutPt(e,!k))}else{for(;e.Next.Pt.X>=
-n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;k||e.Pt.X==n.X||(e=e.Next);q=this.DupOutPt(e,k);f.IntPoint.op_Inequality(q.Pt,n)&&(e=q,e.Pt.X=n.X,e.Pt.Y=n.Y,f.use_xyz&&(e.Pt.Z=n.Z),q=this.DupOutPt(e,k))}v==f.Direction.dLeftToRight==k?(b.Prev=e,e.Next=b,d.Next=q,q.Prev=d):(b.Next=e,e.Prev=b,d.Prev=q,q.Next=d);return!0};f.Clipper.prototype.JoinPoints=function(b,d,e){var q=b.OutPt1,n;new f.OutPt;var k=b.OutPt2,v;new f.OutPt;if((v=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(d!=e)return!1;for(n=b.OutPt1.Next;n!=q&&f.IntPoint.op_Equality(n.Pt,b.OffPt);)n=n.Next;n=n.Pt.Y>b.OffPt.Y;for(v=b.OutPt2.Next;v!=k&&f.IntPoint.op_Equality(v.Pt,b.OffPt);)v=v.Next;if(n==v.Pt.Y>b.OffPt.Y)return!1;n?(n=this.DupOutPt(q,!1),v=this.DupOutPt(k,!0),q.Prev=k,k.Next=q,n.Next=v,v.Prev=n):(n=this.DupOutPt(q,!0),v=this.DupOutPt(k,!1),q.Next=k,k.Prev=q,n.Prev=v,v.Next=n);b.OutPt1=q;b.OutPt2=n;return!0}if(v){for(n=q;q.Prev.Pt.Y==q.Pt.Y&&q.Prev!=n&&
-q.Prev!=k;)q=q.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=q&&n.Next!=k;)n=n.Next;if(n.Next==q||n.Next==k)return!1;for(v=k;k.Prev.Pt.Y==k.Pt.Y&&k.Prev!=v&&k.Prev!=n;)k=k.Prev;for(;v.Next.Pt.Y==v.Pt.Y&&v.Next!=k&&v.Next!=q;)v=v.Next;if(v.Next==k||v.Next==q)return!1;e={Left:null,Right:null};if(!this.GetOverlap(q.Pt.X,n.Pt.X,k.Pt.X,v.Pt.X,e))return!1;d=e.Left;var C=e.Right;e=new f.IntPoint;q.Pt.X>=d&&q.Pt.X<=C?(e.X=q.Pt.X,e.Y=q.Pt.Y,f.use_xyz&&(e.Z=q.Pt.Z),d=q.Pt.X>n.Pt.X):k.Pt.X>=d&&k.Pt.X<=C?(e.X=k.Pt.X,
-e.Y=k.Pt.Y,f.use_xyz&&(e.Z=k.Pt.Z),d=k.Pt.X>v.Pt.X):n.Pt.X>=d&&n.Pt.X<=C?(e.X=n.Pt.X,e.Y=n.Pt.Y,f.use_xyz&&(e.Z=n.Pt.Z),d=n.Pt.X>q.Pt.X):(e.X=v.Pt.X,e.Y=v.Pt.Y,f.use_xyz&&(e.Z=v.Pt.Z),d=v.Pt.X>k.Pt.X);b.OutPt1=q;b.OutPt2=k;return this.JoinHorz(q,n,k,v,e,d)}for(n=q.Next;f.IntPoint.op_Equality(n.Pt,q.Pt)&&n!=q;)n=n.Next;if(C=n.Pt.Y>q.Pt.Y||!f.ClipperBase.SlopesEqual(q.Pt,n.Pt,b.OffPt,this.m_UseFullRange)){for(n=q.Prev;f.IntPoint.op_Equality(n.Pt,q.Pt)&&n!=q;)n=n.Prev;if(n.Pt.Y>q.Pt.Y||!f.ClipperBase.SlopesEqual(q.Pt,
-n.Pt,b.OffPt,this.m_UseFullRange))return!1}for(v=k.Next;f.IntPoint.op_Equality(v.Pt,k.Pt)&&v!=k;)v=v.Next;var p=v.Pt.Y>k.Pt.Y||!f.ClipperBase.SlopesEqual(k.Pt,v.Pt,b.OffPt,this.m_UseFullRange);if(p){for(v=k.Prev;f.IntPoint.op_Equality(v.Pt,k.Pt)&&v!=k;)v=v.Prev;if(v.Pt.Y>k.Pt.Y||!f.ClipperBase.SlopesEqual(k.Pt,v.Pt,b.OffPt,this.m_UseFullRange))return!1}if(n==q||v==k||n==v||d==e&&C==p)return!1;C?(n=this.DupOutPt(q,!1),v=this.DupOutPt(k,!0),q.Prev=k,k.Next=q,n.Next=v,v.Prev=n):(n=this.DupOutPt(q,!0),
-v=this.DupOutPt(k,!1),q.Next=k,k.Prev=q,n.Prev=v,v.Next=n);b.OutPt1=q;b.OutPt2=n;return!0};f.Clipper.GetBounds=function(b){for(var d=0,e=b.length;d<e&&0==b[d].length;)d++;if(d==e)return new f.IntRect(0,0,0,0);var q=new f.IntRect;q.left=b[d][0].X;q.right=q.left;q.top=b[d][0].Y;for(q.bottom=q.top;d<e;d++)for(var k=0,N=b[d].length;k<N;k++)b[d][k].X<q.left?q.left=b[d][k].X:b[d][k].X>q.right&&(q.right=b[d][k].X),b[d][k].Y<q.top?q.top=b[d][k].Y:b[d][k].Y>q.bottom&&(q.bottom=b[d][k].Y);return q};f.Clipper.prototype.GetBounds2=
-function(b){var d=b,e=new f.IntRect;e.left=b.Pt.X;e.right=b.Pt.X;e.top=b.Pt.Y;e.bottom=b.Pt.Y;for(b=b.Next;b!=d;)b.Pt.X<e.left&&(e.left=b.Pt.X),b.Pt.X>e.right&&(e.right=b.Pt.X),b.Pt.Y<e.top&&(e.top=b.Pt.Y),b.Pt.Y>e.bottom&&(e.bottom=b.Pt.Y),b=b.Next;return e};f.Clipper.PointInPolygon=function(b,d){var e=0,f=d.length;if(3>f)return 0;for(var k=d[0],N=1;N<=f;++N){var v=N==f?d[0]:d[N];if(v.Y==b.Y&&(v.X==b.X||k.Y==b.Y&&v.X>b.X==k.X<b.X))return-1;if(k.Y<b.Y!=v.Y<b.Y)if(k.X>=b.X)if(v.X>b.X)e=1-e;else{var C=
-(k.X-b.X)*(v.Y-b.Y)-(v.X-b.X)*(k.Y-b.Y);if(0==C)return-1;0<C==v.Y>k.Y&&(e=1-e)}else if(v.X>b.X){C=(k.X-b.X)*(v.Y-b.Y)-(v.X-b.X)*(k.Y-b.Y);if(0==C)return-1;0<C==v.Y>k.Y&&(e=1-e)}k=v}return e};f.Clipper.prototype.PointInPolygon=function(b,d){var e=0,f=d,k=b.X,N=b.Y,v=d.Pt.X,C=d.Pt.Y;do{d=d.Next;var p=d.Pt.X,F=d.Pt.Y;if(F==N&&(p==k||C==N&&p>k==v<k))return-1;if(C<N!=F<N)if(v>=k)if(p>k)e=1-e;else{v=(v-k)*(F-N)-(p-k)*(C-N);if(0==v)return-1;0<v==F>C&&(e=1-e)}else if(p>k){v=(v-k)*(F-N)-(p-k)*(C-N);if(0==
-v)return-1;0<v==F>C&&(e=1-e)}v=p;C=F}while(f!=d);return e};f.Clipper.prototype.Poly2ContainsPoly1=function(b,d){var e=b;do{var f=this.PointInPolygon(e.Pt,d);if(0<=f)return 0<f;e=e.Next}while(e!=b);return!0};f.Clipper.prototype.FixupFirstLefts1=function(b,d){for(var e=0,f=this.m_PolyOuts.length;e<f;e++){var k=this.m_PolyOuts[e];null!=k.Pts&&null!=k.FirstLeft&&this.ParseFirstLeft(k.FirstLeft)==b&&this.Poly2ContainsPoly1(k.Pts,d.Pts)&&(k.FirstLeft=d)}};f.Clipper.prototype.FixupFirstLefts2=function(b,
+n.Right=Math.min(b,e));return n.Left<n.Right};f.Clipper.prototype.JoinHorz=function(b,d,e,r,n,k){var u=b.Pt.X>d.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;r=e.Pt.X>r.Pt.X?f.Direction.dRightToLeft:f.Direction.dLeftToRight;if(u==r)return!1;if(u==f.Direction.dLeftToRight){for(;b.Next.Pt.X<=n.X&&b.Next.Pt.X>=b.Pt.X&&b.Next.Pt.Y==n.Y;)b=b.Next;k&&b.Pt.X!=n.X&&(b=b.Next);d=this.DupOutPt(b,!k);f.IntPoint.op_Inequality(d.Pt,n)&&(b=d,b.Pt.X=n.X,b.Pt.Y=n.Y,f.use_xyz&&(b.Pt.Z=n.Z),d=this.DupOutPt(b,
+!k))}else{for(;b.Next.Pt.X>=n.X&&b.Next.Pt.X<=b.Pt.X&&b.Next.Pt.Y==n.Y;)b=b.Next;k||b.Pt.X==n.X||(b=b.Next);d=this.DupOutPt(b,k);f.IntPoint.op_Inequality(d.Pt,n)&&(b=d,b.Pt.X=n.X,b.Pt.Y=n.Y,f.use_xyz&&(b.Pt.Z=n.Z),d=this.DupOutPt(b,k))}if(r==f.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;k&&e.Pt.X!=n.X&&(e=e.Next);r=this.DupOutPt(e,!k);f.IntPoint.op_Inequality(r.Pt,n)&&(e=r,e.Pt.X=n.X,e.Pt.Y=n.Y,f.use_xyz&&(e.Pt.Z=n.Z),r=this.DupOutPt(e,!k))}else{for(;e.Next.Pt.X>=
+n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;k||e.Pt.X==n.X||(e=e.Next);r=this.DupOutPt(e,k);f.IntPoint.op_Inequality(r.Pt,n)&&(e=r,e.Pt.X=n.X,e.Pt.Y=n.Y,f.use_xyz&&(e.Pt.Z=n.Z),r=this.DupOutPt(e,k))}u==f.Direction.dLeftToRight==k?(b.Prev=e,e.Next=b,d.Next=r,r.Prev=d):(b.Next=e,e.Prev=b,d.Prev=r,r.Next=d);return!0};f.Clipper.prototype.JoinPoints=function(b,d,e){var r=b.OutPt1,n;new f.OutPt;var k=b.OutPt2,u;new f.OutPt;if((u=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(d!=e)return!1;for(n=b.OutPt1.Next;n!=r&&f.IntPoint.op_Equality(n.Pt,b.OffPt);)n=n.Next;n=n.Pt.Y>b.OffPt.Y;for(u=b.OutPt2.Next;u!=k&&f.IntPoint.op_Equality(u.Pt,b.OffPt);)u=u.Next;if(n==u.Pt.Y>b.OffPt.Y)return!1;n?(n=this.DupOutPt(r,!1),u=this.DupOutPt(k,!0),r.Prev=k,k.Next=r,n.Next=u,u.Prev=n):(n=this.DupOutPt(r,!0),u=this.DupOutPt(k,!1),r.Next=k,k.Prev=r,n.Prev=u,u.Next=n);b.OutPt1=r;b.OutPt2=n;return!0}if(u){for(n=r;r.Prev.Pt.Y==r.Pt.Y&&r.Prev!=n&&
+r.Prev!=k;)r=r.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=r&&n.Next!=k;)n=n.Next;if(n.Next==r||n.Next==k)return!1;for(u=k;k.Prev.Pt.Y==k.Pt.Y&&k.Prev!=u&&k.Prev!=n;)k=k.Prev;for(;u.Next.Pt.Y==u.Pt.Y&&u.Next!=k&&u.Next!=r;)u=u.Next;if(u.Next==k||u.Next==r)return!1;e={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,n.Pt.X,k.Pt.X,u.Pt.X,e))return!1;d=e.Left;var C=e.Right;e=new f.IntPoint;r.Pt.X>=d&&r.Pt.X<=C?(e.X=r.Pt.X,e.Y=r.Pt.Y,f.use_xyz&&(e.Z=r.Pt.Z),d=r.Pt.X>n.Pt.X):k.Pt.X>=d&&k.Pt.X<=C?(e.X=k.Pt.X,
+e.Y=k.Pt.Y,f.use_xyz&&(e.Z=k.Pt.Z),d=k.Pt.X>u.Pt.X):n.Pt.X>=d&&n.Pt.X<=C?(e.X=n.Pt.X,e.Y=n.Pt.Y,f.use_xyz&&(e.Z=n.Pt.Z),d=n.Pt.X>r.Pt.X):(e.X=u.Pt.X,e.Y=u.Pt.Y,f.use_xyz&&(e.Z=u.Pt.Z),d=u.Pt.X>k.Pt.X);b.OutPt1=r;b.OutPt2=k;return this.JoinHorz(r,n,k,u,e,d)}for(n=r.Next;f.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Next;if(C=n.Pt.Y>r.Pt.Y||!f.ClipperBase.SlopesEqual(r.Pt,n.Pt,b.OffPt,this.m_UseFullRange)){for(n=r.Prev;f.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Prev;if(n.Pt.Y>r.Pt.Y||!f.ClipperBase.SlopesEqual(r.Pt,
+n.Pt,b.OffPt,this.m_UseFullRange))return!1}for(u=k.Next;f.IntPoint.op_Equality(u.Pt,k.Pt)&&u!=k;)u=u.Next;var p=u.Pt.Y>k.Pt.Y||!f.ClipperBase.SlopesEqual(k.Pt,u.Pt,b.OffPt,this.m_UseFullRange);if(p){for(u=k.Prev;f.IntPoint.op_Equality(u.Pt,k.Pt)&&u!=k;)u=u.Prev;if(u.Pt.Y>k.Pt.Y||!f.ClipperBase.SlopesEqual(k.Pt,u.Pt,b.OffPt,this.m_UseFullRange))return!1}if(n==r||u==k||n==u||d==e&&C==p)return!1;C?(n=this.DupOutPt(r,!1),u=this.DupOutPt(k,!0),r.Prev=k,k.Next=r,n.Next=u,u.Prev=n):(n=this.DupOutPt(r,!0),
+u=this.DupOutPt(k,!1),r.Next=k,k.Prev=r,n.Prev=u,u.Next=n);b.OutPt1=r;b.OutPt2=n;return!0};f.Clipper.GetBounds=function(b){for(var d=0,e=b.length;d<e&&0==b[d].length;)d++;if(d==e)return new f.IntRect(0,0,0,0);var r=new f.IntRect;r.left=b[d][0].X;r.right=r.left;r.top=b[d][0].Y;for(r.bottom=r.top;d<e;d++)for(var k=0,I=b[d].length;k<I;k++)b[d][k].X<r.left?r.left=b[d][k].X:b[d][k].X>r.right&&(r.right=b[d][k].X),b[d][k].Y<r.top?r.top=b[d][k].Y:b[d][k].Y>r.bottom&&(r.bottom=b[d][k].Y);return r};f.Clipper.prototype.GetBounds2=
+function(b){var d=b,e=new f.IntRect;e.left=b.Pt.X;e.right=b.Pt.X;e.top=b.Pt.Y;e.bottom=b.Pt.Y;for(b=b.Next;b!=d;)b.Pt.X<e.left&&(e.left=b.Pt.X),b.Pt.X>e.right&&(e.right=b.Pt.X),b.Pt.Y<e.top&&(e.top=b.Pt.Y),b.Pt.Y>e.bottom&&(e.bottom=b.Pt.Y),b=b.Next;return e};f.Clipper.PointInPolygon=function(b,d){var e=0,f=d.length;if(3>f)return 0;for(var k=d[0],I=1;I<=f;++I){var u=I==f?d[0]:d[I];if(u.Y==b.Y&&(u.X==b.X||k.Y==b.Y&&u.X>b.X==k.X<b.X))return-1;if(k.Y<b.Y!=u.Y<b.Y)if(k.X>=b.X)if(u.X>b.X)e=1-e;else{var C=
+(k.X-b.X)*(u.Y-b.Y)-(u.X-b.X)*(k.Y-b.Y);if(0==C)return-1;0<C==u.Y>k.Y&&(e=1-e)}else if(u.X>b.X){C=(k.X-b.X)*(u.Y-b.Y)-(u.X-b.X)*(k.Y-b.Y);if(0==C)return-1;0<C==u.Y>k.Y&&(e=1-e)}k=u}return e};f.Clipper.prototype.PointInPolygon=function(b,d){var e=0,f=d,k=b.X,I=b.Y,u=d.Pt.X,C=d.Pt.Y;do{d=d.Next;var p=d.Pt.X,E=d.Pt.Y;if(E==I&&(p==k||C==I&&p>k==u<k))return-1;if(C<I!=E<I)if(u>=k)if(p>k)e=1-e;else{u=(u-k)*(E-I)-(p-k)*(C-I);if(0==u)return-1;0<u==E>C&&(e=1-e)}else if(p>k){u=(u-k)*(E-I)-(p-k)*(C-I);if(0==
+u)return-1;0<u==E>C&&(e=1-e)}u=p;C=E}while(f!=d);return e};f.Clipper.prototype.Poly2ContainsPoly1=function(b,d){var e=b;do{var f=this.PointInPolygon(e.Pt,d);if(0<=f)return 0<f;e=e.Next}while(e!=b);return!0};f.Clipper.prototype.FixupFirstLefts1=function(b,d){for(var e=0,f=this.m_PolyOuts.length;e<f;e++){var k=this.m_PolyOuts[e];null!=k.Pts&&null!=k.FirstLeft&&this.ParseFirstLeft(k.FirstLeft)==b&&this.Poly2ContainsPoly1(k.Pts,d.Pts)&&(k.FirstLeft=d)}};f.Clipper.prototype.FixupFirstLefts2=function(b,
d){for(var e=0,f=this.m_PolyOuts,k=f.length,p=f[e];e<k;e++,p=f[e])p.FirstLeft==b&&(p.FirstLeft=d)};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,d=this.m_Joins.length;b<d;b++){var e=this.m_Joins[b],k=this.GetOutRec(e.OutPt1.Idx),n=this.GetOutRec(e.OutPt2.Idx);if(null!=k.Pts&&null!=n.Pts){var p;p=k==n?k:this.Param1RightOfParam2(k,n)?n:this.Param1RightOfParam2(n,k)?k:this.GetLowermostRec(k,n);if(this.JoinPoints(e,
-k,n))if(k==n){k.Pts=e.OutPt1;k.BottomPt=null;n=this.CreateOutRec();n.Pts=e.OutPt2;this.UpdateOutPtIdxs(n);if(this.m_UsingPolyTree){p=0;for(var v=this.m_PolyOuts.length;p<v-1;p++){var C=this.m_PolyOuts[p];null!=C.Pts&&f.Clipper.ParseFirstLeft(C.FirstLeft)==k&&C.IsHole!=k.IsHole&&this.Poly2ContainsPoly1(C.Pts,e.OutPt2)&&(C.FirstLeft=n)}}this.Poly2ContainsPoly1(n.Pts,k.Pts)?(n.IsHole=!k.IsHole,n.FirstLeft=k,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,k),(n.IsHole^this.ReverseSolution)==0<this.Area(n)&&
+k,n))if(k==n){k.Pts=e.OutPt1;k.BottomPt=null;n=this.CreateOutRec();n.Pts=e.OutPt2;this.UpdateOutPtIdxs(n);if(this.m_UsingPolyTree){p=0;for(var u=this.m_PolyOuts.length;p<u-1;p++){var C=this.m_PolyOuts[p];null!=C.Pts&&f.Clipper.ParseFirstLeft(C.FirstLeft)==k&&C.IsHole!=k.IsHole&&this.Poly2ContainsPoly1(C.Pts,e.OutPt2)&&(C.FirstLeft=n)}}this.Poly2ContainsPoly1(n.Pts,k.Pts)?(n.IsHole=!k.IsHole,n.FirstLeft=k,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,k),(n.IsHole^this.ReverseSolution)==0<this.Area(n)&&
this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(k.Pts,n.Pts)?(n.IsHole=k.IsHole,k.IsHole=!n.IsHole,n.FirstLeft=k.FirstLeft,k.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(k,n),(k.IsHole^this.ReverseSolution)==0<this.Area(k)&&this.ReversePolyPtLinks(k.Pts)):(n.IsHole=k.IsHole,n.FirstLeft=k.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(k,n))}else n.Pts=null,n.BottomPt=null,n.Idx=k.Idx,k.IsHole=p.IsHole,p==n&&(k.FirstLeft=n.FirstLeft),n.FirstLeft=k,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,
k)}}};f.Clipper.prototype.UpdateOutPtIdxs=function(b){var d=b.Pts;do d.Idx=b.Idx,d=d.Prev;while(d!=b.Pts)};f.Clipper.prototype.DoSimplePolygons=function(){for(var b=0;b<this.m_PolyOuts.length;){var d=this.m_PolyOuts[b++],e=d.Pts;if(null!=e&&!d.IsOpen){do{for(var k=e.Next;k!=d.Pts;){if(f.IntPoint.op_Equality(e.Pt,k.Pt)&&k.Next!=e&&k.Prev!=e){var n=e.Prev,p=k.Prev;e.Prev=p;p.Next=e;k.Prev=n;n.Next=k;d.Pts=e;n=this.CreateOutRec();n.Pts=k;this.UpdateOutPtIdxs(n);this.Poly2ContainsPoly1(n.Pts,d.Pts)?(n.IsHole=
!d.IsHole,n.FirstLeft=d,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,d)):this.Poly2ContainsPoly1(d.Pts,n.Pts)?(n.IsHole=d.IsHole,d.IsHole=!n.IsHole,n.FirstLeft=d.FirstLeft,d.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(d,n)):(n.IsHole=d.IsHole,n.FirstLeft=d.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(d,n));k=e}k=k.Next}e=e.Next}while(e!=d.Pts)}}};f.Clipper.Area=function(b){var d=b.length;if(3>d)return 0;for(var e=0,f=0,k=d-1;f<d;++f)e+=(b[k].X+b[f].X)*(b[k].Y-b[f].Y),k=f;return.5*
@@ -161,22 +161,22 @@ k)}}};f.Clipper.prototype.UpdateOutPtIdxs=function(b){var d=b.Pts;do d.Idx=b.Idx
!0);k.Execute(f.ClipType.ctUnion,e,d,d);return e};f.Clipper.DistanceSqrd=function(b,d){var e=b.X-d.X,f=b.Y-d.Y;return e*e+f*f};f.Clipper.DistanceFromLineSqrd=function(b,d,e){var f=d.Y-e.Y;e=e.X-d.X;d=f*d.X+e*d.Y;d=f*b.X+e*b.Y-d;return d*d/(f*f+e*e)};f.Clipper.SlopesNearCollinear=function(b,d,e,k){return Math.abs(b.X-d.X)>Math.abs(b.Y-d.Y)?b.X>d.X==b.X<e.X?f.Clipper.DistanceFromLineSqrd(b,d,e)<k:d.X>b.X==d.X<e.X?f.Clipper.DistanceFromLineSqrd(d,b,e)<k:f.Clipper.DistanceFromLineSqrd(e,b,d)<k:b.Y>d.Y==
b.Y<e.Y?f.Clipper.DistanceFromLineSqrd(b,d,e)<k:d.Y>b.Y==d.Y<e.Y?f.Clipper.DistanceFromLineSqrd(d,b,e)<k:f.Clipper.DistanceFromLineSqrd(e,b,d)<k};f.Clipper.PointsAreClose=function(b,d,e){var f=b.X-d.X;b=b.Y-d.Y;return f*f+b*b<=e};f.Clipper.ExcludeOp=function(b){var d=b.Prev;d.Next=b.Next;b.Next.Prev=d;d.Idx=0;return d};f.Clipper.CleanPolygon=function(b,d){"undefined"==typeof d&&(d=1.415);var e=b.length;if(0==e)return[];for(var k=Array(e),n=0;n<e;++n)k[n]=new f.OutPt;for(n=0;n<e;++n)k[n].Pt=b[n],k[n].Next=
k[(n+1)%e],k[n].Next.Prev=k[n],k[n].Idx=0;n=d*d;for(k=k[0];0==k.Idx&&k.Next!=k.Prev;)f.Clipper.PointsAreClose(k.Pt,k.Prev.Pt,n)?(k=f.Clipper.ExcludeOp(k),e--):f.Clipper.PointsAreClose(k.Prev.Pt,k.Next.Pt,n)?(f.Clipper.ExcludeOp(k.Next),k=f.Clipper.ExcludeOp(k),e-=2):f.Clipper.SlopesNearCollinear(k.Prev.Pt,k.Pt,k.Next.Pt,n)?(k=f.Clipper.ExcludeOp(k),e--):(k.Idx=1,k=k.Next);3>e&&(e=0);for(var p=Array(e),n=0;n<e;++n)p[n]=new f.IntPoint(k.Pt),k=k.Next;return p};f.Clipper.CleanPolygons=function(b,d){for(var e=
-Array(b.length),k=0,n=b.length;k<n;k++)e[k]=f.Clipper.CleanPolygon(b[k],d);return e};f.Clipper.Minkowski=function(b,d,e,k){k=k?1:0;var n=b.length,p=d.length,v=[];if(e)for(e=0;e<p;e++){for(var C=Array(n),F=0,E=b.length,H=b[F];F<E;F++,H=b[F])C[F]=new f.IntPoint(d[e].X+H.X,d[e].Y+H.Y);v.push(C)}else for(e=0;e<p;e++){C=Array(n);F=0;E=b.length;for(H=b[F];F<E;F++,H=b[F])C[F]=new f.IntPoint(d[e].X-H.X,d[e].Y-H.Y);v.push(C)}b=[];for(e=0;e<p-1+k;e++)for(F=0;F<n;F++)d=[],d.push(v[e%p][F%n]),d.push(v[(e+1)%
-p][F%n]),d.push(v[(e+1)%p][(F+1)%n]),d.push(v[e%p][(F+1)%n]),f.Clipper.Orientation(d)||d.reverse(),b.push(d);return b};f.Clipper.MinkowskiSum=function(b,d,e){if(d[0]instanceof Array){v=d;d=new f.Paths;for(var k=new f.Clipper,n=0;n<v.length;++n){var p=f.Clipper.Minkowski(b,v[n],!0,e);k.AddPaths(p,f.PolyType.ptSubject,!0);e&&(p=f.Clipper.TranslatePath(v[n],b[0]),k.AddPath(p,f.PolyType.ptClip,!0))}k.Execute(f.ClipType.ctUnion,d,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return d}var v=f.Clipper.Minkowski(b,
-d,!0,e),k=new f.Clipper;k.AddPaths(v,f.PolyType.ptSubject,!0);k.Execute(f.ClipType.ctUnion,v,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return v};f.Clipper.TranslatePath=function(b,d){for(var e=new f.Path,k=0;k<b.length;k++)e.push(new f.IntPoint(b[k].X+d.X,b[k].Y+d.Y));return e};f.Clipper.MinkowskiDiff=function(b,d){var e=f.Clipper.Minkowski(b,d,!1,!0),k=new f.Clipper;k.AddPaths(e,f.PolyType.ptSubject,!0);k.Execute(f.ClipType.ctUnion,e,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);
+Array(b.length),k=0,n=b.length;k<n;k++)e[k]=f.Clipper.CleanPolygon(b[k],d);return e};f.Clipper.Minkowski=function(b,d,e,k){k=k?1:0;var n=b.length,p=d.length,u=[];if(e)for(e=0;e<p;e++){for(var C=Array(n),E=0,F=b.length,H=b[E];E<F;E++,H=b[E])C[E]=new f.IntPoint(d[e].X+H.X,d[e].Y+H.Y);u.push(C)}else for(e=0;e<p;e++){C=Array(n);E=0;F=b.length;for(H=b[E];E<F;E++,H=b[E])C[E]=new f.IntPoint(d[e].X-H.X,d[e].Y-H.Y);u.push(C)}b=[];for(e=0;e<p-1+k;e++)for(E=0;E<n;E++)d=[],d.push(u[e%p][E%n]),d.push(u[(e+1)%
+p][E%n]),d.push(u[(e+1)%p][(E+1)%n]),d.push(u[e%p][(E+1)%n]),f.Clipper.Orientation(d)||d.reverse(),b.push(d);return b};f.Clipper.MinkowskiSum=function(b,d,e){if(d[0]instanceof Array){u=d;d=new f.Paths;for(var k=new f.Clipper,n=0;n<u.length;++n){var p=f.Clipper.Minkowski(b,u[n],!0,e);k.AddPaths(p,f.PolyType.ptSubject,!0);e&&(p=f.Clipper.TranslatePath(u[n],b[0]),k.AddPath(p,f.PolyType.ptClip,!0))}k.Execute(f.ClipType.ctUnion,d,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return d}var u=f.Clipper.Minkowski(b,
+d,!0,e),k=new f.Clipper;k.AddPaths(u,f.PolyType.ptSubject,!0);k.Execute(f.ClipType.ctUnion,u,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);return u};f.Clipper.TranslatePath=function(b,d){for(var e=new f.Path,k=0;k<b.length;k++)e.push(new f.IntPoint(b[k].X+d.X,b[k].Y+d.Y));return e};f.Clipper.MinkowskiDiff=function(b,d){var e=f.Clipper.Minkowski(b,d,!1,!0),k=new f.Clipper;k.AddPaths(e,f.PolyType.ptSubject,!0);k.Execute(f.ClipType.ctUnion,e,f.PolyFillType.pftNonZero,f.PolyFillType.pftNonZero);
return e};f.Clipper.PolyTreeToPaths=function(b){var d=[];f.Clipper.AddPolyNodeToPaths(b,f.Clipper.NodeType.ntAny,d);return d};f.Clipper.AddPolyNodeToPaths=function(b,d,e){var k=!0;switch(d){case f.Clipper.NodeType.ntOpen:return;case f.Clipper.NodeType.ntClosed:k=!b.IsOpen}0<b.m_polygon.length&&k&&e.push(b.m_polygon);k=0;b=b.Childs();for(var n=b.length,p=b[k];k<n;k++,p=b[k])f.Clipper.AddPolyNodeToPaths(p,d,e)};f.Clipper.OpenPathsFromPolyTree=function(b){for(var d=new f.Paths,e=0,k=b.ChildCount();e<
-k;e++)b.Childs()[e].IsOpen&&d.push(b.Childs()[e].m_polygon);return d};f.Clipper.ClosedPathsFromPolyTree=function(b){var d=new f.Paths;f.Clipper.AddPolyNodeToPaths(b,f.Clipper.NodeType.ntClosed,d);return d};V(f.Clipper,f.ClipperBase);f.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};f.ClipperOffset=function(b,d){"undefined"==typeof b&&(b=2);"undefined"==typeof d&&(d=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=[];
+k;e++)b.Childs()[e].IsOpen&&d.push(b.Childs()[e].m_polygon);return d};f.Clipper.ClosedPathsFromPolyTree=function(b){var d=new f.Paths;f.Clipper.AddPolyNodeToPaths(b,f.Clipper.NodeType.ntClosed,d);return d};Y(f.Clipper,f.ClipperBase);f.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};f.ClipperOffset=function(b,d){"undefined"==typeof b&&(b=2);"undefined"==typeof d&&(d=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=d;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,d,e){var k=b.length-1;if(!(0>k)){var n=
-new f.PolyNode;n.m_jointype=d;n.m_endtype=e;if(e==f.EndType.etClosedLine||e==f.EndType.etClosedPolygon)for(;0<k&&f.IntPoint.op_Equality(b[0],b[k]);)k--;n.m_polygon.push(b[0]);var p=0;d=0;for(var v=1;v<=k;v++)f.IntPoint.op_Inequality(n.m_polygon[p],b[v])&&(p++,n.m_polygon.push(b[v]),b[v].Y>n.m_polygon[d].Y||b[v].Y==n.m_polygon[d].Y&&b[v].X<n.m_polygon[d].X)&&(d=p);if(!(e==f.EndType.etClosedPolygon&&2>p)&&(this.m_polyNodes.AddChild(n),e==f.EndType.etClosedPolygon))if(0>this.m_lowest.X)this.m_lowest=
+new f.PolyNode;n.m_jointype=d;n.m_endtype=e;if(e==f.EndType.etClosedLine||e==f.EndType.etClosedPolygon)for(;0<k&&f.IntPoint.op_Equality(b[0],b[k]);)k--;n.m_polygon.push(b[0]);var p=0;d=0;for(var u=1;u<=k;u++)f.IntPoint.op_Inequality(n.m_polygon[p],b[u])&&(p++,n.m_polygon.push(b[u]),b[u].Y>n.m_polygon[d].Y||b[u].Y==n.m_polygon[d].Y&&b[u].X<n.m_polygon[d].X)&&(d=p);if(!(e==f.EndType.etClosedPolygon&&2>p)&&(this.m_polyNodes.AddChild(n),e==f.EndType.etClosedPolygon))if(0>this.m_lowest.X)this.m_lowest=
new f.IntPoint(this.m_polyNodes.ChildCount()-1,d);else if(b=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y],n.m_polygon[d].Y>b.Y||n.m_polygon[d].Y==b.Y&&n.m_polygon[d].X<b.X)this.m_lowest=new f.IntPoint(this.m_polyNodes.ChildCount()-1,d)}};f.ClipperOffset.prototype.AddPaths=function(b,d,e){for(var f=0,k=b.length;f<k;f++)this.AddPath(b[f],d,e)};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 d=this.m_polyNodes.Childs()[b];(d.m_endtype==f.EndType.etClosedPolygon||d.m_endtype==f.EndType.etClosedLine&&f.Clipper.Orientation(d.m_polygon))&&d.m_polygon.reverse()}else for(b=0;b<this.m_polyNodes.ChildCount();b++)d=this.m_polyNodes.Childs()[b],d.m_endtype!=f.EndType.etClosedLine||f.Clipper.Orientation(d.m_polygon)||d.m_polygon.reverse()};f.ClipperOffset.GetUnitNormal=function(b,d){var e=d.X-b.X,k=d.Y-b.Y;if(0==e&&0==k)return new f.DoublePoint(0,0);var n=
1/Math.sqrt(e*e+k*k);return new f.DoublePoint(k*n,-(e*n))};f.ClipperOffset.prototype.DoOffset=function(b){this.m_destPolys=[];this.m_delta=b;if(f.ClipperBase.near_zero(b))for(var d=0;d<this.m_polyNodes.ChildCount();d++){var e=this.m_polyNodes.Childs()[d];e.m_endtype==f.EndType.etClosedPolygon&&this.m_destPolys.push(e.m_polygon)}else{this.m_miterLim=2<this.MiterLimit?2/(this.MiterLimit*this.MiterLimit):.5;var k=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/k);this.m_cos=Math.cos(f.ClipperOffset.two_pi/k);this.m_StepsPerRad=k/f.ClipperOffset.two_pi;0>b&&(this.m_sin=-this.m_sin);for(d=0;d<this.m_polyNodes.ChildCount();d++){e=this.m_polyNodes.Childs()[d];this.m_srcPoly=e.m_polygon;var n=this.m_srcPoly.length;if(!(0==n||0>=b&&(3>n||e.m_endtype!=f.EndType.etClosedPolygon))){this.m_destPoly=
-[];if(1==n)if(e.m_jointype==f.JoinType.jtRound)for(var e=1,n=0,p=1;p<=k;p++){this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+e*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b)));var v=e,e=e*this.m_cos-this.m_sin*n,n=v*this.m_sin+n*this.m_cos}else for(n=e=-1,p=0;4>p;++p)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+e*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b))),0>e?e=1:0>n?n=1:e=-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]));e.m_endtype==f.EndType.etClosedLine||e.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(e.m_endtype==f.EndType.etClosedPolygon)for(v=n-1,p=0;p<n;p++)v=this.OffsetPoint(p,v,e.m_jointype);else if(e.m_endtype==f.EndType.etClosedLine){v=n-1;for(p=0;p<n;p++)v=this.OffsetPoint(p,v,e.m_jointype);this.m_destPolys.push(this.m_destPoly);this.m_destPoly=
-[];v=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(-v.X,-v.Y);v=0;for(p=n-1;0<=p;p--)v=this.OffsetPoint(p,v,e.m_jointype)}else{v=0;for(p=1;p<n-1;++p)v=this.OffsetPoint(p,v,e.m_jointype);e.m_endtype==f.EndType.etOpenButt?(p=n-1,v=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(v),
-v=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(v)):(p=n-1,v=n-2,this.m_sinA=0,this.m_normals[p]=new f.DoublePoint(-this.m_normals[p].X,-this.m_normals[p].Y),e.m_endtype==f.EndType.etOpenSquare?this.DoSquare(p,v):this.DoRound(p,v));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);v=n-1;for(p=v-1;0<p;--p)v=this.OffsetPoint(p,v,e.m_jointype);e.m_endtype==f.EndType.etOpenButt?(v=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(v),v=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(v)):(this.m_sinA=0,e.m_endtype==f.EndType.etOpenSquare?
+[];if(1==n)if(e.m_jointype==f.JoinType.jtRound)for(var e=1,n=0,p=1;p<=k;p++){this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+e*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b)));var u=e,e=e*this.m_cos-this.m_sin*n,n=u*this.m_sin+n*this.m_cos}else for(n=e=-1,p=0;4>p;++p)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[0].X+e*b),f.ClipperOffset.Round(this.m_srcPoly[0].Y+n*b))),0>e?e=1:0>n?n=1:e=-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]));e.m_endtype==f.EndType.etClosedLine||e.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(e.m_endtype==f.EndType.etClosedPolygon)for(u=n-1,p=0;p<n;p++)u=this.OffsetPoint(p,u,e.m_jointype);else if(e.m_endtype==f.EndType.etClosedLine){u=n-1;for(p=0;p<n;p++)u=this.OffsetPoint(p,u,e.m_jointype);this.m_destPolys.push(this.m_destPoly);this.m_destPoly=
+[];u=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(-u.X,-u.Y);u=0;for(p=n-1;0<=p;p--)u=this.OffsetPoint(p,u,e.m_jointype)}else{u=0;for(p=1;p<n-1;++p)u=this.OffsetPoint(p,u,e.m_jointype);e.m_endtype==f.EndType.etOpenButt?(p=n-1,u=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(u),
+u=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(u)):(p=n-1,u=n-2,this.m_sinA=0,this.m_normals[p]=new f.DoublePoint(-this.m_normals[p].X,-this.m_normals[p].Y),e.m_endtype==f.EndType.etOpenSquare?this.DoSquare(p,u):this.DoRound(p,u));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);u=n-1;for(p=u-1;0<p;--p)u=this.OffsetPoint(p,u,e.m_jointype);e.m_endtype==f.EndType.etOpenButt?(u=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(u),u=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(u)):(this.m_sinA=0,e.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(d=b[0],e=b[1],d.Clear(),this.FixOrientations(),this.DoOffset(e),b=new f.Clipper(0),b.AddPaths(this.m_destPolys,f.PolyType.ptSubject,!0),0<e)b.Execute(f.ClipType.ctUnion,d,f.PolyFillType.pftPositive,f.PolyFillType.pftPositive);else if(e=f.Clipper.GetBounds(this.m_destPolys),k=new f.Path,k.push(new f.IntPoint(e.left-10,e.bottom+
10)),k.push(new f.IntPoint(e.right+10,e.bottom+10)),k.push(new f.IntPoint(e.right+10,e.top-10)),k.push(new f.IntPoint(e.left-10,e.top-10)),b.AddPath(k,f.PolyType.ptSubject,!0),b.ReverseSolution=!0,b.Execute(f.ClipType.ctUnion,d,f.PolyFillType.pftNegative,f.PolyFillType.pftNegative),1==d.ChildCount()&&0<d.Childs()[0].ChildCount())for(b=d.Childs()[0],d.Childs()[0]=b.Childs()[0],d.Childs()[0].m_Parent=d,e=1;e<b.ChildCount();e++)d.AddChild(b.Childs()[e]);else d.Clear();else{var d=b[0],e=b[1];f.Clear(d);
this.FixOrientations();this.DoOffset(e);b=new f.Clipper(0);b.AddPaths(this.m_destPolys,f.PolyType.ptSubject,!0);if(0<e)b.Execute(f.ClipType.ctUnion,d,f.PolyFillType.pftPositive,f.PolyFillType.pftPositive);else{var e=f.Clipper.GetBounds(this.m_destPolys),k=new f.Path;k.push(new f.IntPoint(e.left-10,e.bottom+10));k.push(new f.IntPoint(e.right+10,e.bottom+10));k.push(new f.IntPoint(e.right+10,e.top-10));k.push(new f.IntPoint(e.left-10,e.top-10));b.AddPath(k,f.PolyType.ptSubject,!0);b.ReverseSolution=
@@ -185,597 +185,625 @@ f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[d].Y*this.m_delta))),d}
this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_normals[b].Y*this.m_delta)));else switch(e){case f.JoinType.jtMiter:e=1+(this.m_normals[b].X*this.m_normals[d].X+this.m_normals[b].Y*this.m_normals[d].Y);e>=this.m_miterLim?this.DoMiter(b,d,e):this.DoSquare(b,d);break;case f.JoinType.jtSquare:this.DoSquare(b,d);break;case f.JoinType.jtRound:this.DoRound(b,d)}return b};f.ClipperOffset.prototype.DoSquare=function(b,d){var e=Math.tan(Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[b].X+
this.m_normals[d].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[d].X-this.m_normals[d].Y*e)),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_delta*(this.m_normals[d].Y+this.m_normals[d].X*e))));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*e)),f.ClipperOffset.Round(this.m_srcPoly[b].Y+this.m_delta*(this.m_normals[b].Y-this.m_normals[b].X*
e))))};f.ClipperOffset.prototype.DoMiter=function(b,d,e){e=this.m_delta/e;this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+(this.m_normals[d].X+this.m_normals[b].X)*e),f.ClipperOffset.Round(this.m_srcPoly[b].Y+(this.m_normals[d].Y+this.m_normals[b].Y)*e)))};f.ClipperOffset.prototype.DoRound=function(b,d){for(var e=Math.max(f.Cast_Int32(f.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[b].X+this.m_normals[d].Y*this.m_normals[b].Y)))),
-1),k=this.m_normals[d].X,n=this.m_normals[d].Y,p,v=0;v<e;++v)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+k*this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+n*this.m_delta))),p=k,k=k*this.m_cos-this.m_sin*n,n=p*this.m_sin+n*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);
+1),k=this.m_normals[d].X,n=this.m_normals[d].Y,p,u=0;u<e;++u)this.m_destPoly.push(new f.IntPoint(f.ClipperOffset.Round(this.m_srcPoly[b].X+k*this.m_delta),f.ClipperOffset.Round(this.m_srcPoly[b].Y+n*this.m_delta))),p=k,k=k*this.m_cos-this.m_sin*n,n=p*this.m_sin+n*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(d){alert(d.message)}};f.JS={};f.JS.AreaOfPolygon=function(b,d){d||(d=1);return f.Clipper.Area(b)/(d*d)};f.JS.AreaOfPolygons=function(b,d){d||(d=1);for(var e=0,k=0;k<b.length;k++)e+=f.Clipper.Area(b[k]);return e/(d*d)};f.JS.BoundsOfPath=function(b,d){return f.JS.BoundsOfPaths([b],d)};f.JS.BoundsOfPaths=function(b,d){d||(d=1);var e=f.Clipper.GetBounds(b);e.left/=d;e.bottom/=d;e.right/=d;e.top/=d;return e};f.JS.Clean=function(b,d){if(!(b instanceof Array))return[];var e=b[0]instanceof Array;b=
-f.JS.Clone(b);if("number"!=typeof d||null===d)return f.Error("Delta is not a number in Clean()."),b;if(0===b.length||1==b.length&&0===b[0].length||0>d)return b;e||(b=[b]);for(var k=b.length,n,p,v,F,E,H,K,I=[],ea=0;ea<k;ea++)if(p=b[ea],n=p.length,0!==n)if(3>n)v=p,I.push(v);else{v=p;F=d*d;E=p[0];for(K=H=1;K<n;K++)(p[K].X-E.X)*(p[K].X-E.X)+(p[K].Y-E.Y)*(p[K].Y-E.Y)<=F||(v[H]=p[K],E=p[K],H++);E=p[H-1];(p[0].X-E.X)*(p[0].X-E.X)+(p[0].Y-E.Y)*(p[0].Y-E.Y)<=F&&H--;H<n&&v.splice(H,n-H);v.length&&I.push(v)}!e&&
-I.length?I=I[0]:e||0!==I.length?e&&0===I.length&&(I=[[]]):I=[];return I};f.JS.Clone=function(b){if(!(b instanceof Array)||0===b.length)return[];if(1==b.length&&0===b[0].length)return[[]];var d=b[0]instanceof Array;d||(b=[b]);var e=b.length,f,k,p,v,F=Array(e);for(k=0;k<e;k++){f=b[k].length;v=Array(f);for(p=0;p<f;p++)v[p]={X:b[k][p].X,Y:b[k][p].Y};F[k]=v}d||(F=F[0]);return F};f.JS.Lighten=function(b,d){if(!(b instanceof Array))return[];if("number"!=typeof d||null===d)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>d)return f.JS.Clone(b);b[0]instanceof Array||(b=[b]);var e,k,n,p,v,F,E,H,K,I,ea,U,W,V,Y,Ea=b.length,ja=d*d,aa=[];for(e=0;e<Ea;e++)if(n=b[e],F=n.length,0!=F){for(p=0;1E6>p;p++){v=[];F=n.length;n[F-1].X!=n[0].X||n[F-1].Y!=n[0].Y?(ea=1,n.push({X:n[0].X,Y:n[0].Y}),F=n.length):ea=0;I=[];for(k=0;k<F-2;k++){E=n[k];K=n[k+1];H=n[k+2];V=E.X;Y=E.Y;E=H.X-V;U=H.Y-Y;if(0!==E||0!==U)W=((K.X-V)*E+(K.Y-Y)*U)/(E*E+U*U),1<W?(V=H.X,Y=H.Y):0<W&&(V+=E*W,Y+=
-U*W);E=K.X-V;U=K.Y-Y;H=E*E+U*U;H<=ja&&(I[k+1]=1,k++)}v.push({X:n[0].X,Y:n[0].Y});for(k=1;k<F-1;k++)I[k]||v.push({X:n[k].X,Y:n[k].Y});v.push({X:n[F-1].X,Y:n[F-1].Y});ea&&n.pop();if(I.length)n=v;else break}F=v.length;v[F-1].X==v[0].X&&v[F-1].Y==v[0].Y&&v.pop();2<v.length&&aa.push(v)}b[0]instanceof Array||(aa=aa[0]);"undefined"==typeof aa&&(aa=[[]]);return aa};f.JS.PerimeterOfPath=function(b,d,e){if("undefined"==typeof b)return 0;var f=Math.sqrt,k=0,p,v,F,E,H=b.length;if(2>H)return 0;for(d&&(b[H]=b[0],
-H++);--H;)p=b[H],F=p.X,p=p.Y,v=b[H-1],E=v.X,v=v.Y,k+=f((F-E)*(F-E)+(p-v)*(p-v));d&&b.pop();return k/e};f.JS.PerimeterOfPaths=function(b,d,e){e||(e=1);for(var k=0,n=0;n<b.length;n++)k+=f.JS.PerimeterOfPath(b[n],d,e);return k};f.JS.ScaleDownPath=function(b,d){var e,f;d||(d=1);for(e=b.length;e--;)f=b[e],f.X/=d,f.Y/=d};f.JS.ScaleDownPaths=function(b,d){var e,f,k;d||(d=1);for(e=b.length;e--;)for(f=b[e].length;f--;)k=b[e][f],k.X/=d,k.Y/=d};f.JS.ScaleUpPath=function(b,d){var e,f,k=Math.round;d||(d=1);for(e=
-b.length;e--;)f=b[e],f.X=k(f.X*d),f.Y=k(f.Y*d)};f.JS.ScaleUpPaths=function(b,d){var e,f,k,p=Math.round;d||(d=1);for(e=b.length;e--;)for(f=b[e].length;f--;)k=b[e][f],k.X=p(k.X*d),k.Y=p(k.Y*d)};f.ExPolygons=function(){return[]};f.ExPolygon=function(){this.holes=this.outer=null};f.JS.AddOuterPolyNodeToExPolygons=function(b,d){var e=new f.ExPolygon;e.outer=b.Contour();var k=b.Childs(),n=k.length;e.holes=Array(n);var p,v,F,E,H;for(v=0;v<n;v++)for(p=k[v],e.holes[v]=p.Contour(),F=0,E=p.Childs(),H=E.length;F<
-H;F++)p=E[F],f.JS.AddOuterPolyNodeToExPolygons(p,d);d.push(e)};f.JS.ExPolygonsToPaths=function(b){var d,e,k,n,p=new f.Paths;d=0;for(k=b.length;d<k;d++)for(p.push(b[d].outer),e=0,n=b[d].holes.length;e<n;e++)p.push(b[d].holes[e]);return p};f.JS.PolyTreeToExPolygons=function(b){var d=new f.ExPolygons,e,k,n;e=0;k=b.Childs();for(n=k.length;e<n;e++)b=k[e],f.JS.AddOuterPolyNodeToExPolygons(b,d);return d}})();
-var CindyJS=function(){function p(k){if(0===ja)return console.error("Waiting for "+k+" after we finished waiting."),function(){};0>ja&&(ja=0);++ja;return function(){--ja;0>ja&&console.error("Wait count mismatch: "+k);if(0===ja)for(var p=0,E=Ca.length;p<E;)Ca[p++].startup()}}function E(k){var p=E.newInstance(k);0>=ja?p.startup():!1!==k.autostart&&Ca.push(p);return p}var ja=-1,Ca=[];"undefined"===typeof document||"undefined"===typeof window||"undefined"===typeof document.addEventListener||"undefined"!==
-typeof window.cindyDontWait&&!0===window.cindyDontWait||document.addEventListener("DOMContentLoaded",p("DOMContentLoaded"));var pa=null,Da=null,aa={};E.getBaseDir=function(){if(null!==pa)return pa;for(var k=document.getElementsByTagName("script"),p=0;p<k.length;++p){var E=k[p],U=E.src;if(U){var W=/Cindy\.js$/.exec(U);if(W)return pa=U.substr(0,W.index),console.log("Will load extensions from "+pa),Da=E,pa}}console.error("Could not find <script> tag for Cindy.js");return pa=Da=!1};E.addNewScript=function(k,
-p){p||console.error.bind(console);var K=E.getBaseDir();if(!1===K)return!1;var U=document.createElement("script");U.src=K+k;var K=Da.nextSibling,W=Da.parentElement;K?W.insertBefore(U,K):W.appendChild(U);return U};E.loadScript=function(k,p,K,U){if(window[k])return K(),!0;U||(U=console.error.bind(console));var W=aa[k];if(!W){W=E.addNewScript(p,U);if(!1===W)return U("Can't load additional components."),!1;aa[k]=W}W.addEventListener("load",K);W.addEventListener("error",U);return null};E._autoLoadingPlugin=
-{};E.autoLoadPlugin=function(k,p,K){if(E._pluginRegistry[k])return K(),!0;var U=E._autoLoadingPlugin[k];if(!U){p||(p=k+"-plugin.js");U=E._autoLoadingPlugin[k]=[];k=E.addNewScript(p);if(!1===k)return!1;k.addEventListener("error",console.error.bind(console))}U.push(K);return null};var k={ctype:"undefined"};E.waitFor=p;E._pluginRegistry={};E.instances=[];E.registerPlugin=function(k,p,K){if(1!==k)return console.error("Plugin API version "+k+" not supported"),!1;E._pluginRegistry[p]=K;(E._autoLoadingPlugin[p]||
-[]).forEach(function(k){k()})};var Oa=0;E.dumpState=function(k){k=E.instances[k||0].saveState();console.log(JSON.stringify(k))};E.debugState=function(k){E.instances.map(function(k){var p=k.config,p=JSON.parse(JSON.stringify(p)),F=k.saveState();console.log(JSON.stringify(F));for(var E in F)p[E]=F[E];k.shutdown();return p}).forEach(function(k){E(k)})};E.newInstance=function(p){function E(){ka.width=da=ka.clientWidth;ka.height=ca=ka.clientHeight;y.setTransform(1,0,0,1,0,0);z.setMat(25,0,0,25,250.5,250.5);
-if(yb)for(var a=0;a<yb.length;a++){var h=yb[a],c=Object.keys(h)[0];"scale"===c&&(Kb=h.scale,z[c](h.scale));if("translate"===c)z[c](h.translate[0],h.translate[1]);"scaleAndOrigin"===c&&(Kb=h[c][0]/25,z[c].apply(null,h[c]));"visibleRect"===c&&(z[c].apply(null,h[c]),Kb=z.drawingstate.initialmatrix.a/25)}z.createnewbackup();z.greset();a=1;"undefined"!==typeof window&&window.devicePixelRatio&&(a=window.devicePixelRatio);h=y.webkitBackingStorePixelRatio||y.mozBackingStorePixelRatio||y.msBackingStorePixelRatio||
-y.oBackingStorePixelRatio||y.backingStorePixelRatio||1;a!==h&&(a/=h,ka.width=da*a,ka.height=ca*a,y.scale(a,a))}function K(a){var h;if("canvas"!==a.tagName.toLowerCase())for(h=a,ka=document.createElement("canvas");h.firstChild;)h.removeChild(h.firstChild);else{ka=a;h=document.createElement("div");var c=null,r=null;Array.prototype.slice.call(ka.attributes).forEach(function(a){"width"===a.name?c=a.value:"height"===a.name?r=a.value:h.setAttributeNodeNS(ka.removeAttributeNode(a))});null===c||h.style.width||
-(h.style.width=c+"px");null===r||h.style.height||(h.style.height=r+"px");ka.parentNode.replaceChild(h,ka)}h.classList.add("CindyJS-widget");a=ka.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(h).getPropertyValue("position"),a=String(a||"static"));"static"===a&&(h.style.position="relative");h.appendChild(ka);return ka}function U(){var a=p.cinderella;if(!a||!a.version)return!1;for(var h=
-0;h<arguments.length;++h){var c=a.version[h],r=arguments[h];if(c!==r)return typeof c===typeof r&&c<r}return!1}function W(){ac=!0;if(0===Lb){if(p.exclusive)for(b=wa.instances.length;0<b;)wa.instances[--b].shutdown();void 0!==p.csconsole&&(ia=p.csconsole);ia=null===ia?new qa:!0===ia?new xb:"string"===typeof ia?new cb(ia):"object"===typeof ia&&"function"===typeof ia.appendChild?new cb(ia):new qa;ta=[100,100];var a=null;yb=p.transform;if(p.ports&&0<p.ports.length){b=p.ports[0];(a=b.element)||(a=document.getElementById(b.id));
-var a=K(a),h=a.parentNode.style;"window"===b.fill?(h.width="100vw",h.height="100vh"):"parent"===b.fill?(h.width="100%",h.height="100%"):b.width&&b.height&&(h.width=b.width+"px",h.height=b.height+"px");b.background&&(a.style.backgroundColor=b.background);void 0!==b.transform&&(yb=b.transform);Fa(b.grid)&&0<b.grid&&(Wa=b.grid);Fa(b.tgrid)&&0<b.tgrid&&(bc=b.tgrid);b.snap&&(cc=!0);b.axes&&(zb=!0)}a||(a=p.canvas,a||"undefined"===typeof document||(a=document.getElementById(p.canvasname))&&(a=K(a)));a&&
-(ka=a,y=a.getContext("2d"),E(),y.setLineDash||(y.setLineDash=function(){}),(p.animation?p.animation.controls:p.animcontrols)&&ja(p),p.animation&&Fa(p.animation.speed)&&(void 0===p.animation.accuracy&&U(2,9,1875)?sa(.5*p.animation.speed):sa(p.animation.speed)),p.animation&&Fa(p.animation.accuracy)&&(Mb=p.animation.accuracy));p.statusbar&&(dc="string"===typeof p.statusbar?document.getElementById(p.statusbar):p.statusbar);var c=p.scripts,r=null;"string"===typeof c&&c.search(/\*/)&&(r=c);"object"!==typeof c&&
-(c=null);"move keydown keyup keytyped keytype mousedown mouseup mousedrag mousemove mouseclick init tick draw simulationstep simulationstart simulationstop ondrop".split(" ").forEach(function(a){var h;if(null!==c&&c[a])h=c[a];else{h=a+"script";if(p[h])h=document.getElementById(p[h]);else if(r){if(h=document.getElementById(r.replace(/\*/,a)),!h)return}else return;h=h.text}h=Ra(h,!1);"error"===h.ctype?console.error("Error compiling "+a+" script: "+h.message):S[a]=h});U(2,9,1888)&&!S.keydown&&(S.keydown=
-S.keytyped,S.keytyped=S.keytype,S.keytype=void 0);Fa(p.grid)&&0<p.grid&&(Wa=p.grid);p.snap&&(cc=!0);u={};var b=0;Xa={};p.geometry||(p.geometry=[]);Md(p.geometry);p.behavior||(p.behavior=[]);"function"===typeof ec&&ec(p.behavior);for(var d in p.images)b=aa(p.images[d],!1),b!==k&&(Xa[d]=b);for(var g in p.videos)d=aa(p.videos[g],!0),d!==k&&(Xa[g]=d);oa.canvas=a;if(p.oninit)p.oninit(oa);wa.instances.push(oa);p.use&&p.use.forEach(function(a){t.use$1([w.wrap(a)],{})});Nc.convexhull3d$1&&pa("QuickHull3D",
-"QuickHull3D.js");V()}}function aa(a,h){var c;"string"===typeof a?(h?(c=document.createElement("video"),c.preload="auto",c.loop=!0,c.setAttribute("playsinline",""),enableInlineVideo(c)):c=new Image,c.src=a):c=a;if(!c.tagName)return console.error("Not a valid image element",c),k;var r={img:c,width:NaN,height:NaN,ready:!0,live:!1,generation:0,whenReady:f},b=c.tagName.toLowerCase(),d=[];if("img"===b)c.complete?(r.width=c.width,r.height=c.height):(r.ready=!1,c.addEventListener("load",function(){r.width=
-c.width;r.height=c.height;r.ready=!0;r.whenReady=f;d.forEach(f);e()}),r.whenReady=d.push.bind(d));else if("video"===b)r.live=!0,c.readyState>=c.HAVE_METADATA?(r.width=c.videoWidth,r.height=c.videoHeight):(r.ready=!1,c.addEventListener("loadedmetadata",function(){r.width=c.videoWidth;r.height=c.videoHeight;r.ready=!0;r.whenReady=f;d.forEach(f);e()}),r.whenReady=d.push.bind(d));else if("canvas"===b)r.width=c.width,r.height=c.height;else return console.error("Not a valid image element",b,c),k;return{ctype:"image",
-value:r}}function ja(a){function h(a,c){var h=document.createElement("button"),r=document.createElement("img");h.appendChild(r);l.appendChild(h);Ab(r,a);h.addEventListener("click",c);Sa[a]=function(a){a?h.classList.add("CindyJS-active"):h.classList.remove("CindyJS-active")}}function c(a){if(k){var c=e.getBoundingClientRect();sa(g*(a.clientX-c.left-e.clientLeft+.5)/c.width+b)}}var r=document.createElement("div");r.className="CindyJS-animcontrols";ka.parentNode.appendChild(r);var b=0,d=1,g=1;a.animation&&
-a.animation.speedRange&&Fa(a.animation.speedRange[0])&&Fa(a.animation.speedRange[1])&&(b=a.animation.speedRange[0],d=a.animation.speedRange[1],g=d-b);var e=document.createElement("div");e.className="CindyJS-animspeed";r.appendChild(e);var f=document.createElement("div");e.appendChild(f);H(e,"mousedown",function(a){k=!0;c(a)});H(e,"mousemove",c);H(ka.parentNode,"mouseup",function(a){k=!1},!0);var l=document.createElement("div");l.className="CindyJS-animbuttons";r.appendChild(l);h("play",I);h("pause",
-Ca);h("stop",Da);Sa.stop(!0);gc=function(a){a=(a-b)/g;a=Math.max(0,Math.min(1,a));a=.1*Math.round(1E3*a);f.style.width=a+"%"};var k=!1}function sa(a){Oc=a;gc&&gc(a)}function f(a){return a()}function pa(a,h){var c=null;p.plugins&&(c=p.plugins[a]);c||(c=wa._pluginRegistry[a]);c?t.use$1([w.wrap(a)],{}):(++Pc,wa.autoLoadPlugin(a,h,function(){t.use$1([w.wrap(a)],{});V()}))}function V(){0===--Pc&&(A(S.init),(p.animation||p).autoplay&&I(),oa.canvas&&Zb(oa.canvas,p))}function Y(){null!==Bb&&(ma.set(Bb.state),
-Object.keys(Bb.speeds).forEach(function(a){var h=u.csnames[a];"undefined"!==typeof h.behavior&&(a=Bb.speeds[a],h.behavior.vx=a[0],h.behavior.vy=a[1],h.behavior.vz=a[2],h.behavior.fx=0,h.behavior.fy=0,h.behavior.fz=0)}),Nd())}function I(){if(!Ya){if(Ob){var a=db.backup;a.set(ma);for(var h={},c=0;c<u.points.length;c++){var r=u.points[c];"undefined"!==typeof r.behavior&&(h[r.name]=[r.behavior.vx,r.behavior.vy,r.behavior.vz])}Bb={state:a,speeds:h};Cb=0;Ob=!1;Sa.stop(!1)}else Sa.pause(!1);hc=Date.now();
-Sa.play(!0);"function"===typeof ec&&ic&&Od();Ya=!0;A(S.simulationstart);e()}}function Ca(){Ya&&(Sa.play(!1),Sa.pause(!0),Ya=!1)}function Da(){Ob||(Ya?(A(S.simulationstop),Ya=!1,Sa.play(!1)):Sa.pause(!1),Sa.stop(!0),Ob=!0,Y())}function Qa(){if(!jc){jc=!0;for(var a=wa.instances.length;0<a;)if(wa.instances[--a]===oa){wa.instances.splice(a,1);break}for(a=jb.length;0<a;)try{jb[--a]()}catch(h){console.error(h)}}}function ab(a){this["in"]=function(a,c){console.log(a);c?this.append(this.createTextNode("span",
-"blue",a)):this.append(this.createTextNode("p","blue",a))};this.out=function(a,c){console.log(a);c?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.err=function(a,c){console.log(a);c?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.createTextNode=function(a,c,r){return"undefined"!==typeof document?(a=document.createElement(a),a.appendChild(document.createTextNode(r)),a.style.color=c,a):r+"\n"}}
-function xb(){var a=this,h,c=document.createElement("div"),r;c.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(c);h=document.getElementById("cmd");r=document.getElementById("log");h.onkeydown=function(c){13===c.keyCode&&""!==h.value&&(a["in"](h.value),c=
-t.parse$1([w.wrap(h.value)],[]),c=A(c),console.log(ba(c)),"undefined"!==c.ctype&&ia.out(ba(c)),h.value="",r.scrollTop=r.scrollHeight)};this.append=function(a){r.appendChild(a)};this.clear=function(){r.innerHTML=""}}function cb(a){var h=a;"string"===typeof a&&(h=document.getElementById(a));this.append=function(a){h.appendChild(a)};this.clear=function(){h.innerHTML=""}}function qa(){this.append=function(a){};this.clear=function(){}}function H(a,h,c,r){void 0===r&&(r=!1);jb.push(function(){a.removeEventListener(h,
-c,r)});a.addEventListener(h,c,r)}function Zb(a,h){function c(c){var h=a.getBoundingClientRect();c=z.to(c.clientX-h.left-a.clientLeft+.5,c.clientY-h.top-a.clientTop+.5);X.prevx=X.x;X.prevy=X.y;X.x=c[0];X.y=c[1];ta[0]=X.x;ta[1]=X.y;e()}function r(a){for(var c=a.changedTouches,h=!1,r=0;r<c.length;r++)c[r].identifier===Q&&(h=!0);h&&(Q=-1,X.down=!1,fa=void 0,A(S.mouseup),qb("mouseup"),e(),a.preventDefault())}var b=null;"undefined"!==typeof MutationObserver&&(b=MutationObserver);b||"undefined"===typeof WebKitMutationObserver||
-(b=WebKitMutationObserver);b?(b=new b(function(c){document.body.contains(a)||Qa()}),b.observe(document.documentElement,{childList:!0,subtree:!0}),jb.push(function(){b.disconnect()})):(H(a,"DOMNodeRemovedFromDocument",Qa),H(a,"DOMNodeRemoved",Qa));if(!0===h.keylistener)H(document,"keydown",function(a){N(a,S.keydown);return!1}),H(document,"keyup",function(a){N(a,S.keyup);return!1}),H(document,"keypress",function(a){N(a,S.keytyped);return!1});else if(S.keydown||S.keyup||S.keytyped)a.setAttribute("tabindex",
-"0"),H(a,"mousedown",function(){a.focus()}),H(a,"keydown",function(a){9!==a.keyCode&&(N(a,S.keydown),S.keytyped||a.preventDefault())}),H(a,"keyup",function(a){N(a,S.keyup);a.preventDefault()}),H(a,"keypress",function(a){9!==a.keyCode&&(N(a,S.keytyped),a.preventDefault())});H(a,"mousedown",function(a){X.button=a.which;c(a);A(S.mousedown);qb("mousedown");X.down=!0;a.preventDefault()});H(a,"mouseup",function(a){X.down=!1;fa=void 0;A(S.mouseup);qb("mouseup");e();a.preventDefault()});H(a,"mousemove",function(a){c(a);
-X.down?A(S.mousedrag):A(S.mousemove);qb("mousemove");a.preventDefault()});H(a,"click",function(a){c(a);A(S.mouseclick);a.preventDefault()});H(a,"dragenter",function(a){a.preventDefault()});H(a,"dragover",function(a){a.preventDefault()});H(a,"drop",function(c){function h(a,c){function g(){e.readyState===XMLHttpRequest.DONE&&(200!==e.status?(console.error("GET request for "+a+" failed: "+(e.responseText||"(no error message)")),d(c,k)):b(c,e.responseText))}var Q=a.replace(/[?#][^]*/,""),Q=Q.replace(/[^]*\/([^\/])/,
-"$1");f[c]={type:"",name:Q};var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE)if(200!==e.status)console.error("HEAD request for "+a+" failed: "+(e.responseText||"(no error message)")),d(c,k);else{var h=e.getResponseHeader("Content-Type");f[c].type=h;/^image\//.test(h)?na(c,a):r(h)?(e=new XMLHttpRequest,e.onreadystatechange=g,e.open("GET",a),e.send()):d(c,k)}};e.open("HEAD",a);e.send()}function r(a){a=a.replace(/;[^]*/,"");return/^text\//.test(a)?1:"application/json"===
-a?2:0}function b(a,c){switch(r(f[a].type)){case 1:d(a,w.string(c));break;case 2:var h,na;try{h=JSON.parse(c),na=w.wrapJSON(h)}catch(g){console.error(g),na=k}d(a,na);break;default:d(a,k)}}function na(a,c){var h=new Image,r=!1;h.onload=function(){r||(r=!0,d(a,aa(h,!1)))};h.onerror=function(c){r||(r=!0,console.error(c),d(a,k))};h.src=c}function d(a,c,h){l[a]=g.turnIntoCSList([c,w.string(h||c.ctype),w.string(f[a].type),w.string(f[a].name)]);0===--m&&(a=p,kc=g.turnIntoCSList(l),lc=a,A(S.ondrop),lc=kc=
-k,e())}c.preventDefault();var Q=c.dataTransfer,f=Q.files,l=Array(f.length),m=f.length,n=c.currentTarget.getBoundingClientRect(),p=g.realVector(z.to(c.clientX-n.left-a.clientLeft+.5,c.clientY-n.top-a.clientTop+.5));if(0<f.length)Array.prototype.forEach.call(f,function(a,c){var h=new FileReader;r(a.type)?(h.onload=function(){b(c,h.result)},h.readAsText(a)):/^image\//.test(a.type)?(h.onload=function(){na(c,h.result)},h.readAsDataURL(a)):(console.log("Unknown MIME type: "+a.type),d(c,k))});else if(c=
-Q.getData("text/uri-list"))c=c.split("\n").filter(function(a){return!/^\s*(#|$)/.test(a)}),m=c.length,l=Array(m),f=Array(m),c.forEach(h)});var Q=-1;H(a,"touchstart",function(a){if(-1===Q){var h=a.changedTouches;0!==h.length&&(Q=h[0].identifier,c(a.targetTouches[0]),A(S.mousedown),X.down=!0,qb("mousedown"),a.preventDefault())}},!1);H(a,"touchmove",function(a){for(var h=a.changedTouches,r=!1,b=0;b<h.length;b++)h[b].identifier===Q&&(r=!0);r&&(c(a.targetTouches[0]),X.down?A(S.mousedrag):A(S.mousemove),
-qb("mousemove"),a.preventDefault())},!0);H(a,"touchend",r,!1);"undefined"!==typeof document&&document.body&&H(document.body,"touchcancel",r,!1);"undefined"!==typeof window&&H(window,"resize",function(){Pb(function(){E();e()})},!1);d(a.parentNode);e()}function b(a,h){var c=document.createElement("div");c.setAttribute("style",h);a.appendChild(c);return c}function d(a){function h(){r.scrollLeft=r.scrollTop=na.scrollLeft=na.scrollTop=1E5}function c(){if(d!==a.clientWidth||g!==a.clientHeight)d=a.clientWidth,
-g=a.clientHeight,f||(f=!0,Pb(function(){f=!1;E();e()}));h()}if("undefined"!==typeof document){var r=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");b(r,"position: absolute; transition: 0s; left: 0; top: 0; width: 100000px; height: 100000px");var na=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");b(na,"position: absolute; transition: 0s; left: 0; top: 0; width: 200%; height: 200%");
-h();var d=a.clientWidth,g=a.clientHeight,f=!1;r.addEventListener("scroll",c);na.addEventListener("scroll",c)}}function e(){mc||(mc=Pb(q))}function q(){mc=null;if(!jc){if(Ya){var a=Date.now(),h=Math.min(50,a-hc)*Oc*Pd;hc=a;a=Cb+h;ic&&"undefined"!==typeof ra&&ra.tick(h);Cb=a;Ya&&A(S.tick)}n();Ya&&e()}}function n(){z.reset();y.save();y.clearRect(0,0,da,ca);var a=z.drawingstate.matrix,h,c,r,b,d;if(0!==Wa){y.beginPath();y.strokeStyle="rgba(0,0,0,0.1)";y.lineWidth=1;y.lineCap="butt";h=Wa*a.a;for(b=Math.ceil(-a.tx/
-h);(d=b*h+a.tx)<da;){if(b||!zb)y.moveTo(d,0),y.lineTo(d,ca);b++}for(b=Math.floor(a.ty/h);(d=b*h-a.ty)<ca;){if(b||!zb)y.moveTo(0,d),y.lineTo(da,d);b++}y.stroke()}if(0!==bc){y.beginPath();y.strokeStyle="rgba(0,0,0,0.1)";y.lineWidth=1;y.lineCap="butt";h=bc*a.a;var e=Math.sqrt(3);c=a.ty/e;r=(ca+a.ty)/e;for(b=Math.ceil(-(a.tx+r)/h);(d=b*h+a.tx)+c<da;)y.moveTo(d+c,0),y.lineTo(d+r,ca),b++;for(b=Math.ceil(-(a.tx-c)/h);(d=b*h+a.tx)-r<da;)y.moveTo(d-c,0),y.lineTo(d-r,ca),b++;h*=.5*e;for(b=Math.floor(a.ty/h);(d=
-b*h-a.ty)<ca;){if(b||!zb)y.moveTo(0,d),y.lineTo(da,d);b++}y.stroke()}zb&&(y.beginPath(),y.strokeStyle="rgba(0,0,0,0.2)",y.lineWidth=3,y.lineCap="butt",y.lineJoin="miter",y.miterLimit=10,y.beginPath(),y.moveTo(0,-a.ty),y.lineTo(da-6,-a.ty),y.moveTo(da-13,-5-a.ty),y.lineTo(da-3,-a.ty),y.lineTo(da-13,5-a.ty),y.moveTo(a.tx,ca),y.lineTo(a.tx,6),y.moveTo(a.tx-5,13),y.lineTo(a.tx,3),y.lineTo(a.tx+5,13),y.stroke());Qd();z.greset();Rd();for(a=0;a<u.polygons.length;a++)h=u.polygons[a],h.isshowing&&!1!==h.visible&&
-(c={color:h.color,alpha:h.alpha,fillcolor:h.fillcolor,fillalpha:h.fillalpha,size:h.size,lineJoin:w.string("miter"),fillrule:w.string(h.fillrule)},D.drawpolygon([h.vertices],c,"D",!0));for(a=0;a<u.conics.length;a++)u.conics[a].isArc?(h=u.conics[a],h.isshowing&&!1!==h.visible&&(c={},c.color=h.color,c.alpha=h.alpha,c.size=h.size,D.drawarc(h,c,h.filled?"F":"D"))):(h=u.conics[a],h.isshowing&&!1!==h.visible&&(c={},c.color=h.color,c.alpha=h.alpha,c.size=h.size,D.drawconic(h.matrix,c)));for(a=0;a<u.lines.length;a++)a:if(h=
-u.lines[a],h.isshowing&&!1!==h.visible&&g._helper.isAlmostReal(h.homog))if("S"===h.kind)c={overhang:h.overhang,dashtype:h.dashtype,size:h.size,color:h.color,alpha:h.alpha,arrow:h.arrow,arrowsize:h.arrowsize,arrowposition:h.arrowposition,arrowshape:h.arrowshape,arrowsides:h.arrowsides},0<=l.mult(h.startpos.value[2],l.conjugate(h.endpos.value[2])).value.real?t.draw$2([h.startpos,h.endpos],c):(x.handleModifs(c,x.lineModifs),x.drawRaySegment(h.startpos,h.endpos));else if("end"===h.clip.value&&"Join"===
-h.type)b=u.csnames[h.args[0]],c=u.csnames[h.args[1]],t.draw$2([b.homog,c.homog],{overhang:h.overhang,dashtype:h.dashtype,size:h.size,color:h.color,alpha:h.alpha});else{if("inci"===h.clip.value){b=[1E6,0];c=[-1E6,0];d=[1E6,0];r=[-1E6,0];for(e=0;e<h.incidences.length;e++){var f=u.csnames[h.incidences[e]].homog,k=f.value[0],m=f.value[1],n=f.value[2];l._helper.isAlmostZero(n)||(k=l.div(k,n),m=l.div(m,n),l._helper.isAlmostReal(k)&&l._helper.isAlmostReal(m)&&(k.value.real<b[0]&&(b=[k.value.real,f]),k.value.real>
-c[0]&&(c=[k.value.real,f]),m.value.real<d[0]&&(d=[m.value.real,f]),m.value.real>r[0]&&(r=[m.value.real,f])))}c[0]-b[0]>r[0]-d[0]?(b=b[1],c=c[1]):(b=d[1],c=r[1]);if(b!==c){t.draw$2([b,c],{dashtype:h.dashtype,size:h.size,color:h.color,alpha:h.alpha,overhang:h.overhang});break a}}t.draw$1([h.homog],{dashtype:h.dashtype,size:h.size,color:h.color,alpha:h.alpha})}for(a=0;a<u.points.length;a++)h=u.points[a],h.isshowing&&!1!==h.visible&&g._helper.isAlmostReal(h.homog)&&(c=h.color,h.behavior&&(c=h.color),
-t.draw$1([h.homog],{size:h.size,color:c,alpha:h.alpha}),h.labeled&&!h.tmp&&(c=h.printname||h.name||"P",r=h.labelpos||{x:3,y:3},b=h.textsize||la.textsize,d=!0===h.textbold,e=!0===h.textitalics,f=h.text_fontfamily||la.fontFamily,k=r.x*r.x+r.y*r.y,m=1,0<k&&(m=1+h.size.value.real/Math.sqrt(k)),D.drawtext([h.homog,w.wrap(c)],{x_offset:w.wrap(m*r.x),y_offset:w.wrap(m*r.y),size:w.wrap(b),bold:w.wrap(d),italics:w.wrap(e),family:w.wrap(f)})));for(a=0;a<u.texts.length;a++)Sd(u.texts[a]);y.restore()}function N(a,
-h){var c=window.event?event:a,c=c.charCode?c.charCode:c.keyCode;Qc=String.fromCharCode(c);Rc=c;A(h);e()}function v(a){var h=a.value;a=h[0].value;var c=h[1].value,h=h[2].value;return g.turnIntoCSList([a[0],l.add(a[1],c[0]),l.add(a[2],h[0]),c[1],l.add(c[2],h[1]),h[2]])}function C(a){var h=!0;return function(c,r){h&&(console.error("Operator "+a+" is not supported yet."),h=!1);return k}}function ba(a){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){for(var h="[",c=0;c<a.value.length;c++)h+=ba(A(a.value[c])),c!==a.value.length-1&&(h+=", ");return h+"]"}return"dict"===a.ctype?Ka.niceprint(a):"function"===a.ctype?"FUNCTION":"infix"===a.ctype?"INFIX":"modifier"===a.ctype?a.key+"->"+ba(a.value):"shape"===a.ctype?a.type:"error"===a.ctype?"Error: "+a.message:"variable"===a.ctype?ba(J.getvar(a.name)):"geo"===a.ctype?a.value.name:
-"image"===a.ctype?"IMAGE":"_?_"}function bb(a,h){var c="undefined"===a[0].ctype,r="undefined"===a[1].ctype,b=A(a[1]);if(c||r)return k;"variable"===a[0].ctype?J.setvar(a[0].name,b):"infix"===a[0].ctype?"_"===a[0].oper?D.assigntake(a[0],b):console.error("Can't use infix expression as lvalue"):"field"===a[0].ctype?D.assigndot(a[0],b):"function"===a[0].ctype&&"genList"===a[0].oper?"list"===b.ctype?D.assignlist(a[0].args,b.value):console.error("Expected list in rhs of assignment"):console.error("Left hand side of assignment is not a recognized lvalue");
-return b}function pb(a,h){var c=A(a[0]),r=A(a[1]);if(c.ctype===r.ctype){if("number"===c.ctype)return w.bool(c.value.real===r.value.real&&c.value.imag===r.value.imag);if("string"===c.ctype||"boolean"===c.ctype)return w.bool(c.value===r.value);if("list"===c.ctype)return g.equals(c,r);if("geo"===c.ctype)return w.bool(c.value===r.value)}return{ctype:"boolean",value:!1}}function Gc(a,h){return w.not(pb(a,h))}function Yb(a,h){var c=B(a[0]),r=B(a[1]);return"number"===c.ctype&&"number"===r.ctype?{ctype:"boolean",
-value:l._helper.isAlmostEqual(c,r)}:"string"===c.ctype&&"string"===r.ctype||"boolean"===c.ctype&&"boolean"===r.ctype?{ctype:"boolean",value:c.value===r.value}:"list"===c.ctype&&"list"===r.ctype?g.almostequals(c,r):{ctype:"boolean",value:!1}}function Hc(a,h){var c=B(a[0]),r=B(a[1]);return"boolean"===c.ctype&&"boolean"===r.ctype?{ctype:"boolean",value:c.value&&r.value}:k}function Ic(a,h){var c=B(a[0]),r=B(a[1]);return"boolean"===c.ctype&&"boolean"===r.ctype?{ctype:"boolean",value:c.value||r.value}:
-k}function Jc(a,h){var c=a[0];"void"!==c.ctype&&(c=B(c));var r=B(a[1]),b=w.add(c,r);"Angle"===c.usage&&"Angle"===r.usage&&(b=w.withUsage(b,"Angle"));return b}function $b(a,h){var c=a[0];"void"!==c.ctype&&(c=B(c));var r=B(a[1]),b=w.sub(c,r);"Angle"===c.usage&&"Angle"===r.usage&&(b=w.withUsage(b,"Angle"));return b}function Kc(a,h){var c=B(a[0]),r=B(a[1]),b=w.mult(c,r);"Angle"!==c.usage||r.usage?"Angle"!==r.usage||c.usage||(b=w.withUsage(b,"Angle")):b=w.withUsage(b,"Angle");return b}function Lc(a,h){var c=
-B(a[0]),r=B(a[1]);"number"===r.ctype&&l._helper.isZero(r)&&ia.err("WARNING: Division by zero!");var b=w.div(c,r);"Angle"!==c.usage||r.usage?"Angle"!==r.usage||c.usage||(b=w.withUsage(b,"Angle")):b=w.withUsage(b,"Angle");return b}function Mc(a,h){var c=B(a[0]),r=B(a[1]);return"number"===c.ctype&&"number"===r.ctype?l.pow(c,r):k}function Sc(a,h){var c=M(a[0]),r=M(a[1]);if(c!==k&&r!==k){var b=g.cross(c,r);"Point"===c.usage&&"Point"===r.usage&&(b=w.withUsage(b,"Line"));"Line"===c.usage&&"Line"===r.usage&&
-(b=w.withUsage(b,"Point"));return b}return k}function nc(a){var h=a.length;if(0===h)return[];if(1===h)return[0];if(2===h)return a[0][0]+a[1][1]<=a[0][1]+a[1][0]?[0,1]:[1,0];if(4<h)return Td(a);for(var c=Ud[h],r=Number.POSITIVE_INFINITY,b=c[0],d=0;d<c.length;++d){for(var g=c[d],e=0,f=0;f<h;++f)e+=a[f][g[f]];e<r&&(r=e,b=g)}return b}function Td(a){function h(){return{matched:-1,prev:-1,start:-1,cost:0,used:!1,leaf:!1}}function c(a){for(var h=0;h<d;++h)0<k[a][h]||l[h].used||(l[h].used=!0,c(l[h].matched))}
-function r(a){for(var c=0;c<d;++c)0<k[c][a]||f[c].used||(f[c].used=!0,r(f[c].matched))}var b=Math.abs,d=a.length,g,e,f=Array(d),l=Array(d),k=Array(d);for(g=0;g<d;++g)k[g]=Array(d);for(g=0;g<d;++g)for(f[g]=h(),l[g]=h(),f[g].cost=a[g][0],e=1;e<d;++e)f[g].cost>a[g][e]&&(f[g].cost=a[g][e]);for(;;){for(g=0;g<d;++g)for(e=0;e<d;++e)k[g][e]=a[g][e]-f[g].cost-l[e].cost,k[g][e]<1E-14*(b(a[g][e])+b(f[g].cost)+b(l[e].cost))&&(k[g][e]=0);for(g=0;g<d;++g)f[g].matched=l[g].matched=-1;for(var m=0;;){for(g=0;g<d;++g)f[g].used=
-f[g].leaf=l[g].used=l[g].leaf=!1,-1===f[g].matched&&(f[g].start=g,f[g].used=f[g].leaf=!0,f[g].prev=-1);for(var n=!1,p=!1;!p;){for(g=0;g<d;++g)if(f[g].leaf)for(f[g].leaf=!1,e=0;e<d;++e)if(!(l[e].used||0<k[g][e])&&f[g].matched!==e&&(l[e].prev=g,l[e].start=f[g].start,l[e].used=l[e].leaf=!0,-1===l[e].matched)){f[l[e].start].prev=e;n=!0;break}if(n)break;p=!0;for(e=0;e<d;++e)l[e].leaf&&(l[e].leaf=!1,g=l[e].matched,f[g].used||(f[g].prev=e,f[g].start=l[e].start,f[g].used=f[g].leaf=!0,p=!1))}if(!n)break;for(n=
-0;n<d;++n)if(-1===f[n].matched&&-1!==f[n].prev){e=f[n].prev;do g=l[e].prev,l[e].matched=g,f[g].matched=e,e=f[g].prev;while(g!==n);++m}}if(m===d)break;for(g=0;g<d;++g)f[g].used=f[g].leaf=l[g].used=l[g].leaf=!1;for(g=0;g<d;++g)-1===f[g].matched&&c(g);for(e=0;e<d;++e)-1===l[e].matched&&r(e);for(g=0;g<d;++g)-1===f[g].matched||f[g].used||l[f[g].matched].used||(f[g].used=!0);m=Number.POSITIVE_INFINITY;for(g=0;g<d;++g)if(!f[g].used)for(e=0;e<d;++e)l[e].used||m>k[g][e]&&(m=k[g][e]);for(g=0;g<d;++g)f[g].used||
-(f[g].cost+=m),l[g].used&&(l[g].cost-=m)}a=Array(d);for(g=0;g<d;++g)e=f[g].matched,a[g]=e;return a}function oc(a,h){var c=A(a[0]),r=B(a[1]);"string"!==c.ctype&&(c=g.asList(c));if("number"===r.ctype){r=Math.floor(r.value.real);0>r&&(r=c.value.length+r+1);if(0<r&&r<c.value.length+1)return"list"===c.ctype?c.value[r-1]:{ctype:"string",value:c.value.charAt(r-1)};ia.err("WARNING: Index out of range!");return k}if("list"===r.ctype){for(var b=[],d=0;d<r.value.length;d++){var e=B(r.value[d]);b[d]=oc([c,e],
-[])}return g.turnIntoCSList(b)}return k}function Tc(a,h){var c=A(a[0]),r=A(a[1]);if("shape"===c.ctype&&"shape"===r.ctype)return D.shapeconcat(c,r);c=g.asList(c);r=g.asList(r);return"list"===c.ctype&&"list"===r.ctype?g.concat(c,r):k}function Uc(a,h){var c=A(a[0]),r=A(a[1]);return"list"===c.ctype&&"list"===r.ctype?g.set(g.common(c,r)):"shape"===c.ctype&&"shape"===r.ctype?D.shapecommon(c,r):k}function Vc(a,h){var c=A(a[0]),r=A(a[1]);return"list"===c.ctype&&"list"===r.ctype?g.remove(c,r):"shape"===c.ctype&&
-"shape"===r.ctype?D.shaperemove(c,r):k}function Wc(a,h){var c=A(a[0]),r=A(a[1]);return"list"===c.ctype?g.append(c,r):k}function Xc(a,h){var c=A(a[0]),r=A(a[1]);return"list"===r.ctype?g.prepend(c,r):k}function pc(a,h){a|=0;h|=0;if(0===a&&0===h)return 0;for(;0!==h;){var c=a;a=h;h=c%h|0}return a}function Vd(a){return 1===a?0:1}function Yc(a,h,c,r,b,d,g){if(-1!==h.indexOf("\n")){var e=Infinity,f=-Infinity,l=Infinity,k=-Infinity;h.split("\n").forEach(function(h){h=Yc(a,h,c,r,b,d);e>h.left&&(e=h.left);
-f<h.right&&(f=h.right);l>h.top&&(l=h.top);k<h.bottom&&(k=h.bottom);r+=g});return{left:e,right:f,top:l,bottom:k}}var m=a.measureText(h);a.fillText(h,c-m.width*b,r);return{left:c-m.width*b,right:c+m.width*(1-b),top:r-.84*d,bottom:r+.36*d}}function La(a){return"image"===a.ctype?a.value:"string"===a.ctype&&Xa.hasOwnProperty(a.value)?Xa[a.value].value:null}function rb(a,h,c,r,b){var d=[];if(a.readPixels)d=a.readPixels(h,c,r,b);else{var g,e;if(a.img.getContext)e=a.img.getContext("2d"),g=e.getImageData(h,
-c,r,b).data;else try{Db||(Db=document.createElement("canvas")),Db.width=r,Db.height=b,e=Db.getContext("2d"),e.drawImage(a.img,h,c,r,b,0,0,r,b),g=e.getImageData(0,0,r,b).data}catch(f){console.log(f)}for(var l in g)d.push(g[l]/255)}return d}function Zc(a){return a.replace(/[^A-Za-z0-9 \u0080-\uffff]/ig,"\\$&")}function ha(a,h,c){var r=a;h&&(r=r+" at "+h.row+":"+h.col);c&&(r=r+": \u2018"+c+"\u2019");r=Error(r);r.name="CindyScriptParseError";r.description=a;r.location=h;r.text=c;return r}function kb(a){this.input=
-a;this.re=new RegExp($c,"g");for(var h=[],c=a.indexOf("\n")+1;c;)h.push(c),c=a.indexOf("\n",c)+1;h.push(a.length);this.bols=h;this.bol=this.pos=0;this.line=1}function Qb(a){var h=a[a.length-2],c=a[a.length-3],r=a[a.length-1];if(c){if(c.isSuperscript&&h.precedence<=c.precedence)throw ha("Operator not allowed after superscript",h.start,h.text);if(r){if(!h.op.infix)throw ha("Operator may not be used infix",h.start,h.text);}else if(!h.op.postfix)throw ha("Operator may not be used postfix",h.start,h.text);
-}else if(r){if(!h.op.prefix)throw ha("Operator may not be used prefix",h.start,h.text);}else if(!h.op.bare)throw ha("Operator without operands",h.start,h.text);h.ctype="infix";h.oper=h.op.sym;h.args=[c,r];a.splice(a.length-3,3,h)}function ad(a,h,c,r){a.length&1||a.push(null);for(c=xa[c];3<=a.length&&a[a.length-2].precedence<=c.precedence;)Qb(a);a.push({op:c,precedence:c.precedence+(c.rassoc?1:0),start:h.start,end:h.end,text:h.text,rawtext:h.rawtext});c="";for(var b=h.text,d=0;d<b.length;++d)c+="0123456789+-".charAt(r.indexOf(b.charAt(d)));
-h.ctype="number";h.value={real:+c,imag:0};a.push(h);Qb(a)}function bd(a,h){var c=[],r;a:for(;;)switch(r=a.next(),r.toktype){case "OP":var b=xa[r.text];"_"!==b.sym||!c.length||c.length&1||"OP"!==c[c.length-1].toktype||":="!==c[c.length-1].op.sym||(c.pop(),b=xa[":=_"],r.text=b.sym);r.op=b;r.precedence=b.precedence;for(c.length&1||c.push(null);3<=c.length&&c[c.length-2].precedence<=r.precedence;)Qb(c);b.rassoc&&r.precedence++;c.push(r);break;case "ID":r.ctype="variable";r.name=r.text;if(c.length&1)throw ha("Missing operator",
-r.start,r.text);c.push(r);break;case "NUM":r.ctype="number";r.value={real:+r.text,imag:0};if(c.length&1)throw ha("Missing operator",r.start,r.text);c.push(r);break;case "STR":r.ctype="string";r.value=r.raw.substring(1,r.raw.length-1);if(c.length&1)throw ha("Missing operator",r.start,r.text);c.push(r);break;case "SUB":ad(c,r,"_","\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089\u208a\u208b");break;case "SUP":ad(c,r,"^","\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079\u207a\u207b");
-c[c.length-1].isSuperscript=!0;break;case "BRA":b="[](){}||".indexOf(r.text);if(r.text===h||b&1)break a;var b="[](){}||".charAt(b+1),d=bd(a,b),g=d.closedBy;if(g.text!==b)throw ha("Opening "+r.text+" at "+r.start.row+":"+r.start.col+" closed by "+(g.text||"EOF")+" at "+g.start.row+":"+g.start.col);g=r.text+g.text;b=[];if(d=d.expr){for(;d&&"infix"===d.ctype&&","===d.oper;)b.push(d.args[0]),d=d.args[1];b.push(d)}if(c.length&1){if("{}"===g)throw ha("{\u2026} reserved for future use",r.start);d=c[c.length-
-1];if("variable"!==d.ctype)throw ha("Function name must be an identifier",d.start);if(2<c.length&&c[c.length-2].precedence<cd)throw ha("Function call in indexing construct must be enclosed in parentheses",r.start);d.ctype="function";r=d.args=[];for(var g=d.modifs={},e=0;e<b.length;++e){var f=b[e];if(f&&"infix"===f.ctype&&"->"===f.oper){var l=f.args[0];if("variable"!==l.ctype)throw ha("Modifier name must be an identifier",f.start);g[l.name]=f.args[1]}else r.push(f)}d.oper=d.name.toLowerCase()+"$"+
-d.args.length}else if("||"===g)if(1===b.length)c.push({ctype:"function",oper:"abs_infix",args:b,modifs:{}});else if(2===b.length)c.push({ctype:"function",oper:"dist_infix",args:b,modifs:{}});else throw ha("Don't support |\u2026| with "+b.length+" arguments",r.start);else{if("{}"===g)throw ha("{\u2026} reserved for future use",r.start);"[]"!==g&&1===b.length?c.push({ctype:"paren",args:b}):0===b.length?c.push({ctype:"list",value:[]}):c.push({ctype:"function",oper:"genList",args:b,modifs:{}})}break;
-case "EOF":break a}for(c.length&1||c.push(null);3<=c.length;)Qb(c);return{expr:c[0],closedBy:r}}function Eb(a){this.usedFunctions={};this.usedVariables={}}function A(a){if(void 0===a)return k;if("infix"===a.ctype)return a.impl(a.args,{},a);if("variable"===a.ctype)return A(J.getvar(a.name));if("function"===a.ctype)return D.evaluate(a.oper,a.args,a.modifs);if("void"===a.ctype)return k;if("field"===a.ctype){var h=A(a.obj);return"geo"===h.ctype?ya.getField(h.value,a.key):"list"===h.ctype?g.getField(h,
-a.key):k}return a}function B(a){a=A(a);if("geo"===a.ctype){var h=a.value;if("P"===h.kind)return ya.getField(h,"xy");if("V"===h.kind)return h.value}return a}function M(a){a=A(a);if("geo"===a.ctype){var h=a.value;if("P"===h.kind||"L"===h.kind)return ya.getField(h,"homog")}return g._helper.isNumberVecN(a,3)?a:g._helper.isNumberVecN(a,2)?(h=g.turnIntoCSList([a.value[0],a.value[1],l.real(1)]),a.usage&&(h=w.withUsage(h,a.usage)),h):k}function Ra(a){var h=new Eb;h.usedFunctions=Nc;h.infixmap=R;a=h.parse(a);
-for(var c in h.usedVariables)J.create(c);return a}function dd(){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 ed(){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 fd(a,h){var c=a.width,r=a.height,b=document.createElement("canvas");b.setAttribute("width",c);b.setAttribute("height",r);b.setAttribute("style","display:none;");var d=oa.canvas;d.parentNode.insertBefore(b,d.nextSibling);try{return b.getContext("2d").drawImage(a,
-0,0,c,r),b.toDataURL(h||"image/png")}finally{b.parentNode.removeChild(b)}}function Wd(a){a=a.replace(RegExp("[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/]+","g"),"");var h=new Uint8Array(3*a.length>>2),c,r,b,d,g,e;for(r=c=0;c+3<a.length;c+=4)b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c)),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+1)),g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+
-2)),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+3)),h[r++]=b<<2|d>>4,h[r++]=d<<4|g>>2,h[r++]=g<<6|e;switch(a.length-c){case 0:break;case 2:b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+1));h[r++]=b<<2|d>>4;break;case 3:b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+
-1));g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+2));h[r++]=b<<2|d>>4;h[r++]=d<<4|g>>2;break;default:throw Error("Malformed Base64 input: "+(a.length-c)+" chars left: "+a.substr(c));}if(r!==h.length)throw Error("Failed assertion: "+r+" should be "+h.length);return h}function Xd(a){function h(c){return(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3])>>>0}if(57>a.length)throw Error("Too short to be a PNG file");if(2303741511!==h(0)||218765834!==h(4))throw Error("PNG signature missing");
-for(var c=[],r=8;r<a.length;){if(r+12>a.length)throw Error("Incomplete chunk at offset 0x"+r.toString(16));var b=h(r);if(2147483648<=b)throw Error("Chunk too long");var d=r+12+b;if(d>a.length)throw Error("Incomplete chunk at offset 0x"+r.toString(16));var g=a.subarray(r+4,r+8),g=String.fromCharCode.apply(String,g);c.push({len:b,type:g,data:a.subarray(r+8,r+8+b),crc:h(r+8+b)});r=d}return c}function Rb(a,h){var c;if(c=/^rgba\(([0-9]+), *([0-9]+), *([0-9]+), *([0-9]+)\)$/.exec(a))h(+c[1],+c[2],+c[3],
-+c[4]);else if(c=/^rgb\(([0-9]+), *([0-9]+), *([0-9]+)\)$/.exec(a))h(+c[1],+c[2],+c[3],1);else throw Error("Can't handle color style "+a);}function Yd(a){var h=1;Object.keys(Xa).forEach(function(c){var r=Xa[c].value.img;if(void 0===r.cachedDataURL&&r.src)if("data:"===r.src.substr(0,5))r.cachedDataURL=r.src;else{++h;r.cachedDataURL=null;var b=new XMLHttpRequest;b.responseType="blob";b.onreadystatechange=function(){if(b.readyState===XMLHttpRequest.DONE)if(200===b.status){var c=new FileReader;c.onloadend=
-function(){r.cachedDataURL=c.result;console.log("Cached data for image "+r.src);0===--h&&a()};c.readAsDataURL(b.response)}else console.error("Failed to load "+r.src+": "+b.statusText),0===--h&&a()};b.open("GET",r.src,!0);b.send()}});0===--h&&a()}function lb(a,h,c){for(c||(c="0");a.length<h;)a=c+a;return a}function gd(){null!==Fb&&(window.URL.revokeObjectURL(Fb),Fb=null)}function hd(a){Yd(function(){var h=y;try{y=new a;y.width=da;y.height=ca;n();var c=y.toBlob();Fb=window.URL.createObjectURL(c);id(Fb)}finally{y=
-h}})}function Gb(a){var h=null,c=1E6,r;console.log("getElementAtMouse");for(var b=0;b<u.gslp.length;b++){var d=u.gslp[b];if(!d.pinned&&!1!==d.visible&&!0!==d.tmp){var e,f,k,m=z.drawingstate.matrix.sdet;if("P"===d.kind){var n=g.normalizeZ(d.homog);if(!g._helper.isAlmostReal(n))continue;e=n.value[0].value.real-a.x;f=n.value[1].value.real-a.y;k=Math.sqrt(e*e+f*f);d.narrow&k>20/m&&(k=1E4)}else if("C"===d.kind)f=u.csnames[d.args[0]],k=0,"undefined"!==typeof d.radius&&(k=d.radius.value.real),e=l.div(f.homog.value[0],
-f.homog.value[2]).value.real,f=l.div(f.homog.value[1],f.homog.value[2]).value.real,e-=a.x,f-=a.y,k=Math.sqrt(e*e+f*f)-k,f=e=0,0>k&&(k=-k),k+=30/m;else if("L"===d.kind||"S"===d.kind)e=d.homog,k=l,f=k.add(k.mult(e.value[0],k.conjugate(e.value[0])),k.mult(e.value[1],k.conjugate(e.value[1]))),f=g.scaldiv(k.sqrt(f),e),k=f.value[0].value.real*a.x+f.value[1].value.real*a.y+f.value[2].value.real,e=f.value[0].value.real*k,f=f.value[1].value.real*k,0>k&&(k=-k),k+=1;k<c+.2/m&&(c=k,h=d,r={x:e,y:f})}}return null===
-h?null:{mover:h,offset:r,prev:{x:a.x,y:a.y}}}function Ta(){return"P"+Zd++}function qb(a){var h=G[qc].actions;h[sb].event===a&&h[sb]["do"]()&&(e(),sb===h.length-1?(ua=[],sb=Ua=0):sb++)}function rc(a){return a&&.5>Math.abs(a.offset.x)&&.5>Math.abs(a.offset.y)&&!a.mover.tmp}function jd(a){return rc(a)&&"P"===a.mover.kind}function kd(a){return rc(a)&&("L"===a.mover.kind||"S"===a.mover.kind)}function sc(a){fa={mover:a,offset:{x:0,y:0},prev:{x:X.x,y:X.y}}}function mb(){var a=Gb(X);jd(a)?ua[Ua]=a.mover:
-(ua[Ua]={type:"Free",name:Ta(),labeled:!0,pos:[ta[0],ta[1],1]},Ha(ua[Ua]));Ua++}function ld(){var a=Gb(X);return kd(a)?(ua[Ua]=a.mover,Ua++,!0):!1}function md(){var a=Gb(X),h;(h=kd(a))||(h=rc(a)&&"C"===a.mover.kind);return h?(ua[Ua]=a.mover,Ua++,!0):!1}function tb(){var a=Gb(X);if(jd(a))for(Hb.args[1]=a.mover.name,a=0;a<u.gslp.length;a++){var h=u.gslp[a];!0===h.tmp&&nd(h.name)}else for(a=0;a<u.gslp.length;a++)h=u.gslp[a],!0===h.tmp&&(h.tmp=!1)}function Sb(a){var h={type:"Free",name:Ta(),labeled:!0,
-pos:[ta[0],ta[1],1],tmp:!0},h=Ha(h);Hb=Ha({type:a,name:Ta(),labeled:!0,args:[ua[0].name,h.name]});sc(h)}function $d(a){for(var h in a)null!==a[h]&&(la[h]=a[h])}function Md(a){Object.keys(m).forEach(function(a){var c=m[a];eb(c.signature||"_helper"===a,a+" has no signature");void 0!==c.updatePosition&&void 0===c.stateSize&&(c.stateSize=0)});u.gslp=[];u.csnames={};u.points=[];u.lines=[];u.conics=[];u.texts=[];u.free=[];u.polygons=[];a.forEach(od);pd()}function qd(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 ae(a){void 0===a.size&&(a.size=la.pointSize);a.size=l.real(a.size);!a.movable||a.pinned?(a.color=g.realVector(a.color||la.pointColor),a.color=g.scalmult(l.real(la.dimDependent),a.color)):a.color=g.realVector(a.color||la.pointColor);void 0===a.alpha&&(a.alpha=la.alpha);a.alpha=l.real(a.alpha);a.drawtrace&&
-qd(a)}function Tb(a){void 0===a.size&&(a.size=la.lineSize);a.size=l.real(a.size);a.color=g.realVector(a.color||la.lineColor);void 0===a.alpha&&(a.alpha=la.alpha);a.alpha=l.real(a.alpha);a.clip=w.string(a.clip||la.clip);void 0===a.overhang&&(a.overhang=la.overhangLine);a.overhang=l.real(a.overhang);a.dashtype&&(a.dashtype=w.wrap(a.dashtype))}function be(a){void 0===a.overhang&&(a.overhang=la.overhangSeg);a.arrow&&(a.arrow=w.bool(a.arrow));a.arrowsize&&(a.arrowsize=l.real(a.arrowsize));a.arrowposition&&
-(a.arrowposition=l.real(a.arrowposition));a.arrowshape&&(a.arrowshape=w.string(a.arrowshape));a.arrowsides&&(a.arrowsides=w.string(a.arrowsides));Tb(a);a.clip=w.string("end")}function ce(a){a.size=void 0!==a.textsize?a.textsize:void 0!==a.size?a.size:la.textsize;a.size=l.real(+a.size)}function de(a){a.filled=void 0!==a.filled?w.bool(a.filled):w.bool(!0);a.fillcolor=void 0===a.fillcolor?k:g.realVector(a.fillcolor);void 0===a.fillalpha&&(a.fillalpha=0);a.fillalpha=l.real(a.fillalpha);Tb(a)}function Ha(a){a=
-od(a);pd();return a}function od(a){var h;if(void 0!==u.csnames[a.name])return console.log("Element name '"+a.name+"' already exists"),h=u.csnames[a.name],m[h.type].isMovable&&"P"===m[h.type].kind&&Ia(h,a.pos,"homog"),{ctype:"geo",value:h};for(;tc.hasOwnProperty(a.type);)a.type=tc[a.type];if(h=rd[a.type]){var c=h(a),r=null;for(h=0;h<c.length;++h)r=Ha(c[h]);return r}var b=m[a.type],c=!1;if(!b)return console.error(a),console.error("Operation "+a.type+" not implemented yet"),null;if("**"!==b.signature)if(!Array.isArray(b.signature)&&
-"*"===b.signature.charAt(1))c=!0,a.args.forEach(function(c){if(u.csnames[c].kind!==b.signature.charAt(0))return console.error("Not all elements in set are of same type: "+a.name+" expects "+b.signature+" but "+c+" is of kind "+u.csnames[c].kind),"undefined"!==typeof window&&window.alert("Not all elements in set are of same type: "+a.name),null});else if(b.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(h=0;h<a.args.length;++h){if(!u.csnames.hasOwnProperty(a.args[h]))return console.log("Dropping "+a.name+" due to missing argument "+a.args[h]),null;if("**"!==b.signature&&!c&&(r=u.csnames[a.args[h]].kind,b.signature[h]!==r&&("S"!==r||"L"!==b.signature[h])))return window.alert("Wrong argument kind "+r+" as argument "+h+" to element "+a.name+" of type "+a.type),null}b.signatureConstraints&&!b.signatureConstraints(a)&&window.alert("signature constraints violated for element "+
-a.name);u.gslp.push(a);u.csnames[a.name]=a;h=za.length;a.kind=b.kind;a.stateIdx=h;h+=b.stateSize;a.incidences=[];a.isshowing=!0;a.movable=!1;b.isMovable&&(a.movable=!0,u.free.push(a));"P"===a.kind&&(u.points.push(a),ae(a));"L"===a.kind&&(u.lines.push(a),Tb(a));"C"===a.kind&&(u.conics.push(a),Tb(a));"S"===a.kind&&(u.lines.push(a),be(a));"Text"===a.kind&&(u.texts.push(a),ce(a));"Poly"===a.kind&&(u.polygons.push(a),de(a));ee(h);ma=Ma=za;fb=!0;b.initialize&&(va=Aa=a.stateIdx,a.param=b.initialize(a),eb(Aa===
-a.stateIdx+b.stateSize,"State fully initialized"));va=Aa=a.stateIdx;b.updatePosition(a,!1);eb(va===a.stateIdx+b.stateSize,"State fully consumed");eb(Aa===a.stateIdx+b.stateSize,"State fully updated");fb=!1;ma=db["in"];ma.set(za);Ma=db.out;uc(a,b);Ub={};gb(a);return u.csnames[a.name]}function nd(a){var h,c;console.log("Remove element "+a);delete u.csnames[a];for(h=0;h<u.gslp.length;h++)c=u.gslp[h],c.name===a&&(console.log("Removed element from gslp "+a),u.gslp.splice(h,1));for(h=0;h<u.free.length;h++)c=
-u.free[h],c.name===a&&(console.log("Removed element from free "+a),u.free.splice(h,1));for(h=0;h<u.points.length;h++)c=u.points[h],c.name===a&&(console.log("Removed element from points "+a),u.points.splice(h,1));for(h=0;h<u.lines.length;h++)c=u.lines[h],c.name===a&&(console.log("Removed element from lines "+a),u.lines.splice(h,1));for(h=0;h<u.conics.length;h++)c=u.conics[h],c.name===a&&(console.log("Removed element from conics "+a),u.conics.splice(h,1));Ub={}}function sd(a,h){var c=u.csnames[h.args[0]].homog,
-r=u.csnames[h.args[1]].homog,b=a.homog,d=l.div(c.value[0],c.value[2]),c=l.div(c.value[1],c.value[2]),g=l.div(r.value[0],r.value[2]),r=l.div(r.value[1],r.value[2]),e=l.div(b.value[0],b.value[2]),b=l.div(b.value[1],b.value[2]);return l._helper.isAlmostReal(d)&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(g)&&l._helper.isAlmostReal(r)&&l._helper.isAlmostReal(e)&&l._helper.isAlmostReal(b)?(d=d.value.real,c=c.value.real,g=g.value.real,r=r.value.real,e=e.value.real,b=b.value.real,d=Math.sqrt((d-g)*
-(d-g)+(c-r)*(c-r))-Math.sqrt((d-e)*(d-e)+(c-b)*(c-b))-Math.sqrt((g-e)*(g-e)+(r-b)*(r-b)),1E-15>d*d):!1}function uc(a,h){a.isshowing=!0;if(a.args)for(var c=0;c<a.args.length;c++)if(!u.csnames[a.args[c]].isshowing){a.isshowing=!1;return}h.visiblecheck&&h.visiblecheck(a)}function Sd(a){a._bbox=null;if(a.isshowing&&!1!==a.visible){var h={size:a.size},c=a.homog,r=a.text,b=m[a.type].getText,r=b?b(a):r.replace(/@[$#]"([^"\\]|\\.)*"/g,function(a){var c,h;try{if(c=JSON.parse(a.substring(2)),h=u.csnames[c],
-!h)return"?"}catch(r){return"?"}switch(a.charAt(1)){case "$":return h.printname||c;case "#":return"V"!==h.kind?"?":ba(h.value)}}),b=null;if(a.html)var d=a._textCache||{text:!1},g=a.html,e=g.parentNode,f=e.parentNode,b=function(c,h,r,b,na){d.invisible&&f.style.removeProperty("display");if(c!==d.text||h!==d.font||r!==d.x||b!==d.y||na!==d.align){h!==d.font&&(g.style.font=h,g.style.lineHeight=la.lineHeight);c!==d.text&&!1!==c&&!1===td(g,c,h)&&(c=!1);f.style.left=r+"px";f.style.top=b+"px";if(na||e.style.transform)e.style.transform=
-"translateX("+-100*na+"%)";a._textCache={text:c,font:h,x:r,y:b,align:na}}};r=w.string(r);a.dock&&(a.dock.to?c=u.csnames[a.dock.to].homog:ud.hasOwnProperty(a.dock.corner)&&(c=t.screenbounds$0([],{}),c=c.value[ud[a.dock.corner]]),h.offset=a.dock.offset);a.align&&(h.align=w.string(a.align));c&&(a._bbox=D.drawtext([c,r],h,b))}else a.html&&(a.html.parentNode.parentNode.style.display="none",a._textCache={invisible:!0})}function Rd(){function a(){var a=e++/c._traces.length,h=c._traces[g];h&&(a*=r*a*a,t.draw$1([h],
-{size:l.real(b),color:c.color,alpha:l.real(a)}));b*=d}for(var h=0;h<u.points.length;h++){var c=u.points[h];if(c.drawtrace){c._traces_tick===c.traceskip?(c._traces[c._traces_index]=c.homog,c._traces_index=(c._traces_index+1)%c._traces.length,c._traces_tick=0):c._traces_tick++;var r=c.alpha.value.real,b=c.size.value.real,d=1;1!==c.tracedim&&(b*=c.tracedim,d=Math.pow(c.tracedim,-1/c._traces.length));var g,e=0;for(g=c._traces_index;g<c._traces.length;++g)a();for(g=0;g<c._traces_index;++g)a()}}}function eb(a,
-h){var c="Assertion failed: "+h;if(!a)throw console.log(c),Qa(),"undefined"!==typeof alert&&alert(c),Error(c);}function ee(a){if(a!==za.length){var h,c,r=vc.length;hb.length<a*r?(h=2*a,hb=new Float64Array(r*h)):h=hb.length/r|0;for(c=0;c<r;++c)db[vc[c]]=hb.subarray(c*h,c*h+a);a=za;ma=db["in"];Ma=db.out;za=db.good;za.set(a)}}function ub(){za.set(ma);Ja=!1;vd(!1);for(var a=za.length,h=Math.abs,c=0;c<a;c+=2)h(za[c])>1E12*h(za[c+1])&&(za[c+1]=0)}function Vb(){if(vb)Ja=!0;else throw wd;}function xd(a,h,
-c,r,b){return w.add(r,w.mult(c,w.sub(b,r)))}function Qd(){L&&(L.currentMouseAndScripts=[]);wc=!0;if(fa){var a=fa.mover,h=g.realVector([X.x+fa.offset.x,X.y+fa.offset.y,1]);yd(a,h,"mouse");fa.prev.x=X.x;fa.prev.y=X.y}A(S.move);A(S.draw);Ja||ub();wc=!1;L&&(L.fullLog.push(g.turnIntoCSList([g.turnIntoCSList(L.currentMouseAndScripts)])),L.length>L.logLength&&L.splice(0,L.length-L.logLength),L.currentMouseAndScripts=null,L.postMouseHooks.forEach(function(a){a()}))}function Ia(a,h,c){yd(a,h,c);wc||Ja||ub()}
-function yd(a,h,c){L&&L.currentMouseAndScripts&&(L.currentMover=[]);a===zd?(ma.set(za),Ja=!1):(zd=a,ub());Ma.set(ma);var r=1E4,b;b=Ub[a.name];if(!b){var d={},e=0;b=[];d[a.name]=a;for(var f=u.gslp,k=0;k<f.length;++k){var n=f[k],p=n.args;if(p)for(var q=0;q<p.length;++q)d.hasOwnProperty(p[q])&&(d[n.name]=n,b[e++]=n)}Ub[a.name]=b}var d=-1,e=.9,t,v,x,f=m[a.type],k=f.parameterPath||xd;va=a.stateIdx;n=f.getParamFromState(a);va=Aa=a.stateIdx;p=f.getParamForInput(a,h,c);for(q=d+e;d!==q;){var y=q*q,z=.5/(1+
-y),z=l.complex(2*q*z+.5,(1-y)*z);vb=d+.5*e<=d||0===r;0===r&&console.log("tracing limit Reached");y=!1;L&&L.currentMouseAndScripts&&(L.currentStep=[]);try{va=Aa=a.stateIdx;var A=k(a,q,z,n,p);L&&(L.currentParam=A);z=Ma;Ma=ma;f.putParamToState(a,A);Ma=z;Aa=a.stateIdx;L&&(L.currentElement=a);f.updatePosition(a,!0);eb(va===a.stateIdx+f.stateSize,"State fully consumed");eb(Aa===a.stateIdx+f.stateSize,"State fully updated");for(t=0;t<b.length;++t)v=b[t],x=m[v.type],va=Aa=v.stateIdx,L&&(L.currentElement=
-v),x.updatePosition(v,!1),eb(va===v.stateIdx+x.stateSize,"State fully consumed"),eb(Aa===v.stateIdx+x.stateSize,"State fully updated");L&&(L.currentElement=null);d=q;e*=1.25;q+=e;1<=q&&(q=1);Ma=ma;ma=z}catch(B){if(B!==wd)throw B;e*=.5;q=d+e;--r;y=!0}L&&L.currentMouseAndScripts&&(L.currentMover.push(g.turnIntoCSList([g.turnIntoCSList(L.currentStep),w.wrap(y),w.wrap(d),w.wrap(q),w.wrap(L.currentParam)])),L.currentStep=null,L.currentParam=null)}vd(Ja);for(t=0;t<b.length;++t)v=b[t],x=m[v.type],uc(v,x);
-L&&L.currentMouseAndScripts&&(L.currentMouseAndScripts.push(g.turnIntoCSList([g.turnIntoCSList(L.currentMover),w.wrap(Ja),w.wrap(a.name),h,w.wrap(c),n,p])),L.currentMover=null)}function Nd(){ub();vb=!0;for(var a=u.gslp,h=0;h<a.length;h++){var c=a[h],r=m[c.type];va=Aa=c.stateIdx;r.updatePosition(c,!1);uc(c,r)}a=Ma;Ma=ma;ma=a;ub()}function vd(a){var h=p.tracingStateReport;"string"===typeof h&&(document.getElementById(h).textContent=a?"BAD":"GOOD")}function fe(){return g.turnIntoCSList(L.fullLog.slice())}
-function ge(a){var h=JSON.stringify(L.fullLog);a=new Blob([h],{type:a?"application/octet-stream":"application/json"});return window.URL.createObjectURL(a)}function wb(){var a=va;va+=2;return l.complex(ma[a],ma[a+1])}function Z(a){for(var h=Array(a),c=0;c<a;++c)h[c]=wb();return g.turnIntoCSList(h)}function Va(a){Ma[Aa]=a.value.real;Ma[Aa+1]=a.value.imag;Aa+=2}function T(a){for(var h=0,c=a.value.length;h<c;++h)Va(a.value[h])}function Na(a,h){var c=Z(3),r=Z(3),c=Ad(a,h,c,r);T(c[0]);T(c[1]);return g.turnIntoCSList(c)}
-function Ad(a,h,c,r){if(fb)return[a,h];var b=g.projectiveDistMinScal(c,a),d=g.projectiveDistMinScal(c,h),e=g.projectiveDistMinScal(r,a),f=g.projectiveDistMinScal(r,h),l=g.projectiveDistMinScal(c,r),m=g.projectiveDistMinScal(a,h),n=b+f,p=d+e,q;n>p?(q=[h,a],n=p):q=[a,h];p=function(){};if(L&&L.currentStep){var t=[L.labelTracing2,w.wrap(L.currentElement.name),g.turnIntoCSList(q),g.turnIntoCSList([c,r]),g.realMatrix([[b,d],[e,f]]),w.wrap(n),w.wrap(l),w.wrap(m),k];L.currentStep.push(g.turnIntoCSList(t));
-p=function(a){L.hasOwnProperty(a)||(L[a]=w.wrap(a));t[t.length-1]=L[a]}}g._helper.isNaN(a)||g._helper.isNaN(h)?(p("Tracing failed due to NaNs."),Ja=!0):l>3*n&&m>3*n?p("Normal case, everything all right."):1E-5>m?1E-5>l?p("Staying inside singularity."):(p("Moved into singularity."),Ja=!0):1E-5>l?p("Moved out of singularity."):(vb?p("Reached refinement limit, giving up."):p("Need to refine."),Vb());return q}function xc(a,h,c,r){var b=Z(3),d=Z(3),e=Z(3),f=Z(3);a=he(a,h,c,r,b,d,e,f);T(a[0]);T(a[1]);T(a[2]);
-T(a[3]);return g.turnIntoCSList(a)}function he(a,h,c,r,b,d,e,f){var l=function(){};b=[b,d,e,f];a=[a,h,c,r];if(fb)return a;d=0;r=Array(4);for(c=0;4>c;c++)for(r[c]=Array(4),f=0;4>f;f++)e=g.projectiveDistMinScal(b[c],a[f]),r[c][f]=e;e=nc(r);h=Array(4);for(c=0;4>c;++c)h[c]=a[e[c]],d+=r[c][e[c]];var m=1*d,n=Infinity,p=Infinity;for(c=0;4>c;c++){if(g._helper.isNaN(a[c]))return l("Tracing failed due to NaNs."),Ja=!0,h;for(f=c+1;4>f;f++)e=g.projectiveDistMinScal(b[c],b[f]),n>e&&(n=e),e=g.projectiveDistMinScal(h[c],
-h[f]),p>e&&(p=e)}if(L&&L.currentStep){var q=[L.labelTracing4,w.wrap(L.currentElement.name),g.turnIntoCSList(h),g.turnIntoCSList(b),g.realMatrix(r),w.wrap(d),w.wrap(n),w.wrap(p),k];L.currentStep.push(g.turnIntoCSList(q));l=function(a){L.hasOwnProperty(a)||(L[a]=w.wrap(a));q[q.length-1]=L[a]}}n>m&&p>m||(1E-5>p?1E-5>n?l("Staying inside singularity."):(l("Moved into singularity."),Ja=!0):1E-5>n?l("Moved out of singularity."):(vb?l("Reached refinement limit, giving up."):l("Need to refine."),Vb()));return h}
-function Bd(a){var h=a.length,c,r;if(fb){for(c=0;c<h;++c)va+=2*a[c].value.length,T(a[c]);return a}var b=Array(h),d=Array(h),e=Array(h),f=99,l=99,m=Array(h);for(c=0;c<h;++c)b[c]=Z(a[c].value.length),d[c]=g.normSquared(b[c]).value.real,e[c]=g.normSquared(a[c]).value.real,m[c]=Array(h);var n;for(c=0;c<h;++c){for(r=0;r<h;++r)n=g.sesquilinearproduct(b[c],a[r]).value,n=(n.real*n.real+n.imag*n.imag)/(d[c]*e[r]),m[c][r]=1-n;for(r=c+1;r<h;++r)n=g.sesquilinearproduct(b[c],b[r]).value,n=(n.real*n.real+n.imag*
-n.imag)/(d[c]*d[r]),f>1-n&&(f=1-n),n=g.sesquilinearproduct(a[c],a[r]).value,n=(n.real*n.real+n.imag*n.imag)/(e[c]*e[r]),l>1-n&&(l=1-n)}n=nc(m);r=Array(h);d=0;e=!1;for(c=0;c<h;++c){var d=d+m[c][n[c]],p=r[c]=a[n[c]];T(p);e|=g._helper.isNaN(p)}e|=isNaN(d);a=function(){};if(L&&L.currentStep){var q=[L.labelTracingSesq,w.wrap(L.currentElement.name),g.turnIntoCSList(r),g.turnIntoCSList(b),g.realMatrix(m),w.wrap(d),w.wrap(f),w.wrap(l),k];L.currentStep.push(g.turnIntoCSList(q));a=function(a){L.hasOwnProperty(a)||
-(L[a]=w.wrap(a));q[q.length-1]=L[a]}}e?(a("Tracing failed due to NaNs."),Ja=!0):f>3*d&&l>3*d?a("Normal case, everything all right."):1E-5>l?1E-5>f?a("Staying inside singularity."):(a("Moved into singularity."),Ja=!0):1E-5>f?a("Moved out of singularity."):(vb?a("Reached refinement limit, giving up."):a("Need to refine."),Vb());return r}function gb(a){if(gb.hasOwnProperty(a.kind))gb[a.kind](a)}function Cd(a,h){return function(){a.incidences.push(h.name);h.incidences.push(a.name)}}function Dd(a,h){return{toString:function(){return"point "+
-a.name+" incident line "+h.name},apply:Cd(a,h),holds:function(){var c=g.scaldiv(g.abs(a.homog),a.homog),r=g.scaldiv(g.abs(h.homog),h.homog);return 1E-13>l.abs(g.scalproduct(c,r)).value.real}}}function Ed(a,h){return{toString:function(){return"point "+a.name+" incident conic "+h.name},apply:Cd(a,h),holds:function(){var c=w.mult(h.matrix,a.homog),c=w.mult(a.homog,c),c=l.abs(c);1E-13>c.value.real&&(a.incidences.push(h.name),h.incidences.push(a.name))}}}function pd(){if(0!==ib.length){for(var a=0;a<ib.length;++a)ib[a].apply();
-ib=[]}}function yc(a,h,c){var r=document.createElement("div"),b=document.createElement("img");b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAPoCAQAAAC1v1zVAAAAGklEQVR42u3BMQEAAADCoPVPbQ0PoAAAgHcDC7gAAVI8ZnwAAAAASUVORK5CYII=";r.className="CindyJS-baseline";r.appendChild(b);b=document.createElement("div");b.className="CindyJS-button";r.appendChild(b);for(var d=2;d<arguments.length;++d)b.appendChild(arguments[d]);ka.parentNode.appendChild(r);a.html=arguments[arguments.length-1];Fa(a.fillalpha)||
-(a.fillalpha=1);a.fillcolor&&(a.html.style.backgroundColor=x.makeColor(a.fillcolor,a.fillalpha));r=e;if(a.script)var g=Ra(a.script),r=function(){A(g);e()};c.addEventListener(h,r);!p.keylistener&&(S.keydown||S.keyup||S.keytyped)&&(c.addEventListener("keydown",function(a){9!==a.keyCode&&N(a,S.keydown)}),c.addEventListener("keyup",function(a){N(a,S.keyup)}),c.addEventListener("keypress",function(a){9!==a.keyCode&&N(a,S.keytyped)}));m.Text.initialize(a)}function Pa(){}function ie(a){if(!/^Select/.test(a.type)&&
-!m[a.type].isMovable)return null;var h=w.unwrap,c=l.add;switch(a.kind){case "P":case "L":case "Text":return h(a.homog);case "C":return a=a.matrix.value,{xx:h(a[0].value[0]),yy:h(a[1].value[1]),zz:h(a[2].value[2]),xy:h(c(a[0].value[1],a[1].value[0])),xz:h(c(a[0].value[2],a[2].value[0])),yz:h(c(a[1].value[2],a[2].value[1]))};default:return null}}function je(a){var h={};h.offset=w.unwrap(a.offset);a.to&&(h.to=a.to);a.corner&&(h.corner=a.corner);return h}function ke(a){var h={};le.forEach(function(c){if(a.hasOwnProperty(c)){var b=
-w.unwrap(a[c]);null!==b&&void 0!==b&&(h[c]=b)}});if("P"===a.kind&&(!a.movable||a.pinned)&&h.color){var c=l.real(1/la.dimDependent);h.color=w.unwrap(g.scalmult(c,a.color))}if(c=ie(a))h.pos=c;a.dock&&(h.dock=je(a.dock));return h}function me(){var a=[];u.gslp.forEach(function(h){h.tmp||a.push(ke(h))});return a}function Od(){Ba.forEach(function(a){var h=(a.geo||[]).map(function(a){return u.csnames[a]});O[a.type].reset(a,h[0],h)})}function ec(a){ic=0!==a.length;Ba=[];ga=[];zc=[];O.Environment.init({});
-a.forEach(function(a){a.behavior?(a.name&&(a.behavior.geo=[a.name]),a=a.behavior,a.gravity&&(a.gravity=-a.gravity)):c=a.geo;var c=(a.geo||[]).map(function(a){return u.csnames[a]}),r=c[0],b=O[a.type];b?(b.init&&b.init(a,r,c),r&&(r.behavior=a,"Mass"===a.type?ga.push(r):"Spring"===a.type&&zc.push(r)),Ba.push(a)):(console.error(a),console.error("Behavior "+a.type+" not implemented yet"))})}var wa=this,ia,S={},Ya=!1,Ob=!0,Cb=0,Oc=.5,hc=0,Mb=10,Fd=5/360,Pd=.32/Fd/1E3*2,Kb=1,Wa=0,bc=0,cc=!1,zb=!1,ka,yb,
-Fa=Number.isFinite||function(a){return"number"===typeof a&&isFinite(a)},ta,y,da,ca,u,Xa,kc=k,lc=k,Sa={play:Pa,pause:Pa,stop:Pa},gc=null,Ab=function(a,h){var c=[];Ab=function(a,h){c.push({img:a,id:h})};Ab(a,h);var r=wa.getBaseDir()+"images/Icons.svg",b=new XMLHttpRequest;b.onreadystatechange=function(){if(b.readyState===XMLHttpRequest.DONE)if(200!==b.status)console.error("Failed to load CindyJS Icons.svg from "+r+": "+b.statusText);else{var a=b.responseXML,h=a.documentElement,d={},g,e;for(g=h.firstChild;g;g=
-e)e=g.nextSibling,g.nodeType===Node.ELEMENT_NODE&&"http://www.w3.org/2000/svg"===g.namespaceURI&&"g"===g.localName.toLowerCase()&&(h.removeChild(g),g.setAttribute("style","display:inline"),d[g.getAttribute("id")]=g);var f=new XMLSerializer;Ab=function(c,r){if(d.hasOwnProperty(r)){var b=d[r];h.appendChild(b);var g;try{g=f.serializeToString(a)}finally{h.removeChild(b)}c.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(g)}};c.forEach(function(a){Ab(a.img,a.id)});c=null}};b.responseType="document";
-b.open("GET",r);b.send()},Pc=1,Bb=null,jb=[],jc=!1,oa={config:p,startup:W,shutdown:Qa,evokeCS:function(a){a=Ra(a,!1);console.log(a);A(a);e()},play:I,pause:Ca,stop:Da,evalcs:function(a){return A(Ra(a,!1))},parse:function(a){return Ra(a)},niceprint:ba,canvas:null},ac=!1,Lb=0;p.use&&p.use.forEach(function(a){var h=null;p.plugins&&(h=p.plugins[a]);h||(h=wa._pluginRegistry[a]);h||(++Lb,console.log("Loading script for plugin "+a),wa.loadScript(a+"-plugin",a+"-plugin.js",function(){console.log("Successfully loaded plugin "+
-a);0===--Lb&&ac&&W()},function(){console.error("Failed to auto-load plugin "+a);0===--Lb&&ac&&W()}))});xb.prototype=new ab;cb.prototype=new ab;qa.prototype=new ab;var X={},fa,Qc="",Rc=0,Pb;Pb=p.isNode?process.nextTick:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,0)};var mc=null,ne=[0,8,4,0,"gbb244ca"],l={_helper:{}};l._helper.roundingfactor=1E4;l._helper.angleroundingfactor=
-10;l._helper.niceround=function(a,h){return Math.round(a*h)/h};l.niceprint=function(a,h){h=h||l._helper.roundingfactor;if("Angle"===a.usage)return l._helper.niceangle(a);var c=l._helper.niceround(a.value.real,h),r=l._helper.niceround(a.value.imag,h);return 0===r?""+c:0<r?""+c+" + i*"+r:""+c+" - i*"+-r};var Ac=p.angleUnit||"\u00b0",oe=Ac.replace(/\s+/g,""),Gd=2*Math.PI,pe=1/Gd,qe={rad:Gd,"\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 h=qe[oe];if(!h)return l.niceprint(w.withUsage(a,null));if("function"===typeof h)return h(a);a=l.niceprint(l.realmult(h*pe,a),200<h?l._helper.angleroundingfactor:null);return-1===a.indexOf("i*")?a+Ac:"("+a+")"+Ac};l.complex=function(a,h){return{ctype:"number",value:{real:a,imag:h}}};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,h){return a.value.real*a.value.real+a.value.imag*a.value.imag<h.value.real*h.value.real+h.value.imag*h.value.imag?h:a};l.max=function(a,h){return{ctype:"number",value:{real:Math.max(a.value.real,h.value.real),imag:Math.max(a.value.imag,h.value.imag)}}};l.min=function(a,h){return{ctype:"number",value:{real:Math.min(a.value.real,h.value.real),imag:Math.min(a.value.imag,h.value.imag)}}};l.add=function(a,h){return{ctype:"number",value:{real:a.value.real+
-h.value.real,imag:a.value.imag+h.value.imag}}};l.sub=function(a,h){return{ctype:"number",value:{real:a.value.real-h.value.real,imag:a.value.imag-h.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,h){return{ctype:"number",value:{real:a.value.real*h.value.real-a.value.imag*h.value.imag,imag:a.value.real*h.value.imag+a.value.imag*h.value.real}}};l.realmult=function(a,h){return{ctype:"number",
-value:{real:a*h.value.real,imag:a*h.value.imag}}};l.multiMult=function(a){var h=a[0];if("number"!==h.ctype)return k;for(var c=1;c<a.length;c++){if("number"!==a[c].ctype)return k;h=l.mult(h,a[c])}return h};l.abs2=function(a,h){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 h=a.value.real*a.value.real+a.value.imag*a.value.imag;return{ctype:"number",value:{real:a.value.real/h,imag:-a.value.imag/
-h}}};l.div=function(a,h){var c=a.value.real,r=a.value.imag,b=h.value.real,d=h.value.imag,g=b*b+d*d;return{ctype:"number",value:{real:(c*b+r*d)/g,imag:(r*b-c*d)/g}}};l.eps=1E-10;l.epsbig=1E-6;l.snap=function(a){var h=a.value.real;a=a.value.imag;Math.floor(h+l.eps)!==Math.floor(h-l.eps)&&(h=Math.round(h));Math.floor(a+l.eps)!==Math.floor(a-l.eps)&&(a=Math.round(a));return{ctype:"number",value:{real:h,imag:a}}};l.exp=function(a){var h=Math.exp(a.value.real);return{ctype:"number",value:{real:h*Math.cos(a.value.imag),
-imag:h*Math.sin(a.value.imag)}}};l.cos=function(a){var h=a.value.real;a=a.value.imag;var c=Math.exp(a),r=c*Math.sin(-h),b=c*Math.cos(-h),c=Math.exp(-a);return{ctype:"number",value:{real:(b+c*Math.cos(h))/2,imag:(r+c*Math.sin(h))/2}}};l.sin=function(a){var h=a.value.real;a=a.value.imag;var c=Math.exp(a),r=c*Math.sin(-h),b=c*Math.cos(-h),c=Math.exp(-a);return{ctype:"number",value:{real:-(r-c*Math.sin(h))/2,imag:(b-c*Math.cos(h))/2}}};l.tan=function(a){var h=l.sin(a);a=l.cos(a);return l.div(h,a)};l.arccos=
-function(a){var h=l.mult(a,l.neg(a)),h=l.sqrt(l.add(l.real(1),h));a=l.add(l.mult(a,l.complex(0,1)),h);a=l.add(l.mult(l.log(a),l.complex(0,1)),l.real(.5*Math.PI));return w.withUsage(a,"Angle")};l.arcsin=function(a){var h=l.mult(a,l.neg(a)),h=l.sqrt(l.add(l.real(1),h));a=l.add(l.mult(a,l.complex(0,1)),h);a=l.mult(l.log(a),l.complex(0,-1));return w.withUsage(a,"Angle")};l.arctan=function(a){var h=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)));h=l.mult(l.sub(h,
-a),l.complex(0,.5));return w.withUsage(h,"Angle")};l.arctan2=function(a,h){var c;if(void 0===h)c=l.real(Math.atan2(a.value.imag,a.value.real));else if(l._helper.isReal(a)&&l._helper.isReal(h))c=l.real(Math.atan2(h.value.real,a.value.real));else{c=l.add(a,l.mult(l.complex(0,1),h));var r=l.sqrt(l.add(l.mult(a,a),l.mult(h,h)));c=l.mult(l.complex(0,-1),l.log(l.div(c,r)))}return w.withUsage(c,"Angle")};l.sqrt=function(a){var h=a.value.real,c=a.value.imag;a=Math.sqrt(Math.sqrt(h*h+c*c));h=Math.atan2(c,
-h);return{ctype:"number",value:{real:a*Math.cos(h/2),imag:a*Math.sin(h/2)}}};l.powRealExponent=function(a,h){var c=a.value.real,r=a.value.imag,b=Math.pow(Math.sqrt(c*c+r*r),h),c=Math.atan2(r,c);return{ctype:"number",value:{real:b*Math.cos(c*h),imag:b*Math.sin(c*h)}}};l.log=function(a){var h=a.value.real;a=a.value.imag;var c=Math.sqrt(h*h+a*a),r=Math.atan2(a,h);0>a&&(r+=2*Math.PI);0===a&&0>h&&(r=Math.PI);r>Math.PI&&(r-=2*Math.PI);return l.snap({ctype:"number",value:{real:Math.log(c),imag:r}})};l.pow=
-function(a,h){return l._helper.isZero(h)?l.one:l._helper.isZero(a)?l.zero:l._helper.isReal(h)?l.powRealExponent(a,h.value.real):l.exp(l.mult(l.log(a),h))};l.mod=function(a,h){var c=a.value.real,r=h.value.real,b=a.value.imag,d=h.value.imag,c=c-Math.floor(c/r)*r,b=b-Math.floor(b/d)*d;0===r&&(c=0);0===d&&(b=0);return l.snap({ctype:"number",value:{real:c,imag:b}})};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=a-Math.floor(a);return l._helper.seed=a};l._helper.randnormal=function(){var a=l._helper.rand(),h=l._helper.rand();return Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*h)};l._helper.isEqual=function(a,h){return a.value.real===h.value.real&&a.value.imag===h.value.imag};l._helper.isLessThan=function(a,h){return a.value.real<h.value.real||a.value.real===h.value.real&&a.value.imag<h.value.imag};l._helper.compare=function(a,h){return l._helper.isLessThan(a,h)?
--1:l._helper.isEqual(a,h)?0:1};l._helper.isAlmostEqual=function(a,h,c){var r=l.eps;"undefined"!==typeof c&&(r=c);c=a.value.real-h.value.real;a=a.value.imag-h.value.imag;return c<r&&c>-r&&a<r&&a>-r};l._helper.isZero=function(a){return 0===a.value.real&&0===a.value.imag};l._helper.isAlmostZero=function(a){var h=a.value.real;a=a.value.imag;return h<l.eps&&h>-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,h,c,r){a=l._helper.solveCubicHelper(a,h,c,r);return[g.scalproduct(l._helper.cub1,a),g.scalproduct(l._helper.cub2,a),g.scalproduct(l._helper.cub3,a)]};l._helper.solveCubicHelper=function(a,h,c,r){var b=a.value.real;a=a.value.imag;var d=h.value.real;h=h.value.imag;var e=c.value.real,f=c.value.imag,k=r.value.real,m=r.value.imag,n=b*e-a*f;c=b*f+a*e;r=4*n-(d*d-h*h);var p=4*c-2*d*h,q=b*d-a*h,t=b*h+a*d,v=r*e-p*f-18*(q*k-t*m),p=r*f+p*e-18*
-(q*m+t*k);r=27*(b*b-a*a);var u=54*a*b,w=r*k-u*m,x=r*m+u*k,z=d*d-h*h,y=2*d*h,A=z*d-y*h,B=z*h+y*d,C=w+4*A,u=x+4*B;r=27*(v*e-p*f+C*k-u*m);p=27*(v*f+p*e+C*m+u*k);C=Math.sqrt(Math.sqrt(r*r+p*p));u=Math.atan2(p,r);p=C*Math.sin(u/2);r=C*Math.cos(u/2);A=-2*A+9*(q*e-t*f)-w+(r*b-p*a);B=-2*B+9*(q*f+t*e)-x+(r*a+p*b);r=Math.exp(Math.log(Math.sqrt(A*A+B*B))/3);e=Math.atan2(B,A);u=r*Math.sin(e/3);p=r*Math.cos(e/3);r*=r;e*=2;n=2*z-6*n;c=2*y-6*c;y=-1.5874010519681996*(d*p-h*u);d=-1.5874010519681996*(d*u+h*p);h=1.2599210498948732*
-r*Math.cos(e/3);e=1.2599210498948732*r*Math.sin(e/3);r=4.762203155904599*(p*b-u*a);p=4.762203155904599*(p*a+u*b);b=r*r+p*p;u=(-n*p+c*r)/b;n=(n*r+c*p)/b;c=u;u=(-y*p+d*r)/b;y=(y*r+d*p)/b;d=u;u=(-h*p+e*r)/b;h=(h*r+e*p)/b;e=u;return g.turnIntoCSList([l.complex(n,c),l.complex(y,d),l.complex(h,e)])};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 h=[],c=0;c<a.length;c++)h[c]={ctype:"number",value:{real:a[c],imag:0}};return{ctype:"list",value:h}};g._helper.unitvector=function(a,h){var c=g.zerovector(a);c.value[Math.floor(h.value.real-1)]=l.real(1);return c};g.idMatrix=function(a){for(var h=g.zeromatrix(a,a),c=l.real(1),r=0;r<a.value.real;r++)h.value[r].value[r]=c;return h};g._helper.flippedidMatrix=function(a){for(var h=g.zeromatrix(a,a),c=l.real(1),r=0;r<a.value.real;r++)h.value[r].value[a.value.real-
-r-1]=c;return h};g.println=function(a){for(var h=[],c=0;c<a.value.length;c++)if("number"===a.value[c].ctype)h[c]=l.niceprint(a.value[c]);else if("list"===a.value[c].ctype)g.println(a.value[c]);else return k;"number"===a.value[0].ctype&&console.log(h)};g.matrix=function(a){return g.turnIntoCSList(a.map(g.turnIntoCSList))};g.realMatrix=function(a){for(var h=a.length,c=Array(h),r=0;r<h;r++)c[r]=g.realVector(a[r]);return g.turnIntoCSList(c)};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,h){for(var c=[],r=0,b=Math.round(a.value.real);b<Math.round(h.value.real)+1;b++)c[r]={ctype:"number",value:{real:b,imag:0}},r++;return{ctype:"list",value:c}};g.pairs=function(a){for(var h=
-[],c=0;c<a.value.length-1;c++)for(var r=c+1;r<a.value.length;r++)h.push({ctype:"list",value:[a.value[c],a.value[r]]});return{ctype:"list",value:h}};g.triples=function(a){for(var h=[],c=0;c<a.value.length-2;c++)for(var r=c+1;r<a.value.length-1;r++)for(var b=r+1;b<a.value.length;b++)h.push({ctype:"list",value:[a.value[c],a.value[r],a.value[b]]});return{ctype:"list",value:h}};g.cycle=function(a){for(var h=[],c=0;c<a.value.length-1;c++)h[c]={ctype:"list",value:[a.value[c],a.value[c+1]]};h.push({ctype:"list",
-value:[a.value[a.value.length-1],a.value[0]]});return{ctype:"list",value:h}};g.consecutive=function(a){for(var h=[],c=0;c<a.value.length-1;c++)h[c]={ctype:"list",value:[a.value[c],a.value[c+1]]};return{ctype:"list",value:h}};g.reverse=function(a){for(var h=Array(a.value.length),c=a.value.length-1,r=0;0<=c;c--,r++)h[r]=a.value[c];return{ctype:"list",value:h}};g.directproduct=function(a,h){for(var c=[],r=0;r<a.value.length;r++)for(var b=0;b<h.value.length;b++)c.push({ctype:"list",value:[a.value[r],
-h.value[b]]});return{ctype:"list",value:c}};g.concat=function(a,h){for(var c=[],r=0;r<a.value.length;r++)c.push(a.value[r]);for(r=0;r<h.value.length;r++)c.push(h.value[r]);return{ctype:"list",value:c}};g.prepend=function(a,h){var c=[];c[0]=a;for(var r=0;r<h.value.length;r++)c[r+1]=h.value[r];return{ctype:"list",value:c}};g.append=function(a,h){for(var c=[],r=0;r<a.value.length;r++)c[r]=a.value[r];c.push(h);return{ctype:"list",value:c}};g.contains=function(a,h){for(var c=0;c<a.value.length;c++)if(D.equals(a.value[c],
-h).value)return{ctype:"boolean",value:!0};return{ctype:"boolean",value:!1}};g.common=function(a,h){for(var c=[],r=0,b=0;b<a.value.length;b++){for(var d=!1,g=a.value[b],e=0;e<h.value.length;e++)d=d||D.equals(g,h.value[e]).value;d&&(c[r]=a.value[b],r++)}return{ctype:"list",value:c}};g.remove=function(a,h){for(var c=[],r=0,b=0;b<a.value.length;b++){for(var d=!1,g=a.value[b],e=0;e<h.value.length;e++)d=d||D.equals(g,h.value[e]).value;d||(c[r]=a.value[b],r++)}return{ctype:"list",value:c}};g.sort1=function(a){a=
-a.value.slice();a.sort(w.compare);return g.turnIntoCSList(a)};g._helper.isEqual=function(a,h){return g.equals(a,h).value};g._helper.isLessThan=function(a,h){for(var c=a.value.length,r=h.value.length,b=0;!(b>=c||b>=r)&&w.isEqual(a.value[b],h.value[b]);)b++;return b===c&&b<r?!0:b===r&&b<c||b===c&&b===r?!1:w.isLessThan(a.value[b],h.value[b])};g._helper.compare=function(a,h){return g._helper.isLessThan(a,h)?-1:g._helper.isEqual(a,h)?0:1};g.equals=function(a,h){if(a.value.length!==h.value.length)return{ctype:"boolean",
-value:!1};for(var c=!0,r=0;r<a.value.length;r++)var b=a.value[r],d=h.value[r],c="list"===b.ctype&&"list"===d.ctype?c&&g.equals(b,d).value:c&&pb([b,d],[]).value;return{ctype:"boolean",value:c}};g.almostequals=function(a,h){if(a.value.length!==h.value.length)return{ctype:"boolean",value:!1};for(var c=!0,r=0;r<a.value.length;r++)var b=a.value[r],d=h.value[r],c="list"===b.ctype&&"list"===d.ctype?c&&g.almostequals(b,d).value:c&&Yb([b,d],[]).value;return{ctype:"boolean",value:c}};g._helper.isAlmostReal=
-function(a){for(var h=!0,c=0;c<a.value.length;c++)var r=a.value[c],h="list"===r.ctype?h&&g._helper.isAlmostReal(r):h&&l._helper.isAlmostReal(r);return h};g._helper.isAlmostZero=function(a){for(var h=0;h<a.value.length;h++){var c=a.value[h];if("list"===c.ctype){if(!g._helper.isAlmostZero(c))return!1}else if(!l._helper.isAlmostZero(c))return!1}return!0};g._helper.isNaN=function(a){for(var h=!1,c=0;c<a.value.length;c++)var r=a.value[c],h="list"===r.ctype?h||g._helper.isNaN(r):h||l._helper.isNaN(r);return h};
-g.set=function(a){var h=[],c=0;a=a.value.slice();a.sort(w.compare);for(var r=0;r<a.length;r++)0!==r&&pb([h[h.length-1],a[r]],[]).value||(h[c]=a[r],c++);return{ctype:"list",value:h}};g.maxval=function(a){for(var h=l.zero,c=0;c<a.value.length;c++){var r=a.value[c];"number"===r.ctype&&(h=l.argmax(h,r));"list"===r.ctype&&(h=l.argmax(h,g.maxval(r)))}return h};g.maxIndex=function(a,h,c){var r=0;void 0!==c&&(r=c);c=r;for(var b=h(a.value[r]).value.real;r<a.value.length;++r){var d=h(a.value[r]).value.real;
-d>b&&(c=r,b=d)}return c};g.normalizeMax=function(a){var h=l.inv(g.maxval(a));return l._helper.isFinite(h)?g.scalmult(h,a):a};g.normalizeZ=function(a){var h=l.inv(a.value[2]);return g.scalmult(h,a)};g.dehom=function(a){a=a.value.slice();var h=a.length-1,c=l.inv(a[h]);a.length=h;for(var r=0;r<h;++r)a[r]=l.mult(c,a[r]);return g.turnIntoCSList(a)};g.normalizeAbs=function(a){var h=l.inv(g.abs(a));return g.scalmult(h,a)};g.max=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=[],r=0;r<
-a.value.length;r++)c[r]=w.max(a.value[r],h.value[r]);return{ctype:"list",value:c}};g.min=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=[],r=0;r<a.value.length;r++)c[r]=w.min(a.value[r],h.value[r]);return{ctype:"list",value:c}};g.scaldiv=function(a,h){if("number"!==a.ctype)return k;for(var c=[],r=0;r<h.value.length;r++){var b=h.value[r];c[r]="number"===b.ctype?w.div(b,a):"list"===b.ctype?g.scaldiv(a,b):k}return{ctype:"list",value:c}};g.scalmult=function(a,h){if("number"!==a.ctype)return k;
-for(var c=[],r=0;r<h.value.length;r++){var b=h.value[r];c[r]="number"===b.ctype?w.mult(b,a):"list"===b.ctype?g.scalmult(a,b):k}return{ctype:"list",value:c}};g.add=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=[],r=0;r<a.value.length;r++){var b=a.value[r],d=h.value[r];c[r]="number"===b.ctype&&"number"===d.ctype?w.add(b,d):"list"===b.ctype&&"list"===d.ctype?g.add(b,d):k}return{ctype:"list",value:c}};g.sub=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=[],r=
-0;r<a.value.length;r++){var b=a.value[r],d=h.value[r];c[r]="number"===b.ctype&&"number"===d.ctype?l.sub(b,d):"list"===b.ctype&&"list"===d.ctype?g.sub(b,d):k}return{ctype:"list",value:c}};g.abs2=function(a){for(var h=0,c=0;c<a.value.length;c++){var r=a.value[c];if("number"===r.ctype)h+=l.abs2(r).value.real;else if("list"===r.ctype)h+=g.abs2(r).value.real;else return k}return{ctype:"number",value:{real:h,imag:0}}};g.abs=function(a){return l.sqrt(g.abs2(a))};g.normalizeMaxXX=function(a){for(var h=-1E4,
-c=l.real(1),r=0;r<a.value.length;r++){var b=l.abs(a.value[r]);b.value.real>h&&(c=a.value[r],h=b.value.real)}return g.scaldiv(c,a)};g.recursive=function(a,h){for(var c=[],r=0;r<a.value.length;r++){var b=B(a.value[r]);c[r]="number"===b.ctype?l[h](b):"list"===b.ctype?g[h](b):k}return{ctype:"list",value:c}};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 h=-1,c=0;c<a.value.length;c++){if("list"!==a.value[c].ctype)return-1;if(0===c)h=a.value[c].value.length;else if(h!==a.value[c].value.length)return-1}return h};g._helper.isNumberVecN=function(a,h){if("list"!==a.ctype||a.value.length!==
-h)return!1;for(var c=0;c<a.value.length;c++)if("number"!==a.value[c].ctype)return!1;return!0};g.isNumberVector=function(a){if("list"!==a.ctype)return{ctype:"boolean",value:!1};for(var h=0;h<a.value.length;h++)if("number"!==a.value[h].ctype)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};g.isNumberVectorN=function(a,h){if("list"!==a.ctype)return{ctype:"boolean",value:!1};if(a.value)for(var c=0;c<a.value.length;c++)if("number"!==a.value[c].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 h=0;h<a.value.length;h++)if(!g.isNumberVector(a.value[h]).value)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};g._helper.isNumberMatrixMN=function(a,h,c){return g.isNumberMatrix(a).value&&a.value.length===h&&a.value[0].value.length===c};g.scalproduct=function(a,h){if(a.value.length!==h.value.length)return k;for(var c={ctype:"number",value:{real:0,imag:0}},r=0;r<h.value.length;r++){var b=
-a.value[r],d=h.value[r];if("number"===b.ctype&&"number"===d.ctype)c=l.add(l.mult(b,d),c);else return k}return c};g.sesquilinearproduct=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=0,r=0,b=0;b<h.value.length;b++)var d=a.value[b].value,g=h.value[b].value,c=c+(d.real*g.real+d.imag*g.imag),r=r+(d.real*g.imag-d.imag*g.real);return l.complex(c,r)};g.normSquared=function(a){for(var h=0,c=0;c<a.value.length;c++)var r=a.value[c].value,h=h+(r.real*r.real+r.imag*r.imag);return l.real(h)};
-g.productMV=function(a,h){if(a.value[0].value.length!==h.value.length)return k;for(var c=[],r=0;r<a.value.length;r++){for(var b={ctype:"number",value:{real:0,imag:0}},d=a.value[r],e=0;e<h.value.length;e++){var f=d.value[e],m=h.value[e];if("number"===f.ctype&&"number"===m.ctype)b=l.add(l.mult(f,m),b);else return k}c[r]=b}return g.turnIntoCSList(c)};g.productVM=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=[],b=0;b<h.value[0].value.length;b++){for(var d={ctype:"number",value:{real:0,
-imag:0}},e=0;e<a.value.length;e++){var f=a.value[e],m=h.value[e].value[b];if("number"===f.ctype&&"number"===m.ctype)d=l.add(l.mult(f,m),d);else return k}c[b]=d}return g.turnIntoCSList(c)};g.productMM=function(a,h){if(a.value[0].value.length!==h.value.length)return k;for(var c=[],b=0;b<a.value.length;b++){var d=g.productVM(a.value[b],h);c[b]=d}return g.turnIntoCSList(c)};g.mult=function(a,h){return a.value.length===h.value.length&&g.isNumberVector(a).value&&g.isNumberVector(h).value?g.scalproduct(a,
-h):g.isNumberMatrix(a).value&&h.value.length===a.value[0].value.length&&g.isNumberVector(h).value?g.productMV(a,h):g.isNumberMatrix(h).value&&a.value.length===h.value.length&&g.isNumberVector(a).value?g.productVM(a,h):g.isNumberMatrix(a).value&&g.isNumberMatrix(h).value&&h.value.length===a.value[0].value.length?g.productMM(a,h):k};g.projectiveDistMinScal=function(a,h){var c=g.abs(a),b=g.abs(h);if(0===c.value.real||0===b.value.real)return 0;var d=g.conjugate(h),d=g.scalproduct(a,d),d=l._helper.isAlmostZero(d)?
-l.real(1):l.div(d,l.abs(d)),c=g.scaldiv(c,a),b=g.scaldiv(b,h),b=g.scalmult(d,b),d=g.abs(g.add(c,b)),b=g.abs(g.sub(c,b));return Math.min(d.value.real,b.value.real)};g.conicDist=function(a,h){var c=v(a),b=v(h);console.log(ba(c),ba(b));return g.projectiveDistMinScal(c,b)};g.crossOperator=function(a){var h=a.value[0],c=a.value[1];a=a.value[2];return g.turnIntoCSList([g.turnIntoCSList([l.zero,l.neg(a),c]),g.turnIntoCSList([a,l.zero,l.neg(h)]),g.turnIntoCSList([l.neg(c),h,l.zero])])};g.cross=function(a,
-h){var c=l.sub(l.mult(a.value[1],h.value[2]),l.mult(a.value[2],h.value[1])),b=l.sub(l.mult(a.value[2],h.value[0]),l.mult(a.value[0],h.value[2])),d=l.sub(l.mult(a.value[0],h.value[1]),l.mult(a.value[1],h.value[0]));return g.turnIntoCSList([c,b,d])};g.crossratio3harm=function(a,h,c,b,d){var e=g.det3(a,c,d),f=g.det3(h,b,d);a=g.det3(a,b,d);h=g.det3(h,c,d);e=l.mult(e,f);f=l.mult(a,h);return g.turnIntoCSList([e,f])};g.crossratio3=function(a,h,c,b,d){a=g.crossratio3harm(a,h,c,b,d);return l.div(a.value[0],
-a.value[1])};g.veronese=function(a){var h=l.mult(a.value[0],a.value[0]),c=l.mult(a.value[1],a.value[1]),b=l.mult(a.value[2],a.value[2]),d=l.mult(a.value[0],a.value[1]),e=l.mult(a.value[0],a.value[2]);a=l.mult(a.value[1],a.value[2]);return g.turnIntoSCList([h,c,b,d,e,a])};g.matrixFromVeronese=function(a){var h=a.value[0],c=a.value[1],b=a.value[2],d=l.realmult(.5,a.value[3]),e=l.realmult(.5,a.value[4]);a=l.realmult(.5,a.value[5]);return g.turnIntoCSList([g.turnIntoCSList([h,d,e]),g.turnIntoCSList([d,
-c,a]),g.turnIntoCSList([e,a,b])])};g.det2=function(a,h){var c=l.mult(a.value[0],h.value[1]);return c=l.sub(c,l.mult(a.value[1],h.value[0]))};g.det3=function(a,h,c){return l.complex(a.value[0].value.real*h.value[1].value.real*c.value[2].value.real-a.value[0].value.imag*h.value[1].value.imag*c.value[2].value.real-a.value[0].value.imag*h.value[1].value.real*c.value[2].value.imag-a.value[0].value.real*h.value[1].value.imag*c.value[2].value.imag+a.value[2].value.real*h.value[0].value.real*c.value[1].value.real-
-a.value[2].value.imag*h.value[0].value.imag*c.value[1].value.real-a.value[2].value.imag*h.value[0].value.real*c.value[1].value.imag-a.value[2].value.real*h.value[0].value.imag*c.value[1].value.imag+a.value[1].value.real*h.value[2].value.real*c.value[0].value.real-a.value[1].value.imag*h.value[2].value.imag*c.value[0].value.real-a.value[1].value.imag*h.value[2].value.real*c.value[0].value.imag-a.value[1].value.real*h.value[2].value.imag*c.value[0].value.imag-a.value[0].value.real*h.value[2].value.real*
-c.value[1].value.real+a.value[0].value.imag*h.value[2].value.imag*c.value[1].value.real+a.value[0].value.imag*h.value[2].value.real*c.value[1].value.imag+a.value[0].value.real*h.value[2].value.imag*c.value[1].value.imag-a.value[2].value.real*h.value[1].value.real*c.value[0].value.real+a.value[2].value.imag*h.value[1].value.imag*c.value[0].value.real+a.value[2].value.imag*h.value[1].value.real*c.value[0].value.imag+a.value[2].value.real*h.value[1].value.imag*c.value[0].value.imag-a.value[1].value.real*
-h.value[0].value.real*c.value[2].value.real+a.value[1].value.imag*h.value[0].value.imag*c.value[2].value.real+a.value[1].value.imag*h.value[0].value.real*c.value[2].value.imag+a.value[1].value.real*h.value[0].value.imag*c.value[2].value.imag,-a.value[0].value.imag*h.value[1].value.imag*c.value[2].value.imag+a.value[0].value.imag*h.value[1].value.real*c.value[2].value.real+a.value[0].value.real*h.value[1].value.real*c.value[2].value.imag+a.value[0].value.real*h.value[1].value.imag*c.value[2].value.real-
-a.value[2].value.imag*h.value[0].value.imag*c.value[1].value.imag+a.value[2].value.imag*h.value[0].value.real*c.value[1].value.real+a.value[2].value.real*h.value[0].value.real*c.value[1].value.imag+a.value[2].value.real*h.value[0].value.imag*c.value[1].value.real-a.value[1].value.imag*h.value[2].value.imag*c.value[0].value.imag+a.value[1].value.imag*h.value[2].value.real*c.value[0].value.real+a.value[1].value.real*h.value[2].value.real*c.value[0].value.imag+a.value[1].value.real*h.value[2].value.imag*
-c.value[0].value.real+a.value[0].value.imag*h.value[2].value.imag*c.value[1].value.imag-a.value[0].value.imag*h.value[2].value.real*c.value[1].value.real-a.value[0].value.real*h.value[2].value.real*c.value[1].value.imag-a.value[0].value.real*h.value[2].value.imag*c.value[1].value.real+a.value[2].value.imag*h.value[1].value.imag*c.value[0].value.imag-a.value[2].value.imag*h.value[1].value.real*c.value[0].value.real-a.value[2].value.real*h.value[1].value.real*c.value[0].value.imag-a.value[2].value.real*
-h.value[1].value.imag*c.value[0].value.real+a.value[1].value.imag*h.value[0].value.imag*c.value[2].value.imag-a.value[1].value.imag*h.value[0].value.real*c.value[2].value.real-a.value[1].value.real*h.value[0].value.real*c.value[2].value.imag-a.value[1].value.real*h.value[0].value.imag*c.value[2].value.real)};g.det4m=function(a){var h=a.value,c=h[0].value,b=c[0].value,d=+b.real,g=+b.imag,b=c[1].value,e=+b.real,f=+b.imag,b=c[2].value,k=+b.real,m=+b.imag,b=c[3].value,n=+b.real,p=+b.imag,c=h[1].value,
-b=c[0].value,q=+b.real,t=+b.imag,b=c[1].value,u=+b.real,v=+b.imag,b=c[2].value,w=+b.real,x=+b.imag,b=c[3].value,c=+b.real,b=+b.imag;a=d*u-g*v-e*q+f*t;var y=d*v+g*u-e*t-f*q,z=d*w-g*x-k*q+m*t,A=d*x+g*w-k*t-m*q,B=d*c-g*b-n*q+p*t,C=d*b+g*c-n*t-p*q,D=e*w-f*x-k*u+m*v,E=e*x+f*w-k*v-m*u,F=e*c-f*b-n*u+p*v,G=e*b+f*c-n*v-p*u,H=k*c-m*b-n*w+p*x,L=k*b+m*c-n*x-p*w,c=h[2].value,b=c[0].value,d=+b.real,g=+b.imag,b=c[1].value,e=+b.real,f=+b.imag,b=c[2].value,k=+b.real,m=+b.imag,b=c[3].value,n=+b.real,p=+b.imag,c=h[3].value,
-b=c[0].value,q=+b.real,t=+b.imag,b=c[1].value,u=+b.real,v=+b.imag,b=c[2].value,w=+b.real,x=+b.imag,b=c[3].value,c=+b.real,b=+b.imag,h=d*u-g*v-e*q+f*t,J=d*v+g*u-e*t-f*q,I=d*w-g*x-k*q+m*t,K=d*x+g*w-k*t-m*q,M=d*c-g*b-n*q+p*t,d=d*b+g*c-n*t-p*q,g=e*w-f*x-k*u+m*v,q=e*x+f*w-k*v-m*u,t=e*c-f*b-n*u+p*v,e=e*b+f*c-n*v-p*u,f=k*c-m*b-n*w+p*x,k=k*b+m*c-n*x-p*w;return l.complex(a*f-y*k-z*t+A*e+B*g-C*q+D*M-E*d-F*I+G*K+H*h-L*J,a*k+y*f-z*e-A*t+B*q+C*g+D*d+E*M-F*K-G*I+H*J+L*h)};g.eucangle=function(a,h){var c=g.cross(a,
-g.linfty),b=g.cross(h,g.linfty),d=g.det3(g.ez,c,g.ii),c=g.det3(g.ez,c,g.jj),e=g.det3(g.ez,b,g.ii),b=g.det3(g.ez,b,g.jj),d=l.div(l.mult(d,b),l.mult(e,c)),d=l.log(d);return d=l.mult(d,l.complex(0,.5))};g.zerovector=function(a){a=Math.floor(a.value.real);for(var h=Array(a),c=0;c<a;c++)h[c]=0;return g.realVector(h)};g.zeromatrix=function(a,h){for(var c=Math.floor(a.value.real),b=Array(c),d=0;d<c;d++)b[d]=g.zerovector(h);return g.turnIntoCSList(b)};g.vandermonde=function(a){for(var h=a.value.length,c=
-g.zeromatrix(h,h),b=0;b<h;b++)for(var d=0;d<h;d++)c.value[b].value[d]=l.pow(a.value[b],l.real(d-1));return c};g.transpose=function(a){for(var h=[],c=a.value[0].value.length,b=a.value.length,d=0;d<c;d++){for(var e=[],f=0;f<b;f++)e[f]=a.value[f].value[d];h[d]=g.turnIntoCSList(e)}return g.turnIntoCSList(h)};g.column=function(a,h){for(var c=[],b=a.value.length,d=Math.floor(h.value.real-1),e=0;e<b;e++)c[e]=a.value[e].value[d];return g.turnIntoCSList(c)};g.row=function(a,h){for(var c=[],b=a.value[0].value.length,
-d=Math.floor(h.value.real-1),e=0;e<b;e++)c[e]=a.value[d].value[e];return g.turnIntoCSList(c)};g.adjoint2=function(a){var h=a.value[0].value[0],c=a.value[1].value[0],b=Array(2);b[0]=g.turnIntoCSList([a.value[1].value[1],l.neg(a.value[0].value[1])]);b[1]=g.turnIntoCSList([l.neg(c),h]);return b=g.turnIntoCSList(b)};g.adjoint3=function(a){var h,c,b,d,g,e,f,k,l,m,n,p,q,t,u,v,w;h=a.value[0].value;c=h[0].value;b=c.real;d=c.imag;c=h[1].value;g=c.real;e=c.imag;c=h[2].value;f=c.real;k=c.imag;h=a.value[1].value;
-c=h[0].value;l=c.real;m=c.imag;c=h[1].value;n=c.real;p=c.imag;c=h[2].value;q=c.real;t=c.imag;h=a.value[2].value;c=h[0].value;a=c.real;u=c.imag;c=h[1].value;v=c.real;w=c.imag;c=h[2].value;h=c.real;c=c.imag;return{ctype:"list",value:[{ctype:"list",value:[{ctype:"number",value:{real:n*h-q*v-p*c+t*w,imag:n*c-q*w-v*t+h*p}},{ctype:"number",value:{real:-g*h+f*v+e*c-k*w,imag:-g*c+f*w+v*k-h*e}},{ctype:"number",value:{real:g*q-f*n-e*t+k*p,imag:g*t-f*p-n*k+q*e}}]},{ctype:"list",value:[{ctype:"number",value:{real:-l*
-h+q*a+m*c-t*u,imag:-l*c+q*u+a*t-h*m}},{ctype:"number",value:{real:b*h-f*a-d*c+k*u,imag:b*c-f*u-a*k+h*d}},{ctype:"number",value:{real:-b*q+f*l+d*t-k*m,imag:-b*t+f*m+l*k-q*d}}]},{ctype:"list",value:[{ctype:"number",value:{real:l*v-n*a-m*w+p*u,imag:l*w-n*u-a*p+v*m}},{ctype:"number",value:{real:-b*v+g*a+d*w-e*u,imag:-b*w+g*u+a*e-v*d}},{ctype:"number",value:{real:b*n-g*l-d*p+e*m,imag:b*p-g*m-l*e+n*d}}]}]}};g.inverse=function(a){var h=a.value.length;if(h!==a.value[0].value.length)return console.log("Inverse works only for square matrices"),
-k;if(2===h)return g.scaldiv(g.det(a),g.adjoint2(a));if(3===h)return g.scaldiv(g.det(a),g.adjoint3(a));h=g.LUdecomp(a);a=a.value.length;var c=l.real(0),b=l.real(1),d=g.zerovector(l.real(a));d.value[0]=b;for(var e=Array(a),f=0;f<a;f++)e[f]=g._helper.LUsolve(h,d),d.value[f]=c,d.value[f+1]=b;e=g.turnIntoCSList(e);return e=g.transpose(e)};g.linearsolve=function(a,h){return 2===a.value.length?g.linearsolveCramer2(a,h):3===a.value.length?g.linearsolveCramer3(a,h):g.LUsolve(a,h)};g.getDiag=function(a){if(a.value.length!==
-a.value[0].value.length)return k;for(var h=Array(a.value.length),c=0;c<a.value.length;c++)h[c]=a.value[c].value[c];return g.turnIntoCSList(h)};g.getSubDiag=function(a){if(a.value.length!==a.value[0].value.length)return k;for(var h=Array(a.value.length-1),c=0;c<a.value.length-1;c++)h[c]=a.value[c+1].value[c];return g.turnIntoCSList(h)};g.eig2=function(a){var h=l.add(a.value[0].value[0],a.value[1].value[1]);a=g.det2(a.value[0],a.value[1]);var c=l.mult(h,h),b=h=l.mult(h,l.real(.5));a=l.sqrt(l.sub(l.div(c,
-l.real(4)),a));h=l.add(h,a);b=l.sub(b,a);return g.turnIntoCSList([h,b])};g.eig=function(a,h){var c=h||!0,b=a,d=l.real(b.value.length),e=d.value.real;l.real(0);var b=g._helper.QRIteration(b)[0],b=g.getDiag(b),b=g.sort1(b),d=g.idMatrix(d,d),f=Array(e),f=g.turnIntoCSList(f);if(c){for(var k,m,n,p=0,q=!1,c=0;c<e;c++)q?m=k.value[p]:(k=b.value[c],k=g.sub(a,g.scalmult(k,d)),k=g.nullSpace(k),m=k.value[0],void 0!==m&&(n=m)),void 0===m&&(m=n),1E-8>g.abs(m).value.real&&0===p&&(m=g._helper.inverseIteration(a,
-b.value[c])),f.value[c]=g._helper.isAlmostZeroVec(m)?m:g.scaldiv(g.abs(m),m),c<e-1&&((q=1E-6>l.abs(l.sub(b.value[c],b.value[c+1])).value.real)?p++:p=0);f=g.transpose(f)}return g.turnIntoCSList([b,f])};g._helper.isNormalMatrix=function(a){return 1E-10>g.abs(g.sub(a,g.transjugate(a))).value.real};g._helper.QRIteration=function(a,h){var c,b=a;c=l.real(b.value.length);var d=c.value.real,e=c.value.real;l.real(0);var f;g.idMatrix(c,c);var k=g.zeromatrix(c,c),m=g.idMatrix(c,c),n=h?h:2500,p,q,t,u=0,v=Array(e);
-for(c=0;c<n;c++){f=g._helper.getBlock(b,[e-2,e-1],[e-2,e-1]);p=g.eig2(f);f=p.value[0];p=p.value[1];g.abs(f);g.abs(p);q=b.value[e-1].value[e-1];t=l.abs(l.sub(q,f)).value.real;q=l.abs(l.sub(q,p)).value.real;p=t<q?f:p;f=g.idMatrix(l.real(e),l.real(e));p=g.scalmult(p,f);f=g.QRdecomp(g.sub(b,p));b=w.mult(f.R,f.Q);b=g.add(b,p);f.Q=g._helper.buildBlockMatrix(f.Q,g.idMatrix(l.real(u),l.real(u)));m=w.mult(m,f.Q);if(1E-48>l.abs2(b.value[b.value.length-1].value[b.value[0].value.length-2]).value.real&&1<e){v[d-
-u-1]=b.value[e-1].value[e-1];for(c=0;c<e;c++)k.value[e-1].value[c]=b.value[e-1].value[c],k.value[c].value[e-1]=b.value[c].value[e-1];b=g._helper.getBlock(b,[0,e-2],[0,e-2]);u++;e--}if(1===e){k.value[0].value[0]=b.value[0].value[0];break}if(g._helper.isUpperTriangular(b)){for(c=0;c<e;c++)k.value[c].value[c]=b.value[c].value[c];break}}return[k,m]};g.rank=function(a,h){return g.RRQRdecomp(a,h).rank};g._helper.isAlmostZeroVec=function(a){for(var h=a.value.length,c=0;c<h;c++)if(!l._helper.isAlmostZero(a.value[c]))return!1;
-return!0};g._helper.isLowerTriangular=function(a){for(var h=a.value.length,c=a.value[0].value.length,b=0;b<h;b++)for(var d=b+1;d<c;d++)if(!l._helper.isAlmostZero(a.value[b].value[d]))return!1;return!0};g._helper.isUpperTriangular=function(a){return g._helper.isLowerTriangular(g.transpose(a))};g._helper.isAlmostId=function(a){var h=a.value.length,c=l.real(h);if(h!==a.value[0].value.length)return!1;a=g.sub(a,g.idMatrix(c),c);for(c=0;c<h;c++)for(var b=0;b<h;b++)if(1E-16<l.abs(a.value[c].value[b]).value.real)return!1;
-return!0};g.nullSpace=function(a,h){var c=a.value.length,b=g.RRQRdecomp(g.transjugate(a),h),d=g.transpose(b.Q),b=c-b.rank.value.real,e=Array(b);d.value.reverse();for(var f,k=0;k<b;k++)f=d.value[k],e[k]=g.scaldiv(g.abs(f),f);e=g.turnIntoCSList(e);return 0<e.value.length?e:g.turnIntoCSList([g.zerovector(l.real(c))])};g._helper.isAlmostDiagonal=function(a){var h=a.value.length;l.real(h);l.real(0);if(h!==a.value[0].value.length)return!1;for(var c=0;c<h;c++)for(var b=0;b<h;b++)if(c!==b&&1E-16<l.abs(a.value[c].value[b]).value.real)return!1;
-return!0};g._helper.inverseIteration=function(a,h){console.log("warning: code untested");for(var c=a.value.length,b=Array(c),d=0;d<c;d++)b[d]=2*Math.random()-.5;for(var b=g.realVector(b),c=g.idMatrix(l.real(c),l.real(c)),d=l.add(h,l.real(.1*Math.random()-.5)),e=0;100>e;e++)b=g.scaldiv(g.abs(b),b),b=g.LUsolve(g.sub(a,g.scalmult(d,c)),JSON.parse(JSON.stringify(b)));return g.scaldiv(g.abs(b),b)};g._helper.toHessenberg=function(a){var h=JSON.parse(JSON.stringify(a)),c=h.value.length,b=l.real(c-1),d=l.real(c);
-l.real(1);if(g._helper.isUpperTriangular(h))return[g.idMatrix(b,b),a];var e;a=g.idMatrix(d,d);for(var f,d=1;d<c-1;d++)e=g.column(h,l.real(d)),e.value=e.value.splice(d),f=g.abs2(e).value.real,1E-16<f&&(e=g._helper.getHouseHolder(e),a=w.mult(a,e),h=w.mult(w.mult(e,h),e)),b.value.real--;return[a,h]};g._helper.swapEl=function(a,h,c){var b;"[object Array]"===Object.prototype.toString.call(a)?(b=a[h],a[h]=a[c],a[c]=b):"list"===a.ctype&&(b=a.value[h],a.value[h]=a.value[c],a.value[c]=b)};g.RRQRdecomp=function(a,
-h){var c=Math.sqrt(l.eps);void 0!==h&&(c=.1*h.value.real);var c=c*c,b,d=a.value.length,e=l.real(d),f=l.real(1),k=g._helper.unitvector(l.real(a.value.length),f),m=g.idMatrix(e,e),n=JSON.parse(JSON.stringify(a)),p=g.transpose(a),q=Array(d);for(b=0;b<d;b++)q[b]=g.abs2(p.value[b]);q=g.turnIntoCSList(q);p=Array(d);for(b=0;b<d;b++)p[b]=b;b=g.maxIndex(q,l.abs);for(var t=q.value[b],u=0,v=0;1E-16<l.abs2(t).value.real;v++){u++;g._helper.swapColumn(n,v,b);g._helper.swapEl(q,v,b);g._helper.swapEl(p,v,b);b=g._helper.getBlock(n,
-[v],[v]);b=g.column(b,f);t=g.abs2(b).value.real;1E-8<t&&(b=g._helper.getHouseHolder(b),b=g._helper.buildBlockMatrix(g.idMatrix(l.real(v),l.real(v)),b),m=w.mult(m,g.transjugate(b)),n=w.mult(b,n));for(b=v+1;b<d;b++)q.value[b]=l.sub(q.value[b],l.mult(n.value[v].value[b],l.conjugate(n.value[v].value[b])));b=g.maxIndex(q,l.abs2,v+1);t=q.value[b];if(v+2===d){l.abs(t).value.real>c&&u++;break}e=l.sub(e,f);k.value=k.value.splice(0,k.value.length-1)}return{Q:m,R:n,P:g.turnIntoCSList(p),rank:l.real(u)}};g._helper.getHouseHolder=
-function(a){var h=l.real(a.value.length);if(1E-16>g.abs2(a))return g.idMatrix(h,h);var c,b=l.real(1),d=g._helper.unitvector(l.real(a.value.length),b);c=g._helper.QRgetAlpha(a,0);c=g.sub(a,g.scalmult(c,d));c=g.scaldiv(g.abs(c),c);a=l.div(g.sesquilinearproduct(a,c),g.sesquilinearproduct(c,a));h=g.idMatrix(h,h);return h=g.sub(h,g.scalmult(l.add(b,a),g._helper.transposeMult(c,g.conjugate(c))))};g._helper.reOrderbyPivots=function(a,h){for(var c=a.value.length.length,b=g.transpose(a),c=Array(c),d=0;d<h.length;d++)c[h[d]]=
-b.value[d];c=g.turnIntoCSList(c);return g.transpose(c)};g.QRdecomp=function(a){var h,c=a.value.length,b=l.real(c);if(g._helper.isUpperTriangular(a))return{Q:g.idMatrix(b,b),R:a};var d=l.real(1),e=g._helper.unitvector(l.real(a.value.length),d),f,k=g.idMatrix(b,b);a=JSON.parse(JSON.stringify(a));for(var m=0;;m++){h=g._helper.getBlock(a,[m],[m]);h=g.column(h,d);f=g.abs2(h).value.real;1E-8<f&&(h=g._helper.getHouseHolder(h),h=g._helper.buildBlockMatrix(g.idMatrix(l.real(m),l.real(m)),h),k=w.mult(k,g.transjugate(h)),
-a=w.mult(h,a));if(m+2===c)break;b=l.sub(b,d);e.value=e.value.splice(0,e.value.length-1)}return{Q:k,R:a}};g._helper.swapColumn=function(a,h,c){for(var b,d=0;d<a.value.length;d++)b=a.value[d].value[h],a.value[d].value[h]=a.value[d].value[c],a.value[d].value[c]=b};g._helper.buildBlockMatrix=function(a,h){if(0===a.value.length)return h;if(0===h.value.length)return a;for(var c=a.value.length,b=a.value[0].value.length,d=b+h.value[0].value.length,d=g.zeromatrix(l.real(c+h.value.length),l.real(d)),e=0;e<
-a.value.length;e++)for(var f=0;f<a.value[0].value.length;f++)d.value[e].value[f]=a.value[e].value[f];for(e=0;e<h.value.length;e++)for(f=0;f<h.value[0].value.length;f++)d.value[c+e].value[b+f]=h.value[e].value[f];return d};g._helper.getBlock=function(a,h,c){a=JSON.parse(JSON.stringify(a));var b=h[0],d=c[0];h=void 0===h[1]?a.value.length:h[1];c=void 0===c[1]?a.value[0].value.length:c[1];h++;c++;a.value=a.value.slice(b,h);for(b=0;b<a.value.length;b++)a.value[b].value=a.value[b].value.slice(d,c);return a};
-g._helper.setBlock=function(a,h,c){a=JSON.parse(JSON.stringify(a));var b=c[0];c=c[1];for(var d=h.value.length,g=h.value[0].value.length,e=0;e<d;e++)for(var f=0;f<g;f++)a.value[b+e].value[c+f]=h.value[e].value[f];return a};g._helper.transposeMult=function(a,h){if(a.value.length!==h.value.length)return k;for(var c=a.value.length,b=Array(c),d=0;d<c;d++)b[d]=g.scalmult(a.value[d],h);return g.turnIntoCSList(b)};g._helper.QRgetAlpha=function(a,h){return 0>a.value[h].value.real?g.abs(a):l.neg(g.abs(a))};
-g.LUdecomp=function(a){a=JSON.parse(JSON.stringify(a));var h,c,b,d,g,e=0,f,k=a.value.length,m=k-1,n=Array(k);for(b=0;b<k;++b){g=b;d=a.value[b];f=l.abs(d.value[b]).value.real;for(c=b+1;c<k;++c)h=l.abs(a.value[c].value[b]),f<h.value.real&&(f=h.value.real,g=c);f<l.eps&&console.log("Warning: singular matrix!");n[b]=g;g!==b&&(a.value[b]=a.value[g],a.value[g]=d,d=a.value[b],e++);c=d.value[b];for(h=b+1;h<k;++h)a.value[h].value[b]=l.div(a.value[h].value[b],c);for(h=b+1;h<k;++h){g=a.value[h];for(c=b+1;c<m;++c)g.value[c]=
-l.sub(g.value[c],l.mult(g.value[b],d.value[c])),++c,g.value[c]=l.sub(g.value[c],l.mult(g.value[b],d.value[c]));c===m&&(g.value[c]=l.sub(g.value[c],l.mult(g.value[b],d.value[c])))}}return{LU:a,P:n,TransPos:e}};g.LUsolve=function(a,h){var c=g.LUdecomp(a);return g._helper.LUsolve(c,h)};g._helper.LUsolve=function(a,h){var c=JSON.parse(JSON.stringify(h)),b,d=a.LU,g=d.value.length,e=JSON.parse(JSON.stringify(c)),f=a.P,k;for(b=g-1;-1!==b;--b)e.value[b]=c.value[b];for(b=0;b<g;++b)for(c=f[b],f[b]!==b&&(k=
-e.value[b],e.value[b]=e.value[c],e.value[c]=k),k=d.value[b],c=0;c<b;++c)e.value[b]=l.sub(e.value[b],l.mult(e.value[c],k.value[c]));for(b=g-1;0<=b;--b){k=d.value[b];for(c=b+1;c<g;++c)e.value[b]=l.sub(e.value[b],l.mult(e.value[c],k.value[c]));e.value[b]=l.div(e.value[b],k.value[b])}return e};g.linearsolveCramer2=function(a,h){var c=g.column(a,l.real(1)),b=g.column(a,l.real(2)),d=g.det2(c,b);l._helper.isZero(d)&&console.log("A is not regular!");b=g.det2(h,b);b=l.div(b,d);c=g.det2(c,h);c=l.div(c,d);return g.turnIntoCSList([b,
-c])};g.linearsolveCramer3=function(a,h){var c=g.column(a,l.real(1)),b=g.column(a,l.real(2)),d=g.column(a,l.real(3)),e=g.det3(c,b,d);l._helper.isZero(e)&&console.log("A is not regular!");var f=g.det3(h,b,d),d=g.det3(c,h,d),c=g.det3(c,b,h),f=g.turnIntoCSList([f,d,c]);return f=g.scaldiv(e,f)};g.linearsolveCGNR=function(a,h){var c=g.transpose(a),b=w.mult(c,a),c=w.mult(c,h);return g.linearsolveCG(b,c)};g.linearsolveCG=function(a,h){var c,b,d,e,f,k;e=h;b=c=g.sub(h,w.mult(a,h));for(var m=Math.ceil(1.2*a.value.length),
-n=0;n<m;){n++;f=w.mult(a,b);k=d=g.scalproduct(c,c);d=l.div(d,g.scalproduct(b,f));e=g.add(e,w.mult(d,b));c=g.sub(c,w.mult(d,f));if(g.abs(c).value.real<l.eps)break;d=g.scalproduct(c,c);d=l.div(d,k);b=g.add(c,w.mult(d,b))}n>=m&&console.log("CG did not converge");return e};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 h=a.value.length,c=l.real(1),b,d,e=JSON.parse(JSON.stringify(a)),f,k,m,n;for(a=0;a<h-1;a++){d=a;for(b=a+1;b<h;b++)l.abs(e.value[b].value[a]).value.real>l.abs(e.value[d].value[a]).value.real&&(d=b);d!==a&&(b=e.value[d],e.value[d]=e.value[a],e.value[a]=b,c=l.neg(c));f=e.value[a];for(b=a+1;b<h;b++){k=e.value[b];m=l.div(k.value[a],f.value[a]);for(d=a+1;d<h-1;d+=2)n=d+1,k.value[d]=l.sub(k.value[d],l.mult(f.value[d],m)),k.value[n]=l.sub(k.value[n],l.mult(f.value[n],m));d!==h&&(k.value[d]=l.sub(k.value[d],
-l.mult(f.value[d],m)))}if(l._helper.isZero(f.value[a]))return l.real(0);c=l.mult(c,f.value[a])}return l.mult(c,e.value[a].value[a])};g.LUdet=function(a){a=g.LUdecomp(a);for(var h=a.LU,c=h.value.length,b=h.value[0].value[0],d=1;d<c;d++)b=l.mult(b,h.value[d].value[d]);1===a.TransPos%2&&(b=l.neg(b));return b};g.getField=function(a,h){var c;if("homog"===h){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"===h){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"===h&&g.isNumberVector(a)){c=a.value.length;if(0<c&&3!==c)return a.value[0];if(3===c)return"Point"===a.usage?l.div(a.value[0],a.value[2]):a.value[0]}if("y"===h&&g.isNumberVector(a)){c=a.value.length;if(1<c&&3!==c)return a.value[1];if(3===c)return"Point"===a.usage?l.div(a.value[1],a.value[2]):a.value[1]}return"z"===h&&g.isNumberVector(a)&&(c=a.value.length,2<c)?a.value[2]:
-k};g.nil=g.turnIntoCSList([]);g.ofGeos=function(a){return g.turnIntoCSList(a.map(function(a){return{ctype:"geo",value:a}}))};var Ka={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(Ka.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&&ia.err("Bad dictionary key: "+ba(a));return"undef"},create:function(){return{ctype:"dict",value:{}}},clone:function(a){var h=Ka.create(),c;for(c in a.value)a.value.hasOwnProperty(c)&&(h.value[c]=a.value[c]);return h},put:function(a,h,c){a.value[Ka.key(h)]={key:h,value:c}},get:function(a,h,c){return(a=a.value[Ka.key(h)])?a.value:c},niceprint:function(a){return"{"+Object.keys(a.value).sort().map(function(h){h=a.value[h];return ba(h.key)+":"+ba(h.value)}).join(", ")+"}"}},w={_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 w.bool(!a.value)},isLessThan:function(a,h){return-1===w.compare(a,h)},isEqual:function(a,h){return 0===w.compare(a,h)},compareResults:function(a,h){return w.compare(a.result,h.result)},compare:function(a,h){if(a.ctype!==h.ctype)return w.order[a.ctype]-w.order[h.ctype];if("number"===a.ctype)return l._helper.compare(a,
-h);if("list"===a.ctype)return g._helper.compare(a,h);if("geo"===a.ctype)return a.value.name===h.value.name?0:a.value.name<h.value.name?-1:1;if("string"===a.ctype)return a.value===h.value?0:a.value<h.value?-1:1;if("boolean"===a.ctype)return a.value===h.value?0:!1===a.value?-1:1},add:function(a,h){return"void"===a.ctype&&"number"===h.ctype||"void"===a.ctype&&"list"===h.ctype?h:"number"===a.ctype&&"number"===h.ctype?l.add(a,h):"string"===a.ctype||"string"===h.ctype?{ctype:"string",value:ba(a)+ba(h)}:
-"list"===a.ctype&&"list"===h.ctype?g.add(a,h):k},sub:function(a,h){return"void"===a.ctype&&"number"===h.ctype?l.neg(h):"void"===a.ctype&&"list"===h.ctype?g.neg(h):"number"===a.ctype&&"number"===h.ctype?l.sub(a,h):"list"===a.ctype&&"list"===h.ctype?g.sub(a,h):k},mult:function(a,h){return"number"===a.ctype&&"number"===h.ctype?l.mult(a,h):"number"===a.ctype&&"list"===h.ctype?g.scalmult(a,h):"list"===a.ctype&&"number"===h.ctype?g.scalmult(h,a):"list"===a.ctype&&"list"===h.ctype?g.mult(a,h):k},div:function(a,
-h){return"number"===a.ctype&&"number"===h.ctype?l.div(a,h):"list"===a.ctype&&"number"===h.ctype?g.scaldiv(h,a):k},max:function(a,h){return"number"===a.ctype&&"number"===h.ctype?l.max(a,h):"list"===a.ctype&&"list"===h.ctype?g.max(a,h):k},min:function(a,h){return"number"===a.ctype&&"number"===h.ctype?l.min(a,h):"list"===a.ctype&&"list"===h.ctype?g.min(a,h):k},wrap:function(a){if("number"===typeof a)return l.real(a);if("object"===typeof a&&void 0!==a.length){for(var h=[],c=0;c<a.length;c++)h[c]=w.wrap(a[c]);
-return g.turnIntoCSList(h)}return"string"===typeof a?{ctype:"string",value:a}:"boolean"===typeof a?{ctype:"boolean",value:a}:k},unwrap:function(a){if("object"!==typeof a||null===a)return a;if(Array.isArray(a))return a.map(w.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(w.unwrap);default:return null}},withUsage:function(a,h){return{ctype:a.ctype,value:a.value,usage:h}},
-wrapJSON:function(a){switch(typeof a){case "number":return l.real(a);case "string":return w.string(a);case "boolean":return w.bool(a);case "object":if(null===a)return k;if(Array.isArray(a))return g.turnIntoCSList(a.map(w.wrapJSON));var h=Ka.create(),c;for(c in a)Ka.put(h,w.string(c),w.wrapJSON(a[c]));return h;default:return console.log("Failed to convert "+typeof a+" to CindyJS data type"),k}},identity:function(a){return a}},Za={},R={};R[":"]=C(":");R["\u00b0"]=function(a,h){var c=B(a[0]);return"number"===
-c.ctype&&"void"===a[1].ctype?w.withUsage(l.realmult(Math.PI/180,c),"Angle"):k};R._=oc;R["^"]=Mc;R["\u221a"]=function(a,h){return"void"===a[0].ctype?t.sqrt$1([a[1]],h):k};R["*"]=Kc;R["\u00d7"]=Sc;R["/"]=Lc;R["+"]=Jc;R["-"]=$b;R["!"]=function(a,h){var c=B(a[1]);return"void"===a[0].ctype&&"boolean"===c.ctype?{ctype:"boolean",value:!c.value}:k};R["=="]=pb;R["~="]=Yb;R["~<"]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?
-{ctype:"boolean",value:c.value.real-b.value.real<=-l.eps}:k};R["~>"]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real>=l.eps}:k};R["=:="]=C("=:=");R[">="]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real>=b.value.real}:"string"===c.ctype&&"string"===
-b.ctype?{ctype:"boolean",value:c.value>=b.value}:k};R["<="]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real<=b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value<=b.value}:k};R["~>="]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-
-b.value.real>-l.eps}:k};R["~<="]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real<l.eps}:k};R[">"]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real>b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value>b.value}:
-k};R["<"]=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&l._helper.isAlmostReal(c)&&l._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real<b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value<b.value}:k};R["<>"]=Gc;R["\u2208"]=function(a,h){var c=A(a[0]),b=A(a[1]);return"list"===b.ctype?g.contains(b,c):k};R["\u2209"]=function(a,h){var c=A(a[0]),b=A(a[1]);return"list"===b.ctype?w.not(g.contains(b,c)):k};R["&"]=Hc;R["%"]=Ic;
-R["!="]=Gc;R["~!="]=function(a,h){return w.not(Yb(a,h))};R[".."]=function(a,h){var c=A(a[0]),b=A(a[1]);return"number"===c.ctype&&"number"===b.ctype?g.sequence(c,b):k};R["++"]=Tc;R["--"]=Vc;R["~~"]=Uc;R[":>"]=Wc;R["<:"]=Xc;R["="]=bb;R[":="]=function(a,h,c){h="undefined"===a[1].ctype;if("undefined"===a[0].ctype||h)return k;if("function"===a[0].ctype){h=a[0].oper;var b=a[0].args,d=a[1],g=1;if(Za.hasOwnProperty(h)){g=Za[h];if(g.definer===c)return k;g=g.generation+1}Za[h]={oper:h,body:d,arglist:b,definer:c,
-generation:g}}"variable"===a[0].ctype&&J.setvar(a[0].name,a[1]);return k};R[":=_"]=function(a,h){if("void"!==a[1].ctype)return k;"function"===a[0].ctype&&delete Za[a[0].oper];return k};R["::="]=C("::=");R[";"]=function(a,h){var c="void"===a[0].ctype,b="void"===a[1].ctype;if(c&&b)return k;if(!c&&b)return A(a[0]);c||b||A(a[0]);return b?k:A(a[1])};var t={},D={evaluate:function(a,h,c){if(Za.hasOwnProperty(a)){a=Za[a];if(void 0===a)h=k;else{var b=[];for(c=0;c<a.arglist.length;c++)b[c]=A(h[c]);for(c=0;c<
-a.arglist.length;c++)J.newvar(a.arglist[c].name),J.setvar(a.arglist[c].name,b[c]);J.pushVstack("*");h=A(a.body);J.cleanVstack();for(c=0;c<a.arglist.length;c++)J.removevar(a.arglist[c].name)}return h}if(b=t[a])return b(h,c);var d=a.lastIndexOf("$");if(-1!==d&&(d=a.substr(0,d),b=t[d]))return b(h,c);ia.err("Called undefined function "+d+" (as "+a+")");return k},equals:function(a,h){return"number"===a.ctype&&"number"===h.ctype?{ctype:"boolean",value:a.value.real===h.value.real&&a.value.imag===h.value.imag}:
-"string"===a.ctype&&"string"===h.ctype||"boolean"===a.ctype&&"boolean"===h.ctype?{ctype:"boolean",value:a.value===h.value}:"list"===a.ctype&&"list"===h.ctype?g.equals(a,h):"geo"===a.ctype&&"geo"===h.ctype?{ctype:"boolean",value:a.value===h.value}:{ctype:"boolean",value:!1}}},J={};J.vars=function(){var a={pi:l.real(Math.PI),"\u03c0":l.real(Math.PI),i:l.complex(0,1),"true":w.bool(!0),"false":w.bool(!1),"#":k,nil:g.turnIntoCSList([]),newline:w.string("\n"),tab:w.string("\t")},h=[],c;for(c in a)h[c]=
-[a[c]];return h}();J.isVariable=function(a){return this.vars.hasOwnProperty(a)};J.create=function(a){if(this.vars.hasOwnProperty(a))return this.vars[a];var h=[null];return this.vars[a]=h};J.newvar=function(a){a=this.vars[a];a.push(k);return a};J.removevar=function(a){var h=this.vars[a];0===h.length&&console.error("Removing non-existing "+a);h.pop();0===h.length&&console.warn("Removing last "+a)};J.setvar=function(a,h){var c=this.vars[a];0===c.length&&console.error("Setting non-existing variable "+
-a);void 0===h&&(console.error("Setting variable "+a+" to undefined value"),h=k);if("undefined"===h.ctype)c[c.length-1]=h;else{var b=h;null===b&&(b=k);c[c.length-1]=b}};J.undefinedWarning={};J.getvar=function(a){var h=this.vars[a];0===h.length&&console.error("Getting non-existing variable "+a);h=h[h.length-1];if(null===h){if(u.csnames.hasOwnProperty(a))return{ctype:"geo",value:u.csnames[a]};console&&console.log&&void 0===this.undefinedWarning[a]&&(this.undefinedWarning[a]=!0,console.log("Warning: Accessing undefined variable: "+
-a));return k}return h};J.dump=function(a){var h=this.vars[a];console.log("*** Dump "+a);for(a=0;a<h.length;a++)console.log(a+":> "+ba(h[a]))};J.vstack=[];J.pushVstack=function(a){this.vstack.push(a)};J.popVstack=function(){this.vstack.pop()};J.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 ya={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,h){return"undefined"!==typeof u.csnames[a]?ya.getField(u.csnames[a],h):k},setGeoField:function(a,h,c){return"undefined"!==typeof u.csnames[a]?ya.setField(u.csnames[a],h,c):k},getField:function(a,h){var c;if("P"===a.kind){if("xy"===h)return c=g.dehom(a.homog),w.withUsage(c,"Point");if("homog"===h)return w.withUsage(a.homog,"Point");if("x"===h)return l.div(a.homog.value[0],
-a.homog.value[2]);if("y"===h)return l.div(a.homog.value[1],a.homog.value[2])}if("L"===a.kind||"S"===a.kind){if("homog"===h)return w.withUsage(a.homog,"Line");if("angle"===h)return c=g.eucangle(g.ey,a.homog),w.withUsage(c,"Angle");if("slope"===h)return l.neg(l.div(a.homog.value[0],a.homog.value[1]))}if("Tr"===a.kind&&"matrix"===h)return a.matrix;if("C"===a.kind){if("radius"===h){var b=a.matrix;c=b.value[0].value[0];var d=b.value[0].value[2],e=b.value[1].value[2],b=b.value[2].value[2];l.mult(c,c);d=
-l.div(d,c);e=l.div(e,c);c=l.div(b,c);return c=l.sqrt(l.sub(l.add(l.mult(d,d),l.mult(e,e)),c))}if("size"===h)return a.size;if("matrix"===h)return a.matrix;if("center"===h)return c=m._helper.CenterOfConic(a.matrix),c=g.dehom(c),w.withUsage(c,"Point");if("dualMatrix"===h)return g.normalizeMax(g.adjoint3(a.matrix))}if("Text"===a.kind){if("pressed"===h)return a.checkbox?w.bool(a.checkbox.checked):w.bool(!1);if("xy"===h)return c=g.dehom(a.homog),w.withUsage(c,"Point");if("homog"===h)return w.withUsage(a.homog,
-"Point");if("x"===h)return l.div(a.homog.value[0],a.homog.value[2]);if("y"===h)return l.div(a.homog.value[1],a.homog.value[2])}if("trace"===h)return w.bool(!!a.drawtrace);if(ya.generalFields[h])return(c=a[ya.generalFields[h]])&&c.ctype?c:"object"!==typeof c?w.wrap(c):k;if(a.behavior){if("mass"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.mass);if("radius"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.radius);if("charge"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.charge);
-if("friction"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.friction);if("vx"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.vx);if("vy"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.vy);if("v"===h&&"Mass"===a.behavior.type)return g.realVector([a.behavior.vx,a.behavior.vy]);if("fx"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.fx);if("fy"===h&&"Mass"===a.behavior.type)return l.real(a.behavior.fy);if("f"===h&&"Mass"===a.behavior.type)return g.realVector([a.behavior.fx,
-a.behavior.fy])}c=m[a.type]["get_"+h];return"function"===typeof c?c(a):k},setField:function(a,h,c){"color"===h&&g._helper.isNumberVecN(c,3)&&(a.color=c);"size"===h&&"number"===c.ctype&&(a.size=c);"alpha"===h&&"number"===c.ctype&&(a.alpha=c);"fillcolor"===h&&g._helper.isNumberVecN(c,3)&&(a.fillcolor=c);"fillalpha"===h&&"number"===c.ctype&&(a.fillalpha=c);"visible"===h&&"boolean"===c.ctype&&(a.visible=c.value);"pinned"===h&&"boolean"===c.ctype&&(a.pinned=c.value);"labeled"!==h&&"labelled"!==h||"boolean"!==
-c.ctype||(a.labeled=c.value);"printlabel"===h&&(a.printname=ba(c));"trace"===h&&"boolean"===c.ctype&&(c.value&&!a.drawtrace?(a.drawtrace=!0,qd(a)):a.drawtrace=c.value);"P"===a.kind&&a.movable&&("xy"===h&&g._helper.isNumberVecN(c,2)&&Ia(a,g.turnIntoCSList([c.value[0],c.value[1],l.real(1)]),"homog"),"xy"===h&&g._helper.isNumberVecN(c,3)&&Ia(a,c,"homog"),"x"===h&&"number"===c.ctype&&Ia(a,g.turnIntoCSList([l.mult(c,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]),"homog"),"y"===h&&"number"===c.ctype&&
-Ia(a,g.turnIntoCSList([a.homog.value[0],l.mult(c,a.homog.value[2]),a.homog.value[2]]),"homog"),"homog"===h&&g._helper.isNumberVecN(c,3)&&Ia(a,c,"homog"));"homog"===h&&"L"===a.kind&&a.movable&&g._helper.isNumberVecN(c,3)&&Ia(a,c,"homog");"Text"===a.kind&&("pressed"===h&&"boolean"===c.ctype&&a.checkbox&&(a.checkbox.checked=c.value),a.movable&&("xy"===h?g._helper.isNumberVecN(c,2)?a.homog=g.turnIntoCSList([c.value[0],c.value[1],l.real(1)]):g._helper.isNumberVecN(c,3)&&(a.homog=c):"homog"===h&&g._helper.isNumberVecN(c,
-3)?a.homog=c:"x"===h&&"number"===c.ctype?a.homog=g.turnIntoCSList([l.mult(c,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]):"y"===h&&"number"===c.ctype&&(a.homog=g.turnIntoCSList([a.homog.value[0],l.mult(c,a.homog.value[2]),a.homog.value[2]]))));a.behavior&&("mass"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.mass=c.value.real),"mass"===h&&"Sun"===a.behavior.type&&"number"===c.ctype&&(a.behavior.mass=c.value.real),"friction"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&
-(a.behavior.friction=c.value.real),"charge"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.charge=c.value.real),"radius"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.radius=c.value.real),"vx"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.vx=c.value.real),"vy"===h&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.vy=c.value.real),"v"===h&&"Mass"===a.behavior.type&&g._helper.isNumberVecN(c,2)&&(a.behavior.vx=c.value[0].value.real,a.behavior.vy=
-c.value[1].value.real));h=m[a.type]["set_"+h];if("function"===typeof h)return h(a,c)}};t.version$0=function(a,h){var c=["CindyJS"].concat(ne);return g.turnIntoCSList(c.map(w.wrap))};t.clearconsole$0=function(a,h){ia.clear()};t.err$1=function(a,h){var c="",b;"variable"===a[0].ctype?(c=a[0].name,b=J.getvar(a[0].name)):b=a[0];b=c+" ===> "+ba(A(b));ia.err(b);return k};t.errc$1=function(a,h){var c;"variable"===a[0].ctype?(c=A(J.getvar(a[0].name)),console.log(a[0].name+" ===> "+ba(c))):(c=A(a[0]),console.log(" ===> "+
-ba(c)));return k};t.print$1=function(a,h){ia.out(ba(A(a[0])),!0);return k};t.println$1=function(a,h){ia.out(ba(A(a[0])));return k};t.assert$2=function(a,h){var c=A(a[0]);if("boolean"===c.ctype){if(!1===c.value)return t.println$1([a[1]],h)}else ia.err("Condition for assert is not boolean");return k};t.dump$1=function(a,h){console.log(JSON.stringify(a[0]));return k};t.repeat$2=function(a,h){return t.repeat$3([a[0],null,a[1]],h)};t.repeat$3=function(a,h){var c=B(a[0]),b="#";null!==a[1]&&"variable"===
-a[1].ctype&&(b=a[1].name);if("number"!==c.ctype)return k;var c=Math.round(c.value.real),d=1,g=1,e=c+1,f=!1,l=!1,m=!1,n;void 0!==h.start&&(n=A(h.start),"number"===n.ctype&&(f=!0,g=n.value.real));void 0!==h.step&&(n=A(h.step),"number"===n.ctype&&(m=!0,d=n.value.real));void 0!==h.stop&&(n=A(h.stop),"number"===n.ctype&&(l=!0,e=n.value.real));!f||l||m||(e=d*c+g);f||!l||m||(g=-d*(c-1)+e,e+=d);f||l||!m||(e=d*c+g);f&&l&&!m&&(d=(e-g)/(c-1),e+=d);f&&!l&&m&&(e=d*c+g);!f&&l&&m&&(g=-d*(c-1)+e,e+=d);f&&l&&m&&(e+=
-d);(g<=e&&0<d||g>=e&&0>d)&&f&&l&&m&&(c=Math.floor((e-g)/d));J.newvar(b);e=k;for(f=0;f<c;f++)J.setvar(b,{ctype:"number",value:{real:f*d+g,imag:0}}),e=A(a[2]);J.removevar(b);return e};t.while$2=function(a,h){for(var c=a[1],b=a[0],d=A(b),e=k;"list"!==d.ctype&&d.value;)e=A(c),d=A(b);return e};t.apply$2=function(a,h){return t.apply$3([a[0],null,a[1]],h)};t.apply$3=function(a,h){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var c=c.value,d=[];J.newvar(b);
-for(var e=0;e<c.length;e++)J.setvar(b,c[e]),d[e]=A(a[2]);J.removevar(b);return{ctype:"list",value:d}};t.forall$2=function(a,h){return t.forall$3([a[0],null,a[1]],h)};t.forall$3=function(a,h){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);c=c.value;J.newvar(b);for(var d,e=0;e<c.length;e++)J.setvar(b,c[e]),d=A(a[2]);J.removevar(b);return d};t.select$2=function(a,h){return t.select$3([a[0],null,a[1]],h)};t.select$3=function(a,h){var c=B(a[0]);
-if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var c=c.value,d=[];J.newvar(b);for(var e=0,g=0;g<c.length;g++){J.setvar(b,c[g]);var f=A(a[2]);"boolean"===f.ctype&&!0===f.value&&(d[e]=c[g],e++)}J.removevar(b);return{ctype:"list",value:d}};t.flatten$1=function(a,h){function c(a,h){return-1===h||"list"!==a.ctype?a:[].concat.apply([],a.value.map(function(a){return c(a,h-1)}))}var b=B(a[0]);if("list"!==b.ctype)return b;var d=h.levels;void 0===d?d=1:(d=A(d),d=
-"number"===d.ctype?d.value.real:"string"===d.ctype&&"all"===d.value?-2:1);return{ctype:"list",value:c(b,d)}};t.createvar$1=function(a,h){"variable"===a[0].ctype&&J.newvar(a[0].name);return k};t.local=function(a,h){for(var c=0;c<a.length;c++)"variable"===a[c].ctype&&J.newvar(a[c].name);return k};t.removevar$1=function(a,h){var c=A(a[0]);"variable"===a[0].ctype&&J.removevar(a[0].name);return c};t.release=function(a,h){if(0===a.length)return k;for(var c=A(a[a.length-1]),b=0;b<a.length;b++)"variable"===
-a[b].ctype&&J.removevar(a[b].name);return c};t.regional=function(a,h){for(var c=0;c<a.length;c++)if("variable"===a[c].ctype){var b=a[c].name;J.newvar(b);J.pushVstack(b)}return k};t.genList=function(a,h){return g.turnIntoCSList(a.map(A))};D.assigntake=function(a,h){var c=a.args[0],b=A(c),d=B(a.args[1]),e=k;if("list"===b.ctype||"string"===b.ctype)d=Math.floor(d.value.real),0>d&&(d=b.value.length+d+1),0<d&&d<=b.value.length&&("list"===b.ctype?(b=b.value.slice(),b[d-1]=A(h),e=g.turnIntoCSList(b)):(b=
-b.value,b=b.substring(0,d-1)+ba(A(h))+b.substring(d,b.length),e=w.string(b)));bb([c,e])};D.assigndot=function(a,h){var c=A(a.obj),b=a.key;"geo"===c.ctype&&b&&ya.setField(c.value,b,B(h));return k};D.assignlist=function(a,h){var c=a.length,b=h.length;b<c&&(c=b);for(b=0;b<c;b++)bb([a[b],h[b]],[])};t.if$2=function(a,h){return t.if$3(a,h)};t.if$3=function(a,h){var c=B(a[0]);if("boolean"===c.ctype){if(!0===c.value)return A(a[1]);if(3===a.length)return A(a[2])}else ia.err("Condition for if is not boolean");
-return k};t.and$2=Hc;t.or$2=Ic;t.xor$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"boolean"===c.ctype&&"boolean"===b.ctype?{ctype:"boolean",value:c.value!==b.value}:k};t.not$1=function(a,h){var c=B(a[0]);return"boolean"===c.ctype?{ctype:"boolean",value:!c.value}:k};D.genericListMathGen=function(a,h,c){t[a+"$1"]=function(a,b){var d=A(a[0]);if("list"!==d.ctype)return k;d=d.value;if(0===d.length)return c;for(var r=d[0],e=1;e<d.length;e++)r=h(r,d[e]);return r};var b=a+"$3";t[a+"$2"]=function(a,c){return t[b]([a[0],
-null,a[1]])};t[b]=function(a,b){var d=B(a[0]);if("list"!==d.ctype)return k;d=d.value;if(0===d.length)return c;var r="#";null!==a[1]&&"variable"===a[1].ctype&&(r=a[1].name);J.newvar(r);J.setvar(r,d[0]);for(var e=A(a[2]),g=1;g<d.length;g++){J.setvar(r,d[g]);var f=A(a[2]),e=h(e,f)}J.removevar(r);return e}};D.genericListMathGen("product",w.mult,l.real(1));D.genericListMathGen("sum",w.add,l.real(0));D.genericListMathGen("max",w.max,k);D.genericListMathGen("min",w.min,k);t.max$2=function(a,h){var c=B(a[0]);
-if("list"===c.ctype)return t.max$3([c,null,a[1]]);var b=B(a[1]);return t.max$1([g.turnIntoCSList([c,b])])};t.min$2=function(a,h){var c=B(a[0]);if("list"===c.ctype)return t.min$3([c,null,a[1]]);var b=B(a[1]);return t.min$1([g.turnIntoCSList([c,b])])};t.add$2=Jc;t.sub$2=$b;t.mult$2=Kc;t.div$2=Lc;t.mod$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype?l.mod(c,b):k};t.pow$2=Mc;t.exp$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.exp(c):k};t.sin$1=function(a,
-h){var c=B(a[0]);return"number"===c.ctype?l.sin(c):k};t.sqrt$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.sqrt(c):k};D.laguerre=function(a,h,c){if("list"!==a.ctype)return k;var b=a.value.length-1,d;for(d=0;d<=b;d++)if("number"!==a.value[d].ctype)return k;if("number"!==h.ctype)return k;for(var e=[1,.3141,.5926,.5358,.9793,.2385,.6264,.3383,.2795,.0288],g,f,m,n=1;n<=c;n++){f=m=l.zero;g=a.value[b];for(d=b-1;0<=d;d--)m=l.add(f,l.mult(m,h)),f=l.add(g,l.mult(f,h)),g=l.add(a.value[d],l.mult(g,
-h));if(l._helper.isLessThan(l.abs(g),l.real(1E-14)))break;d=l.div(f,g);f=l.mult(d,d);g=l.sub(f,l.div(l.mult(l.real(2),m),g));m=l.sqrt(l.mult(l.real(b-1),l.sub(l.mult(l.real(b),g),f)));g=l.add(d,m);d=l.sub(d,m);l._helper.isLessThan(l.abs(g),l.abs(d))&&(g=d);d=l._helper.isLessThan(l.real(1E-14),l.abs(g))?l.div(l.real(b),g):l.mult(l.add(l.abs(h),l.one),l.complex(Math.cos(n),Math.sin(n)));if(l._helper.isLessThan(l.abs(d),l.real(1E-14)))break;0===n%20&&n<c-19&&(d=l.mult(d,l.real(e[Math.floor(n/20)])));
-h=l.sub(h,d)}return h};D.quadratic_roots=function(a){if("list"!==a.ctype)return k;var h=a.value[2],c=a.value[1];a=a.value[0];if(l._helper.isZero(a))return[l.zero,l.neg(l.div(c,h))];var b=l.sqrt(l.sub(l.mult(c,c),l.mult(l.real(4),l.mult(h,a))));0<=l.re(c)&&(b=l.neg(b));return[l.div(l.sub(b,c),l.mult(l.real(2),h)),l.div(l.mult(l.real(2),a),l.sub(b,c))]};D.roots=function(a){var h=[],c=a,b=a.value.length-1;if(0>=b)return g.turnIntoCSList([]);if(l._helper.isZero(a.value[b]))return h=D.roots(g.turnIntoCSList(a.value.slice(0,
-b))),g.append(h,l.infinity);if(1===b)h[0]=l.neg(l.div(a.value[0],a.value[1]));else if(2===b)h=D.quadratic_roots(a);else{for(var d=0;d<b-2;d++){h[d]=D.laguerre(a,l.zero,200);h[d]=D.laguerre(c,h[d],1);var e=[];e[b-d]=a.value[b-d];for(var f=b-d;0<f;f--)e[f-1]=l.add(a.value[f-1],l.mult(e[f],h[d]));e.shift();a=g.turnIntoCSList(e)}a=D.quadratic_roots(a);h[b-2]=a[0];h[b-1]=a[1]}return g.turnIntoCSList(h)};t.roots$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){for(var b=0;b<c.value.length;b++)if("number"!==
-c.value[b].ctype)return k;c=D.roots(c);return g.sort1(c)}return k};t.autodiff$3=function(a,h){var c="x",b;if("function"===a[0].ctype)b=Za[a[0].oper].body,c=a[0].args[0].name;else if("function"===typeof a[0].impl)b=a[0];else return console.log("could not parse function"),k;var d=B(a[1]),e=B(a[2]);if(1>e.value.real)return console.log("grade cant be < 1"),k;e=l.add(e,l.real(1));return P.autodiff(b,c,d,e)};t.cos$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.cos(c):k};t.tan$1=function(a,h){var c=
-B(a[0]);return"number"===c.ctype?l.tan(c):k};t.arccos$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.arccos(c):k};t.arcsin$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.arcsin(c):k};t.arctan$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.arctan(c):k};t.arctan2$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype?l.arctan2(c,b):k};t.arctan2$1=function(a,h){var c=B(a[0]);if("list"===c.ctype&&2===c.value.length){if(c=c.value,"number"===c[0].ctype&&
-"number"===c[1].ctype)return t.arctan2$2(c,h)}else if("number"===c.ctype)return l.arctan2(c);return k};t.log$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.log(c):k};D.recursiveGen=function(a){var h=l[a],c=g[a];t[a+"$1"]=function(a,b){var d=B(a[0]);return"number"===d.ctype?h(d):"list"===d.ctype?c(d):k}};D.recursiveGen("im");D.recursiveGen("re");D.recursiveGen("conjugate");D.recursiveGen("round");D.recursiveGen("ceil");D.recursiveGen("floor");D.recursiveGen("abs");t.abs_infix=t.abs$1;t.random$0=
-function(a,h){return l.real(l._helper.rand())};t.random$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?l.complex(c.value.real*l._helper.rand(),c.value.imag*l._helper.rand()):k};t.seedrandom$1=function(a,h){var c=B(a[0]);"number"===c.ctype&&l._helper.seedrandom(c.value.real);return k};t.randomnormal$0=function(a,h){return l.real(l._helper.randnormal())};t.randominteger$1=function(a,h){var c=B(a[0]);if("number"===c.ctype){var b=c.value.real|0,c=c.value.imag|0,b=b*l._helper.rand()|0,c=c*l._helper.rand()|
-0;return l.complex(b,c)}return k};t.randomint$1=t.randominteger$1;t.randombool$0=function(a,h){return.5<l._helper.rand()?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isreal$1=function(a,h){var c=A(a[0]);return"number"===c.ctype&&l._helper.isAlmostReal(c)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isinteger$1=function(a,h){var c=A(a[0]);return"number"===c.ctype&&l._helper.isAlmostReal(c)&&c.value.real===Math.floor(c.value.real)?{ctype:"boolean",value:!0}:{ctype:"boolean",
-value:!1}};t.iseven$1=function(a,h){var c=A(a[0]);return"number"===c.ctype&&l._helper.isAlmostReal(c)&&c.value.real/2===Math.floor(c.value.real/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isodd$1=function(a,h){var c=A(a[0]);return"number"===c.ctype&&l._helper.isAlmostReal(c)&&(c.value.real-1)/2===Math.floor((c.value.real-1)/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.iscomplex$1=function(a,h){return"number"===A(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",
-value:!1}};t.isstring$1=function(a,h){return"string"===A(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.islist$1=function(a,h){return"list"===A(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.ismatrix$1=function(a,h){var c=A(a[0]);return-1!==g._helper.colNumb(c)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.iscircle$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&"C"===c.value.kind&&"Circle"===c.value.matrix.usage?{ctype:"boolean",value:!0}:
-{ctype:"boolean",value:!1}};t.isconic$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&"C"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isline$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&"L"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.ispoint$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&"P"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isgeometric$1=function(a,h){return"geo"===A(a[0]).ctype?{ctype:"boolean",
-value:!0}:{ctype:"boolean",value:!1}};t.isnumbermatrix$1=function(a,h){var c=A(a[0]);return g.isNumberMatrix(c)};t.isnumbervector$1=function(a,h){var c=A(a[0]);return g.isNumberVector(c)};t.issun$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Sun"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.ismass$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Mass"===c.value.behavior.type?{ctype:"boolean",value:!0}:
-{ctype:"boolean",value:!1}};t.isspring$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Spring"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isbouncer$1=function(a,h){var c=A(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Bouncer"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isundefined$1=function(a,h){return"undefined"===A(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};
-var Hd={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"};t.algorithm$1=function(a,h){var c=A(a[0]);if("geo"===c.ctype){var c=c.value,b=c.type,d=B(h.compatibility);"string"===d.ctype&&/^cinderella$/i.test(d.value)&&(/^Select/.test(b)&&(c=u.csnames[c.args[0]],b=c.type),Hd.hasOwnProperty(b)?b=Hd[b]:"CircleMr"===b&&(b=c.pinned?"CircleByFixedRadius":"CircleByRadius"));return w.string(b)}return k};t.inputs$1=function(a,h){var c=A(a[0]);if("geo"===c.ctype){var c=c.value,b=c.type,d=
-[];c.args&&(d=c.args.map(function(a){return{ctype:"geo",value:u.csnames[a]}}));if(/^Select/.test(b)||m[b].isMovable)switch(c.kind){case "P":case "L":d.push(c.homog);break;case "C":d.push(c.matrix)}return g.turnIntoCSList(d)}return k};t.moveto$2=function(a,h){var c=A(a[0]),b=B(a[1]);"geo"===c.ctype&&(c=c.value,g._helper.isNumberVecN(b,2)?ya.setField(c,"xy",b):g._helper.isNumberVecN(b,3)&&ya.setField(c,"homog",b));return k};t.continuefromhere$0=function(a,h){ub();return k};t.matrixrowcolumn$1=function(a,
-h){var c=A(a[0]);return-1!==g._helper.colNumb(c)?g.realVector([c.value.length,c.value[0].value.length]):k};t.rowmatrix$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.turnIntoCSList([c]):k};t.columnmatrix$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.turnIntoCSList(c.value.map(function(a){return g.turnIntoCSList([a])})):k};t.submatrix$3=function(a,h){var c=A(a[0]),b=A(a[1]),d=A(a[2]);if("list"===c.ctype&&"number"===b.ctype&&"number"===d.ctype){var e=Math.round(b.value.real),b=Math.round(d.value.real),
-c=c.value.slice();0<b&&b<=c.length&&c.splice(b-1,1);var f=!0,c=c.map(function(a){if("list"!==a.ctype)f=!1;else return a=a.value.slice(),0<e&&e<=a.length&&a.splice(e-1,1),g.turnIntoCSList(a)});return f?g.turnIntoCSList(c):k}return k};t.complex$1=function(a,h){var c,b,d;d=B(a[0]);if("list"===d.ctype&&g.isNumberVector(d)){if(2===d.value.length)return c=d.value[0],b=d.value[1],l.complex(c.value.real-b.value.imag,b.value.real+c.value.imag);if(3===d.value.length)return c=d.value[0],b=d.value[1],d=d.value[2],
-c=l.div(c,d),b=l.div(b,d),l.complex(c.value.real-b.value.imag,b.value.real+c.value.imag)}return k};t.gauss$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?g.realVector([c.value.real,c.value.imag]):k};t.cross$2=Sc;t.crossratio$4=function(a,h){var c=A(a[0]),b=A(a[1]),d=A(a[2]),e=A(a[3]),f=M(c),m=M(b),n=M(d),p=M(e);return f!==k&&m!==k&&n!==k&&p!==k?g.crossratio3(f,m,n,p,g.ii):"number"===c.ctype&&"number"===b.ctype&&"number"===d.ctype&&"number"===e.ctype?l.div(l.mult(l.sub(c,d),l.sub(b,e)),l.mult(l.sub(c,
-e),l.sub(b,d))):k};t.para$2=function(a,h){var c=B(a[0]),b=B(a[1]),d=M(c),e=M(b);if(c!==k&&b!==k){var b=b.usage,f=d,l=e;if("Line"===c.usage||"Point"===b)f=e,l=d;c=g.cross(g.cross(g.linfty,l),f);return w.withUsage(c,"Line")}return k};t.perp$2=function(a,h){var c=B(a[0]),b=B(a[1]),d=M(c),e=M(b);if(c!==k&&b!==k){var f=b.usage||e.usage,b=d,m=e;if("Line"===(c.usage||d.usage)||"Point"===f)b=e,m=d;c=g.turnIntoCSList([m.value[0],m.value[1],l.zero]);c=g.cross(c,b);return w.withUsage(c,"Line")}return k};t.perp$1=
-function(a,h){var c=B(a[0]);return g._helper.isNumberVecN(c,2)?g.turnIntoCSList([l.neg(c.value[1]),c.value[0]]):k};t.parallel$2=t.para$2;t.perpendicular$2=t.perp$2;t.perpendicular$1=t.perp$1;t.meet$2=function(a,h){var c=M(a[0]),b=M(a[1]);return c!==k&&b!==k?(c=g.cross(c,b),w.withUsage(c,"Point")):k};t.join$2=function(a,h){var c=M(a[0]),b=M(a[1]);return c!==k&&b!==k?(c=g.cross(c,b),w.withUsage(c,"Line")):k};t.dist$2=function(a,h){var c=B(a[0]),b=B(a[1]),c=$b([c,b],[]);return t.abs$1([c],[])};t.dist_infix=
-t.dist$2;t.point$1=function(a,h){var c=A(a[0]);return g._helper.isNumberVecN(c,3)||g._helper.isNumberVecN(c,2)?w.withUsage(c,"Point"):c};t.line$1=function(a,h){var c=A(a[0]);return g._helper.isNumberVecN(c,3)?w.withUsage(c,"Line"):c};t.det$3=function(a,h){var c=M(a[0]),b=M(a[1]),d=M(a[2]);if(c!==k&&b!==k&&d!==k)return g.det3(c,b,d)};t.det$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.det(c)}return k};t.eig$1=function(a,h){var c=
-B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.eig(c)}return k};t.eigenvalues$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.eig(c,!1).value[0]}return k};t.rank$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.rank(c,h.precision)}return k};t.kernel$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);
-if(-1!==b&&b===c.value.length)return c=g.nullSpace(c,h.precision),g.transpose(c)}return k};t.eigenvectors$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.eig(c).value[1]}return k};t.area$3=function(a,h){var c=M(a[0]),b=M(a[1]),d=M(a[2]);if(c!==k&&b!==k&&d!==k){var e=c.value[2],f=b.value[2],m=d.value[2];if(!l._helper.isAlmostZero(e)&&!l._helper.isAlmostZero(f)&&!l._helper.isAlmostZero(m))return c=g.scaldiv(e,c),b=g.scaldiv(f,b),d=
-g.scaldiv(m,d),c=g.det3(c,b,d),l.realmult(.5,c)}return k};t.inverse$1=function(a,h){var c=B(a[0]);if("list"===c.ctype){var b=g._helper.colNumb(c);if(-1!==b&&b===c.value.length)return g.inverse(c)}return k};t.linearsolve$2=function(a,h){var c=B(a[0]),b=B(a[1]);if("list"===c.ctype){var d=g._helper.colNumb(c);if(-1!==d&&d===c.value.length&&g._helper.isNumberVecN(b,d))return g.linearsolve(c,b)}return k};var Ud=[[[]],[[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]]];t.mincostmatching$1=function(a,h){var c=A(a[0]);if(g.isNumberMatrix(c).value){var b=c.value.length,d=g._helper.colNumb(c),e=b<d?d:b,f,m,n=Array(e);for(f=0;f<e;++f)for(n[f]=Array(e),m=0;m<e;++m)n[f][m]=f<b&&m<d?c.value[f].value[m].value.real:0;c=nc(n);e=Array(b);for(f=0;f<b;++f)m=
-c[f],e[f]=m<d?l.real(m+1):l.real(0);return g.turnIntoCSList(e)}return k};t.take$2=oc;t.length$1=function(a,h){var c=A(a[0]);return"list"===c.ctype||"string"===c.ctype?l.real(c.value.length):k};t.pairs$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.pairs(c):k};t.triples$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.triples(c):k};t.cycle$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.cycle(c):k};t.consecutive$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.consecutive(c):
-k};t.reverse$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.reverse(c):k};t.directproduct$2=function(a,h){var c=A(a[0]),b=A(a[1]);return"list"===c.ctype&&"list"===b.ctype?g.directproduct(c,b):k};t.concat$2=Tc;t.common$2=Uc;t.remove$2=Vc;t.append$2=Wc;t.prepend$2=Xc;t.contains$2=function(a,h){var c=A(a[0]),b=A(a[1]);return"list"===c.ctype?g.contains(c,b):k};t.sort$2=function(a,h){return t.sort$3([a[0],null,a[1]],h)};t.sort$3=function(a,h){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";
-null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var c=c.value,d=[];J.newvar(b);var e;for(e=0;e<c.length;e++)J.setvar(b,c[e]),d[e]={val:c[e],result:A(a[2])};J.removevar(b);d.sort(w.compareResults);b=[];for(e=0;e<c.length;e++)b[e]=d[e].val;return{ctype:"list",value:b}};t.sort$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.sort1(c):k};t.set$1=function(a,h){var c=A(a[0]);return"list"===c.ctype?g.set(c):k};t.combinations$2=function(a,h){function c(a,h){a===f?n.push(g.turnIntoCSList(m.slice())):
-h<e&&(m[a]=b.value[h],c(a+1,h+1),c(a,h+1))}var b=A(a[0]),d=A(a[1]),e,f,m,n;if("number"===d.ctype){f=d.value.real|0;if("number"===b.ctype){e=b.value.real|0;e-f<f&&(f=e-f);if(0>f)return l.real(0);if(0===f)return l.real(1);if(1===f)return b;for(var p=d=1,q=1;q<=f;++q)var t=e-f+q|0,v=q|0,u=pc(t,v)|0,t=t/u|0,v=v/u|0,u=pc(d,v)|0,d=d/u|0,v=v/u|0,u=pc(t,p)|0,t=t/u|0,p=p/u|0,d=d*t|0,p=p*v|0;return l.real(d/p)}if("list"===b.ctype){e=b.value.length;if(0>f||f>e)return g.turnIntoCSList([]);if(0===f)return g.turnIntoCSList([g.turnIntoCSList([])]);
-if(f===e)return g.turnIntoCSList([b]);n=[];m=Array(f);c(0,0);return g.turnIntoCSList(n)}}return k};t.zeromatrix$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype?g.zeromatrix(c,b):k};t.zerovector$1=function(a,h){var c=B(a[0]);return"number"===c.ctype?g.zerovector(c):k};t.transpose$1=function(a,h){var c=B(a[0]);return"list"===c.ctype&&-1!==g._helper.colNumb(c)?g.transpose(c):k};t.row$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===b.ctype&&"list"===c.ctype&&
--1!==g._helper.colNumb(c)?g.row(c,b):k};t.column$2=function(a,h){var c=B(a[0]),b=B(a[1]);return"number"===b.ctype&&"list"===c.ctype&&-1!==g._helper.colNumb(c)?g.column(c,b):k};t.dict$0=function(a,h){var c=Ka.create(),b;for(b in h)h.hasOwnProperty(b)&&Ka.put(c,w.string(b),A(h[b]));return c};t.put$3=function(a,h){var c=A(a[0]),b=A(a[1]),d=A(a[2]);return"dict"===c.ctype?(c=Ka.clone(c),Ka.put(c,b,d),c):k};t.get$2=function(a,h){var c=A(a[0]),b=A(a[1]);return"dict"===c.ctype?Ka.get(c,b,k):k};t.red$1=function(a,
-h){var c=A(a[0]);return"number"===c.ctype?g.realVector([Math.min(1,Math.max(0,c.value.real)),0,0]):k};t.green$1=function(a,h){var c=A(a[0]);return"number"===c.ctype?g.realVector([0,Math.min(1,Math.max(0,c.value.real)),0]):k};t.blue$1=function(a,h){var c=A(a[0]);return"number"===c.ctype?g.realVector([0,0,Math.min(1,Math.max(0,c.value.real))]):k};t.gray$1=function(a,h){var c=A(a[0]);return"number"===c.ctype?(c=Math.min(1,Math.max(0,c.value.real)),g.realVector([c,c,c])):k};t.grey$1=t.gray$1;D.HSVtoRGB=
-function(a,h,c){var b,d,e,f,k,l;a&&void 0===h&&void 0===c&&(h=a.s,c=a.v,a=a.h);f=Math.floor(6*a);k=6*a-f;a=c*(1-h);l=c*(1-k*h);h=c*(1-(1-k)*h);switch(f%6){case 0:b=c;d=h;e=a;break;case 1:b=l;d=c;e=a;break;case 2:b=a;d=c;e=h;break;case 3:b=a;d=l;e=c;break;case 4:b=h;d=a;e=c;break;case 5:b=c,d=a,e=l}return g.realVector([b,d,e])};t.hue$1=function(a,h){var c=A(a[0]);return"number"===c.ctype?(c=c.value.real,c-=Math.floor(c),D.HSVtoRGB(c,1,1)):k};D.shapeconvert=function(a){var h,c;if("circle"===a.type){h=
-a.value.value[0];h=w.div(h,h.value[2]);var b=h.value[0].value.real,d=h.value[1].value.real;a=a.value.value[1].value.real;c=Array(125);var e=2*Math.PI/125;for(h=0;125>h;h++)c[h]={X:b+Math.cos(h*e)*a,Y:d+Math.sin(h*e)*a};return[c]}if("polygon"===a.type){b=[];for(h=0;h<a.value.length;h++){d=a.value[h];c=[];for(e=0;e<d.length;e++)c[e]={X:d[e].X,Y:d[e].Y};b[h]=c}return b}};D.shapeop=function(a,h,c){a=D.shapeconvert(a);var b=D.shapeconvert(h);ClipperLib.JS.ScaleUpPaths(a,1E3);ClipperLib.JS.ScaleUpPaths(b,
-1E3);h=new ClipperLib.Clipper;h.AddPaths(a,ClipperLib.PolyType.ptSubject,!0);h.AddPaths(b,ClipperLib.PolyType.ptClip,!0);var b=a=ClipperLib.PolyFillType.pftNonZero,d=new ClipperLib.Paths;h.Execute(c,d,a,b);ClipperLib.JS.ScaleDownPaths(d,1E3);return{ctype:"shape",type:"polygon",value:d}};D.shapecommon=function(a,h){return D.shapeop(a,h,ClipperLib.ClipType.ctIntersection)};D.shaperemove=function(a,h){return D.shapeop(a,h,ClipperLib.ClipType.ctDifference)};D.shapeconcat=function(a,h){return D.shapeop(a,
-h,ClipperLib.ClipType.ctUnion)};t.key$0=function(a,h){return{ctype:"string",value:Qc}};t.keycode$0=function(a,h){return l.real(Rc)};t.mouse$0=function(a,h){return g.realVector([ta[0],ta[1]])};t.mover$0=function(a,h){if(fa&&fa.mover)return{ctype:"geo",value:fa.mover};console.log("Not moving anything at the moment");return k};t.translate$1=function(a,h){var c=B(a[0]);"list"===c.ctype&&g.isNumberVector(c)&&2===c.value.length&&z.translate(c.value[0].value.real,c.value[1].value.real);return k};t.rotate$1=
-function(a,h){var c=B(a[0]);"number"===c.ctype&&z.rotate(c.value.real);return k};t.scale$1=function(a,h){var c=B(a[0]);"number"===c.ctype&&z.scale(c.value.real);return k};t.greset$0=function(a,h){var c=$a.stack.length;z.greset();for(var b=0;b<c;b++)y.restore();return k};t.gsave$0=function(a,h){z.gsave();y.save();return k};t.grestore$0=function(a,h){z.grestore();y.restore();return k};t.color$1=function(a,h){var c=B(a[0]);"list"===c.ctype&&g.isNumberVector(c).value&&z.setcolor(c);return k};t.linecolor$1=
-function(a,h){var c=B(a[0]);"list"===c.ctype&&g.isNumberVector(c).value&&z.setlinecolor(c);return k};t.pointcolor$1=function(a,h){var c=B(a[0]);"list"===c.ctype&&g.isNumberVector(c).value&&z.setpointcolor(c);return k};t.alpha$1=function(a,h){var c=B(a[0]);"number"===c.ctype&&z.setalpha(c);return k};t.pointsize$1=function(a,h){var c=B(a[0]);"number"===c.ctype&&z.setpointsize(c);return k};t.linesize$1=function(a,h){var c=B(a[0]);"number"===c.ctype&&z.setlinesize(c);return k};t.textsize$1=function(a,
-h){var c=B(a[0]);"number"===c.ctype&&z.settextsize(c);return k};t.playanimation$0=function(a,h){I();return k};t.pauseanimation$0=function(a,h){Ca();return k};t.stopanimation$0=function(a,h){Da();return k};t.text$1=function(a,h){var c=B(a[0]);return w.string(ba(c))};t.replace$3=function(a,h){var c=A(a[0]),b=A(a[1]),d=A(a[2]);if("string"===c.ctype&&"string"===b.ctype&&"string"===d.ctype)return c=c.value,b=b.value.replace(/[^A-Za-z0-9]/g,"\\$&"),d=d.value.replace(/\$/g,"$$$$"),c=c.replace(new RegExp(b,
-"g"),d),{ctype:"string",value:c}};t.replace$2=function(a,h){function c(a,c,h){var e="";d=b=-1;for(var g=0;g<c.length;g++){var f=c[g][0],k=a.indexOf(f,h);-1!==k&&(-1===b?(e=f,b=k,d=g):k<b&&(e=f,b=k,d=g))}return e}var b,d,e,g=A(a[0]);e=A(a[1]);if("string"===g.ctype&&"list"===e.ctype){for(var g=g.value,f=[],l=0;l<e.value.length;l++){var m=e.value[l];"list"===m.ctype&&2===m.value.length&&"string"===m.value[0].ctype&&"string"===m.value[1].ctype&&(f[f.length]=[m.value[0].value,m.value[1].value])}b=-1;for(e=
-c(g,f,0);-1!==b;)g=g.substring(0,b)+f[d][1]+g.substring(b+e.length,g.length),e=b+f[d][1].length,e=c(g,f,e);return{ctype:"string",value:g}}return k};t.substring$3=function(a,h){var c=A(a[0]),b=B(a[1]),d=B(a[2]);return"string"===c.ctype&&"number"===b.ctype&&"number"===d.ctype?{ctype:"string",value:c.value.substring(Math.floor(b.value.real),Math.floor(d.value.real))}:k};t.tokenize$2=function(a,h){var c=A(a[0]),b=A(a[1]);if("string"===c.ctype&&"string"===b.ctype)return t.tokenize$2([c,g.turnIntoCSList([b])],
-h);if("string"===c.ctype&&"list"===b.ctype){c=c.value;if(0===b.value.length){b=!0;if(void 0!==h.autoconvert){var d=A(h.autoconvert);"boolean"===d.ctype&&(b=d.value)}return b&&""!==c&&(b=Number(c),!isNaN(b))?l.real(b):w.string(c)}var d=b.value[0],e=g.turnIntoCSList(b.value.slice(1)),c=c.split(d.value);return g.turnIntoCSList(c.map(function(a){return t.tokenize$2([w.string(a),e],h)}))}return k};t.indexof$2=function(a,h){var c=A(a[0]),b=A(a[1]);return"string"===c.ctype&&"string"===b.ctype?(c=c.value.indexOf(b.value),
-l.real(c+1)):k};t.indexof$3=function(a,h){var c=A(a[0]),b=A(a[1]),d=A(a[2]);return"string"===c.ctype&&"string"===b.ctype&&"number"===d.ctype?(c=c.value.indexOf(b.value,Math.round(d.value.real)-1),l.real(c+1)):k};t.parse$1=function(a,h){var c=A(a[0]);return"string"===c.ctype?(c=Ra(c.value),A(c)):k};t.unicode$1=function(a,h){var c;c=A(a[0]);var b=16;if(h.base){var d=A(h.base);"number"===d.ctype&&(b=d.value.real)}if("string"===c.ctype)c=parseInt(c.value,b);else if("number"===c.ctype)c=c.value.real;else return k;
-"undefined"!==typeof String.fromCodePoint?c=String.fromCodePoint(c):65535>=c?c=String.fromCharCode(c):(c-=65536,c=String.fromCharCode((c>>10)+55296,(c&1023)+56320));return w.string(c)};t.international$1=function(a,h){return t.international$2([a[0],null],h)};t.international$2=function(a,h){var c=A(a[0]);if("string"!==c.ctype)return k;var b=(p.translations||{})[p.language||"en"]||{};if(!b.hasOwnProperty(c.value))return c;var d=b[c.value];if("string"===typeof d)return w.string(d);if(null===a[1])return c;
-var e=A(a[1]),e="number"===e.ctype?e.value.real:0,b=(b._pluralFormFunction||Vd)(e);return b<d.length?w.string(d[b]):c};t.currentlanguage$0=function(a,h){return w.string(p.language||"en")};D.basismap=function(a,h,c,b){var d=g.turnIntoCSList([a,h,c]),d=g.adjoint3(g.transpose(d));b=w.mult(d,b);d=g.turnIntoCSList([w.mult(b.value[0],a),w.mult(b.value[1],h),w.mult(b.value[2],c)]);return g.transpose(d)};t.map$8=function(a,h){var c=M(a[0]),b=M(a[1]),d=M(a[2]),e=M(a[3]),f=M(a[4]),l=M(a[5]),m=M(a[6]),n=M(a[7]);
-return f!==k&&l!==k&&m!==k&&n!==k&&c!==k&&b!==k&&d!==k&&e!==k?(f=D.basismap(f,l,m,n),c=D.basismap(c,b,d,e),c=w.mult(f,g.adjoint3(c)),g.normalizeMax(c)):k};t.map$6=function(a,h){var c=M(a[0]),b=M(a[1]),d=M(a[2]),e=g.realVector([0,0,1]),f=g.cross,l=f(f(d,f(e,f(c,b))),f(b,f(e,f(c,d)))),m=M(a[3]),n=M(a[4]),p=M(a[5]),e=f(f(p,f(e,f(m,n))),f(n,f(e,f(m,p))));return m!==k&&n!==k&&p!==k&&e!==k&&c!==k&&b!==k&&d!==k&&l!==k?(m=D.basismap(m,n,p,e),c=D.basismap(c,b,d,l),c=w.mult(m,g.adjoint3(c)),g.normalizeMax(c)):
-k};t.map$4=function(a,h){var c=g.ii,b=g.jj,d=M(a[0]),e=M(a[1]),f=M(a[2]),l=M(a[3]);return f!==k&&l!==k&&d!==k&&e!==k?(f=D.basismap(f,l,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,g.adjoint3(c)),g.normalizeMax(c)):k};t.map$2=function(a,h){var c=g.ii,b=g.jj,d=M(a[0]),e=w.add(g.realVector([1,0,0]),d),f=M(a[1]),l=w.add(g.realVector([1,0,0]),f);return f!==k&&l!==k&&d!==k&&e!==k?(f=D.basismap(f,l,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,g.adjoint3(c)),g.normalizeMax(c)):k};t.pointreflect$1=function(a,h){var c=g.ii,
-b=g.jj,d=M(a[0]),e=w.add(g.realVector([1,0,0]),d),f=w.add(g.realVector([-1,0,0]),d);return f!==k&&d!==k&&e!==k?(f=D.basismap(d,f,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,g.adjoint3(c)),g.normalizeMax(c)):k};t.linereflect$1=function(a,h){var c=g.ii,b=g.jj,d=M(a[0]),e=g.realVector([Math.random(),Math.random(),Math.random()]),f=g.realVector([Math.random(),Math.random(),Math.random()]),e=g.cross(e,d),f=g.cross(f,d);return d!==k&&e!==k?(d=D.basismap(e,f,c,b),c=D.basismap(e,f,b,c),c=w.mult(d,g.adjoint3(c)),
-g.normalizeMax(c)):k};D.extractPointVec=function(a){var h={ok:!1};if("geo"===a.ctype){var c=a.value;if("P"===c.kind)return h.x=ya.getField(c,"x"),h.y=ya.getField(c,"y"),h.z=l.real(1),h.ok=!0,h}if("list"!==a.ctype)return h;var b=a.value;if(2===b.length&&(a=b[0],c=b[1],"number"===a.ctype&&"number"===c.ctype))return h.x=a,h.y=c,h.z=l.real(1),h.ok=!0,h;3===b.length&&(a=b[0],c=b[1],b=b[2],"number"===a.ctype&&"number"===c.ctype&&"number"===b.ctype&&(h.x=l.div(a,b),h.y=l.div(c,b),h.z=l.real(1),h.ok=!0));
-return h};t.polygon$1=function(a,h){var c=A(a[0]);if("list"===c.ctype){for(var b=[],d=0;d<c.value.length;d++){var e=D.extractPoint(c.value[d]);if(!e.ok)return k;b[d]={X:e.x,Y:e.y}}return{ctype:"shape",type:"polygon",value:[b]}}return k};t.circle$2=function(a,h){var c=B(a[0]),b=B(a[1]),c=D.extractPointVec(c);if(!c.ok||"number"!==b.ctype)return k;c=g.turnIntoCSList([c.x,c.y,c.z]);return{ctype:"shape",type:"circle",value:g.turnIntoCSList([c,b])}};t.screen$0=function(a,h){var c=z.drawingstate.initialmatrix,
-b=function(a,b){var h=a-c.tx,d=b+c.ty;return{X:(h*c.d-d*c.b)/c.det,Y:-(-h*c.c+d*c.a)/c.det}};return{ctype:"shape",type:"polygon",value:[[b(0,0),b(da,0),b(da,ca),b(0,ca)]]}};t.halfplane$2=function(a,b){var c=B(a[0]),d=B(a[1]),e=M(c),f=M(d);if(c!==k&&d!==k){var m=d.usage,d=e,n=f;if("Line"===c.usage||"Point"===m)d=f,n=e;c=g.turnIntoCSList([n.value[0],n.value[1],l.zero]);c=g.cross(c,d);c=g.cross(n,c);c=w.div(c,c.value[2]);d=w.div(d,d.value[2]);d=g.sub(d,c);n=g.abs(d);d=w.div(d,n);n=c.value[0].value.real;
-c=c.value[1].value.real;e=1E3*d.value[0].value.real;d=1E3*d.value[1].value.real;return{ctype:"shape",type:"polygon",value:[[{X:n+d/2,Y:c-e/2},{X:n+d/2+e,Y:c-e/2+d},{X:n-d/2+e,Y:c+e/2+d},{X:n-d/2,Y:c+e/2}]]}}return k};t.element$1=function(a,b){var c=A(a[0]);return"string"===c.ctype&&u.csnames.hasOwnProperty(c.value)?{ctype:"geo",value:u.csnames[c.value]}:k};D.all$1=function(a,b){var c=A(a[0]);return"geo"===c.ctype&&c.value.incidences?g.ofGeos(c.value.incidences.map(function(a){return u.csnames[a]}).filter(b)):
-g.nil};t.allpoints$0=function(a,b){return g.ofGeos(u.points)};t.allpoints$1=function(a,b){return D.all$1(a,function(a){return"P"===a.kind})};t.allmasses$0=function(a,b){return g.ofGeos(ga)};t.allmasses$1=function(a,b){return D.all$1(a,function(a){return"P"===a.kind&&a.behavior&&"Mass"===a.behavior.type})};t.allsprings$0=function(a,b){return g.ofGeos(zc)};t.allsprings$1=function(a,b){return D.all$1(a,function(a){return"S"===a.kind&&a.behavior&&"Spring"===a.behavior.type})};t.alllines$0=function(a,
-b){return g.ofGeos(u.lines)};t.alllines$1=function(a,b){return D.all$1(a,function(a){return"L"===a.kind||"S"===a.kind})};t.allsegments$0=function(a,b){return g.ofGeos(u.lines.filter(function(a){return"S"===a.kind}))};t.allsegments$1=function(a,b){return D.all$1(a,function(a){return"S"===a.kind})};t.allconics$0=function(a,b){return g.ofGeos(u.conics)};t.allconics$1=function(a,b){return D.all$1(a,function(a){return"C"===a.kind})};t.allcircles$0=function(a,b){return g.ofGeos(u.conics.filter(function(a){return"Circle"===
-a.matrix.usage}))};t.allcircles$1=function(a,b){return D.all$1(a,function(a){return"C"===a.kind&&"Circle"===a.matrix.usage})};t.allelements$0=function(a,b){return g.ofGeos(u.gslp)};t.allelements$1=function(a,b){return D.all$1(a,function(a){return!0})};t.incidences$1=t.allelements$1;t.createpoint$2=function(a,b){var c=A(a[0]),d=M(a[1]);return"string"!==c.ctype?(console.log("Name must be a string"),k):"list"!==d.ctype&&g.isNumberVector(d)?(console.log("Position must be a number vector"),k):Ha({name:c.value,
-type:"Free",labeled:!0,pos:d})};t.create$3=function(a,b){var c=A(a[0]),d=A(a[1]),e=A(a[2]),f,n;if("string"===c.ctype)f=c.value;else{if("list"!==c.ctype)return console.log("Names must be a string or a list of strings"),k;if(1!==c.value.length){f=w.string(c.value.map(function(a){return a.value}).join("__"));f=t.create$3([f,d,e],b);if(f!==k)for(d=w.string(f.kind.replace(/^(.*)s$/,"Select$1")),e=g.turnIntoCSList([w.string(f.name)]),n=0;n<c.value.length;++n)t.create$3([c.value[n],d,e],{index:l.real(n+
-1)});return f}if("string"!==c.value[0].ctype)return console.log("Element of names list must be a string"),k;f=c.value[0].value}if("string"!==d.ctype)return console.log("Type must be a string"),k;if("list"!==e.ctype)return console.log("Arguments must be a list"),k;if(!m.hasOwnProperty(d.value)&&!tc.hasOwnProperty(d.value)&&!rd.hasOwnProperty(d.value))return console.log("Invalid geometric operation: '"+d.value+"'"),k;var c=[],p=null;for(n=0;n<e.value.length;n++){var q=e.value[n];if("string"===q.ctype)c.push(q.value);
-else if("geo"===q.ctype)c.push(q.value.name);else if(p=M(q),p===k)return console.log("Unknown argument type"),k}f={name:f,type:d.value,labeled:!0};p&&(f.pos=p);0<c.length&&(f.args=c);d=B(b.index);"number"===d.ctype&&(f.index=d.value.real|0);return Ha(f)};t.javascript$1=function(a,b){var c=A(a[0]);"string"===c.ctype&&(new Function(c.value)).call(oa);return k};t.use$1=function(a,b){function c(a,c,b){t[a.toLowerCase()+"$"+c]=b}var d=A(a[0]);if("string"===d.ctype){var d=d.value,e;p.plugins&&(e=p.plugins[d]);
-e||(e=wa._pluginRegistry[d]);if(e)return e({instance:oa,config:p,nada:k,evaluate:A,extractPoint:D.extractPoint,evaluateAndVal:B,defineFunction:c,addShutdownHook:jb.push.bind(jb),addAutoCleaningEventListener:H,getVariable:J.getvar.bind(J),getInitialMatrix:function(){return z.drawingstate.initialmatrix},setTextRenderer:function(a,c){Bc=a;c&&(td=c)},getImage:function(a,c){"string"===typeof a&&(a=w.string(a));var b=La(a);if(!b)return null;!c&&b.cdyUpdate&&b.cdyUpdate();return b},getMyfunction:function(a){return Za.hasOwnProperty(a)?
-Za[a]:null}}),{ctype:"boolean",value:!0};console.log("Plugin "+d+" not found");return{ctype:"boolean",value:!1}}return k};t.format$2=function(a,b){function c(a){a=a.toFixed(f);var c;do c=a,a=a.substring(0,a.length-1);while(""!==a&&"-"!==a&&+a===+c);return""+c}function d(a){var b;return"number"===a.ctype?(b=c(a.value.real),a=c(a.value.imag),b="0"===a?b:"-"===a.substring(0,1)?b+" - i*"+a.substring(1):b+" + i*"+a,{ctype:"string",value:b}):"list"===a.ctype?{ctype:"list",value:a.value.map(d)}:{ctype:"string",
-value:ba(a).toString()}}var e=B(a[0]),g=B(a[1]),f;return"number"!==e.ctype&&"list"!==e.ctype||"number"!==g.ctype?k:(f=Math.max(0,Math.min(20,Math.round(g.value.real))),d(e))};Date.now||(Date.now=function(){return(new Date).getTime()});var Id=0;t.timestamp$0=function(a,b){return l.real(Date.now())};t.seconds$0=function(a,b){return l.real((Date.now()-Id)/1E3)};t.resetclock$0=function(a,b){Id=Date.now();return k};t.time$0=function(a,b){var c=new Date;return g.realVector([c.getHours(),c.getMinutes(),
-c.getSeconds(),c.getMilliseconds()])};t.date$0=function(a,b){var c=new Date;return g.realVector([c.getFullYear(),c.getMonth()+1,c.getDate()])};t.simulationtime$0=function(a,b){return l.real(Cb*Fd)};t.settimeout$2=function(a,b){function c(){A(g);e()}var d=A(a[0]),g=a[1];"number"===d.ctype&&"undefined"!==typeof window&&window.setTimeout(c,1E3*d.value.real);return k};D.formatForWebGL=function(a){return a.toFixed(10)};t.generateWebGL$2=function(a,b){var c=D.formatForWebGL,d=a[0],e=A(a[1]);console.log(e);
-if("list"!==e.ctype)return k;for(var g=[],f=0;f<e.value.length;f++)"string"===e.value[f].ctype&&g.push(e.value[f].value);console.log("***********");console.log(g);e=D.plotvars(d);console.log(e);-1===e.indexOf("a")&&-1===e.indexOf("b")&&-1===e.indexOf("c")&&-1===e.indexOf("d")&&-1===e.indexOf("e")&&-1===e.indexOf("f")&&(d=B(d));if("number"===d.ctype)return{ctype:"string",value:"vec2("+c(d.value.real)+","+c(d.value.imag)+")"};if("variable"===d.ctype)return{ctype:"string",value:d.name};if("string"===
-d.ctype||"void"===d.ctype)return d;if(2===d.args.length&&("infix"===d.ctype||"function"===d.ctype)){c=t.compileToWebGL$1([d.args[0]],{});e=t.compileToWebGL$1([d.args[1]],{});if("+"===d.oper||"add"===d.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:e.value}:{ctype:"string",value:"addc("+c.value+","+e.value+")"};if("*"===d.oper||"mult"===d.oper)return{ctype:"string",value:"multc("+c.value+","+e.value+")"};if("/"===d.oper||"div"===d.oper)return{ctype:"string",value:"divc("+c.value+
-","+e.value+")"};if("-"===d.oper||"sub"===d.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:"negc("+e.value+")"}:{ctype:"string",value:"subc("+c.value+","+e.value+")"};if("^"===d.oper||"pow"===d.oper)return{ctype:"string",value:"powc("+c.value+","+e.value+")"}}if("function"===d.ctype&&1===d.args.length){c=t.compileToWebGL$1([d.args[0]],{});if("sin$1"===d.oper)return{ctype:"string",value:"sinc("+c.value+")"};if("cos$1"===d.oper)return{ctype:"string",value:"cosc("+c.value+")"};
-if("tan$1"===d.oper)return{ctype:"string",value:"tanc("+c.value+")"};if("exp$1"===d.oper)return{ctype:"string",value:"expc("+c.value+")"};if("log$1"===d.oper)return{ctype:"string",value:"logc("+c.value+")"};if("arctan$1"===d.oper)return{ctype:"string",value:"arctanc("+c.value+")"};if("arcsin$1"===d.oper)return{ctype:"string",value:"arcsinc("+c.value+")"};if("arccos$1"===d.oper)return{ctype:"string",value:"arccosc("+c.value+")"};if("sqrt$1"===d.oper)return{ctype:"string",value:"sqrtc("+c.value+")"}}return k};
-t.compileToWebGL$1=function(a,b){var c,d;c=D.formatForWebGL;var e=a[0];d=D.plotvars(e);-1===d.indexOf("a")&&-1===d.indexOf("b")&&-1===d.indexOf("c")&&-1===d.indexOf("d")&&-1===d.indexOf("e")&&-1===d.indexOf("f")&&(e=B(e));if("number"===e.ctype)return{ctype:"string",value:"vec2("+c(e.value.real)+","+c(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)){c=t.compileToWebGL$1([e.args[0]],
-{});d=t.compileToWebGL$1([e.args[1]],{});if("+"===e.oper||"add"===e.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:d.value}:{ctype:"string",value:"addc("+c.value+","+d.value+")"};if("*"===e.oper||"mult"===e.oper)return{ctype:"string",value:"multc("+c.value+","+d.value+")"};if("/"===e.oper||"div"===e.oper)return{ctype:"string",value:"divc("+c.value+","+d.value+")"};if("-"===e.oper||"sub"===e.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:"negc("+d.value+
-")"}:{ctype:"string",value:"subc("+c.value+","+d.value+")"};if("^"===e.oper||"pow"===e.oper)return{ctype:"string",value:"powc("+c.value+","+d.value+")"}}if("function"===e.ctype&&1===e.args.length){c=t.compileToWebGL$1([e.args[0]],{});if("sin$1"===e.oper)return{ctype:"string",value:"sinc("+c.value+")"};if("cos$1"===e.oper)return{ctype:"string",value:"cosc("+c.value+")"};if("tan$1"===e.oper)return{ctype:"string",value:"tanc("+c.value+")"};if("exp$1"===e.oper)return{ctype:"string",value:"expc("+c.value+
-")"};if("log$1"===e.oper)return{ctype:"string",value:"logc("+c.value+")"};if("arctan$1"===e.oper)return{ctype:"string",value:"arctanc("+c.value+")"};if("arcsin$1"===e.oper)return{ctype:"string",value:"arcsinc("+c.value+")"};if("arccos$1"===e.oper)return{ctype:"string$1",value:"arccosc("+c.value+")"};if("sqrt$1"===e.oper)return{ctype:"string",value:"sqrtc("+c.value+")"}}return k};t.setsimulationspeed$1=function(a,b){var c=B(a[0]);"number"===c.ctype&&sa(c.value.real);return k};t.setsimulationaccuracy$1=
-function(a,b){var c=B(a[0]);"number"===c.ctype&&"undefined"!==typeof O&&"undefined"!==typeof O.env&&(O.env.accuracy=Math.max(1,c.value.real|0));return k};t.setsimulationquality$1=function(a,b){var c=B(a[0]);"number"===c.ctype&&"undefined"!==typeof O&&"undefined"!==typeof O.env&&(c=c.value.real,0===c&&(O.env.errorbound=.01,O.env.lowestdeltat=1E-5,O.env.slowdownfactor=2),1===c&&(O.env.errorbound=.001,O.env.lowestdeltat=1E-7,O.env.slowdownfactor=2),2===c&&(O.env.errorbound=1E-5,O.env.lowestdeltat=1E-10,
-O.env.slowdownfactor=4),3===c&&(O.env.errorbound=1E-6,O.env.lowestdeltat=1E-12,O.env.slowdownfactor=4));return k};var Wb=null,dc=null;t.createtool$3=function(a,b){var c,d="left",e="top",g=null;b.space&&(c=A(b.space),"number"===c.ctype&&(g=c.value.real/2));var f=null;b.toolbar&&(c=A(b.toolbar),"string"===c.ctype&&((f=document.getElementById(c.value))||console.warn("Element #"+c.value+" not found")));if(!f){if(b.reference){var l=A(b.reference);if("string"===l.ctype)switch(l.value){case "UR":d="right";
-break;case "LL":e="bottom";break;case "LR":d="right",e="bottom"}}f=document.createElement("div");f.className="CindyJS-toolbar";ka.parentNode.appendChild(f);l=A(a[1]);c=A(a[2]);"number"===l.ctype&&(f.style[d]=l.value.real+"px");"number"===c.ctype&&(f.style[e]=c.value.real+"px");null!==g&&(f.style.margin=-g+"px")}l=A(a[0]);if("string"===l.ctype)l=[[l.value]];else if("list"===l.ctype)l=l.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 console.log("Name must be a string or a list of strings"),k;if(b.flipped&&(c=A(b.flipped),"boolean"===c.ctype&&c.value)){console.log("Flipping");var m=0;c=l.length;l.forEach(function(a){a.length>m&&(m=a.length)});for(var n=[],p=0;p<m;++p){n[p]=[];for(var q=0;q<c;++q)n[p][q]=l[q][p]||null}l=n}"bottom"===e&&l.reverse();l.forEach(function(a){"right"===d&&a.reverse();var c=document.createElement("div");f.appendChild(c);a.forEach(function(a){function b(){Wb&&
-Wb.classList.remove("CindyJS-active");Wb=d;d.classList.add("CindyJS-active");qc=a;var c=G[qc].actions;dc&&(dc.textContent=c[0].tooltip||"");ua=[];sb=Ua=0}G.hasOwnProperty(a)||(console.log("Tool '"+a+"' not implemented yet."),a=null);if(null===a){var h=document.createElement("span");h.className="CindyJS-spacer";c.appendChild(h)}else{var d=document.createElement("button"),h=document.createElement("img");h.src=wa.getBaseDir()+"images/"+a+".png";d.appendChild(h);d.addEventListener("click",b);Wb||b();
-null!==g&&(d.style.margin=g+"px");c.appendChild(d)}})});return k};t.dropped$0=function(){return kc};t.droppoint$0=function(){return lc};t.parsecsv$1=function(a,b){var c=!0,d=B(b.autoconvert);"boolean"===d.ctype&&(c=d.value);var e=null,d=B(b.delimiter);"string"===d.ctype&&/^[^\"\r\n]$/.test(d.value)&&(e=d.value);d=B(a[0]);if("string"!==d.ctype)return console.log("CSV data is not a string"),k;var d=d.value,f='(?:"((?:[^"]+|"")*)"|([^]*?))(\r\n|(,)|[\r\n]|$)';e&&(e=e.replace(/[^A-Za-z0-9]/g,"\\$&").replace(/\$/g,
-"$$$$"),f=f.replace(/,/g,e));for(var f=new RegExp(f,"g"),e=[],m=[],n=null;f.lastIndex<d.length;){var p=f.exec(d),q=p[2];"string"===typeof p[1]&&(q=p[1].replace(/""/g,'"'));q=c?/^[Tt]rue$/.test(q)?w.bool(!0):/^[Ff]alse$/.test(q)?w.bool(!1):/^[\-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+|Infinity)$/.test(q)?l.real(Number(q)):w.string(q):w.string(q);e.push(q);p[4]&&f.lastIndex===d.length&&(e.push(w.string("")),p={});if(!p[4]){null===n&&(n=e.length);if(n<e.length)for(n=e.length,p=0;p<m.length;++p)for(q=m[p].length;q<
-n;++q)m[p][q]=k;else if(n>e.length)for(p=e.length;p<n;++p)e[p]=k;m.push(e);e=[]}}return g.turnIntoCSList(m.map(g.turnIntoCSList))};t.load$2=function(a,b){return t.load$3([a[0],null,a[1]],b)};t.load$3=function(a,b){function c(){if(l.readyState===XMLHttpRequest.DONE){var c;200===l.status?c=w.string(String(l.responseText)):(ia.err("Failed to load "+f+": "+l.statusText),c=k);J.newvar(d);J.setvar(d,c);A(a[2]);J.removevar(d);e()}}var d="#";null!==a[1]&&"variable"===a[1].ctype&&(d=a[1].name);var g=B(a[0]),
-f=null,l=null;"string"===g.ctype&&/^https?:\/\//.test(g.value)&&(f=g.value);return null!==f?(l=new XMLHttpRequest,l.onreadystatechange=c,l.open("GET",f),l.send(),w.bool(!0)):k};D.extractPoint=function(a){var b={ok:!1};if("geo"===a.ctype){var c=a.value;if("P"===c.kind)return b.x=ya.getField(c,"x").value.real,b.y=ya.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};t.draw$1=function(a,b){var c=B(a[0]);if("shape"===c.ctype)D.drawshape(c,b);else if("Line"===c.usage)x.handleModifs(b,x.lineModifs),x.drawline(c);else{var d=D.extractPoint(c);if(!d.ok){if("undefined"!==typeof c.value&&2===c.value.length)return t.draw$2(c.value,b);return}null!==b&&x.handleModifs(b,x.pointModifs);x.drawpoint(d)}return k};
-t.draw$2=function(a,b){var c=B(a[0]),d=B(a[1]),c=D.extractPoint(c),d=D.extractPoint(d);if(!c.ok||!d.ok)return k;null!==b&&x.handleModifs(b,x.lineModifs);x.drawsegcore(c,d);return k};t.drawcircle$2=function(a,b){return D.drawcircle(a,b,"D")};D.arcHelper=function(a){var b={};b.startPoint=M(a[0]);b.viaPoint=M(a[1]);b.endPoint=M(a[2]);return b};t.fillcircle$2=function(a,b){return D.drawcircle(a,b,"F")};t.drawarc$3=function(a,b){var c=D.arcHelper(a);return D.drawarc(c,b,"D")};t.fillarc$3=function(a,b){var c=
-D.arcHelper(a);return D.drawarc(c,b,"F")};D.drawarc=function(a,b,c){var d=a.startPoint,e=a.viaPoint;a=a.endPoint;if(!g._helper.isAlmostReal(g.turnIntoCSList([d,e,a])))return k;x.handleModifs(b,x.conicModifs);x.preDrawCurve();b=g.det3(d,e,a);if(1E-12<Math.abs(b.value.real)){b=m._helper.ConicBy5(null,d,e,a,g.ii,g.jj);var f=m._helper.CenterOfConic(b),f=g.normalizeMax(f);b=l.real(0);var n=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(w.mult(n,d));g.normalizeZ(w.mult(n,e));n=g.normalizeZ(w.mult(n,a));b=-Math.atan2(b.value[1].value.real,b.value[0].value.real);n=-Math.atan2(n.value[1].value.real,n.value[0].value.real);f=g.normalizeZ(f);d=g.normalizeZ(d);e=g.normalizeZ(e);a=g.normalizeZ(a);var p=g.abs(g.sub(d,f)),q=[f.value[0].value.real,f.value[1].value.real],f=z.drawingstate.matrix,t=q[0]*f.a-q[1]*f.b+f.tx,q=q[0]*f.c-q[1]*f.d-f.ty,d=0<g.det3(d,e,a).value.real;y.save();y.beginPath();
-y.translate(t,q);y.arc(0,0,p.value.real*f.sdet,b,n,d);"F"===c&&(y.fillStyle=x.lineColor,y.closePath(),y.fill());"D"===c&&y.stroke();y.restore()}else{if("D"!==c)return k;c=D.extractPoint(d);b=D.extractPoint(e);n=D.extractPoint(a);if(!c.ok||!b.ok||!n.ok)return k;p=(c.x-n.x)*(c.x-n.x)+(c.y-n.y)*(c.y-n.y);f=(n.x-b.x)*(n.x-b.x)+(n.y-b.y)*(n.y-b.y);if(1E-12>(c.x-b.x)*(c.x-b.x)+(c.y-b.y)*(c.y-b.y)||1E-12>p||1E-12>f)return k;0>g.crossratio3(d,a,e,g.cross(g.cross(d,e),g.linfty),g.ii).value.real?x.drawsegcore(c,
-n):x.drawRaySegment(d,a)}return k};D.drawcircle=function(a,b,c){var d=B(a[0]);a=B(a[1]);var e=D.extractPoint(d);if(!e.ok||"number"!==a.ctype||!l._helper.isAlmostReal(a))return k;var d=z.drawingstate.matrix,g=e.x*d.a-e.y*d.b+d.tx,e=e.x*d.c-e.y*d.d-d.ty;x.handleModifs(b,x.conicModifs);x.preDrawCurve();y.lineJoin="miter";y.beginPath();y.arc(g,e,Math.abs(a.value.real)*d.sdet,0,2*Math.PI);y.closePath();"D"===c&&y.stroke();"F"===c&&(y.fillStyle=x.lineColor,y.fill());"C"===c&&y.clip();return k};t.drawconic$1=
-function(a,b){var c;c=B(a[0]);if("list"!==c.ctype||3!==c.value.length&&6!==c.value.length)return console.error("could not parse conic"),k;if(6===c.value.length){for(var d=0;6>d;d++)if("number"!==c.value[d].ctype)return console.error("could not parse conic"),k;var e=l.real(.5),d=c.value[0],f=c.value[2],f=l.mult(f,e),m=c.value[1],n=c.value[3],n=l.mult(n,e),p=c.value[4],p=l.mult(p,e);c=c.value[5];c=g.turnIntoCSList([g.turnIntoCSList([d,f,n]),g.turnIntoCSList([f,m,p]),g.turnIntoCSList([n,p,c])])}else{for(d=
-0;3>d;d++)for(f=0;3>f;f++)if("number"!==c.value[d].value[f].ctype)return console.error("could not parse conic"),k;g.equals(c,g.transpose(c)).value||(d=w.mult(c,l.real(.5)),c=w.mult(g.transpose(c),l.real(.5)),c=g.add(d,c))}c=g.normalizeMax(c);return D.drawconic(c,b)};D.drawconic=function(a,b){x.handleModifs(b,x.conicModifs);if(0!==x.lsize){x.preDrawCurve();for(var c=g.normalizeMax(a),d=c,e=0;2>e;e++)for(var f=0;2>f;f++)if(Math.abs(c.value[e].value[f].value.imag)>l.eps)return;e=g.turnIntoCSList([g.realVector([-1,
--1,1]),g.realVector([1,0,0]),g.realVector([0,1,0])]);f=z.from(0,0,1);f[2]=1;var n=z.from(1,0,1);n[2]=1;var p=z.from(0,1,1);p[2]=1;var f=g.turnIntoCSList([g.realVector(f),g.realVector(n),g.realVector(p)]),f=g.transpose(f),e=w.mult(f,e),e=g.inverse(e),c=w.mult(g.transpose(e),c),c=w.mult(c,e),e=c.value[0].value[0].value.real,f=c.value[1].value[0].value.real,n=c.value[1].value[1].value.real,p=c.value[2].value[0].value.real,q=c.value[2].value[1].value.real,v=c.value[2].value[2].value.real,c=[[e,f,p],[f,
-n,q],[p,q,v]],u=1E-14>Math.abs(e*n*v-e*q*q-f*f*v+2*f*p*q-n*p*p);if(u&&"Circle"===a.usage){var A=w.mult(g.adjoint3(d),g.linfty);l.abs(A.value[2]).value.real>l.eps&&(u=!1)}var A=da>ca?da:ca,B=-1.5*A,C=1.5*A,D=-1.5*A,E=1.5*A,F=1;u&&(F=0);if(F)var p=0,p=1E-14<Math.abs(e-f)?Math.atan(f/e-n)/2:Math.PI/4,G=function(a){var c=Math.cos(a);a=Math.sin(a);return[[c,-a,0],[a,c,0],[0,0,1]]}(p),G=g.realMatrix(G),e=g.transpose(G),c=w.mult(g.realMatrix(c),G),c=w.mult(e,c),e=c.value[0].value[0].value.real,f=c.value[1].value[0].value.real,
-n=c.value[1].value[1].value.real,p=c.value[2].value[0].value.real,q=c.value[2].value[1].value.real,v=c.value[2].value[2].value.real;var c=[e,f,n,p,q,v],e=function(){var a=m._helper.splitDegenConic(d);if(a!==k){var c=a[1],a=[a[0]];t.draw$1(a,b);a[0]=c;t.draw$1(a,b)}},H=function(a){"undefined"!==a&&6===a.length||console.error("this does not define a Conic");if(u)return"degenerate";a=a[0]*a[2]-a[1]*a[1];return 1E-14>Math.abs(a)?"parabola":1E-14<a?"ellipsoid":"hyperbola"};H(c);var L=function(a,c){return 0<
-a&&a<da&&0<c&&c<ca},J=[],I=[],K=[],M=[],N=[],O=[],P=function(){J=[];I=[];K=[];M=[];N=[];O=[]},R=function(a,c){y.beginPath();y.moveTo(a[0],c[0]);for(var b=1;b<a.length;b++)y.lineTo(a[b],c[b]);y.stroke()},S=function(a,c,b){var h,d,e=H(a);if(6!==a.length)console.error("Conic needs 6 Parameters");else{var f=a[0],r=a[1],k=a[2],l=a[3],m=a[4];a=a[5];var n;h=b-c;for(var p=.1*h+c,na=b-.1*h,Q=c;Q<=b;Q+=n){n=Q<p||Q>na||100>Math.abs(b-c)?.5:0>Q||Q>ca?10:3;d=-f*k*Q*Q-2*f*m*Q-f*a+r*r*Q*Q+2*r*l*Q+l*l;d=Math.sqrt(d);
-h=1/f*(-r*Q-l+d);d=-1/f*(r*Q+l+d);var q,Ga;F?(q=[h,Q,1],Ga=[d,Q,1],q=w.mult(G,g.realVector(q)),Ga=w.mult(G,g.realVector(Ga)),h=q.value[0].value.real,d=Ga.value[0].value.real,q=q.value[1].value.real,Ga=Ga.value[1].value.real):Ga=q=Q;isNaN(h)||"ellipsoid"!==e?!isNaN(h)&&h>=B&&h<=C&&(J.push(h),K.push(q)):(J.push(h),K.push(q));isNaN(d)||"ellipsoid"!==e?!isNaN(d)&&d>=B&&d<=C&&(I.push(d),M.push(Ga)):(I.push(d),M.push(Ga))}}},f=function(a){var c,b,h;H(a);if(6!==a.length)console.error("Conic needs 6 Parameters");
-else{h=a[0];var d=a[1],e=a[2],f=a[3],g=a[4],r=a[5];c=-h*g+d*f;b=Math.sqrt(h*(-h*e*r+h*Math.pow(g,2)+Math.pow(d,2)*r-2*d*f*g+e*Math.pow(f,2)));e=h*e-Math.pow(d,2);1E-14<Math.abs(e)?(h=(c-b)/e,b=(c+b)/e):b=h=(-h*r+f*f)/(2*h*g-2*d*f);!isNaN(h)&&h>D&&h<E||(h=D);!isNaN(b)&&b>D&&b<E||(b=D);c=h<b?h:b;b=h>b?h:b;S(a,D,c);N=J.concat(I.reverse());O=K.concat(M.reverse());R(N,O);P();S(a,b,E);R(J,K);if(L(J[0],K[1])||L(I[0],M[0]))y.beginPath(),y.moveTo(J[0],K[0]),y.lineTo(I[0],M[0]),y.stroke();R(I,M);P();S(a,c,
-b);R(J,K);y.beginPath();y.moveTo(J[0],K[0]);y.lineTo(I[0],M[0]);y.stroke();y.beginPath();y.moveTo(J[J.length-1],K[K.length-1]);y.lineTo(I[I.length-1],M[M.length-1]);y.stroke();R(I,M);P()}};u?e():f(c)}};t.drawall$1=function(a,b){var c=A(a[0]);if("list"===c.ctype){x.handleModifs(b,x.pointAndLineModifs);for(var d=0;d<c.value.length;d++)t.draw$1([c.value[d]],null)}return k};t.connect$1=function(a,b){return D.drawpolygon(a,b,"D",!1)};t.drawpoly$1=function(a,b){return D.drawpolygon(a,b,"D",!0)};t.fillpoly$1=
-function(a,b){return D.drawpolygon(a,b,"F",!0)};t.drawpolygon$1=function(a,b){return D.drawpolygon(a,b,"D",!0)};t.fillpolygon$1=function(a,b){return D.drawpolygon(a,b,"F",!0)};D.drawpolygon=function(a,b,c,d){function e(){for(var a=l.value,c=0;c<a.length;c++){var b=a[c],h;for(h=0;h<b.length;h++){var d=b[h],f=d.X*g.a-d.Y*g.b+g.tx,d=d.X*g.c-d.Y*g.d-g.ty;0===h?y.moveTo(f,d):y.lineTo(f,d)}y.closePath()}}function f(){var a;for(a=0;a<l.value.length;a++){var c=D.extractPoint(l.value[a]);if(!c.ok)return;var b=
-c.x*g.a-c.y*g.b+g.tx,c=c.x*g.c-c.y*g.d-g.ty;0===a?y.moveTo(b,c):y.lineTo(b,c)}d&&y.closePath()}x.handleModifs(b,x.conicModifs);x.preDrawCurve();var g=z.drawingstate.matrix,l=A(a[0]);y.beginPath();"list"===l.ctype&&f();"shape"===l.ctype&&e();"D"===c&&(x.fillColor&&(y.fillStyle=x.fillColor,y.fill(x.fillrule)),y.stroke());"F"===c&&(y.fillStyle=x.lineColor,y.fill(x.fillrule));"C"===c&&y.clip();return k};var Bc=Yc,td=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};D.drawtext=function(a,b,c){var d=B(a[0]);a=A(a[1]);var e=D.extractPoint(d);if(!e.ok)return null;x.handleModifs(b,x.textModifs);b=z.drawingstate.textsize;null===b&&(b=la.textsize);null!==x.size&&(b=x.size);y.fillStyle=x.textColor;var f=z.drawingstate.matrix,d=e.x*f.a-e.y*f.b+f.tx+x.xOffset,e=e.x*f.c-e.y*f.d-f.ty-x.yOffset;a=ba(a);f=x.bold+x.italics+Math.round(10*b)/10+"px "+x.family;
-y.font=f;return c?c(a,f,d,e,x.align,b):Bc(y,a,d,e,x.align,b,b*la.lineHeight)};t.drawtext$2=function(a,b){D.drawtext(a,b,null);return k};t.drawtable$2=function(a,b){var c=B(a[0]),d=B(a[1]),e=D.extractPoint(c);if(!e.ok||"list"!==d.ctype)return k;var d=d.value,c=d.length,f=-1,l;for(l=0;l<c;++l)"list"===d[l].ctype&&d[l].value.length>f&&(f=d[l].value.length);-1===f?(d=d.map(function(a){return[a]}),f=1):d=d.map(function(a){return g.asList(a).value});var m=100,n=null,p=!0,q=z.drawingstate.textcolor;x.handleModifs(b,
-{size:!0,color:function(a){g._helper.isNumberVecN(a,3)&&(q=x.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&&(m=a.value.real)},height:function(a){"number"===a.ctype&&(n=a.value.real)},border:function(a){"boolean"===a.ctype&&(p=a.value)}});var t=z.drawingstate.textsize;null===t&&(t=la.textsize);null!==x.size&&(t=x.size);null===n&&(n=1.6*t);y.font=x.bold+
-x.italics+Math.round(10*t)/10+"px "+x.family;l=z.drawingstate.matrix;var v=f*m,u=c*n,t=e.x*l.a-e.y*l.b+l.tx+x.xOffset,w=e.x*l.c-e.y*l.d-l.ty-x.yOffset-u;if(p){x.preDrawCurve();y.strokeStyle=x.lineColor;y.beginPath();for(l=1;l<c;++l)y.moveTo(t,w+l*n),y.lineTo(t+v,w+l*n);for(e=1;e<f;++e)y.moveTo(t+e*m,w),y.lineTo(t+e*m,w+u);y.stroke();y.lineWidth=x.lsize+1;y.beginPath();y.rect(t,w,v,u);y.stroke()}t+=x.align*m+(1-2*x.align)*n*.3;w+=.7*n;y.fillStyle=q;for(l=0;l<c;++l)for(e=0;e<f;++e)v=ba(d[l][e]),Bc(y,
-v,t+e*m,w+l*n,x.align);return k};D.drawshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],b,"D",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"D"):k};D.fillshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],b,"F",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"F"):k};D.clipshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],b,"C",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"C"):k};t.fill$1=
-function(a,b){var c=A(a[0]);return"shape"===c.ctype?D.fillshape(c,b):k};t.clip$1=function(a,b){var c=A(a[0]);return"shape"===c.ctype?D.clipshape(c,b):"list"===c.ctype?(c=t.polygon$1(a,[]),t.clip$1([c],[])):k};t.plot$1=function(a,b){return t.plot$2([a[0],null],b)};t.plot$2=function(a,b){function c(a){return"number"===a.ctype&&l._helper.isAlmostReal(a)}function d(a,c,b,h,e){n++;c=+c.value.real;e=+h.value.real;h=c*E.a-e*E.b+E.tx;c=c*E.c-e*E.d-E.ty;a=+a.value.real;e=+b.value.real;b=a*E.a-e*E.b+E.tx;a=
-a*E.c-e*E.d-E.ty;p?(y.lineTo(b,a),y.lineTo(h,c)):(y.beginPath(),y.moveTo(b,a),y.lineTo(h,c),p=!0)}function e(a,b,h,g,k){var n=c(h),q=c(g);if(.001>k)!f&&p&&(y.stroke(),p=!1);else if(n||q){var t=l.real((a.value.real+b.value.real)/2);J.setvar(B,t);var v=A(w),u=c(v);if(n&&q&&u){var Nb=h.value.real,q=v.value.real,u=g.value.real;if(n=1>Math.abs(Nb+u-2*q)/m){var x=l.real((a.value.real+t.value.real)/2);J.setvar(B,x);var x=A(w),fc=l.real((t.value.real+b.value.real)/2);J.setvar(B,fc);fc=A(w);Nb=Math.abs(Nb+
-q-2*x.value.real)/m;q=Math.abs(q+u-2*fc.value.real)/m;n=n&&1>Nb&&1>q}n?(d(a,t,h,v,k/2),d(t,b,v,g,k/2)):(e(a,t,h,v,k/2),e(t,b,v,g,k/2))}else e(a,t,h,v,k/2),e(t,b,v,g,k/2)}}var f=!1,m=.2/Kb,n=0,p=!1,q=-10,t=10,v=.1,u=1E3,w=a[0],B;if(null!==a[1]&&"variable"===a[1].ctype)B=a[1].name;else{var C=D.plotvars(w);B="#";-1!==C.indexOf("t")&&(B="t");-1!==C.indexOf("z")&&(B="z");-1!==C.indexOf("y")&&(B="y");-1!==C.indexOf("x")&&(B="x")}J.newvar(B);var E=z.drawingstate.matrix;x.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&&(q=a.value.real)},stop:function(a){"number"===a.ctype&&(t=a.value.real)},steps:function(a){"number"===a.ctype&&(u=a.value.real)}});y.strokeStyle=x.lineColor;y.lineWidth=x.lsize;var F,G,H,I,p=!1,C=l.real(14.32);J.setvar(B,C);H=A(w);if("number"!==H.ctype){if(g.isNumberVector(H).value&&2===H.value.length){p=!1;v=(t-q)/u;for(C=q;C<
-t;C+=v)J.setvar(B,l.real(C)),I=A(w),g.isNumberVector(I).value&&2===I.value.length&&(F=+I.value[0].value.real,G=+I.value[1].value.real,I=F*E.a-G*E.b+E.tx,F=F*E.c-G*E.d-E.ty,p?y.lineTo(I,F):(y.beginPath(),y.moveTo(I,F),p=!0));y.stroke();J.removevar(B)}return k}for(I=q;I<t+v;I+=v)C=l.real(I),J.setvar(B,C),H=A(w),C.value.real>q&&e(F,C,G,H,v),F=C,G=H;J.removevar(B);p&&y.stroke();return k};t.plotX$1=function(a,b){var c=a[0],d=D.plotvars(c),e="#";-1!==d.indexOf("t")&&(e="t");-1!==d.indexOf("z")&&(e="z");
--1!==d.indexOf("y")&&(e="y");-1!==d.indexOf("x")&&(e="x");J.newvar(e);d=z.drawingstate.matrix;y.fillStyle=z.drawingstate.linecolor;y.lineWidth=1;y.lineCap=x.lineCap;y.lineJoin=x.lineJoin;y.miterLimit=x.miterLimit;for(var f=!1,g=-10;10>g;g+=.01){J.setvar(e,l.real(g));var m=A(c);if("number"===m.ctype){var n=+m.value.real,m=g*d.a-n*d.b+d.tx,n=g*d.c-n*d.d-d.ty;f?y.lineTo(m,n):(y.beginPath(),y.moveTo(m,n),f=!0)}}y.stroke();J.removevar(e);return k};D.plotvars=function(a){function b(a,c){var h={},d;for(d=
-a.length-1;0<=d;--d)h[a[d]]=a[d];for(d=c.length-1;0<=d;--d)h[c[d]]=c[d];d=[];for(var e in h)h.hasOwnProperty(e)&&d.push(h[e]);return d}function c(a,c){for(var b=0;b<a.length;b++)a[b]===c&&(a.splice(b,1),b--);return a}var d,e,f,g;if("variable"===a.ctype)return[a.name];if("infix"===a.ctype)return d=D.plotvars(a.args[0]),a=D.plotvars(a.args[1]),b(d,a);if("list"===a.ctype){f=a.value;e=[];for(g=0;g<f.length;g++)d=D.plotvars(f[g]),e=b(e,d);return e}if("function"===a.ctype){f=a.args;e=[];for(g=0;g<f.length;g++)d=
-D.plotvars(f[g]),e=b(e,d);"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||(e=c(e,a.args[1].name));return e}return[]};t.clrscr$0=function(a,b){"undefined"!==typeof da&&"undefined"!==typeof ca&&y.clearRect(0,0,da,ca);return k};t.repaint$0=function(a,b){e();return k};t.screenbounds$0=function(a,b){var c=w.withUsage(g.realVector(z.to(0,0)),"Point"),d=w.withUsage(g.realVector(z.to(da,
-0)),"Point"),e=w.withUsage(g.realVector(z.to(da,ca)),"Point"),f=w.withUsage(g.realVector(z.to(0,ca)),"Point");return g.turnIntoCSList([c,d,e,f])};t.createimage$3=function(a,b){var c=A(a[0]),d=B(a[1]),e=B(a[2]);if("number"!==d.ctype||"number"!==e.ctype||"string"!==c.ctype)return k;var f=document.createElement("canvas");f.id=c.value;f.width=d.value.real;f.height=e.value.real;f.style.display="none";document.body.appendChild(f);Xa[c.value]=aa(f,!1);return k};t.clearimage$1=function(a,b){var c=A(a[0]);
-if("string"!==c.ctype&&"image"!==c.ctype)return k;var c=La(c),d=c.img;if("undefined"===typeof d||null===d)return k;var e=c.width,f=c.height;d.getContext("2d").clearRect(0,0,e,f);c.generation++;return k};t.canvas$4=function(a,b){var c=B(a[0]),d=B(a[1]),e=A(a[2]),f=a[3],g=D.extractPoint(c),l=D.extractPoint(d);if(!g.ok||!l.ok||"string"!==e.ctype&&"image"!==e.ctype)return k;e=La(e);if(!e||!e.img.getContext)return k;var d=e.img,m=e.width,c=e.height,n=l.x-g.x,p=l.y-g.y,q=g.x-p*c/m,t=g.y+n*c/m,p=l.x-p*c/
-m,n=l.y+n*c/m,l=z.from(g.x,g.y,1),q=z.from(q,t,1),p=z.from(p,n,1),g=l[0],t=l[1],n=q[0],v=q[1],u=p[0],w=p[1],q=m*(t-v)/((g-n)*(t-w)-(g-u)*(t-v)),m=m*(g-n)/((t-v)*(g-u)-(t-w)*(g-n)),p=-q*g-m*t,l=(c*(t-w)-c*(t-v))/((g-n)*(t-w)-(g-u)*(t-v)),n=(c*(g-u)-c*(g-n))/((t-v)*(g-u)-(t-w)*(g-n)),c=c-l*g-n*t,d=d.getContext("2d"),g=y;y=d;y.save();y.transform(q,l,m,n,p,c);e.generation++;A(f);y.restore();y=g};t.canvas$5=function(a,b){var c=B(a[0]),d=B(a[1]),e=B(a[2]),f=A(a[3]),g=a[4],c=D.extractPoint(c),l=D.extractPoint(d),
-m=D.extractPoint(e);if(!c.ok||!l.ok||!m.ok||"string"!==f.ctype&&"image"!==f.ctype)return k;f=La(f);if(!f||!f.img.getContext)return k;var e=f.img,n=f.width,d=f.height,p=z.from(c.x,c.y,1),q=z.from(l.x,l.y,1),l=z.from(m.x,m.y,1),c=p[0],m=p[1],t=q[0],v=q[1],u=l[0],w=l[1],l=((0-n)*(m-w)-0*(m-v))/((c-t)*(m-w)-(c-u)*(m-v)),n=((0-n)*(c-u)-0*(c-t))/((m-v)*(c-u)-(m-w)*(c-t)),q=0-l*c-n*m,p=((d-d)*(m-w)-(d-0)*(m-v))/((c-t)*(m-w)-(c-u)*(m-v)),t=((d-d)*(c-u)-(d-0)*(c-t))/((m-v)*(c-u)-(m-w)*(c-t)),d=d-p*c-t*m,e=
-e.getContext("2d"),c=y;y=e;y.save();y.transform(l,p,n,t,q,d);f.generation++;A(g);y.restore();y=c};t.screenresolution$0=function(a,b){return l.real(z.drawingstate.matrix.a)};t.layer$1=function(a,b){};t.imagesize$1=function(a,b){var c=La(B(a[0]));return c?g.realVector([+c.width,+c.height]):k};t.imageready$1=function(a,b){var c=La(B(a[0]));return w.bool(!(!c||!c.ready))};t.drawimage$2=function(a,b){function c(){var a=1,c=1,d=1,f=1,r=0,l=1,n=D.extractPoint(e);if(!n.ok)return k;m=La(m);if(!m)return k;
-y.save();var p;void 0!==b.angle&&(p=A(b.angle),"number"===p.ctype&&(r=p.value.real));void 0!==b.rotation&&(p=A(b.rotation),"number"===p.ctype&&(r=p.value.real));void 0!==b.scale&&(p=B(b.scale),"number"===p.ctype&&(c=a=p.value.real),g.isNumberVector(p).value&&2===p.value.length&&(a=p.value[0].value.real,c=p.value[1].value.real));void 0!==b.scalex&&(p=A(b.scalex),"number"===p.ctype&&(a=p.value.real));void 0!==b.scaley&&(p=A(b.scaley),"number"===p.ctype&&(c=p.value.real));void 0!==b.flipx&&(p=A(b.flipx),
-"boolean"===p.ctype&&p.value&&(d=-1));void 0!==b.flipy&&(p=A(b.flipy),"boolean"===p.ctype&&p.value&&(f=-1));void 0!==b.alpha&&(p=A(b.alpha),"number"===p.ctype&&(l=p.value.real));var q=z.drawingstate.matrix,Q=z.drawingstate.initialmatrix,t=m.width,v=m.height;p=n.x*q.a-n.y*q.b+q.tx;var u=n.x*q.c-n.y*q.d-q.ty,w=(n.x+1)*q.a-n.y*q.b+q.tx-p,q=(n.x+1)*q.c-n.y*q.d-q.ty-u,Ga=(n.x+1)*Q.a-n.y*Q.b+Q.tx-(n.x*Q.a-n.y*Q.b+Q.tx),Q=(n.x+1)*Q.c-n.y*Q.d-Q.ty-(n.x*Q.c-n.y*Q.d-Q.ty),n=Math.sqrt(w*w+q*q)/Math.sqrt(Ga*
-Ga+Q*Q),w=-Math.atan2(w,q)+Math.atan2(Ga,Q),q=z.drawingstate.matrix.sdet/72,a=a*q,c=c*q;1!==l&&(y.globalAlpha=l);y.translate(p,u);y.scale(a*d*n,c*f*n);y.rotate(r+w);y.translate(-p,-u);y.translate(-t/2,-v/2);a=m;a.drawTo?a.drawTo(y,p,u):y.drawImage(a.img,p,u);y.globalAlpha=1;y.restore()}function d(){var a=1,c=1,g=1,r=1,n=D.extractPoint(e),p=D.extractPoint(f),q;if(!n.ok||!p.ok)return k;m=La(m);if(!m)return k;var t=m.width,v=m.height;if(0===l)q={},q.x=n.x-(p.y-n.y),q.y=n.y+(p.x-n.x),r=v/t;else if(q=
-D.extractPoint(l),!n.ok)return k;y.save();var u;void 0!==b.alpha&&(u=A(b.alpha),"number"===u.ctype&&(a=u.value.real));void 0!==b.aspect&&(u=A(b.aspect),"number"===u.ctype&&(r=u.value.real));void 0!==b.flipx&&(u=A(b.flipx),"boolean"===u.ctype&&u.value&&(c=-1));void 0!==b.flipy&&(u=A(b.flipy),"boolean"===u.ctype&&u.value&&(g=-1));u=z.drawingstate.matrix;1!==a&&(y.globalAlpha=a);a=n.x*u.a-n.y*u.b+u.tx;n=n.x*u.c-n.y*u.d-u.ty;y.transform(p.x*u.a-p.y*u.b+u.tx-a,p.x*u.c-p.y*u.d-u.ty-n,q.x*u.a-q.y*u.b+u.tx-
-a,q.x*u.c-q.y*u.d-u.ty-n,a,n);y.scale(1/t,-1/v*r);y.translate(t/2,-v/2);y.scale(c,g);y.translate(-t/2,v/2);y.translate(0,-v);c=m;c.drawTo?c.drawTo(y,0,0):y.drawImage(c.img,0,0);y.globalAlpha=1;y.restore()}var e,f,l,m;return 2===a.length?(e=B(a[0]),m=B(a[1]),c()):3===a.length?(e=B(a[0]),f=B(a[1]),l=0,m=B(a[2]),d()):4===a.length?(e=B(a[0]),f=B(a[1]),l=B(a[2]),m=B(a[3]),d()):k};t.drawimage$3=t.drawimage$2;t.drawimage$4=t.drawimage$2;t.allimages$0=function(){var a=[];Object.keys(Xa).forEach(function(b){a.push({ctype:"string",
-value:b})});return g.turnIntoCSList(a)};t.cameravideo$0=function(a,b){function c(a){return{video:{width:a,advanced:[{width:{max:a,min:a}},{width:{ideal:a}}]},audio:!1}}var d=!0,e={};if(void 0!==b.resolution){var f=A(b.resolution);"string"===f.ctype&&"maximal"===f.value?d=!0:"number"===f.ctype?(d=!1,e=c(f.value.real)):g._helper.isNumberVecN(f,2)&&(d=!1,e=c(f.value[0].value.real),f=f.value[1].value.real,10>f||!Number.isInteger(f)?(e.video.aspectRatio=f,e.video.advanced[0].aspectRatio={min:f,max:f},
-e.video.advanced[1].aspectRatio={ideal:f}):(e.video.height=f,e.video.advanced[0].height={min:f,max:f},e.video.advanced[1].height={ideal:f}))}d&&(e=[320,640,1024,1280,1920,2560],e=e.map(function(a){return{width:{min:a}}}),e={video:{width:16E3,height:9E3,advanced:e},audio:!1});var d=null,l=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia;l?d=function(a,c){navigator.mediaDevices.getUserMedia(e).then(a,c)}:(l=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||
-navigator.msGetUserMedia)&&(d=function(a,c){l.call(navigator,e,a,c)});if(!d)return console.warn("getUserMedia call not supported"),k;var m=document.createElement("video");m.autoplay=!0;f=aa(m,!0);console.log("Opening stream.");d(function(a){a=window.URL.createObjectURL(a);m.src=a;m.addEventListener("loadeddata",I)},function(a){console.error("Could not get user video:",String(a),a)});return f};t.playvideo$1=function(a,b){var c=La(B(a[0]));c.live&&c.img.play&&c.img.play();return k};t.pausevideo$1=function(a,
-b){var c=La(B(a[0]));c.live&&c.img.pause&&c.img.pause();return k};var Db;t.imagergba$3=function(a,b){var c=La(B(a[0])),d=B(a[1]),e=B(a[2]);if(!c||"number"!==d.ctype||"number"!==e.ctype||!c.ready)return k;d=Math.round(d.value.real);e=Math.round(e.value.real);if(!Fa(d)||!Fa(e))return k;c=rb(c,d,e,1,1);return g.realVector([255*c[0],255*c[1],255*c[2],c[3]])};t.imagergb$3=t.imagergba$3;t.imagergba$4=function(a,b){var c=La(B(a[2]));if(!c||!c.ready)return k;var d=c.width,e=c.height,f=M(a[0]),l=M(a[1]),m=
-M(g.realVector([0,e,1])),d=M(g.realVector([d,e,1]));if(f===k||l===k||n===k)return k;var n=g.ii,e=g.jj,m=D.basismap(m,d,n,e),f=D.basismap(f,l,e,n),n=M(a[3]);var p=D.extractPoint(w.mult(m,w.mult(g.adjoint3(f),n)));if(p.ok){var l=c.width,m=c.height,n=!0,q=!1;void 0!==b.interpolate&&(f=A(b.interpolate),"boolean"===f.ctype&&(n=f.value));void 0!==b.repeat&&(f=A(b.repeat),"boolean"===f.ctype&&(q=f.value));n&&(p.x-=.5,p.y-=.5);q&&(p.x=(p.x%l+l)%l,p.y=(p.y%m+m)%m);d=Math.floor(p.x);e=Math.floor(p.y);if(Fa(d)&&
-Fa(e)){f=[0,0,0,0];if(n){var n=p.x-d,p=p.y-e,t=rb(c,d,e,2,2);if(q){if(d===l-1||e===m-1)var q=rb(c,(d+1)%l,e,1,1),u=rb(c,d,(e+1)%m,1,1),c=rb(c,(d+1)%l,(e+1)%m,1,1),t=t.slice(0,4).concat(q,u,c)}else{if(-1===d||d===l-1)n=Math.round(n);if(-1===e||e===m-1)p=Math.round(p)}for(c=0;4>c;c++)f[c]=(1-p)*((1-n)*t[c]+n*t[c+4])+p*((1-n)*t[c+8]+n*t[c+12])}else f=rb(c,d,e,1,1);c=g.realVector(f)}else c=k}else c=k;return c};t.imagergb$4=function(a,b){var c=t.imagergba$4(a,b);return c===k?k:g.turnIntoCSList(c.value.slice(0,
-3))};"use strict";var re=[{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:[","]}],se=["+","-"],te=["!","\u221a"],ue=["\u00b0",":=_"],ve=[";",","],Cc=[],xa={},cd;(function(){var a=0;re.forEach(function(b){a+=2;var c=!!b.rassoc;b.functionCall&&(cd=a);
-for(var d in b){var e=b[d];if("boolean"!==typeof e)for(var f={name:d,sym:e[0],symbols:e,rassoc:c,precedence:a,prefix:!1,postfix:!1,infix:!0,bare:!1},g=0;g<e.length;++g){var l=e[g];if(xa.hasOwnProperty(l))throw Error("Duplicate operator: "+l);xa[l]=f;Cc.push(l)}}});se.forEach(function(a){xa[a].prefix=!0});te.forEach(function(a){xa[a].prefix=!0;xa[a].infix=!1});ue.forEach(function(a){xa[a].postfix=!0;xa[a].infix=!1});ve.forEach(function(a){xa[a].prefix=!0;xa[a].postfix=!0;xa[a].infix=!0;xa[a].bare=
-!0})})();Cc.sort(function(a,b){return b.length-a.length});var we="(?:[0-9](?: [0-9])*(?: \\.(?! \\.)(?: [0-9])*)?|\\.(?: [0-9])+)(?: [Ee](?: [+-])?(?: [0-9])+)?".replace(/ /g,"[ \t]*"),xe="(?:[\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]*"),ye="(?:[\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]*"),Dc=function(a,b,c){var d,e,f=0,g="(?:[",l=b.length;for(d=0;d<l;++d)e=b.charCodeAt(d),55296<=e?(g+="]|"+b.charAt(d)+"[",f=56320):(g+=String.fromCharCode(e=f=a[e-32]+f),f+=a[b.charCodeAt(++d)-32],f!==e&&(f!==e+1&&(g+="-"),g+=String.fromCharCode(f)));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,
+f.JS.Clone(b);if("number"!=typeof d||null===d)return f.Error("Delta is not a number in Clean()."),b;if(0===b.length||1==b.length&&0===b[0].length||0>d)return b;e||(b=[b]);for(var k=b.length,n,p,u,E,F,H,N,M=[],ia=0;ia<k;ia++)if(p=b[ia],n=p.length,0!==n)if(3>n)u=p,M.push(u);else{u=p;E=d*d;F=p[0];for(N=H=1;N<n;N++)(p[N].X-F.X)*(p[N].X-F.X)+(p[N].Y-F.Y)*(p[N].Y-F.Y)<=E||(u[H]=p[N],F=p[N],H++);F=p[H-1];(p[0].X-F.X)*(p[0].X-F.X)+(p[0].Y-F.Y)*(p[0].Y-F.Y)<=E&&H--;H<n&&u.splice(H,n-H);u.length&&M.push(u)}!e&&
+M.length?M=M[0]:e||0!==M.length?e&&0===M.length&&(M=[[]]):M=[];return M};f.JS.Clone=function(b){if(!(b instanceof Array)||0===b.length)return[];if(1==b.length&&0===b[0].length)return[[]];var d=b[0]instanceof Array;d||(b=[b]);var e=b.length,f,k,p,u,E=Array(e);for(k=0;k<e;k++){f=b[k].length;u=Array(f);for(p=0;p<f;p++)u[p]={X:b[k][p].X,Y:b[k][p].Y};E[k]=u}d||(E=E[0]);return E};f.JS.Lighten=function(b,d){if(!(b instanceof Array))return[];if("number"!=typeof d||null===d)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>d)return f.JS.Clone(b);b[0]instanceof Array||(b=[b]);var e,k,n,p,u,E,F,H,N,M,ia,S,V,Y,ba,fa=b.length,ha=d*d,ea=[];for(e=0;e<fa;e++)if(n=b[e],E=n.length,0!=E){for(p=0;1E6>p;p++){u=[];E=n.length;n[E-1].X!=n[0].X||n[E-1].Y!=n[0].Y?(ia=1,n.push({X:n[0].X,Y:n[0].Y}),E=n.length):ia=0;M=[];for(k=0;k<E-2;k++){F=n[k];N=n[k+1];H=n[k+2];Y=F.X;ba=F.Y;F=H.X-Y;S=H.Y-ba;if(0!==F||0!==S)V=((N.X-Y)*F+(N.Y-ba)*S)/(F*F+S*S),1<V?(Y=H.X,ba=H.Y):0<V&&(Y+=F*
+V,ba+=S*V);F=N.X-Y;S=N.Y-ba;H=F*F+S*S;H<=ha&&(M[k+1]=1,k++)}u.push({X:n[0].X,Y:n[0].Y});for(k=1;k<E-1;k++)M[k]||u.push({X:n[k].X,Y:n[k].Y});u.push({X:n[E-1].X,Y:n[E-1].Y});ia&&n.pop();if(M.length)n=u;else break}E=u.length;u[E-1].X==u[0].X&&u[E-1].Y==u[0].Y&&u.pop();2<u.length&&ea.push(u)}b[0]instanceof Array||(ea=ea[0]);"undefined"==typeof ea&&(ea=[[]]);return ea};f.JS.PerimeterOfPath=function(b,d,e){if("undefined"==typeof b)return 0;var f=Math.sqrt,k=0,p,u,E,F,H=b.length;if(2>H)return 0;for(d&&(b[H]=
+b[0],H++);--H;)p=b[H],E=p.X,p=p.Y,u=b[H-1],F=u.X,u=u.Y,k+=f((E-F)*(E-F)+(p-u)*(p-u));d&&b.pop();return k/e};f.JS.PerimeterOfPaths=function(b,d,e){e||(e=1);for(var k=0,n=0;n<b.length;n++)k+=f.JS.PerimeterOfPath(b[n],d,e);return k};f.JS.ScaleDownPath=function(b,d){var e,f;d||(d=1);for(e=b.length;e--;)f=b[e],f.X/=d,f.Y/=d};f.JS.ScaleDownPaths=function(b,d){var e,f,k;d||(d=1);for(e=b.length;e--;)for(f=b[e].length;f--;)k=b[e][f],k.X/=d,k.Y/=d};f.JS.ScaleUpPath=function(b,d){var e,f,k=Math.round;d||(d=
+1);for(e=b.length;e--;)f=b[e],f.X=k(f.X*d),f.Y=k(f.Y*d)};f.JS.ScaleUpPaths=function(b,d){var e,f,k,p=Math.round;d||(d=1);for(e=b.length;e--;)for(f=b[e].length;f--;)k=b[e][f],k.X=p(k.X*d),k.Y=p(k.Y*d)};f.ExPolygons=function(){return[]};f.ExPolygon=function(){this.holes=this.outer=null};f.JS.AddOuterPolyNodeToExPolygons=function(b,d){var e=new f.ExPolygon;e.outer=b.Contour();var k=b.Childs(),n=k.length;e.holes=Array(n);var p,u,E,F,H;for(u=0;u<n;u++)for(p=k[u],e.holes[u]=p.Contour(),E=0,F=p.Childs(),
+H=F.length;E<H;E++)p=F[E],f.JS.AddOuterPolyNodeToExPolygons(p,d);d.push(e)};f.JS.ExPolygonsToPaths=function(b){var d,e,k,n,p=new f.Paths;d=0;for(k=b.length;d<k;d++)for(p.push(b[d].outer),e=0,n=b[d].holes.length;e<n;e++)p.push(b[d].holes[e]);return p};f.JS.PolyTreeToExPolygons=function(b){var d=new f.ExPolygons,e,k,n;e=0;k=b.Childs();for(n=k.length;e<n;e++)b=k[e],f.JS.AddOuterPolyNodeToExPolygons(b,d);return d}})();
+var CindyJS=function(){function p(k){if(0===ha)return console.error("Waiting for "+k+" after we finished waiting."),function(){};0>ha&&(ha=0);++ha;return function(){--ha;0>ha&&console.error("Wait count mismatch: "+k);if(0===ha)for(var p=0,F=Ga.length;p<F;)Ga[p++].startup()}}function F(k){var p=F.newInstance(k);0>=ha?p.startup():!1!==k.autostart&&Ga.push(p);return p}var ha=-1,Ga=[];"undefined"===typeof document||"undefined"===typeof window||"undefined"===typeof document.addEventListener||"undefined"!==
+typeof window.cindyDontWait&&!0===window.cindyDontWait||document.addEventListener("DOMContentLoaded",p("DOMContentLoaded"));var pa=null,Ha=null,ea={};F.getBaseDir=function(){if(null!==pa)return pa;for(var k=document.getElementsByTagName("script"),p=0;p<k.length;++p){var F=k[p],V=F.src;if(V){var S=/Cindy\.js$/.exec(V);if(S)return pa=V.substr(0,S.index),console.log("Will load extensions from "+pa),Ha=F,pa}}console.error("Could not find <script> tag for Cindy.js");return pa=Ha=!1};F.addNewScript=function(k,
+p){p||console.error.bind(console);var N=F.getBaseDir();if(!1===N)return!1;var V=document.createElement("script");V.src=N+k;var N=Ha.nextSibling,S=Ha.parentElement;N?S.insertBefore(V,N):S.appendChild(V);return V};F.loadScript=function(k,p,N,V){for(var S=String(k).split("."),fa=window;S.length&&"object"===typeof fa&&null!==fa;)fa=fa[S.shift()];if(fa&&!S.length)return N(),!0;V||(V=console.error.bind(console));S=ea[k];if(!S){S=F.addNewScript(p,V);if(!1===S)return V("Can't load additional components."),
+!1;ea[k]=S}S.addEventListener("load",N);S.addEventListener("error",V);return null};F._autoLoadingPlugin={};F.autoLoadPlugin=function(k,p,N){if(F._pluginRegistry[k])return N(),!0;var V=F._autoLoadingPlugin[k];if(!V){p||(p=k+"-plugin.js");V=F._autoLoadingPlugin[k]=[];k=F.addNewScript(p);if(!1===k)return!1;k.addEventListener("error",console.error.bind(console))}V.push(N);return null};var k={ctype:"undefined"};F.waitFor=p;F._pluginRegistry={};F.instances=[];F.registerPlugin=function(k,p,N){if(1!==k)return console.error("Plugin API version "+
+k+" not supported"),!1;F._pluginRegistry[p]=N;(F._autoLoadingPlugin[p]||[]).forEach(function(k){k()})};var Qa=0;F.dumpState=function(k){k=F.instances[k||0].saveState();console.log(JSON.stringify(k))};F.debugState=function(k){F.instances.map(function(k){var p=k.config,p=JSON.parse(JSON.stringify(p)),E=k.saveState();console.log(JSON.stringify(E));for(var F in E)p[F]=E[F];k.shutdown();return p}).forEach(function(k){F(k)})};F.newInstance=function(p){function F(){na.width=ca=na.clientWidth;na.height=da=
+na.clientHeight;A.setTransform(1,0,0,1,0,0);y.setMat(25,0,0,25,250.5,250.5);if(Db)for(var a=0;a<Db.length;a++){var g=Db[a],c=Object.keys(g)[0];"scale"===c&&(Tb=g.scale,y[c](g.scale));if("translate"===c)y[c](g.translate[0],g.translate[1]);"scaleAndOrigin"===c&&(Tb=g[c][0]/25,y[c].apply(null,g[c]));"visibleRect"===c&&(y[c].apply(null,g[c]),Tb=y.drawingstate.initialmatrix.a/25)}y.createnewbackup();y.greset();a=1;"undefined"!==typeof window&&window.devicePixelRatio&&(a=window.devicePixelRatio);g=A.webkitBackingStorePixelRatio||
+A.mozBackingStorePixelRatio||A.msBackingStorePixelRatio||A.oBackingStorePixelRatio||A.backingStorePixelRatio||1;a!==g&&(a/=g,na.width=ca*a,na.height=da*a,A.scale(a,a))}function N(a){var g;if("canvas"!==a.tagName.toLowerCase())for(g=a,na=document.createElement("canvas");g.firstChild;)g.removeChild(g.firstChild);else{na=a;g=document.createElement("div");var c=null,q=null;Array.prototype.slice.call(na.attributes).forEach(function(a){"width"===a.name?c=a.value:"height"===a.name?q=a.value:g.setAttributeNodeNS(na.removeAttributeNode(a))});
+null===c||g.style.width||(g.style.width=c+"px");null===q||g.style.height||(g.style.height=q+"px");na.parentNode.replaceChild(g,na)}g.classList.add("CindyJS-widget");a=na.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(g).getPropertyValue("position"),a=String(a||"static"));"static"===a&&(g.style.position="relative");g.appendChild(na);return na}function V(){var a=p.cinderella;if(!a||
+!a.version)return!1;for(var g=0;g<arguments.length;++g){var c=a.version[g],q=arguments[g];if(c!==q)return typeof c===typeof q&&c<q}return!1}function S(){kc=!0;if(0===Ub){if(p.exclusive)for(b=va.instances.length;0<b;)va.instances[--b].shutdown();void 0!==p.csconsole&&(wa=p.csconsole);wa=null===wa?new ua:!0===wa?new Cb:"string"===typeof wa?new gb(wa):"object"===typeof wa&&"function"===typeof wa.appendChild?new gb(wa):new ua;ra=[100,100];var a=null;Db=p.transform;if(p.ports&&0<p.ports.length){b=p.ports[0];
+(a=b.element)||(a=document.getElementById(b.id));var a=N(a),g=a.parentNode.style;"window"===b.fill?(g.width="100vw",g.height="100vh"):"parent"===b.fill?(g.width="100%",g.height="100%"):b.width&&b.height&&(g.width=b.width+"px",g.height=b.height+"px");b.background&&(a.style.backgroundColor=b.background);void 0!==b.transform&&(Db=b.transform);Ia(b.grid)&&0<b.grid&&(za=b.grid);Ia(b.tgrid)&&0<b.tgrid&&(lc=b.tgrid);b.snap&&(Eb=!0);b.axes&&(Fb=!0)}a||(a=p.canvas,a||"undefined"===typeof document||(a=document.getElementById(p.canvasname))&&
+(a=N(a)));a&&(na=a,A=a.getContext("2d"),F(),A.setLineDash||(A.setLineDash=function(){}),(p.animation?p.animation.controls:p.animcontrols)&&ea(p),p.animation&&Ia(p.animation.speed)&&(void 0===p.animation.accuracy&&V(2,9,1875)?ha(.5*p.animation.speed):ha(p.animation.speed)),p.animation&&Ia(p.animation.accuracy)&&(Vb=p.animation.accuracy));p.statusbar&&(mc="string"===typeof p.statusbar?document.getElementById(p.statusbar):p.statusbar);var c=p.scripts,q=null;"string"===typeof c&&c.search(/\*/)&&(q=c);
+"object"!==typeof c&&(c=null);"move keydown keyup keytyped keytype mousedown mouseup mousedrag mousemove mouseclick init tick draw simulationstep simulationstart simulationstop ondrop".split(" ").forEach(function(a){var g;if(null!==c&&c[a])g=c[a];else{g=a+"script";if(p[g])g=document.getElementById(p[g]);else if(q){if(g=document.getElementById(q.replace(/\*/,a)),!g)return}else return;g=g.text}g=Ua(g,!1);"error"===g.ctype?console.error("Error compiling "+a+" script: "+g.message):R[a]=Td(g,a)});V(2,
+9,1888)&&!R.keydown&&(R.keydown=R.keytyped,R.keytyped=R.keytype,R.keytype=void 0);Ia(p.grid)&&0<p.grid&&(za=p.grid);p.snap&&(Eb=!0);v={};var b=0;bb={};p.geometry||(p.geometry=[]);Ud(p.geometry);p.behavior||(p.behavior=[]);"function"===typeof nc&&nc(p.behavior);for(var d in p.images)b=fa(p.images[d],!1),b!==k&&(bb[d]=b);for(var h in p.videos)d=fa(p.videos[h],!0),d!==k&&(bb[h]=d);sa.canvas=a;if(p.oninit)p.oninit(sa);va.instances.push(sa);p.use&&p.use.forEach(function(a){t.use$1([w.wrap(a)],{})});hb.convexhull3d$1&&
+pa("QuickHull3D","QuickHull3D.js");(hb.colorplot$1||hb.colorplot$2||hb.colorplot$3||hb.colorplot$4)&&pa("CindyGL","CindyGL.js");(hb.playtone$1||hb.playmelody$1)&&pa("midi","midi-plugin.js");Y()}}function fa(a,g){var c;"string"===typeof a?(g?(c=document.createElement("video"),c.preload="auto",c.loop=!0,c.setAttribute("playsinline",""),enableInlineVideo(c)):c=new Image,c.src=a):c=a;if(!c.tagName)return console.error("Not a valid image element",c),k;var q={img:c,width:NaN,height:NaN,ready:!0,live:!1,
+generation:0,whenReady:f},b=c.tagName.toLowerCase(),d=[];if("img"===b)c.complete?(q.width=c.width,q.height=c.height):(q.ready=!1,c.addEventListener("load",function(){q.width=c.width;q.height=c.height;q.ready=!0;q.whenReady=f;d.forEach(f);e()}),q.whenReady=d.push.bind(d));else if("video"===b)q.live=!0,c.readyState>=c.HAVE_METADATA?(q.width=c.videoWidth,q.height=c.videoHeight):(q.ready=!1,c.addEventListener("loadedmetadata",function(){q.width=c.videoWidth;q.height=c.videoHeight;q.ready=!0;q.whenReady=
+f;d.forEach(f);e()}),q.whenReady=d.push.bind(d));else if("canvas"===b)q.width=c.width,q.height=c.height;else return console.error("Not a valid image element",b,c),k;return{ctype:"image",value:q}}function ea(a){function g(a,c){var g=document.createElement("button"),q=document.createElement("img");g.appendChild(q);m.appendChild(g);Gb(q,a);g.addEventListener("click",c);Va[a]=function(a){a?g.classList.add("CindyJS-active"):g.classList.remove("CindyJS-active")}}function c(a){if(k){var c=e.getBoundingClientRect();
+ha(h*(a.clientX-c.left-e.clientLeft+.5)/c.width+b)}}var q=document.createElement("div");q.className="CindyJS-animcontrols";na.parentNode.appendChild(q);var b=0,d=1,h=1;a.animation&&a.animation.speedRange&&Ia(a.animation.speedRange[0])&&Ia(a.animation.speedRange[1])&&(b=a.animation.speedRange[0],d=a.animation.speedRange[1],h=d-b);var e=document.createElement("div");e.className="CindyJS-animspeed";q.appendChild(e);var f=document.createElement("div");e.appendChild(f);H(e,"mousedown",function(a){k=!0;
+c(a)});H(e,"mousemove",c);H(na.parentNode,"mouseup",function(a){k=!1},!0);var m=document.createElement("div");m.className="CindyJS-animbuttons";q.appendChild(m);g("play",M);g("pause",Ga);g("stop",Ha);Va.stop(!0);oc=function(a){a=(a-b)/h;a=Math.max(0,Math.min(1,a));a=.1*Math.round(1E3*a);f.style.width=a+"%"};var k=!1}function ha(a){Vc=a;oc&&oc(a)}function f(a){return a()}function pa(a,g,c){var q=null;p.plugins&&(q=p.plugins[a]);q||(q=va._pluginRegistry[a]);q?t.use$1([w.wrap(a)],{}):(++Wc,va.autoLoadPlugin(a,
+g,function(){t.use$1([w.wrap(a)],{});Y(c)}))}function Y(a){0===--Wc&&(a?e():(z(R.init),(p.animation||p).autoplay&&M(),sa.canvas&&ic(sa.canvas,p)))}function ba(){null!==Hb&&(qa.set(Hb.state),Object.keys(Hb.speeds).forEach(function(a){var g=v.csnames[a];"undefined"!==typeof g.behavior&&(a=Hb.speeds[a],g.behavior.vx=a[0],g.behavior.vy=a[1],g.behavior.vz=a[2],g.behavior.fx=0,g.behavior.fy=0,g.behavior.fz=0)}),Vd())}function M(){if(!cb){if(Xb){var a=ib.backup;a.set(qa);for(var g={},c=0;c<v.points.length;c++){var q=
+v.points[c];"undefined"!==typeof q.behavior&&(g[q.name]=[q.behavior.vx,q.behavior.vy,q.behavior.vz])}Hb={state:a,speeds:g};Ib=0;Xb=!1;Va.stop(!1)}else Va.pause(!1);pc=Date.now();Va.play(!0);"function"===typeof nc&&qc&&Wd();cb=!0;z(R.simulationstart);e()}}function Ga(){cb&&(Va.play(!1),Va.pause(!0),cb=!1)}function Ha(){Xb||(cb?(z(R.simulationstop),cb=!1,Va.play(!1)):Va.pause(!1),Va.stop(!0),Xb=!0,ba())}function Ta(){if(!Yb){Yb=!0;for(var a=va.instances.length;0<a;)if(va.instances[--a]===sa){va.instances.splice(a,
+1);break}for(a=jb.length;0<a;)try{jb[--a]()}catch(g){console.error(g)}}}function fb(a){this["in"]=function(a,c){console.log(a);c?this.append(this.createTextNode("span","blue",a)):this.append(this.createTextNode("p","blue",a))};this.out=function(a,c){console.log(a);c?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.err=function(a,c){console.log(a);c?this.append(this.createTextNode("span","red",a)):this.append(this.createTextNode("p","red",a))};this.createTextNode=
+function(a,c,q){return"undefined"!==typeof document?(a=document.createElement(a),a.appendChild(document.createTextNode(q)),a.style.color=c,a):q+"\n"}}function Cb(){var a=this,g,c=document.createElement("div"),q;c.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(c);
+g=document.getElementById("cmd");q=document.getElementById("log");g.onkeydown=function(c){13===c.keyCode&&""!==g.value&&(a["in"](g.value),c=t.parse$1([w.wrap(g.value)],[]),c=z(c),console.log(Z(c)),"undefined"!==c.ctype&&wa.out(Z(c)),g.value="",q.scrollTop=q.scrollHeight)};this.append=function(a){q.appendChild(a)};this.clear=function(){q.innerHTML=""}}function gb(a){var g=a;"string"===typeof a&&(g=document.getElementById(a));this.append=function(a){g.appendChild(a)};this.clear=function(){g.innerHTML=
+""}}function ua(){this.append=function(a){};this.clear=function(){}}function H(a,g,c,q){void 0===q&&(q=!1);jb.push(function(){a.removeEventListener(g,c,q)});a.addEventListener(g,c,q)}function ic(a,g){function c(c){var g=a.getBoundingClientRect();c=y.to(c.clientX-g.left-a.clientLeft+.5,c.clientY-g.top-a.clientTop+.5);aa.prevx=aa.x;aa.prevy=aa.y;aa.x=c[0];aa.y=c[1];ra[0]=aa.x;ra[1]=aa.y;e()}function q(a){for(var c=a.changedTouches,g=!1,q=0;q<c.length;q++)c[q].identifier===W&&(g=!0);g&&(W=-1,aa.down=
+!1,ja=void 0,z(R.mouseup),wb("mouseup"),e(),a.preventDefault())}var b=null;"undefined"!==typeof MutationObserver&&(b=MutationObserver);b||"undefined"===typeof WebKitMutationObserver||(b=WebKitMutationObserver);b?(b=new b(function(c){document.body.contains(a)||Ta()}),b.observe(document.documentElement,{childList:!0,subtree:!0}),jb.push(function(){b.disconnect()})):(H(a,"DOMNodeRemovedFromDocument",Ta),H(a,"DOMNodeRemoved",Ta));if(!0===g.keylistener)H(document,"keydown",function(a){I(a,R.keydown);return!1}),
+H(document,"keyup",function(a){I(a,R.keyup);return!1}),H(document,"keypress",function(a){I(a,R.keytyped);return!1});else if(R.keydown||R.keyup||R.keytyped)a.setAttribute("tabindex","0"),H(a,"mousedown",function(){a.focus()}),H(a,"keydown",function(a){9!==a.keyCode&&(I(a,R.keydown),R.keytyped||a.preventDefault())}),H(a,"keyup",function(a){I(a,R.keyup);a.preventDefault()}),H(a,"keypress",function(a){9!==a.keyCode&&(I(a,R.keytyped),a.preventDefault())});H(a,"mousedown",function(a){aa.button=a.which;
+c(a);z(R.mousedown);wb("mousedown");aa.down=!0;a.preventDefault()});H(a,"mouseup",function(a){aa.down=!1;ja=void 0;z(R.mouseup);wb("mouseup");e();a.preventDefault()});H(a,"mousemove",function(a){c(a);aa.down?z(R.mousedrag):z(R.mousemove);wb("mousemove");a.preventDefault()});H(a,"click",function(a){c(a);z(R.mouseclick);a.preventDefault()});H(a,"dragenter",function(a){a.preventDefault()});H(a,"dragover",function(a){a.preventDefault()});H(a,"drop",function(c){function g(a,c){function h(){e.readyState===
+XMLHttpRequest.DONE&&(200!==e.status?(console.error("GET request for "+a+" failed: "+(e.responseText||"(no error message)")),d(c,k)):b(c,e.responseText))}var W=a.replace(/[?#][^]*/,""),W=W.replace(/[^]*\/([^\/])/,"$1");f[c]={type:"",name:W};var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE)if(200!==e.status)console.error("HEAD request for "+a+" failed: "+(e.responseText||"(no error message)")),d(c,k);else{var g=e.getResponseHeader("Content-Type");f[c].type=
+g;/^image\//.test(g)?oa(c,a):q(g)?(e=new XMLHttpRequest,e.onreadystatechange=h,e.open("GET",a),e.send()):d(c,k)}};e.open("HEAD",a);e.send()}function q(a){a=a.replace(/;[^]*/,"");return/^text\//.test(a)?1:"application/json"===a?2:0}function b(a,c){switch(q(f[a].type)){case 1:d(a,w.string(c));break;case 2:var g,oa;try{g=JSON.parse(c),oa=w.wrapJSON(g)}catch(h){console.error(h),oa=k}d(a,oa);break;default:d(a,k)}}function oa(a,c){var g=new Image,q=!1;g.onload=function(){q||(q=!0,d(a,fa(g,!1)))};g.onerror=
+function(c){q||(q=!0,console.error(c),d(a,k))};g.src=c}function d(a,c,g){m[a]=h.turnIntoCSList([c,w.string(g||c.ctype),w.string(f[a].type),w.string(f[a].name)]);0===--l&&(a=p,rc=h.turnIntoCSList(m),sc=a,z(R.ondrop),sc=rc=k,e())}c.preventDefault();var W=c.dataTransfer,f=W.files,m=Array(f.length),l=f.length,n=c.currentTarget.getBoundingClientRect(),p=h.realVector(y.to(c.clientX-n.left-a.clientLeft+.5,c.clientY-n.top-a.clientTop+.5));if(0<f.length)Array.prototype.forEach.call(f,function(a,c){var g=new FileReader;
+q(a.type)?(g.onload=function(){b(c,g.result)},g.readAsText(a)):/^image\//.test(a.type)?(g.onload=function(){oa(c,g.result)},g.readAsDataURL(a)):(console.log("Unknown MIME type: "+a.type),d(c,k))});else if(c=W.getData("text/uri-list"))c=c.split("\n").filter(function(a){return!/^\s*(#|$)/.test(a)}),l=c.length,m=Array(l),f=Array(l),c.forEach(g)});var W=-1;H(a,"touchstart",function(a){if(-1===W){var g=a.changedTouches;0!==g.length&&(W=g[0].identifier,c(a.targetTouches[0]),z(R.mousedown),aa.down=!0,wb("mousedown"),
+a.preventDefault())}},!1);H(a,"touchmove",function(a){for(var g=a.changedTouches,q=!1,b=0;b<g.length;b++)g[b].identifier===W&&(q=!0);q&&(c(a.targetTouches[0]),aa.down?z(R.mousedrag):z(R.mousemove),wb("mousemove"),a.preventDefault())},!0);H(a,"touchend",q,!1);"undefined"!==typeof document&&document.body&&H(document.body,"touchcancel",q,!1);"undefined"!==typeof window&&H(window,"resize",function(){Zb(function(){F();e()})},!1);d(a.parentNode);e()}function b(a,g){var c=document.createElement("div");c.setAttribute("style",
+g);a.appendChild(c);return c}function d(a){function g(){q.scrollLeft=q.scrollTop=oa.scrollLeft=oa.scrollTop=1E5}function c(){if(d!==a.clientWidth||h!==a.clientHeight)d=a.clientWidth,h=a.clientHeight,f||(f=!0,Zb(function(){f=!1;F();e()}));g()}if("undefined"!==typeof document){var q=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");b(q,"position: absolute; transition: 0s; left: 0; top: 0; width: 100000px; height: 100000px");
+var oa=b(a,"position: absolute; transition: 0s; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;");b(oa,"position: absolute; transition: 0s; left: 0; top: 0; width: 200%; height: 200%");g();var d=a.clientWidth,h=a.clientHeight,f=!1;q.addEventListener("scroll",c);oa.addEventListener("scroll",c)}}function e(){tc||(tc=Zb(r))}function r(){tc=null;if(!Yb){if(cb){var a=Date.now(),g=Math.min(50,a-pc)*Vc*Xd;pc=a;a=Ib+g;qc&&"undefined"!==typeof ya&&ya.tick(g);Ib=a;cb&&
+z(R.tick)}n();cb&&e()}}function n(){y.reset();A.save();A.clearRect(0,0,ca,da);var a=y.drawingstate.matrix,g,c,q,b,d;if(0!==za){A.beginPath();A.strokeStyle="rgba(0,0,0,0.1)";A.lineWidth=1;A.lineCap="butt";g=za*a.a;for(b=Math.ceil(-a.tx/g);(d=b*g+a.tx)<ca;){if(b||!Fb)A.moveTo(d,0),A.lineTo(d,da);b++}for(b=Math.floor(a.ty/g);(d=b*g-a.ty)<da;){if(b||!Fb)A.moveTo(0,d),A.lineTo(ca,d);b++}A.stroke()}if(0!==lc){A.beginPath();A.strokeStyle="rgba(0,0,0,0.1)";A.lineWidth=1;A.lineCap="butt";g=lc*a.a;var e=Math.sqrt(3);
+c=a.ty/e;q=(da+a.ty)/e;for(b=Math.ceil(-(a.tx+q)/g);(d=b*g+a.tx)+c<ca;)A.moveTo(d+c,0),A.lineTo(d+q,da),b++;for(b=Math.ceil(-(a.tx-c)/g);(d=b*g+a.tx)-q<ca;)A.moveTo(d-c,0),A.lineTo(d-q,da),b++;g*=.5*e;for(b=Math.floor(a.ty/g);(d=b*g-a.ty)<da;){if(b||!Fb)A.moveTo(0,d),A.lineTo(ca,d);b++}A.stroke()}Fb&&(A.beginPath(),A.strokeStyle="rgba(0,0,0,0.2)",A.lineWidth=3,A.lineCap="butt",A.lineJoin="miter",A.miterLimit=10,A.beginPath(),A.moveTo(0,-a.ty),A.lineTo(ca-6,-a.ty),A.moveTo(ca-13,-5-a.ty),A.lineTo(ca-
+3,-a.ty),A.lineTo(ca-13,5-a.ty),A.moveTo(a.tx,da),A.lineTo(a.tx,6),A.moveTo(a.tx-5,13),A.lineTo(a.tx,3),A.lineTo(a.tx+5,13),A.stroke());Yd();y.greset();Zd();for(a=0;a<v.polygons.length;a++)g=v.polygons[a],g.isshowing&&!1!==g.visible&&(c={color:g.color,alpha:g.alpha,fillcolor:g.fillcolor,fillalpha:g.fillalpha,size:g.size,lineJoin:w.string("miter"),fillrule:w.string(g.fillrule)},D.drawpolygon([g.vertices],c,"D",!0));for(a=0;a<v.conics.length;a++)v.conics[a].isArc?(g=v.conics[a],g.isshowing&&!1!==g.visible&&
+(c={},c.color=g.color,c.alpha=g.alpha,c.size=g.size,D.drawarc(g,c,g.filled?"F":"D"))):(g=v.conics[a],g.isshowing&&!1!==g.visible&&(c={},c.color=g.color,c.alpha=g.alpha,c.size=g.size,D.drawconic(g.matrix,c)));for(a=0;a<v.lines.length;a++)a:if(g=v.lines[a],g.isshowing&&!1!==g.visible&&h._helper.isAlmostReal(g.homog))if("S"===g.kind)c={overhang:g.overhang,dashtype:g.dashtype,size:g.size,color:g.color,alpha:g.alpha,arrow:g.arrow,arrowsize:g.arrowsize,arrowposition:g.arrowposition,arrowshape:g.arrowshape,
+arrowsides:g.arrowsides},0<=m.mult(g.startpos.value[2],m.conjugate(g.endpos.value[2])).value.real?(t.draw$2([g.startpos,g.endpos],c),g.labeled&&!g.tmp&&(c=g.printname||g.name||"S",q=h.scalmult(m.real(Math.sign(g.startpos.value[2].value.real)*Math.sign(g.endpos.value[2].value.real)),h.cross(g.startpos,g.endpos)),q={x:q.value[0].value.real,y:q.value[1].value.real},b=Math.sqrt(q.x*q.x+q.y*q.y),q={x:8*q.x/b-3,y:8*q.y/b-3},q=g.labelpos||q,b=x.makeColor(ga.textColor),d=l._helper.midpoint(l._helper.midpoint(g.startpos,
+g.endpos),g.endpos),Xc(g,c,d,q,b))):(x.handleModifs(c,x.lineModifs),x.drawRaySegment(g.startpos,g.endpos));else if("end"===g.clip.value&&"Join"===g.type)b=v.csnames[g.args[0]],c=v.csnames[g.args[1]],t.draw$2([b.homog,c.homog],{overhang:g.overhang,dashtype:g.dashtype,size:g.size,color:g.color,alpha:g.alpha});else{if("inci"===g.clip.value){b=[1E6,0];c=[-1E6,0];d=[1E6,0];q=[-1E6,0];for(e=0;e<g.incidences.length;e++){var f=v.csnames[g.incidences[e]].homog,k=f.value[0],Ra=f.value[1],n=f.value[2];m._helper.isAlmostZero(n)||
+(k=m.div(k,n),Ra=m.div(Ra,n),m._helper.isAlmostReal(k)&&m._helper.isAlmostReal(Ra)&&(k.value.real<b[0]&&(b=[k.value.real,f]),k.value.real>c[0]&&(c=[k.value.real,f]),Ra.value.real<d[0]&&(d=[Ra.value.real,f]),Ra.value.real>q[0]&&(q=[Ra.value.real,f])))}c[0]-b[0]>q[0]-d[0]?(b=b[1],c=c[1]):(b=d[1],c=q[1]);if(b!==c){t.draw$2([b,c],{dashtype:g.dashtype,size:g.size,color:g.color,alpha:g.alpha,overhang:g.overhang});break a}}t.draw$1([g.homog],{dashtype:g.dashtype,size:g.size,color:g.color,alpha:g.alpha})}for(a=
+0;a<v.points.length;a++)if(g=v.points[a],g.isshowing&&!1!==g.visible&&h._helper.isAlmostReal(g.homog)&&(c=g.color,g.behavior&&(c=g.color),t.draw$1([g.homog],{size:g.size,color:c,alpha:g.alpha,noborder:g.noborder,border:g.border}),g.labeled&&!g.tmp)){q=g.printname||g.name||"P";b=g.labelpos||{x:3,y:3};d=x.makeColor(ga.textColor);if(!0===g.noborder.value||!1===g.border.value)d=c;Xc(g,q,g.homog,b,d)}for(a=0;a<v.texts.length;a++)$d(v.texts[a]);if(v.ifs.length){if(U.dirty||!w.deeplyEqual(U.mat,y.drawingstate.matrix))l.IFS.updateParameters(),
+U.dirty=!1;U.img&&A.drawImage(U.img,0,0,ca,da)}A.restore()}function I(a,g){var c=window.event?event:a,c=c.charCode?c.charCode:c.keyCode;Yc=String.fromCharCode(c);Zc=c;z(g);e()}function u(a){var g=a.value;a=g[0].value;var c=g[1].value,g=g[2].value;return h.turnIntoCSList([a[0],m.add(a[1],c[0]),m.add(a[2],g[0]),c[1],m.add(c[2],g[1]),g[2]])}function C(a){var g=!0;return function(c,q){g&&(console.error("Operator "+a+" is not supported yet."),g=!1);return k}}function Z(a){if("undefined"===typeof a)return"_??_";
+if(null===a)return"_???_";if("undefined"===a.ctype)return"___";if("number"===a.ctype)return m.niceprint(a);if("string"===a.ctype||"boolean"===a.ctype)return a.value;if("list"===a.ctype){for(var g="[",c=0;c<a.value.length;c++)g+=Z(z(a.value[c])),c!==a.value.length-1&&(g+=", ");return g+"]"}return"dict"===a.ctype?Na.niceprint(a):"function"===a.ctype?"FUNCTION":"infix"===a.ctype?"INFIX":"modifier"===a.ctype?a.key+"->"+Z(a.value):"shape"===a.ctype?a.type:"error"===a.ctype?"Error: "+a.message:"variable"===
+a.ctype?Z(J.getvar(a.name)):"geo"===a.ctype?a.value.name:"image"===a.ctype?"IMAGE":"_?_"}function ab(a,g){var c="undefined"===a[0].ctype,q="undefined"===a[1].ctype,b=z(a[1]);if(c||q)return k;"variable"===a[0].ctype?J.setvar(a[0].name,b):"infix"===a[0].ctype?"_"===a[0].oper?D.assigntake(a[0],b):ka("Can't use infix expression as lvalue"):"field"===a[0].ctype?D.assigndot(a[0],b):"userdata"===a[0].ctype?D.assigncolon(a[0],b):"function"===a[0].ctype&&"genList"===a[0].oper?"list"===b.ctype?D.assignlist(a[0].args,
+b.value):ka("Expected list in rhs of assignment"):ka("Left hand side of assignment is not a recognized lvalue");return b}function vb(a,g){var c=z(a[0]),q=z(a[1]);if(c.ctype===q.ctype){if("number"===c.ctype)return w.bool(c.value.real===q.value.real&&c.value.imag===q.value.imag);if("string"===c.ctype||"boolean"===c.ctype)return w.bool(c.value===q.value);if("list"===c.ctype)return h.equals(c,q);if("geo"===c.ctype)return w.bool(c.value===q.value)}return{ctype:"boolean",value:!1}}function Oc(a,g){return w.not(vb(a,
+g))}function hc(a,g){var c=B(a[0]),q=B(a[1]);return"number"===c.ctype&&"number"===q.ctype?{ctype:"boolean",value:m._helper.isAlmostEqual(c,q)}:"string"===c.ctype&&"string"===q.ctype||"boolean"===c.ctype&&"boolean"===q.ctype?{ctype:"boolean",value:c.value===q.value}:"list"===c.ctype&&"list"===q.ctype?h.almostequals(c,q):{ctype:"boolean",value:!1}}function Pc(a,g){var c=B(a[0]),q=B(a[1]);return"boolean"===c.ctype&&"boolean"===q.ctype?{ctype:"boolean",value:c.value&&q.value}:k}function Qc(a,g){var c=
+B(a[0]),q=B(a[1]);return"boolean"===c.ctype&&"boolean"===q.ctype?{ctype:"boolean",value:c.value||q.value}:k}function Rc(a,g){var c=a[0];"void"!==c.ctype&&(c=B(c));var q=B(a[1]),b=w.add(c,q);"Angle"===c.usage&&"Angle"===q.usage&&(b=w.withUsage(b,"Angle"));return b}function jc(a,g){var c=a[0];"void"!==c.ctype&&(c=B(c));var q=B(a[1]),b=w.sub(c,q);"Angle"===c.usage&&"Angle"===q.usage&&(b=w.withUsage(b,"Angle"));return b}function Sc(a,g){var c=B(a[0]),q=B(a[1]),b=w.mult(c,q);"Angle"!==c.usage||q.usage?
+"Angle"!==q.usage||c.usage||(b=w.withUsage(b,"Angle")):b=w.withUsage(b,"Angle");return b}function Tc(a,g){var c=B(a[0]),q=B(a[1]);"number"===q.ctype&&m._helper.isZero(q)&&ka("WARNING: Division by zero!");var b=w.div(c,q);"Angle"!==c.usage||q.usage?"Angle"!==q.usage||c.usage||(b=w.withUsage(b,"Angle")):b=w.withUsage(b,"Angle");return b}function Uc(a,g){var c=B(a[0]),q=B(a[1]);return"number"===c.ctype&&"number"===q.ctype?m.pow(c,q):k}function $c(a,g){var c=K(a[0]),q=K(a[1]);if(c!==k&&q!==k){var b=h.cross(c,
+q);"Point"===c.usage&&"Point"===q.usage&&(b=w.withUsage(b,"Line"));"Line"===c.usage&&"Line"===q.usage&&(b=w.withUsage(b,"Point"));return b}return k}function uc(a){var g=a.length;if(0===g)return[];if(1===g)return[0];if(2===g)return a[0][0]+a[1][1]<=a[0][1]+a[1][0]?[0,1]:[1,0];if(4<g)return ae(a);for(var c=be[g],q=Number.POSITIVE_INFINITY,b=c[0],d=0;d<c.length;++d){for(var h=c[d],e=0,f=0;f<g;++f)e+=a[f][h[f]];e<q&&(q=e,b=h)}return b}function ae(a){function g(){return{matched:-1,prev:-1,start:-1,cost:0,
+used:!1,leaf:!1}}function c(a){for(var g=0;g<d;++g)0<k[a][g]||m[g].used||(m[g].used=!0,c(m[g].matched))}function q(a){for(var c=0;c<d;++c)0<k[c][a]||f[c].used||(f[c].used=!0,q(f[c].matched))}var b=Math.abs,d=a.length,h,e,f=Array(d),m=Array(d),k=Array(d);for(h=0;h<d;++h)k[h]=Array(d);for(h=0;h<d;++h)for(f[h]=g(),m[h]=g(),f[h].cost=a[h][0],e=1;e<d;++e)f[h].cost>a[h][e]&&(f[h].cost=a[h][e]);for(;;){for(h=0;h<d;++h)for(e=0;e<d;++e)k[h][e]=a[h][e]-f[h].cost-m[e].cost,k[h][e]<1E-14*(b(a[h][e])+b(f[h].cost)+
+b(m[e].cost))&&(k[h][e]=0);for(h=0;h<d;++h)f[h].matched=m[h].matched=-1;for(var l=0;;){for(h=0;h<d;++h)f[h].used=f[h].leaf=m[h].used=m[h].leaf=!1,-1===f[h].matched&&(f[h].start=h,f[h].used=f[h].leaf=!0,f[h].prev=-1);for(var n=!1,p=!1;!p;){for(h=0;h<d;++h)if(f[h].leaf)for(f[h].leaf=!1,e=0;e<d;++e)if(!(m[e].used||0<k[h][e])&&f[h].matched!==e&&(m[e].prev=h,m[e].start=f[h].start,m[e].used=m[e].leaf=!0,-1===m[e].matched)){f[m[e].start].prev=e;n=!0;break}if(n)break;p=!0;for(e=0;e<d;++e)m[e].leaf&&(m[e].leaf=
+!1,h=m[e].matched,f[h].used||(f[h].prev=e,f[h].start=m[e].start,f[h].used=f[h].leaf=!0,p=!1))}if(!n)break;for(n=0;n<d;++n)if(-1===f[n].matched&&-1!==f[n].prev){e=f[n].prev;do h=m[e].prev,m[e].matched=h,f[h].matched=e,e=f[h].prev;while(h!==n);++l}}if(l===d)break;for(h=0;h<d;++h)f[h].used=f[h].leaf=m[h].used=m[h].leaf=!1;for(h=0;h<d;++h)-1===f[h].matched&&c(h);for(e=0;e<d;++e)-1===m[e].matched&&q(e);for(h=0;h<d;++h)-1===f[h].matched||f[h].used||m[f[h].matched].used||(f[h].used=!0);l=Number.POSITIVE_INFINITY;
+for(h=0;h<d;++h)if(!f[h].used)for(e=0;e<d;++e)m[e].used||l>k[h][e]&&(l=k[h][e]);for(h=0;h<d;++h)f[h].used||(f[h].cost+=l),m[h].used&&(m[h].cost-=l)}a=Array(d);for(h=0;h<d;++h)e=f[h].matched,a[h]=e;return a}function vc(a,g){var c=z(a[0]),q=B(a[1]);"string"!==c.ctype&&(c=h.asList(c));if("number"===q.ctype){q=Math.floor(q.value.real);0>q&&(q=c.value.length+q+1);if(0<q&&q<c.value.length+1)return"list"===c.ctype?c.value[q-1]:{ctype:"string",value:c.value.charAt(q-1)};ka("WARNING: Index out of range!");
+return k}if("list"===q.ctype){for(var b=[],d=0;d<q.value.length;d++){var e=B(q.value[d]);b[d]=vc([c,e],[])}return h.turnIntoCSList(b)}return k}function ad(a,g){var c=z(a[0]),q=z(a[1]);if("shape"===c.ctype&&"shape"===q.ctype)return D.shapeconcat(c,q);c=h.asList(c);q=h.asList(q);return"list"===c.ctype&&"list"===q.ctype?h.concat(c,q):k}function bd(a,g){var c=z(a[0]),q=z(a[1]);return"list"===c.ctype&&"list"===q.ctype?h.set(h.common(c,q)):"shape"===c.ctype&&"shape"===q.ctype?D.shapecommon(c,q):k}function cd(a,
+g){var c=z(a[0]),q=z(a[1]);return"list"===c.ctype&&"list"===q.ctype?h.remove(c,q):"shape"===c.ctype&&"shape"===q.ctype?D.shaperemove(c,q):k}function dd(a,g){var c=z(a[0]),q=z(a[1]);return"list"===c.ctype?h.append(c,q):k}function ed(a,g){var c=z(a[0]),q=z(a[1]);return"list"===q.ctype?h.prepend(c,q):k}function wc(a,g){a|=0;g|=0;if(0===a&&0===g)return 0;for(;0!==g;){var c=a;a=g;g=c%g|0}return a}function ce(a){return 1===a?0:1}function Jb(a,g,c){var q=g*g-4*a*c;0<=q?(q=Math.sqrt(q),0<g&&(q=-q),g=[[q-
+g,2*a],[2*c,q-g]]):g=null;if(null===g)return null;a=g[0][0]/g[0][1];g=g[1][0]/g[1][1];return g<a?[g,a]:[a,g]}function fd(a,g,c,q,b,d,h){if(-1!==g.indexOf("\n")){var e=Infinity,f=-Infinity,m=Infinity,k=-Infinity;g.split("\n").forEach(function(g){g=fd(a,g,c,q,b,d);e>g.left&&(e=g.left);f<g.right&&(f=g.right);m>g.top&&(m=g.top);k<g.bottom&&(k=g.bottom);q+=h});return{left:e,right:f,top:m,bottom:k}}var l=a.measureText(g);a.fillText(g,c-l.width*b,q);return{left:c-l.width*b,right:c+l.width*(1-b),top:q-.84*
+d,bottom:q+.36*d}}function Ja(a){return"image"===a.ctype?a.value:"string"===a.ctype&&bb.hasOwnProperty(a.value)?bb[a.value].value:null}function pb(a,g,c,q,b){var d=[];if(a.readPixels)d=a.readPixels(g,c,q,b);else{var h,e;if(a.img.getContext)e=a.img.getContext("2d"),h=e.getImageData(g,c,q,b).data;else try{Kb||(Kb=document.createElement("canvas")),Kb.width=q,Kb.height=b,e=Kb.getContext("2d"),e.drawImage(a.img,g,c,q,b,0,0,q,b),h=e.getImageData(0,0,q,b).data}catch(f){console.log(f)}for(var m in h)d.push(h[m]/
+255)}return d}function gd(a){return a.replace(/[^A-Za-z0-9 \u0080-\uffff]/ig,"\\$&")}function la(a,g,c){var q=a;g&&(q=q+" at "+g.row+":"+g.col);c&&(q=q+": \u2018"+c+"\u2019");q=Error(q);q.name="CindyScriptParseError";q.description=a;q.location=g;q.text=c;return q}function qb(a){this.input=a;this.re=new RegExp(hd,"g");for(var g=[],c=a.indexOf("\n")+1;c;)g.push(c),c=a.indexOf("\n",c)+1;g.push(a.length);this.bols=g;this.bol=this.pos=0;this.line=1}function $b(a){var g=a[a.length-2],c=a[a.length-3],q=
+a[a.length-1];if(c){if(c.isSuperscript&&g.precedence<=c.precedence)throw la("Operator not allowed after superscript",g.start,g.text);if(q){if(!g.op.infix)throw la("Operator may not be used infix",g.start,g.text);}else if(!g.op.postfix)throw la("Operator may not be used postfix",g.start,g.text);}else if(q){if(!g.op.prefix)throw la("Operator may not be used prefix",g.start,g.text);}else if(!g.op.bare)throw la("Operator without operands",g.start,g.text);g.ctype="infix";g.oper=g.op.sym;g.args=[c,q];a.splice(a.length-
+3,3,g)}function id(a,g,c,q){a.length&1||a.push(null);for(c=Ca[c];3<=a.length&&a[a.length-2].precedence<=c.precedence;)$b(a);a.push({op:c,precedence:c.precedence+(c.rassoc?1:0),start:g.start,end:g.end,text:g.text,rawtext:g.rawtext});c="";for(var b=g.text,d=0;d<b.length;++d)c+="0123456789+-".charAt(q.indexOf(b.charAt(d)));g.ctype="number";g.value={real:+c,imag:0};a.push(g);$b(a)}function jd(a,g){var c=[],q;a:for(;;)switch(q=a.next(),q.toktype){case "OP":var b=Ca[q.text];"_"!==b.sym||!c.length||c.length&
+1||"OP"!==c[c.length-1].toktype||":="!==c[c.length-1].op.sym||(c.pop(),b=Ca[":=_"],q.text=b.sym);q.op=b;q.precedence=b.precedence;for(c.length&1||c.push(null);3<=c.length&&c[c.length-2].precedence<=q.precedence;)$b(c);b.rassoc&&q.precedence++;c.push(q);break;case "ID":q.ctype="variable";q.name=q.text;if(c.length&1)throw la("Missing operator",q.start,q.text);c.push(q);break;case "NUM":q.ctype="number";q.value={real:+q.text,imag:0};if(c.length&1)throw la("Missing operator",q.start,q.text);c.push(q);
+break;case "STR":q.ctype="string";q.value=q.raw.substring(1,q.raw.length-1);if(c.length&1)throw la("Missing operator",q.start,q.text);c.push(q);break;case "SUB":id(c,q,"_","\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089\u208a\u208b");break;case "SUP":id(c,q,"^","\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079\u207a\u207b");c[c.length-1].isSuperscript=!0;break;case "BRA":b="[](){}||".indexOf(q.text);if(q.text===g||b&1)break a;var b="[](){}||".charAt(b+1),d=jd(a,b),h=d.closedBy;
+if(h.text!==b)throw la("Opening "+q.text+" at "+q.start.row+":"+q.start.col+" closed by "+(h.text||"EOF")+" at "+h.start.row+":"+h.start.col);h=q.text+h.text;b=[];if(d=d.expr){for(;d&&"infix"===d.ctype&&","===d.oper;)b.push(d.args[0]),d=d.args[1];b.push(d)}if(c.length&1){if("{}"===h)throw la("{\u2026} reserved for future use",q.start);d=c[c.length-1];if("variable"!==d.ctype)throw la("Function name must be an identifier",d.start);if(2<c.length&&c[c.length-2].precedence<kd)throw la("Function call in indexing construct must be enclosed in parentheses",
+q.start);d.ctype="function";q=d.args=[];for(var h=d.modifs={},e=0;e<b.length;++e){var f=b[e];if(f&&"infix"===f.ctype&&"->"===f.oper){var m=f.args[0];if("variable"!==m.ctype)throw la("Modifier name must be an identifier",f.start);h[m.name]=f.args[1]}else q.push(f)}d.oper=d.name.toLowerCase()+"$"+d.args.length}else if("||"===h)if(1===b.length)c.push({ctype:"function",oper:"abs_infix",args:b,modifs:{}});else if(2===b.length)c.push({ctype:"function",oper:"dist_infix",args:b,modifs:{}});else throw la("Don't support |\u2026| with "+
+b.length+" arguments",q.start);else{if("{}"===h)throw la("{\u2026} reserved for future use",q.start);"[]"!==h&&1===b.length?c.push({ctype:"paren",args:b}):0===b.length?c.push({ctype:"list",value:[]}):c.push({ctype:"function",oper:"genList",args:b,modifs:{}})}break;case "EOF":break a}for(c.length&1||c.push(null);3<=c.length;)$b(c);return{expr:c[0],closedBy:q}}function Lb(a){this.usedFunctions={};this.usedVariables={}}function z(a){if(void 0===a)return k;if("infix"===a.ctype)return a.impl(a.args,{},
+a);if("variable"===a.ctype)return z(J.getvar(a.name));if("function"===a.ctype)return Mb.push(a),a=D.evaluate(a.oper,a.args,a.modifs),Mb.pop(),a;if("void"===a.ctype)return k;if("field"===a.ctype){var g=z(a.obj);return"geo"===g.ctype?ta.getField(g.value,a.key):"list"===g.ctype?h.getField(g,a.key):k}return"userdata"===a.ctype?(g=z(a.obj),a=Z(z(a.key)),"_?_"===a&&(a=void 0),"geo"===g.ctype?ta.getuserData(g.value,a):"list"===g.ctype||"string"===g.ctype?ta.getuserData(g,a):k):a}function B(a){a=z(a);if("geo"===
+a.ctype){var g=a.value;if("P"===g.kind)return ta.getField(g,"xy");if("V"===g.kind)return g.value}return a}function K(a){a=z(a);if("geo"===a.ctype){var g=a.value;if("P"===g.kind||"L"===g.kind)return ta.getField(g,"homog")}return h._helper.isNumberVecN(a,3)?a:h._helper.isNumberVecN(a,2)?(g=h.turnIntoCSList([a.value[0],a.value[1],m.real(1)]),a.usage&&(g=w.withUsage(g,a.usage)),g):k}function Ua(a){var g=new Lb;g.usedFunctions=hb;g.infixmap=Q;a=g.parse(a);for(var c in g.usedVariables)J.create(c);return a}
+function Td(a,g){return{ctype:"infix",args:[],impl:function(){Mb=[{oper:g}];var c=z(a);Mb=[];return c}}}function ka(a){wa.err(a+Mb.map(function(a){return"\n at "+a.oper}).join("\n"))}function ld(){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 md(){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 nd(a,g){var c=a.width,q=a.height,b=document.createElement("canvas");b.setAttribute("width",
+c);b.setAttribute("height",q);b.setAttribute("style","display:none;");var d=sa.canvas;d.parentNode.insertBefore(b,d.nextSibling);try{return b.getContext("2d").drawImage(a,0,0,c,q),b.toDataURL(g||"image/png")}finally{b.parentNode.removeChild(b)}}function de(a){a=a.replace(RegExp("[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/]+","g"),"");var g=new Uint8Array(3*a.length>>2),c,q,b,d,h,e;for(q=c=0;c+3<a.length;c+=4)b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c)),
+d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+1)),h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+2)),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+3)),g[q++]=b<<2|d>>4,g[q++]=d<<4|h>>2,g[q++]=h<<6|e;switch(a.length-c){case 0:break;case 2:b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+
+1));g[q++]=b<<2|d>>4;break;case 3:b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c));d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+1));h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(c+2));g[q++]=b<<2|d>>4;g[q++]=d<<4|h>>2;break;default:throw Error("Malformed Base64 input: "+(a.length-c)+" chars left: "+a.substr(c));}if(q!==g.length)throw Error("Failed assertion: "+q+" should be "+
+g.length);return g}function ee(a){function g(c){return(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3])>>>0}if(57>a.length)throw Error("Too short to be a PNG file");if(2303741511!==g(0)||218765834!==g(4))throw Error("PNG signature missing");for(var c=[],q=8;q<a.length;){if(q+12>a.length)throw Error("Incomplete chunk at offset 0x"+q.toString(16));var b=g(q);if(2147483648<=b)throw Error("Chunk too long");var d=q+12+b;if(d>a.length)throw Error("Incomplete chunk at offset 0x"+q.toString(16));var h=a.subarray(q+
+4,q+8),h=String.fromCharCode.apply(String,h);c.push({len:b,type:h,data:a.subarray(q+8,q+8+b),crc:g(q+8+b)});q=d}return c}function ac(a,g){var c;if(c=/^rgba\(([0-9.]+), *([0-9.]+), *([0-9.]+), *([0-9.]+)\)$/.exec(a))g(+c[1],+c[2],+c[3],+c[4]);else if(c=/^rgb\(([0-9.]+), *([0-9.]+), *([0-9.]+)\)$/.exec(a))g(+c[1],+c[2],+c[3],1);else throw Error("Can't handle color style "+a);}function fe(a){var g=1;Object.keys(bb).forEach(function(c){var q=bb[c].value.img;if(void 0===q.cachedDataURL&&q.src)if("data:"===
+q.src.substr(0,5))q.cachedDataURL=q.src;else{++g;q.cachedDataURL=null;var b=new XMLHttpRequest;b.responseType="blob";b.onreadystatechange=function(){if(b.readyState===XMLHttpRequest.DONE)if(200===b.status){var c=new FileReader;c.onloadend=function(){q.cachedDataURL=c.result;console.log("Cached data for image "+q.src);0===--g&&a()};c.readAsDataURL(b.response)}else console.error("Failed to load "+q.src+": "+b.statusText),0===--g&&a()};b.open("GET",q.src,!0);b.send()}});0===--g&&a()}function rb(a,g,
+c){for(c||(c="0");a.length<g;)a=c+a;return a}function od(){null!==Nb&&(window.URL.revokeObjectURL(Nb),Nb=null)}function pd(a){fe(function(){var g=A;try{A=new a;A.width=ca;A.height=da;n();var c=A.toBlob();Nb=window.URL.createObjectURL(c);qd(Nb)}finally{A=g}})}function Ob(a){var g=null,c=1E6,q;console.log("getElementAtMouse");for(var b=0;b<v.gslp.length;b++){var d=v.gslp[b];if(!d.pinned&&!1!==d.visible&&!0!==d.tmp){var e,f,k,l=y.drawingstate.matrix.sdet;if("P"===d.kind){var n=h.normalizeZ(d.homog);
+if(!h._helper.isAlmostReal(n))continue;e=n.value[0].value.real-a.x;f=n.value[1].value.real-a.y;k=Math.sqrt(e*e+f*f);d.narrow&k>20/l&&(k=1E4)}else if("C"===d.kind)f=v.csnames[d.args[0]],k=0,"undefined"!==typeof d.radius&&(k=d.radius.value.real),e=m.div(f.homog.value[0],f.homog.value[2]).value.real,f=m.div(f.homog.value[1],f.homog.value[2]).value.real,e-=a.x,f-=a.y,k=Math.sqrt(e*e+f*f)-k,f=e=0,0>k&&(k=-k),k+=30/l;else if("L"===d.kind||"S"===d.kind)e=d.homog,k=m,f=k.add(k.mult(e.value[0],k.conjugate(e.value[0])),
+k.mult(e.value[1],k.conjugate(e.value[1]))),f=h.scaldiv(k.sqrt(f),e),k=f.value[0].value.real*a.x+f.value[1].value.real*a.y+f.value[2].value.real,e=f.value[0].value.real*k,f=f.value[1].value.real*k,0>k&&(k=-k),k+=1;k<c+.2/l&&(c=k,g=d,q={x:e,y:f})}}return null===g?null:{mover:g,offset:q,prev:{x:a.x,y:a.y}}}function Xa(){return"P"+ge++}function wb(a){var g=G[xc].actions;g[xb].event===a&&g[xb]["do"]()&&(e(),xb===g.length-1?(Aa=[],xb=Ya=0):xb++)}function yc(a){return a&&.5>Math.abs(a.offset.x)&&.5>Math.abs(a.offset.y)&&
+!a.mover.tmp}function rd(a){return yc(a)&&"P"===a.mover.kind}function sd(a){return yc(a)&&("L"===a.mover.kind||"S"===a.mover.kind)}function zc(a){ja={mover:a,offset:{x:0,y:0},prev:{x:aa.x,y:aa.y}}}function sb(){var a=Ob(aa);rd(a)?Aa[Ya]=a.mover:(Aa[Ya]={type:"Free",name:Xa(),labeled:!0,pos:[ra[0],ra[1],1]},Ka(Aa[Ya]));Ya++}function td(){var a=Ob(aa);return sd(a)?(Aa[Ya]=a.mover,Ya++,!0):!1}function ud(){var a=Ob(aa),g;(g=sd(a))||(g=yc(a)&&"C"===a.mover.kind);return g?(Aa[Ya]=a.mover,Ya++,!0):!1}function yb(){var a=
+Ob(aa);if(rd(a))for(Pb.args[1]=a.mover.name,a=0;a<v.gslp.length;a++){var g=v.gslp[a];!0===g.tmp&&vd(g.name)}else for(a=0;a<v.gslp.length;a++)g=v.gslp[a],!0===g.tmp&&(g.tmp=!1)}function bc(a){var g={type:"Free",name:Xa(),labeled:!0,pos:[ra[0],ra[1],1],tmp:!0},g=Ka(g);Pb=Ka({type:a,name:Xa(),labeled:!0,args:[Aa[0].name,g.name]});zc(g)}function he(a){for(var g in a)null!==a[g]&&(ga[g]=a[g])}function Ud(a){Object.keys(l).forEach(function(a){var c=l[a];kb(c.signature||"_helper"===a,a+" has no signature");
+void 0!==c.updatePosition&&void 0===c.stateSize&&(c.stateSize=0)});v.gslp=[];v.csnames={};v.points=[];v.lines=[];v.conics=[];v.texts=[];v.free=[];v.polygons=[];v.ifs=[];a.forEach(wd);xd()}function yd(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 ie(a){void 0===a.size&&(a.size=ga.pointSize);a.size=m.real(a.size);!a.movable||
+a.pinned?(a.color=h.realVector(a.color||ga.pointColor),a.color=h.scalmult(m.real(ga.dimDependent),a.color)):a.color=h.realVector(a.color||ga.pointColor);void 0===a.alpha&&(a.alpha=ga.alpha);a.alpha=m.real(a.alpha);"boolean"!==typeof a.noborder&&(a.noborder=ga.noborder);a.noborder=w.bool(a.noborder);"boolean"!==typeof a.border&&(a.border=!ga.noborder);a.border=w.bool(a.border);a.drawtrace&&yd(a)}function cc(a){void 0===a.size&&(a.size=ga.lineSize);a.size=m.real(a.size);a.color=h.realVector(a.color||
+ga.lineColor);void 0===a.alpha&&(a.alpha=ga.alpha);a.alpha=m.real(a.alpha);a.clip=w.string(a.clip||ga.clip);void 0===a.overhang&&(a.overhang=ga.overhangLine);a.overhang=m.real(a.overhang);a.dashtype&&(a.dashtype=w.wrap(a.dashtype))}function je(a){void 0===a.overhang&&(a.overhang=ga.overhangSeg);a.arrow&&(a.arrow=w.bool(a.arrow));a.arrowsize&&(a.arrowsize=m.real(a.arrowsize));a.arrowposition&&(a.arrowposition=m.real(a.arrowposition));a.arrowshape&&(a.arrowshape=w.string(a.arrowshape));a.arrowsides&&
+(a.arrowsides=w.string(a.arrowsides));cc(a);a.clip=w.string("end")}function ke(a){a.size=void 0!==a.textsize?a.textsize:void 0!==a.size?a.size:ga.textsize;a.size=m.real(+a.size)}function le(a){a.filled=void 0!==a.filled?w.bool(a.filled):w.bool(!0);a.fillcolor=void 0===a.fillcolor?k:h.realVector(a.fillcolor);void 0===a.fillalpha&&(a.fillalpha=0);a.fillalpha=m.real(a.fillalpha);cc(a)}function Ka(a){a=wd(a);xd();return a}function wd(a){var g;if(void 0!==v.csnames[a.name])return console.log("Element name '"+
+a.name+"' already exists"),g=v.csnames[a.name],l[g.type].isMovable&&"P"===l[g.type].kind&&La(g,a.pos,"homog"),{ctype:"geo",value:g};for(;Ac.hasOwnProperty(a.type);)a.type=Ac[a.type];if(g=zd[a.type]){var c=g(a),q=null;for(g=0;g<c.length;++g)q=Ka(c[g]);return q}var b=l[a.type],c=!1;if(!b)return console.error(a),console.error("Operation "+a.type+" not implemented yet"),null;if("**"!==b.signature)if(!Array.isArray(b.signature)&&"*"===b.signature.charAt(1))c=!0,a.args.forEach(function(c){if(v.csnames[c].kind!==
+b.signature.charAt(0))return console.error("Not all elements in set are of same type: "+a.name+" expects "+b.signature+" but "+c+" is of kind "+v.csnames[c].kind),"undefined"!==typeof window&&window.alert("Not all elements in set are of same type: "+a.name),null});else if(b.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(g=
+0;g<a.args.length;++g){if(!v.csnames.hasOwnProperty(a.args[g]))return console.log("Dropping "+a.name+" due to missing argument "+a.args[g]),null;if("**"!==b.signature&&!c&&(q=v.csnames[a.args[g]].kind,b.signature[g]!==q&&("S"!==q||"L"!==b.signature[g])))return window.alert("Wrong argument kind "+q+" as argument "+g+" to element "+a.name+" of type "+a.type),null}b.signatureConstraints&&!b.signatureConstraints(a)&&window.alert("signature constraints violated for element "+a.name);v.gslp.push(a);v.csnames[a.name]=
+a;g=Da.length;a.kind=b.kind;a.stateIdx=g;g+=b.stateSize;a.incidences=[];a.isshowing=!0;a.movable=!1;b.isMovable&&(a.movable=!0,v.free.push(a));"P"===a.kind&&(v.points.push(a),ie(a));"L"===a.kind&&(v.lines.push(a),cc(a));"C"===a.kind&&(v.conics.push(a),cc(a));"S"===a.kind&&(v.lines.push(a),je(a));"Text"===a.kind&&(v.texts.push(a),ke(a));"Poly"===a.kind&&(v.polygons.push(a),le(a));"IFS"===a.kind&&v.ifs.push(a);me(g);qa=Oa=Da;lb=!0;b.initialize&&(Ba=Ea=a.stateIdx,a.param=b.initialize(a),kb(Ea===a.stateIdx+
+b.stateSize,"State fully initialized"));Ba=Ea=a.stateIdx;b.updatePosition(a,!1);kb(Ba===a.stateIdx+b.stateSize,"State fully consumed");kb(Ea===a.stateIdx+b.stateSize,"State fully updated");lb=!1;qa=ib["in"];qa.set(Da);Oa=ib.out;Bc(a,b);dc={};mb(a);return v.csnames[a.name]}function vd(a){var g,c;console.log("Remove element "+a);delete v.csnames[a];for(g=0;g<v.gslp.length;g++)c=v.gslp[g],c.name===a&&(console.log("Removed element from gslp "+a),v.gslp.splice(g,1));for(g=0;g<v.free.length;g++)c=v.free[g],
+c.name===a&&(console.log("Removed element from free "+a),v.free.splice(g,1));for(g=0;g<v.points.length;g++)c=v.points[g],c.name===a&&(console.log("Removed element from points "+a),v.points.splice(g,1));for(g=0;g<v.lines.length;g++)c=v.lines[g],c.name===a&&(console.log("Removed element from lines "+a),v.lines.splice(g,1));for(g=0;g<v.conics.length;g++)c=v.conics[g],c.name===a&&(console.log("Removed element from conics "+a),v.conics.splice(g,1));dc={}}function Ad(a,g){var c=v.csnames[g.args[0]].homog,
+q=v.csnames[g.args[1]].homog,b=a.homog,d=m.div(c.value[0],c.value[2]),c=m.div(c.value[1],c.value[2]),h=m.div(q.value[0],q.value[2]),q=m.div(q.value[1],q.value[2]),e=m.div(b.value[0],b.value[2]),b=m.div(b.value[1],b.value[2]);return m._helper.isAlmostReal(d)&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(h)&&m._helper.isAlmostReal(q)&&m._helper.isAlmostReal(e)&&m._helper.isAlmostReal(b)?(d=d.value.real,c=c.value.real,h=h.value.real,q=q.value.real,e=e.value.real,b=b.value.real,d=Math.sqrt((d-h)*
+(d-h)+(c-q)*(c-q))-Math.sqrt((d-e)*(d-e)+(c-b)*(c-b))-Math.sqrt((h-e)*(h-e)+(q-b)*(q-b)),1E-15>d*d):!1}function Bc(a,g){a.isshowing=!0;if(a.args)for(var c=0;c<a.args.length;c++)if(!v.csnames[a.args[c]].isshowing){a.isshowing=!1;return}g.visiblecheck&&g.visiblecheck(a)}function Xc(a,g,c,q,b){var d=a.textsize||ga.textsize,h=!0===a.textbold,e=!0===a.textitalics,f=a.text_fontfamily||ga.fontFamily,k=q.x*q.x+q.y*q.y,l=1;0<k&&(l=1+a.size.value.real/Math.sqrt(k));a=a.alpha||m.real(ga.alpha);D.drawtext([c,
+w.wrap(g)],{x_offset:w.wrap(l*q.x),y_offset:w.wrap(l*q.y),size:w.wrap(d),bold:w.wrap(h),italics:w.wrap(e),family:w.wrap(f),color:b,alpha:a})}function $d(a){a._bbox=null;if(a.isshowing&&!1!==a.visible){var g={size:a.size},c=a.homog,q=a.text,b=l[a.type].getText,q=b?b(a):q.replace(/@[$#]"([^"\\]|\\.)*"/g,function(a){var c,g;try{if(c=JSON.parse(a.substring(2)),g=v.csnames[c],!g)return"?"}catch(q){return"?"}switch(a.charAt(1)){case "$":return g.printname||c;case "#":return"V"!==g.kind?"?":Z(g.value)}}),
+b=null;if(a.html)var d=a._textCache||{text:!1},h=a.html,e=h.parentNode,f=e.parentNode,b=function(c,g,q,b,oa){d.invisible&&f.style.removeProperty("display");if(c!==d.text||g!==d.font||q!==d.x||b!==d.y||oa!==d.align){g!==d.font&&(h.style.font=g,h.style.lineHeight=ga.lineHeight);c!==d.text&&!1!==c&&!1===Bd(h,c,g)&&(c=!1);f.style.left=q+"px";f.style.top=b+"px";if(oa||e.style.transform)e.style.transform="translateX("+-100*oa+"%)";a._textCache={text:c,font:g,x:q,y:b,align:oa}}};q=w.string(q);a.dock&&(a.dock.to?
+c=v.csnames[a.dock.to].homog:Cd.hasOwnProperty(a.dock.corner)&&(c=t.screenbounds$0([],{}),c=c.value[Cd[a.dock.corner]]),g.offset=a.dock.offset);a.align&&(g.align=w.string(a.align));c&&(a._bbox=D.drawtext([c,q],g,b))}else a.html&&(a.html.parentNode.parentNode.style.display="none",a._textCache={invisible:!0})}function Zd(){function a(){var a=e++/c._traces.length,g=c._traces[h];g&&(a*=q*a*a,t.draw$1([g],{size:m.real(b),color:c.color,alpha:m.real(a)}));b*=d}for(var g=0;g<v.points.length;g++){var c=v.points[g];
+if(c.drawtrace){c._traces_tick===c.traceskip?(c._traces[c._traces_index]=c.homog,c._traces_index=(c._traces_index+1)%c._traces.length,c._traces_tick=0):c._traces_tick++;var q=c.alpha.value.real,b=c.size.value.real,d=1;1!==c.tracedim&&(b*=c.tracedim,d=Math.pow(c.tracedim,-1/c._traces.length));var h,e=0;for(h=c._traces_index;h<c._traces.length;++h)a();for(h=0;h<c._traces_index;++h)a()}}}function kb(a,g){var c="Assertion failed: "+g;if(!a)throw console.log(c),Ta(),"undefined"!==typeof alert&&alert(c),
+Error(c);}function me(a){if(a!==Da.length){var g,c,q=Cc.length;nb.length<a*q?(g=2*a,nb=new Float64Array(q*g)):g=nb.length/q|0;for(c=0;c<q;++c)ib[Cc[c]]=nb.subarray(c*g,c*g+a);a=Da;qa=ib["in"];Oa=ib.out;Da=ib.good;Da.set(a)}}function zb(){Da.set(qa);Ma=!1;Dd(!1);for(var a=Da.length,g=Math.abs,c=0;c<a;c+=2)g(Da[c])>1E12*g(Da[c+1])&&(Da[c+1]=0)}function ec(){if(Ab)Ma=!0;else throw Ed;}function Fd(a,g,c,q,b){return w.add(q,w.mult(c,w.sub(b,q)))}function Yd(){L&&(L.currentMouseAndScripts=[]);Dc=!0;if(ja){var a=
+ja.mover,g=h.realVector([aa.x+ja.offset.x,aa.y+ja.offset.y,1]);Gd(a,g,"mouse");ja.prev.x=aa.x;ja.prev.y=aa.y}z(R.move);z(R.draw);Ma||zb();Dc=!1;L&&(L.fullLog.push(h.turnIntoCSList([h.turnIntoCSList(L.currentMouseAndScripts)])),L.length>L.logLength&&L.splice(0,L.length-L.logLength),L.currentMouseAndScripts=null,L.postMouseHooks.forEach(function(a){a()}))}function La(a,g,c){Gd(a,g,c);Dc||Ma||zb()}function Gd(a,g,c){L&&L.currentMouseAndScripts&&(L.currentMover=[]);a===Hd?(qa.set(Da),Ma=!1):(Hd=a,zb());
+Oa.set(qa);var q=1E4,b;b=dc[a.name];if(!b){var d={},e=0;b=[];d[a.name]=a;for(var f=v.gslp,k=0;k<f.length;++k){var n=f[k],Wa=n.args;if(Wa)for(var p=0;p<Wa.length;++p)d.hasOwnProperty(Wa[p])&&(d[n.name]=n,b[e++]=n)}dc[a.name]=b}var d=-1,e=.9,r,t,u,f=l[a.type],k=f.parameterPath||Fd;Ba=a.stateIdx;n=f.getParamFromState(a);Ba=Ea=a.stateIdx;Wa=f.getParamForInput(a,g,c);for(p=d+e;d!==p;){var x=p*p,y=.5/(1+x),y=m.complex(2*p*y+.5,(1-x)*y);Ab=d+.5*e<=d||0===q;0===q&&console.log("tracing limit Reached");x=!1;
+L&&L.currentMouseAndScripts&&(L.currentStep=[]);try{Ba=Ea=a.stateIdx;var A=k(a,p,y,n,Wa);L&&(L.currentParam=A);y=Oa;Oa=qa;f.putParamToState(a,A);Oa=y;Ea=a.stateIdx;L&&(L.currentElement=a);f.updatePosition(a,!0);kb(Ba===a.stateIdx+f.stateSize,"State fully consumed");kb(Ea===a.stateIdx+f.stateSize,"State fully updated");for(r=0;r<b.length;++r)t=b[r],u=l[t.type],Ba=Ea=t.stateIdx,L&&(L.currentElement=t),u.updatePosition(t,!1),kb(Ba===t.stateIdx+u.stateSize,"State fully consumed"),kb(Ea===t.stateIdx+u.stateSize,
+"State fully updated");L&&(L.currentElement=null);d=p;e*=1.25;p+=e;1<=p&&(p=1);Oa=qa;qa=y}catch(z){if(z!==Ed)throw z;e*=.5;p=d+e;--q;x=!0}L&&L.currentMouseAndScripts&&(L.currentMover.push(h.turnIntoCSList([h.turnIntoCSList(L.currentStep),w.wrap(x),w.wrap(d),w.wrap(p),w.wrap(L.currentParam)])),L.currentStep=null,L.currentParam=null)}Dd(Ma);for(r=0;r<b.length;++r)t=b[r],u=l[t.type],Bc(t,u);L&&L.currentMouseAndScripts&&(L.currentMouseAndScripts.push(h.turnIntoCSList([h.turnIntoCSList(L.currentMover),
+w.wrap(Ma),w.wrap(a.name),g,w.wrap(c),n,Wa])),L.currentMover=null)}function Vd(){zb();Ab=!0;for(var a=v.gslp,g=0;g<a.length;g++){var c=a[g],q=l[c.type];Ba=Ea=c.stateIdx;q.updatePosition(c,!1);Bc(c,q)}a=Oa;Oa=qa;qa=a;zb()}function Dd(a){var g=p.tracingStateReport;"string"===typeof g&&(document.getElementById(g).textContent=a?"BAD":"GOOD")}function ne(){return h.turnIntoCSList(L.fullLog.slice())}function oe(a){var g=JSON.stringify(L.fullLog);a=new Blob([g],{type:a?"application/octet-stream":"application/json"});
+return window.URL.createObjectURL(a)}function Bb(){var a=Ba;Ba+=2;return m.complex(qa[a],qa[a+1])}function X(a){for(var g=Array(a),c=0;c<a;++c)g[c]=Bb();return h.turnIntoCSList(g)}function Za(a){Oa[Ea]=a.value.real;Oa[Ea+1]=a.value.imag;Ea+=2}function T(a){for(var g=0,c=a.value.length;g<c;++g)Za(a.value[g])}function Pa(a,g){var c=X(3),q=X(3),c=Ec(a,g,c,q);T(c[0]);T(c[1]);return h.turnIntoCSList(c)}function Ec(a,g,c,q){if(lb)return[a,g];var b=h.projectiveDistMinScal(c,a),d=h.projectiveDistMinScal(c,
+g),e=h.projectiveDistMinScal(q,a),f=h.projectiveDistMinScal(q,g),m=h.projectiveDistMinScal(c,q),l=h.projectiveDistMinScal(a,g),n=b+f,p=d+e,r;n>p?(r=[g,a],n=p):r=[a,g];p=function(){};if(L&&L.currentStep){var t=[L.labelTracing2,w.wrap(L.currentElement.name),h.turnIntoCSList(r),h.turnIntoCSList([c,q]),h.realMatrix([[b,d],[e,f]]),w.wrap(n),w.wrap(m),w.wrap(l),k];L.currentStep.push(h.turnIntoCSList(t));p=function(a){L.hasOwnProperty(a)||(L[a]=w.wrap(a));t[t.length-1]=L[a]}}h._helper.isNaN(a)||h._helper.isNaN(g)?
+(p("Tracing failed due to NaNs."),Ma=!0):m>3*n&&l>3*n?p("Normal case, everything all right."):1E-5>l?1E-5>m?p("Staying inside singularity."):(p("Moved into singularity."),Ma=!0):1E-5>m?p("Moved out of singularity."):(Ab?p("Reached refinement limit, giving up."):p("Need to refine."),ec());return r}function Fc(a,g,c,q){var b=X(3),d=X(3),e=X(3),f=X(3);a=pe(a,g,c,q,b,d,e,f);T(a[0]);T(a[1]);T(a[2]);T(a[3]);return h.turnIntoCSList(a)}function pe(a,g,c,q,b,d,e,f){var m=function(){};b=[b,d,e,f];a=[a,g,c,
+q];if(lb)return a;d=0;q=Array(4);for(c=0;4>c;c++)for(q[c]=Array(4),f=0;4>f;f++)e=h.projectiveDistMinScal(b[c],a[f]),q[c][f]=e;e=uc(q);g=Array(4);for(c=0;4>c;++c)g[c]=a[e[c]],d+=q[c][e[c]];var l=1*d,n=Infinity,p=Infinity;for(c=0;4>c;c++){if(h._helper.isNaN(a[c]))return m("Tracing failed due to NaNs."),Ma=!0,g;for(f=c+1;4>f;f++)e=h.projectiveDistMinScal(b[c],b[f]),n>e&&(n=e),e=h.projectiveDistMinScal(g[c],g[f]),p>e&&(p=e)}if(L&&L.currentStep){var r=[L.labelTracing4,w.wrap(L.currentElement.name),h.turnIntoCSList(g),
+h.turnIntoCSList(b),h.realMatrix(q),w.wrap(d),w.wrap(n),w.wrap(p),k];L.currentStep.push(h.turnIntoCSList(r));m=function(a){L.hasOwnProperty(a)||(L[a]=w.wrap(a));r[r.length-1]=L[a]}}n>l&&p>l||(1E-5>p?1E-5>n?m("Staying inside singularity."):(m("Moved into singularity."),Ma=!0):1E-5>n?m("Moved out of singularity."):(Ab?m("Reached refinement limit, giving up."):m("Need to refine."),ec()));return g}function Id(a){var g=a.length,c,q;if(lb){for(c=0;c<g;++c)Ba+=2*a[c].value.length,T(a[c]);return a}var b=
+Array(g),d=Array(g),e=Array(g),f=99,m=99,l=Array(g);for(c=0;c<g;++c)b[c]=X(a[c].value.length),d[c]=h.normSquared(b[c]).value.real,e[c]=h.normSquared(a[c]).value.real,l[c]=Array(g);var n;for(c=0;c<g;++c){for(q=0;q<g;++q)n=h.sesquilinearproduct(b[c],a[q]).value,n=(n.real*n.real+n.imag*n.imag)/(d[c]*e[q]),l[c][q]=1-n;for(q=c+1;q<g;++q)n=h.sesquilinearproduct(b[c],b[q]).value,n=(n.real*n.real+n.imag*n.imag)/(d[c]*d[q]),f>1-n&&(f=1-n),n=h.sesquilinearproduct(a[c],a[q]).value,n=(n.real*n.real+n.imag*n.imag)/
+(e[c]*e[q]),m>1-n&&(m=1-n)}n=uc(l);q=Array(g);d=0;e=!1;for(c=0;c<g;++c){var d=d+l[c][n[c]],p=q[c]=a[n[c]];T(p);e|=h._helper.isNaN(p)}e|=isNaN(d);a=function(){};if(L&&L.currentStep){var r=[L.labelTracingSesq,w.wrap(L.currentElement.name),h.turnIntoCSList(q),h.turnIntoCSList(b),h.realMatrix(l),w.wrap(d),w.wrap(f),w.wrap(m),k];L.currentStep.push(h.turnIntoCSList(r));a=function(a){L.hasOwnProperty(a)||(L[a]=w.wrap(a));r[r.length-1]=L[a]}}e?(a("Tracing failed due to NaNs."),Ma=!0):f>3*d&&m>3*d?a("Normal case, everything all right."):
+1E-5>m?1E-5>f?a("Staying inside singularity."):(a("Moved into singularity."),Ma=!0):1E-5>f?a("Moved out of singularity."):(Ab?a("Reached refinement limit, giving up."):a("Need to refine."),ec());return q}function Qb(a,g){var c=l._helper.flattenConicMatrix(a),q=l._helper.flattenConicMatrix(g),b=X(6),d=X(6),q=Ec(c,q,b,d);T(q[0]);T(q[1]);c=l._helper.buildConicMatrix(q[0].value);q=l._helper.buildConicMatrix(q[1].value);return h.turnIntoCSList([c,q])}function mb(a){if(mb.hasOwnProperty(a.kind))mb[a.kind](a)}
+function Jd(a,g){return function(){a.incidences.push(g.name);g.incidences.push(a.name)}}function Kd(a,g){return{toString:function(){return"point "+a.name+" incident line "+g.name},apply:Jd(a,g),holds:function(){var c=h.scaldiv(h.abs(a.homog),a.homog),q=h.scaldiv(h.abs(g.homog),g.homog);return 1E-13>m.abs(h.scalproduct(c,q)).value.real}}}function Ld(a,g){return{toString:function(){return"point "+a.name+" incident conic "+g.name},apply:Jd(a,g),holds:function(){var c=w.mult(g.matrix,a.homog),c=w.mult(a.homog,
+c),c=m.abs(c);1E-13>c.value.real&&(a.incidences.push(g.name),g.incidences.push(a.name))}}}function xd(){if(0!==ob.length){for(var a=0;a<ob.length;++a)ob[a].apply();ob=[]}}function Gc(a,g,c){var q=document.createElement("div"),b=document.createElement("img");b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAPoCAQAAAC1v1zVAAAAGklEQVR42u3BMQEAAADCoPVPbQ0PoAAAgHcDC7gAAVI8ZnwAAAAASUVORK5CYII=";q.className="CindyJS-baseline";q.appendChild(b);b=document.createElement("div");b.className="CindyJS-button";
+q.appendChild(b);for(var d=2;d<arguments.length;++d)b.appendChild(arguments[d]);na.parentNode.appendChild(q);a.html=arguments[arguments.length-1];Ia(a.fillalpha)||(a.fillalpha=1);a.fillcolor&&(a.html.style.backgroundColor=x.makeColor(a.fillcolor,a.fillalpha));q=e;if(a.script)var h=Ua(a.script),q=function(){z(h);e()};c.addEventListener(g,q);!p.keylistener&&(R.keydown||R.keyup||R.keytyped)&&(c.addEventListener("keydown",function(a){9!==a.keyCode&&I(a,R.keydown)}),c.addEventListener("keyup",function(a){I(a,
+R.keyup)}),c.addEventListener("keypress",function(a){9!==a.keyCode&&I(a,R.keytyped)}));l.Text.initialize(a)}function Sa(){}function qe(a){if(!/^Select/.test(a.type)&&!l[a.type].isMovable)return null;var g=w.unwrap,c=m.add;switch(a.kind){case "P":case "L":case "Text":return g(a.homog);case "C":return a=a.matrix.value,{xx:g(a[0].value[0]),yy:g(a[1].value[1]),zz:g(a[2].value[2]),xy:g(c(a[0].value[1],a[1].value[0])),xz:g(c(a[0].value[2],a[2].value[0])),yz:g(c(a[1].value[2],a[2].value[1]))};default:return null}}
+function re(a){var g={};g.offset=w.unwrap(a.offset);a.to&&(g.to=a.to);a.corner&&(g.corner=a.corner);return g}function se(a){var g={};te.forEach(function(c){if(a.hasOwnProperty(c)){var b=w.unwrap(a[c]);null!==b&&void 0!==b&&(g[c]=b)}});if("P"===a.kind&&(!a.movable||a.pinned)&&g.color){var c=m.real(1/ga.dimDependent);g.color=w.unwrap(h.scalmult(c,a.color))}if(c=qe(a))g.pos=c;a.dock&&(g.dock=re(a.dock));return g}function ue(){var a=[];v.gslp.forEach(function(g){g.tmp||a.push(se(g))});return a}function Wd(){Fa.forEach(function(a){var g=
+(a.geo||[]).map(function(a){return v.csnames[a]});O[a.type].reset(a,g[0],g)})}function nc(a){qc=0!==a.length;Fa=[];ma=[];Hc=[];O.Environment.init({});a.forEach(function(a){a.behavior?(a.name&&(a.behavior.geo=[a.name]),a=a.behavior,a.gravity&&(a.gravity=-a.gravity)):c=a.geo;var c=(a.geo||[]).map(function(a){return v.csnames[a]}),q=c[0],b=O[a.type];b?(b.init&&b.init(a,q,c),q&&(q.behavior=a,"Mass"===a.type?ma.push(q):"Spring"===a.type&&Hc.push(q)),Fa.push(a)):(console.error(a),console.error("Behavior "+
+a.type+" not implemented yet"))})}var va=this,wa,R={},cb=!1,Xb=!0,Ib=0,Vc=.5,pc=0,Vb=10,Md=5/360,Xd=.32/Md/1E3*2,Tb=1,za=0,lc=0,Eb=!1,Fb=!1,na,Db,Ia=Number.isFinite||function(a){return"number"===typeof a&&isFinite(a)},ra,A,ca,da,v,bb,rc=k,sc=k,Va={play:Sa,pause:Sa,stop:Sa},oc=null,Gb=function(a,g){var c=[];Gb=function(a,g){c.push({img:a,id:g})};Gb(a,g);var q=va.getBaseDir()+"images/Icons.svg",b=new XMLHttpRequest;b.onreadystatechange=function(){if(b.readyState===XMLHttpRequest.DONE)if(200!==b.status)console.error("Failed to load CindyJS Icons.svg from "+
+q+": "+b.statusText);else{var a=b.responseXML,g=a.documentElement,d={},h,e;for(h=g.firstChild;h;h=e)e=h.nextSibling,h.nodeType===Node.ELEMENT_NODE&&"http://www.w3.org/2000/svg"===h.namespaceURI&&"g"===h.localName.toLowerCase()&&(g.removeChild(h),h.setAttribute("style","display:inline"),d[h.getAttribute("id")]=h);var f=new XMLSerializer;Gb=function(c,q){if(d.hasOwnProperty(q)){var b=d[q];g.appendChild(b);var h;try{h=f.serializeToString(a)}finally{g.removeChild(b)}c.src="data:image/svg+xml;charset=utf-8,"+
+encodeURIComponent(h)}};c.forEach(function(a){Gb(a.img,a.id)});c=null}};b.responseType="document";b.open("GET",q);b.send()},Wc=1,Hb=null,jb=[],Yb=!1,sa={config:p,startup:S,shutdown:Ta,evokeCS:function(a){a=Ua(a,!1);z(a);e()},play:M,pause:Ga,stop:Ha,evalcs:function(a){return z(Ua(a,!1))},parse:function(a){return Ua(a)},niceprint:Z,canvas:null},kc=!1,Ub=0;p.use&&p.use.forEach(function(a){var g=null;p.plugins&&(g=p.plugins[a]);g||(g=va._pluginRegistry[a]);g||(++Ub,console.log("Loading script for plugin "+
+a),va.loadScript(a+"-plugin",a+"-plugin.js",function(){console.log("Successfully loaded plugin "+a);0===--Ub&&kc&&S()},function(){console.error("Failed to auto-load plugin "+a);0===--Ub&&kc&&S()}))});Cb.prototype=new fb;gb.prototype=new fb;ua.prototype=new fb;var aa={},ja,Yc="",Zc=0,Zb;Zb=p.isNode?process.nextTick:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,
+0)};var tc=null,ve=[0,8,7,0,"g8c01b8d"],m={_helper:{}};m._helper.roundingfactor=1E4;m._helper.angleroundingfactor=10;m._helper.niceround=function(a,g){return Math.round(a*g)/g};m.niceprint=function(a,g){g=g||m._helper.roundingfactor;if("Angle"===a.usage)return m._helper.niceangle(a);var c=m._helper.niceround(a.value.real,g),q=m._helper.niceround(a.value.imag,g);return 0===q?""+c:0<q?""+c+" + i*"+q:""+c+" - i*"+-q};var Ic=p.angleUnit||"\u00b0",we=Ic.replace(/\s+/g,""),Nd=2*Math.PI,xe=1/Nd,ye={rad:Nd,
+"\u00b0":360,deg:360,degree:360,gra:400,grad:400,turn:1,cyc:1,rev:1,rot:1,"\u03c0":2,pi:2,quad:4};m._helper.niceangle=function(a){var g=ye[we];if(!g)return m.niceprint(w.withUsage(a,null));if("function"===typeof g)return g(a);a=m.niceprint(m.realmult(g*xe,a),200<g?m._helper.angleroundingfactor:null);return-1===a.indexOf("i*")?a+Ic:"("+a+")"+Ic};m.complex=function(a,g){return{ctype:"number",value:{real:a,imag:g}}};m.real=function(a){return{ctype:"number",value:{real:a,imag:0}}};m.zero=m.real(0);m.one=
+m.real(1);m.infinity=m.complex(Infinity,Infinity);m.nan=m.complex(NaN,NaN);m._helper.input=function(a){return"object"===typeof a?m.complex(+a.r,+a.i):m.real(+a)};m.argmax=function(a,g){return a.value.real*a.value.real+a.value.imag*a.value.imag<g.value.real*g.value.real+g.value.imag*g.value.imag?g:a};m.max=function(a,g){return{ctype:"number",value:{real:Math.max(a.value.real,g.value.real),imag:Math.max(a.value.imag,g.value.imag)}}};m.min=function(a,g){return{ctype:"number",value:{real:Math.min(a.value.real,
+g.value.real),imag:Math.min(a.value.imag,g.value.imag)}}};m.add=function(a,g){return{ctype:"number",value:{real:a.value.real+g.value.real,imag:a.value.imag+g.value.imag}}};m.sub=function(a,g){return{ctype:"number",value:{real:a.value.real-g.value.real,imag:a.value.imag-g.value.imag}}};m.neg=function(a){return{ctype:"number",value:{real:-a.value.real,imag:-a.value.imag}}};m.re=function(a){return{ctype:"number",value:{real:a.value.real,imag:0}}};m.im=function(a){return{ctype:"number",value:{real:a.value.imag,
+imag:0}}};m.conjugate=function(a){return{ctype:"number",value:{real:a.value.real,imag:-a.value.imag}}};m.round=function(a){return{ctype:"number",value:{real:Math.round(a.value.real),imag:Math.round(a.value.imag)}}};m.ceil=function(a){return{ctype:"number",value:{real:Math.ceil(a.value.real),imag:Math.ceil(a.value.imag)}}};m.floor=function(a){return{ctype:"number",value:{real:Math.floor(a.value.real),imag:Math.floor(a.value.imag)}}};m.mult=function(a,g){return{ctype:"number",value:{real:a.value.real*
+g.value.real-a.value.imag*g.value.imag,imag:a.value.real*g.value.imag+a.value.imag*g.value.real}}};m.realmult=function(a,g){return{ctype:"number",value:{real:a*g.value.real,imag:a*g.value.imag}}};m.multiMult=function(a){var g=a[0];if("number"!==g.ctype)return k;for(var c=1;c<a.length;c++){if("number"!==a[c].ctype)return k;g=m.mult(g,a[c])}return g};m.abs2=function(a){return{ctype:"number",value:{real:a.value.real*a.value.real+a.value.imag*a.value.imag,imag:0}}};m.abs=function(a){return m.sqrt(m.abs2(a))};
+m.inv=function(a){var g=a.value.real*a.value.real+a.value.imag*a.value.imag;return{ctype:"number",value:{real:a.value.real/g,imag:-a.value.imag/g}}};m.div=function(a,g){var c=a.value.real,q=a.value.imag,b=g.value.real,d=g.value.imag,h=b*b+d*d;return{ctype:"number",value:{real:(c*b+q*d)/h,imag:(q*b-c*d)/h}}};m.eps=1E-10;m.epsbig=1E-6;m.snap=function(a){var g=a.value.real;a=a.value.imag;Math.floor(g+m.eps)!==Math.floor(g-m.eps)&&(g=Math.round(g));Math.floor(a+m.eps)!==Math.floor(a-m.eps)&&(a=Math.round(a));
+return{ctype:"number",value:{real:g,imag:a}}};m.exp=function(a){var g=Math.exp(a.value.real);return{ctype:"number",value:{real:g*Math.cos(a.value.imag),imag:g*Math.sin(a.value.imag)}}};m.cos=function(a){var g=a.value.real;a=a.value.imag;var c=Math.exp(a),q=c*Math.sin(-g),b=c*Math.cos(-g),c=Math.exp(-a);return{ctype:"number",value:{real:(b+c*Math.cos(g))/2,imag:(q+c*Math.sin(g))/2}}};m.sin=function(a){var g=a.value.real;a=a.value.imag;var c=Math.exp(a),q=c*Math.sin(-g),b=c*Math.cos(-g),c=Math.exp(-a);
+return{ctype:"number",value:{real:-(q-c*Math.sin(g))/2,imag:(b-c*Math.cos(g))/2}}};m.tan=function(a){var g=m.sin(a);a=m.cos(a);return m.div(g,a)};m.arccos=function(a){var g=m.mult(a,m.neg(a)),g=m.sqrt(m.add(m.real(1),g));a=m.add(m.mult(a,m.complex(0,1)),g);a=m.add(m.mult(m.log(a),m.complex(0,1)),m.real(.5*Math.PI));return w.withUsage(a,"Angle")};m.arcsin=function(a){var g=m.mult(a,m.neg(a)),g=m.sqrt(m.add(m.real(1),g));a=m.add(m.mult(a,m.complex(0,1)),g);a=m.mult(m.log(a),m.complex(0,-1));return w.withUsage(a,
+"Angle")};m.arctan=function(a){var g=m.log(m.add(m.mult(a,m.complex(0,-1)),m.real(1)));a=m.log(m.add(m.mult(a,m.complex(0,1)),m.real(1)));g=m.mult(m.sub(g,a),m.complex(0,.5));return w.withUsage(g,"Angle")};m.arctan2=function(a,g){var c;if(void 0===g)c=m.real(Math.atan2(a.value.imag,a.value.real));else if(m._helper.isReal(a)&&m._helper.isReal(g))c=m.real(Math.atan2(g.value.real,a.value.real));else{c=m.add(a,m.mult(m.complex(0,1),g));var q=m.sqrt(m.add(m.mult(a,a),m.mult(g,g)));c=m.mult(m.complex(0,
+-1),m.log(m.div(c,q)))}return w.withUsage(c,"Angle")};m.sqrt=function(a){var g=a.value.real,c=a.value.imag;a=Math.sqrt(Math.sqrt(g*g+c*c));g=Math.atan2(c,g);return{ctype:"number",value:{real:a*Math.cos(g/2),imag:a*Math.sin(g/2)}}};m.powRealExponent=function(a,g){var c=a.value.real,q=a.value.imag,b=Math.pow(Math.sqrt(c*c+q*q),g),c=Math.atan2(q,c);return{ctype:"number",value:{real:b*Math.cos(c*g),imag:b*Math.sin(c*g)}}};m.log=function(a){var g=a.value.real;a=a.value.imag;var c=Math.sqrt(g*g+a*a),q=
+Math.atan2(a,g);0>a&&(q+=2*Math.PI);0===a&&0>g&&(q=Math.PI);q>Math.PI&&(q-=2*Math.PI);return m.snap({ctype:"number",value:{real:Math.log(c),imag:q}})};m.pow=function(a,g){return m._helper.isZero(g)?m.one:m._helper.isZero(a)?m.zero:m._helper.isReal(g)?m.powRealExponent(a,g.value.real):m.exp(m.mult(m.log(a),g))};m.mod=function(a,g){var c=a.value.real,q=g.value.real,b=a.value.imag,d=g.value.imag,c=c-Math.floor(c/q)*q,b=b-Math.floor(b/d)*d;0===q&&(c=0);0===d&&(b=0);return m.snap({ctype:"number",value:{real:c,
+imag:b}})};m._helper.seed="NO";m._helper.seedrandom=function(a){a-=Math.floor(a);m._helper.seed=.8*a+.1};m._helper.rand=function(){if("NO"===m._helper.seed)return Math.random();var a=m._helper.seed,a=1E3*Math.sin(1E3*a),a=a-Math.floor(a);return m._helper.seed=a};m._helper.randnormal=function(){var a=m._helper.rand(),g=m._helper.rand();return Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*g)};m._helper.isEqual=function(a,g){return a.value.real===g.value.real&&a.value.imag===g.value.imag};m._helper.isLessThan=
+function(a,g){return a.value.real<g.value.real||a.value.real===g.value.real&&a.value.imag<g.value.imag};m._helper.compare=function(a,g){return m._helper.isLessThan(a,g)?-1:m._helper.isEqual(a,g)?0:1};m._helper.isAlmostEqual=function(a,g,c){var q=m.eps;"undefined"!==typeof c&&(q=c);c=a.value.real-g.value.real;a=a.value.imag-g.value.imag;return c<q&&c>-q&&a<q&&a>-q};m._helper.isZero=function(a){return 0===a.value.real&&0===a.value.imag};m._helper.isAlmostZero=function(a){var g=a.value.real;a=a.value.imag;
+return g<m.eps&&g>-m.eps&&a<m.eps&&a>-m.eps};m._helper.isReal=function(a){return 0===a.value.imag};m._helper.isAlmostReal=function(a){a=a.value.imag;return a<m.epsbig&&a>-m.epsbig};m._helper.isNaN=function(a){return isNaN(a.value.real)||isNaN(a.value.imag)};m._helper.isFinite=function(a){return isFinite(a.value.real)&&isFinite(a.value.imag)};m._helper.isAlmostImag=function(a){a=a.value.real;return a<m.epsbig&&a>-m.epsbig};m._helper.z3a=m.complex(-.5,.5*Math.sqrt(3));m._helper.z3b=m.complex(-.5,-.5*
+Math.sqrt(3));m._helper.cub1={ctype:"list",value:[m.one,m.one,m.one]};m._helper.cub2={ctype:"list",value:[m._helper.z3a,m.one,m._helper.z3b]};m._helper.cub3={ctype:"list",value:[m._helper.z3b,m.one,m._helper.z3a]};m.solveCubic=function(a,g,c,q){a=m._helper.solveCubicHelper(a,g,c,q);return[h.scalproduct(m._helper.cub1,a),h.scalproduct(m._helper.cub2,a),h.scalproduct(m._helper.cub3,a)]};m._helper.solveCubicHelper=function(a,g,c,q){var b=a.value.real;a=a.value.imag;var d=g.value.real;g=g.value.imag;
+var e=c.value.real,f=c.value.imag,k=q.value.real,l=q.value.imag,n=b*e-a*f;c=b*f+a*e;q=4*n-(d*d-g*g);var p=4*c-2*d*g,r=b*d-a*g,t=b*g+a*d,v=q*e-p*f-18*(r*k-t*l),p=q*f+p*e-18*(r*l+t*k);q=27*(b*b-a*a);var u=54*a*b,w=q*k-u*l,x=q*l+u*k,y=d*d-g*g,A=2*d*g,z=y*d-A*g,B=y*g+A*d,C=w+4*z,u=x+4*B;q=27*(v*e-p*f+C*k-u*l);p=27*(v*f+p*e+C*l+u*k);C=Math.sqrt(Math.sqrt(q*q+p*p));u=Math.atan2(p,q);p=C*Math.sin(u/2);q=C*Math.cos(u/2);z=-2*z+9*(r*e-t*f)-w+(q*b-p*a);B=-2*B+9*(r*f+t*e)-x+(q*a+p*b);q=Math.exp(Math.log(Math.sqrt(z*
+z+B*B))/3);e=Math.atan2(B,z);u=q*Math.sin(e/3);p=q*Math.cos(e/3);q*=q;e*=2;n=2*y-6*n;c=2*A-6*c;A=-1.5874010519681996*(d*p-g*u);d=-1.5874010519681996*(d*u+g*p);g=1.2599210498948732*q*Math.cos(e/3);e=1.2599210498948732*q*Math.sin(e/3);q=4.762203155904599*(p*b-u*a);p=4.762203155904599*(p*a+u*b);b=q*q+p*p;u=(-n*p+c*q)/b;n=(n*q+c*p)/b;c=u;u=(-A*p+d*q)/b;A=(A*q+d*p)/b;d=u;u=(-g*p+e*q)/b;g=(g*q+e*p)/b;e=u;return h.turnIntoCSList([m.complex(n,c),m.complex(A,d),m.complex(g,e)])};var h={_helper:{},turnIntoCSList:function(a){return{ctype:"list",
+value:a}}};h.EMPTY=h.turnIntoCSList([]);h.asList=function(a){return"list"===a.ctype?a:"number"===a.ctype||"boolean"===a.ctype||"geo"===a.ctype?h.turnIntoCSList([a]):h.EMPTY};h.realVector=function(a){for(var g=[],c=0;c<a.length;c++)g[c]={ctype:"number",value:{real:a[c],imag:0}};return{ctype:"list",value:g}};h._helper.unitvector=function(a,g){var c=h.zerovector(a);c.value[Math.floor(g.value.real-1)]=m.real(1);return c};h.idMatrix=function(a){for(var g=h.zeromatrix(a,a),c=m.real(1),q=0;q<a.value.real;q++)g.value[q].value[q]=
+c;return g};h._helper.flippedidMatrix=function(a){for(var g=h.zeromatrix(a,a),c=m.real(1),q=0;q<a.value.real;q++)g.value[q].value[a.value.real-q-1]=c;return g};h.println=function(a){for(var g=[],c=0;c<a.value.length;c++)if("number"===a.value[c].ctype)g[c]=m.niceprint(a.value[c]);else if("list"===a.value[c].ctype)h.println(a.value[c]);else return k;"number"===a.value[0].ctype&&console.log(g)};h.matrix=function(a){return h.turnIntoCSList(a.map(h.turnIntoCSList))};h.realMatrix=function(a){for(var g=
+a.length,c=Array(g),q=0;q<g;q++)c[q]=h.realVector(a[q]);return h.turnIntoCSList(c)};h.ex=h.realVector([1,0,0]);h.ey=h.realVector([0,1,0]);h.ez=h.realVector([0,0,1]);h.linfty=h.realVector([0,0,1]);h.ii=h.turnIntoCSList([m.complex(1,0),m.complex(0,1),m.complex(0,0)]);h.jj=h.turnIntoCSList([m.complex(1,0),m.complex(0,-1),m.complex(0,0)]);h.fundDual=h.realMatrix([[1,0,0],[0,1,0],[0,0,0]]);h.fund=h.realMatrix([[0,0,0],[0,0,0],[0,0,1]]);h.sequence=function(a,g){for(var c=[],q=0,b=Math.round(a.value.real);b<
+Math.round(g.value.real)+1;b++)c[q]={ctype:"number",value:{real:b,imag:0}},q++;return{ctype:"list",value:c}};h.pairs=function(a){for(var g=[],c=0;c<a.value.length-1;c++)for(var q=c+1;q<a.value.length;q++)g.push({ctype:"list",value:[a.value[c],a.value[q]]});return{ctype:"list",value:g}};h.triples=function(a){for(var g=[],c=0;c<a.value.length-2;c++)for(var q=c+1;q<a.value.length-1;q++)for(var b=q+1;b<a.value.length;b++)g.push({ctype:"list",value:[a.value[c],a.value[q],a.value[b]]});return{ctype:"list",
+value:g}};h.cycle=function(a){for(var g=[],c=0;c<a.value.length-1;c++)g[c]={ctype:"list",value:[a.value[c],a.value[c+1]]};g.push({ctype:"list",value:[a.value[a.value.length-1],a.value[0]]});return{ctype:"list",value:g}};h.consecutive=function(a){for(var g=[],c=0;c<a.value.length-1;c++)g[c]={ctype:"list",value:[a.value[c],a.value[c+1]]};return{ctype:"list",value:g}};h.reverse=function(a){for(var g=Array(a.value.length),c=a.value.length-1,q=0;0<=c;c--,q++)g[q]=a.value[c];return{ctype:"list",value:g}};
+h.directproduct=function(a,g){for(var c=[],q=0;q<a.value.length;q++)for(var b=0;b<g.value.length;b++)c.push({ctype:"list",value:[a.value[q],g.value[b]]});return{ctype:"list",value:c}};h.concat=function(a,g){for(var c=[],q=0;q<a.value.length;q++)c.push(a.value[q]);for(q=0;q<g.value.length;q++)c.push(g.value[q]);return{ctype:"list",value:c}};h.prepend=function(a,g){var c=[];c[0]=a;for(var q=0;q<g.value.length;q++)c[q+1]=g.value[q];return{ctype:"list",value:c}};h.append=function(a,g){for(var c=[],q=
+0;q<a.value.length;q++)c[q]=a.value[q];c.push(g);return{ctype:"list",value:c}};h.contains=function(a,g){for(var c=0;c<a.value.length;c++)if(D.equals(a.value[c],g).value)return{ctype:"boolean",value:!0};return{ctype:"boolean",value:!1}};h.common=function(a,g){for(var c=[],q=0,b=0;b<a.value.length;b++){for(var d=!1,h=a.value[b],e=0;e<g.value.length;e++)d=d||D.equals(h,g.value[e]).value;d&&(c[q]=a.value[b],q++)}return{ctype:"list",value:c}};h.remove=function(a,g){for(var c=[],q=0,b=0;b<a.value.length;b++){for(var d=
+!1,h=a.value[b],e=0;e<g.value.length;e++)d=d||D.equals(h,g.value[e]).value;d||(c[q]=a.value[b],q++)}return{ctype:"list",value:c}};h.sort1=function(a){a=a.value.slice();a.sort(w.compare);return h.turnIntoCSList(a)};h._helper.isEqual=function(a,g){return h.equals(a,g).value};h._helper.isLessThan=function(a,g){for(var c=a.value.length,q=g.value.length,b=0;!(b>=c||b>=q)&&w.isEqual(a.value[b],g.value[b]);)b++;return b===c&&b<q?!0:b===q&&b<c||b===c&&b===q?!1:w.isLessThan(a.value[b],g.value[b])};h._helper.compare=
+function(a,g){return h._helper.isLessThan(a,g)?-1:h._helper.isEqual(a,g)?0:1};h.equals=function(a,g){if(a.value.length!==g.value.length)return{ctype:"boolean",value:!1};for(var c=!0,q=0;q<a.value.length;q++)var b=a.value[q],d=g.value[q],c="list"===b.ctype&&"list"===d.ctype?c&&h.equals(b,d).value:c&&vb([b,d],[]).value;return{ctype:"boolean",value:c}};h.almostequals=function(a,g){if(a.value.length!==g.value.length)return{ctype:"boolean",value:!1};for(var c=!0,q=0;q<a.value.length;q++)var b=a.value[q],
+d=g.value[q],c="list"===b.ctype&&"list"===d.ctype?c&&h.almostequals(b,d).value:c&&hc([b,d],[]).value;return{ctype:"boolean",value:c}};h._helper.isAlmostReal=function(a){for(var g=!0,c=0;c<a.value.length;c++)var q=a.value[c],g="list"===q.ctype?g&&h._helper.isAlmostReal(q):g&&m._helper.isAlmostReal(q);return g};h._helper.isAlmostZero=function(a){for(var g=0;g<a.value.length;g++){var c=a.value[g];if("list"===c.ctype){if(!h._helper.isAlmostZero(c))return!1}else if(!m._helper.isAlmostZero(c))return!1}return!0};
+h._helper.isNaN=function(a){for(var g=!1,c=0;c<a.value.length;c++)var q=a.value[c],g="list"===q.ctype?g||h._helper.isNaN(q):g||m._helper.isNaN(q);return g};h.set=function(a){var g=[],c=0;a=a.value.slice();a.sort(w.compare);for(var q=0;q<a.length;q++)0!==q&&vb([g[g.length-1],a[q]],[]).value||(g[c]=a[q],c++);return{ctype:"list",value:g}};h.maxval=function(a){for(var g=m.zero,c=0;c<a.value.length;c++){var q=a.value[c];"number"===q.ctype&&(g=m.argmax(g,q));"list"===q.ctype&&(g=m.argmax(g,h.maxval(q)))}return g};
+h.maxIndex=function(a,g,c){var q=0;void 0!==c&&(q=c);c=q;for(var b=g(a.value[q]).value.real;q<a.value.length;++q){var d=g(a.value[q]).value.real;d>b&&(c=q,b=d)}return c};h.normalizeMax=function(a){var g=m.inv(h.maxval(a));return m._helper.isFinite(g)?h.scalmult(g,a):a};h.normalizeZ=function(a){var g=m.inv(a.value[2]);return h.scalmult(g,a)};h.dehom=function(a){a=a.value.slice();var g=a.length-1,c=m.inv(a[g]);a.length=g;for(var q=0;q<g;++q)a[q]=m.mult(c,a[q]);return h.turnIntoCSList(a)};h.normalizeAbs=
+function(a){var g=m.inv(h.abs(a));return h.scalmult(g,a)};h.max=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++)c[q]=w.max(a.value[q],g.value[q]);return{ctype:"list",value:c}};h.min=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++)c[q]=w.min(a.value[q],g.value[q]);return{ctype:"list",value:c}};h.scaldiv=function(a,g){if("number"!==a.ctype)return k;for(var c=[],q=0;q<g.value.length;q++){var b=g.value[q];
+c[q]="number"===b.ctype?w.div(b,a):"list"===b.ctype?h.scaldiv(a,b):k}return{ctype:"list",value:c}};h.scalmult=function(a,g){if("number"!==a.ctype)return k;for(var c=[],q=0;q<g.value.length;q++){var b=g.value[q];c[q]="number"===b.ctype?w.mult(b,a):"list"===b.ctype?h.scalmult(a,b):k}return{ctype:"list",value:c}};h.add=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++){var b=a.value[q],d=g.value[q];c[q]="number"===b.ctype&&"number"===d.ctype?w.add(b,d):"list"===
+b.ctype&&"list"===d.ctype?h.add(b,d):k}return{ctype:"list",value:c}};h.sub=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++){var b=a.value[q],d=g.value[q];c[q]="number"===b.ctype&&"number"===d.ctype?m.sub(b,d):"list"===b.ctype&&"list"===d.ctype?h.sub(b,d):k}return{ctype:"list",value:c}};h.abs2=function(a){for(var g=0,c=0;c<a.value.length;c++){var q=a.value[c];if("number"===q.ctype)g+=m.abs2(q).value.real;else if("list"===q.ctype)g+=h.abs2(q).value.real;
+else return k}return{ctype:"number",value:{real:g,imag:0}}};h.abs=function(a){return m.sqrt(h.abs2(a))};h.normalizeMaxXX=function(a){for(var g=-1E4,c=m.real(1),q=0;q<a.value.length;q++){var b=m.abs(a.value[q]);b.value.real>g&&(c=a.value[q],g=b.value.real)}return h.scaldiv(c,a)};h.recursive=function(a,g){for(var c=[],q=0;q<a.value.length;q++){var b=B(a.value[q]);c[q]="number"===b.ctype?m[g](b):"list"===b.ctype?h[g](b):k}return{ctype:"list",value:c}};h.re=function(a){return h.recursive(a,"re")};h.neg=
+function(a){return h.recursive(a,"neg")};h.im=function(a){return h.recursive(a,"im")};h.conjugate=function(a){return h.recursive(a,"conjugate")};h.transjugate=function(a){return h.transpose(h.conjugate(a))};h.round=function(a){return h.recursive(a,"round")};h.ceil=function(a){return h.recursive(a,"ceil")};h.floor=function(a){return h.recursive(a,"floor")};h._helper.colNumb=function(a){if("list"!==a.ctype)return-1;for(var g=-1,c=0;c<a.value.length;c++){if("list"!==a.value[c].ctype)return-1;if(0===
+c)g=a.value[c].value.length;else if(g!==a.value[c].value.length)return-1}return g};h._helper.isNumberVecN=function(a,g){if("list"!==a.ctype||a.value.length!==g)return!1;for(var c=0;c<a.value.length;c++)if("number"!==a.value[c].ctype)return!1;return!0};h.isNumberVector=function(a){if("list"!==a.ctype)return{ctype:"boolean",value:!1};for(var g=0;g<a.value.length;g++)if("number"!==a.value[g].ctype)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};h.isNumberVectorN=function(a,g){if("list"!==
+a.ctype)return{ctype:"boolean",value:!1};if(a.value)for(var c=0;c<a.value.length;c++)if("number"!==a.value[c].ctype)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};h.isNumberMatrix=function(a){if(-1===h._helper.colNumb(a))return{ctype:"boolean",value:!1};for(var g=0;g<a.value.length;g++)if(!h.isNumberVector(a.value[g]).value)return{ctype:"boolean",value:!1};return{ctype:"boolean",value:!0}};h._helper.isNumberMatrixMN=function(a,g,c){return h.isNumberMatrix(a).value&&a.value.length===
+g&&a.value[0].value.length===c};h.scalproduct=function(a,g){if(a.value.length!==g.value.length)return k;for(var c={ctype:"number",value:{real:0,imag:0}},q=0;q<g.value.length;q++){var b=a.value[q],d=g.value[q];if("number"===b.ctype&&"number"===d.ctype)c=m.add(m.mult(b,d),c);else return k}return c};h.sesquilinearproduct=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=0,q=0,b=0;b<g.value.length;b++)var d=a.value[b].value,h=g.value[b].value,c=c+(d.real*h.real+d.imag*h.imag),q=q+(d.real*
+h.imag-d.imag*h.real);return m.complex(c,q)};h.normSquared=function(a){for(var g=0,c=0;c<a.value.length;c++)var q=a.value[c].value,g=g+(q.real*q.real+q.imag*q.imag);return m.real(g)};h.productMV=function(a,g){if(a.value[0].value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++){for(var b={ctype:"number",value:{real:0,imag:0}},d=a.value[q],e=0;e<g.value.length;e++){var f=d.value[e],l=g.value[e];if("number"===f.ctype&&"number"===l.ctype)b=m.add(m.mult(f,l),b);else return k}c[q]=
+b}return h.turnIntoCSList(c)};h.productVM=function(a,g){if(a.value.length!==g.value.length)return k;for(var c=[],q=0;q<g.value[0].value.length;q++){for(var b={ctype:"number",value:{real:0,imag:0}},d=0;d<a.value.length;d++){var e=a.value[d],f=g.value[d].value[q];if("number"===e.ctype&&"number"===f.ctype)b=m.add(m.mult(e,f),b);else return k}c[q]=b}return h.turnIntoCSList(c)};h.productMM=function(a,g){if(a.value[0].value.length!==g.value.length)return k;for(var c=[],q=0;q<a.value.length;q++){var b=h.productVM(a.value[q],
+g);c[q]=b}return h.turnIntoCSList(c)};h.mult=function(a,g){return a.value.length===g.value.length&&h.isNumberVector(a).value&&h.isNumberVector(g).value?h.scalproduct(a,g):h.isNumberMatrix(a).value&&g.value.length===a.value[0].value.length&&h.isNumberVector(g).value?h.productMV(a,g):h.isNumberMatrix(g).value&&a.value.length===g.value.length&&h.isNumberVector(a).value?h.productVM(a,g):h.isNumberMatrix(a).value&&h.isNumberMatrix(g).value&&g.value.length===a.value[0].value.length?h.productMM(a,g):k};
+h.projectiveDistMinScal=function(a,g){var c=h.abs(a),q=h.abs(g);if(0===c.value.real||0===q.value.real)return 0;var b=h.conjugate(g),b=h.scalproduct(a,b),b=m._helper.isAlmostZero(b)?m.real(1):m.div(b,m.abs(b)),c=h.scaldiv(c,a),q=h.scaldiv(q,g),q=h.scalmult(b,q),b=h.abs(h.add(c,q)),q=h.abs(h.sub(c,q));return Math.min(b.value.real,q.value.real)};h.conicDist=function(a,g){var c=u(a),q=u(g);console.log(Z(c),Z(q));return h.projectiveDistMinScal(c,q)};h.crossOperator=function(a){var g=a.value[0],c=a.value[1];
+a=a.value[2];return h.turnIntoCSList([h.turnIntoCSList([m.zero,m.neg(a),c]),h.turnIntoCSList([a,m.zero,m.neg(g)]),h.turnIntoCSList([m.neg(c),g,m.zero])])};h.cross=function(a,g){var c=m.sub(m.mult(a.value[1],g.value[2]),m.mult(a.value[2],g.value[1])),q=m.sub(m.mult(a.value[2],g.value[0]),m.mult(a.value[0],g.value[2])),b=m.sub(m.mult(a.value[0],g.value[1]),m.mult(a.value[1],g.value[0]));return h.turnIntoCSList([c,q,b])};h.crossratio3harm=function(a,g,c,q,b){var d=h.det3(a,c,b),e=h.det3(g,q,b);a=h.det3(a,
+q,b);g=h.det3(g,c,b);d=m.mult(d,e);e=m.mult(a,g);return h.turnIntoCSList([d,e])};h.crossratio3=function(a,g,c,q,b){a=h.crossratio3harm(a,g,c,q,b);return m.div(a.value[0],a.value[1])};h.veronese=function(a){var g=m.mult(a.value[0],a.value[0]),c=m.mult(a.value[1],a.value[1]),q=m.mult(a.value[2],a.value[2]),b=m.mult(a.value[0],a.value[1]),d=m.mult(a.value[0],a.value[2]);a=m.mult(a.value[1],a.value[2]);return h.turnIntoSCList([g,c,q,b,d,a])};h.matrixFromVeronese=function(a){var g=a.value[0],c=a.value[1],
+q=a.value[2],b=m.realmult(.5,a.value[3]),d=m.realmult(.5,a.value[4]);a=m.realmult(.5,a.value[5]);return h.turnIntoCSList([h.turnIntoCSList([g,b,d]),h.turnIntoCSList([b,c,a]),h.turnIntoCSList([d,a,q])])};h.det2=function(a,g){var c=m.mult(a.value[0],g.value[1]);return c=m.sub(c,m.mult(a.value[1],g.value[0]))};h.det3=function(a,g,c){return m.complex(a.value[0].value.real*g.value[1].value.real*c.value[2].value.real-a.value[0].value.imag*g.value[1].value.imag*c.value[2].value.real-a.value[0].value.imag*
+g.value[1].value.real*c.value[2].value.imag-a.value[0].value.real*g.value[1].value.imag*c.value[2].value.imag+a.value[2].value.real*g.value[0].value.real*c.value[1].value.real-a.value[2].value.imag*g.value[0].value.imag*c.value[1].value.real-a.value[2].value.imag*g.value[0].value.real*c.value[1].value.imag-a.value[2].value.real*g.value[0].value.imag*c.value[1].value.imag+a.value[1].value.real*g.value[2].value.real*c.value[0].value.real-a.value[1].value.imag*g.value[2].value.imag*c.value[0].value.real-
+a.value[1].value.imag*g.value[2].value.real*c.value[0].value.imag-a.value[1].value.real*g.value[2].value.imag*c.value[0].value.imag-a.value[0].value.real*g.value[2].value.real*c.value[1].value.real+a.value[0].value.imag*g.value[2].value.imag*c.value[1].value.real+a.value[0].value.imag*g.value[2].value.real*c.value[1].value.imag+a.value[0].value.real*g.value[2].value.imag*c.value[1].value.imag-a.value[2].value.real*g.value[1].value.real*c.value[0].value.real+a.value[2].value.imag*g.value[1].value.imag*
+c.value[0].value.real+a.value[2].value.imag*g.value[1].value.real*c.value[0].value.imag+a.value[2].value.real*g.value[1].value.imag*c.value[0].value.imag-a.value[1].value.real*g.value[0].value.real*c.value[2].value.real+a.value[1].value.imag*g.value[0].value.imag*c.value[2].value.real+a.value[1].value.imag*g.value[0].value.real*c.value[2].value.imag+a.value[1].value.real*g.value[0].value.imag*c.value[2].value.imag,-a.value[0].value.imag*g.value[1].value.imag*c.value[2].value.imag+a.value[0].value.imag*
+g.value[1].value.real*c.value[2].value.real+a.value[0].value.real*g.value[1].value.real*c.value[2].value.imag+a.value[0].value.real*g.value[1].value.imag*c.value[2].value.real-a.value[2].value.imag*g.value[0].value.imag*c.value[1].value.imag+a.value[2].value.imag*g.value[0].value.real*c.value[1].value.real+a.value[2].value.real*g.value[0].value.real*c.value[1].value.imag+a.value[2].value.real*g.value[0].value.imag*c.value[1].value.real-a.value[1].value.imag*g.value[2].value.imag*c.value[0].value.imag+
+a.value[1].value.imag*g.value[2].value.real*c.value[0].value.real+a.value[1].value.real*g.value[2].value.real*c.value[0].value.imag+a.value[1].value.real*g.value[2].value.imag*c.value[0].value.real+a.value[0].value.imag*g.value[2].value.imag*c.value[1].value.imag-a.value[0].value.imag*g.value[2].value.real*c.value[1].value.real-a.value[0].value.real*g.value[2].value.real*c.value[1].value.imag-a.value[0].value.real*g.value[2].value.imag*c.value[1].value.real+a.value[2].value.imag*g.value[1].value.imag*
+c.value[0].value.imag-a.value[2].value.imag*g.value[1].value.real*c.value[0].value.real-a.value[2].value.real*g.value[1].value.real*c.value[0].value.imag-a.value[2].value.real*g.value[1].value.imag*c.value[0].value.real+a.value[1].value.imag*g.value[0].value.imag*c.value[2].value.imag-a.value[1].value.imag*g.value[0].value.real*c.value[2].value.real-a.value[1].value.real*g.value[0].value.real*c.value[2].value.imag-a.value[1].value.real*g.value[0].value.imag*c.value[2].value.real)};h.det4m=function(a){var g=
+a.value,c=g[0].value,q=c[0].value,b=+q.real,d=+q.imag,q=c[1].value,h=+q.real,e=+q.imag,q=c[2].value,f=+q.real,k=+q.imag,q=c[3].value,l=+q.real,n=+q.imag,c=g[1].value,q=c[0].value,p=+q.real,r=+q.imag,q=c[1].value,t=+q.real,v=+q.imag,q=c[2].value,u=+q.real,w=+q.imag,q=c[3].value,c=+q.real,q=+q.imag;a=b*t-d*v-h*p+e*r;var x=b*v+d*t-h*r-e*p,y=b*u-d*w-f*p+k*r,A=b*w+d*u-f*r-k*p,z=b*c-d*q-l*p+n*r,B=b*q+d*c-l*r-n*p,C=h*u-e*w-f*t+k*v,D=h*w+e*u-f*v-k*t,F=h*c-e*q-l*t+n*v,E=h*q+e*c-l*v-n*t,G=f*c-k*q-l*u+n*w,H=
+f*q+k*c-l*w-n*u,c=g[2].value,q=c[0].value,b=+q.real,d=+q.imag,q=c[1].value,h=+q.real,e=+q.imag,q=c[2].value,f=+q.real,k=+q.imag,q=c[3].value,l=+q.real,n=+q.imag,c=g[3].value,q=c[0].value,p=+q.real,r=+q.imag,q=c[1].value,t=+q.real,v=+q.imag,q=c[2].value,u=+q.real,w=+q.imag,q=c[3].value,c=+q.real,q=+q.imag,g=b*t-d*v-h*p+e*r,L=b*v+d*t-h*r-e*p,J=b*u-d*w-f*p+k*r,M=b*w+d*u-f*r-k*p,N=b*c-d*q-l*p+n*r,b=b*q+d*c-l*r-n*p,d=h*u-e*w-f*t+k*v,p=h*w+e*u-f*v-k*t,r=h*c-e*q-l*t+n*v,h=h*q+e*c-l*v-n*t,e=f*c-k*q-l*u+n*
+w,f=f*q+k*c-l*w-n*u;return m.complex(a*e-x*f-y*r+A*h+z*d-B*p+C*N-D*b-F*J+E*M+G*g-H*L,a*f+x*e-y*h-A*r+z*p+B*d+C*b+D*N-F*M-E*J+G*L+H*g)};h.eucangle=function(a,g){var c=h.cross(a,h.linfty),q=h.cross(g,h.linfty),b=h.det3(h.ez,c,h.ii),c=h.det3(h.ez,c,h.jj),d=h.det3(h.ez,q,h.ii),q=h.det3(h.ez,q,h.jj),b=m.div(m.mult(b,q),m.mult(d,c)),b=m.log(b);return b=m.mult(b,m.complex(0,.5))};h.zerovector=function(a){a=Math.floor(a.value.real);for(var g=Array(a),c=0;c<a;c++)g[c]=0;return h.realVector(g)};h.zeromatrix=
+function(a,g){for(var c=Math.floor(a.value.real),q=Array(c),b=0;b<c;b++)q[b]=h.zerovector(g);return h.turnIntoCSList(q)};h.vandermonde=function(a){for(var g=a.value.length,c=h.zeromatrix(g,g),q=0;q<g;q++)for(var b=0;b<g;b++)c.value[q].value[b]=m.pow(a.value[q],m.real(b-1));return c};h.transpose=function(a){for(var g=[],c=a.value[0].value.length,q=a.value.length,b=0;b<c;b++){for(var d=[],e=0;e<q;e++)d[e]=a.value[e].value[b];g[b]=h.turnIntoCSList(d)}return h.turnIntoCSList(g)};h.column=function(a,g){for(var c=
+[],q=a.value.length,b=Math.floor(g.value.real-1),d=0;d<q;d++)c[d]=a.value[d].value[b];return h.turnIntoCSList(c)};h.row=function(a,g){for(var c=[],q=a.value[0].value.length,b=Math.floor(g.value.real-1),d=0;d<q;d++)c[d]=a.value[b].value[d];return h.turnIntoCSList(c)};h.adjoint2=function(a){var g=a.value[0].value[0],c=a.value[1].value[0],q=Array(2);q[0]=h.turnIntoCSList([a.value[1].value[1],m.neg(a.value[0].value[1])]);q[1]=h.turnIntoCSList([m.neg(c),g]);return q=h.turnIntoCSList(q)};h.adjoint3=function(a){var g,
+c,q,b,d,h,e,f,m,k,l,n,p,r,t,v,u;g=a.value[0].value;c=g[0].value;q=c.real;b=c.imag;c=g[1].value;d=c.real;h=c.imag;c=g[2].value;e=c.real;f=c.imag;g=a.value[1].value;c=g[0].value;m=c.real;k=c.imag;c=g[1].value;l=c.real;n=c.imag;c=g[2].value;p=c.real;r=c.imag;g=a.value[2].value;c=g[0].value;a=c.real;t=c.imag;c=g[1].value;v=c.real;u=c.imag;c=g[2].value;g=c.real;c=c.imag;return{ctype:"list",value:[{ctype:"list",value:[{ctype:"number",value:{real:l*g-p*v-n*c+r*u,imag:l*c-p*u-v*r+g*n}},{ctype:"number",value:{real:-d*
+g+e*v+h*c-f*u,imag:-d*c+e*u+v*f-g*h}},{ctype:"number",value:{real:d*p-e*l-h*r+f*n,imag:d*r-e*n-l*f+p*h}}]},{ctype:"list",value:[{ctype:"number",value:{real:-m*g+p*a+k*c-r*t,imag:-m*c+p*t+a*r-g*k}},{ctype:"number",value:{real:q*g-e*a-b*c+f*t,imag:q*c-e*t-a*f+g*b}},{ctype:"number",value:{real:-q*p+e*m+b*r-f*k,imag:-q*r+e*k+m*f-p*b}}]},{ctype:"list",value:[{ctype:"number",value:{real:m*v-l*a-k*u+n*t,imag:m*u-l*t-a*n+v*k}},{ctype:"number",value:{real:-q*v+d*a+b*u-h*t,imag:-q*u+d*t+a*h-v*b}},{ctype:"number",
+value:{real:q*l-d*m-b*n+h*k,imag:q*n-d*k-m*h+l*b}}]}]}};h.inverse=function(a){var g=a.value.length;if(g!==a.value[0].value.length)return console.log("Inverse works only for square matrices"),k;if(2===g)return h.scaldiv(h.det(a),h.adjoint2(a));if(3===g)return h.scaldiv(h.det(a),h.adjoint3(a));g=h.LUdecomp(a);a=a.value.length;var c=m.real(0),q=m.real(1),b=h.zerovector(m.real(a));b.value[0]=q;for(var d=Array(a),e=0;e<a;e++)d[e]=h._helper.LUsolve(g,b),b.value[e]=c,b.value[e+1]=q;d=h.turnIntoCSList(d);
+return d=h.transpose(d)};h.linearsolve=function(a,g){return 2===a.value.length?h.linearsolveCramer2(a,g):3===a.value.length?h.linearsolveCramer3(a,g):h.LUsolve(a,g)};h.getDiag=function(a){if(a.value.length!==a.value[0].value.length)return k;for(var g=Array(a.value.length),c=0;c<a.value.length;c++)g[c]=a.value[c].value[c];return h.turnIntoCSList(g)};h.getSubDiag=function(a){if(a.value.length!==a.value[0].value.length)return k;for(var g=Array(a.value.length-1),c=0;c<a.value.length-1;c++)g[c]=a.value[c+
+1].value[c];return h.turnIntoCSList(g)};h.eig2=function(a){var g=m.add(a.value[0].value[0],a.value[1].value[1]);a=h.det2(a.value[0],a.value[1]);var c=m.mult(g,g),b=g=m.mult(g,m.real(.5));a=m.sqrt(m.sub(m.div(c,m.real(4)),a));g=m.add(g,a);b=m.sub(b,a);return h.turnIntoCSList([g,b])};h.eig=function(a,g){var c=g||!0,b=a,d=m.real(b.value.length),e=d.value.real;m.real(0);var b=h._helper.QRIteration(b)[0],b=h.getDiag(b),b=h.sort1(b),d=h.idMatrix(d,d),f=Array(e),f=h.turnIntoCSList(f);if(c){for(var k,l,n,
+p=0,r=!1,c=0;c<e;c++)r?l=k.value[p]:(k=b.value[c],k=h.sub(a,h.scalmult(k,d)),k=h.nullSpace(k),l=k.value[0],void 0!==l&&(n=l)),void 0===l&&(l=n),1E-8>h.abs(l).value.real&&0===p&&(l=h._helper.inverseIteration(a,b.value[c])),f.value[c]=h._helper.isAlmostZeroVec(l)?l:h.scaldiv(h.abs(l),l),c<e-1&&((r=1E-6>m.abs(m.sub(b.value[c],b.value[c+1])).value.real)?p++:p=0);f=h.transpose(f)}return h.turnIntoCSList([b,f])};h._helper.isNormalMatrix=function(a){return 1E-10>h.abs(h.sub(a,h.transjugate(a))).value.real};
+h._helper.QRIteration=function(a,g){var c,b=a;c=m.real(b.value.length);var d=c.value.real,e=c.value.real;m.real(0);var f;h.idMatrix(c,c);var k=h.zeromatrix(c,c),l=h.idMatrix(c,c),n=g?g:2500,p,r,t,v=0,u=Array(e);for(c=0;c<n;c++){f=h._helper.getBlock(b,[e-2,e-1],[e-2,e-1]);p=h.eig2(f);f=p.value[0];p=p.value[1];h.abs(f);h.abs(p);r=b.value[e-1].value[e-1];t=m.abs(m.sub(r,f)).value.real;r=m.abs(m.sub(r,p)).value.real;p=t<r?f:p;f=h.idMatrix(m.real(e),m.real(e));p=h.scalmult(p,f);f=h.QRdecomp(h.sub(b,p));
+b=w.mult(f.R,f.Q);b=h.add(b,p);f.Q=h._helper.buildBlockMatrix(f.Q,h.idMatrix(m.real(v),m.real(v)));l=w.mult(l,f.Q);if(1E-48>m.abs2(b.value[b.value.length-1].value[b.value[0].value.length-2]).value.real&&1<e){u[d-v-1]=b.value[e-1].value[e-1];for(c=0;c<e;c++)k.value[e-1].value[c]=b.value[e-1].value[c],k.value[c].value[e-1]=b.value[c].value[e-1];b=h._helper.getBlock(b,[0,e-2],[0,e-2]);v++;e--}if(1===e){k.value[0].value[0]=b.value[0].value[0];break}if(h._helper.isUpperTriangular(b)){for(c=0;c<e;c++)k.value[c].value[c]=
+b.value[c].value[c];break}}return[k,l]};h.rank=function(a,g){return h.RRQRdecomp(a,g).rank};h._helper.isAlmostZeroVec=function(a){for(var g=a.value.length,c=0;c<g;c++)if(!m._helper.isAlmostZero(a.value[c]))return!1;return!0};h._helper.isLowerTriangular=function(a){for(var g=a.value.length,c=a.value[0].value.length,b=0;b<g;b++)for(var d=b+1;d<c;d++)if(!m._helper.isAlmostZero(a.value[b].value[d]))return!1;return!0};h._helper.isUpperTriangular=function(a){return h._helper.isLowerTriangular(h.transpose(a))};
+h._helper.isAlmostId=function(a){var g=a.value.length,c=m.real(g);if(g!==a.value[0].value.length)return!1;a=h.sub(a,h.idMatrix(c),c);for(c=0;c<g;c++)for(var b=0;b<g;b++)if(1E-16<m.abs(a.value[c].value[b]).value.real)return!1;return!0};h.nullSpace=function(a,g){var c=a.value.length,b=h.RRQRdecomp(h.transjugate(a),g),d=h.transpose(b.Q),b=c-b.rank.value.real,e=Array(b);d.value.reverse();for(var f,k=0;k<b;k++)f=d.value[k],e[k]=h.scaldiv(h.abs(f),f);e=h.turnIntoCSList(e);return 0<e.value.length?e:h.turnIntoCSList([h.zerovector(m.real(c))])};
+h._helper.isAlmostDiagonal=function(a){var g=a.value.length;m.real(g);m.real(0);if(g!==a.value[0].value.length)return!1;for(var c=0;c<g;c++)for(var b=0;b<g;b++)if(c!==b&&1E-16<m.abs(a.value[c].value[b]).value.real)return!1;return!0};h._helper.inverseIteration=function(a,g){console.log("warning: code untested");for(var c=a.value.length,b=Array(c),d=0;d<c;d++)b[d]=2*Math.random()-.5;for(var b=h.realVector(b),c=h.idMatrix(m.real(c),m.real(c)),d=m.add(g,m.real(.1*Math.random()-.5)),e=0;100>e;e++)b=h.scaldiv(h.abs(b),
+b),b=h.LUsolve(h.sub(a,h.scalmult(d,c)),JSON.parse(JSON.stringify(b)));return h.scaldiv(h.abs(b),b)};h._helper.toHessenberg=function(a){var g=JSON.parse(JSON.stringify(a)),c=g.value.length,b=m.real(c-1),d=m.real(c);m.real(1);if(h._helper.isUpperTriangular(g))return[h.idMatrix(b,b),a];var e;a=h.idMatrix(d,d);for(var f,d=1;d<c-1;d++)e=h.column(g,m.real(d)),e.value=e.value.splice(d),f=h.abs2(e).value.real,1E-16<f&&(e=h._helper.getHouseHolder(e),a=w.mult(a,e),g=w.mult(w.mult(e,g),e)),b.value.real--;return[a,
+g]};h._helper.swapEl=function(a,g,c){var b;"[object Array]"===Object.prototype.toString.call(a)?(b=a[g],a[g]=a[c],a[c]=b):"list"===a.ctype&&(b=a.value[g],a.value[g]=a.value[c],a.value[c]=b)};h.RRQRdecomp=function(a,g){var c=Math.sqrt(m.eps);void 0!==g&&(c=.1*g.value.real);var c=c*c,b,d=a.value.length,e=m.real(d),f=m.real(1),k=h._helper.unitvector(m.real(a.value.length),f),l=h.idMatrix(e,e),n=JSON.parse(JSON.stringify(a)),p=h.transpose(a),r=Array(d);for(b=0;b<d;b++)r[b]=h.abs2(p.value[b]);r=h.turnIntoCSList(r);
+p=Array(d);for(b=0;b<d;b++)p[b]=b;b=h.maxIndex(r,m.abs);for(var t=r.value[b],v=0,u=0;1E-16<m.abs2(t).value.real;u++){v++;h._helper.swapColumn(n,u,b);h._helper.swapEl(r,u,b);h._helper.swapEl(p,u,b);b=h._helper.getBlock(n,[u],[u]);b=h.column(b,f);t=h.abs2(b).value.real;1E-8<t&&(b=h._helper.getHouseHolder(b),b=h._helper.buildBlockMatrix(h.idMatrix(m.real(u),m.real(u)),b),l=w.mult(l,h.transjugate(b)),n=w.mult(b,n));for(b=u+1;b<d;b++)r.value[b]=m.sub(r.value[b],m.mult(n.value[u].value[b],m.conjugate(n.value[u].value[b])));
+b=h.maxIndex(r,m.abs2,u+1);t=r.value[b];if(u+2===d){m.abs(t).value.real>c&&v++;break}e=m.sub(e,f);k.value=k.value.splice(0,k.value.length-1)}return{Q:l,R:n,P:h.turnIntoCSList(p),rank:m.real(v)}};h._helper.getHouseHolder=function(a){var g=m.real(a.value.length);if(1E-16>h.abs2(a))return h.idMatrix(g,g);var c,b=m.real(1),d=h._helper.unitvector(m.real(a.value.length),b);c=h._helper.QRgetAlpha(a,0);c=h.sub(a,h.scalmult(c,d));c=h.scaldiv(h.abs(c),c);a=m.div(h.sesquilinearproduct(a,c),h.sesquilinearproduct(c,
+a));g=h.idMatrix(g,g);return g=h.sub(g,h.scalmult(m.add(b,a),h._helper.transposeMult(c,h.conjugate(c))))};h._helper.reOrderbyPivots=function(a,g){for(var c=a.value.length.length,b=h.transpose(a),c=Array(c),d=0;d<g.length;d++)c[g[d]]=b.value[d];c=h.turnIntoCSList(c);return h.transpose(c)};h.QRdecomp=function(a){var g,c=a.value.length,b=m.real(c);if(h._helper.isUpperTriangular(a))return{Q:h.idMatrix(b,b),R:a};var d=m.real(1),e=h._helper.unitvector(m.real(a.value.length),d),f,k=h.idMatrix(b,b);a=JSON.parse(JSON.stringify(a));
+for(var l=0;;l++){g=h._helper.getBlock(a,[l],[l]);g=h.column(g,d);f=h.abs2(g).value.real;1E-8<f&&(g=h._helper.getHouseHolder(g),g=h._helper.buildBlockMatrix(h.idMatrix(m.real(l),m.real(l)),g),k=w.mult(k,h.transjugate(g)),a=w.mult(g,a));if(l+2===c)break;b=m.sub(b,d);e.value=e.value.splice(0,e.value.length-1)}return{Q:k,R:a}};h._helper.swapColumn=function(a,g,c){for(var b,d=0;d<a.value.length;d++)b=a.value[d].value[g],a.value[d].value[g]=a.value[d].value[c],a.value[d].value[c]=b};h._helper.buildBlockMatrix=
+function(a,g){if(0===a.value.length)return g;if(0===g.value.length)return a;for(var c=a.value.length,b=a.value[0].value.length,d=b+g.value[0].value.length,d=h.zeromatrix(m.real(c+g.value.length),m.real(d)),e=0;e<a.value.length;e++)for(var f=0;f<a.value[0].value.length;f++)d.value[e].value[f]=a.value[e].value[f];for(e=0;e<g.value.length;e++)for(f=0;f<g.value[0].value.length;f++)d.value[c+e].value[b+f]=g.value[e].value[f];return d};h._helper.getBlock=function(a,g,c){a=JSON.parse(JSON.stringify(a));
+var b=g[0],d=c[0];g=void 0===g[1]?a.value.length:g[1];c=void 0===c[1]?a.value[0].value.length:c[1];g++;c++;a.value=a.value.slice(b,g);for(b=0;b<a.value.length;b++)a.value[b].value=a.value[b].value.slice(d,c);return a};h._helper.setBlock=function(a,g,c){a=JSON.parse(JSON.stringify(a));var b=c[0];c=c[1];for(var d=g.value.length,h=g.value[0].value.length,e=0;e<d;e++)for(var f=0;f<h;f++)a.value[b+e].value[c+f]=g.value[e].value[f];return a};h._helper.transposeMult=function(a,g){if(a.value.length!==g.value.length)return k;
+for(var c=a.value.length,b=Array(c),d=0;d<c;d++)b[d]=h.scalmult(a.value[d],g);return h.turnIntoCSList(b)};h._helper.QRgetAlpha=function(a,g){return 0>a.value[g].value.real?h.abs(a):m.neg(h.abs(a))};h.LUdecomp=function(a){a=JSON.parse(JSON.stringify(a));var g,c,b,d,h,e=0,f,k=a.value.length,l=k-1,n=Array(k);for(b=0;b<k;++b){h=b;d=a.value[b];f=m.abs(d.value[b]).value.real;for(c=b+1;c<k;++c)g=m.abs(a.value[c].value[b]),f<g.value.real&&(f=g.value.real,h=c);f<m.eps&&console.log("Warning: singular matrix!");
+n[b]=h;h!==b&&(a.value[b]=a.value[h],a.value[h]=d,d=a.value[b],e++);c=d.value[b];for(g=b+1;g<k;++g)a.value[g].value[b]=m.div(a.value[g].value[b],c);for(g=b+1;g<k;++g){h=a.value[g];for(c=b+1;c<l;++c)h.value[c]=m.sub(h.value[c],m.mult(h.value[b],d.value[c])),++c,h.value[c]=m.sub(h.value[c],m.mult(h.value[b],d.value[c]));c===l&&(h.value[c]=m.sub(h.value[c],m.mult(h.value[b],d.value[c])))}}return{LU:a,P:n,TransPos:e}};h.LUsolve=function(a,g){var c=h.LUdecomp(a);return h._helper.LUsolve(c,g)};h._helper.LUsolve=
+function(a,g){var c=JSON.parse(JSON.stringify(g)),b,d=a.LU,h=d.value.length,e=JSON.parse(JSON.stringify(c)),f=a.P,k;for(b=h-1;-1!==b;--b)e.value[b]=c.value[b];for(b=0;b<h;++b)for(c=f[b],f[b]!==b&&(k=e.value[b],e.value[b]=e.value[c],e.value[c]=k),k=d.value[b],c=0;c<b;++c)e.value[b]=m.sub(e.value[b],m.mult(e.value[c],k.value[c]));for(b=h-1;0<=b;--b){k=d.value[b];for(c=b+1;c<h;++c)e.value[b]=m.sub(e.value[b],m.mult(e.value[c],k.value[c]));e.value[b]=m.div(e.value[b],k.value[b])}return e};h.linearsolveCramer2=
+function(a,g){var c=h.column(a,m.real(1)),b=h.column(a,m.real(2)),d=h.det2(c,b);m._helper.isZero(d)&&console.log("A is not regular!");b=h.det2(g,b);b=m.div(b,d);c=h.det2(c,g);c=m.div(c,d);return h.turnIntoCSList([b,c])};h.linearsolveCramer3=function(a,g){var c=h.column(a,m.real(1)),b=h.column(a,m.real(2)),d=h.column(a,m.real(3)),e=h.det3(c,b,d);m._helper.isZero(e)&&console.log("A is not regular!");var f=h.det3(g,b,d),d=h.det3(c,g,d),c=h.det3(c,b,g),f=h.turnIntoCSList([f,d,c]);return f=h.scaldiv(e,
+f)};h.linearsolveCGNR=function(a,g){var c=h.transpose(a),b=w.mult(c,a),c=w.mult(c,g);return h.linearsolveCG(b,c)};h.linearsolveCG=function(a,g){var c,b,d,e,f,k;e=g;b=c=h.sub(g,w.mult(a,g));for(var l=Math.ceil(1.2*a.value.length),n=0;n<l;){n++;f=w.mult(a,b);k=d=h.scalproduct(c,c);d=m.div(d,h.scalproduct(b,f));e=h.add(e,w.mult(d,b));c=h.sub(c,w.mult(d,f));if(h.abs(c).value.real<m.eps)break;d=h.scalproduct(c,c);d=m.div(d,k);b=h.add(c,w.mult(d,b))}n>=l&&console.log("CG did not converge");return e};h.det=
+function(a){if(1===a.value.length)return a.value[0].value[0];if(2===a.value.length)return h.det2(a.value[0],a.value[1]);if(3===a.value.length)return h.det3(a.value[0],a.value[1],a.value[2]);if(4===a.value.length)return h.det4m(a);var g=a.value.length,c=m.real(1),b,d,e=JSON.parse(JSON.stringify(a)),f,k,l,n;for(a=0;a<g-1;a++){d=a;for(b=a+1;b<g;b++)m.abs(e.value[b].value[a]).value.real>m.abs(e.value[d].value[a]).value.real&&(d=b);d!==a&&(b=e.value[d],e.value[d]=e.value[a],e.value[a]=b,c=m.neg(c));f=
+e.value[a];for(b=a+1;b<g;b++){k=e.value[b];l=m.div(k.value[a],f.value[a]);for(d=a+1;d<g-1;d+=2)n=d+1,k.value[d]=m.sub(k.value[d],m.mult(f.value[d],l)),k.value[n]=m.sub(k.value[n],m.mult(f.value[n],l));d!==g&&(k.value[d]=m.sub(k.value[d],m.mult(f.value[d],l)))}if(m._helper.isZero(f.value[a]))return m.real(0);c=m.mult(c,f.value[a])}return m.mult(c,e.value[a].value[a])};h.LUdet=function(a){a=h.LUdecomp(a);for(var g=a.LU,c=g.value.length,b=g.value[0].value[0],d=1;d<c;d++)b=m.mult(b,g.value[d].value[d]);
+1===a.TransPos%2&&(b=m.neg(b));return b};h.getField=function(a,g){var c;if("homog"===g){if(h._helper.isNumberVecN(a,3))return a;if(h._helper.isNumberVecN(a,2))return h.turnIntoCSList([a.value[0],a.value[1],m.real(1)])}if("xy"===g){if(h._helper.isNumberVecN(a,2))return a;if(h._helper.isNumberVecN(a,3))return h.turnIntoCSList([m.div(a.value[0],a.value[2]),m.div(a.value[1],a.value[2])])}if("x"===g&&h.isNumberVector(a)){c=a.value.length;if(0<c&&3!==c)return a.value[0];if(3===c)return"Point"===a.usage?
+m.div(a.value[0],a.value[2]):a.value[0]}if("y"===g&&h.isNumberVector(a)){c=a.value.length;if(1<c&&3!==c)return a.value[1];if(3===c)return"Point"===a.usage?m.div(a.value[1],a.value[2]):a.value[1]}return"z"===g&&h.isNumberVector(a)&&(c=a.value.length,2<c)?a.value[2]:k};h.nil=h.turnIntoCSList([]);h.ofGeos=function(a){return h.turnIntoCSList(a.map(function(a){return{ctype:"geo",value:a}}))};var Na={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(Na.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&&wa.err("Bad dictionary key: "+Z(a));return"undef"},create:function(){return{ctype:"dict",value:{}}},clone:function(a){var g=Na.create(),c;for(c in a.value)a.value.hasOwnProperty(c)&&(g.value[c]=a.value[c]);return g},put:function(a,
+g,c){a.value[Na.key(g)]={key:g,value:c}},get:function(a,g,c){return(a=a.value[Na.key(g)])?a.value:c},niceprint:function(a){return"{"+Object.keys(a.value).sort().map(function(g){g=a.value[g];return Z(g.key)+":"+Z(g.value)}).join(", ")+"}"}},w={_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 w.bool(!a.value)},isLessThan:function(a,
+g){return-1===w.compare(a,g)},isEqual:function(a,g){return 0===w.compare(a,g)},compareResults:function(a,g){return w.compare(a.result,g.result)},compare:function(a,g){if(a.ctype!==g.ctype)return w.order[a.ctype]-w.order[g.ctype];if("number"===a.ctype)return m._helper.compare(a,g);if("list"===a.ctype)return h._helper.compare(a,g);if("geo"===a.ctype)return a.value.name===g.value.name?0:a.value.name<g.value.name?-1:1;if("string"===a.ctype)return a.value===g.value?0:a.value<g.value?-1:1;if("boolean"===
+a.ctype)return a.value===g.value?0:!1===a.value?-1:1},add:function(a,g){return"void"===a.ctype&&"number"===g.ctype||"void"===a.ctype&&"list"===g.ctype?g:"number"===a.ctype&&"number"===g.ctype?m.add(a,g):"string"===a.ctype||"string"===g.ctype?{ctype:"string",value:Z(a)+Z(g)}:"list"===a.ctype&&"list"===g.ctype?h.add(a,g):k},sub:function(a,g){return"void"===a.ctype&&"number"===g.ctype?m.neg(g):"void"===a.ctype&&"list"===g.ctype?h.neg(g):"number"===a.ctype&&"number"===g.ctype?m.sub(a,g):"list"===a.ctype&&
+"list"===g.ctype?h.sub(a,g):k},mult:function(a,g){return"number"===a.ctype&&"number"===g.ctype?m.mult(a,g):"number"===a.ctype&&"list"===g.ctype?h.scalmult(a,g):"list"===a.ctype&&"number"===g.ctype?h.scalmult(g,a):"list"===a.ctype&&"list"===g.ctype?h.mult(a,g):k},div:function(a,g){return"number"===a.ctype&&"number"===g.ctype?m.div(a,g):"list"===a.ctype&&"number"===g.ctype?h.scaldiv(g,a):k},max:function(a,g){return"number"===a.ctype&&"number"===g.ctype?m.max(a,g):"list"===a.ctype&&"list"===g.ctype?
+h.max(a,g):k},min:function(a,g){return"number"===a.ctype&&"number"===g.ctype?m.min(a,g):"list"===a.ctype&&"list"===g.ctype?h.min(a,g):k},wrap:function(a){if("number"===typeof a)return m.real(a);if("object"===typeof a&&void 0!==a.length){for(var g=[],c=0;c<a.length;c++)g[c]=w.wrap(a[c]);return h.turnIntoCSList(g)}return"string"===typeof a?{ctype:"string",value:a}:"boolean"===typeof a?{ctype:"boolean",value:a}:k},unwrap:function(a){if("object"!==typeof a||null===a)return a;if(Array.isArray(a))return a.map(w.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(w.unwrap);default:return null}},withUsage:function(a,g){return{ctype:a.ctype,value:a.value,usage:g}},wrapJSON:function(a){switch(typeof a){case "number":return m.real(a);case "string":return w.string(a);case "boolean":return w.bool(a);case "object":if(null===a)return k;if(Array.isArray(a))return h.turnIntoCSList(a.map(w.wrapJSON));
+var g=Na.create(),c;for(c in a)Na.put(g,w.string(c),w.wrapJSON(a[c]));return g;default:return console.log("Failed to convert "+typeof a+" to CindyJS data type"),k}},identity:function(a){return a},deeplyEqual:function(a,g){if("object"!==typeof a||"object"!==typeof g||null===a||null===g)return a===g;var c=0,b;for(b in a)if(++c,!(b in g&&w.deeplyEqual(a[b],g[b])))return!1;for(b in g)--c;return 0===c},DeepCloneJSON:function(a){var g,c,b;g=Array.isArray(a)?[]:{};for(b in a)c=a[b],g[b]="object"===typeof c&&
+null!==c?w.DeepCloneJSON(c):c;return g}},db={},Q={};Q[":"]=C(":");Q["\u00b0"]=function(a,g){var c=B(a[0]);return"number"===c.ctype&&"void"===a[1].ctype?w.withUsage(m.realmult(Math.PI/180,c),"Angle"):k};Q._=vc;Q["^"]=Uc;Q["\u221a"]=function(a,g){return"void"===a[0].ctype?t.sqrt$1([a[1]],g):k};Q["*"]=Sc;Q["\u00d7"]=$c;Q["/"]=Tc;Q["+"]=Rc;Q["-"]=jc;Q["!"]=function(a,g){var c=B(a[1]);return"void"===a[0].ctype&&"boolean"===c.ctype?{ctype:"boolean",value:!c.value}:k};Q["=="]=vb;Q["~="]=hc;Q["~<"]=function(a,
+g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real<=-m.eps}:k};Q["~>"]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real>=m.eps}:k};Q["=:="]=C("=:=");Q[">="]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&
+m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real>=b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value>=b.value}:k};Q["<="]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real<=b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value<=b.value}:k};Q["~>="]=function(a,g){var c=B(a[0]),
+b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real>-m.eps}:k};Q["~<="]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real-b.value.real<m.eps}:k};Q[">"]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?
+{ctype:"boolean",value:c.value.real>b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value>b.value}:k};Q["<"]=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype&&m._helper.isAlmostReal(c)&&m._helper.isAlmostReal(b)?{ctype:"boolean",value:c.value.real<b.value.real}:"string"===c.ctype&&"string"===b.ctype?{ctype:"boolean",value:c.value<b.value}:k};Q["<>"]=Oc;Q["\u2208"]=function(a,g){var c=z(a[0]),b=z(a[1]);return"list"===b.ctype?h.contains(b,
+c):k};Q["\u2209"]=function(a,g){var c=z(a[0]),b=z(a[1]);return"list"===b.ctype?w.not(h.contains(b,c)):k};Q["&"]=Pc;Q["%"]=Qc;Q["!="]=Oc;Q["~!="]=function(a,g){return w.not(hc(a,g))};Q[".."]=function(a,g){var c=z(a[0]),b=z(a[1]);return"number"===c.ctype&&"number"===b.ctype?h.sequence(c,b):k};Q["++"]=ad;Q["--"]=cd;Q["~~"]=bd;Q[":>"]=dd;Q["<:"]=ed;Q["="]=ab;Q[":="]=function(a,g,c){g="undefined"===a[1].ctype;if("undefined"===a[0].ctype||g)return k;if("function"===a[0].ctype){g=a[0].oper;var b=a[0].args,
+d=a[1],h=1;if(db.hasOwnProperty(g)){h=db[g];if(h.definer===c)return k;h=h.generation+1}db[g]={oper:g,body:d,arglist:b,definer:c,generation:h}}"variable"===a[0].ctype&&J.setvar(a[0].name,a[1]);return k};Q[":=_"]=function(a,g){if("void"!==a[1].ctype)return k;"function"===a[0].ctype&&delete db[a[0].oper];return k};Q["::="]=C("::=");Q[";"]=function(a,g){var c="void"===a[0].ctype,b="void"===a[1].ctype;if(c&&b)return k;if(!c&&b)return z(a[0]);c||b||z(a[0]);return b?k:z(a[1])};var t={},D={evaluate:function(a,
+g,c){if(db.hasOwnProperty(a)){a=db[a];if(void 0===a)g=k;else{var b=[];for(c=0;c<a.arglist.length;c++)b[c]=z(g[c]);for(c=0;c<a.arglist.length;c++)J.newvar(a.arglist[c].name),J.setvar(a.arglist[c].name,b[c]);J.pushVstack("*");g=z(a.body);J.cleanVstack();for(c=0;c<a.arglist.length;c++)J.removevar(a.arglist[c].name)}return g}if(b=t[a])return b(g,c);var d=a.lastIndexOf("$");if(-1!==d&&(d=a.substr(0,d),b=t[d]))return b(g,c);wa.err("Called undefined function "+d+" (as "+a+")");return k},equals:function(a,
+g){return"number"===a.ctype&&"number"===g.ctype?{ctype:"boolean",value:a.value.real===g.value.real&&a.value.imag===g.value.imag}:"string"===a.ctype&&"string"===g.ctype||"boolean"===a.ctype&&"boolean"===g.ctype?{ctype:"boolean",value:a.value===g.value}:"list"===a.ctype&&"list"===g.ctype?h.equals(a,g):"geo"===a.ctype&&"geo"===g.ctype?{ctype:"boolean",value:a.value===g.value}:{ctype:"boolean",value:!1}}},J={};J.vars=function(){var a={pi:m.real(Math.PI),"\u03c0":m.real(Math.PI),i:m.complex(0,1),"true":w.bool(!0),
+"false":w.bool(!1),"#":k,nil:h.turnIntoCSList([]),newline:w.string("\n"),tab:w.string("\t")},g=[],c;for(c in a)g[c]=[a[c]];return g}();J.isVariable=function(a){return this.vars.hasOwnProperty(a)};J.create=function(a){if(this.vars.hasOwnProperty(a))return this.vars[a];var g=[null];return this.vars[a]=g};J.newvar=function(a){a=this.vars[a];a.push(k);return a};J.removevar=function(a){var g=this.vars[a];0===g.length&&console.error("Removing non-existing "+a);g.pop();0===g.length&&console.warn("Removing last "+
+a)};J.setvar=function(a,g){var c=this.vars[a];0===c.length&&console.error("Setting non-existing variable "+a);void 0===g&&(console.error("Setting variable "+a+" to undefined value"),g=k);if("undefined"===g.ctype)c[c.length-1]=g;else{var b=g;null===b&&(b=k);c[c.length-1]=b}};J.undefinedWarning={};J.getvar=function(a){var g=this.vars[a]||[];0===g.length&&console.error("Getting non-existing variable "+a);g=g[g.length-1];if(null===g){if(v.csnames.hasOwnProperty(a))return{ctype:"geo",value:v.csnames[a]};
+console&&console.log&&void 0===this.undefinedWarning[a]&&(this.undefinedWarning[a]=!0,console.log("Warning: Accessing undefined variable: "+a));return k}return g};J.dump=function(a){var g=this.vars[a];console.log("*** Dump "+a);for(a=0;a<g.length;a++)console.log(a+":> "+Z(g[a]))};J.vstack=[];J.pushVstack=function(a){this.vstack.push(a)};J.popVstack=function(){this.vstack.pop()};J.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 ta={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,g){return"undefined"!==typeof v.csnames[a]?ta.getField(v.csnames[a],g):k},setGeoField:function(a,g,c){return"undefined"!==typeof v.csnames[a]?ta.setField(v.csnames[a],g,c):k},getField:function(a,g){var c;
+if("P"===a.kind){if("xy"===g)return c=h.dehom(a.homog),w.withUsage(c,"Point");if("homog"===g)return w.withUsage(a.homog,"Point");if("x"===g)return m.div(a.homog.value[0],a.homog.value[2]);if("y"===g)return m.div(a.homog.value[1],a.homog.value[2])}if("L"===a.kind||"S"===a.kind){if("homog"===g)return w.withUsage(a.homog,"Line");if("angle"===g)return c=h.eucangle(h.ey,a.homog),w.withUsage(c,"Angle");if("slope"===g)return m.neg(m.div(a.homog.value[0],a.homog.value[1]))}if("Tr"===a.kind&&"matrix"===g)return a.matrix;
+if("C"===a.kind){if("radius"===g){var b=a.matrix;c=b.value[0].value[0];var d=b.value[0].value[2],e=b.value[1].value[2],b=b.value[2].value[2];m.mult(c,c);d=m.div(d,c);e=m.div(e,c);c=m.div(b,c);return c=m.sqrt(m.sub(m.add(m.mult(d,d),m.mult(e,e)),c))}if("size"===g)return a.size;if("matrix"===g)return a.matrix;if("center"===g)return c=l._helper.CenterOfConic(a.matrix),c=h.dehom(c),w.withUsage(c,"Point");if("dualMatrix"===g)return h.normalizeMax(h.adjoint3(a.matrix))}if("Text"===a.kind){if("pressed"===
+g)return a.checkbox?w.bool(a.checkbox.checked):w.bool(!1);if("xy"===g)return c=h.dehom(a.homog),w.withUsage(c,"Point");if("homog"===g)return w.withUsage(a.homog,"Point");if("x"===g)return m.div(a.homog.value[0],a.homog.value[2]);if("y"===g)return m.div(a.homog.value[1],a.homog.value[2])}if("trace"===g)return w.bool(!!a.drawtrace);if(ta.generalFields[g])return(c=a[ta.generalFields[g]])&&c.ctype?c:"object"!==typeof c?w.wrap(c):k;if(a.behavior){if("mass"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.mass);
+if("radius"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.radius);if("charge"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.charge);if("friction"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.friction);if("vx"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.vx);if("vy"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.vy);if("v"===g&&"Mass"===a.behavior.type)return h.realVector([a.behavior.vx,a.behavior.vy]);if("fx"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.fx);
+if("fy"===g&&"Mass"===a.behavior.type)return m.real(a.behavior.fy);if("f"===g&&"Mass"===a.behavior.type)return h.realVector([a.behavior.fx,a.behavior.fy]);if("ldiff"===g&&"Spring"===a.behavior.type)return m.real(a.behavior.ldiff)}c=l[a.type]["get_"+g];return"function"===typeof c?c(a):k},setField:function(a,g,c){"color"===g&&h._helper.isNumberVecN(c,3)&&(a.color=c);"size"===g&&"number"===c.ctype&&(a.size=c);"alpha"===g&&"number"===c.ctype&&(a.alpha=c);"fillcolor"===g&&h._helper.isNumberVecN(c,3)&&
+(a.fillcolor=c);"fillalpha"===g&&"number"===c.ctype&&(a.fillalpha=c);"visible"===g&&"boolean"===c.ctype&&(a.visible=c.value);"pinned"===g&&"boolean"===c.ctype&&(a.pinned=c.value);"labeled"!==g&&"labelled"!==g||"boolean"!==c.ctype||(a.labeled=c.value);"printlabel"===g&&(a.printname=Z(c));"trace"===g&&"boolean"===c.ctype&&(c.value&&!a.drawtrace?(a.drawtrace=!0,yd(a)):a.drawtrace=c.value);"P"===a.kind&&a.movable&&("xy"===g&&h._helper.isNumberVecN(c,2)&&La(a,h.turnIntoCSList([c.value[0],c.value[1],m.real(1)]),
+"homog"),"xy"===g&&h._helper.isNumberVecN(c,3)&&La(a,c,"homog"),"x"===g&&"number"===c.ctype&&La(a,h.turnIntoCSList([m.mult(c,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]),"homog"),"y"===g&&"number"===c.ctype&&La(a,h.turnIntoCSList([a.homog.value[0],m.mult(c,a.homog.value[2]),a.homog.value[2]]),"homog"),"homog"===g&&h._helper.isNumberVecN(c,3)&&La(a,c,"homog"));"homog"===g&&"L"===a.kind&&a.movable&&h._helper.isNumberVecN(c,3)&&La(a,c,"homog");"Text"===a.kind&&("pressed"===g&&"boolean"===c.ctype&&
+a.checkbox&&(a.checkbox.checked=c.value),a.movable&&("xy"===g?h._helper.isNumberVecN(c,2)?a.homog=h.turnIntoCSList([c.value[0],c.value[1],m.real(1)]):h._helper.isNumberVecN(c,3)&&(a.homog=c):"homog"===g&&h._helper.isNumberVecN(c,3)?a.homog=c:"x"===g&&"number"===c.ctype?a.homog=h.turnIntoCSList([m.mult(c,a.homog.value[2]),a.homog.value[1],a.homog.value[2]]):"y"===g&&"number"===c.ctype&&(a.homog=h.turnIntoCSList([a.homog.value[0],m.mult(c,a.homog.value[2]),a.homog.value[2]]))));a.behavior&&("mass"===
+g&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.mass=c.value.real),"mass"===g&&"Sun"===a.behavior.type&&"number"===c.ctype&&(a.behavior.mass=c.value.real),"friction"===g&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.friction=c.value.real),"charge"===g&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.charge=c.value.real),"radius"===g&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.radius=c.value.real),"vx"===g&&"Mass"===a.behavior.type&&"number"===c.ctype&&
+(a.behavior.vx=c.value.real),"vy"===g&&"Mass"===a.behavior.type&&"number"===c.ctype&&(a.behavior.vy=c.value.real),"v"===g&&"Mass"===a.behavior.type&&h._helper.isNumberVecN(c,2)&&(a.behavior.vx=c.value[0].value.real,a.behavior.vy=c.value[1].value.real));g=l[a.type]["set_"+g];if("function"===typeof g)return g(a,c)},getuserData:function(a,g){var c;a.userData&&a.userData[g]&&(c=a.userData[g]);return c&&c.ctype?c:"object"!==typeof c?w.wrap(c):k},setuserData:function(a,g,c){a.userData||(a.userData={});
+a.userData[g]=c}};t.version$0=function(a,g){var c=["CindyJS"].concat(ve);return h.turnIntoCSList(c.map(w.wrap))};t.clearconsole$0=function(a,g){wa.clear()};t.err$1=function(a,g){var c="",b;"variable"===a[0].ctype?(c=a[0].name,b=J.getvar(a[0].name)):b=a[0];b=c+" ===> "+Z(z(b));ka(b);return k};t.errc$1=function(a,g){var c;"variable"===a[0].ctype?(c=z(J.getvar(a[0].name)),console.log(a[0].name+" ===> "+Z(c))):(c=z(a[0]),console.log(" ===> "+Z(c)));return k};t.print$1=function(a,g){wa.out(Z(z(a[0])),
+!0);return k};t.println$1=function(a,g){wa.out(Z(z(a[0])));return k};t.assert$2=function(a,g){var c=z(a[0]);if("boolean"===c.ctype){if(!1===c.value)return t.println$1([a[1]],g)}else ka("Condition for assert is not boolean");return k};t.dump$1=function(a,g){console.log(JSON.stringify(a[0]));return k};t.repeat$2=function(a,g){return t.repeat$3([a[0],null,a[1]],g)};t.repeat$3=function(a,g){var c=B(a[0]),b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);if("number"!==c.ctype)return k;var c=Math.round(c.value.real),
+d=1,h=1,e=c+1,f=!1,m=!1,l=!1,n;void 0!==g.start&&(n=z(g.start),"number"===n.ctype&&(f=!0,h=n.value.real));void 0!==g.step&&(n=z(g.step),"number"===n.ctype&&(l=!0,d=n.value.real));void 0!==g.stop&&(n=z(g.stop),"number"===n.ctype&&(m=!0,e=n.value.real));!f||m||l||(e=d*c+h);f||!m||l||(h=-d*(c-1)+e,e+=d);f||m||!l||(e=d*c+h);f&&m&&!l&&(d=(e-h)/(c-1),e+=d);f&&!m&&l&&(e=d*c+h);!f&&m&&l&&(h=-d*(c-1)+e,e+=d);f&&m&&l&&(e+=d);(h<=e&&0<d||h>=e&&0>d)&&f&&m&&l&&(c=Math.floor((e-h)/d));J.newvar(b);e=k;for(f=0;f<
+c;f++)J.setvar(b,{ctype:"number",value:{real:f*d+h,imag:0}}),e=z(a[2]);J.removevar(b);return e};t.while$2=function(a,g){for(var c=a[1],b=a[0],d=z(b),h=k;"list"!==d.ctype&&d.value;)h=z(c),d=z(b);return h};t.apply$2=function(a,g){return t.apply$3([a[0],null,a[1]],g)};t.apply$3=function(a,g){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var c=c.value,d=[];J.newvar(b);for(var h=0;h<c.length;h++)J.setvar(b,c[h]),d[h]=z(a[2]);J.removevar(b);return{ctype:"list",
+value:d}};t.forall$2=function(a,g){return t.forall$3([a[0],null,a[1]],g)};t.forall$3=function(a,g){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);c=c.value;J.newvar(b);for(var d,h=0;h<c.length;h++)J.setvar(b,c[h]),d=z(a[2]);J.removevar(b);return d};t.select$2=function(a,g){return t.select$3([a[0],null,a[1]],g)};t.select$3=function(a,g){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);
+var c=c.value,d=[];J.newvar(b);for(var h=0,e=0;e<c.length;e++){J.setvar(b,c[e]);var f=z(a[2]);"boolean"===f.ctype&&!0===f.value&&(d[h]=c[e],h++)}J.removevar(b);return{ctype:"list",value:d}};t.flatten$1=function(a,g){function c(a,g){return-1===g||"list"!==a.ctype?a:[].concat.apply([],a.value.map(function(a){return c(a,g-1)}))}var b=B(a[0]);if("list"!==b.ctype)return b;var d=g.levels;void 0===d?d=1:(d=z(d),d="number"===d.ctype?d.value.real:"string"===d.ctype&&"all"===d.value?-2:1);return{ctype:"list",
+value:c(b,d)}};t.createvar$1=function(a,g){"variable"===a[0].ctype&&J.newvar(a[0].name);return k};t.local=function(a,g){for(var c=0;c<a.length;c++)"variable"===a[c].ctype&&J.newvar(a[c].name);return k};t.removevar$1=function(a,g){var c=z(a[0]);"variable"===a[0].ctype&&J.removevar(a[0].name);return c};t.release=function(a,g){if(0===a.length)return k;for(var c=z(a[a.length-1]),b=0;b<a.length;b++)"variable"===a[b].ctype&&J.removevar(a[b].name);return c};t.regional=function(a,g){for(var c=0;c<a.length;c++)if("variable"===
+a[c].ctype){var b=a[c].name;J.newvar(b);J.pushVstack(b)}return k};t.genList=function(a,g){return h.turnIntoCSList(a.map(z))};D.assigntake=function(a,g){var c=a.args[0],b=z(c),d=B(a.args[1]),e=k;if("list"===b.ctype||"string"===b.ctype)d=Math.floor(d.value.real),0>d&&(d=b.value.length+d+1),0<d&&d<=b.value.length&&("list"===b.ctype?(e=b.value.slice(),e[d-1]=z(g),e=h.turnIntoCSList(e),b.userData&&(e.userData=b.userData)):(b=b.value,b=b.substring(0,d-1)+Z(z(g))+b.substring(d,b.length),e=w.string(b)));
+ab([c,e])};D.assigndot=function(a,g){var c=z(a.obj),b=a.key;"geo"===c.ctype&&b&&ta.setField(c.value,b,B(g));return k};D.assigncolon=function(a,g){var c=a.obj,b=z(c),d=Z(z(a.key));"_?_"===d&&(d=void 0);if("geo"===b.ctype&&d)ta.setuserData(b.value,d,B(g));else if("list"===b.ctype||"string"===b.ctype&&d){var h={},e;for(e in b)h[e]=b[e];if(h.userData){var b={},f;for(f in h.userData)b[f]=h.userData[f];h.userData=b}else h.userData={};h.userData[d]=B(g);ab([c,h])}else d?console.log("User data can only be assigned to geo objects and lists."):
+console.log("Key is undefined");return k};D.assignlist=function(a,g){var c=a.length,b=g.length;b<c&&(c=b);for(b=0;b<c;b++)ab([a[b],g[b]],[])};t.if$2=function(a,g){return t.if$3(a,g)};t.if$3=function(a,g){var c=B(a[0]);if("boolean"===c.ctype){if(!0===c.value)return z(a[1]);if(3===a.length)return z(a[2])}else ka("Condition for if is not boolean");return k};t.and$2=Pc;t.or$2=Qc;t.xor$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"boolean"===c.ctype&&"boolean"===b.ctype?{ctype:"boolean",value:c.value!==
+b.value}:k};t.not$1=function(a,g){var c=B(a[0]);return"boolean"===c.ctype?{ctype:"boolean",value:!c.value}:k};D.genericListMathGen=function(a,g,c){t[a+"$1"]=function(a,b){var q=z(a[0]);if("list"!==q.ctype)return k;q=q.value;if(0===q.length)return c;for(var d=q[0],h=1;h<q.length;h++)d=g(d,q[h]);return d};var b=a+"$3";t[a+"$2"]=function(a,c){return t[b]([a[0],null,a[1]])};t[b]=function(a,b){var q=B(a[0]);if("list"!==q.ctype)return k;q=q.value;if(0===q.length)return c;var d="#";null!==a[1]&&"variable"===
+a[1].ctype&&(d=a[1].name);J.newvar(d);J.setvar(d,q[0]);for(var h=z(a[2]),e=1;e<q.length;e++){J.setvar(d,q[e]);var f=z(a[2]),h=g(h,f)}J.removevar(d);return h}};D.genericListMathGen("product",w.mult,m.real(1));D.genericListMathGen("sum",w.add,m.real(0));D.genericListMathGen("max",w.max,k);D.genericListMathGen("min",w.min,k);t.max$2=function(a,g){var c=B(a[0]);if("list"===c.ctype)return t.max$3([c,null,a[1]]);var b=B(a[1]);return t.max$1([h.turnIntoCSList([c,b])])};t.min$2=function(a,g){var c=B(a[0]);
+if("list"===c.ctype)return t.min$3([c,null,a[1]]);var b=B(a[1]);return t.min$1([h.turnIntoCSList([c,b])])};t.add$2=Rc;t.sub$2=jc;t.mult$2=Sc;t.div$2=Tc;t.mod$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype?m.mod(c,b):k};t.pow$2=Uc;t.exp$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.exp(c):k};t.sin$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.sin(c):k};t.sqrt$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.sqrt(c):k};D.laguerre=function(a,
+g,c){if("list"!==a.ctype)return k;var b=a.value.length-1,d;for(d=0;d<=b;d++)if("number"!==a.value[d].ctype)return k;if("number"!==g.ctype)return k;for(var h=[1,.3141,.5926,.5358,.9793,.2385,.6264,.3383,.2795,.0288],e,f,l,n=1;n<=c;n++){f=l=m.zero;e=a.value[b];for(d=b-1;0<=d;d--)l=m.add(f,m.mult(l,g)),f=m.add(e,m.mult(f,g)),e=m.add(a.value[d],m.mult(e,g));if(m._helper.isLessThan(m.abs(e),m.real(1E-14)))break;d=m.div(f,e);f=m.mult(d,d);e=m.sub(f,m.div(m.mult(m.real(2),l),e));l=m.sqrt(m.mult(m.real(b-
+1),m.sub(m.mult(m.real(b),e),f)));e=m.add(d,l);d=m.sub(d,l);m._helper.isLessThan(m.abs(e),m.abs(d))&&(e=d);d=m._helper.isLessThan(m.real(1E-14),m.abs(e))?m.div(m.real(b),e):m.mult(m.add(m.abs(g),m.one),m.complex(Math.cos(n),Math.sin(n)));if(m._helper.isLessThan(m.abs(d),m.real(1E-14)))break;0===n%20&&n<c-19&&(d=m.mult(d,m.real(h[Math.floor(n/20)])));g=m.sub(g,d)}return g};D.quadratic_roots=function(a){if("list"!==a.ctype)return k;var g=a.value[2],c=a.value[1];a=a.value[0];if(m._helper.isZero(a))return[m.zero,
+m.neg(m.div(c,g))];var b=m.sqrt(m.sub(m.mult(c,c),m.mult(m.real(4),m.mult(g,a))));0<=m.re(c)&&(b=m.neg(b));return[m.div(m.sub(b,c),m.mult(m.real(2),g)),m.div(m.mult(m.real(2),a),m.sub(b,c))]};D.roots=function(a){var g=[],c=a,b=a.value.length-1;if(0>=b)return h.turnIntoCSList([]);if(m._helper.isZero(a.value[b]))return g=D.roots(h.turnIntoCSList(a.value.slice(0,b))),h.append(g,m.infinity);if(1===b)g[0]=m.neg(m.div(a.value[0],a.value[1]));else if(2===b)g=D.quadratic_roots(a);else{for(var d=0;d<b-2;d++){g[d]=
+D.laguerre(a,m.zero,200);g[d]=D.laguerre(c,g[d],1);var e=[];e[b-d]=a.value[b-d];for(var f=b-d;0<f;f--)e[f-1]=m.add(a.value[f-1],m.mult(e[f],g[d]));e.shift();a=h.turnIntoCSList(e)}a=D.quadratic_roots(a);g[b-2]=a[0];g[b-1]=a[1]}return h.turnIntoCSList(g)};t.roots$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){for(var b=0;b<c.value.length;b++)if("number"!==c.value[b].ctype)return k;c=D.roots(c);return h.sort1(c)}return k};t.autodiff$3=function(a,g){var c="x",b;if("function"===a[0].ctype)b=db[a[0].oper].body,
+c=a[0].args[0].name;else if("function"===typeof a[0].impl)b=a[0];else return ka("could not parse function"),k;var d=B(a[1]),h=B(a[2]);if(1>h.value.real)return ka("grade cant be < 1"),k;h=m.add(h,m.real(1));return P.autodiff(b,c,d,h)};t.cos$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.cos(c):k};t.tan$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.tan(c):k};t.arccos$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.arccos(c):k};t.arcsin$1=function(a,g){var c=B(a[0]);return"number"===
+c.ctype?m.arcsin(c):k};t.arctan$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.arctan(c):k};t.arctan2$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===c.ctype&&"number"===b.ctype?m.arctan2(c,b):k};t.arctan2$1=function(a,g){var c=B(a[0]);if("list"===c.ctype&&2===c.value.length){if(c=c.value,"number"===c[0].ctype&&"number"===c[1].ctype)return t.arctan2$2(c,g)}else if("number"===c.ctype)return m.arctan2(c);return k};t.log$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.log(c):
+k};D.recursiveGen=function(a){var g=m[a],c=h[a];t[a+"$1"]=function(a,b){var d=B(a[0]);return"number"===d.ctype?g(d):"list"===d.ctype?c(d):k}};D.recursiveGen("im");D.recursiveGen("re");D.recursiveGen("conjugate");D.recursiveGen("round");D.recursiveGen("ceil");D.recursiveGen("floor");D.recursiveGen("abs");t.abs_infix=t.abs$1;t.random$0=function(a,g){return m.real(m._helper.rand())};t.random$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?m.complex(c.value.real*m._helper.rand(),c.value.imag*m._helper.rand()):
+k};t.seedrandom$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&m._helper.seedrandom(c.value.real);return k};t.randomnormal$0=function(a,g){return m.real(m._helper.randnormal())};t.randominteger$1=function(a,g){var c=B(a[0]);if("number"===c.ctype){var b=c.value.real|0,c=c.value.imag|0,b=b*m._helper.rand()|0,c=c*m._helper.rand()|0;return m.complex(b,c)}return k};t.randomint$1=t.randominteger$1;t.randombool$0=function(a,g){return.5<m._helper.rand()?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};
+t.isreal$1=function(a,g){var c=z(a[0]);return"number"===c.ctype&&m._helper.isAlmostReal(c)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isinteger$1=function(a,g){var c=z(a[0]);return"number"===c.ctype&&m._helper.isAlmostReal(c)&&c.value.real===Math.floor(c.value.real)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.iseven$1=function(a,g){var c=z(a[0]);return"number"===c.ctype&&m._helper.isAlmostReal(c)&&c.value.real/2===Math.floor(c.value.real/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",
+value:!1}};t.isodd$1=function(a,g){var c=z(a[0]);return"number"===c.ctype&&m._helper.isAlmostReal(c)&&(c.value.real-1)/2===Math.floor((c.value.real-1)/2)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.iscomplex$1=function(a,g){return"number"===z(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isstring$1=function(a,g){return"string"===z(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.islist$1=function(a,g){return"list"===z(a[0]).ctype?{ctype:"boolean",
+value:!0}:{ctype:"boolean",value:!1}};t.ismatrix$1=function(a,g){var c=z(a[0]);return-1!==h._helper.colNumb(c)?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.iscircle$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&"C"===c.value.kind&&"Circle"===c.value.matrix.usage?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isconic$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&"C"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isline$1=function(a,g){var c=
+z(a[0]);return"geo"===c.ctype&&"L"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.ispoint$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&"P"===c.value.kind?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isgeometric$1=function(a,g){return"geo"===z(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isnumbermatrix$1=function(a,g){var c=z(a[0]);return h.isNumberMatrix(c)};t.isnumbervector$1=function(a,g){var c=z(a[0]);return h.isNumberVector(c)};
+t.issun$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Sun"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.ismass$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Mass"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isspring$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Spring"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",
+value:!1}};t.isbouncer$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&void 0!==c.value.behavior&&"Bouncer"===c.value.behavior.type?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};t.isundefined$1=function(a,g){return"undefined"===z(a[0]).ctype?{ctype:"boolean",value:!0}:{ctype:"boolean",value:!1}};var Od={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"};t.algorithm$1=function(a,g){var c=z(a[0]);if("geo"===c.ctype){var c=c.value,b=c.type,d=B(g.compatibility);"string"===
+d.ctype&&/^cinderella$/i.test(d.value)&&(/^Select/.test(b)&&(c=v.csnames[c.args[0]],b=c.type),Od.hasOwnProperty(b)?b=Od[b]:"CircleMr"===b&&(b=c.pinned?"CircleByFixedRadius":"CircleByRadius"));return w.string(b)}return k};t.inputs$1=function(a,g){var c=z(a[0]);if("geo"===c.ctype){var c=c.value,b=c.type,d=[];c.args&&(d=c.args.map(function(a){return{ctype:"geo",value:v.csnames[a]}}));if(/^Select/.test(b)||l[b].isMovable)switch(c.kind){case "P":case "L":d.push(c.homog);break;case "C":d.push(c.matrix)}return h.turnIntoCSList(d)}return k};
+t.moveto$2=function(a,g){var c=z(a[0]),b=B(a[1]);"geo"===c.ctype&&(c=c.value,h._helper.isNumberVecN(b,2)?ta.setField(c,"xy",b):h._helper.isNumberVecN(b,3)&&ta.setField(c,"homog",b));return k};t.continuefromhere$0=function(a,g){zb();return k};t.matrixrowcolumn$1=function(a,g){var c=z(a[0]);return-1!==h._helper.colNumb(c)?h.realVector([c.value.length,c.value[0].value.length]):k};t.rowmatrix$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.turnIntoCSList([c]):k};t.columnmatrix$1=function(a,g){var c=
+z(a[0]);return"list"===c.ctype?h.turnIntoCSList(c.value.map(function(a){return h.turnIntoCSList([a])})):k};t.submatrix$3=function(a,g){var c=z(a[0]),b=z(a[1]),d=z(a[2]);if("list"===c.ctype&&"number"===b.ctype&&"number"===d.ctype){var e=Math.round(b.value.real),b=Math.round(d.value.real),c=c.value.slice();0<b&&b<=c.length&&c.splice(b-1,1);var f=!0,c=c.map(function(a){if("list"!==a.ctype)f=!1;else return a=a.value.slice(),0<e&&e<=a.length&&a.splice(e-1,1),h.turnIntoCSList(a)});return f?h.turnIntoCSList(c):
+k}return k};t.complex$1=function(a,g){var c,b,d;d=B(a[0]);if("list"===d.ctype&&h.isNumberVector(d)){if(2===d.value.length)return c=d.value[0],b=d.value[1],m.complex(c.value.real-b.value.imag,b.value.real+c.value.imag);if(3===d.value.length)return c=d.value[0],b=d.value[1],d=d.value[2],c=m.div(c,d),b=m.div(b,d),m.complex(c.value.real-b.value.imag,b.value.real+c.value.imag)}return k};t.gauss$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?h.realVector([c.value.real,c.value.imag]):k};t.cross$2=
+$c;t.crossratio$4=function(a,g){var c=z(a[0]),b=z(a[1]),d=z(a[2]),e=z(a[3]),f=K(c),l=K(b),n=K(d),p=K(e);return f!==k&&l!==k&&n!==k&&p!==k?h.crossratio3(f,l,n,p,h.ii):"number"===c.ctype&&"number"===b.ctype&&"number"===d.ctype&&"number"===e.ctype?m.div(m.mult(m.sub(c,d),m.sub(b,e)),m.mult(m.sub(c,e),m.sub(b,d))):k};t.para$2=function(a,g){var c=B(a[0]),b=B(a[1]),d=K(c),e=K(b);if(c!==k&&b!==k){var b=b.usage,f=d,m=e;if("Line"===c.usage||"Point"===b)f=e,m=d;c=h.cross(h.cross(h.linfty,m),f);return w.withUsage(c,
+"Line")}return k};t.perp$2=function(a,g){var c=B(a[0]),b=B(a[1]),d=K(c),e=K(b);if(c!==k&&b!==k){var f=b.usage||e.usage,b=d,l=e;if("Line"===(c.usage||d.usage)||"Point"===f)b=e,l=d;c=h.turnIntoCSList([l.value[0],l.value[1],m.zero]);c=h.cross(c,b);return w.withUsage(c,"Line")}return k};t.perp$1=function(a,g){var c=B(a[0]);return h._helper.isNumberVecN(c,2)?h.turnIntoCSList([m.neg(c.value[1]),c.value[0]]):k};t.parallel$2=t.para$2;t.perpendicular$2=t.perp$2;t.perpendicular$1=t.perp$1;t.meet$2=function(a,
+g){var c=K(a[0]),b=K(a[1]);return c!==k&&b!==k?(c=h.cross(c,b),w.withUsage(c,"Point")):k};t.join$2=function(a,g){var c=K(a[0]),b=K(a[1]);return c!==k&&b!==k?(c=h.cross(c,b),w.withUsage(c,"Line")):k};t.dist$2=function(a,g){var c=B(a[0]),b=B(a[1]),c=jc([c,b],[]);return t.abs$1([c],[])};t.dist_infix=t.dist$2;t.point$1=function(a,g){var c=z(a[0]);return h._helper.isNumberVecN(c,3)||h._helper.isNumberVecN(c,2)?w.withUsage(c,"Point"):c};t.line$1=function(a,g){var c=z(a[0]);return h._helper.isNumberVecN(c,
+3)?w.withUsage(c,"Line"):c};t.det$3=function(a,g){var c=K(a[0]),b=K(a[1]),d=K(a[2]);if(c!==k&&b!==k&&d!==k)return h.det3(c,b,d)};t.det$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==b&&b===c.value.length)return h.det(c)}return k};t.eig$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==b&&b===c.value.length)return h.eig(c)}return k};t.eigenvalues$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);
+if(-1!==b&&b===c.value.length)return h.eig(c,!1).value[0]}return k};t.rank$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==b&&b===c.value.length)return h.rank(c,g.precision)}return k};t.kernel$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==b&&b===c.value.length)return c=h.nullSpace(c,g.precision),h.transpose(c)}return k};t.eigenvectors$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==
+b&&b===c.value.length)return h.eig(c).value[1]}return k};t.area$3=function(a,g){var c=K(a[0]),b=K(a[1]),d=K(a[2]);if(c!==k&&b!==k&&d!==k){var e=c.value[2],f=b.value[2],l=d.value[2];if(!m._helper.isAlmostZero(e)&&!m._helper.isAlmostZero(f)&&!m._helper.isAlmostZero(l))return c=h.scaldiv(e,c),b=h.scaldiv(f,b),d=h.scaldiv(l,d),c=h.det3(c,b,d),m.realmult(.5,c)}return k};t.inverse$1=function(a,g){var c=B(a[0]);if("list"===c.ctype){var b=h._helper.colNumb(c);if(-1!==b&&b===c.value.length)return h.inverse(c)}return k};
+t.linearsolve$2=function(a,g){var c=B(a[0]),b=B(a[1]);if("list"===c.ctype){var d=h._helper.colNumb(c);if(-1!==d&&d===c.value.length&&h._helper.isNumberVecN(b,d))return h.linearsolve(c,b)}return k};var be=[[[]],[[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]]];t.mincostmatching$1=function(a,g){var c=z(a[0]);if(h.isNumberMatrix(c).value){var b=c.value.length,d=h._helper.colNumb(c),e=b<d?d:b,f,l,n=Array(e);for(f=0;f<e;++f)for(n[f]=Array(e),l=0;l<e;++l)n[f][l]=f<b&&l<d?c.value[f].value[l].value.real:0;c=uc(n);e=Array(b);for(f=0;f<b;++f)l=c[f],e[f]=l<d?m.real(l+1):m.real(0);return h.turnIntoCSList(e)}return k};t.take$2=vc;t.length$1=function(a,g){var c=z(a[0]);return"list"===c.ctype||"string"===c.ctype?m.real(c.value.length):k};t.pairs$1=
+function(a,g){var c=z(a[0]);return"list"===c.ctype?h.pairs(c):k};t.triples$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.triples(c):k};t.cycle$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.cycle(c):k};t.consecutive$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.consecutive(c):k};t.reverse$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.reverse(c):k};t.directproduct$2=function(a,g){var c=z(a[0]),b=z(a[1]);return"list"===c.ctype&&"list"===b.ctype?h.directproduct(c,b):
+k};t.concat$2=ad;t.common$2=bd;t.remove$2=cd;t.append$2=dd;t.prepend$2=ed;t.contains$2=function(a,g){var c=z(a[0]),b=z(a[1]);return"list"===c.ctype?h.contains(c,b):k};t.sort$2=function(a,g){return t.sort$3([a[0],null,a[1]],g)};t.sort$3=function(a,g){var c=B(a[0]);if("list"!==c.ctype)return k;var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var c=c.value,d=[];J.newvar(b);var h;for(h=0;h<c.length;h++)J.setvar(b,c[h]),d[h]={val:c[h],result:z(a[2])};J.removevar(b);d.sort(w.compareResults);
+b=[];for(h=0;h<c.length;h++)b[h]=d[h].val;return{ctype:"list",value:b}};t.sort$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.sort1(c):k};t.set$1=function(a,g){var c=z(a[0]);return"list"===c.ctype?h.set(c):k};t.combinations$2=function(a,g){function c(a,g){a===f?n.push(h.turnIntoCSList(l.slice())):g<e&&(l[a]=b.value[g],c(a+1,g+1),c(a,g+1))}var b=z(a[0]),d=z(a[1]),e,f,l,n;if("number"===d.ctype){f=d.value.real|0;if("number"===b.ctype){e=b.value.real|0;e-f<f&&(f=e-f);if(0>f)return m.real(0);if(0===
+f)return m.real(1);if(1===f)return b;for(var p=d=1,r=1;r<=f;++r)var t=e-f+r|0,u=r|0,v=wc(t,u)|0,t=t/v|0,u=u/v|0,v=wc(d,u)|0,d=d/v|0,u=u/v|0,v=wc(t,p)|0,t=t/v|0,p=p/v|0,d=d*t|0,p=p*u|0;return m.real(d/p)}if("list"===b.ctype){e=b.value.length;if(0>f||f>e)return h.turnIntoCSList([]);if(0===f)return h.turnIntoCSList([h.turnIntoCSList([])]);if(f===e)return h.turnIntoCSList([b]);n=[];l=Array(f);c(0,0);return h.turnIntoCSList(n)}}return k};t.zeromatrix$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===
+c.ctype&&"number"===b.ctype?h.zeromatrix(c,b):k};t.zerovector$1=function(a,g){var c=B(a[0]);return"number"===c.ctype?h.zerovector(c):k};t.transpose$1=function(a,g){var c=B(a[0]);return"list"===c.ctype&&-1!==h._helper.colNumb(c)?h.transpose(c):k};t.row$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===b.ctype&&"list"===c.ctype&&-1!==h._helper.colNumb(c)?h.row(c,b):k};t.column$2=function(a,g){var c=B(a[0]),b=B(a[1]);return"number"===b.ctype&&"list"===c.ctype&&-1!==h._helper.colNumb(c)?h.column(c,
+b):k};t.dict$0=function(a,g){var c=Na.create(),b;for(b in g)g.hasOwnProperty(b)&&Na.put(c,w.string(b),z(g[b]));return c};t.put$3=function(a,g){var c=z(a[0]),b=z(a[1]),d=z(a[2]);return"dict"===c.ctype?(c=Na.clone(c),Na.put(c,b,d),c):k};t.get$2=function(a,g){var c=z(a[0]),b=z(a[1]);return"dict"===c.ctype?Na.get(c,b,k):k};t.red$1=function(a,g){var c=z(a[0]);return"number"===c.ctype?h.realVector([Math.min(1,Math.max(0,c.value.real)),0,0]):k};t.green$1=function(a,g){var c=z(a[0]);return"number"===c.ctype?
+h.realVector([0,Math.min(1,Math.max(0,c.value.real)),0]):k};t.blue$1=function(a,g){var c=z(a[0]);return"number"===c.ctype?h.realVector([0,0,Math.min(1,Math.max(0,c.value.real))]):k};t.gray$1=function(a,g){var c=z(a[0]);return"number"===c.ctype?(c=Math.min(1,Math.max(0,c.value.real)),h.realVector([c,c,c])):k};t.grey$1=t.gray$1;D.HSVtoRGB=function(a,g,c){var b,d,e,f,k,m;a&&void 0===g&&void 0===c&&(g=a.s,c=a.v,a=a.h);f=Math.floor(6*a);k=6*a-f;a=c*(1-g);m=c*(1-k*g);g=c*(1-(1-k)*g);switch(f%6){case 0:b=
+c;d=g;e=a;break;case 1:b=m;d=c;e=a;break;case 2:b=a;d=c;e=g;break;case 3:b=a;d=m;e=c;break;case 4:b=g;d=a;e=c;break;case 5:b=c,d=a,e=m}return h.realVector([b,d,e])};t.hue$1=function(a,g){var c=z(a[0]);return"number"===c.ctype?(c=c.value.real,c-=Math.floor(c),D.HSVtoRGB(c,1,1)):k};D.shapeconvert=function(a){var g,c;if("circle"===a.type){g=a.value.value[0];g=w.div(g,g.value[2]);var b=g.value[0].value.real,d=g.value[1].value.real;a=a.value.value[1].value.real;c=Array(125);var h=2*Math.PI/125;for(g=0;125>
+g;g++)c[g]={X:b+Math.cos(g*h)*a,Y:d+Math.sin(g*h)*a};return[c]}if("polygon"===a.type){b=[];for(g=0;g<a.value.length;g++){d=a.value[g];c=[];for(h=0;h<d.length;h++)c[h]={X:d[h].X,Y:d[h].Y};b[g]=c}return b}};D.shapeop=function(a,g,c){a=D.shapeconvert(a);var b=D.shapeconvert(g);ClipperLib.JS.ScaleUpPaths(a,1E3);ClipperLib.JS.ScaleUpPaths(b,1E3);g=new ClipperLib.Clipper;g.AddPaths(a,ClipperLib.PolyType.ptSubject,!0);g.AddPaths(b,ClipperLib.PolyType.ptClip,!0);var b=a=ClipperLib.PolyFillType.pftNonZero,
+d=new ClipperLib.Paths;g.Execute(c,d,a,b);ClipperLib.JS.ScaleDownPaths(d,1E3);return{ctype:"shape",type:"polygon",value:d}};D.shapecommon=function(a,g){return D.shapeop(a,g,ClipperLib.ClipType.ctIntersection)};D.shaperemove=function(a,g){return D.shapeop(a,g,ClipperLib.ClipType.ctDifference)};D.shapeconcat=function(a,g){return D.shapeop(a,g,ClipperLib.ClipType.ctUnion)};t.key$0=function(a,g){return{ctype:"string",value:Yc}};t.keycode$0=function(a,g){return m.real(Zc)};t.mouse$0=function(a,g){return h.realVector([ra[0],
+ra[1]])};t.mover$0=function(a,g){if(ja&&ja.mover)return{ctype:"geo",value:ja.mover};console.log("Not moving anything at the moment");return k};t.translate$1=function(a,g){var c=B(a[0]);"list"===c.ctype&&h.isNumberVector(c)&&2===c.value.length&&y.translate(c.value[0].value.real,c.value[1].value.real);return k};t.rotate$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.rotate(c.value.real);return k};t.scale$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.scale(c.value.real);return k};t.greset$0=
+function(a,g){var c=eb.stack.length;y.greset();for(var b=0;b<c;b++)A.restore();return k};t.gsave$0=function(a,g){y.gsave();A.save();return k};t.grestore$0=function(a,g){y.grestore();A.restore();return k};t.color$1=function(a,g){var c=B(a[0]);"list"===c.ctype&&h.isNumberVector(c).value&&y.setcolor(c);return k};t.linecolor$1=function(a,g){var c=B(a[0]);"list"===c.ctype&&h.isNumberVector(c).value&&y.setlinecolor(c);return k};t.pointcolor$1=function(a,g){var c=B(a[0]);"list"===c.ctype&&h.isNumberVector(c).value&&
+y.setpointcolor(c);return k};t.alpha$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.setalpha(c);return k};t.pointsize$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.setpointsize(c);return k};t.linesize$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.setlinesize(c);return k};t.textsize$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&y.settextsize(c);return k};t.playanimation$0=function(a,g){M();return k};t.pauseanimation$0=function(a,g){Ga();return k};t.stopanimation$0=function(a,g){Ha();
+return k};t.text$1=function(a,g){var c=B(a[0]);return w.string(Z(c))};t.replace$3=function(a,g){var c=z(a[0]),b=z(a[1]),d=z(a[2]);if("string"===c.ctype&&"string"===b.ctype&&"string"===d.ctype)return c=c.value,b=b.value.replace(/[^A-Za-z0-9]/g,"\\$&"),d=d.value.replace(/\$/g,"$$$$"),c=c.replace(new RegExp(b,"g"),d),{ctype:"string",value:c}};t.replace$2=function(a,g){function c(a,c,g){var h="";d=b=-1;for(var e=0;e<c.length;e++){var f=c[e][0],k=a.indexOf(f,g);-1!==k&&(-1===b?(h=f,b=k,d=e):k<b&&(h=f,
+b=k,d=e))}return h}var b,d,h,e=z(a[0]);h=z(a[1]);if("string"===e.ctype&&"list"===h.ctype){for(var e=e.value,f=[],m=0;m<h.value.length;m++){var l=h.value[m];"list"===l.ctype&&2===l.value.length&&"string"===l.value[0].ctype&&"string"===l.value[1].ctype&&(f[f.length]=[l.value[0].value,l.value[1].value])}b=-1;for(h=c(e,f,0);-1!==b;)e=e.substring(0,b)+f[d][1]+e.substring(b+h.length,e.length),h=b+f[d][1].length,h=c(e,f,h);return{ctype:"string",value:e}}return k};t.substring$3=function(a,g){var c=z(a[0]),
+b=B(a[1]),d=B(a[2]);return"string"===c.ctype&&"number"===b.ctype&&"number"===d.ctype?{ctype:"string",value:c.value.substring(Math.floor(b.value.real),Math.floor(d.value.real))}:k};t.tokenize$2=function(a,g){var c=z(a[0]),b=z(a[1]);if("string"===c.ctype&&"string"===b.ctype)return t.tokenize$2([c,h.turnIntoCSList([b])],g);if("string"===c.ctype&&"list"===b.ctype){c=c.value;if(0===b.value.length){b=!0;if(void 0!==g.autoconvert){var d=z(g.autoconvert);"boolean"===d.ctype&&(b=d.value)}return b&&""!==c&&
+(b=Number(c),!isNaN(b))?m.real(b):w.string(c)}var d=b.value[0],e=h.turnIntoCSList(b.value.slice(1)),c=c.split(d.value);return h.turnIntoCSList(c.map(function(a){return t.tokenize$2([w.string(a),e],g)}))}return k};t.indexof$2=function(a,g){var c=z(a[0]),b=z(a[1]);return"string"===c.ctype&&"string"===b.ctype?(c=c.value.indexOf(b.value),m.real(c+1)):k};t.indexof$3=function(a,g){var c=z(a[0]),b=z(a[1]),d=z(a[2]);return"string"===c.ctype&&"string"===b.ctype&&"number"===d.ctype?(c=c.value.indexOf(b.value,
+Math.round(d.value.real)-1),m.real(c+1)):k};t.parse$1=function(a,g){var c=z(a[0]);return"string"===c.ctype?(c=Ua(c.value),z(c)):k};t.unicode$1=function(a,g){var c;c=z(a[0]);var b=16;if(g.base){var d=z(g.base);"number"===d.ctype&&(b=d.value.real)}if("string"===c.ctype)c=parseInt(c.value,b);else if("number"===c.ctype)c=c.value.real;else return k;"undefined"!==typeof String.fromCodePoint?c=String.fromCodePoint(c):65535>=c?c=String.fromCharCode(c):(c-=65536,c=String.fromCharCode((c>>10)+55296,(c&1023)+
+56320));return w.string(c)};t.international$1=function(a,g){return t.international$2([a[0],null],g)};t.international$2=function(a,g){var c=z(a[0]);if("string"!==c.ctype)return k;var b=(p.translations||{})[p.language||"en"]||{};if(!b.hasOwnProperty(c.value))return c;var d=b[c.value];if("string"===typeof d)return w.string(d);if(null===a[1])return c;var h=z(a[1]),h="number"===h.ctype?h.value.real:0,b=(b._pluralFormFunction||ce)(h);return b<d.length?w.string(d[b]):c};t.currentlanguage$0=function(a,g){return w.string(p.language||
+"en")};D.basismap=function(a,g,c,b){var d=h.turnIntoCSList([a,g,c]),d=h.adjoint3(h.transpose(d));b=w.mult(d,b);d=h.turnIntoCSList([w.mult(b.value[0],a),w.mult(b.value[1],g),w.mult(b.value[2],c)]);return h.transpose(d)};t.map$8=function(a,g){var c=K(a[0]),b=K(a[1]),d=K(a[2]),e=K(a[3]),f=K(a[4]),m=K(a[5]),l=K(a[6]),n=K(a[7]);return f!==k&&m!==k&&l!==k&&n!==k&&c!==k&&b!==k&&d!==k&&e!==k?(f=D.basismap(f,m,l,n),c=D.basismap(c,b,d,e),c=w.mult(f,h.adjoint3(c)),h.normalizeMax(c)):k};t.map$6=function(a,g){var c=
+K(a[0]),b=K(a[1]),d=K(a[2]),e=h.realVector([0,0,1]),f=h.cross,m=f(f(d,f(e,f(c,b))),f(b,f(e,f(c,d)))),l=K(a[3]),n=K(a[4]),p=K(a[5]),e=f(f(p,f(e,f(l,n))),f(n,f(e,f(l,p))));return l!==k&&n!==k&&p!==k&&e!==k&&c!==k&&b!==k&&d!==k&&m!==k?(l=D.basismap(l,n,p,e),c=D.basismap(c,b,d,m),c=w.mult(l,h.adjoint3(c)),h.normalizeMax(c)):k};t.map$4=function(a,g){var c=h.ii,b=h.jj,d=K(a[0]),e=K(a[1]),f=K(a[2]),m=K(a[3]);return f!==k&&m!==k&&d!==k&&e!==k?(f=D.basismap(f,m,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,h.adjoint3(c)),
+h.normalizeMax(c)):k};t.map$2=function(a,g){var c=h.ii,b=h.jj,d=K(a[0]),e=w.add(h.realVector([1,0,0]),d),f=K(a[1]),m=w.add(h.realVector([1,0,0]),f);return f!==k&&m!==k&&d!==k&&e!==k?(f=D.basismap(f,m,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,h.adjoint3(c)),h.normalizeMax(c)):k};t.pointreflect$1=function(a,g){var c=h.ii,b=h.jj,d=K(a[0]),e=w.add(h.realVector([1,0,0]),d),f=w.add(h.realVector([-1,0,0]),d);return f!==k&&d!==k&&e!==k?(f=D.basismap(d,f,c,b),c=D.basismap(d,e,c,b),c=w.mult(f,h.adjoint3(c)),h.normalizeMax(c)):
+k};t.linereflect$1=function(a,g){var c=h.ii,b=h.jj,d=K(a[0]),e=h.realVector([Math.random(),Math.random(),Math.random()]),f=h.realVector([Math.random(),Math.random(),Math.random()]),e=h.cross(e,d),f=h.cross(f,d);return d!==k&&e!==k?(d=D.basismap(e,f,c,b),c=D.basismap(e,f,b,c),c=w.mult(d,h.adjoint3(c)),h.normalizeMax(c)):k};D.extractPointVec=function(a){var g={ok:!1};if("geo"===a.ctype){var c=a.value;if("P"===c.kind)return g.x=ta.getField(c,"x"),g.y=ta.getField(c,"y"),g.z=m.real(1),g.ok=!0,g}if("list"!==
+a.ctype)return g;var b=a.value;if(2===b.length&&(a=b[0],c=b[1],"number"===a.ctype&&"number"===c.ctype))return g.x=a,g.y=c,g.z=m.real(1),g.ok=!0,g;3===b.length&&(a=b[0],c=b[1],b=b[2],"number"===a.ctype&&"number"===c.ctype&&"number"===b.ctype&&(g.x=m.div(a,b),g.y=m.div(c,b),g.z=m.real(1),g.ok=!0));return g};t.polygon$1=function(a,g){var c=z(a[0]);if("list"===c.ctype){for(var b=[],d=0;d<c.value.length;d++){var h=D.extractPoint(c.value[d]);if(!h.ok)return k;b[d]={X:h.x,Y:h.y}}return{ctype:"shape",type:"polygon",
+value:[b]}}return k};t.circle$2=function(a,g){var c=B(a[0]),b=B(a[1]),c=D.extractPointVec(c);if(!c.ok||"number"!==b.ctype)return k;c=h.turnIntoCSList([c.x,c.y,c.z]);return{ctype:"shape",type:"circle",value:h.turnIntoCSList([c,b])}};t.screen$0=function(a,g){var c=y.drawingstate.initialmatrix,b=function(a,g){var b=a-c.tx,d=g+c.ty;return{X:(b*c.d-d*c.b)/c.det,Y:-(-b*c.c+d*c.a)/c.det}};return{ctype:"shape",type:"polygon",value:[[b(0,0),b(ca,0),b(ca,da),b(0,da)]]}};t.halfplane$2=function(a,g){var c=B(a[0]),
+b=B(a[1]),d=K(c),e=K(b);if(c!==k&&b!==k){var f=b.usage,b=d,l=e;if("Line"===c.usage||"Point"===f)b=e,l=d;c=h.turnIntoCSList([l.value[0],l.value[1],m.zero]);c=h.cross(c,b);c=h.cross(l,c);c=w.div(c,c.value[2]);b=w.div(b,b.value[2]);b=h.sub(b,c);l=h.abs(b);b=w.div(b,l);l=c.value[0].value.real;c=c.value[1].value.real;d=1E3*b.value[0].value.real;b=1E3*b.value[1].value.real;return{ctype:"shape",type:"polygon",value:[[{X:l+b/2,Y:c-d/2},{X:l+b/2+d,Y:c-d/2+b},{X:l-b/2+d,Y:c+d/2+b},{X:l-b/2,Y:c+d/2}]]}}return k};
+t.element$1=function(a,g){var c=z(a[0]);return"string"===c.ctype&&v.csnames.hasOwnProperty(c.value)?{ctype:"geo",value:v.csnames[c.value]}:k};D.all$1=function(a,g){var c=z(a[0]);return"geo"===c.ctype&&c.value.incidences?h.ofGeos(c.value.incidences.map(function(a){return v.csnames[a]}).filter(g)):h.nil};t.allpoints$0=function(a,g){return h.ofGeos(v.points)};t.allpoints$1=function(a,g){return D.all$1(a,function(a){return"P"===a.kind})};t.allmasses$0=function(a,g){return h.ofGeos(ma)};t.allmasses$1=
+function(a,g){return D.all$1(a,function(a){return"P"===a.kind&&a.behavior&&"Mass"===a.behavior.type})};t.allsprings$0=function(a,g){return h.ofGeos(Hc)};t.allsprings$1=function(a,g){return D.all$1(a,function(a){return"S"===a.kind&&a.behavior&&"Spring"===a.behavior.type})};t.alllines$0=function(a,g){return h.ofGeos(v.lines)};t.alllines$1=function(a,g){return D.all$1(a,function(a){return"L"===a.kind||"S"===a.kind})};t.allsegments$0=function(a,g){return h.ofGeos(v.lines.filter(function(a){return"S"===
+a.kind}))};t.allsegments$1=function(a,g){return D.all$1(a,function(a){return"S"===a.kind})};t.allconics$0=function(a,g){return h.ofGeos(v.conics)};t.allconics$1=function(a,g){return D.all$1(a,function(a){return"C"===a.kind})};t.allcircles$0=function(a,g){return h.ofGeos(v.conics.filter(function(a){return"Circle"===a.matrix.usage}))};t.allcircles$1=function(a,g){return D.all$1(a,function(a){return"C"===a.kind&&"Circle"===a.matrix.usage})};t.allelements$0=function(a,g){return h.ofGeos(v.gslp)};t.allelements$1=
+function(a,g){return D.all$1(a,function(a){return!0})};t.elementsatmouse$0=function(a,g){var c=h.realVector([ra[0],ra[1],1]),b=function(a){if(m._helper.isAlmostZero(a.value[2]))return Infinity;a=h.normalizeZ(a);return h.abs(h.sub(a,c)).value.real},d=function(a){a=h.turnIntoCSList([a.value[0],a.value[1],m.zero]);return h.normalizeMax(h.cross(c,a))},e=function(a){var g=w.mult(a.matrix,c),g=d(g);a=l._helper.IntersectLC(g,a.matrix).map(function(a){return b(a)});return.5>Math.min(a[0],a[1])},f=v.points.filter(function(a){return.5>
+b(a.homog)}),k=v.lines.filter(function(a){var g;g=d(a.homog);g=h.normalizeMax(h.cross(a.homog,g));if((g=.5>b(g))&&"S"===a.kind){var e=a.homog,e=h.turnIntoCSList([e.value[0],e.value[1],m.zero]);a=h.crossratio3(a.farpoint,a.startpos,a.endpos,c,e).value.real;if(0>a||1<a)g=!1}return g}),n=v.conics.filter(function(a){var g=e(a);if(g&&a.isArc){var b=h.crossratio3harm(a.startPoint,a.endPoint,a.viaPoint,c,h.ii);a=b.value[0];b=b.value[1];m._helper.isAlmostZero(a)?(a=m.div(a,b),b=m.real(1)):(b=m.div(b,a),a=
+m.real(1));var d=h.abs(h.turnIntoCSList([b,a]));a=m.div(a,d);b=m.div(b,d);b=m.mult(b,a);0>a.value.real&&(b=m.neg(b));0>b.value.real&&(g=!1)}return g}),f=f.concat(k,n);return h.ofGeos(f)};t.incidences$1=t.allelements$1;t.createpoint$2=function(a,g){var c=z(a[0]),b=K(a[1]);return"string"!==c.ctype?(ka("Name must be a string"),k):"list"!==b.ctype&&h.isNumberVector(b)?(ka("Position must be a number vector"),k):Ka({name:c.value,type:"Free",labeled:!0,pos:b})};t.create$3=function(a,g){var c=z(a[0]),b=z(a[1]),
+d=z(a[2]),e,f;if("string"===c.ctype)e=c.value;else{if("list"!==c.ctype)return ka("Names must be a string or a list of strings"),k;if(1!==c.value.length){e=w.string(c.value.map(function(a){return a.value}).join("__"));e=t.create$3([e,b,d],g);if(e!==k)for(b=w.string(e.kind.replace(/^(.*)s$/,"Select$1")),d=h.turnIntoCSList([w.string(e.name)]),f=0;f<c.value.length;++f)t.create$3([c.value[f],b,d],{index:m.real(f+1)});return e}if("string"!==c.value[0].ctype)return ka("Element of names list must be a string"),
+k;e=c.value[0].value}if("string"!==b.ctype)return ka("Type must be a string"),k;if("list"!==d.ctype)return ka("Arguments must be a list"),k;if(!l.hasOwnProperty(b.value)&&!Ac.hasOwnProperty(b.value)&&!zd.hasOwnProperty(b.value))return ka("Invalid geometric operation: '"+b.value+"'"),k;var c=[],n=null;for(f=0;f<d.value.length;f++){var p=d.value[f];if("string"===p.ctype)c.push(p.value);else if("geo"===p.ctype)c.push(p.value.name);else if(n=K(p),n===k)return ka("Unknown argument type"),k}e={name:e,type:b.value,
+labeled:!0};n&&(e.pos=n);0<c.length&&(e.args=c);b=B(g.index);"number"===b.ctype&&(e.index=b.value.real|0);return Ka(e)};t.javascript$1=function(a,g){var c=z(a[0]);"string"===c.ctype&&(new Function(c.value)).call(sa);return k};t.use$1=function(a,g){function c(a,c,g){t[a.toLowerCase()+"$"+c]=g}var b=z(a[0]);if("string"===b.ctype){var b=b.value,d;p.plugins&&(d=p.plugins[b]);d||(d=va._pluginRegistry[b]);if(d)return d({instance:sa,config:p,nada:k,evaluate:z,extractPoint:D.extractPoint,evaluateAndVal:B,
+defineFunction:c,addShutdownHook:jb.push.bind(jb),addAutoCleaningEventListener:H,getVariable:J.getvar.bind(J),getInitialMatrix:function(){return y.drawingstate.initialmatrix},setTextRenderer:function(a,c){Jc=a;c&&(Bd=c)},getImage:function(a,c){"string"===typeof a&&(a=w.string(a));var g=Ja(a);if(!g)return null;!c&&g.cdyUpdate&&g.cdyUpdate();return g},getMyfunction:function(a){return db.hasOwnProperty(a)?db[a]:null}}),{ctype:"boolean",value:!0};ka("Plugin "+b+" not found");return{ctype:"boolean",value:!1}}return k};
+t.format$2=function(a,g){function c(a){a=a.toFixed(e);var c;do c=a,a=a.substring(0,a.length-1);while(""!==a&&"-"!==a&&+a===+c);return""+c}function b(a){var g;return"number"===a.ctype?(g=c(a.value.real),a=c(a.value.imag),g="0"===a?g:"-"===a.substring(0,1)?g+" - i*"+a.substring(1):g+" + i*"+a,{ctype:"string",value:g}):"list"===a.ctype?{ctype:"list",value:a.value.map(b)}:{ctype:"string",value:Z(a).toString()}}var d=B(a[0]),h=B(a[1]),e;return"number"!==d.ctype&&"list"!==d.ctype||"number"!==h.ctype?k:
+(e=Math.max(0,Math.min(20,Math.round(h.value.real))),b(d))};Date.now||(Date.now=function(){return(new Date).getTime()});var Pd=0;t.timestamp$0=function(a,g){return m.real(Date.now())};t.seconds$0=function(a,g){return m.real((Date.now()-Pd)/1E3)};t.resetclock$0=function(a,g){Pd=Date.now();return k};t.time$0=function(a,g){var c=new Date;return h.realVector([c.getHours(),c.getMinutes(),c.getSeconds(),c.getMilliseconds()])};t.date$0=function(a,g){var c=new Date;return h.realVector([c.getFullYear(),c.getMonth()+
+1,c.getDate()])};t.simulationtime$0=function(a,g){return m.real(Ib*Md)};t.settimeout$2=function(a,g){function c(){z(d);e()}var b=z(a[0]),d=a[1];"number"===b.ctype&&"undefined"!==typeof window&&window.setTimeout(c,1E3*b.value.real);return k};D.formatForWebGL=function(a){return a.toFixed(10)};t.generateWebGL$2=function(a,g){var c=D.formatForWebGL,b=a[0],d=z(a[1]);console.log(d);if("list"!==d.ctype)return k;for(var h=[],e=0;e<d.value.length;e++)"string"===d.value[e].ctype&&h.push(d.value[e].value);console.log("***********");
+console.log(h);d=D.plotvars(b);console.log(d);-1===d.indexOf("a")&&-1===d.indexOf("b")&&-1===d.indexOf("c")&&-1===d.indexOf("d")&&-1===d.indexOf("e")&&-1===d.indexOf("f")&&(b=B(b));if("number"===b.ctype)return{ctype:"string",value:"vec2("+c(b.value.real)+","+c(b.value.imag)+")"};if("variable"===b.ctype)return{ctype:"string",value:b.name};if("string"===b.ctype||"void"===b.ctype)return b;if(2===b.args.length&&("infix"===b.ctype||"function"===b.ctype)){c=t.compileToWebGL$1([b.args[0]],{});d=t.compileToWebGL$1([b.args[1]],
+{});if("+"===b.oper||"add"===b.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:d.value}:{ctype:"string",value:"addc("+c.value+","+d.value+")"};if("*"===b.oper||"mult"===b.oper)return{ctype:"string",value:"multc("+c.value+","+d.value+")"};if("/"===b.oper||"div"===b.oper)return{ctype:"string",value:"divc("+c.value+","+d.value+")"};if("-"===b.oper||"sub"===b.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:"negc("+d.value+")"}:{ctype:"string",value:"subc("+c.value+
+","+d.value+")"};if("^"===b.oper||"pow"===b.oper)return{ctype:"string",value:"powc("+c.value+","+d.value+")"}}if("function"===b.ctype&&1===b.args.length){c=t.compileToWebGL$1([b.args[0]],{});if("sin$1"===b.oper)return{ctype:"string",value:"sinc("+c.value+")"};if("cos$1"===b.oper)return{ctype:"string",value:"cosc("+c.value+")"};if("tan$1"===b.oper)return{ctype:"string",value:"tanc("+c.value+")"};if("exp$1"===b.oper)return{ctype:"string",value:"expc("+c.value+")"};if("log$1"===b.oper)return{ctype:"string",
+value:"logc("+c.value+")"};if("arctan$1"===b.oper)return{ctype:"string",value:"arctanc("+c.value+")"};if("arcsin$1"===b.oper)return{ctype:"string",value:"arcsinc("+c.value+")"};if("arccos$1"===b.oper)return{ctype:"string",value:"arccosc("+c.value+")"};if("sqrt$1"===b.oper)return{ctype:"string",value:"sqrtc("+c.value+")"}}return k};t.compileToWebGL$1=function(a,g){var c,b;c=D.formatForWebGL;var d=a[0];b=D.plotvars(d);-1===b.indexOf("a")&&-1===b.indexOf("b")&&-1===b.indexOf("c")&&-1===b.indexOf("d")&&
+-1===b.indexOf("e")&&-1===b.indexOf("f")&&(d=B(d));if("number"===d.ctype)return{ctype:"string",value:"vec2("+c(d.value.real)+","+c(d.value.imag)+")"};if("variable"===d.ctype)return{ctype:"string",value:d.name};if("string"===d.ctype||"void"===d.ctype)return d;if(2===d.args.length&&("infix"===d.ctype||"function"===d.ctype)){c=t.compileToWebGL$1([d.args[0]],{});b=t.compileToWebGL$1([d.args[1]],{});if("+"===d.oper||"add"===d.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:b.value}:
+{ctype:"string",value:"addc("+c.value+","+b.value+")"};if("*"===d.oper||"mult"===d.oper)return{ctype:"string",value:"multc("+c.value+","+b.value+")"};if("/"===d.oper||"div"===d.oper)return{ctype:"string",value:"divc("+c.value+","+b.value+")"};if("-"===d.oper||"sub"===d.oper)return void 0===c.value||"void"===c.ctype?{ctype:"string",value:"negc("+b.value+")"}:{ctype:"string",value:"subc("+c.value+","+b.value+")"};if("^"===d.oper||"pow"===d.oper)return{ctype:"string",value:"powc("+c.value+","+b.value+
+")"}}if("function"===d.ctype&&1===d.args.length){c=t.compileToWebGL$1([d.args[0]],{});if("sin$1"===d.oper)return{ctype:"string",value:"sinc("+c.value+")"};if("cos$1"===d.oper)return{ctype:"string",value:"cosc("+c.value+")"};if("tan$1"===d.oper)return{ctype:"string",value:"tanc("+c.value+")"};if("exp$1"===d.oper)return{ctype:"string",value:"expc("+c.value+")"};if("log$1"===d.oper)return{ctype:"string",value:"logc("+c.value+")"};if("arctan$1"===d.oper)return{ctype:"string",value:"arctanc("+c.value+
+")"};if("arcsin$1"===d.oper)return{ctype:"string",value:"arcsinc("+c.value+")"};if("arccos$1"===d.oper)return{ctype:"string$1",value:"arccosc("+c.value+")"};if("sqrt$1"===d.oper)return{ctype:"string",value:"sqrtc("+c.value+")"}}return k};t.setsimulationspeed$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&ha(c.value.real);return k};t.setsimulationaccuracy$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&"undefined"!==typeof O&&"undefined"!==typeof O.env&&(O.env.accuracy=Math.max(1,c.value.real|
+0));return k};t.setsimulationquality$1=function(a,g){var c=B(a[0]);"number"===c.ctype&&"undefined"!==typeof O&&"undefined"!==typeof O.env&&(c=c.value.real,0===c&&(O.env.errorbound=.01,O.env.lowestdeltat=1E-5,O.env.slowdownfactor=2),1===c&&(O.env.errorbound=.001,O.env.lowestdeltat=1E-7,O.env.slowdownfactor=2),2===c&&(O.env.errorbound=1E-5,O.env.lowestdeltat=1E-10,O.env.slowdownfactor=4),3===c&&(O.env.errorbound=1E-6,O.env.lowestdeltat=1E-12,O.env.slowdownfactor=4));return k};var fc=null,mc=null;t.createtool$3=
+function(a,g){var c,b="left",d="top",h=null;g.space&&(c=z(g.space),"number"===c.ctype&&(h=c.value.real/2));var e=null;g.toolbar&&(c=z(g.toolbar),"string"===c.ctype&&((e=document.getElementById(c.value))||console.warn("Element #"+c.value+" not found")));if(!e){if(g.reference){var f=z(g.reference);if("string"===f.ctype)switch(f.value){case "UR":b="right";break;case "LL":d="bottom";break;case "LR":b="right",d="bottom"}}e=document.createElement("div");e.className="CindyJS-toolbar";na.parentNode.appendChild(e);
+f=z(a[1]);c=z(a[2]);"number"===f.ctype&&(e.style[b]=f.value.real+"px");"number"===c.ctype&&(e.style[d]=c.value.real+"px");null!==h&&(e.style.margin=-h+"px")}f=z(a[0]);if("string"===f.ctype)f=[[f.value]];else if("list"===f.ctype)f=f.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 ka("Name must be a string or a list of strings"),k;if(g.flipped&&(c=z(g.flipped),"boolean"===c.ctype&&c.value)){ka("Flipping");
+var m=0;c=f.length;f.forEach(function(a){a.length>m&&(m=a.length)});for(var l=[],n=0;n<m;++n){l[n]=[];for(var p=0;p<c;++p)l[n][p]=f[p][n]||null}f=l}"bottom"===d&&f.reverse();f.forEach(function(a){"right"===b&&a.reverse();var c=document.createElement("div");e.appendChild(c);a.forEach(function(a){function g(){fc&&fc.classList.remove("CindyJS-active");fc=d;d.classList.add("CindyJS-active");xc=a;var c=G[xc].actions;mc&&(mc.textContent=c[0].tooltip||"");Aa=[];xb=Ya=0}G.hasOwnProperty(a)||(ka("Tool '"+
+a+"' not implemented yet."),a=null);if(null===a){var b=document.createElement("span");b.className="CindyJS-spacer";c.appendChild(b)}else{var d=document.createElement("button"),b=document.createElement("img");b.src=va.getBaseDir()+"images/"+a+".png";d.appendChild(b);d.addEventListener("click",g);fc||g();null!==h&&(d.style.margin=h+"px");c.appendChild(d)}})});return k};t.dropped$0=function(){return rc};t.droppoint$0=function(){return sc};t.parsecsv$1=function(a,g){var c=!0,b=B(g.autoconvert);"boolean"===
+b.ctype&&(c=b.value);var d=null,b=B(g.delimiter);"string"===b.ctype&&/^[^\"\r\n]$/.test(b.value)&&(d=b.value);b=B(a[0]);if("string"!==b.ctype)return ka("CSV data is not a string"),k;var b=b.value,e='(?:"((?:[^"]+|"")*)"|([^]*?))(\r\n|(,)|[\r\n]|$)';d&&(d=d.replace(/[^A-Za-z0-9]/g,"\\$&").replace(/\$/g,"$$$$"),e=e.replace(/,/g,d));for(var e=new RegExp(e,"g"),d=[],f=[],l=null;e.lastIndex<b.length;){var n=e.exec(b),p=n[2];"string"===typeof n[1]&&(p=n[1].replace(/""/g,'"'));p=c?/^[Tt]rue$/.test(p)?w.bool(!0):
+/^[Ff]alse$/.test(p)?w.bool(!1):/^[\-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+|Infinity)$/.test(p)?m.real(Number(p)):w.string(p):w.string(p);d.push(p);n[4]&&e.lastIndex===b.length&&(d.push(w.string("")),n={});if(!n[4]){null===l&&(l=d.length);if(l<d.length)for(l=d.length,n=0;n<f.length;++n)for(p=f[n].length;p<l;++p)f[n][p]=k;else if(l>d.length)for(n=d.length;n<l;++n)d[n]=k;f.push(d);d=[]}}return h.turnIntoCSList(f.map(h.turnIntoCSList))};t.load$2=function(a,g){return t.load$3([a[0],null,a[1]],g)};t.load$3=function(a,
+g){function c(){if(f.readyState===XMLHttpRequest.DONE){var c;200===f.status?c=w.string(String(f.responseText)):(ka("Failed to load "+h+": "+f.statusText),c=k);J.newvar(b);J.setvar(b,c);z(a[2]);J.removevar(b);e()}}var b="#";null!==a[1]&&"variable"===a[1].ctype&&(b=a[1].name);var d=B(a[0]),h=null,f=null;"string"===d.ctype&&/^https?:\/\//.test(d.value)&&(h=d.value);return null!==h?(f=new XMLHttpRequest,f.onreadystatechange=c,f.open("GET",h),f.send(),w.bool(!0)):k};D.extractPoint=function(a){var g={ok:!1};
+if("geo"===a.ctype){var c=a.value;if("P"===c.kind)return g.x=ta.getField(c,"x").value.real,g.y=ta.getField(c,"y").value.real,g.ok=!0,g}if("list"!==a.ctype)return g;var b=a.value;if(2===b.length&&(a=b[0],c=b[1],"number"===a.ctype&&"number"===c.ctype))return g.x=a.value.real,g.y=c.value.real,g.ok=!0,g;3===b.length&&(a=b[0],c=b[1],b=b[2],"number"===a.ctype&&"number"===c.ctype&&"number"===b.ctype&&(a=m.div(a,b),c=m.div(c,b),g.x=a.value.real,g.y=c.value.real,g.ok=!0));return g};t.draw$1=function(a,g){var c=
+B(a[0]);if("shape"===c.ctype)D.drawshape(c,g);else if("Line"===c.usage)x.handleModifs(g,x.lineModifs),x.drawline(c);else{var b=D.extractPoint(c);if(!b.ok){if("undefined"!==typeof c.value&&2===c.value.length)return t.draw$2(c.value,g);return}null!==g&&x.handleModifs(g,x.pointModifs);x.drawpoint(b)}return k};t.draw$2=function(a,g){var c=B(a[0]),b=B(a[1]),c=D.extractPoint(c),b=D.extractPoint(b);if(!c.ok||!b.ok)return k;null!==g&&x.handleModifs(g,x.lineModifs);x.drawsegcore(c,b);return k};t.drawcircle$2=
+function(a,g){return D.drawcircle(a,g,"D")};D.arcHelper=function(a){var g={};g.startPoint=K(a[0]);g.viaPoint=K(a[1]);g.endPoint=K(a[2]);return g};t.fillcircle$2=function(a,g){return D.drawcircle(a,g,"F")};t.drawarc$3=function(a,g){var c=D.arcHelper(a);return D.drawarc(c,g,"D")};t.fillarc$3=function(a,g){var c=D.arcHelper(a);return D.drawarc(c,g,"F")};D.drawarc=function(a,g,c){var b=a.startPoint,d=a.viaPoint;a=a.endPoint;if(!h._helper.isAlmostReal(h.turnIntoCSList([b,d,a])))return k;x.handleModifs(g,
+x.conicModifs);x.preDrawCurve();g=h.det3(b,d,a);if(1E-12<Math.abs(g.value.real)){g=l._helper.ConicBy5(null,b,d,a,h.ii,h.jj);var e=l._helper.CenterOfConic(g),e=h.normalizeMax(e);g=m.real(0);var f=h.turnIntoCSList([h.turnIntoCSList([e.value[2],g,m.neg(e.value[0])]),h.turnIntoCSList([g,e.value[2],m.neg(e.value[1])]),h.turnIntoCSList([g,g,e.value[2]])]);g=h.normalizeZ(w.mult(f,b));h.normalizeZ(w.mult(f,d));f=h.normalizeZ(w.mult(f,a));g=-Math.atan2(g.value[1].value.real,g.value[0].value.real);f=-Math.atan2(f.value[1].value.real,
+f.value[0].value.real);e=h.normalizeZ(e);b=h.normalizeZ(b);d=h.normalizeZ(d);a=h.normalizeZ(a);var n=h.abs(h.sub(b,e)),p=[e.value[0].value.real,e.value[1].value.real],e=y.drawingstate.matrix,r=p[0]*e.a-p[1]*e.b+e.tx,p=p[0]*e.c-p[1]*e.d-e.ty,b=0<h.det3(b,d,a).value.real;A.save();A.beginPath();A.translate(r,p);A.arc(0,0,n.value.real*e.sdet,g,f,b);"F"===c&&(A.fillStyle=x.lineColor,A.closePath(),A.fill());"D"===c&&A.stroke();A.restore()}else{if("D"!==c)return k;c=D.extractPoint(b);g=D.extractPoint(d);
+f=D.extractPoint(a);if(!c.ok||!g.ok||!f.ok)return k;n=(c.x-f.x)*(c.x-f.x)+(c.y-f.y)*(c.y-f.y);e=(f.x-g.x)*(f.x-g.x)+(f.y-g.y)*(f.y-g.y);if(1E-12>(c.x-g.x)*(c.x-g.x)+(c.y-g.y)*(c.y-g.y)||1E-12>n||1E-12>e)return k;0>h.crossratio3(b,a,d,h.cross(h.cross(b,d),h.linfty),h.ii).value.real?x.drawsegcore(c,f):x.drawRaySegment(b,a)}return k};D.drawcircle=function(a,g,c){var b=B(a[0]);a=B(a[1]);var d=D.extractPoint(b);if(!d.ok||"number"!==a.ctype||!m._helper.isAlmostReal(a))return k;var b=y.drawingstate.matrix,
+e=d.x*b.a-d.y*b.b+b.tx,d=d.x*b.c-d.y*b.d-b.ty;x.handleModifs(g,x.conicModifs);x.preDrawCurve();A.lineJoin="miter";A.beginPath();A.arc(e,d,Math.abs(a.value.real)*b.sdet,0,2*Math.PI);A.closePath();"D"===c&&A.stroke();"F"===c&&(A.fillStyle=x.lineColor,A.fill());"C"===c&&A.clip();return k};t.drawconic$1=function(a,b){var c=B(a[0]);if("list"!==c.ctype||3!==c.value.length&&6!==c.value.length)return console.error("could not parse conic"),k;if(6===c.value.length){for(var d=0;6>d;d++)if("number"!==c.value[d].ctype)return console.error("could not parse conic"),
+k;var e=m.real(.5),d=c.value[0],f=c.value[2],f=m.mult(f,e),l=c.value[1],n=c.value[3],n=m.mult(n,e),p=c.value[4],p=m.mult(p,e),c=c.value[5],c=h.turnIntoCSList([h.turnIntoCSList([d,f,n]),h.turnIntoCSList([f,l,p]),h.turnIntoCSList([n,p,c])])}else{if(!h.isNumberMatrix(c).value||3!==c.value.length||3!==c.value[0].value.length)return k;d=h.transpose(c);h.equals(c,d).value||(c=h.add(d,c))}return D.drawconic(c,b)};D.drawconic=function(a,b){function c(a,c){var b=(p*a+r*c+t)*a+(u*c+v)*c+w;return 0<=b?1:0>b?
+-1:NaN}function d(a){K.next=a;a.prev=K;return K=a}function e(a,b,g,d){return{a:a,b1:b,b2:g,vertical:!0,index:d,sign:function(b){return c(a,b)},mkp:function(c){return{x:a,y:c}},sol:Jb(u,r*a+v,(p*a+t)*a+w),discr:function(){return Jb(E,-2*C,z)},tpt:function(a){return{x:a,y:-.5*(r*a+v)/u}}}}function f(a,b,g,d){return{a:a,b1:b,b2:g,vertical:!1,index:d,sign:function(b){return c(b,a)},mkp:function(c){return{x:c,y:a}},sol:Jb(p,r*a+t,(u*a+v)*a+w),discr:function(){return Jb(E,-2*F,D)},tpt:function(a){return{x:-.5*
+(r*a+t)/p,y:a}}}}function m(a){var c=Math.min(a.b1,a.b2),b=Math.max(a.b1,a.b2),g=a.sign(c),e=a.sign(b);if(!isFinite(g*e))return!1;var h=a.sol,f;if(g!==e){if(null===h)return!1;f=.5*(h[0]+h[1]);f>c&&f<b?(c=a.sign(f),f=h[c===e?0:1]):(g=.5*(c+b),f=h[Math.abs(g-h[0])<Math.abs(g-h[1])?0:1]);N.push(d(a.mkp(f)))}else{if(null===h){if(0>=G)return!0;h=a.discr();if(null===h)return!0;a=a.tpt(h[a.index]);a.x>=H&&a.x<=J&&a.y>=L&&a.y<=M&&d(a);return!0}f=.5*(h[0]+h[1]);if(!(f>c&&f<b))return!0;c=a.sign(f);if(c===g||
+isNaN(c))return!0;a.b1>a.b2&&(h=[h[1],h[0]]);N.push(d(a.mkp(h[0])));N.push(d(a.mkp(h[1])))}return!0}function k(a,c,b,g,d){var e=c-g,h=b-a,q=a*g-c*b,f=C*e+F*h+E*q;if(1E-14>Math.abs(f))return A.lineTo(b,g);var m=(z*e+B*h+C*q)/f,e=(B*e+D*h+F*q)/f;if(!isFinite(m)||!isFinite(e)||.04>Math.abs(a*e+m*g+b*c-b*e-m*c-a*g))return A.lineTo(b,g);do if(!(10<d)){var q=.5*(a+b),h=.5*(c+g),l=m-q,f=e-h;if(!(.04>l*l+f*f)){var n=p*l*l+r*l*f+u*f*f,oa=2*p*l*q+r*(l*h+f*q)+2*u*f*h+t*l+v*f,W=(p*q+r*h+t)*q+(u*h+v)*h+w,xa=Jb(n,
+oa,W);xa||(xa=[-.5*oa/n,-2*W/oa]);if(0<xa[0])xa=xa[0];else if(0<=xa[1])xa=xa[1];else break;l=q+xa*l;f=h+xa*f;q=l-.5*(m+q);h=f-.5*(e+h);if(!(.04>q*q+h*h)){k(a,c,l,f,d+1);k(l,f,b,g,d+1);return}}}while(0);A.quadraticCurveTo(m,e,b,g)}x.handleModifs(b,x.conicModifs);if(0!==x.lsize){x.preDrawCurve();var l;l=h.normalizeMax(a);if(h._helper.isAlmostReal(l)){var n=y.toMat();l=h.mult(h.transpose(n),l);l=h.mult(l,n);l=h.normalizeMax(l);var p=l.value[0].value[0].value.real,r=2*l.value[0].value[1].value.real,t=
+2*l.value[0].value[2].value.real,u=l.value[1].value[1].value.real,v=2*l.value[1].value[2].value.real,w=l.value[2].value[2].value.real,z=4*w*u-v*v,B=v*t-2*w*r,C=v*r-2*u*t,D=4*w*p-t*t,F=t*r-2*v*p,E=4*u*p-r*r,G=E;l=u*D+r*B+p*z-w*E;0>l&&(p=-p,r=-r,t=-t,u=-u,v=-v,w=-w,l=-l);l=x.lsize;var H=-l,L=-l,J=ca+l,M=da+l,N=[],K=l={};if(m(e(H,L,M,0))&&m(f(M,H,J,1))&&m(e(J,M,L,1))&&m(f(L,J,H,0))&&K!==l){K.next=l.next;l.next.prev=K;A.beginPath();var I,O;if(0===N.length){I=K;A.moveTo(I.x,I.y);do O=I.next,k(I.x,I.y,
+O.x,O.y,0),I=O;while(I!==K);A.closePath()}n=1===c(H,L)?0:1;if(4===N.length){var P=0;for(l=0;2>l;++l){I=N[l];O=N[l+2];var Q=O.x-I.x;I=O.y-I.y;I=(p*Q+r*I)*Q+u*I*I;Math.abs(I)>Math.abs(P)&&(P=I)}if(isNaN(P))return;0<=P&&(n=1-n)}for(l=n;l<N.length;l+=2)for(I=N[l],n=N[(l+1)%N.length],A.moveTo(I.x,I.y),O=I.next;I!==n;O=(I=O).next)k(I.x,I.y,O.x,O.y,0);A.stroke()}}}};t.drawall$1=function(a,b){var c=z(a[0]);if("list"===c.ctype){x.handleModifs(b,x.pointAndLineModifs);for(var d=0;d<c.value.length;d++)t.draw$1([c.value[d]],
+null)}return k};t.connect$1=function(a,b){return D.drawpolygon(a,b,"D",!1)};t.drawpoly$1=function(a,b){return D.drawpolygon(a,b,"D",!0)};t.fillpoly$1=function(a,b){return D.drawpolygon(a,b,"F",!0)};t.drawpolygon$1=function(a,b){return D.drawpolygon(a,b,"D",!0)};t.fillpolygon$1=function(a,b){return D.drawpolygon(a,b,"F",!0)};D.drawpolygon=function(a,b,c,d){function e(){for(var a=m.value,c=0;c<a.length;c++){var b=a[c],g;for(g=0;g<b.length;g++){var d=b[g],h=d.X*f.a-d.Y*f.b+f.tx,d=d.X*f.c-d.Y*f.d-f.ty;
+0===g?A.moveTo(h,d):A.lineTo(h,d)}A.closePath()}}function h(){var a;for(a=0;a<m.value.length;a++){var c=D.extractPoint(m.value[a]);if(!c.ok)return;var b=c.x*f.a-c.y*f.b+f.tx,c=c.x*f.c-c.y*f.d-f.ty;0===a?A.moveTo(b,c):A.lineTo(b,c)}d&&A.closePath()}x.handleModifs(b,x.conicModifs);x.preDrawCurve();var f=y.drawingstate.matrix,m=z(a[0]);A.beginPath();"list"===m.ctype&&h();"shape"===m.ctype&&e();"D"===c&&(x.fillColor&&(A.fillStyle=x.fillColor,A.fill(x.fillrule)),A.stroke());"F"===c&&(A.fillStyle=x.lineColor,
+A.fill(x.fillrule));"C"===c&&A.clip();return k};var Jc=fd,Bd=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};D.drawtext=function(a,b,c){var d=B(a[0]);a=z(a[1]);var e=D.extractPoint(d);if(!e.ok)return null;x.handleModifs(b,x.textModifs);b=y.drawingstate.textsize;null===b&&(b=ga.textsize);null!==x.size&&(b=x.size);A.fillStyle=x.textColor;var h=
+y.drawingstate.matrix,d=e.x*h.a-e.y*h.b+h.tx+x.xOffset,e=e.x*h.c-e.y*h.d-h.ty-x.yOffset;a=Z(a);va._pluginRegistry.katex||"string"!==typeof a||3<=a.split("$").length&&pa("katex","katex-plugin.js",!0);h=x.bold+x.italics+Math.round(10*b)/10+"px "+x.family;A.font=h;return c?c(a,h,d,e,x.align,b):Jc(A,a,d,e,x.align,b,b*ga.lineHeight)};t.drawtext$2=function(a,b){D.drawtext(a,b,null);return k};t.drawtable$2=function(a,b){var c=B(a[0]),d=B(a[1]),e=D.extractPoint(c);if(!e.ok||"list"!==d.ctype)return k;var d=
+d.value,c=d.length,f=-1,m;for(m=0;m<c;++m)"list"===d[m].ctype&&d[m].value.length>f&&(f=d[m].value.length);-1===f?(d=d.map(function(a){return[a]}),f=1):d=d.map(function(a){return h.asList(a).value});var l=100,n=null,p=!0,r=y.drawingstate.textcolor;x.handleModifs(b,{size:!0,color:function(a){h._helper.isNumberVecN(a,3)&&(r=x.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&&(l=a.value.real)},height:function(a){"number"===a.ctype&&(n=a.value.real)},border:function(a){"boolean"===a.ctype&&(p=a.value)}});var t=y.drawingstate.textsize;null===t&&(t=ga.textsize);null!==x.size&&(t=x.size);null===n&&(n=1.6*t);A.font=x.bold+x.italics+Math.round(10*t)/10+"px "+x.family;m=y.drawingstate.matrix;var u=f*l,v=c*n,t=e.x*m.a-e.y*m.b+m.tx+x.xOffset,w=e.x*m.c-e.y*m.d-m.ty-x.yOffset-v;if(p){x.preDrawCurve();A.strokeStyle=x.lineColor;A.beginPath();for(m=1;m<c;++m)A.moveTo(t,w+m*
+n),A.lineTo(t+u,w+m*n);for(e=1;e<f;++e)A.moveTo(t+e*l,w),A.lineTo(t+e*l,w+v);A.stroke();A.lineWidth=x.lsize+1;A.beginPath();A.rect(t,w,u,v);A.stroke()}t+=x.align*l+(1-2*x.align)*n*.3;w+=.7*n;A.fillStyle=r;for(m=0;m<c;++m)for(e=0;e<f;++e)u=Z(d[m][e]),Jc(A,u,t+e*l,w+m*n,x.align);return k};D.drawshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],b,"D",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"D"):k};D.fillshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],
+b,"F",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"F"):k};D.clipshape=function(a,b){return"polygon"===a.type?D.drawpolygon([a],b,"C",1):"circle"===a.type?D.drawcircle([a.value.value[0],a.value.value[1]],b,"C"):k};t.fill$1=function(a,b){var c=z(a[0]);return"shape"===c.ctype?D.fillshape(c,b):k};t.clip$1=function(a,b){var c=z(a[0]);return"shape"===c.ctype?D.clipshape(c,b):"list"===c.ctype?(c=t.polygon$1(a,[]),t.clip$1([c],[])):k};t.plot$1=function(a,b){return t.plot$2([a[0],
+null],b)};t.plot$2=function(a,b){function c(a){return"number"===a.ctype&&m._helper.isAlmostReal(a)}function d(a,c,b,g,e){n++;c=+c.value.real;e=+g.value.real;g=c*E.a-e*E.b+E.tx;c=c*E.c-e*E.d-E.ty;a=+a.value.real;e=+b.value.real;b=a*E.a-e*E.b+E.tx;a=a*E.c-e*E.d-E.ty;p?(A.lineTo(b,a),A.lineTo(g,c)):(A.beginPath(),A.moveTo(b,a),A.lineTo(g,c),p=!0)}function e(a,b,g,h,k){var n=c(g),r=c(h);if(.001>k)!f&&p&&(A.stroke(),p=!1);else if(n||r){var t=m.real((a.value.real+b.value.real)/2);J.setvar(B,t);var u=z(w),
+v=c(u);if(n&&r&&v){var Wb=g.value.real,r=u.value.real,v=h.value.real;if(n=1>Math.abs(Wb+v-2*r)/l){var Wa=m.real((a.value.real+t.value.real)/2);J.setvar(B,Wa);var Wa=z(w),Ra=m.real((t.value.real+b.value.real)/2);J.setvar(B,Ra);Ra=z(w);Wb=Math.abs(Wb+r-2*Wa.value.real)/l;r=Math.abs(r+v-2*Ra.value.real)/l;n=n&&1>Wb&&1>r}n?(d(a,t,g,u,k/2),d(t,b,u,h,k/2)):(e(a,t,g,u,k/2),e(t,b,u,h,k/2))}else e(a,t,g,u,k/2),e(t,b,u,h,k/2)}}var f=!1,l=.2/Tb,n=0,p=!1,r=-10,t=10,u=.1,v=1E3,w=a[0],B;if(null!==a[1]&&"variable"===
+a[1].ctype)B=a[1].name;else{var C=D.plotvars(w);B="#";-1!==C.indexOf("t")&&(B="t");-1!==C.indexOf("z")&&(B="z");-1!==C.indexOf("y")&&(B="y");-1!==C.indexOf("x")&&(B="x")}J.newvar(B);var E=y.drawingstate.matrix;x.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&&(r=a.value.real)},stop:function(a){"number"===a.ctype&&(t=a.value.real)},steps:function(a){"number"===
+a.ctype&&(v=a.value.real)}});A.strokeStyle=x.lineColor;A.lineWidth=x.lsize;var F,G,H,I,p=!1,C=m.real(14.32);J.setvar(B,C);H=z(w);if("number"!==H.ctype){if(h.isNumberVector(H).value&&2===H.value.length){p=!1;u=(t-r)/v;for(C=r;C<t;C+=u)J.setvar(B,m.real(C)),I=z(w),h.isNumberVector(I).value&&2===I.value.length&&(F=+I.value[0].value.real,G=+I.value[1].value.real,I=F*E.a-G*E.b+E.tx,F=F*E.c-G*E.d-E.ty,p?A.lineTo(I,F):(A.beginPath(),A.moveTo(I,F),p=!0));A.stroke();J.removevar(B)}return k}for(I=r;I<t+u;I+=
+u)C=m.real(I),J.setvar(B,C),H=z(w),C.value.real>r&&e(F,C,G,H,u),F=C,G=H;J.removevar(B);p&&A.stroke();return k};t.plotX$1=function(a,b){var c=a[0],d=D.plotvars(c),e="#";-1!==d.indexOf("t")&&(e="t");-1!==d.indexOf("z")&&(e="z");-1!==d.indexOf("y")&&(e="y");-1!==d.indexOf("x")&&(e="x");J.newvar(e);d=y.drawingstate.matrix;A.fillStyle=y.drawingstate.linecolor;A.lineWidth=1;A.lineCap=x.lineCap;A.lineJoin=x.lineJoin;A.miterLimit=x.miterLimit;for(var h=!1,f=-10;10>f;f+=.01){J.setvar(e,m.real(f));var l=z(c);
+if("number"===l.ctype){var n=+l.value.real,l=f*d.a-n*d.b+d.tx,n=f*d.c-n*d.d-d.ty;h?A.lineTo(l,n):(A.beginPath(),A.moveTo(l,n),h=!0)}}A.stroke();J.removevar(e);return k};D.plotvars=function(a){function b(a,c){var g={},d;for(d=a.length-1;0<=d;--d)g[a[d]]=a[d];for(d=c.length-1;0<=d;--d)g[c[d]]=c[d];d=[];for(var e in g)g.hasOwnProperty(e)&&d.push(g[e]);return d}function c(a,c){for(var b=0;b<a.length;b++)a[b]===c&&(a.splice(b,1),b--);return a}var d,e,h,f;if("variable"===a.ctype)return[a.name];if("infix"===
+a.ctype)return d=D.plotvars(a.args[0]),a=D.plotvars(a.args[1]),b(d,a);if("list"===a.ctype){h=a.value;e=[];for(f=0;f<h.length;f++)d=D.plotvars(h[f]),e=b(e,d);return e}if("function"===a.ctype){h=a.args;e=[];for(f=0;f<h.length;f++)d=D.plotvars(h[f]),e=b(e,d);"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||(e=c(e,a.args[1].name));return e}return[]};t.clrscr$0=function(a,
+b){"undefined"!==typeof ca&&"undefined"!==typeof da&&A.clearRect(0,0,ca,da);return k};t.repaint$0=function(a,b){e();return k};t.screenbounds$0=function(a,b){var c=w.withUsage(h.realVector(y.to(0,0)),"Point"),d=w.withUsage(h.realVector(y.to(ca,0)),"Point"),e=w.withUsage(h.realVector(y.to(ca,da)),"Point"),f=w.withUsage(h.realVector(y.to(0,da)),"Point");return h.turnIntoCSList([c,d,e,f])};t.createimage$3=function(a,b){var c=z(a[0]),d=B(a[1]),e=B(a[2]);if("number"!==d.ctype||"number"!==e.ctype||"string"!==
+c.ctype)return k;var h=document.createElement("canvas");h.id=c.value;h.width=d.value.real;h.height=e.value.real;h.style.display="none";document.body.appendChild(h);bb[c.value]=fa(h,!1);return k};t.clearimage$1=function(a,b){var c=z(a[0]);if("string"!==c.ctype&&"image"!==c.ctype)return k;c=Ja(c);if(!c)return k;var d=c.img;if("undefined"===typeof d||null===d)return k;var e=c.width,h=c.height;d.getContext("2d").clearRect(0,0,e,h);c.generation++;return k};t.canvas$4=function(a,b){var c=B(a[0]),d=B(a[1]),
+e=z(a[2]),h=a[3],f=D.extractPoint(c),m=D.extractPoint(d);if(!f.ok||!m.ok||"string"!==e.ctype&&"image"!==e.ctype)return k;e=Ja(e);if(!e||!e.img.getContext)return k;var d=e.img,l=e.width,c=e.height,n=m.x-f.x,p=m.y-f.y,r=f.x-p*c/l,t=f.y+n*c/l,p=m.x-p*c/l,n=m.y+n*c/l,m=y.from(f.x,f.y,1),r=y.from(r,t,1),p=y.from(p,n,1),f=m[0],t=m[1],n=r[0],u=r[1],v=p[0],w=p[1],r=l*(t-u)/((f-n)*(t-w)-(f-v)*(t-u)),l=l*(f-n)/((t-u)*(f-v)-(t-w)*(f-n)),p=-r*f-l*t,m=(c*(t-w)-c*(t-u))/((f-n)*(t-w)-(f-v)*(t-u)),n=(c*(f-v)-c*(f-
+n))/((t-u)*(f-v)-(t-w)*(f-n)),c=c-m*f-n*t,d=d.getContext("2d"),f=A;A=d;A.save();A.transform(r,m,l,n,p,c);e.generation++;z(h);A.restore();A=f};t.canvas$5=function(a,b){var c=B(a[0]),d=B(a[1]),e=B(a[2]),h=z(a[3]),f=a[4],c=D.extractPoint(c),m=D.extractPoint(d),l=D.extractPoint(e);if(!c.ok||!m.ok||!l.ok||"string"!==h.ctype&&"image"!==h.ctype)return k;h=Ja(h);if(!h||!h.img.getContext)return k;var e=h.img,n=h.width,d=h.height,p=y.from(c.x,c.y,1),r=y.from(m.x,m.y,1),m=y.from(l.x,l.y,1),c=p[0],l=p[1],t=r[0],
+u=r[1],v=m[0],w=m[1],m=((0-n)*(l-w)-0*(l-u))/((c-t)*(l-w)-(c-v)*(l-u)),n=((0-n)*(c-v)-0*(c-t))/((l-u)*(c-v)-(l-w)*(c-t)),r=0-m*c-n*l,p=((d-d)*(l-w)-(d-0)*(l-u))/((c-t)*(l-w)-(c-v)*(l-u)),t=((d-d)*(c-v)-(d-0)*(c-t))/((l-u)*(c-v)-(l-w)*(c-t)),d=d-p*c-t*l,e=e.getContext("2d"),c=A;A=e;A.save();A.transform(m,p,n,t,r,d);h.generation++;z(f);A.restore();A=c};t.screenresolution$0=function(a,b){return m.real(y.drawingstate.matrix.a)};t.layer$1=function(a,b){};t.imagesize$1=function(a,b){var c=Ja(B(a[0]));return c?
+h.realVector([+c.width,+c.height]):k};t.imageready$1=function(a,b){var c=Ja(B(a[0]));return w.bool(!(!c||!c.ready))};t.drawimage$2=function(a,b){function c(){var a=1,c=1,d=1,f=1,q=0,m=1,n=D.extractPoint(e);if(!n.ok)return k;l=Ja(l);if(!l)return k;A.save();var p;void 0!==b.angle&&(p=z(b.angle),"number"===p.ctype&&(q=p.value.real));void 0!==b.rotation&&(p=z(b.rotation),"number"===p.ctype&&(q=p.value.real));void 0!==b.scale&&(p=B(b.scale),"number"===p.ctype&&(c=a=p.value.real),h.isNumberVector(p).value&&
+2===p.value.length&&(a=p.value[0].value.real,c=p.value[1].value.real));void 0!==b.scalex&&(p=z(b.scalex),"number"===p.ctype&&(a=p.value.real));void 0!==b.scaley&&(p=z(b.scaley),"number"===p.ctype&&(c=p.value.real));void 0!==b.flipx&&(p=z(b.flipx),"boolean"===p.ctype&&p.value&&(d=-1));void 0!==b.flipy&&(p=z(b.flipy),"boolean"===p.ctype&&p.value&&(f=-1));void 0!==b.alpha&&(p=z(b.alpha),"number"===p.ctype&&(m=p.value.real));var r=y.drawingstate.matrix,W=y.drawingstate.initialmatrix,t=l.width,u=l.height;
+p=n.x*r.a-n.y*r.b+r.tx;var v=n.x*r.c-n.y*r.d-r.ty,xa=(n.x+1)*r.a-n.y*r.b+r.tx-p,r=(n.x+1)*r.c-n.y*r.d-r.ty-v,w=(n.x+1)*W.a-n.y*W.b+W.tx-(n.x*W.a-n.y*W.b+W.tx),W=(n.x+1)*W.c-n.y*W.d-W.ty-(n.x*W.c-n.y*W.d-W.ty),n=Math.sqrt(xa*xa+r*r)/Math.sqrt(w*w+W*W),xa=-Math.atan2(xa,r)+Math.atan2(w,W),r=y.drawingstate.matrix.sdet/72,a=a*r,c=c*r;1!==m&&(A.globalAlpha=m);A.translate(p,v);A.scale(a*d*n,c*f*n);A.rotate(q+xa);A.translate(-p,-v);A.translate(-t/2,-u/2);a=l;a.drawTo?a.drawTo(A,p,v):A.drawImage(a.img,p,
+v);A.globalAlpha=1;A.restore()}function d(){var a=1,c=1,h=1,q=1,n=D.extractPoint(e),p=D.extractPoint(f),r;if(!n.ok||!p.ok)return k;l=Ja(l);if(!l)return k;var t=l.width,u=l.height;if(0===m)r={},r.x=n.x-(p.y-n.y),r.y=n.y+(p.x-n.x),q=u/t;else if(r=D.extractPoint(m),!n.ok)return k;A.save();var v;void 0!==b.alpha&&(v=z(b.alpha),"number"===v.ctype&&(a=v.value.real));void 0!==b.aspect&&(v=z(b.aspect),"number"===v.ctype&&(q=v.value.real));void 0!==b.flipx&&(v=z(b.flipx),"boolean"===v.ctype&&v.value&&(c=-1));
+void 0!==b.flipy&&(v=z(b.flipy),"boolean"===v.ctype&&v.value&&(h=-1));v=y.drawingstate.matrix;1!==a&&(A.globalAlpha=a);a=n.x*v.a-n.y*v.b+v.tx;n=n.x*v.c-n.y*v.d-v.ty;A.transform(p.x*v.a-p.y*v.b+v.tx-a,p.x*v.c-p.y*v.d-v.ty-n,r.x*v.a-r.y*v.b+v.tx-a,r.x*v.c-r.y*v.d-v.ty-n,a,n);A.scale(1/t,-1/u*q);A.translate(t/2,-u/2);A.scale(c,h);A.translate(-t/2,u/2);A.translate(0,-u);c=l;c.drawTo?c.drawTo(A,0,0):A.drawImage(c.img,0,0);A.globalAlpha=1;A.restore()}var e,f,m,l;return 2===a.length?(e=B(a[0]),l=B(a[1]),
+c()):3===a.length?(e=B(a[0]),f=B(a[1]),m=0,l=B(a[2]),d()):4===a.length?(e=B(a[0]),f=B(a[1]),m=B(a[2]),l=B(a[3]),d()):k};t.drawimage$3=t.drawimage$2;t.drawimage$4=t.drawimage$2;t.allimages$0=function(){var a=[];Object.keys(bb).forEach(function(b){a.push({ctype:"string",value:b})});return h.turnIntoCSList(a)};t.cameravideo$0=function(a,b){function c(a){return{video:{width:a,advanced:[{width:{max:a,min:a}},{width:{ideal:a}}]},audio:!1}}var d=!0,e={};if(void 0!==b.resolution){var f=z(b.resolution);"string"===
+f.ctype&&"maximal"===f.value?d=!0:"number"===f.ctype?(d=!1,e=c(f.value.real)):h._helper.isNumberVecN(f,2)&&(d=!1,e=c(f.value[0].value.real),f=f.value[1].value.real,10>f||!Number.isInteger(f)?(e.video.aspectRatio=f,e.video.advanced[0].aspectRatio={min:f,max:f},e.video.advanced[1].aspectRatio={ideal:f}):(e.video.height=f,e.video.advanced[0].height={min:f,max:f},e.video.advanced[1].height={ideal:f}))}d&&(e=[320,640,1024,1280,1920,2560],e=e.map(function(a){return{width:{min:a}}}),e={video:{width:16E3,
+height:9E3,advanced:e},audio:!1});var d=null,m=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia;m?d=function(a,c){navigator.mediaDevices.getUserMedia(e).then(a,c)}:(m=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)&&(d=function(a,c){m.call(navigator,e,a,c)});if(!d)return console.warn("getUserMedia call not supported"),k;var l=document.createElement("video");l.autoplay=!0;f=fa(l,!0);console.log("Opening stream.");d(function(a){l.srcObject=
+a;l.setAttribute("autoplay","");l.setAttribute("muted","");l.setAttribute("playsinline","");l.play();l.addEventListener("loadeddata",M)},function(a){console.error("Could not get user video:",String(a),a)});return f};t.playvideo$1=function(a,b){var c=Ja(B(a[0]));c.live&&c.img.play&&c.img.play();return k};t.pausevideo$1=function(a,b){var c=Ja(B(a[0]));c.live&&c.img.pause&&c.img.pause();return k};var Kb;t.imagergba$3=function(a,b){var c=Ja(B(a[0])),d=B(a[1]),e=B(a[2]);if(!c||"number"!==d.ctype||"number"!==
+e.ctype||!c.ready)return k;d=Math.round(d.value.real);e=Math.round(e.value.real);if(!Ia(d)||!Ia(e))return k;c=pb(c,d,e,1,1);return h.realVector([255*c[0],255*c[1],255*c[2],c[3]])};t.imagergb$3=t.imagergba$3;t.imagergba$4=function(a,b){var c=Ja(B(a[2]));if(!c||!c.ready)return k;var d=c.width,e=c.height,f=K(a[0]),m=K(a[1]),l=K(h.realVector([0,e,1])),d=K(h.realVector([d,e,1]));if(f===k||m===k||n===k)return k;var n=h.ii,e=h.jj,l=D.basismap(l,d,n,e),f=D.basismap(f,m,e,n),n=K(a[3]);var p=D.extractPoint(w.mult(l,
+w.mult(h.adjoint3(f),n)));if(p.ok){var m=c.width,l=c.height,n=!0,r=!1;void 0!==b.interpolate&&(f=z(b.interpolate),"boolean"===f.ctype&&(n=f.value));void 0!==b.repeat&&(f=z(b.repeat),"boolean"===f.ctype&&(r=f.value));n&&(p.x-=.5,p.y-=.5);r&&(p.x=(p.x%m+m)%m,p.y=(p.y%l+l)%l);d=Math.floor(p.x);e=Math.floor(p.y);if(Ia(d)&&Ia(e)){f=[0,0,0,0];if(n){var n=p.x-d,p=p.y-e,t=pb(c,d,e,2,2);if(r){if(d===m-1||e===l-1)var r=pb(c,(d+1)%m,e,1,1),v=pb(c,d,(e+1)%l,1,1),c=pb(c,(d+1)%m,(e+1)%l,1,1),t=t.slice(0,4).concat(r,
+v,c)}else{if(-1===d||d===m-1)n=Math.round(n);if(-1===e||e===l-1)p=Math.round(p)}for(c=0;4>c;c++)f[c]=(1-p)*((1-n)*t[c]+n*t[c+4])+p*((1-n)*t[c+8]+n*t[c+12])}else f=pb(c,d,e,1,1);c=h.realVector(f)}else c=k}else c=k;return c};t.imagergb$4=function(a,b){var c=t.imagergba$4(a,b);return c===k?k:h.turnIntoCSList(c.value.slice(0,3))};t.readpixels$1=function(a,b){for(var c=Ja(B(a[0])),c=pb(c,0,0,c.width,c.height),d=[],e=0;e+3<c.length;e+=4)d.push(h.turnIntoCSList([m.real(c[e+0]),m.real(c[e+1]),m.real(c[e+
+2]),m.real(c[e+3])]));return h.turnIntoCSList(d)};"use strict";var ze=[{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:[","]}],Ae=["+","-"],Be=["!","\u221a"],Ce=["\u00b0",":=_"],De=[";",","],Kc=[],Ca={},kd;(function(){var a=0;ze.forEach(function(b){a+=
+2;var c=!!b.rassoc;b.functionCall&&(kd=a);for(var d in b){var e=b[d];if("boolean"!==typeof e)for(var h={name:d,sym:e[0],symbols:e,rassoc:c,precedence:a,prefix:!1,postfix:!1,infix:!0,bare:!1},f=0;f<e.length;++f){var m=e[f];if(Ca.hasOwnProperty(m))throw Error("Duplicate operator: "+m);Ca[m]=h;Kc.push(m)}}});Ae.forEach(function(a){Ca[a].prefix=!0});Be.forEach(function(a){Ca[a].prefix=!0;Ca[a].infix=!1});Ce.forEach(function(a){Ca[a].postfix=!0;Ca[a].infix=!1});De.forEach(function(a){Ca[a].prefix=!0;Ca[a].postfix=
+!0;Ca[a].infix=!0;Ca[a].bare=!0})})();Kc.sort(function(a,b){return b.length-a.length});var Ee="(?:[0-9](?: [0-9])*(?: \\.(?! \\.)(?: [0-9])*)?|\\.(?: [0-9])+)(?: [Ee](?: [+-])?(?: [0-9])+)?".replace(/ /g,"[ \t]*"),Fe="(?:[\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]*"),Ge="(?:[\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]*"),Lc=function(a,b,c){var d,e,h=0,f="(?:[",m=b.length;for(d=0;d<m;++d)e=b.charCodeAt(d),55296<=e?(f+="]|"+b.charAt(d)+"[",h=56320):(f+=String.fromCharCode(e=h=a[e-32]+h),h+=a[b.charCodeAt(++d)-32],h!==e&&(h!==e+1&&(f+="-"),f+=String.fromCharCode(h)));return f+"]|["+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"),ze=("#(?: [1-9])?|(?:'|"+Dc+")(?: (?:[0-9']|"+Dc+"))*").replace(/ /g,"[ \t]*"),$c=["([ \t\n]+)|(//.*)|(/\\*)","("+we+")","("+Cc.map(Zc).join("|")+")","("+"[](){}||".split("").map(Zc).join("|")+")","("+ye+")","("+xe+")","("+ze+")",'("[^"]*")|($)'].join("|"),Ae=new RegExp("[ \t]*".replace(/\*$/,"+"),"g"),Ec="ANY WS COMMENT START_COMMENT NUM OP BRA SUB SUP ID STR EOF".split(" ");(function(){var a=(new RegExp($c,"g")).exec("");if(a.hasOwnProperty(Ec.length))throw Error("RE has more groups than expected");
-if(!a.hasOwnProperty(Ec.length-1))throw Error("RE has fewer groups than expected");})();kb.prototype.advanceBy=function(a){this.advanceTo(this.pos+a)};kb.prototype.advanceTo=function(a){for(this.pos=a;this.bols[0]<=a;)this.bol=this.bols.shift(),this.line++};kb.prototype.curPos=function(){return{row:this.line,col:this.pos-this.bol,pos:this.pos}};kb.prototype.nextInternal=function(){var a=this.re.exec(this.input);if(a.index!==this.pos)throw ha("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(Ae,""),toktype:Ec[d]}};kb.prototype.next=function(){var a;do if(a=this.nextInternal(),"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 ha("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 Be={ctype:"void"};Eb.prototype.postprocess=function(a){if(null===a)return Be;if(a){if("infix"===a.ctype)if(":="===a.oper){var b=a.args[0];if("function"===b.ctype)b.args.forEach(function(c){if(null===c||"variable"!==c.ctype)throw ha("Function argument must be an identifier",c.start||a.start);});else if("variable"!==b.ctype)throw ha(a.oper+" can only be used to define functions or variables",
-a.start);}else if(","===a.oper)throw ha("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 ha("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}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)};throw Error("Unsupported AST node of type "+a.ctype);};Eb.prototype.parse=function(a){try{var b=bd(new kb(a));if("EOF"!==b.closedBy.toktype)throw ha("Closing bracket never opened.",b.closedBy.start,b.closedBy.text);return this.postprocess(b.expr)}catch(c){return c.ctype="error",c}};"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===
-typeof window&&(module.exports.Parser=Eb,module.exports.Tokenizer=kb,module.exports.unicodeLetters=Dc,module.exports.parse=function(a){return(new Eb).parse(a)});var Nc={},Fc;Fc=[0,0,0,0,0,0,0,0,0,0,0,0];t.playsin$1=function(a,b){var c=B(a[0]),d=0;if("number"===c.ctype){var e;void 0!==b.line&&(e=A(b.line),"number"===e.ctype&&(d=Math.floor(e.value.real),0>d&&(d=0),10<d&&(d=10)));c=c.value.real;0!==Fc[d]&&Fc[d].set({freq:c})}return k};var P={printArr:function(a){for(var b=a.value.length,c=[],d=[],e=
-!1,f=0;f<b;f++)c[f]=a.value[f].value.real,d[f]=a.value[f].value.imag,0!==d[f]&&(e=!0);console.log(c);e&&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){var c=P.zero(b);c.value[0]=a;return c},variable:function(a,b){var c=P.zero(b);c.value[0]=a;c.value[1]=l.real(1);return c},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"),
-k;for(var c=a.value.length,d=P.zero(l.real(c)),e=l.real(0),f=0;f<c;f++){for(var g=0;g<=f;g++)e=l.add(e,l.mult(a.value[g],b.value[f-g]));d.value[f]=e;e=l.real(0)}return d},pow:function(a,b){if(0>b.value.real||b.value.real!==Math.floor(b.value.real))return P.root(a,b);for(var c=a,d=1;d<b.value.real;d++)c=P.mult(c,a);return c},root:function(a,b){var c=l.real(0),d=l.real(1),e=l.add(d,b),f=a.value.length,g=P.zero(l.real(f));g.value[0]=l.pow(a.value[0],b);for(var k=c,m,n,p=1;p<f;p++){n=l.real(p);for(var q=
-1;q<=p;q++)m=l.mult(e,l.real(q)),m=l.div(m,n),m=l.sub(m,d),m=l.mult(m,a.value[q]),m=l.mult(m,g.value[p-q]),k=l.add(k,m);k=l.div(k,a.value[0]);g.value[p]=k;k=c}return g},findFirstNoneZero:function(a,b,c){for(var d=Infinity,e=Infinity,f=c;f<a.value.length;f++)if(1E-12<l.abs2(a.value[f]).value.real){d=f;break}for(a=c;a<b.value.length;a++)if(1E-12<l.abs2(b.value[a]).value.real){e=a;break}return[d,e]},div:function(a,b){if(a.value.length!==b.value.length)return console.log("dims don't fit - return nada"),
-k;for(var c=a.value.length,d=l.real(0),e=P.zero(l.real(c)),f=d,g,m=0;m<c;m++){g=P.findFirstNoneZero(a,b,m);m<g[0]&&g[0]===g[1]&&Infinity!==g[0]&&(a.value.splice(m,g[0]),b.value.splice(m,g[0]),e.value.splice(m,g[0]),c-=g[0]);g=a.value[m];for(var n=0;n<m;n++)f=l.add(f,l.mult(e.value[n],b.value[m-n]));g=l.sub(g,f);g=l.div(g,b.value[0]);e.value[m]=g;f=d}return e},exp:function(a){var b=l.real(0),c=a.value.length,d=P.zero(l.real(c)),e=b,f;d.value[0]=l.exp(a.value[0]);for(var g=1;g<c;g++){for(var k=1;k<=
-g;k++)f=l.mult(l.real(k),a.value[k]),f=l.mult(f,d.value[g-k]),e=l.add(e,f);d.value[g]=l.div(e,l.real(g));e=b}return d},log:function(a){var b=l.real(0),c=a.value.length,d=P.zero(l.real(c));d.value[0]=l.log(a.value[0]);for(var e=b,f,g,k=1;k<c;k++){f=a.value[k];for(var m=1;m<k;m++)g=l.mult(l.real(m),d.value[m]),g=l.mult(g,a.value[k-m]),e=l.add(e,g);e=l.div(e,l.real(k));f=l.sub(f,e);f=l.div(f,a.value[0]);d.value[k]=f;e=b}return d},sincos:function(a){var b=l.real(0),c=a.value.length,d=P.zero(l.real(c)),
-e=P.zero(l.real(c));d.value[0]=l.sin(a.value[0]);e.value[0]=l.cos(a.value[0]);for(var f=b,g=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,e.value[p-q]),m=l.mult(m,d.value[p-q]),g=l.add(g,k),f=l.add(f,m);g=l.div(g,n);f=l.div(f,l.neg(n));d.value[p]=g;e.value[p]=f;f=g=b}P.sinsave=d;P.cossave=e;return[d,e]},sin:function(a){return P.sincos(a)[0]},cos:function(a){return P.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){var e;if("variable"===a.ctype)e=a.name!==b?P.number(A(a),d):P.variable(c,d);else if("number"===a.ctype)e=P.number(a,d);else{if("infix"===a.ctype){if("*"===a.oper)return P.mult(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));if("^"===a.oper)return P.pow(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d).value[0]);if("/"===a.oper)return P.div(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));if("+"===a.oper)return P.add(P.diff(a.args[0],
-b,c,d),P.diff(a.args[1],b,c,d));if("-"===a.oper)return P.sub(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));console.log("infix not found",a.oper);return k}if("function"===a.ctype){if("exp$1"===a.oper)return P.exp(P.diff(a.args[0],b,c,d));if("log$1"===a.oper)return P.log(P.diff(a.args[0],b,c,d));if("sin$1"===a.oper)return P.sin(P.diff(a.args[0],b,c,d));if("cos$1"===a.oper)return P.cos(P.diff(a.args[0],b,c,d))}else return console.log("ctype not found",a.ctype),k}return e},adevaluate:function(a,b,
-c,d){a=P.diff(a,b,c,d);d=P.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,l,k=0;k<f;k++)l=P.adevaluate(a,b,c.value[k],d),e[k]=l;return e=g.turnIntoCSList(e)}},x={handleModifs:function(a,b){x.dashing&&x.unSetDash();x.colorraw=null;x.fillcolorraw=null;x.fillrule="nonzero";x.size=null;0>=x.psize&&(x.psize=0);0>=x.lsize&&(x.lsize=0);x.overhang=1;x.dashing=!1;x.isArrow=!1;x.arrowSides="==>";x.arrowposition=
-1;x.headlen=10;x.arrowShape=x.arrowShapes.line;x.alpha=z.drawingstate.alpha;x.fillalpha=0;x.bold="";x.italics="";x.family="sans-serif";x.align=0;x.xOffset=0;x.yOffset=0;x.lineCap="round";x.lineJoin="round";x.miterLimit=10;var c,d;for(c in a){var e=a[c];e&&((d=b[c])?(!0===d&&(d=x.modifHandlers[c]),d(A(e))):console.log("Modifier not supported: "+c))}null!==x.size?x.psize=x.lsize=x.size:(x.psize=z.drawingstate.pointsize,x.lsize=z.drawingstate.linesize);x.dashing&&x.dashing(x.lsize);null!==x.colorraw?
-x.pointColor=x.lineColor=x.textColor=x.makeColor(x.colorraw):1===x.alpha?(x.pointColor=z.drawingstate.pointcolor,x.lineColor=z.drawingstate.linecolor,x.textColor=z.drawingstate.textcolor):(x.pointColor=x.makeColor(z.drawingstate.pointcolorraw),x.lineColor=x.makeColor(z.drawingstate.linecolorraw),x.textColor=x.makeColor(z.drawingstate.textcolorraw));x.black=1===x.alpha?"rgb(0,0,0)":"rgba(0,0,0,"+x.alpha+")";x.fillColor=x.fillcolorraw&&0<x.fillalpha?x.makeColor(x.fillcolorraw,x.fillalpha):null},modifHandlers:{size:function(a){"number"===
-a.ctype&&(x.size=a.value.real,0>x.size&&(x.size=0),1E3<x.size&&(x.size=1E3))},color:function(a){g.isNumberVector(a).value&&3===a.value.length&&(x.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&&(x.fillcolorraw=[a.value[0].value.real,a.value[1].value.real,a.value[2].value.real])},alpha:function(a){"number"===a.ctype&&(x.alpha=a.value.real)},fillalpha:function(a){"number"===a.ctype&&(x.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);x.dashing=x.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=x.dashTypes[a])x.dashing=x.setDash.bind(null,a)},dashing:function(a){"number"===a.ctype&&(a=Math.floor(a.value.real),x.dashing=x.setDash.bind(null,[2*a,a]))},overhang:function(a){"number"===a.ctype&&
-(x.overhang=x.overhang*a.value.real+(1-x.overhang)*(1-a.value.real))},arrow:function(a){"boolean"===a.ctype?x.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"):x.arrowShapes.hasOwnProperty(a.value)?(x.arrowShape=x.arrowShapes[a.value],x.isArrow=!0,x.arrowShape.deprecated&&(console.log("arrowshape "+a.value+" is deprecated, use "+x.arrowShape.deprecated+" instead."),x.arrowShape.deprecated=
-null)):(a=Object.keys(x.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"):(x.arrowSides=a.value,x.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?
-x.overhang=x.overhang*a.value.real+(1-x.overhang)*(1-a.value.real):(x.arrowposition=a.value.real,x.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"):x.headlen*=a.value.real},bold:function(a){"boolean"===a.ctype&&a.value&&(x.bold="bold ")},italics:function(a){"boolean"===a.ctype&&a.value&&(x.italics="italic ")},family:function(a){"string"===a.ctype&&(x.family=a.value)},align:function(a){"string"===
-a.ctype&&(a=a.value,"left"===a&&(x.align=0),"right"===a&&(x.align=1),"mid"===a&&(x.align=.5))},x_offset:function(a){"number"===a.ctype&&(x.xOffset=a.value.real)},y_offset:function(a){"number"===a.ctype&&(x.yOffset=a.value.real)},offset:function(a){"list"===a.ctype&&2===a.value.length&&"number"===a.value[0].ctype&&"number"===a.value[1].ctype&&(x.xOffset=a.value[0].value.real,x.yOffset=a.value[1].value.real)},lineCap:function(a){"string"!==a.ctype||"round"!==a.value&&"square"!==a.value&&"butt"!==a.value||
-(x.lineCap=a.value)},lineJoin:function(a){"string"!==a.ctype||"round"!==a.value&&"bevel"!==a.value&&"miter"!==a.value||(x.lineJoin=a.value)},fillrule:function(a){"string"!==a.ctype||"nonzero"!==a.value&&"evenodd"!==a.value||(x.fillrule=a.value)},miterLimit:function(a){"number"===a.ctype&&0<a.value.real&&(x.miterLimit=Math.round(a.value.real))}},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}};x.pointAndLineModifs=x.lineModifs;x.conicModifs={size:!0,color:!0,alpha:!0,fillcolor:!0,fillrule:!0,fillalpha:!0,lineCap:!0,lineJoin:!0,miterLimit:!0};x.textModifs={size:!0,color:!0,alpha:!0,bold:!0,italics:!0,family:!0,align:!0,x_offset:!0,y_offset:!0,offset:!0};x.makeColor=function(a,b){void 0===b&&(b=x.alpha);return"rgba("+Math.floor(255*a[0])+","+Math.floor(255*a[1])+","+Math.floor(255*a[2])+","+b+")"};x.preDrawCurve=
-function(){y.lineWidth=x.lsize;y.lineCap=x.lineCap;y.lineJoin=x.lineJoin;y.mozFillRule=x.fillrule;y.fillrule=x.fillrule;y.miterLimit=x.miterLimit;y.strokeStyle=x.lineColor};x.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"}};x.clipSegment=function(a,
-b){var c=b.x-a.x,d=b.y-a.y,e=x.clipLineCore(-d,c,a.x*b.y-b.x*a.y);if(2!==e.length)return[];var f=e[0],e=e[1],g=1/(c*c+d*d),l=((f.x-a.x)*c+(f.y-a.y)*d)*g,c=((e.x-a.x)*c+(e.y-a.y)*d)*g;0>l&&(f=a);1<l&&(f=b);0>c&&(e=a);1<c&&(e=b);return f===e?[]:[f,e]};x.drawsegcore=function(a,b){function c(a,b,c,h){var d=a-h*q+.5*t,e=b-h*t-.5*q,f=a-h*q-.5*t;h=b-h*t+.5*q;y.beginPath();x.arrowShape.fill&&(y.lineWidth=x.lsize/2);y.moveTo(d,e);y.lineTo(a,b);y.lineTo(f,h);x.arrowShape.close&&(y.fillStyle=x.lineColor,y.lineTo(a-
-c*q,b-c*t),y.closePath(),x.arrowShape.fill&&y.fill());y.stroke()}var d=z.drawingstate.matrix,e=a.x*d.a-a.y*d.b+d.tx,f=a.x*d.c-a.y*d.d-d.ty,g=b.x*d.a-b.y*d.b+d.tx,l=b.x*d.c-b.y*d.d-d.ty,k=x.overhang,m=1-k,d=k*e+m*g,n=k*f+m*l,p=k*g+m*e,k=k*l+m*f;if(0>d||d>da||0>n||n>ca||0>p||p>da||0>k||k>ca){k=x.clipSegment({x:d,y:n},{x:p,y:k});if(2!==k.length||.01>x.lsize)return;d=k[0].x;n=k[0].y;p=k[1].x;k=k[1].y}x.preDrawCurve();if(!x.isArrow||e===f&&g===l).01>x.lsize||(y.beginPath(),y.moveTo(d,n),y.lineTo(p,k),
-y.stroke());else{var e=g-e,f=l-f,g=x.headlen/Math.sqrt(e*e+f*f),q=e*g,t=f*g,l=x.arrowposition,m=1-l,f=l*d+m*p,e=l*n+m*k,g=l*p+m*d,l=l*k+m*n,m=x.arrowSides;y.beginPath();x.arrowShape.close?("<==>"===m||"<=="===m?(1>x.arrowposition&&(y.moveTo(d,n),y.lineTo(f,e)),y.moveTo(f+q,e+t)):y.moveTo(d,n),"==>"===m||"<==>"===m?(y.lineTo(g-q,l-t),1>x.arrowposition&&(y.moveTo(g,l),y.lineTo(p,k))):y.lineTo(p,k)):(y.moveTo(d,n),y.lineTo(p,k));y.stroke();"==>"!==m&&"<==>"!==m||c(g,l,1,x.arrowShape.ratio);"<=="!==m&&
-"<==>"!==m||c(f,e,-1,-x.arrowShape.ratio)}};x.drawpoint=function(a){var b=z.drawingstate.matrix,c=a.x*b.a-a.y*b.b+b.tx;a=a.x*b.c-a.y*b.d-b.ty;y.lineWidth=.3*x.psize;y.beginPath();y.arc(c,a,x.psize,0,2*Math.PI);y.fillStyle=x.pointColor;y.fill();y.beginPath();y.arc(c,a,1.15*x.psize,0,2*Math.PI);y.fillStyle=x.black;y.strokeStyle=x.black;y.stroke()};x.clipLineCore=function(a,b,c){var d=Math.SQRT1_2*x.lsize,e=0-d,f=da+d,g=0-d,d=ca+d,l=0>e*a+g*b+c,k=0>f*a+g*b+c,m=0>e*a+d*b+c,n=0>f*a+d*b+c,p=[];l!==k&&p.push({x:(-c-
-b*g)/a,y:g});k!==n&&p.push({x:f,y:(-c-a*f)/b});m!==n&&p.push({x:(-c-b*d)/a,y:d});l!==m&&p.push({x:e,y:(-c-a*e)/b});return p};x.clipLine=function(a){a=g.normalizeMax(g.productVM(a,z.toMat()));return x.clipLineCore(a.value[0].value.real,a.value[1].value.real,a.value[2].value.real)};x.drawline=function(a){g._helper.isAlmostReal(a)&&(a=x.clipLine(a),2===a.length&&.01<=x.lsize&&(x.preDrawCurve(),y.beginPath(),y.moveTo(a[0].x,a[0].y),y.lineTo(a[1].x,a[1].y),y.stroke()))};x.drawRaySegment=function(a,b){var c=
-D.extractPoint(a),d=D.extractPoint(b);if(c.ok&&d.ok){var e=c.x-d.x,f=c.y-d.y,g=25E3/z.drawingstate.matrix.sdet/Math.sqrt(e*e+f*f),e=e*g,f=f*g;x.drawsegcore(c,{x:c.x+e,y:c.y+f});x.drawsegcore(d,{x:d.x-e,y:d.y-f})}};x.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]};x.setDash=function(a,b){var c=
-Math.sqrt(b);a=a.slice();for(var d=0;d<a.length;d++)a[d]*=c;y.webkitLineDash=a;y.setLineDash(a);y.mozDash=a};x.unSetDash=function(){y.webkitLineDash=[];y.setLineDash([]);y.mozDash=[]};dd.prototype={set fillStyle(a){var b=this;Rb(a,function(a,d,e,f){b._fill="#"+lb(a.toString(16),2)+lb(d.toString(16),2)+lb(e.toString(16),2);b._fillOpacity=255===f?null:f})},set strokeStyle(a){var b=this;Rb(a,function(a,d,e,f){b._stroke="#"+lb(a.toString(16),2)+lb(d.toString(16),2)+lb(e.toString(16),2);b._strokeOpacity=
-255===f?null:f})},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,e,f){this._pathcmd("C",a,b,c,d,e,f)},quadraticCurveTo:function(a,b,c,d){this._pathcmd("Q",a,b,c,d)},arc:function(a,b,c,d,e,f){var g=c*Math.cos(d)+a,l=c*Math.sin(d)+b,k=c*Math.cos(e)+a,m=c*Math.sin(e)+
-b;e=f?d-e:e-d;e>=2*Math.PI?this._pathcmd(this._path.length?"L":"M",g,l,"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,g,l):this._pathcmd(this._path.length?"L":"M",g,l,"A",c,c,0,e>Math.PI?1:0,f?1:0,k,m)},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'+
+"\ud80c\ud840-\ud868\ud86a-\ud86c\ud86f-\ud872"),He=("#(?: [1-9])?|(?:'|"+Lc+")(?: (?:[0-9']|"+Lc+"))*").replace(/ /g,"[ \t]*"),hd=["([ \t\n]+)|(//.*)|(/\\*)","("+Ee+")","("+Kc.map(gd).join("|")+")","("+"[](){}||".split("").map(gd).join("|")+")","("+Ge+")","("+Fe+")","("+He+")",'("[^"]*")|($)'].join("|"),Ie=new RegExp("[ \t]*".replace(/\*$/,"+"),"g"),Mc="ANY WS COMMENT START_COMMENT NUM OP BRA SUB SUP ID STR EOF".split(" ");(function(){var a=(new RegExp(hd,"g")).exec("");if(a.hasOwnProperty(Mc.length))throw Error("RE has more groups than expected");
+if(!a.hasOwnProperty(Mc.length-1))throw Error("RE has fewer groups than expected");})();qb.prototype.advanceBy=function(a){this.advanceTo(this.pos+a)};qb.prototype.advanceTo=function(a){for(this.pos=a;this.bols[0]<=a;)this.bol=this.bols.shift(),this.line++};qb.prototype.curPos=function(){return{row:this.line,col:this.pos-this.bol,pos:this.pos}};qb.prototype.nextInternal=function(){var a=this.re.exec(this.input);if(a.index!==this.pos)throw la("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(Ie,""),toktype:Mc[d]}};qb.prototype.next=function(){var a;do if(a=this.nextInternal(),"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 la("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 Je={ctype:"void"};Lb.prototype.postprocess=function(a){if(null===a)return Je;if(a){if("infix"===a.ctype)if(":="===a.oper){var b=a.args[0];if("function"===b.ctype)b.args.forEach(function(c){if(null===c||"variable"!==c.ctype)throw la("Function argument must be an identifier",c.start||a.start);});else if("variable"!==b.ctype)throw la(a.oper+" can only be used to define functions or variables",
+a.start);}else if(","===a.oper)throw la("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 la("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.args[1])throw la("Data 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};throw Error("Unsupported AST node of type "+a.ctype);};Lb.prototype.parse=function(a){try{var b=jd(new qb(a));if("EOF"!==b.closedBy.toktype)throw la("Closing bracket never opened.",
+b.closedBy.start,b.closedBy.text);return this.postprocess(b.expr)}catch(c){return c.ctype="error",c}};"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===typeof window&&(module.exports.Parser=Lb,module.exports.Tokenizer=qb,module.exports.unicodeLetters=Lc,module.exports.parse=function(a){return(new Lb).parse(a)});var hb={},Mb=[],Nc;Nc=[0,0,0,0,0,0,0,0,0,0,0,0];t.playsin$1=function(a,b){var c=B(a[0]),d=0;if("number"===c.ctype){var e;void 0!==
+b.line&&(e=z(b.line),"number"===e.ctype&&(d=Math.floor(e.value.real),0>d&&(d=0),10<d&&(d=10)));c=c.value.real;0!==Nc[d]&&Nc[d].set({freq:c})}return k};var P={printArr:function(a){for(var b=a.value.length,c=[],d=[],e=!1,h=0;h<b;h++)c[h]=a.value[h].value.real,d[h]=a.value[h].value.imag,0!==d[h]&&(e=!0);console.log(c);e&&console.log(d)},zero:function(a){for(var b=[],c=m.real(0),d=0;d<a.value.real;d++)b[d]=c;return h.turnIntoCSList(b)},number:function(a,b){var c=P.zero(b);c.value[0]=a;return c},variable:function(a,
+b){var c=P.zero(b);c.value[0]=a;c.value[1]=m.real(1);return c},add:function(a,b){return h.add(a,b)},sub:function(a,b){return h.sub(a,b)},mult:function(a,b){if(a.value.length!==b.value.length)return console.error("dims don't fit return nada"),k;for(var c=a.value.length,d=P.zero(m.real(c)),e=m.real(0),h=0;h<c;h++){for(var f=0;f<=h;f++)e=m.add(e,m.mult(a.value[f],b.value[h-f]));d.value[h]=e;e=m.real(0)}return d},pow:function(a,b){if(0>b.value.real||b.value.real!==Math.floor(b.value.real))return P.root(a,
+b);for(var c=a,d=1;d<b.value.real;d++)c=P.mult(c,a);return c},root:function(a,b){var c=m.real(0),d=m.real(1),e=m.add(d,b),h=a.value.length,f=P.zero(m.real(h));f.value[0]=m.pow(a.value[0],b);for(var k=c,l,n,p=1;p<h;p++){n=m.real(p);for(var r=1;r<=p;r++)l=m.mult(e,m.real(r)),l=m.div(l,n),l=m.sub(l,d),l=m.mult(l,a.value[r]),l=m.mult(l,f.value[p-r]),k=m.add(k,l);k=m.div(k,a.value[0]);f.value[p]=k;k=c}return f},findFirstNoneZero:function(a,b,c){for(var d=Infinity,e=Infinity,h=c;h<a.value.length;h++)if(1E-12<
+m.abs2(a.value[h]).value.real){d=h;break}for(a=c;a<b.value.length;a++)if(1E-12<m.abs2(b.value[a]).value.real){e=a;break}return[d,e]},div:function(a,b){if(a.value.length!==b.value.length)return console.log("dims don't fit - return nada"),k;for(var c=a.value.length,d=m.real(0),e=P.zero(m.real(c)),h=d,f,l=0;l<c;l++){f=P.findFirstNoneZero(a,b,l);l<f[0]&&f[0]===f[1]&&Infinity!==f[0]&&(a.value.splice(l,f[0]),b.value.splice(l,f[0]),e.value.splice(l,f[0]),c-=f[0]);f=a.value[l];for(var n=0;n<l;n++)h=m.add(h,
+m.mult(e.value[n],b.value[l-n]));f=m.sub(f,h);f=m.div(f,b.value[0]);e.value[l]=f;h=d}return e},exp:function(a){var b=m.real(0),c=a.value.length,d=P.zero(m.real(c)),e=b,h;d.value[0]=m.exp(a.value[0]);for(var f=1;f<c;f++){for(var k=1;k<=f;k++)h=m.mult(m.real(k),a.value[k]),h=m.mult(h,d.value[f-k]),e=m.add(e,h);d.value[f]=m.div(e,m.real(f));e=b}return d},log:function(a){var b=m.real(0),c=a.value.length,d=P.zero(m.real(c));d.value[0]=m.log(a.value[0]);for(var e=b,h,f,k=1;k<c;k++){h=a.value[k];for(var l=
+1;l<k;l++)f=m.mult(m.real(l),d.value[l]),f=m.mult(f,a.value[k-l]),e=m.add(e,f);e=m.div(e,m.real(k));h=m.sub(h,e);h=m.div(h,a.value[0]);d.value[k]=h;e=b}return d},sincos:function(a){var b=m.real(0),c=a.value.length,d=P.zero(m.real(c)),e=P.zero(m.real(c));d.value[0]=m.sin(a.value[0]);e.value[0]=m.cos(a.value[0]);for(var h=b,f=b,k,l,n,p=1;p<c;p++){n=m.real(p);for(var r=1;r<=p;r++)l=m.mult(m.real(r),a.value[r]),k=m.mult(l,e.value[p-r]),l=m.mult(l,d.value[p-r]),f=m.add(f,k),h=m.add(h,l);f=m.div(f,n);h=
+m.div(h,m.neg(n));d.value[p]=f;e.value[p]=h;h=f=b}P.sinsave=d;P.cossave=e;return[d,e]},sin:function(a){return P.sincos(a)[0]},cos:function(a){return P.sincos(a)[1]},faculty:function(a){var b=[];b[0]=m.real(1);for(var c=1,d=1;d<=a.value.real;d++)c*=d,b[d]=m.real(c);return b=h.turnIntoCSList(b)},diff:function(a,b,c,d){var e;if("variable"===a.ctype)e=a.name!==b?P.number(z(a),d):P.variable(c,d);else if("number"===a.ctype)e=P.number(a,d);else{if("infix"===a.ctype){if("*"===a.oper)return P.mult(P.diff(a.args[0],
+b,c,d),P.diff(a.args[1],b,c,d));if("^"===a.oper)return P.pow(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d).value[0]);if("/"===a.oper)return P.div(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));if("+"===a.oper)return P.add(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));if("-"===a.oper)return P.sub(P.diff(a.args[0],b,c,d),P.diff(a.args[1],b,c,d));console.log("infix not found",a.oper);return k}if("function"===a.ctype){if("exp$1"===a.oper)return P.exp(P.diff(a.args[0],b,c,d));if("log$1"===a.oper)return P.log(P.diff(a.args[0],
+b,c,d));if("sin$1"===a.oper)return P.sin(P.diff(a.args[0],b,c,d));if("cos$1"===a.oper)return P.cos(P.diff(a.args[0],b,c,d))}else return console.log("ctype not found",a.ctype),k}return e},adevaluate:function(a,b,c,d){a=P.diff(a,b,c,d);d=P.faculty(d);for(b=2;b<a.value.length;b++)a.value[b]=m.mult(a.value[b],d.value[b]);return a},autodiff:function(a,b,c,d){for(var e=[],f=c.value.length,m,k=0;k<f;k++)m=P.adevaluate(a,b,c.value[k],d),e[k]=m;return e=h.turnIntoCSList(e)}},x={handleModifs:function(a,b){x.dashing&&
+x.unSetDash();x.colorraw=null;x.fillcolorraw=null;x.fillrule="nonzero";x.size=null;0>=x.psize&&(x.psize=0);0>=x.lsize&&(x.lsize=0);x.overhang=1;x.dashing=!1;x.isArrow=!1;x.arrowSides="==>";x.arrowposition=1;x.headlen=10;x.arrowShape=x.arrowShapes.line;x.alpha=y.drawingstate.alpha;x.fillalpha=0;x.bold="";x.italics="";x.family="sans-serif";x.align=0;x.xOffset=0;x.yOffset=0;x.lineCap="round";x.lineJoin="round";x.miterLimit=10;x.noborder=!1;var c,d;for(c in a){var e=a[c];e&&((d=b[c])?(!0===d&&(d=x.modifHandlers[c]),
+d(z(e))):console.log("Modifier not supported: "+c))}null!==x.size?x.psize=x.lsize=x.size:(x.psize=y.drawingstate.pointsize,x.lsize=y.drawingstate.linesize);x.dashing&&x.dashing(x.lsize);null!==x.colorraw?x.pointColor=x.lineColor=x.textColor=x.makeColor(x.colorraw):1===x.alpha?(x.pointColor=y.drawingstate.pointcolor,x.lineColor=y.drawingstate.linecolor,x.textColor=y.drawingstate.textcolor):(x.pointColor=x.makeColor(y.drawingstate.pointcolorraw),x.lineColor=x.makeColor(y.drawingstate.linecolorraw),
+x.textColor=x.makeColor(y.drawingstate.textcolorraw));x.black=1===x.alpha?"rgb(0,0,0)":"rgba(0,0,0,"+x.alpha+")";x.fillColor=x.fillcolorraw&&0<x.fillalpha?x.makeColor(x.fillcolorraw,x.fillalpha):null},modifHandlers:{size:function(a){"number"===a.ctype&&(x.size=a.value.real,0>x.size&&(x.size=0),1E3<x.size&&(x.size=1E3))},color:function(a){h.isNumberVector(a).value&&3===a.value.length&&(x.colorraw=[a.value[0].value.real,a.value[1].value.real,a.value[2].value.real])},fillcolor:function(a){h.isNumberVector(a).value&&
+3===a.value.length&&(x.fillcolorraw=[a.value[0].value.real,a.value[1].value.real,a.value[2].value.real])},alpha:function(a){"number"===a.ctype&&(x.alpha=a.value.real)},fillalpha:function(a){"number"===a.ctype&&(x.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);x.dashing=x.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=x.dashTypes[a])x.dashing=x.setDash.bind(null,a)},dashing:function(a){"number"===a.ctype&&(a=Math.floor(a.value.real),x.dashing=x.setDash.bind(null,[2*a,a]))},overhang:function(a){"number"===a.ctype&&(x.overhang=x.overhang*a.value.real+(1-x.overhang)*(1-a.value.real))},arrow:function(a){"boolean"===a.ctype?x.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"):
+x.arrowShapes.hasOwnProperty(a.value)?(x.arrowShape=x.arrowShapes[a.value],x.isArrow=!0,x.arrowShape.deprecated&&(console.log("arrowshape "+a.value+" is deprecated, use "+x.arrowShape.deprecated+" instead."),x.arrowShape.deprecated=null)):(a=Object.keys(x.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"):
+(x.arrowSides=a.value,x.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?x.overhang=x.overhang*a.value.real+(1-x.overhang)*(1-a.value.real):(x.arrowposition=a.value.real,x.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"):x.headlen*=a.value.real},
+bold:function(a){"boolean"===a.ctype&&a.value&&(x.bold="bold ")},italics:function(a){"boolean"===a.ctype&&a.value&&(x.italics="italic ")},family:function(a){"string"===a.ctype&&(x.family=a.value)},align:function(a){"string"===a.ctype&&(a=a.value,"left"===a&&(x.align=0),"right"===a&&(x.align=1),"mid"===a||"center"===a)&&(x.align=.5)},x_offset:function(a){"number"===a.ctype&&(x.xOffset=a.value.real)},y_offset:function(a){"number"===a.ctype&&(x.yOffset=a.value.real)},offset:function(a){"list"===a.ctype&&
+2===a.value.length&&"number"===a.value[0].ctype&&"number"===a.value[1].ctype&&(x.xOffset=a.value[0].value.real,x.yOffset=a.value[1].value.real)},lineCap:function(a){"string"!==a.ctype||"round"!==a.value&&"square"!==a.value&&"butt"!==a.value||(x.lineCap=a.value)},lineJoin:function(a){"string"!==a.ctype||"round"!==a.value&&"bevel"!==a.value&&"miter"!==a.value||(x.lineJoin=a.value)},fillrule:function(a){"string"!==a.ctype||"nonzero"!==a.value&&"evenodd"!==a.value||(x.fillrule=a.value)},miterLimit:function(a){"number"===
+a.ctype&&0<a.value.real&&(x.miterLimit=Math.round(a.value.real))},noborder:function(a){"boolean"===a.ctype?x.noborder=a.value:console.error("noborder needs to be of type boolean")},border:function(a){"boolean"===a.ctype?x.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}};x.pointAndLineModifs=x.lineModifs;x.conicModifs={size:!0,color:!0,alpha:!0,fillcolor:!0,fillrule:!0,fillalpha:!0,lineCap:!0,lineJoin:!0,miterLimit:!0};x.textModifs={size:!0,color:!0,alpha:!0,bold:!0,italics:!0,family:!0,align:!0,x_offset:!0,y_offset:!0,offset:!0};x.makeColor=function(a,b){void 0===b&&(b=x.alpha);return"rgba("+Math.floor(255*a[0])+","+Math.floor(255*a[1])+","+Math.floor(255*a[2])+","+b+")"};x.preDrawCurve=function(){A.lineWidth=x.lsize;A.lineCap=
+x.lineCap;A.lineJoin=x.lineJoin;A.mozFillRule=x.fillrule;A.fillrule=x.fillrule;A.miterLimit=x.miterLimit;A.strokeStyle=x.lineColor};x.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"}};x.clipSegment=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=x.clipLineCore(-d,
+c,a.x*b.y-b.x*a.y);if(2!==e.length)return[];var h=e[0],e=e[1],f=1/(c*c+d*d),m=((h.x-a.x)*c+(h.y-a.y)*d)*f,c=((e.x-a.x)*c+(e.y-a.y)*d)*f;0>m&&(h=a);1<m&&(h=b);0>c&&(e=a);1<c&&(e=b);return h===e?[]:[h,e]};x.drawsegcore=function(a,b){function c(a,b,c,g){var d=a-g*r+.5*t,e=b-g*t-.5*r,h=a-g*r-.5*t;g=b-g*t+.5*r;A.beginPath();x.arrowShape.fill&&(A.lineWidth=x.lsize/2);A.moveTo(d,e);A.lineTo(a,b);A.lineTo(h,g);x.arrowShape.close&&(A.fillStyle=x.lineColor,A.lineTo(a-c*r,b-c*t),A.closePath(),x.arrowShape.fill&&
+A.fill());A.stroke()}var d=y.drawingstate.matrix,e=a.x*d.a-a.y*d.b+d.tx,h=a.x*d.c-a.y*d.d-d.ty,f=b.x*d.a-b.y*d.b+d.tx,m=b.x*d.c-b.y*d.d-d.ty,k=x.overhang,l=1-k,d=k*e+l*f,n=k*h+l*m,p=k*f+l*e,k=k*m+l*h;if(0>d||d>ca||0>n||n>da||0>p||p>ca||0>k||k>da){k=x.clipSegment({x:d,y:n},{x:p,y:k});if(2!==k.length||.01>x.lsize)return;d=k[0].x;n=k[0].y;p=k[1].x;k=k[1].y}x.preDrawCurve();if(!x.isArrow||e===h&&f===m).01>x.lsize||(A.beginPath(),A.moveTo(d,n),A.lineTo(p,k),A.stroke());else{var e=f-e,h=m-h,f=x.headlen/
+Math.sqrt(e*e+h*h),r=e*f,t=h*f,m=x.arrowposition,l=1-m,h=m*d+l*p,e=m*n+l*k,f=m*p+l*d,m=m*k+l*n,l=x.arrowSides;A.beginPath();x.arrowShape.close?("<==>"===l||"<=="===l?(1>x.arrowposition&&(A.moveTo(d,n),A.lineTo(h,e)),A.moveTo(h+r,e+t)):A.moveTo(d,n),"==>"===l||"<==>"===l?(A.lineTo(f-r,m-t),1>x.arrowposition&&(A.moveTo(f,m),A.lineTo(p,k))):A.lineTo(p,k)):(A.moveTo(d,n),A.lineTo(p,k));A.stroke();"==>"!==l&&"<==>"!==l||c(f,m,1,x.arrowShape.ratio);"<=="!==l&&"<==>"!==l||c(h,e,-1,-x.arrowShape.ratio)}};
+x.drawpoint=function(a){var b=y.drawingstate.matrix,c=a.x*b.a-a.y*b.b+b.tx;a=a.x*b.c-a.y*b.d-b.ty;A.lineWidth=.3*x.psize;A.beginPath();A.arc(c,a,x.psize,0,2*Math.PI);A.fillStyle=x.pointColor;A.fill();x.noborder||(A.beginPath(),A.arc(c,a,1.15*x.psize,0,2*Math.PI),A.fillStyle=x.black,A.strokeStyle=x.black,A.stroke())};x.clipLineCore=function(a,b,c){var d=Math.SQRT1_2*x.lsize,e=0-d,h=ca+d,f=0-d,d=da+d,m=0>e*a+f*b+c,k=0>h*a+f*b+c,l=0>e*a+d*b+c,n=0>h*a+d*b+c,p=[];m!==k&&p.push({x:(-c-b*f)/a,y:f});k!==
+n&&p.push({x:h,y:(-c-a*h)/b});l!==n&&p.push({x:(-c-b*d)/a,y:d});m!==l&&p.push({x:e,y:(-c-a*e)/b});return p};x.clipLine=function(a){a=h.normalizeMax(h.productVM(a,y.toMat()));return x.clipLineCore(a.value[0].value.real,a.value[1].value.real,a.value[2].value.real)};x.drawline=function(a){h._helper.isAlmostReal(a)&&(a=x.clipLine(a),2===a.length&&.01<=x.lsize&&(x.preDrawCurve(),A.beginPath(),A.moveTo(a[0].x,a[0].y),A.lineTo(a[1].x,a[1].y),A.stroke()))};x.drawRaySegment=function(a,b){var c=D.extractPoint(a),
+d=D.extractPoint(b);if(c.ok&&d.ok){var e=c.x-d.x,h=c.y-d.y,f=25E3/y.drawingstate.matrix.sdet/Math.sqrt(e*e+h*h),e=e*f,h=h*f;x.drawsegcore(c,{x:c.x+e,y:c.y+h});x.drawsegcore(d,{x:d.x-e,y:d.y-h})}};x.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]};x.setDash=function(a,b){var c=Math.sqrt(b);
+a=a.slice();for(var d=0;d<a.length;d++)a[d]*=c;A.webkitLineDash=a;A.setLineDash(a);A.mozDash=a};x.unSetDash=function(){A.webkitLineDash=[];A.setLineDash([]);A.mozDash=[]};ld.prototype={set fillStyle(a){var b=this;ac(a,function(a,d,e,h){b._fill="#"+rb(a.toString(16),2)+rb(d.toString(16),2)+rb(e.toString(16),2);b._fillOpacity=255===h?null:h})},set strokeStyle(a){var b=this;ac(a,function(a,d,e,h){b._stroke="#"+rb(a.toString(16),2)+rb(d.toString(16),2)+rb(e.toString(16),2);b._strokeOpacity=255===h?null:
+h})},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,e,h){this._pathcmd("C",a,b,c,d,e,h)},quadraticCurveTo:function(a,b,c,d){this._pathcmd("Q",a,b,c,d)},arc:function(a,b,c,d,e,h){var f=c*Math.cos(d)+a,m=c*Math.sin(d)+b,k=c*Math.cos(e)+a,l=c*Math.sin(e)+b;e=h?d-e:
+e-d;e>=2*Math.PI?this._pathcmd(this._path.length?"L":"M",f,m,"A",c,c,0,0,h?1:0,a-c*Math.cos(d),b-c*Math.sin(d),"A",c,c,0,0,h?1:0,f,m):this._pathcmd(this._path.length?"L":"M",f,m,"A",c,c,0,e>Math.PI?1:0,h?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,e,f){this._transform("matrix("+[a,b,c,d,e,f].join(" ")+")")},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("SvgWriterContext only supports 3-argument version of drawImage");var d=this._imgcache.indexOf(a);if(-1===d){var d=this._imgcache.length,e;e=a.cachedDataURL?a.cachedDataURL:fd(a);this._defs.push('<image id="img'+d+'" x="0" y="0" width="'+
+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,e,h){this._transform("matrix("+[a,b,c,d,e,h].join(" ")+")")},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("SvgWriterContext only supports 3-argument version of drawImage");var d=this._imgcache.indexOf(a);if(-1===d){var d=this._imgcache.length,e;e=a.cachedDataURL?a.cachedDataURL:nd(a);this._defs.push('<image id="img'+d+'" x="0" y="0" width="'+
a.width+'" height="'+a.height+'" xlink:href="'+e+'"/>');this._imgcache.push(a)}this._cmd('<use x="'+b+'" y="'+c+'" xlink:href="#img'+d+'"/>')},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"})}};ed.prototype={_cmd:function(){this._body.push(Array.prototype.join.call(arguments," "))},_setAlpha:function(a,b,c){var d=Math.round(255*a*this._globalAlpha);b+=d;this._extGState[b]="<< /"+c+" "+d/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;Rb(a,function(a,d,e,f){b._cmd(a/
-255,d/255,e/255,"rg");b._setAlpha(b._fillAlpha=f,"Af","ca")})},set strokeStyle(a){var b=this;Rb(a,function(a,d,e,f){b._cmd(a/255,d/255,e/255,"RG");b._setAlpha(b._strokeAlpha=f,"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,e,f){this._cmd(a,-b,c,-d,this._xPos=e,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,e,f){if(0===d&&e===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-
+this._body.join("\n")+"\n</g>\n</svg>\n";return new Blob([a],{type:"image/svg+xml"})}};md.prototype={_cmd:function(){this._body.push(Array.prototype.join.call(arguments," "))},_setAlpha:function(a,b,c){var d=Math.round(255*a*this._globalAlpha);b+=d;this._extGState[b]="<< /"+c+" "+d/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;ac(a,function(a,d,e,h){b._cmd(a/
+255,d/255,e/255,"rg");b._setAlpha(b._fillAlpha=h,"Af","ca")})},set strokeStyle(a){var b=this;ac(a,function(a,d,e,h){b._cmd(a/255,d/255,e/255,"RG");b._setAlpha(b._strokeAlpha=h,"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,e,h){this._cmd(a,-b,c,-d,this._xPos=e,this._yPos=-h,"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,e,h){if(0===d&&e===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,e,f){this._cmd(a,-b,-c,d,e,-f,"cm")},_png:function(a){if("data:image/png;base64,"!==
-a.substr(0,22))return{error:"Not a base64-encoded PNG file"};a=Wd(a.substr(22));var b=Xd(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,e=c[8],f=c[9],g=0===(f&2),l=0!==(f&4),k=c[10],m=c[11],c=c[12];if(0!==k)throw Error("Unsupported PNG compression method: "+k);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=g?1:3;k=b.filter(function(a){return"IDAT"===a.type}).map(function(a){return a.data});if(l){l=window.pako;m=new l.Inflate;for(b=0;b<k.length;++b)m.push(k[b],b+1===k.length);if(m.err)throw Error(m.err);m=m.result;c=e>>>3;if(m.length!==d*(a*(f+1)*c+1))throw Error("Data length mismatch");for(var n=f*c,k=new Uint8Array(d*(a*n+1)),p=new Uint8Array(d*(a*c+1)),q=0,t=0,u=0,v=0;v<
-d;++v){k[t++]=p[u++]=m[q++];for(var w=0;w<a;++w){for(b=0;b<n;++b)k[t++]=m[q++];for(b=0;b<c;++b)p[u++]=m[q++]}}if(q!==m.length||t!==k.length||u!==p.length)throw Error("Seems we garbled our index computation somehow");p=l.deflate(p);m=this._strm({Type:"/XObject",Subtype:"/Image",Width:a,Height:d,ColorSpace:"/DeviceGray",BitsPerComponent:e,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:1,BitsPerComponent:e,Columns:a})},p).ref;k=[l.deflate(k)]}var x=0;k.forEach(function(a){x+=a.length});
-return this._obj([this._dict({Type:"/XObject",Subtype:"/Image",Name:"/img"+this._imgcache.length,Width:a,Height:d,ColorSpace:g?"/DeviceGray":"/DeviceRGB",SMask:m,BitsPerComponent:e,Length:x,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:f,BitsPerComponent:e,Columns:a})}),"\nstream\n"].concat(k,["\nendstream"]))},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("PdfWriterContext only supports 3-argument version of drawImage");var d=this._imgcache.indexOf(a);if(-1===
-d){d=this._imgcache.length;this._imgcache.push(a);var e=this._png(a.cachedDataURL||"");e.hasOwnProperty("error")&&(e=this._png(fd(a)));if(e.hasOwnProperty("error"))throw Error(e.error);this._xobjects["img"+d]=e.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"+d,"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)]);
+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,e,h){this._cmd(a,-b,-c,d,e,-h,"cm")},_png:function(a){if("data:image/png;base64,"!==
+a.substr(0,22))return{error:"Not a base64-encoded PNG file"};a=de(a.substr(22));var b=ee(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,e=c[8],h=c[9],f=0===(h&2),m=0!==(h&4),k=c[10],l=c[11],c=c[12];if(0!==k)throw Error("Unsupported PNG compression method: "+k);if(0!==l)throw Error("Unsupported PNG filter method: "+
+l);if(0!==c)return{error:"Interlaced image not supported"};if(0!==(h&1))return{error:"Indexed PNG image not supported"};l=null;h=f?1:3;k=b.filter(function(a){return"IDAT"===a.type}).map(function(a){return a.data});if(m){m=window.pako;l=new m.Inflate;for(b=0;b<k.length;++b)l.push(k[b],b+1===k.length);if(l.err)throw Error(l.err);l=l.result;c=e>>>3;if(l.length!==d*(a*(h+1)*c+1))throw Error("Data length mismatch");for(var n=h*c,k=new Uint8Array(d*(a*n+1)),p=new Uint8Array(d*(a*c+1)),r=0,t=0,v=0,u=0;u<
+d;++u){k[t++]=p[v++]=l[r++];for(var w=0;w<a;++w){for(b=0;b<n;++b)k[t++]=l[r++];for(b=0;b<c;++b)p[v++]=l[r++]}}if(r!==l.length||t!==k.length||v!==p.length)throw Error("Seems we garbled our index computation somehow");p=m.deflate(p);l=this._strm({Type:"/XObject",Subtype:"/Image",Width:a,Height:d,ColorSpace:"/DeviceGray",BitsPerComponent:e,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:1,BitsPerComponent:e,Columns:a})},p).ref;k=[m.deflate(k)]}var x=0;k.forEach(function(a){x+=a.length});
+return this._obj([this._dict({Type:"/XObject",Subtype:"/Image",Name:"/img"+this._imgcache.length,Width:a,Height:d,ColorSpace:f?"/DeviceGray":"/DeviceRGB",SMask:l,BitsPerComponent:e,Length:x,Filter:"/FlateDecode",DecodeParms:this._dict({Predictor:15,Colors:h,BitsPerComponent:e,Columns:a})}),"\nstream\n"].concat(k,["\nendstream"]))},drawImage:function(a,b,c){if(3!==arguments.length)throw Error("PdfWriterContext only supports 3-argument version of drawImage");var d=this._imgcache.indexOf(a);if(-1===
+d){d=this._imgcache.length;this._imgcache.push(a);var e=this._png(a.cachedDataURL||"");e.hasOwnProperty("error")&&(e=this._png(nd(a)));if(e.hasOwnProperty("error"))throw Error(e.error);this._xobjects["img"+d]=e.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"+d,"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 c=0;a.unshift(b+" 0 obj\n");a.push("\nendobj\n");for(var d=0;d<a.length;++d)c+=a[d].length;this._offset+=c;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;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);var b=this._objects,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 Fb=null;jb.push(gd);oa.exportSVG=function(){hd(dd)};oa.exportPDF=function(){wa.loadScript("pako","pako.min.js",function(){hd(ed)})};oa.exportPNG=function(){id(y.canvas.toDataURL())};var id=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);gd()},100)},qc="Move",Hb,ua=[],Ua=0,Zd=0,sb=0,G={Delete:{}};G.Delete.actions=[];G.Delete.actions[0]={};G.Delete.actions[0].event="mousedown";G.Delete.actions[0].tooltip="...";G.Delete.actions[0]["do"]=function(){fa=Gb(X);null!==fa&&nd(fa.mover.name);return!0};G.Move={};G.Move.actions=[];G.Move.actions[0]={};G.Move.actions[0].event="mousedown";G.Move.actions[0].tooltip="Move free elements by dragging the mouse";
-G.Move.actions[0]["do"]=function(){for(var a=X,b=null,c=1E6,d,e=0;e<u.free.length;e++){var f=u.free[e];if(!f.pinned&&!1!==f.visible&&!0!==f.tmp){var k,m,n,p=z.drawingstate.matrix.sdet;if("P"===f.kind){m=g.normalizeZ(f.homog);if(!g._helper.isAlmostReal(m))continue;k=m.value[0].value.real-a.x;m=m.value[1].value.real-a.y;n=Math.sqrt(k*k+m*m);if(f.narrow&&n>("number"===typeof f.narrow?f.narrow:20)/p)continue}else if("C"===f.kind)m=u.csnames[f.args[0]],n=f.radius,k=l.div(m.homog.value[0],m.homog.value[2]).value.real,
-m=l.div(m.homog.value[1],m.homog.value[2]).value.real,k-=a.x,m-=a.y,n=Math.sqrt(k*k+m*m)-n.value.real,m=k=0,0>n&&(n=-n),n+=30/p;else if("L"===f.kind)k=f.homog,n=l,m=n.add(n.mult(k.value[0],n.conjugate(k.value[0])),n.mult(k.value[1],n.conjugate(k.value[1]))),m=g.scaldiv(n.sqrt(m),k),n=m.value[0].value.real*a.x+m.value[1].value.real*a.y+m.value[2].value.real,k=-m.value[0].value.real*n,m=-m.value[1].value.real*n,0>n&&(n=-n),n+=25/p;else if("Text"===f.kind){if(!f.homog||f.dock||!f._bbox)continue;m=z.from(a.x,
-a.y,1);k=Math.max(0,m[0]-f._bbox.right,f._bbox.left-m[0]);m=Math.max(0,m[1]-f._bbox.bottom,f._bbox.top-m[1]);n=Math.sqrt(k*k+m*m);if(20<n)continue;n/=p;m=g.normalizeZ(f.homog);if(!g._helper.isAlmostReal(m))continue;k=m.value[0].value.real-a.x;m=m.value[1].value.real-a.y}else continue;n<c+.2/p&&(c=n,b=f,d={x:k,y:m})}}console.log("Moving "+(b?b.name:"nothing"));fa=null===b?null:{mover:b,offset:d,prev:{x:a.x,y:a.y}};return!0};G.Point={};G.Point.actions=[];G.Point.actions[0]={};G.Point.actions[0].event=
-"mousedown";G.Point.actions[0].tooltip="Add a single point with the mouse";G.Point.actions[0]["do"]=function(){Ha({type:"Free",name:Ta(),labeled:!0,pos:[ta[0],ta[1],1]});return!0};G.Mid={};G.Mid.actions=[];G.Mid.actions[0]={};G.Mid.actions[0].event="mousedown";G.Mid.actions[0].tooltip="Construct two points and their midpoint by dragging";G.Mid.actions[0]["do"]=function(){mb();return!0};G.Mid.actions[1]={};G.Mid.actions[1].event="mousemove";G.Mid.actions[1]["do"]=function(){Sb("Mid");return!0};G.Mid.actions[2]=
-{};G.Mid.actions[2].event="mouseup";G.Mid.actions[2]["do"]=function(){tb();return!0};G.Circle={};G.Circle.actions=[];G.Circle.actions[0]={};G.Circle.actions[0].event="mousedown";G.Circle.actions[0].tooltip="Construct two points and a circle by dragging the mouse";G.Circle.actions[0]["do"]=function(){mb();return!0};G.Circle.actions[1]={};G.Circle.actions[1].event="mousemove";G.Circle.actions[1]["do"]=function(){Sb("CircleMP");return!0};G.Circle.actions[2]={};G.Circle.actions[2].event="mouseup";G.Circle.actions[2]["do"]=
-function(){tb();return!0};G.Compass={};G.Compass.actions=[];G.Compass.actions[0]={};G.Compass.actions[0].event="mousedown";G.Compass.actions[0].tooltip="...";G.Compass.actions[0]["do"]=function(){mb();return!0};G.Compass.actions[1]={};G.Compass.actions[1].event="mousedown";G.Compass.actions[1].tooltip="...";G.Compass.actions[1]["do"]=function(){mb();return!0};G.Compass.actions[2]={};G.Compass.actions[2].event="mousedown";G.Compass.actions[2].tooltip="...";G.Compass.actions[2]["do"]=function(){mb();
-Ha({type:"Compass",name:Ta(),labeled:!0,args:[ua[0].name,ua[1].name,ua[2].name]});return!0};G.Line={};G.Line.actions=[];G.Line.actions[0]={};G.Line.actions[0].event="mousedown";G.Line.actions[0].tooltip="Construct two points and their connecting line by dragging the mouse";G.Line.actions[0]["do"]=function(){mb();return!0};G.Line.actions[1]={};G.Line.actions[1].event="mousemove";G.Line.actions[1]["do"]=function(){Sb("Join");return!0};G.Line.actions[2]={};G.Line.actions[2].event="mouseup";G.Line.actions[2]["do"]=
-function(){tb();return!0};G.Segment={};G.Segment.actions=[];G.Segment.actions[0]={};G.Segment.actions[0].event="mousedown";G.Segment.actions[0].tooltip="Draw a segment by dragging the mouse";G.Segment.actions[0]["do"]=function(){mb();return!0};G.Segment.actions[1]={};G.Segment.actions[1].event="mousemove";G.Segment.actions[1]["do"]=function(){Sb("Segment");return!0};G.Segment.actions[2]={};G.Segment.actions[2].event="mouseup";G.Segment.actions[2]["do"]=function(){tb();return!0};G.Parallel={};G.Parallel.actions=
-[];G.Parallel.actions[0]={};G.Parallel.actions[0].event="mousedown";G.Parallel.actions[0].tooltip="Construct a parallel line by dragging a line";G.Parallel.actions[0]["do"]=function(){return ld()};G.Parallel.actions[1]={};G.Parallel.actions[1].event="mousemove";G.Parallel.actions[1]["do"]=function(){var a={type:"Free",name:Ta(),labeled:!0,pos:[ta[0],ta[1],1],tmp:!0},a=Ha(a);Hb=Ha({type:"Para",name:Ta(),labeled:!0,args:[ua[0].name,a.name]});sc(a);return!0};G.Parallel.actions[2]={};G.Parallel.actions[2].event=
-"mouseup";G.Parallel.actions[2]["do"]=function(){tb();return!0};G.Orthogonal={};G.Orthogonal.actions=[];G.Orthogonal.actions[0]={};G.Orthogonal.actions[0].event="mousedown";G.Orthogonal.actions[0].tooltip="Construct a orthogonal line by dragging a line";G.Orthogonal.actions[0]["do"]=function(){if(ld()){var a={type:"Free",name:Ta(),labeled:!0,pos:[ta[0],ta[1],1],tmp:!0},a=Ha(a);Hb=Ha({type:"Perp",name:Ta(),labeled:!0,args:[ua[0].name,a.name]});sc(a);return!0}return!1};G.Orthogonal.actions[1]={};G.Orthogonal.actions[1].event=
-"mouseup";G.Orthogonal.actions[1]["do"]=function(){tb();return!0};G.Intersection={};G.Intersection.actions=[];G.Intersection.actions[0]={};G.Intersection.actions[0].event="mousedown";G.Intersection.actions[0].tooltip="Select two elements to define their intersection";G.Intersection.actions[0]["do"]=function(){return md()};G.Intersection.actions[1]={};G.Intersection.actions[1].event="mousedown";G.Intersection.actions[1]["do"]=function(){return md()?(Hb=Ha({type:"Meet",name:Ta(),labeled:!0,args:[ua[0].name,
-ua[1].name]}),!0):!1};var $a={},z={drawingstate:{}};z.drawingstate.linecolor="rgb(0,0,255)";z.drawingstate.linecolorraw=[0,0,1];z.drawingstate.pointcolor="rgb(0,255,0)";z.drawingstate.pointcolorraw=[0,1,0];z.drawingstate.textcolor="rgb(0,0,0)";z.drawingstate.textcolorraw=[0,0,0];z.drawingstate.alpha=1;z.drawingstate.pointsize=4;z.drawingstate.linesize=1;z.drawingstate.textsize=null;z.drawingstate.matrix={};z.drawingstate.matrix.a=25;z.drawingstate.matrix.b=0;z.drawingstate.matrix.c=0;z.drawingstate.matrix.d=
-25;z.drawingstate.matrix.tx=250.5;z.drawingstate.matrix.ty=250.5;z.drawingstate.matrix.det=z.drawingstate.matrix.a*z.drawingstate.matrix.d-z.drawingstate.matrix.b*z.drawingstate.matrix.c;z.drawingstate.matrix.sdet=Math.sqrt(z.drawingstate.matrix.det);z.drawingstate.initialmatrix={};z.drawingstate.initialmatrix.a=z.drawingstate.matrix.a;z.drawingstate.initialmatrix.b=z.drawingstate.matrix.b;z.drawingstate.initialmatrix.c=z.drawingstate.matrix.c;z.drawingstate.initialmatrix.d=z.drawingstate.matrix.d;
-z.drawingstate.initialmatrix.tx=z.drawingstate.matrix.tx;z.drawingstate.initialmatrix.ty=z.drawingstate.matrix.ty;z.drawingstate.initialmatrix.det=z.drawingstate.matrix.det;z.drawingstate.initialmatrix.sdet=z.drawingstate.matrix.sdet;z.clone=function(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),c;for(c in a)b[c]=z.clone(a[c]);return b};$a.backup=z.clone(z.drawingstate);$a.stack=[];z.clone(z.drawingstate);z.reset=function(){z.drawingstate.matrix.a=z.drawingstate.initialmatrix.a;
-z.drawingstate.matrix.b=z.drawingstate.initialmatrix.b;z.drawingstate.matrix.c=z.drawingstate.initialmatrix.c;z.drawingstate.matrix.d=z.drawingstate.initialmatrix.d;z.drawingstate.matrix.tx=z.drawingstate.initialmatrix.tx;z.drawingstate.matrix.ty=z.drawingstate.initialmatrix.ty;z.drawingstate.matrix.det=z.drawingstate.initialmatrix.det;z.drawingstate.matrix.sdet=z.drawingstate.initialmatrix.sdet};z.from=function(a,b,c){a/=c;b/=c;c=z.drawingstate.matrix;return[a*c.a-b*c.b+c.tx,a*c.c-b*c.d-c.ty]};z.to=
-function(a,b){var c=z.drawingstate.matrix,d=a-c.tx,e=b+c.ty;return[(d*c.d-e*c.b)/c.det,-(-d*c.c+e*c.a)/c.det,1]};z.toMat=function(){var a=z.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]])};z.dumpTrafo=function(){function a(a){return Math.round(1E3*a)/1E3}var b=z.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))};z.setMat=function(a,b,c,d,e,f){var g=z.drawingstate.matrix;
-g.a=a;g.b=b;g.c=c;g.d=d;g.tx=e;g.ty=f;g.det=a*d-b*c;g.sdet=Math.sqrt(g.det)};z.scaleAndOrigin=function(a,b,c){z.setMat(a,0,0,a,b,c)};z.visibleRect=function(a,b,c,d){var e=c-a,f=b-d,e=da*f<ca*e?da/e:ca/f;z.setMat(e,0,0,e,(da-e*(a+c))/2,(ca-e*(b+d))/2)};z.applyMat=function(a,b,c,d,e,f){var g=z.drawingstate.matrix;z.setMat(g.a*a+g.c*b,g.b*a+g.d*b,g.a*c+g.c*d,g.b*c+g.d*d,g.a*e+g.c*f+g.tx,g.b*e+g.d*f+g.ty)};z.translate=function(a,b){z.applyMat(1,0,0,1,a,b)};z.rotate=function(a){var b=Math.cos(a);a=Math.sin(a);
-z.applyMat(b,a,-a,b,0,0)};z.scale=function(a){z.applyMat(a,0,0,a,0,0)};z.gsave=function(){$a.stack.push(z.clone(z.drawingstate))};z.grestore=function(){0!==$a.stack.length&&(z.drawingstate=$a.stack.pop())};z.greset=function(){z.drawingstate=z.clone($a.backup);z.drawingstate.matrix.ty-=ca;z.drawingstate.initialmatrix.ty-=ca;$a.stack=[]};z.createnewbackup=function(){z.drawingstate.initialmatrix.a=z.drawingstate.matrix.a;z.drawingstate.initialmatrix.b=z.drawingstate.matrix.b;z.drawingstate.initialmatrix.c=
-z.drawingstate.matrix.c;z.drawingstate.initialmatrix.d=z.drawingstate.matrix.d;z.drawingstate.initialmatrix.tx=z.drawingstate.matrix.tx;z.drawingstate.initialmatrix.ty=z.drawingstate.matrix.ty;z.drawingstate.initialmatrix.det=z.drawingstate.matrix.det;z.drawingstate.initialmatrix.sdet=z.drawingstate.matrix.sdet;$a.backup=z.clone(z.drawingstate)};z.makecolor=function(a,b,c){a=Math.floor(255*a);b=Math.floor(255*b);c=Math.floor(255*c);return 1===z.drawingstate.alpha?"rgb("+a+","+b+","+c+")":"rgba("+
-a+","+b+","+c+","+z.drawingstate.alpha+")"};z.setcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;z.drawingstate.linecolor=z.drawingstate.pointcolor=z.makecolor(b,c,a);z.drawingstate.linecolorraw=z.drawingstate.pointcolorraw=[b,c,a]};z.setlinecolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;z.drawingstate.linecolor=z.makecolor(b,c,a);z.drawingstate.linecolorraw=[b,c,a]};z.settextcolor=function(a){var b=a.value[0].value.real,
-c=a.value[1].value.real;a=a.value[2].value.real;z.drawingstate.textcolor=z.makecolor(b,c,a);z.drawingstate.textcolorraw=[b,c,a]};z.setpointcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;z.drawingstate.pointcolor=z.makecolor(b,c,a);z.drawingstate.pointcolorraw=[b,c,a]};z.setalpha=function(a){z.drawingstate.alpha=a.value.real;z.drawingstate.linecolor=z.makecolor(z.drawingstate.linecolorraw[0],z.drawingstate.linecolorraw[1],z.drawingstate.linecolorraw[2]);
-z.drawingstate.pointcolor=z.makecolor(z.drawingstate.pointcolorraw[0],z.drawingstate.pointcolorraw[1],z.drawingstate.pointcolorraw[2]);z.drawingstate.textcolor=z.makecolor(z.drawingstate.textcolorraw[0],z.drawingstate.textcolorraw[1],z.drawingstate.textcolorraw[2])};z.setpointsize=function(a){z.drawingstate.pointsize=a.value.real};z.setlinesize=function(a){z.drawingstate.linesize=a.value.real};z.settextsize=function(a){z.drawingstate.textsize=a.value.real};var la={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",textsize:20,lineHeight:1.45};p.defaultAppearance&&$d(p.defaultAppearance);var Ub={},ud={UL:0,UR:1,LR:2,LL:3},vc=["in","out","good","backup"],hb=new Float64Array(0),db={};vc.forEach(function(a){db[a]=hb});var ma=hb,Ma=hb,za=hb,va,Aa,fb,Ja,vb,wc=!1,wd={toString:function(){return"RefineException"}},zd=null,L=null;p.enableTraceLog&&(L={logLength:Infinity,fullLog:[],currentMouseAndScripts:null,currentMover:null,
-currentStep:null,currentElement:null,currentParam:null,labelTracing2:w.wrap("tracing2"),labelTracing4:w.wrap("tracing4"),labelTracingSesq:w.wrap("tracingSesq"),postMouseHooks:[]},"number"===typeof p.enableTraceLog&&(L.logLength=p.enableTraceLog),oa.getTraceLog=fe,oa.formatTraceLog=ge,oa.addTraceHook=L.postMouseHooks.push.bind(L.postMouseHooks));Na.stateSize=12;xc.stateSize=24;var ib=[];gb.P=function(a){u.lines.forEach(function(b){b=Dd(a,b);b.holds()&&ib.push(b)});u.conics.forEach(function(b){b=Ed(a,
-b);b.holds()&&ib.push(b)})};gb.L=function(a){u.points.forEach(function(b){b=Dd(b,a);b.holds()&&ib.push(b)})};gb.S=gb.L;gb.C=function(a){u.points.forEach(function(b){b=Ed(b,a);b.holds()&&ib.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=w.withUsage(a.homog,"Line")};m.FreeLine={};m.FreeLine.kind="L";m.FreeLine.signature=
-[];m.FreeLine.isMovable=!0;m.FreeLine.initialize=function(a){a=m._helper.initializeLine(a);T(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 Z(3)};m.FreeLine.putParamToState=function(a,b){T(b)};m.FreeLine.updatePosition=function(a){var b=Z(3);T(b);a.homog=w.withUsage(b,"Line")};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=w.withUsage(a.homog,"Point")};m.Join={};m.Join.kind="L";m.Join.signature=["P","P"];m.Join.updatePosition=function(a){a.homog=g.cross(u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog);a.homog=g.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};m.Segment={};m.Segment.kind="S";m.Segment.signature=["P",
-"P"];m.Segment.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.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=w.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(u.csnames[a.args[0]].homog,
-u.csnames[a.args[1]].homog);a.homog=g.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};m.Meet.visiblecheck=function(a){var b=!0,c=u.csnames[a.args[0]],d=u.csnames[a.args[1]];"S"===c.kind&&(b=sd(a,c));b&&"S"===d.kind&&(b=sd(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(u.csnames[a.args[0]].homog,
-u.csnames[a.args[1]].homog);a.homog=w.withUsage(b,"Point")};m.Perp={};m.Perp.kind="L";m.Perp.signature=["L","P"];m.Perp.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.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=w.withUsage(a.homog,"Line")};m.Para={};m.Para.kind="L";m.Para.signature=["L","P"];m.Para.updatePosition=function(a){var b=u.csnames[a.args[1]].homog;a.homog=g.cross(g.cross(g.linfty,
-u.csnames[a.args[0]].homog),b);a.homog=g.normalizeMax(a.homog);a.homog=w.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,u.csnames[a.args[0]].homog);a.homog=g.normalizeMax(a.homog);a.homog=w.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);T(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 Z(3)};m.HorizontalLine.putParamToState=function(a,b){T(b)};m.HorizontalLine.updatePosition=function(a){var b=
-Z(3);T(b);a.homog=w.withUsage(b,"Line")};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,u.csnames[a.args[0]].homog);a.homog=g.normalizeMax(a.homog);a.homog=w.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);T(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 Z(3)};m.VerticalLine.putParamToState=function(a,b){T(b)};m.VerticalLine.updatePosition=function(a){var b=Z(3);T(b);a.homog=w.withUsage(b,"Line")};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=u.csnames[a.args[1]],c=g.productMV(a.rot,u.csnames[a.args[0]].homog);a.homog=g.cross(b.homog,c);a.homog=g.normalizeMax(a.homog);
-a.homog=w.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?w.wrap(a.dir):g.realVector([a.pos[1],-a.pos[0],0]);T(a)};m.Through.getParamForInput=function(a,b,c){a="dir"===c||"mouse"===c?g.cross(u.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 Z(3)};m.Through.putParamToState=
-function(a,b){T(b)};m.Through.updatePosition=function(a){var b=Z(3);T(b);b=g.cross(u.csnames[a.args[0]].homog,b);b=g.normalizeMax(b);a.homog=w.withUsage(b,"Line")};m.Through.stateSize=6;m.Through.set_angle=function(a,b){if("number"===b.ctype){var c=l.cos(b),d=l.sin(b),c=g.turnIntoCSList([c,d,l.real(0)]);Ia(a,c,"dir")}};m.Through.set_slope=function(a,b){if("number"===b.ctype){var c=g.turnIntoCSList([l.real(1),b,l.real(0)]);Ia(a,c,"dir")}};m.Free={};m.Free.kind="P";m.Free.signature=[];m.Free.isMovable=
-!0;m.Free.initialize=function(a){a=m._helper.initializePoint(a);T(a)};m.Free.getParamForInput=function(a,b,c){if("mouse"===c&&cc&&0!==Wa){b=g.normalizeZ(b);a=b.value[0].value.real;c=b.value[1].value.real;var d=Math.round(a/Wa)*Wa,e=Math.round(c/Wa)*Wa;.2>Math.abs(d-a)&&.2>Math.abs(e-c)&&(b=g.realVector([d,e,1]))}return g.normalizeMax(b)};m.Free.getParamFromState=function(a){return Z(3)};m.Free.putParamToState=function(a,b){T(b)};m.Free.updatePosition=function(a){var b=Z(3);T(b);a.homog=w.withUsage(b,
-"Point")};m.Free.stateSize=6;m._helper.projectPointToLine=function(a,b){var c=g.turnIntoCSList([b.value[0],b.value[1],l.zero]),c=g.cross(c,a);return g.normalizeMax(g.cross(c,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=u.csnames[a.args[0]].homog;var b=m._helper.projectPointToLine(b,a),b=g.normalizeMax(b),c=g.cross(g.linfty,b);g.normalizeMax(c);T(b);T(a);fb=!1};m.PointOnLine.updatePosition=
-function(a,b){var c,d=u.csnames[a.args[0]].homog;c=Z(3);Z(3);if(!b){va=a.stateIdx;var e=ma;ma=za;var f=Z(3),l=Z(3);ma=e;e=g.cross(l,d);g._helper.isAlmostZero(e)&&(e=g.cross(g.linfty,d));f=m._helper.CircleMP(e,f);f=m._helper.IntersectLC(d,f);e=m._helper.pointReflection(e,c);c=Ad(f[0],f[1],c,e)[0]}c=g.normalizeMax(c);T(c);T(d);a.homog=w.withUsage(c,"Point")};m.PointOnLine.getParamForInput=function(a,b,c){return b=m._helper.projectPointToLine(b,u.csnames[a.args[0]].homog)};m.PointOnLine.getParamFromState=
-function(a){return Z(3)};m.PointOnLine.putParamToState=function(a,b){return T(b)};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=u.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]);T(d);T(a);T(b);fb=!1};m.PointOnCircle.putParamToState=function(a,b){T(b)};m.PointOnCircle.getParamFromState=function(a){return Z(3)};m.PointOnCircle.getParamForInput=function(a,b,c){c=g.normalizeZ(m._helper.CenterOfCircle(u.csnames[a.args[0]].matrix));b=g.sub(b,c);va=a.stateIdx;a=Z(3);var d=g.normalizeZ(Z(3));c=g.sub(d,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,e){d=g.normalizeAbs(d);e=g.normalizeAbs(e);var f=g.scalproduct(d,e);if(0<=f.value.real)return xd(a,b,c,d,e);a=g.turnIntoCSList([l.sub(d.value[1],e.value[1]),l.sub(e.value[0],d.value[0]),l.zero]);f=g.scalproduct(d,a);0>f.value.real&&(a=g.neg(a));0>b?(b=2*b+1,c=b*b,f=.25/(1+c),c=l.complex(2*b*f+.25,(1-c)*f)):(b=2*b-1,c=b*b,f=.25/(1+c),c=l.complex(2*b*f+.75,(1-c)*f));var k=l.sub(l.real(1),
-c);b=l.mult(c,c);f=l.mult(k,k);c=l.mult(c,k);d=g.scalmult(f,d);d=g.add(d,g.scalmult(c,a));return d=g.add(d,g.scalmult(b,e))};m.PointOnCircle.updatePosition=function(a){var b=Z(3);T(b);var c=u.csnames[a.args[0]],b=g.productMV(c.matrix,b),c=m._helper.IntersectLC(b,c.matrix),c=Na(c[0],c[1]),b=g.normalizeMax(c.value[0]);a.homog=w.withUsage(b,"Point");a.antipodalPoint=c.value[1]};m.PointOnCircle.stateSize=6+Na.stateSize;m.OtherPointOnCircle={};m.OtherPointOnCircle.kind="P";m.OtherPointOnCircle.signature=
-["P"];m.OtherPointOnCircle.signatureConstraints=function(a){return"PointOnCircle"===u.csnames[a.args[0]].type};m.OtherPointOnCircle.updatePosition=function(a){var b=u.csnames[a.args[0]].antipodalPoint,b=g.normalizeMax(b);a.homog=w.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);Va(a)};m.PointOnSegment.getParamForInput=
-function(a,b){var c=u.csnames[a.args[0]],d=c.homog,d=g.turnIntoCSList([d.value[0],d.value[1],l.zero]),e=g.sub(c.startpos,c.endpos),c=g.crossratio3(e,c.startpos,c.endpos,b,d);0>c.value.real&&(c=l.complex(0,c.value.imag));1<c.value.real&&(c=l.complex(1,c.value.imag));return c};m.PointOnSegment.getParamFromState=function(a){return wb()};m.PointOnSegment.putParamToState=function(a,b){Va(b)};m.PointOnSegment.updatePosition=function(a){var b=wb();Va(b);var c=u.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=w.withUsage(b,"Point")};m.PointOnSegment.stateSize=2;m._helper.projectPointToCircle=function(a,b){var c=m._helper.CenterOfCircle(a.matrix),c=g.normalizeMax(c),c=g.normalizeMax(g.cross(b,c)),c=m._helper.IntersectLC(c,a.matrix),d=g.projectiveDistMinScal(b,c[0]),e=g.projectiveDistMinScal(b,c[1]);return d<e?c[0]:c[1]};m.PointOnArc={};m.PointOnArc.kind="P";m.PointOnArc.signature=["C"];m.PointOnArc.signatureConstraints=function(a){return u.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);T(a)};m.PointOnArc.getParamForInput=function(a,b){var c=u.csnames[a.args[0]],d=m._helper.projectPointToCircle(c,b),c=g.normalizeMax(g.crossratio3harm(c.startPoint,c.endPoint,c.viaPoint,d,g.ii)),d=l.div(c.value[0],c.value[1]);0>d.value.real&&(c=-1>d.value.real?g.realVector([1,0]):g.realVector([0,1]));return c};m.PointOnArc.getParamFromState=function(a){return Z(2)};
-m.PointOnArc.putParamToState=function(a,b){T(b)};m.PointOnArc.updatePosition=function(a){var b=u.csnames[a.args[0]],c=b.startPoint,d=b.viaPoint,e=b.endPoint,f=g.ii,k=g.cross(c,f),d=g.cross(d,f),n=g.cross(e,f),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=Z(2);T(n);c=g.normalizeMax(g.add(g.scalmult(l.mult(d,n.value[0]),c),g.scalmult(l.mult(k,n.value[1]),e)));b=m._helper.conicOtherIntersection(b.matrix,
-f,c);a.homog=w.withUsage(b,"Point")};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(u.csnames[a.args[0]].matrix);
-a.homog=b;a.homog=g.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};m._helper.CircleMP=function(a,b){var c=a.value[0],d=a.value[1],e=l.neg(a.value[2]),f=l.zero,c=g.turnIntoCSList([g.turnIntoCSList([e,f,c]),g.turnIntoCSList([f,e,d]),g.turnIntoCSList([c,d,f])]),e=w.mult(w.mult(b,c),b),d=w.mult(w.mult(b,g.fund),b),e=w.mult(e,g.fund),c=w.mult(d,c);return g.sub(e,c)};m.CircleMP={};m.CircleMP.kind="C";m.CircleMP.signature=["P","P"];m.CircleMP.updatePosition=function(a){a.matrix=m._helper.CircleMP(u.csnames[a.args[0]].homog,
-u.csnames[a.args[1]].homog);a.matrix=g.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Circle")};m.CircleMr={};m.CircleMr.kind="C";m.CircleMr.signature=["P"];m.CircleMr.isMovable=!0;m.CircleMr.initialize=function(a){Va(l.real(a.radius))};m.CircleMr.getParamForInput=function(a,b,c){if("radius"===c)return b;a=u.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 wb()};m.CircleMr.putParamToState=function(a,
-b){Va(b)};m.CircleMr.updatePosition=function(a){var b=wb();Va(b);var c=u.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=w.withUsage(c,"Circle");a.radius=b};m.CircleMr.stateSize=2;m.CircleMr.set_radius=function(a,b){"number"===b.ctype&&Ia(a,b,"radius")};m._helper.ScaledCircleMrr=function(a,b){var c=a.value[0],d=a.value[1],e=l.neg(a.value[2]),e=g.scalmult(e,g.turnIntoCSList([c,d,e])).value,
-c=g.turnIntoCSList([c,d]),c=l.sub(g.scalproduct(c,c),b),e=m._helper.buildConicMatrix([e[2],l.zero,e[2],e[0],e[1],c]);return g.normalizeMax(e)};m.Compass={};m.Compass.kind="C";m.Compass.signature=["P","P","P"];m.Compass.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,d=u.csnames[a.args[2]].homog,e=b.value[2],f=c.value[2],k=d.value[2],b=g.scalmult(l.mult(f,k),b),c=g.scalmult(l.mult(e,k),c),d=g.scalmult(l.mult(e,f),d),b=g.sub(c,b),d=m._helper.ScaledCircleMrr(d,
-g.scalproduct(b,b));a.matrix=w.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,e,f){a=g.turnIntoCSList([g.cross(c,d)]);var k=g.turnIntoCSList([g.cross(b,e)]);b=g.turnIntoCSList([g.cross(b,c)]);d=g.turnIntoCSList([g.cross(d,
-e)]);return m._helper.conicFromTwoDegenerates(a,k,b,d,f)};m._helper.conicFromTwoDegenerates=function(a,b,c,d,e){a=w.mult(g.transpose(b),a);c=w.mult(g.transpose(d),c);a=g.add(a,g.transpose(a));c=g.add(c,g.transpose(c));d=w.mult(w.mult(e,a),e);e=w.mult(w.mult(e,c),e);c=w.mult(d,c);e=w.mult(e,a);return g.sub(c,e)};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,u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,
-u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog);a.matrix=b;a.matrix=g.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};m.FreeConic={};m.FreeConic.kind="C";m.FreeConic.signature=[];m.FreeConic.initialize=function(a){var b;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(Z(6).value)};
-m.FreeConic.putParamToState=function(a,b){for(var c=0;3>c;++c)for(var d=0;d<=c;++d)Va(b.value[c].value[d])};m.FreeConic.updatePosition=function(a){var b=Z(6);T(b);a.matrix=m._helper.buildConicMatrix(b.value);a.matrix=g.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};m.FreeConic.set_matrix=function(a,b){g._helper.isNumberMatrixMN(b,3,3)&&Ia(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],e=a[4],f=a[5];return g.turnIntoCSList([g.turnIntoCSList([a[0],
-b,d]),g.turnIntoCSList([b,c,e]),g.turnIntoCSList([d,e,f])])};m._helper.splitDegenConic=function(a){var b=g.adjoint3(a),c=0,d,e,f=l.abs2(b.value[0].value[0]).value.real;for(d=1;3>d;d++)e=l.abs2(b.value[d].value[d]).value.real,e>f&&(c=d,f=e);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);e=g.column(b,c);e=g.scaldiv(d,e);d=e.value[0];f=e.value[1];e=e.value[2];d=g.turnIntoCSList([g.turnIntoCSList([l.real(0),
-e,l.mult(l.real(-1),f)]),g.turnIntoCSList([l.mult(l.real(-1),e),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++)e=l.abs2(a.value[d].value[c]).value.real,e>f&&(k=d,b=c,f=e);d=a.value[k];a=g.transpose(a);a=a.value[b];d=g.normalizeMax(d);a=g.normalizeMax(a);d=w.withUsage(d,"Line");a=w.withUsage(a,"Line");return[d,a]};m._helper.inputConic=function(a){var b="xx xy yy xz yz zz".split(" ").map(function(b){var d=l._helper.input(a[b]);
-b[0]!==b[1]&&(d=l.realmult(.5,d));return d});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=u.csnames[a.args[0]].results;for(var c=g.conicDist(b,a[0]),d=0,e=1;e<a.length;++e){var f=g.conicDist(b,a[e]);f<c&&(c=f,d=e)}return d};m.SelectConic.updatePosition=function(a){a.matrix=u.csnames[a.args[0]].results[a.param];a.matrix=g.normalizeMax(a.matrix);
-a.matrix=w.withUsage(a.matrix,"Conic")};m._helper.ConicBy4p1l=function(a,b,c,d,e,f){var k=g.scalproduct(b,f),n=g.scalproduct(c,f),p=g.scalproduct(d,f),q=g.scalproduct(e,f),t=g.det3(c,d,e),u=g.det3(b,c,e),v=g.det3(b,d,e),w=g.det3(b,c,d),x=l.mult,n=l.sqrt(x(x(n,q),x(t,u))),k=l.sqrt(x(x(k,p),x(v,w))),p=g.cross(g.cross(b,d),f);f=g.cross(g.cross(c,e),f);p=g.scalmult(n,p);k=g.scalmult(k,f);f=g.normalizeMax(g.add(p,k));k=g.normalizeMax(g.sub(p,k));k=Na(f,k);f=m._helper.ConicBy5(a,b,c,d,e,k.value[0]);a=m._helper.ConicBy5(a,
-b,c,d,e,k.value[1]);return[g.normalizeMax(f),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,u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog);a.results=b};m.ConicBy4p1l.stateSize=Na.stateSize;m._helper.ConicBy3p2l=function(a,b,c,d,e){function f(a,b,c,d){return l.sub(l.mult(a,d),l.mult(b,
-c))}var k=g.cross(a,b),m=g.cross(d,e);d=g.cross(d,k);e=g.cross(e,k);k=g.turnIntoCSList([d,e,m]);c=g.productVM(c,g.adjoint3(k));m=g.adjoint3(g.turnIntoCSList([g.scalmult(c.value[0],d),g.scalmult(c.value[1],e),g.scalmult(c.value[2],m)]));c=g.transpose(m);d=l.mult;e=g.productMV(c,a);a=e.value[0];e=e.value[1];k=g.productMV(c,b);b=k.value[0];var k=k.value[1],n=l.sqrt(d(a,e)),p=l.sqrt(d(b,k)),q,t=Array(4);for(q=0;4>q;++q){var u=(q&2)-1,v=d(l.real(((q&1)<<1)-1),n),w=d(l.real(u),p),x=f(e,v,k,w),y=f(b,w,a,
-v),u=f(a,e,b,k),z=l.add(l.add(f(b,k,a,e),f(k,w,e,v)),f(w,b,v,a)),v=d(x,x),w=d(y,y),A=d(z,z),B=d(x,y),x=d(x,z),y=d(y,z),B=l.sub(B,d(l.real(.5),d(u,u))),u=g.turnIntoCSList([g.turnIntoCSList([v,B,x]),g.turnIntoCSList([B,w,y]),g.turnIntoCSList([x,y,A])]),u=g.productMM(m,g.productMM(u,c)),u=g.turnIntoCSList([u.value[0].value[0],u.value[0].value[1],u.value[0].value[2],u.value[1].value[1],u.value[1].value[2],u.value[2].value[2]]);t[q]=u}return t};m.ConicBy3p2l={};m.ConicBy3p2l.kind="Cs";m.ConicBy3p2l.signature=
-["P","P","P","L","L"];m.ConicBy3p2l.updatePosition=function(a){for(var b=m._helper.ConicBy3p2l(u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog),b=Bd(b),c=Array(4),d=0;4>d;++d){var e=b[d].value;c[d]=g.turnIntoCSList([g.turnIntoCSList([e[0],e[1],e[2]]),g.turnIntoCSList([e[1],e[3],e[4]]),g.turnIntoCSList([e[2],e[4],e[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){for(var b=m._helper.ConicBy3p2l(u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog,u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog),b=Bd(b),c=Array(4),d=0;4>d;++d){var e=b[d].value,e=g.turnIntoCSList([g.turnIntoCSList([e[0],e[1],e[2]]),g.turnIntoCSList([e[1],e[3],e[4]]),g.turnIntoCSList([e[2],e[4],e[5]])]);c[d]=g.normalizeMax(g.adjoint3(e))}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,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog,u.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=Na.stateSize;m.ConicParabolaPL={};m.ConicParabolaPL.kind="C";m.ConicParabolaPL.signature=["P","L"];m.ConicParabolaPL.updatePosition=function(a){var b=u.csnames[a.args[0]].homog.value,
-c=u.csnames[a.args[1]].homog.value,d=l.mult,e=l.neg,f=l.add,k=l.sub,n=b[0],p=b[1],q=b[2],t=c[0],b=c[1],c=c[2],v=d(q,q),x=d(t,t),y=d(b,b),z=d(q,c),A=e(q),q=f(x,y),y=d(v,y),x=d(v,x),e=d(e(v),d(t,b)),t=d(A,f(d(n,q),d(z,t))),b=d(A,f(d(p,q),d(z,b))),d=k(d(f(d(n,n),d(p,p)),q),d(v,d(c,c))),d=m._helper.buildConicMatrix([y,e,x,t,b,d]),d=g.normalizeMax(d);a.matrix=w.withUsage(d,"Conic")};m.ConicBy2Foci1P={};m.ConicBy2Foci1P.kind="Cs";m.ConicBy2Foci1P.signature=["P","P","P"];m.ConicBy2Foci1P.updatePosition=
-function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,d=u.csnames[a.args[2]].homog,e=g.ii,f=g.jj,k=g.normalizeMax(g.cross(b,d)),n=g.normalizeMax(g.cross(c,d)),p=g.normalizeMax(g.cross(d,e)),d=g.normalizeMax(g.cross(d,f)),n=m._helper.coHarmonic(p,d,k,n),k=g.normalizeMax(n[0]),n=g.normalizeMax(n[1]),e=g.turnIntoCSList([e]),p=g.turnIntoCSList([f]),d=g.turnIntoCSList([b]),q=g.turnIntoCSList([c]),f=m._helper.conicFromTwoDegenerates(e,p,d,q,k),f=g.normalizeMax(f),e=m._helper.conicFromTwoDegenerates(e,
-p,d,q,n),e=g.normalizeMax(e),f=g.normalizeMax(g.adjoint3(f)),e=g.normalizeMax(g.adjoint3(e));"ellipsoid"!==m._helper.getConicType(f)&&(k=f,f=e,e=k);g.almostequals(b,c).value&&(b=l.real(3),e=g.zeromatrix(b,b));a.results=[f,e]};m.ConicBy2Pol1P={};m.ConicBy2Pol1P.kind="C";m.ConicBy2Pol1P.signature=["P","L","P","L","P"];m.ConicBy2Pol1P.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,d=u.csnames[a.args[2]].homog,e=u.csnames[a.args[3]].homog,f=u.csnames[a.args[4]].homog,
-k=g.scalproduct,m=g.scalmult,n=g.sub,p=g.productMM,q=l.realmult,t=g.transpose,v=g.turnIntoCSList,x=n(m(k(c,b),f),m(q(2,k(c,f)),b)),y=n(m(k(e,d),f),m(q(2,k(e,f)),d)),z=v([g.cross(b,f)]),f=v([g.cross(d,f)]),y=p(t(z),v([g.cross(b,y)])),v=p(t(f),v([g.cross(d,x)])),p=p(t(z),f),b=k(b,e),c=k(d,c),d=g.add(m(c,y),m(b,v)),d=n(d,m(q(2,l.mult(b,c)),p)),d=g.add(d,t(d)),d=g.normalizeMax(d),d=w.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=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,d=u.csnames[a.args[2]].homog,e=u.csnames[a.args[3]].homog,f=u.csnames[a.args[4]].homog,k=g.scalproduct,m=g.scalmult,n=g.productMM,p=l.mult,q=g.transpose,t=g.turnIntoCSList,v=k(c,b),x=k(c,d),y=k(e,b),z=k(e,d),A=k(f,b),k=k(f,d),B=t([g.sub(m(p(y,k),c),m(p(x,A),e))]),b=g.add(n(q(t([m(p(y,x),f)])),t([g.sub(g.add(m(l.sub(p(v,k),p(x,A)),e),m(l.sub(p(z,A),p(y,k)),c)),m(g.det3(c,e,f),g.cross(b,d)))])),
-n(q(B),B)),b=g.add(b,q(b)),b=g.normalizeMax(b),b=w.withUsage(b,"Conic");a.matrix=b};m._helper.conic1Pol3Inc=function(a,b,c,d,e){var f=g.scalproduct,k=g.scalmult,m=g.productMM,n=g.cross,p=l.realmult,q=l.mult,t=g.transpose,u=g.turnIntoCSList,v=g.det3,w=v(a,c,d),x=u([n(c,e)]),y=u([n(a,e)]),z=u([n(c,d)]),A=f(b,a),B=f(b,c);b=f(b,e);n=u([n(d,g.sub(k(A,e),k(p(2,b),a)))]);x=k(w,m(t(x),n));a=p(2,l.add(q(v(a,d,e),B),q(w,b)));a=l.sub(q(v(c,d,e),A),a);x=g.add(x,k(a,m(t(y),z)));x=g.add(x,t(x));return x=g.normalizeMax(x)};
-m.ConicBy1Pol3P={};m.ConicBy1Pol3P.kind="C";m.ConicBy1Pol3P.signature=["P","L","P","P","P"];m.ConicBy1Pol3P.updatePosition=function(a){var b=m._helper.conic1Pol3Inc(u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog),b=w.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(u.csnames[a.args[1]].homog,
-u.csnames[a.args[0]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog),b=g.normalizeMax(g.adjoint3(b)),b=w.withUsage(b,"Conic");a.matrix=b};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),k=g.det3(e,c,b);c=g.det3(e,d,a);d=g.det3(e,d,b);d=l.sqrt(l.mult(d,k));f=l.sqrt(l.mult(c,f));a=w.mult(a,d);f=w.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=D.basismap(u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.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=w.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,u.csnames[a.args[0]].homog,u.csnames[a.args[1]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[4]].homog),b=g.adjoint3(b);a.matrix=b;a.matrix=g.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};m.ConicFromPrincipalDirections={};m.ConicFromPrincipalDirections.kind="C";m.ConicFromPrincipalDirections.signature=["P","P","P"];m.ConicFromPrincipalDirections.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,
-d=u.csnames[a.args[2]].homog,e=m._helper.pointReflection(b,c),f=g.cross(c,b),b=g.turnIntoCSList([f.value[0],f.value[1],l.zero]),f=g.turnIntoCSList([f]),c=g.turnIntoCSList([g.cross(c,b)]),e=g.turnIntoCSList([g.cross(e,b)]);a.matrix=m._helper.conicFromTwoDegenerates(f,f,c,e,d);a.matrix=g.normalizeMax(a.matrix);a.matrix=w.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,u.csnames[a.args[0]].homog,
-u.csnames[a.args[1]].homog,g.ii,g.jj,u.csnames[a.args[2]].homog);a.matrix=g.normalizeMax(b);a.matrix=w.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=u.csnames[a.args[0]].homog;a.viaPoint=u.csnames[a.args[1]].homog;a.endPoint=u.csnames[a.args[2]].homog};m.ArcBy3.initialize=function(a){a.startPoint=u.csnames[a.args[0]].homog;a.viaPoint=u.csnames[a.args[1]].homog;a.endPoint=u.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=w.mult(u.csnames[a.args[1]].matrix,u.csnames[a.args[0]].homog),b=g.normalizeMax(b);a.homog=w.withUsage(b,"Line")};m.PolarOfLine={};m.PolarOfLine.kind="P";m.PolarOfLine.signature=["L","C"];m.PolarOfLine.updatePosition=function(a){var b=u.csnames[a.args[0]],c=g.adjoint3(u.csnames[a.args[1]].matrix),b=w.mult(c,b.homog),b=g.normalizeMax(b);a.homog=w.withUsage(b,"Point")};
-m.AngleBisector={};m.AngleBisector.kind="Ls";m.AngleBisector.signature=["L","L","P"];m.AngleBisector.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,d=u.csnames[a.args[2]].homog,e=g.add,f=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),f=f(t,b),e=e(t,b);p(f)&&(f=l(l(l(q,e),q),d));p(e)&&(e=l(l(l(q,f),q),d));a.results=Na(n(f),n(e))};m.AngleBisector.stateSize=Na.stateSize;m._helper.IntersectLC=
-function(a,b){var c=l,d=g.crossOperator(a),e=g.transpose(d),e=w.mult(e,w.mult(b,d)),f=g.maxIndex(a,l.abs2),k,m,n,p;0===f?(f=e.value[1].value[1],k=e.value[1].value[2],m=e.value[2].value[1],n=e.value[2].value[2],p=a.value[0]):1===f?(f=e.value[0].value[0],k=e.value[0].value[2],m=e.value[2].value[0],n=e.value[2].value[2],p=a.value[1]):(f=e.value[0].value[0],k=e.value[0].value[1],m=e.value[1].value[0],n=e.value[1].value[1],p=a.value[2]);c=c.div(c.sqrt(c.sub(c.mult(k,m),c.mult(f,n))),p);c=g.add(e,g.scalmult(c,
-d));f=g.maxIndex(c,g.abs2);d=c.value[f];d=g.normalizeMax(d);d=w.withUsage(d,"Point");c=g.transpose(c);f=g.maxIndex(c,g.abs2);c=c.value[f];c=g.normalizeMax(c);c=w.withUsage(c,"Point");return[d,c]};m.IntersectLC={};m.IntersectLC.kind="Ps";m.IntersectLC.signature=["L","C"];m.IntersectLC.updatePosition=function(a){var b=m._helper.IntersectLC(u.csnames[a.args[0]].homog,u.csnames[a.args[1]].matrix);a.results=Na(b[0],b[1])};m.IntersectLC.stateSize=Na.stateSize;m.OtherIntersectionCL={};m.OtherIntersectionCL.kind=
-"P";m.OtherIntersectionCL.signature=["C","L","P"];m.OtherIntersectionCL.updatePosition=function(a){var b=u.csnames[a.args[2]].homog,c=m._helper.IntersectLC(u.csnames[a.args[1]].homog,u.csnames[a.args[0]].matrix),d=c[0],c=c[1],e=g.projectiveDistMinScal(d,b),b=g.projectiveDistMinScal(c,b);a.homog=e<b?c:d;a.homog=g.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};m.IntersectCirCir={};m.IntersectCirCir.kind="Ps";m.IntersectCirCir.signature=["C","C"];m.IntersectCirCir.updatePosition=function(a){var b=
-u.csnames[a.args[0]].matrix,c=u.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=Na(b[0],b[1])};m.IntersectCirCir.stateSize=Na.stateSize;m.OtherIntersectionCC={};m.OtherIntersectionCC.kind="P";m.OtherIntersectionCC.signature=["C","C","P"];m.OtherIntersectionCC.updatePosition=function(a){var b=
-u.csnames[a.args[0]].matrix,c=u.csnames[a.args[1]].matrix,d=u.csnames[a.args[2]].homog,e=g.scalmult(c.value[0].value[0],b.value[2]),c=g.scalmult(b.value[0].value[0],c.value[2]),e=g.sub(e,c),e=g.turnIntoCSList([e.value[0],e.value[1],l.realmult(.5,e.value[2])]),e=g.normalizeMax(e),e=m._helper.IntersectLC(e,b),b=e[0],e=e[1],c=g.projectiveDistMinScal(b,d),d=g.projectiveDistMinScal(e,d);a.homog=c<d?e:b;a.homog=g.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};m._helper.IntersectConicConic=
-function(a,b){var c=a.value[0],d=a.value[1],e=a.value[2],f=b.value[0],k=b.value[1],n=b.value[2],p=g.det3(c,d,e),q=l.add(l.add(g.det3(c,d,n),g.det3(c,k,e)),g.det3(f,d,e)),c=l.add(l.add(g.det3(c,k,n),g.det3(f,d,n)),g.det3(f,k,e)),f=g.det3(f,k,n),n=l.abs2(p).value.real,k=l.abs2(f).value.real;n<k&&(n=a,a=b,b=n,n=f,f=p,p=n,n=c,c=q,q=n,n=k);1E-24>n?(p=a,c=b):(q=l.solveCubic(p,q,c,f),c=l.abs2(l.sub(q[0],q[1])).value.real,f=l.abs2(l.sub(q[0],q[2])).value.real,k=l.abs2(l.sub(q[1],q[2])).value.real,c>f?(p=
-q[1],q=c>k?q[0]:q[2]):(p=q[2],q=f>k?q[0]:q[1]),p=g.add(g.scalmult(p,a),b),c=g.add(g.scalmult(q,a),b));q=m._helper.splitDegenConic(p);p=q[0];q=q[1];c=m._helper.splitDegenConic(c);k=c[0];f=c[1];c=g.cross(p,k);k=g.cross(q,k);p=g.cross(p,f);q=g.cross(q,f);c=g.normalizeMax(c);k=g.normalizeMax(k);p=g.normalizeMax(p);q=g.normalizeMax(q);c=w.withUsage(c,"Point");k=w.withUsage(k,"Point");p=w.withUsage(p,"Point");q=w.withUsage(q,"Point");return[c,k,p,q]};m.IntersectConicConic={};m.IntersectConicConic.kind=
-"Ps";m.IntersectConicConic.signature=["C","C"];m.IntersectConicConic.updatePosition=function(a){var b=m._helper.IntersectConicConic(u.csnames[a.args[0]].matrix,u.csnames[a.args[1]].matrix),b=xc(b[0],b[1],b[2],b[3]);a.results=b};m.IntersectConicConic.stateSize=xc.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=u.csnames[a.args[0]].results.value;a=m._helper.initializePoint(a);for(var c=g.projectiveDistMinScal(a,
-b[0]),d=0,e=1;e<b.length;++e){var f=g.projectiveDistMinScal(a,b[e]);f<c&&(c=f,d=e)}return d};m.SelectP.updatePosition=function(a){a.homog=u.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=u.csnames[a.args[0]].results.value;a=m._helper.initializeLine(a);for(var c=g.projectiveDistMinScal(a,b[0]),d=0,e=1;e<b.length;++e){var f=g.projectiveDistMinScal(a,b[e]);f<c&&(c=f,d=e)}return d};
-m.SelectL.updatePosition=function(a){a.homog=u.csnames[a.args[0]].results.value[a.param];a.homog=w.withUsage(a.homog,"Line")};m._helper.moebiusStep=function(a,b,c){var d=l.add,e=l.sub,f=l.mult,g=a.value[0],k=a.value[1];a=a.value[2];var m=b.value[0],n=b.value[1];b=b.value[2];var p=c.value[0],q=c.value[1],t=c.value[2];c=e(f(b,p),f(m,t));var u=e(f(b,q),f(n,t)),p=e(f(g,t),f(a,p)),q=e(f(k,t),f(a,q));return[e(f(g,c),f(k,u)),d(f(k,c),f(g,u)),f(a,c),f(a,u),e(f(m,p),f(n,q)),d(f(n,p),f(m,q)),f(b,p),f(b,q)]};
-m.TrMoebius={};m.TrMoebius.kind="Mt";m.TrMoebius.signature="PPPPPP".split("");m.TrMoebius.updatePosition=function(a){var b=l.neg,c=m._helper.moebiusStep(u.csnames[a.args[0]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[4]].homog),d=m._helper.moebiusStep(u.csnames[a.args[1]].homog,u.csnames[a.args[3]].homog,u.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:w.identity;a.mat1=g.normalizeMax(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]]));
-a.mat2=g.normalizeMax(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]]))};m.TrInverseMoebius={};m.TrInverseMoebius.kind="Mt";m.TrInverseMoebius.signature=["Mt"];m.TrInverseMoebius.updatePosition=function(a){var b=u.csnames[a.args[0]].moebius,c=l.neg,d=b.anti?c:w.identity;a.moebius={anti:b.anti,ar:b.dr,ai:d(b.di),br:c(b.br),bi:c(d(b.bi)),cr:c(b.cr),ci:c(d(b.ci)),dr:b.ar,di:d(b.ai)};m._helper.moebiusPair(a)};m.TrMoebiusP={};m.TrMoebiusP.kind="P";m.TrMoebiusP.signature=
-["Mt","P"];m.TrMoebiusP.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.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=w.withUsage(a.homog,"Point")};m._helper.TrMoebiusP=function(a,b){var c=g.productMV(b.mat1,a),d=g.productMV(b.mat2,a);return g.normalizeMax(g.cross(c,d))};m.TrMoebiusL={};m.TrMoebiusL.kind="C";m.TrMoebiusL.signature=["Mt","L"];m.TrMoebiusL.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.csnames[a.args[1]].homog,
-d=function(){var a=g.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);return g.normalizeMax(a)},e=g.cross(d(),c),f=g.cross(d(),c),c=g.cross(d(),c),e=m._helper.TrMoebiusP(e,b),f=m._helper.TrMoebiusP(f,b),b=m._helper.TrMoebiusP(c,b);a.matrix=g.normalizeMax(m._helper.ConicBy5(null,e,f,b,g.ii,g.jj));a.matrix=w.withUsage(a.matrix,"Circle")};m.TrMoebiusS={};m.TrMoebiusS.kind="C";m.TrMoebiusS.signature=["Mt","S"];m.TrMoebiusS.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.csnames[a.args[1]],
-d=c.startpos,c=c.endpos,e=g.add(d,c),d=m._helper.TrMoebiusP(d,b),e=m._helper.TrMoebiusP(e,b),b=m._helper.TrMoebiusP(c,b);a.startPoint=d;a.viaPoint=e;a.endPoint=b;a.isArc=!0;a.matrix=g.normalizeMax(m._helper.ConicBy5(null,d,e,b,g.ii,g.jj));a.matrix=w.withUsage(a.matrix,"Circle")};m.TrMoebiusC={};m.TrMoebiusC.kind="C";m.TrMoebiusC.signature=["Mt","C"];m.TrMoebiusC.signatureConstraints=function(a){return"Circle"===u.csnames[a.args[1]].matrix.usage};m.TrMoebiusC.updatePosition=function(a){var b=u.csnames[a.args[0]],
-c=u.csnames[a.args[1]].matrix,d=function(){var a=g.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);return g.normalizeMax(a)},e=m._helper.IntersectLC(d(),c),d=m._helper.IntersectLC(d(),c),c=e[1],d=d[1],e=m._helper.TrMoebiusP(e[0],b),c=m._helper.TrMoebiusP(c,b),b=m._helper.TrMoebiusP(d,b);a.matrix=g.normalizeMax(m._helper.ConicBy5(null,e,c,b,g.ii,g.jj));a.matrix=w.withUsage(a.matrix,"Circle")};m.TrMoebiusArc={};m.TrMoebiusArc.kind="C";m.TrMoebiusArc.signature=["Mt","C"];m.TrMoebiusArc.signatureConstraints=
-function(a){return u.csnames[a.args[1]].isArc};m.TrMoebiusArc.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.csnames[a.args[1]],d=c.viaPoint,e=c.endPoint,c=m._helper.TrMoebiusP(c.startPoint,b),d=m._helper.TrMoebiusP(d,b),b=m._helper.TrMoebiusP(e,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=w.withUsage(a.matrix,"Circle")};m._helper.trBuildMatrix=function(a,b){var c=b(0),d=b(1),e=g.productMM(d,g.adjoint3(c));
-a.matrix=g.normalizeMax(e);e=g.transpose(g.productMM(c,g.adjoint3(d)));a.dualMatrix=g.normalizeMax(e)};m.TrProjection={};m.TrProjection.kind="Tr";m.TrProjection.signature="PPPPPPPP".split("");m.TrProjection.updatePosition=function(a){m._helper.trBuildMatrix(a,function(b){return D.basismap(u.csnames[a.args[0+b]].homog,u.csnames[a.args[2+b]].homog,u.csnames[a.args[4+b]].homog,u.csnames[a.args[6+b]].homog)})};m.TrAffine={};m.TrAffine.kind="Tr";m.TrAffine.signature="PPPPPP".split("");m.TrAffine.updatePosition=
-function(a){var b=l.mult,c=g.scalmult,d=g.turnIntoCSList,e=g.transpose,f=g.normalizeMax,k=g.productMM,m=g.adjoint3,n=d([u.csnames[a.args[0]].homog,u.csnames[a.args[2]].homog,u.csnames[a.args[4]].homog]),p=d([u.csnames[a.args[1]].homog,u.csnames[a.args[3]].homog,u.csnames[a.args[5]].homog]),q=e(n),e=e(p),t=q.value[2].value,v=e.value[2].value,w=[b(t[0],v[2]),b(t[1],v[0]),b(t[2],v[1])],q=m(q).value;a.matrix=f(k(e,d([c(b(w[0],v[1]),q[0]),c(b(w[1],v[2]),q[1]),c(b(w[2],v[0]),q[2])])));q=n.value;a.dualMatrix=
-f(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.updatePosition=function(a){m._helper.trBuildMatrix(a,function(b){return D.basismap(u.csnames[a.args[0+b]].homog,u.csnames[a.args[2+b]].homog,g.ii,g.jj)})};m.TrTranslation={};m.TrTranslation.kind="Tr";m.TrTranslation.signature=["P","P"];m.TrTranslation.updatePosition=function(a){var b=u.csnames[a.args[0]].homog,c=u.csnames[a.args[1]].homog,
-d=g.cross(b,c).value,b=l.mult(b.value[2],c.value[2]),c=g.turnIntoCSList,e=l.neg,f=l.zero,d=c([c([b,f,d[1]]),c([f,b,e(d[0])]),c([f,f,b])]),d=g.normalizeMax(d);a.matrix=d;b=e(d.value[0].value[0]);d=c([c([b,f,f]),c([f,b,f]),c([d.value[0].value[2],d.value[1].value[2],b])]);a.dualMatrix=d};m.TrReflectionP={};m.TrReflectionP.kind="Tr";m.TrReflectionP.signature=["P"];m.TrReflectionP.updatePosition=function(a){var b=u.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.updatePosition=function(a){var b=l.mult,c=l.realmult,d=l.zero,e=u.csnames[a.args[0]].homog.value,f=e[0],k=e[1],e=e[2],m=b(f,f),n=b(k,k),p=c(-.5,l.sub(m,n)),q=b(f,k),b=g.turnIntoCSList([g.turnIntoCSList([l.neg(p),q,b(f,e)]),g.turnIntoCSList([q,p,b(k,e)]),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"===u.csnames[a.args[0]].matrix.usage};m.TrReflectionC.updatePosition=function(a){var b=u.csnames[a.args[0]].matrix,c=b.value[0].value[2],d=b.value[1].value[2],
-e=l.neg;a.moebius={anti:!0,ar:c,ai:d,br:b.value[2].value[2],bi:l.zero,cr:e(b.value[0].value[0]),ci:l.zero,dr:e(c),di:d};m._helper.moebiusPair(a)};m.TrInverse={};m.TrInverse.kind="Tr";m.TrInverse.signature=["Tr"];m.TrInverse.updatePosition=function(a){var b=u.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=u.csnames[a.args[0]].dualMatrix,b=
-g.productMM(g.productMM(b,u.csnames[a.args[1]].matrix),g.transpose(b)),b=g.normalizeMax(b);a.matrix=w.withUsage(b,"Conic")};m.TransformArc={};m.TransformArc.kind="C";m.TransformArc.signature=["Tr","C"];m.TransformArc.signatureConstraints=function(a){return u.csnames[a.args[0]].isArc};m.TransformArc.updatePosition=function(a){var b=u.csnames[a.args[0]].matrix,c=u.csnames[a.args[1]],d=c.viaPoint,e=c.endPoint,c=g.normalizeMax(g.productMV(b,c.startPoint)),d=g.normalizeMax(g.productMV(b,d)),b=g.normalizeMax(g.productMV(b,
-e));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=w.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(u.csnames[a.args[0]].matrix,u.csnames[a.args[1]].homog));a.homog=w.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(u.csnames[a.args[0]].dualMatrix,u.csnames[a.args[1]].homog));a.homog=w.withUsage(a.homog,"Line")};m.TransformS={};m.TransformS.kind="S";m.TransformS.signature=["Tr","S"];m.TransformS.updatePosition=function(a){var b=u.csnames[a.args[0]],c=u.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=u.csnames[a.args[0]].matrix;a.vertices=g.turnIntoCSList(u.csnames[a.args[1]].vertices.value.map(function(a){a=g.normalizeMax(g.productMV(b,a));return a=w.withUsage(a,"Point")}))};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 d=g.productMV(a,c);a=g.scalproduct(c,d);d=g.scalproduct(b,d);d=l.realmult(-2,
-d);b=g.scalmult(a,b);c=g.scalmult(d,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=u.csnames[a.args[1]].homog;a.value=g.abs(g.sub(g.normalizeZ(u.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);Va(l._helper.input(a.angle))};m.Angle.updatePosition=function(a){var b=u.csnames[a.args[1]].homog,
-c=u.csnames[a.args[2]].homog,d=g.cross(u.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=(wb().value.real-c.value.real)/Math.PI,b=Math.round(d);!fb&&.01<Math.abs(b-d)&&Vb();c=l.complex(b*Math.PI+c.value.real,c.value.imag);Va(c);a.value=w.withUsage(c,"Angle")};m.Angle.stateSize=2;m.Text={};m.Text.kind="Text";m.Text.signature="**";m.Text.isMovable=!0;m.Text.updatePosition=Pa;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=Pa;m.Calculation.initialize=
-function(a){m.Text.initialize(a);a.calculation=Ra(a.text)};m.Calculation.getText=function(a){return ba(A(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=Pa;m.Equation.initialize=function(a){m.Text.initialize(a);a.calculation=Ra(a.text)};m.Equation.getText=
-function(a){return a.text+" = "+ba(A(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=Pa;m.Evaluate.initialize=function(a){m.Text.initialize(a);a.calculation=Ra(a.text)};m.Evaluate.getText=function(a){A(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=Pa;m.Plot.initialize=function(a){m.Text.initialize(a);a.calculation=Ra("plot(("+a.text+"))")};m.Plot.getText=function(a){A(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=Pa;m.Button.initialize=function(a){var b=document.createElement("button");yc(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=x.makeColor(a.fillcolor,
-a.fillalpha))};m.ToggleButton={};m.ToggleButton.kind="Text";m.ToggleButton.signature="**";m.ToggleButton.isMovable=!0;m.ToggleButton.updatePosition=Pa;m.ToggleButton.initialize=function(a){var b;b=void 0;void 0===b&&(b="CindyJSid");b+=++Oa;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;yc(a,"change",c,d)};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.EditableText={};m.EditableText.kind="Text";m.EditableText.isMovable=!0;m.EditableText.signature=[];m.EditableText.updatePosition=Pa;m.EditableText.initialize=function(a){var b=document.createElement("input");b.setAttribute("type","text");b.className="CindyJS-editabletext";Fa(a.minwidth)&&(b.style.width=a.minwidth-3+"px");"string"===typeof a.text&&
-(b.value=a.text);b.addEventListener("keydown",function(a){13===a.keyCode&&b.blur()});yc(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.get_currenttext=function(a){return w.string(String(a.html.value))};m.EditableText.set_currenttext=function(a,b){a.html.value=
-ba(b)};m.EditableText.get_text=m.EditableText.get_currenttext;m.EditableText.set_text=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 u.csnames[a].homog}))};var tc={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"},rd={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=u.csnames[a.args[1]],b={Tr:"Transform",Mt:"TrMoebius"}[u.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"+u.csnames[a.args[0]].kind;if(m.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");return[]}},le="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(" ");oa.saveState=function(){return{geometry:me()}};
-var ra={},Jd,Ib,Kd,Ld;Jd=[[],[.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]];Ib=[0,.2,.3,.8,8/9,1,1];Kd=[35/384,0,500/1113,125/192,-2187/6784,11/84,0];Ld=[5179/57600,0,7571/16695,.6140625,-92097/339200,187/2100,.025];var Ba,ga=[],zc=[],ic=!1;ra.tick=function(a){a/=Mb;for(var b=0;b<Mb;b++)ra.tick1(a),Cb+=a,A(S.simulationstep)};ra.tick1=function(a){for(var b=a,c=0;0<a&&c<
-.999*a||0>a&&c>.999*a;)b=ra.oneRKStep(b),c+=b,b=Math.min(2*b,a-c),b=Math.max(b,1E-16),ra.restorePosition(),ra.doCollisions(),ra.calculateForces(),ra.moveToFinalPos();return!0};ra.restorePosition=function(){Ba.forEach(function(a){O[a.type].restorePos(a,9)})};ra.doCollisions=function(){Ba.forEach(function(a){O[a.type].doCollisions(a)})};ra.calculateForces=function(){Ba.forEach(function(a){O[a.type].calculateForces(a)})};ra.moveToFinalPos=function(){Ba.forEach(function(a){O[a.type].move(a)})};ra.oneRKStep=
-function(a){for(var b=function(a){Ba.forEach(function(b){O[b.type].initRK(b,a);O[b.type].storePosition(b)})},c=function(a){Ba.forEach(function(b){O[b.type].setToTimestep(b,Ib[a])})},d=function(a){Ba.forEach(function(b){O[b.type].proceedMotion(b,Ib[a],a,Jd[a])})},e=function(){Ba.forEach(function(a){O[a.type].resetForces(a)})},f=function(a){Ba.forEach(function(b){O[b.type].calculateDelta(b,a)})},g=function(b){var c=0;Ba.forEach(function(a){O[a.type].proceedMotion(a,Ib[6],7,Kd);O[a.type].savePos(a,8);
-O[a.type].proceedMotion(a,Ib[6],7,Ld);O[a.type].savePos(a,9);c+=O[a.type].sqDist(a,8,9)});return c=Math.sqrt(c)/a},k=function(a){Ba.forEach(function(a){O[a.type].recallPosition(a)})},l=!1;!l;){b(a);for(var m=0;7>m;m++)c(m),d(m),e(),ra.calculateForces(),f(m);g(a)>O.env.errorbound&&a>O.env.lowestdeltat?(a/=O.env.slowdownfactor,k()):l=!0}return a};var O={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=O.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=D.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;fa&&X.down&&a.el===fa.mover||Ia(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=d+(a.dy[b]-
-a.dy[c])*(a.dy[b]-a.dy[c]),d=d+(a.dz[b]-a.dz[c])*(a.dz[b]-a.dz[c]),d=d+(a.dvx[b]-a.dvx[c])*(a.dvx[b]-a.dvx[c]),d=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){var c=D.extractPoint(a.el.homog);a.x=c.x;a.y=c.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,e=0;e<ga.length;e++){var f=
-ga[e],g=f.behavior.x,k=f.behavior.y,l=f.behavior.z,m=Math.sqrt((b-g)*(b-g)+(c-k)*(c-k)+(d-l)*(d-l)),k=(c-k)*a.mass*f.behavior.mass/(m*m*m),l=(d-l)*a.mass*f.behavior.mass/(m*m*m);f.behavior.fx+=(b-g)*a.mass*f.behavior.mass/(m*m*m)*f.behavior.mass;f.behavior.fy+=k*f.behavior.mass;f.behavior.fz+=l*f.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=u.csnames[a.geo[1]];console.log(b);var c=D.extractPoint(b.homog);a=D.extractPoint(u.csnames[a.geo[2]].homog);b=b.behavior;O[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=u.csnames[a.geo[2]];if(!fa||!X.down||b!==fa.mover){var c=u.csnames[a.geo[1]];a=D.extractPoint(c.homog);c=c.behavior;a=g.realVector([a.x+c.vx,a.y+c.vy,1]);
-Ia(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=u.csnames[a.namea];a.mb=u.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=D.extractPoint(a.ma.homog),c=D.extractPoint(a.mb.homog),d=(c.x-b.x)*a.strength;a=(c.y-b.y)*a.strength;for(b=0;b<ga.length;b++)c=ga[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=u.csnames[a.namea];a.mb=u.csnames[a.nameb];var c=D.extractPoint(a.ma.homog),d=D.extractPoint(a.mb.homog);a.l0=Math.sqrt((c.x-d.x)*(c.x-d.x)+(c.y-d.y)*(c.y-d.y));a.env=O.env},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,d,e;!a.ma.behavior||fa&&X.down&&a.ma===fa.mover?(c=D.extractPoint(a.ma.homog),
-b=c.x,d=c.y):(b=a.ma.behavior.x,d=a.ma.behavior.y);!a.mb.behavior||fa&&X.down&&a.mb===fa.mover?(e=D.extractPoint(a.mb.homog),c=e.x,e=e.y):(c=a.mb.behavior.x,e=a.mb.behavior.y);var f=Math.sqrt((b-c)*(b-c)+(d-e)*(d-e)),g=a.l0,k=a.stype;1===k&&(g=0);var l=0;if(2===k||3===k)l=a.ma.behavior.mass*a.mb.behavior.mass*a.strength;2===k&&(l=-l);var m,n;if(0===f||0!==k&&1!==k)if(a.ma.behavior&&a.mb.behavior&&0!==f){if(f*=f*f,2===k||3===k)m=(b-c)*l/f,n=(d-e)*l/f}else m=n=0;else m=-(b-c)*a.strength*(f-g)/f*a.env.springstrength,
-n=-(d-e)*a.strength*(f-g)/f*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,e,f){return c*f-e*d+e*b-a*f+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=u.csnames[a.namea];a.mb=u.csnames[a.nameb];var c=D.extractPoint(a.ma.homog),d=D.extractPoint(a.mb.homog);a.x1o=1.01*c.x-.01*d.x;a.y1o=1.01*c.y-.01*d.y;a.x2o=1.01*d.x-.01*c.x;a.y2o=1.01*d.y-.01*c.y;a.env=O.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){for(var b=D.extractPoint(a.ma.homog),c=D.extractPoint(a.mb.homog),d=b.x,b=b.y,e=c.x,c=c.y,f=a.x1o,g=a.y1o,k=a.x2o,m=a.y2o,n=Math.sqrt((d-e)*(d-e)+(b-c)*(b-c)),p=(d-e)/n,n=(b-c)/n,q=0;q<ga.length;q++){var t=ga[q],
-u=t.behavior.xo,v=t.behavior.yo,w=t.behavior.x,x=t.behavior.y,y=l.mult(l.complex(f,g),l.complex(e,c)),z=l.mult(l.complex(k,m),l.complex(d,b)),y=l.sub(y,z),z=l.mult(l.complex(u,v),l.complex(d,b)),y=l.add(y,z),z=l.mult(l.complex(u,v),l.complex(e,c)),y=l.sub(y,z),z=l.sub(l.complex(f,g),l.complex(k,m)),y=l.div(y,z);0>O.det(d,b,e,c,w,x)*O.det(d,b,e,c,y.value.real,y.value.imag)&&0>O.det(d,b,w,x,y.value.real,y.value.imag)*O.det(e,c,w,x,y.value.real,y.value.imag)&&(v=t.behavior.mvx+a.deltat*(-y.value.real+
-t.behavior.xo),w=t.behavior.mvy+a.deltat*(-y.value.imag+t.behavior.yo),u=p*v+n*w,v=n*v-p*w,t.behavior.x=y.value.real,t.behavior.y=y.value.imag,t.behavior.vx=p*u*(1-a.xdamp),t.behavior.vy=n*u*(1-a.xdamp),t.behavior.vx+=-n*v*(1-a.ydamp),t.behavior.vy+=p*v*(1-a.ydamp))}a.x1o=d;a.y1o=b;a.x2o=e;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&&
-(Mb=a.accuracy);"undefined"!==typeof a.deltat&&sa(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);O.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,d,e,f,g,k,l,m,n;if(a.newton)for(b=0;b<ga.length-1;b++)for(c=ga[b],d=c.behavior.x,e=c.behavior.y,f=b+1;f<ga.length;f++)g=ga[f],k=g.behavior.x,l=g.behavior.y,n=Math.sqrt((d-k)*(d-k)+(e-l)*(e-l)),k=(d-k)*c.behavior.mass*g.behavior.mass/(n*n*n),l=(e-l)*c.behavior.mass*g.behavior.mass/(n*n*n),c.behavior.fx-=k,c.behavior.fy-=l,g.behavior.fx+=k,g.behavior.fy+=l;if(a.charges)for(b=0;b<ga.length-1;b++)for(c=ga[b],d=c.behavior.x,e=c.behavior.y,
-f=b+1;f<ga.length;f++)g=ga[f],k=g.behavior.x,l=g.behavior.y,n=Math.sqrt((d-k)*(d-k)+(e-l)*(e-l)),k=(d-k)*c.behavior.charge*g.behavior.charge/(n*n*n),l=(e-l)*c.behavior.charge*g.behavior.charge/(n*n*n),c.behavior.fx+=k,c.behavior.fy+=l,g.behavior.fx-=k,g.behavior.fy-=l;if(a.balls)for(b=0;b<ga.length-1;b++)if(c=ga[b],0!==c.behavior.radius)for(d=c.behavior.x,e=c.behavior.y,f=b+1;f<ga.length;f++)g=ga[f],0!==g.behavior.radius&&(k=g.behavior.x,l=g.behavior.y,m=c.behavior.radius+g.behavior.radius,n=Math.sqrt((d-
-k)*(d-k)+(e-l)*(e-l)),0===a.ballInteractionBoosting?(k=(d-k)/(n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*n)*(n>m?0:(n-m)*(n-m))):1===a.ballInteractionBoosting?(k=(d-k)/(n*n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*n*n)*(n>m?0:(n-m)*(n-m))):(k=(d-k)/(n*n*n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*n*n*n)*(n>m?0:(n-m)*(n-m))),c.behavior.fx+=k,c.behavior.fy+=l,g.behavior.fx-=k,g.behavior.fy-=l);for(b=0;b<ga.length;b++)c=ga[b],c.behavior.fx+=0,c.behavior.fy+=-a.gravity*c.behavior.mass,c.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 oa};return E}(),createCindy=CindyJS;"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===typeof window&&(module.exports=CindyJS);
+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);var b=this._objects,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+(rb(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 Nb=null;jb.push(od);sa.exportSVG=function(){pd(ld)};sa.exportPDF=function(){va.loadScript("pako","pako.min.js",function(){pd(md)})};sa.exportPNG=function(){qd(A.canvas.toDataURL())};var qd=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);od()},100)},xc="Move",Pb,Aa=[],Ya=0,ge=0,xb=0,G={Delete:{}};G.Delete.actions=[];G.Delete.actions[0]={};G.Delete.actions[0].event="mousedown";G.Delete.actions[0].tooltip="...";G.Delete.actions[0]["do"]=function(){ja=Ob(aa);null!==ja&&vd(ja.mover.name);return!0};G.Move={};G.Move.actions=[];G.Move.actions[0]={};G.Move.actions[0].event="mousedown";G.Move.actions[0].tooltip="Move free elements by dragging the mouse";
+G.Move.actions[0]["do"]=function(){for(var a=aa,b=null,c=1E6,d,e=0;e<v.free.length;e++){var f=v.free[e];if(!f.pinned&&!1!==f.visible&&!0!==f.tmp){var k,l,n,p=y.drawingstate.matrix.sdet;if("P"===f.kind){l=h.normalizeZ(f.homog);if(!h._helper.isAlmostReal(l))continue;k=l.value[0].value.real-a.x;l=l.value[1].value.real-a.y;n=Math.sqrt(k*k+l*l);if(f.narrow&&n>("number"===typeof f.narrow?f.narrow:20)/p)continue}else if("C"===f.kind){l=h.normalizeZ(v.csnames[f.args[0]].homog);k=f.radius;if(!h._helper.isAlmostReal(l)||
+!m._helper.isAlmostReal(k))continue;n=l.value[0].value.real;var r=l.value[1].value.real;l=a.x-n;var t=a.y-r,u=Math.sqrt(l*l+t*t);if(0===u)continue;r+=t/u*k.value.real;k=n+l/u*k.value.real-a.x;l=r-a.y;n=Math.sqrt(k*k+l*l);n+=30/p;if(f.narrow&&n>(("number"===typeof f.narrow?f.narrow:20)+30)/p)continue}else if("L"===f.kind)k=f.homog,n=m,l=n.add(n.mult(k.value[0],n.conjugate(k.value[0])),n.mult(k.value[1],n.conjugate(k.value[1]))),l=h.scaldiv(n.sqrt(l),k),n=l.value[0].value.real*a.x+l.value[1].value.real*
+a.y+l.value[2].value.real,k=-l.value[0].value.real*n,l=-l.value[1].value.real*n,0>n&&(n=-n),n+=25/p;else if("Text"===f.kind){if(!f.homog||f.dock||!f._bbox)continue;l=y.from(a.x,a.y,1);k=Math.max(0,l[0]-f._bbox.right,f._bbox.left-l[0]);l=Math.max(0,l[1]-f._bbox.bottom,f._bbox.top-l[1]);n=Math.sqrt(k*k+l*l);if(20<n)continue;n/=p;l=h.normalizeZ(f.homog);if(!h._helper.isAlmostReal(l))continue;k=l.value[0].value.real-a.x;l=l.value[1].value.real-a.y}else continue;n<c+.2/p&&(c=n,b=f,d={x:k,y:l})}}console.log("Moving "+
+(b?b.name:"nothing"));ja=null===b?null:{mover:b,offset:d,prev:{x:a.x,y:a.y}};return!0};G.Point={};G.Point.actions=[];G.Point.actions[0]={};G.Point.actions[0].event="mousedown";G.Point.actions[0].tooltip="Add a single point with the mouse";G.Point.actions[0]["do"]=function(){Ka({type:"Free",name:Xa(),labeled:!0,pos:[ra[0],ra[1],1]});return!0};G.Mid={};G.Mid.actions=[];G.Mid.actions[0]={};G.Mid.actions[0].event="mousedown";G.Mid.actions[0].tooltip="Construct two points and their midpoint by dragging";
+G.Mid.actions[0]["do"]=function(){sb();return!0};G.Mid.actions[1]={};G.Mid.actions[1].event="mousemove";G.Mid.actions[1]["do"]=function(){bc("Mid");return!0};G.Mid.actions[2]={};G.Mid.actions[2].event="mouseup";G.Mid.actions[2]["do"]=function(){yb();return!0};G.Circle={};G.Circle.actions=[];G.Circle.actions[0]={};G.Circle.actions[0].event="mousedown";G.Circle.actions[0].tooltip="Construct two points and a circle by dragging the mouse";G.Circle.actions[0]["do"]=function(){sb();return!0};G.Circle.actions[1]=
+{};G.Circle.actions[1].event="mousemove";G.Circle.actions[1]["do"]=function(){bc("CircleMP");return!0};G.Circle.actions[2]={};G.Circle.actions[2].event="mouseup";G.Circle.actions[2]["do"]=function(){yb();return!0};G.Compass={};G.Compass.actions=[];G.Compass.actions[0]={};G.Compass.actions[0].event="mousedown";G.Compass.actions[0].tooltip="...";G.Compass.actions[0]["do"]=function(){sb();return!0};G.Compass.actions[1]={};G.Compass.actions[1].event="mousedown";G.Compass.actions[1].tooltip="...";G.Compass.actions[1]["do"]=
+function(){sb();return!0};G.Compass.actions[2]={};G.Compass.actions[2].event="mousedown";G.Compass.actions[2].tooltip="...";G.Compass.actions[2]["do"]=function(){sb();Ka({type:"Compass",name:Xa(),labeled:!0,args:[Aa[0].name,Aa[1].name,Aa[2].name]});return!0};G.Line={};G.Line.actions=[];G.Line.actions[0]={};G.Line.actions[0].event="mousedown";G.Line.actions[0].tooltip="Construct two points and their connecting line by dragging the mouse";G.Line.actions[0]["do"]=function(){sb();return!0};G.Line.actions[1]=
+{};G.Line.actions[1].event="mousemove";G.Line.actions[1]["do"]=function(){bc("Join");return!0};G.Line.actions[2]={};G.Line.actions[2].event="mouseup";G.Line.actions[2]["do"]=function(){yb();return!0};G.Segment={};G.Segment.actions=[];G.Segment.actions[0]={};G.Segment.actions[0].event="mousedown";G.Segment.actions[0].tooltip="Draw a segment by dragging the mouse";G.Segment.actions[0]["do"]=function(){sb();return!0};G.Segment.actions[1]={};G.Segment.actions[1].event="mousemove";G.Segment.actions[1]["do"]=
+function(){bc("Segment");return!0};G.Segment.actions[2]={};G.Segment.actions[2].event="mouseup";G.Segment.actions[2]["do"]=function(){yb();return!0};G.Parallel={};G.Parallel.actions=[];G.Parallel.actions[0]={};G.Parallel.actions[0].event="mousedown";G.Parallel.actions[0].tooltip="Construct a parallel line by dragging a line";G.Parallel.actions[0]["do"]=function(){return td()};G.Parallel.actions[1]={};G.Parallel.actions[1].event="mousemove";G.Parallel.actions[1]["do"]=function(){var a={type:"Free",
+name:Xa(),labeled:!0,pos:[ra[0],ra[1],1],tmp:!0},a=Ka(a);Pb=Ka({type:"Para",name:Xa(),labeled:!0,args:[Aa[0].name,a.name]});zc(a);return!0};G.Parallel.actions[2]={};G.Parallel.actions[2].event="mouseup";G.Parallel.actions[2]["do"]=function(){yb();return!0};G.Orthogonal={};G.Orthogonal.actions=[];G.Orthogonal.actions[0]={};G.Orthogonal.actions[0].event="mousedown";G.Orthogonal.actions[0].tooltip="Construct a orthogonal line by dragging a line";G.Orthogonal.actions[0]["do"]=function(){if(td()){var a=
+{type:"Free",name:Xa(),labeled:!0,pos:[ra[0],ra[1],1],tmp:!0},a=Ka(a);Pb=Ka({type:"Perp",name:Xa(),labeled:!0,args:[Aa[0].name,a.name]});zc(a);return!0}return!1};G.Orthogonal.actions[1]={};G.Orthogonal.actions[1].event="mouseup";G.Orthogonal.actions[1]["do"]=function(){yb();return!0};G.Intersection={};G.Intersection.actions=[];G.Intersection.actions[0]={};G.Intersection.actions[0].event="mousedown";G.Intersection.actions[0].tooltip="Select two elements to define their intersection";G.Intersection.actions[0]["do"]=
+function(){return ud()};G.Intersection.actions[1]={};G.Intersection.actions[1].event="mousedown";G.Intersection.actions[1]["do"]=function(){return ud()?(Pb=Ka({type:"Meet",name:Xa(),labeled:!0,args:[Aa[0].name,Aa[1].name]}),!0):!1};var eb={},y={drawingstate:{}};y.drawingstate.linecolor="rgb(0,0,255)";y.drawingstate.linecolorraw=[0,0,1];y.drawingstate.pointcolor="rgb(0,255,0)";y.drawingstate.pointcolorraw=[0,1,0];y.drawingstate.textcolor="rgb(0,0,0)";y.drawingstate.textcolorraw=[0,0,0];y.drawingstate.alpha=
+1;y.drawingstate.pointsize=4;y.drawingstate.linesize=1;y.drawingstate.textsize=null;y.drawingstate.matrix={};y.drawingstate.matrix.a=25;y.drawingstate.matrix.b=0;y.drawingstate.matrix.c=0;y.drawingstate.matrix.d=25;y.drawingstate.matrix.tx=250.5;y.drawingstate.matrix.ty=250.5;y.drawingstate.matrix.det=y.drawingstate.matrix.a*y.drawingstate.matrix.d-y.drawingstate.matrix.b*y.drawingstate.matrix.c;y.drawingstate.matrix.sdet=Math.sqrt(y.drawingstate.matrix.det);y.drawingstate.initialmatrix={};y.drawingstate.initialmatrix.a=
+y.drawingstate.matrix.a;y.drawingstate.initialmatrix.b=y.drawingstate.matrix.b;y.drawingstate.initialmatrix.c=y.drawingstate.matrix.c;y.drawingstate.initialmatrix.d=y.drawingstate.matrix.d;y.drawingstate.initialmatrix.tx=y.drawingstate.matrix.tx;y.drawingstate.initialmatrix.ty=y.drawingstate.matrix.ty;y.drawingstate.initialmatrix.det=y.drawingstate.matrix.det;y.drawingstate.initialmatrix.sdet=y.drawingstate.matrix.sdet;y.clone=function(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),
+c;for(c in a)b[c]=y.clone(a[c]);return b};eb.backup=y.clone(y.drawingstate);eb.stack=[];y.clone(y.drawingstate);y.reset=function(){y.drawingstate.matrix.a=y.drawingstate.initialmatrix.a;y.drawingstate.matrix.b=y.drawingstate.initialmatrix.b;y.drawingstate.matrix.c=y.drawingstate.initialmatrix.c;y.drawingstate.matrix.d=y.drawingstate.initialmatrix.d;y.drawingstate.matrix.tx=y.drawingstate.initialmatrix.tx;y.drawingstate.matrix.ty=y.drawingstate.initialmatrix.ty;y.drawingstate.matrix.det=y.drawingstate.initialmatrix.det;
+y.drawingstate.matrix.sdet=y.drawingstate.initialmatrix.sdet};y.from=function(a,b,c){a/=c;b/=c;c=y.drawingstate.matrix;return[a*c.a-b*c.b+c.tx,a*c.c-b*c.d-c.ty]};y.to=function(a,b){var c=y.drawingstate.matrix,d=a-c.tx,e=b+c.ty;return[(d*c.d-e*c.b)/c.det,-(-d*c.c+e*c.a)/c.det,1]};y.toMat=function(){var a=y.drawingstate.matrix;return h.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]])};y.dumpTrafo=function(){function a(a){return Math.round(1E3*a)/1E3}var b=y.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))};y.setMat=function(a,b,c,d,e,h){var f=y.drawingstate.matrix;f.a=a;f.b=b;f.c=c;f.d=d;f.tx=e;f.ty=h;f.det=a*d-b*c;f.sdet=Math.sqrt(f.det)};y.scaleAndOrigin=function(a,b,c){y.setMat(a,0,0,a,b,c)};y.visibleRect=function(a,b,c,d){var e=c-a,h=b-d,e=ca*h<da*e?ca/e:da/h;y.setMat(e,0,0,e,(ca-e*(a+c))/2,(da-e*(b+d))/2)};y.applyMat=function(a,b,c,d,e,h){var f=y.drawingstate.matrix;y.setMat(f.a*a+f.c*b,f.b*a+f.d*b,f.a*
+c+f.c*d,f.b*c+f.d*d,f.a*e+f.c*h+f.tx,f.b*e+f.d*h+f.ty)};y.translate=function(a,b){y.applyMat(1,0,0,1,a,b)};y.rotate=function(a){var b=Math.cos(a);a=Math.sin(a);y.applyMat(b,a,-a,b,0,0)};y.scale=function(a){y.applyMat(a,0,0,a,0,0)};y.gsave=function(){eb.stack.push(y.clone(y.drawingstate))};y.grestore=function(){0!==eb.stack.length&&(y.drawingstate=eb.stack.pop())};y.greset=function(){y.drawingstate=y.clone(eb.backup);y.drawingstate.matrix.ty-=da;y.drawingstate.initialmatrix.ty-=da;eb.stack=[]};y.createnewbackup=
+function(){y.drawingstate.initialmatrix.a=y.drawingstate.matrix.a;y.drawingstate.initialmatrix.b=y.drawingstate.matrix.b;y.drawingstate.initialmatrix.c=y.drawingstate.matrix.c;y.drawingstate.initialmatrix.d=y.drawingstate.matrix.d;y.drawingstate.initialmatrix.tx=y.drawingstate.matrix.tx;y.drawingstate.initialmatrix.ty=y.drawingstate.matrix.ty;y.drawingstate.initialmatrix.det=y.drawingstate.matrix.det;y.drawingstate.initialmatrix.sdet=y.drawingstate.matrix.sdet;eb.backup=y.clone(y.drawingstate)};y.makecolor=
+function(a,b,c){a=Math.floor(255*a);b=Math.floor(255*b);c=Math.floor(255*c);return 1===y.drawingstate.alpha?"rgb("+a+","+b+","+c+")":"rgba("+a+","+b+","+c+","+y.drawingstate.alpha+")"};y.setcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;y.drawingstate.linecolor=y.drawingstate.pointcolor=y.makecolor(b,c,a);y.drawingstate.linecolorraw=y.drawingstate.pointcolorraw=[b,c,a]};y.setlinecolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=
+a.value[2].value.real;y.drawingstate.linecolor=y.makecolor(b,c,a);y.drawingstate.linecolorraw=[b,c,a]};y.settextcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;y.drawingstate.textcolor=y.makecolor(b,c,a);y.drawingstate.textcolorraw=[b,c,a]};y.setpointcolor=function(a){var b=a.value[0].value.real,c=a.value[1].value.real;a=a.value[2].value.real;y.drawingstate.pointcolor=y.makecolor(b,c,a);y.drawingstate.pointcolorraw=[b,c,a]};y.setalpha=function(a){y.drawingstate.alpha=
+a.value.real;y.drawingstate.linecolor=y.makecolor(y.drawingstate.linecolorraw[0],y.drawingstate.linecolorraw[1],y.drawingstate.linecolorraw[2]);y.drawingstate.pointcolor=y.makecolor(y.drawingstate.pointcolorraw[0],y.drawingstate.pointcolorraw[1],y.drawingstate.pointcolorraw[2]);y.drawingstate.textcolor=y.makecolor(y.drawingstate.textcolorraw[0],y.drawingstate.textcolorraw[1],y.drawingstate.textcolorraw[2])};y.setpointsize=function(a){y.drawingstate.pointsize=a.value.real};y.setlinesize=function(a){y.drawingstate.linesize=
+a.value.real};y.settextsize=function(a){y.drawingstate.textsize=a.value.real};var ga={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};p.defaultAppearance&&he(p.defaultAppearance);var dc={},Cd={UL:0,UR:1,LR:2,LL:3},Cc=["in","out","good","backup"],nb=new Float64Array(0),ib={};Cc.forEach(function(a){ib[a]=nb});var qa=nb,Oa=nb,Da=nb,Ba,Ea,lb,Ma,
+Ab,Dc=!1,Ed={toString:function(){return"RefineException"}},Hd=null,L=null;p.enableTraceLog&&(L={logLength:Infinity,fullLog:[],currentMouseAndScripts:null,currentMover:null,currentStep:null,currentElement:null,currentParam:null,labelTracing2:w.wrap("tracing2"),labelTracing4:w.wrap("tracing4"),labelTracingSesq:w.wrap("tracingSesq"),postMouseHooks:[]},"number"===typeof p.enableTraceLog&&(L.logLength=p.enableTraceLog),sa.getTraceLog=ne,sa.formatTraceLog=oe,sa.addTraceHook=L.postMouseHooks.push.bind(L.postMouseHooks));
+Pa.stateSize=12;Fc.stateSize=24;Qb.stateSize=24;var ob=[];mb.P=function(a){v.lines.forEach(function(b){b=Kd(a,b);b.holds()&&ob.push(b)});v.conics.forEach(function(b){b=Ld(a,b);b.holds()&&ob.push(b)})};mb.L=function(a){v.points.forEach(function(b){b=Kd(b,a);b.holds()&&ob.push(b)})};mb.S=mb.L;mb.C=function(a){v.points.forEach(function(b){b=Ld(b,a);b.holds()&&ob.push(b)})};var l={_helper:{},RandomLine:{}};l.RandomLine.kind="L";l.RandomLine.signature=[];l.RandomLine.updatePosition=function(a){a.homog=
+h.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.FreeLine={};l.FreeLine.kind="L";l.FreeLine.signature=[];l.FreeLine.isMovable=!0;l.FreeLine.initialize=function(a){a=l._helper.initializeLine(a);T(a)};l.FreeLine.getParamForInput=function(a,b,c){"mouse"===c?(a=h.cross(b,h.ez),a=h.cross(a,b)):a="homog"===c?b:h.turnIntoCSList([m.zero,m.zero,m.zero]);return h.normalizeMax(a)};l.FreeLine.getParamFromState=function(a){return X(3)};
+l.FreeLine.putParamToState=function(a,b){T(b)};l.FreeLine.updatePosition=function(a){var b=X(3);T(b);a.homog=w.withUsage(b,"Line")};l.FreeLine.stateSize=6;l.RandomPoint={};l.RandomPoint.kind="P";l.RandomPoint.signature=[];l.RandomPoint.updatePosition=function(a){a.homog=h.realVector([100*Math.random(),100*Math.random(),100*Math.random()]);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};l.Join={};l.Join.kind="L";l.Join.signature=["P","P"];l.Join.updatePosition=function(a){a.homog=
+h.cross(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.Segment={};l.Segment.kind="S";l.Segment.signature=["P","P"];l.Segment.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]];l.Segment.setSegmentPos(a,h.cross(b.homog,c.homog),h.scalmult(c.homog.value[2],b.homog),h.scalmult(b.homog.value[2],c.homog))};l.Segment.setSegmentPos=function(a,b,c,d){b=h.normalizeMax(b);a.homog=w.withUsage(b,"Line");b=
+h.turnIntoCSList([c,d]);b=h.normalizeMax(b);a.startpos=b.value[0];a.endpos=b.value[1]};l.Meet={};l.Meet.kind="P";l.Meet.signature=["L","L"];l.Meet.updatePosition=function(a){a.homog=h.cross(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};l.Meet.visiblecheck=function(a){var b=!0,c=v.csnames[a.args[0]],d=v.csnames[a.args[1]];"S"===c.kind&&(b=Ad(a,c));b&&"S"===d.kind&&(b=Ad(a,d));a.isshowing=b};l._helper.midpoint=function(a,
+b){return h.normalizeMax(h.add(h.scalmult(b.value[2],a),h.scalmult(a.value[2],b)))};l.Mid={};l.Mid.kind="P";l.Mid.signature=["P","P"];l.Mid.updatePosition=function(a){var b=l._helper.midpoint(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog);a.homog=w.withUsage(b,"Point")};l.Perp={};l.Perp.kind="L";l.Perp.signature=["L","P"];l.Perp.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,b=h.turnIntoCSList([b.value[0],b.value[1],m.zero]);a.homog=h.cross(b,c);a.homog=
+h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.Para={};l.Para.kind="L";l.Para.signature=["L","P"];l.Para.updatePosition=function(a){var b=v.csnames[a.args[1]].homog;a.homog=h.cross(h.cross(h.linfty,v.csnames[a.args[0]].homog),b);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.Horizontal={};l.Horizontal.kind="L";l.Horizontal.signature=["P"];l.Horizontal.updatePosition=function(a){a.homog=h.cross(h.ex,v.csnames[a.args[0]].homog);a.homog=h.normalizeMax(a.homog);
+a.homog=w.withUsage(a.homog,"Line")};l.HorizontalLine={};l.HorizontalLine.kind="L";l.HorizontalLine.signature=[];l.HorizontalLine.isMovable=!0;l.HorizontalLine.initialize=function(a){a=l._helper.initializeLine(a);a=h.turnIntoCSList([m.zero,a.value[1],a.value[2]]);a=h.normalizeMax(a);T(a)};l.HorizontalLine.getParamForInput=function(a,b,c){if("mouse"===c)b=h.cross(b,h.ex);else if("homog"===c){if(0!==b.value[0].real||0!==b.value[0].imag)b=h.turnIntoCSList([m.zero,b.value[1],b.value[2]])}else b=h.turnIntoCSList([m.zero,
+m.zero,m.zero]);return h.normalizeMax(b)};l.HorizontalLine.getParamFromState=function(a){return X(3)};l.HorizontalLine.putParamToState=function(a,b){T(b)};l.HorizontalLine.updatePosition=function(a){var b=X(3);T(b);a.homog=w.withUsage(b,"Line")};l.HorizontalLine.stateSize=6;l.Vertical={};l.Vertical.kind="L";l.Vertical.signature=["P"];l.Vertical.updatePosition=function(a){a.homog=h.cross(h.ey,v.csnames[a.args[0]].homog);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.VerticalLine=
+{};l.VerticalLine.kind="L";l.VerticalLine.signature=[];l.VerticalLine.isMovable=!0;l.VerticalLine.initialize=function(a){a=l._helper.initializeLine(a);a=h.turnIntoCSList([a.value[0],m.zero,a.value[2]]);a=h.normalizeMax(a);T(a)};l.VerticalLine.getParamForInput=function(a,b,c){if("mouse"===c)b=h.cross(b,h.ey);else if("homog"===c){if(0!==b.value[1].real||0!==b.value[1].imag)b=h.turnIntoCSList([b.value[0],m.zero,b.value[2]])}else b=h.turnIntoCSList([m.zero,m.zero,m.zero]);return h.normalizeMax(b)};l.VerticalLine.getParamFromState=
+function(a){return X(3)};l.VerticalLine.putParamToState=function(a,b){T(b)};l.VerticalLine.updatePosition=function(a){var b=X(3);T(b);a.homog=w.withUsage(b,"Line")};l.VerticalLine.stateSize=6;l.LineByFixedAngle={};l.LineByFixedAngle.kind="L";l.LineByFixedAngle.signature=["L","P"];l.LineByFixedAngle.initialize=function(a){var b=m._helper.input(a.angle),c=m.cos(b),b=m.sin(b);a.rot=h.turnIntoCSList([h.turnIntoCSList([b,c,m.zero]),h.turnIntoCSList([m.neg(c),b,m.zero]),h.turnIntoCSList([m.zero,m.zero,
+m.zero])])};l.LineByFixedAngle.updatePosition=function(a){var b=v.csnames[a.args[1]],c=h.productMV(a.rot,v.csnames[a.args[0]].homog);a.homog=h.cross(b.homog,c);a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Line")};l.Through={};l.Through.kind="L";l.Through.signature=["P"];l.Through.isMovable=!0;l.Through.initialize=function(a){a=a.dir?w.wrap(a.dir):h.realVector([a.pos[1],-a.pos[0],0]);T(a)};l.Through.getParamForInput=function(a,b,c){a="dir"===c||"mouse"===c?h.cross(v.csnames[a.args[0]].homog,
+b):"homog"===c?b:h.turnIntoCSList([m.zero,m.zero,m.zero]);a=h.cross(h.linfty,a);return h.normalizeMax(a)};l.Through.getParamFromState=function(a){return X(3)};l.Through.putParamToState=function(a,b){T(b)};l.Through.updatePosition=function(a){var b=X(3);T(b);b=h.cross(v.csnames[a.args[0]].homog,b);b=h.normalizeMax(b);a.homog=w.withUsage(b,"Line")};l.Through.stateSize=6;l.Through.set_angle=function(a,b){if("number"===b.ctype){var c=m.cos(b),d=m.sin(b),c=h.turnIntoCSList([c,d,m.real(0)]);La(a,c,"dir")}};
+l.Through.set_slope=function(a,b){if("number"===b.ctype){var c=h.turnIntoCSList([m.real(1),b,m.real(0)]);La(a,c,"dir")}};l.Free={};l.Free.kind="P";l.Free.signature=[];l.Free.isMovable=!0;l.Free.initialize=function(a){a=l._helper.initializePoint(a);T(a)};l.Free.getParamForInput=function(a,b,c){if("mouse"===c&&Eb&&0!==za){b=h.normalizeZ(b);a=b.value[0].value.real;c=b.value[1].value.real;var d=Math.round(a/za)*za,e=Math.round(c/za)*za;.2>Math.abs(d-a)&&.2>Math.abs(e-c)&&(b=h.realVector([d,e,1]))}return h.normalizeMax(b)};
+l.Free.getParamFromState=function(a){return X(3)};l.Free.putParamToState=function(a,b){T(b)};l.Free.updatePosition=function(a){var b=X(3);T(b);a.homog=w.withUsage(b,"Point")};l.Free.stateSize=6;l._helper.projectPointToLine=function(a,b){var c=h.turnIntoCSList([b.value[0],b.value[1],m.zero]),c=h.cross(c,a);return h.normalizeMax(h.cross(c,b))};l.PointOnLine={};l.PointOnLine.kind="P";l.PointOnLine.signature=["L"];l.PointOnLine.isMovable=!0;l.PointOnLine.initialize=function(a){var b=l._helper.initializePoint(a);
+a=v.csnames[a.args[0]].homog;var b=l._helper.projectPointToLine(b,a),b=h.normalizeMax(b),c=h.cross(h.linfty,b);h.normalizeMax(c);T(b);T(a);lb=!1};l.PointOnLine.updatePosition=function(a,b){var c,d=v.csnames[a.args[0]].homog;c=X(3);X(3);if(!b){Ba=a.stateIdx;var e=qa;qa=Da;var f=X(3),m=X(3);qa=e;e=h.cross(m,d);h._helper.isAlmostZero(e)&&(e=h.cross(h.linfty,d));f=l._helper.CircleMP(e,f);f=l._helper.IntersectLC(d,f);e=l._helper.pointReflection(e,c);c=Ec(f[0],f[1],c,e)[0]}c=h.normalizeMax(c);T(c);T(d);
+a.homog=w.withUsage(c,"Point")};l.PointOnLine.getParamForInput=function(a,b,c){a=v.csnames[a.args[0]].homog;b=l._helper.projectPointToLine(b,a);"mouse"===c&&Eb&&0!==za&&(b=l._helper.snapPointToLine(b,a));return b};l.PointOnLine.getParamFromState=function(a){return X(3)};l.PointOnLine.putParamToState=function(a,b){return T(b)};l.PointOnLine.stateSize=12;l.PointOnCircle={};l.PointOnCircle.kind="P";l.PointOnCircle.signature=["C"];l.PointOnCircle.isMovable=!0;l.PointOnCircle.initialize=function(a){var b=
+v.csnames[a.args[0]];a=h.normalizeZ(l._helper.initializePoint(a));var c=h.normalizeZ(l._helper.CenterOfCircle(b.matrix)),d=h.sub(a,c),d=h.turnIntoCSList([d.value[1],m.neg(d.value[0]),m.zero]),c=h.cross(a,c),b=l._helper.IntersectLC(c,b.matrix),c=h.projectiveDistMinScal(a,b[0]);h.projectiveDistMinScal(a,b[1])<c?(a=b[1],b=b[0]):(a=b[0],b=b[1]);T(d);T(a);T(b);lb=!1};l.PointOnCircle.putParamToState=function(a,b){T(b)};l.PointOnCircle.getParamFromState=function(a){return X(3)};l.PointOnCircle.getParamForInput=
+function(a,b,c){c=h.normalizeZ(l._helper.CenterOfCircle(v.csnames[a.args[0]].matrix));b=h.sub(b,c);Ba=a.stateIdx;a=X(3);var d=h.normalizeZ(X(3));c=h.sub(d,c);0>m.sub(m.mult(a.value[0],c.value[1]),m.mult(a.value[1],c.value[0])).value.real&&(b=h.neg(b));return h.turnIntoCSList([b.value[1],m.neg(b.value[0]),m.zero])};l.PointOnCircle.parameterPath=function(a,b,c,d,e){d=h.normalizeAbs(d);e=h.normalizeAbs(e);var f=h.scalproduct(d,e);if(0<=f.value.real)return Fd(a,b,c,d,e);a=h.turnIntoCSList([m.sub(d.value[1],
+e.value[1]),m.sub(e.value[0],d.value[0]),m.zero]);f=h.scalproduct(d,a);0>f.value.real&&(a=h.neg(a));0>b?(b=2*b+1,c=b*b,f=.25/(1+c),c=m.complex(2*b*f+.25,(1-c)*f)):(b=2*b-1,c=b*b,f=.25/(1+c),c=m.complex(2*b*f+.75,(1-c)*f));var k=m.sub(m.real(1),c);b=m.mult(c,c);f=m.mult(k,k);c=m.mult(c,k);d=h.scalmult(f,d);d=h.add(d,h.scalmult(c,a));return d=h.add(d,h.scalmult(b,e))};l.PointOnCircle.updatePosition=function(a){var b=X(3);T(b);var c=v.csnames[a.args[0]],b=h.productMV(c.matrix,b),c=l._helper.IntersectLC(b,
+c.matrix),c=Pa(c[0],c[1]),b=h.normalizeMax(c.value[0]);a.homog=w.withUsage(b,"Point");a.antipodalPoint=c.value[1]};l.PointOnCircle.stateSize=6+Pa.stateSize;l.OtherPointOnCircle={};l.OtherPointOnCircle.kind="P";l.OtherPointOnCircle.signature=["P"];l.OtherPointOnCircle.signatureConstraints=function(a){return"PointOnCircle"===v.csnames[a.args[0]].type};l.OtherPointOnCircle.updatePosition=function(a){var b=v.csnames[a.args[0]].antipodalPoint,b=h.normalizeMax(b);a.homog=w.withUsage(b,"Point")};l.PointOnSegment=
+{};l.PointOnSegment.kind="P";l.PointOnSegment.signature=["S"];l.PointOnSegment.isMovable=!0;l.PointOnSegment.initialize=function(a){var b=l._helper.initializePoint(a);a=l.PointOnSegment.getParamForInput(a,b);Za(a)};l.PointOnSegment.getParamForInput=function(a,b,c){a=v.csnames[a.args[0]];var d=a.homog;"mouse"===c&&Eb&&0!==za&&(b=l._helper.snapPointToLine(b,d));c=h.turnIntoCSList([d.value[0],d.value[1],m.zero]);d=h.sub(a.startpos,a.endpos);b=h.crossratio3(d,a.startpos,a.endpos,b,c);0>b.value.real&&
+(b=m.complex(0,b.value.imag));1<b.value.real&&(b=m.complex(1,b.value.imag));return b};l.PointOnSegment.getParamFromState=function(a){return Bb()};l.PointOnSegment.putParamToState=function(a,b){Za(b)};l.PointOnSegment.updatePosition=function(a){var b=Bb();Za(b);var c=v.csnames[a.args[0]],d=c.startpos,c=h.sub(c.endpos,d),b=h.add(d,h.scalmult(b,c)),b=h.normalizeMax(b);a.homog=w.withUsage(b,"Point")};l.PointOnSegment.stateSize=2;l._helper.projectPointToCircle=function(a,b){var c=l._helper.CenterOfCircle(a.matrix),
+c=h.normalizeMax(c),c=h.normalizeMax(h.cross(b,c)),c=l._helper.IntersectLC(c,a.matrix),d=h.projectiveDistMinScal(b,c[0]),e=h.projectiveDistMinScal(b,c[1]);return d<e?c[0]:c[1]};l.PointOnArc={};l.PointOnArc.kind="P";l.PointOnArc.signature=["C"];l.PointOnArc.signatureConstraints=function(a){return v.csnames[a.args[0]].isArc};l.PointOnArc.isMovable=!0;l.PointOnArc.initialize=function(a){var b=l._helper.initializePoint(a);a=l.PointOnArc.getParamForInput(a,b);T(a)};l.PointOnArc.getParamForInput=function(a,
+b){var c=v.csnames[a.args[0]],d=l._helper.projectPointToCircle(c,b),c=h.normalizeMax(h.crossratio3harm(c.startPoint,c.endPoint,c.viaPoint,d,h.ii)),d=m.div(c.value[0],c.value[1]);0>d.value.real&&(c=-1>d.value.real?h.realVector([1,0]):h.realVector([0,1]));return c};l.PointOnArc.getParamFromState=function(a){return X(2)};l.PointOnArc.putParamToState=function(a,b){T(b)};l.PointOnArc.updatePosition=function(a){var b=v.csnames[a.args[0]],c=b.startPoint,d=b.viaPoint,e=b.endPoint,f=h.ii,k=h.cross(c,f),d=
+h.cross(d,f),n=h.cross(e,f),n=h.turnIntoCSList([k,n]),k=h.transpose(n),n=h.conjugate(n),k=h.productMM(n,k),d=h.productMV(n,d),k=h.productMV(h.adjoint2(k),d),d=k.value[0],k=k.value[1],n=X(2);T(n);c=h.normalizeMax(h.add(h.scalmult(m.mult(d,n.value[0]),c),h.scalmult(m.mult(k,n.value[1]),e)));b=l._helper.conicOtherIntersection(b.matrix,f,c);a.homog=w.withUsage(b,"Point")};l.PointOnArc.stateSize=4;l._helper.CenterOfCircle=function(a){return h.turnIntoCSList([a.value[2].value[0],a.value[2].value[1],m.neg(a.value[0].value[0])])};
+l._helper.CenterOfConic=function(a){a=h.adjoint3(a);return{ctype:"list",value:[a.value[2].value[0],a.value[2].value[1],a.value[2].value[2]]}};l.CenterOfConic={};l.CenterOfConic.kind="P";l.CenterOfConic.signature=["C"];l.CenterOfConic.updatePosition=function(a){var b=l._helper.CenterOfConic(v.csnames[a.args[0]].matrix);a.homog=b;a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};l._helper.CircleMP=function(a,b){var c=a.value[0],d=a.value[1],e=m.neg(a.value[2]),f=m.zero,c=h.turnIntoCSList([h.turnIntoCSList([e,
+f,c]),h.turnIntoCSList([f,e,d]),h.turnIntoCSList([c,d,f])]),e=w.mult(w.mult(b,c),b),d=w.mult(w.mult(b,h.fund),b),e=w.mult(e,h.fund),c=w.mult(d,c);return h.sub(e,c)};l.CircleMP={};l.CircleMP.kind="C";l.CircleMP.signature=["P","P"];l.CircleMP.updatePosition=function(a){a.matrix=l._helper.CircleMP(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog);a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Circle")};l.CircleMr={};l.CircleMr.kind="C";l.CircleMr.signature=["P"];l.CircleMr.isMovable=
+!0;l.CircleMr.initialize=function(a){Za(m.real(a.radius))};l.CircleMr.getParamForInput=function(a,b,c){if("radius"===c)return b;a=v.csnames[a.args[0]].homog;a=h.normalizeZ(a);b=h.normalizeZ(b);b=h.sub(a,b);return b=h.abs(b)};l.CircleMr.getParamFromState=function(a){return Bb()};l.CircleMr.putParamToState=function(a,b){Za(b)};l.CircleMr.updatePosition=function(a){var b=Bb();Za(b);var c=v.csnames[a.args[0]].homog,d=m.mult(c.value[2],b),d=m.mult(d,d);if(!m._helper.isFinite(d)&&!m._helper.isNaN(d))return h.fund;
+c=l._helper.ScaledCircleMrr(c,d);a.matrix=w.withUsage(c,"Circle");a.radius=b};l.CircleMr.stateSize=2;l.CircleMr.set_radius=function(a,b){"number"===b.ctype&&La(a,b,"radius")};l._helper.ScaledCircleMrr=function(a,b){var c=a.value[0],d=a.value[1],e=m.neg(a.value[2]),e=h.scalmult(e,h.turnIntoCSList([c,d,e])).value,c=h.turnIntoCSList([c,d]),c=m.sub(h.scalproduct(c,c),b),e=l._helper.buildConicMatrix([e[2],m.zero,e[2],e[0],e[1],c]);return h.normalizeMax(e)};l.Compass={};l.Compass.kind="C";l.Compass.signature=
+["P","P","P"];l.Compass.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=b.value[2],f=c.value[2],k=d.value[2],b=h.scalmult(m.mult(f,k),b),c=h.scalmult(m.mult(e,k),c),d=h.scalmult(m.mult(e,f),d),b=h.sub(c,b),d=l._helper.ScaledCircleMrr(d,h.scalproduct(b,b));a.matrix=w.withUsage(d,"Circle")};l._helper.getConicType=function(a){if(1E-16>m.abs(h.det(a)).value.real)return"degenerate";var b=m.mult(a.value[0].value[0],a.value[1].value[1]),
+b=m.sub(b,m.pow(a.value[0].value[1],m.real(2))),b=b.value.real;return 1E-16>Math.abs(b)?"parabola":1E-16<b?"ellipsoid":"hyperbola"};l._helper.ConicBy5=function(a,b,c,d,e,f){a=h.turnIntoCSList([h.cross(c,d)]);var m=h.turnIntoCSList([h.cross(b,e)]);b=h.turnIntoCSList([h.cross(b,c)]);d=h.turnIntoCSList([h.cross(d,e)]);return l._helper.conicFromTwoDegenerates(a,m,b,d,f)};l._helper.conicFromTwoDegenerates=function(a,b,c,d,e){a=w.mult(h.transpose(b),a);c=w.mult(h.transpose(d),c);a=h.add(a,h.transpose(a));
+c=h.add(c,h.transpose(c));d=w.mult(w.mult(e,a),e);e=w.mult(w.mult(e,c),e);c=w.mult(d,c);e=w.mult(e,a);return h.sub(c,e)};l.ConicBy5={};l.ConicBy5.kind="C";l.ConicBy5.signature=["P","P","P","P","P"];l.ConicBy5.updatePosition=function(a){var b=l._helper.ConicBy5(a,v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog);a.matrix=b;a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};l.FreeConic={};l.FreeConic.kind=
+"C";l.FreeConic.signature=[];l.FreeConic.initialize=function(a){var b;b=a.pos?l._helper.inputConic(a.pos):h.zeromatrix(m.real(3),m.real(3));l.FreeConic.putParamToState(a,b)};l.FreeConic.getParamForInput=function(a,b,c){return h.normalizeMax(b)};l.FreeConic.getParamFromState=function(a){return l._helper.buildConicMatrix(X(6).value)};l.FreeConic.putParamToState=function(a,b){for(var c=0;3>c;++c)for(var d=0;d<=c;++d)Za(b.value[c].value[d])};l.FreeConic.updatePosition=function(a){var b=X(6);T(b);a.matrix=
+l._helper.buildConicMatrix(b.value);a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};l.FreeConic.set_matrix=function(a,b){h._helper.isNumberMatrixMN(b,3,3)&&La(a,h.add(b,h.transpose(b)),"matrix")};l.FreeConic.stateSize=12;l._helper.buildConicMatrix=function(a){var b=a[1],c=a[2],d=a[3],e=a[4],f=a[5];return h.turnIntoCSList([h.turnIntoCSList([a[0],b,d]),h.turnIntoCSList([b,c,e]),h.turnIntoCSList([d,e,f])])};l._helper.flattenConicMatrix=function(a){return h.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]])};l._helper.splitDegenConic=function(a){var b=h.adjoint3(a),c=0,d,e,f=m.abs2(b.value[0].value[0]).value.real;for(d=1;3>d;d++)e=m.abs2(b.value[d].value[d]).value.real,e>f&&(c=d,f=e);d=m.sqrt(m.mult(m.real(-1),b.value[c].value[c]));if(1E-16>m.abs2(d).value.real)return a=h.turnIntoCSList([m.zero,m.zero,m.zero]),[a,a];c=m.real(c+1);e=h.column(b,c);e=h.scaldiv(d,e);d=e.value[0];f=e.value[1];e=e.value[2];
+d=h.turnIntoCSList([h.turnIntoCSList([m.real(0),e,m.mult(m.real(-1),f)]),h.turnIntoCSList([m.mult(m.real(-1),e),m.real(0),d]),h.turnIntoCSList([f,m.mult(m.real(-1),d),m.real(0)])]);a=h.add(a,d);var k=0;for(d=f=b=0;3>d;d++)for(c=0;3>c;c++)e=m.abs2(a.value[d].value[c]).value.real,e>f&&(k=d,b=c,f=e);d=a.value[k];a=h.transpose(a);a=a.value[b];d=h.normalizeMax(d);a=h.normalizeMax(a);d=w.withUsage(d,"Line");a=w.withUsage(a,"Line");return[d,a]};l._helper.inputConic=function(a){var b="xx xy yy xz yz zz".split(" ").map(function(b){var d=
+m._helper.input(a[b]);b[0]!==b[1]&&(d=m.realmult(.5,d));return d});return l._helper.buildConicMatrix(b)};l.SelectConic={};l.SelectConic.kind="C";l.SelectConic.signature=["Cs"];l.SelectConic.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=l._helper.inputConic(a.pos);a=v.csnames[a.args[0]].results;for(var c=h.conicDist(b,a[0]),d=0,e=1;e<a.length;++e){var f=h.conicDist(b,a[e]);f<c&&(c=f,d=e)}return d};l.SelectConic.updatePosition=function(a){a.matrix=v.csnames[a.args[0]].results[a.param];
+a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};l._helper.ConicBy4p1l=function(a,b,c,d,e,f){var k=h.scalproduct(b,f),n=h.scalproduct(c,f),p=h.scalproduct(d,f),r=h.scalproduct(e,f),t=h.det3(c,d,e),v=h.det3(b,c,e),u=h.det3(b,d,e),w=h.det3(b,c,d),x=m.mult,n=m.sqrt(x(x(n,r),x(t,v))),k=m.sqrt(x(x(k,p),x(u,w))),p=h.cross(h.cross(b,d),f);f=h.cross(h.cross(c,e),f);p=h.scalmult(n,p);k=h.scalmult(k,f);f=h.normalizeMax(h.add(p,k));k=h.normalizeMax(h.sub(p,k));k=Pa(f,k);f=l._helper.ConicBy5(a,
+b,c,d,e,k.value[0]);a=l._helper.ConicBy5(a,b,c,d,e,k.value[1]);return[h.normalizeMax(f),h.normalizeMax(a)]};l.ConicBy4p1l={};l.ConicBy4p1l.kind="Cs";l.ConicBy4p1l.signature=["P","P","P","P","L"];l.ConicBy4p1l.updatePosition=function(a){var b=l._helper.ConicBy4p1l(a,v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog);a.results=b};l.ConicBy4p1l.stateSize=Pa.stateSize;l._helper.ConicBy3p2l=function(a,b,c,d,e){function f(a,
+b,c,d){return m.sub(m.mult(a,d),m.mult(b,c))}var k=h.cross(a,b),l=h.cross(d,e);d=h.cross(d,k);e=h.cross(e,k);k=h.turnIntoCSList([d,e,l]);c=h.productVM(c,h.adjoint3(k));l=h.adjoint3(h.turnIntoCSList([h.scalmult(c.value[0],d),h.scalmult(c.value[1],e),h.scalmult(c.value[2],l)]));c=h.transpose(l);d=m.mult;e=h.productMV(c,a);a=e.value[0];e=e.value[1];k=h.productMV(c,b);b=k.value[0];var k=k.value[1],n=m.sqrt(d(a,e)),p=m.sqrt(d(b,k)),r,t=Array(4);for(r=0;4>r;++r){var v=(r&2)-1,u=d(m.real(((r&1)<<1)-1),n),
+w=d(m.real(v),p),x=f(e,u,k,w),y=f(b,w,a,u),v=f(a,e,b,k),z=m.add(m.add(f(b,k,a,e),f(k,w,e,u)),f(w,b,u,a)),u=d(x,x),w=d(y,y),A=d(z,z),B=d(x,y),x=d(x,z),y=d(y,z),B=m.sub(B,d(m.real(.5),d(v,v))),v=h.turnIntoCSList([h.turnIntoCSList([u,B,x]),h.turnIntoCSList([B,w,y]),h.turnIntoCSList([x,y,A])]),v=h.productMM(l,h.productMM(v,c)),v=h.turnIntoCSList([v.value[0].value[0],v.value[0].value[1],v.value[0].value[2],v.value[1].value[1],v.value[1].value[2],v.value[2].value[2]]);t[r]=v}return t};l.ConicBy3p2l={};
+l.ConicBy3p2l.kind="Cs";l.ConicBy3p2l.signature=["P","P","P","L","L"];l.ConicBy3p2l.updatePosition=function(a){for(var b=l._helper.ConicBy3p2l(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog),b=Id(b),c=Array(4),d=0;4>d;++d){var e=b[d].value;c[d]=h.turnIntoCSList([h.turnIntoCSList([e[0],e[1],e[2]]),h.turnIntoCSList([e[1],e[3],e[4]]),h.turnIntoCSList([e[2],e[4],e[5]])])}a.results=c};l.ConicBy3p2l.stateSize=48;l.ConicBy2p3l=
+{};l.ConicBy2p3l.kind="Cs";l.ConicBy2p3l.signature=["P","P","L","L","L"];l.ConicBy2p3l.updatePosition=function(a){for(var b=l._helper.ConicBy3p2l(v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog,v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog),b=Id(b),c=Array(4),d=0;4>d;++d){var e=b[d].value,e=h.turnIntoCSList([h.turnIntoCSList([e[0],e[1],e[2]]),h.turnIntoCSList([e[1],e[3],e[4]]),h.turnIntoCSList([e[2],e[4],e[5]])]);c[d]=h.normalizeMax(h.adjoint3(e))}a.results=
+c};l.ConicBy2p3l.stateSize=48;l.ConicBy1p4l={};l.ConicBy1p4l.kind="Cs";l.ConicBy1p4l.signature=["P","L","L","L","L"];l.ConicBy1p4l.updatePosition=function(a){var b=l._helper.ConicBy4p1l(a,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog,v.csnames[a.args[0]].homog),c=b[0],b=b[1],c=h.adjoint3(c),b=h.adjoint3(b),b=[c,b];a.results=b};l.ConicBy1p4l.stateSize=Pa.stateSize;l.ConicParabolaPL={};l.ConicParabolaPL.kind="C";l.ConicParabolaPL.signature=
+["P","L"];l.ConicParabolaPL.updatePosition=function(a){var b=v.csnames[a.args[0]].homog.value,c=v.csnames[a.args[1]].homog.value,d=m.mult,e=m.neg,f=m.add,k=m.sub,n=b[0],p=b[1],r=b[2],t=c[0],b=c[1],c=c[2],u=d(r,r),x=d(t,t),y=d(b,b),z=d(r,c),A=e(r),r=f(x,y),y=d(u,y),x=d(u,x),e=d(e(u),d(t,b)),t=d(A,f(d(n,r),d(z,t))),b=d(A,f(d(p,r),d(z,b))),d=k(d(f(d(n,n),d(p,p)),r),d(u,d(c,c))),d=l._helper.buildConicMatrix([y,e,x,t,b,d]),d=h.normalizeMax(d);a.matrix=w.withUsage(d,"Conic")};l.ConicBy2Foci1P={};l.ConicBy2Foci1P.kind=
+"Cs";l.ConicBy2Foci1P.signature=["P","P","P"];l.ConicBy2Foci1P.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=h.ii,f=h.jj,k=h.normalizeMax(h.cross(b,d)),n=h.normalizeMax(h.cross(c,d)),p=h.normalizeMax(h.cross(d,e)),d=h.normalizeMax(h.cross(d,f)),n=l._helper.coHarmonic(p,d,k,n),k=h.normalizeMax(n[0]),n=h.normalizeMax(n[1]),e=h.turnIntoCSList([e]),p=h.turnIntoCSList([f]),d=h.turnIntoCSList([b]),r=h.turnIntoCSList([c]),f=l._helper.conicFromTwoDegenerates(e,
+p,d,r,k),f=h.normalizeMax(f),e=l._helper.conicFromTwoDegenerates(e,p,d,r,n),e=h.normalizeMax(e),f=h.normalizeMax(h.adjoint3(f)),e=h.normalizeMax(h.adjoint3(e));"ellipsoid"!==l._helper.getConicType(f)&&(k=f,f=e,e=k);h.almostequals(b,c).value&&(b=m.real(3),e=h.zeromatrix(b,b));a.results=[f,e]};l.ConicBy2Pol1P={};l.ConicBy2Pol1P.kind="C";l.ConicBy2Pol1P.signature=["P","L","P","L","P"];l.ConicBy2Pol1P.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,
+e=v.csnames[a.args[3]].homog,f=v.csnames[a.args[4]].homog,k=h.scalproduct,l=h.scalmult,n=h.sub,p=h.productMM,r=m.realmult,t=h.transpose,u=h.turnIntoCSList,x=n(l(k(c,b),f),l(r(2,k(c,f)),b)),y=n(l(k(e,d),f),l(r(2,k(e,f)),d)),z=u([h.cross(b,f)]),f=u([h.cross(d,f)]),y=p(t(z),u([h.cross(b,y)])),u=p(t(f),u([h.cross(d,x)])),p=p(t(z),f),b=k(b,e),c=k(d,c),d=h.add(l(c,y),l(b,u)),d=n(d,l(r(2,m.mult(b,c)),p)),d=h.add(d,t(d)),d=h.normalizeMax(d),d=w.withUsage(d,"Conic");a.matrix=d};l.ConicBy2Pol1L={};l.ConicBy2Pol1L.kind=
+"C";l.ConicBy2Pol1L.signature=["P","L","P","L","L"];l.ConicBy2Pol1L.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=v.csnames[a.args[3]].homog,f=v.csnames[a.args[4]].homog,k=h.scalproduct,l=h.scalmult,n=h.productMM,p=m.mult,r=h.transpose,t=h.turnIntoCSList,u=k(c,b),x=k(c,d),y=k(e,b),z=k(e,d),A=k(f,b),k=k(f,d),B=t([h.sub(l(p(y,k),c),l(p(x,A),e))]),b=h.add(n(r(t([l(p(y,x),f)])),t([h.sub(h.add(l(m.sub(p(u,k),p(x,A)),e),l(m.sub(p(z,
+A),p(y,k)),c)),l(h.det3(c,e,f),h.cross(b,d)))])),n(r(B),B)),b=h.add(b,r(b)),b=h.normalizeMax(b),b=w.withUsage(b,"Conic");a.matrix=b};l._helper.conic1Pol3Inc=function(a,b,c,d,e){var f=h.scalproduct,k=h.scalmult,l=h.productMM,n=h.cross,p=m.realmult,r=m.mult,t=h.transpose,v=h.turnIntoCSList,u=h.det3,w=u(a,c,d),x=v([n(c,e)]),y=v([n(a,e)]),z=v([n(c,d)]),A=f(b,a),B=f(b,c);b=f(b,e);n=v([n(d,h.sub(k(A,e),k(p(2,b),a)))]);x=k(w,l(t(x),n));a=p(2,m.add(r(u(a,d,e),B),r(w,b)));a=m.sub(r(u(c,d,e),A),a);x=h.add(x,
+k(a,l(t(y),z)));x=h.add(x,t(x));return x=h.normalizeMax(x)};l.ConicBy1Pol3P={};l.ConicBy1Pol3P.kind="C";l.ConicBy1Pol3P.signature=["P","L","P","P","P"];l.ConicBy1Pol3P.updatePosition=function(a){var b=l._helper.conic1Pol3Inc(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog),b=w.withUsage(b,"Conic");a.matrix=b};l.ConicBy1Pol3L={};l.ConicBy1Pol3L.kind="C";l.ConicBy1Pol3L.signature=["P","L","L","L","L"];l.ConicBy1Pol3L.updatePosition=
+function(a){var b=l._helper.conic1Pol3Inc(v.csnames[a.args[1]].homog,v.csnames[a.args[0]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog),b=h.normalizeMax(h.adjoint3(b)),b=w.withUsage(b,"Conic");a.matrix=b};l.ConicBy1Pol2P1L={};l.ConicBy1Pol2P1L.kind="Cs";l.ConicBy1Pol2P1L.signature=["P","L","P","P","L"];l.ConicBy1Pol2P1L.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=v.csnames[a.args[3]].homog,
+f=v.csnames[a.args[4]].homog,k=m.add,l=h.turnIntoCSList,n=h.cross,p=h.productMM,r=m.mult,t=m.realmult,u=h.scalmult,w=h.scalproduct,x=m.sub,y=h.transpose,z=w(c,b),A=w(c,d),B=w(c,e),c=w(f,b),C=w(f,d),w=w(f,e),f=l([n(b,d)]),b=l([n(b,e)]),d=l([n(d,e)]),e=m.sqrt(r(r(C,w),r(x(r(z,C),t(2,r(c,A))),x(r(z,w),t(2,r(c,B)))))),l=p(y(f),b),e=u(e,h.add(l,y(l))),k=u(x(r(z,r(C,w)),k(r(c,r(A,w)),r(c,r(C,B)))),l),t=h.add(h.sub(u(B,f),u(A,b)),u(t(.5,z),d)),k=h.add(k,u(r(c,c),p(y(d),t))),k=h.add(k,y(k)),p=h.normalizeMax(h.add(e,
+k)),r=h.normalizeMax(h.sub(e,k));a.results=Qb(p,r).value};l.ConicBy1Pol2P1L.stateSize=Qb.stateSize;l.ConicBy1Pol1P2L={};l.ConicBy1Pol1P2L.kind="Cs";l.ConicBy1Pol1P2L.signature=["P","L","P","L","L"];l.ConicBy1Pol1P2L.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=v.csnames[a.args[3]].homog,f=v.csnames[a.args[4]].homog,k=m.add,l=h.turnIntoCSList,n=h.cross,p=h.productMM,r=m.mult,t=m.realmult,u=h.scalmult,w=h.scalproduct,x=m.sub,
+y=h.transpose,z=w(c,b),A=w(c,d),B=w(e,b),C=w(e,d),D=w(f,b),E=w(f,d),F=r(z,z),G=r(z,A),w=r(A,A),H=r(B,B),I=r(B,C),L=r(C,C),N=r(D,D),J=r(D,E),M=r(E,E),K=r(r(F,L),M),K=x(K,t(2,r(r(G,I),M))),K=x(K,t(2,r(r(G,L),J))),K=k(K,t(.5,r(r(w,H),M))),K=k(K,t(3,r(r(w,I),J))),K=k(K,t(.5,r(r(w,L),N))),J=r(r(z,C),E),J=x(J,r(r(A,B),E)),J=x(J,r(r(A,C),D)),J=r(J,r(w,D)),M=x(r(z,C),t(2,r(A,B))),M=r(M,r(w,r(C,D))),K=p(y(l([c])),l([h.add(h.add(u(K,c),u(J,e)),u(M,f))])),J=l([e]),K=h.add(K,u(t(.5,r(r(w,w),N)),p(y(J),J))),K=
+h.add(K,u(w,p(y(l([f])),l([h.add(u(x(x(t(2,r(G,I)),r(F,L)),t(.5,r(w,H))),f),u(r(h.det3(c,e,f),x(r(z,C),r(A,B))),n(b,d)))])))),K=h.add(K,y(K)),b=m.sqrt(r(r(C,E),r(x(r(z,C),t(2,r(A,B))),x(r(z,E),t(2,r(A,D)))))),c=p(y(l([c])),l([h.sub(u(x(r(A,k(r(B,E),r(C,D))),r(z,r(C,E))),c),u(w,h.add(u(D,e),u(B,f))))])),c=h.add(c,u(r(z,w),p(y(l([e])),l([f])))),c=u(b,c),c=h.add(c,y(c)),e=h.normalizeMax(h.add(K,c)),f=h.normalizeMax(h.sub(K,c));a.results=Qb(e,f).value};l.ConicBy1Pol1P2L.stateSize=Qb.stateSize;l._helper.coHarmonic=
+function(a,b,c,d){var e=h.realVector([100*Math.random(),100*Math.random(),1]),f=h.det3(e,c,a),k=h.det3(e,c,b);c=h.det3(e,d,a);d=h.det3(e,d,b);d=m.sqrt(m.mult(d,k));f=m.sqrt(m.mult(c,f));a=w.mult(a,d);f=w.mult(b,f);b=h.add(a,f);a=h.sub(a,f);return[b,a]};l.ConicInSquare={};l.ConicInSquare.kind="C";l.ConicInSquare.signature=["P","P","P","P"];l.ConicInSquare.updatePosition=function(a){var b=D.basismap(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog),
+c=m.one,c=l._helper.buildConicMatrix([c,c,c,m.real(-3),c,c]),b=h.adjoint3(b),b=h.productMM(h.productMM(h.transpose(b),c),b),b=h.normalizeMax(b);a.matrix=w.withUsage(b,"Conic")};l.ConicBy5lines={};l.ConicBy5lines.kind="C";l.ConicBy5lines.signature=["L","L","L","L","L"];l.ConicBy5lines.updatePosition=function(a){var b=l._helper.ConicBy5(a,v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[4]].homog),b=h.adjoint3(b);a.matrix=b;
+a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};l.ConicFromPrincipalDirections={};l.ConicFromPrincipalDirections.kind="C";l.ConicFromPrincipalDirections.signature=["P","P","P"];l.ConicFromPrincipalDirections.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=v.csnames[a.args[2]].homog,e=l._helper.pointReflection(b,c),f=h.cross(c,b),b=h.turnIntoCSList([f.value[0],f.value[1],m.zero]),f=h.turnIntoCSList([f]),c=h.turnIntoCSList([h.cross(c,
+b)]),e=h.turnIntoCSList([h.cross(e,b)]);a.matrix=l._helper.conicFromTwoDegenerates(f,f,c,e,d);a.matrix=h.normalizeMax(a.matrix);a.matrix=w.withUsage(a.matrix,"Conic")};l.CircleBy3={};l.CircleBy3.kind="C";l.CircleBy3.signature=["P","P","P"];l.CircleBy3.updatePosition=function(a){var b=l._helper.ConicBy5(a,v.csnames[a.args[0]].homog,v.csnames[a.args[1]].homog,h.ii,h.jj,v.csnames[a.args[2]].homog);a.matrix=h.normalizeMax(b);a.matrix=w.withUsage(a.matrix,"Circle")};l.ArcBy3={};l.ArcBy3.kind="C";l.ArcBy3.signature=
+["P","P","P"];l.ArcBy3.updatePosition=function(a){l.CircleBy3.updatePosition(a);a.startPoint=v.csnames[a.args[0]].homog;a.viaPoint=v.csnames[a.args[1]].homog;a.endPoint=v.csnames[a.args[2]].homog};l.ArcBy3.initialize=function(a){a.startPoint=v.csnames[a.args[0]].homog;a.viaPoint=v.csnames[a.args[1]].homog;a.endPoint=v.csnames[a.args[2]].homog;a.isArc=!0};l.PolarOfPoint={};l.PolarOfPoint.kind="L";l.PolarOfPoint.signature=["P","C"];l.PolarOfPoint.updatePosition=function(a){var b=w.mult(v.csnames[a.args[1]].matrix,
+v.csnames[a.args[0]].homog),b=h.normalizeMax(b);a.homog=w.withUsage(b,"Line")};l.PolarOfLine={};l.PolarOfLine.kind="P";l.PolarOfLine.signature=["L","C"];l.PolarOfLine.updatePosition=function(a){var b=v.csnames[a.args[0]],c=h.adjoint3(v.csnames[a.args[1]].matrix),b=w.mult(c,b.homog),b=h.normalizeMax(b);a.homog=w.withUsage(b,"Point")};l.AngleBisector={};l.AngleBisector.kind="Ls";l.AngleBisector.signature=["L","L","P"];l.AngleBisector.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,
+d=v.csnames[a.args[2]].homog,e=h.add,f=h.sub,k=h.abs,l=h.cross,m=h.scalmult,n=h.normalizeMax,p=h._helper.isAlmostZero,r=h.linfty,t=m(k(l(l(r,c),r)),b),b=m(k(l(l(r,b),r)),c),f=f(t,b),e=e(t,b);p(f)&&(f=l(l(l(r,e),r),d));p(e)&&(e=l(l(l(r,f),r),d));a.results=Pa(n(f),n(e))};l.AngleBisector.stateSize=Pa.stateSize;l._helper.IntersectLC=function(a,b){var c=m,d=h.crossOperator(a),e=h.transpose(d),e=w.mult(e,w.mult(b,d)),f=h.maxIndex(a,m.abs2),k,l,n,p;0===f?(f=e.value[1].value[1],k=e.value[1].value[2],l=e.value[2].value[1],
+n=e.value[2].value[2],p=a.value[0]):1===f?(f=e.value[0].value[0],k=e.value[0].value[2],l=e.value[2].value[0],n=e.value[2].value[2],p=a.value[1]):(f=e.value[0].value[0],k=e.value[0].value[1],l=e.value[1].value[0],n=e.value[1].value[1],p=a.value[2]);c=c.div(c.sqrt(c.sub(c.mult(k,l),c.mult(f,n))),p);c=h.add(e,h.scalmult(c,d));f=h.maxIndex(c,h.abs2);d=c.value[f];d=h.normalizeMax(d);d=w.withUsage(d,"Point");c=h.transpose(c);f=h.maxIndex(c,h.abs2);c=c.value[f];c=h.normalizeMax(c);c=w.withUsage(c,"Point");
+return[d,c]};l.IntersectLC={};l.IntersectLC.kind="Ps";l.IntersectLC.signature=["L","C"];l.IntersectLC.updatePosition=function(a){var b=l._helper.IntersectLC(v.csnames[a.args[0]].homog,v.csnames[a.args[1]].matrix);a.results=Pa(b[0],b[1])};l.IntersectLC.stateSize=Pa.stateSize;l.OtherIntersectionCL={};l.OtherIntersectionCL.kind="P";l.OtherIntersectionCL.signature=["C","L","P"];l.OtherIntersectionCL.updatePosition=function(a){var b=v.csnames[a.args[2]].homog,c=l._helper.IntersectLC(v.csnames[a.args[1]].homog,
+v.csnames[a.args[0]].matrix),d=c[0],c=c[1],e=h.projectiveDistMinScal(d,b),b=h.projectiveDistMinScal(c,b);a.homog=e<b?c:d;a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};l.IntersectCirCir={};l.IntersectCirCir.kind="Ps";l.IntersectCirCir.signature=["C","C"];l.IntersectCirCir.updatePosition=function(a){var b=v.csnames[a.args[0]].matrix,c=v.csnames[a.args[1]].matrix,d=h.scalmult(c.value[0].value[0],b.value[2]),c=h.scalmult(b.value[0].value[0],c.value[2]),d=h.sub(d,c),d=h.turnIntoCSList([d.value[0],
+d.value[1],m.realmult(.5,d.value[2])]),d=h.normalizeMax(d),b=l._helper.IntersectLC(d,b);a.results=Pa(b[0],b[1])};l.IntersectCirCir.stateSize=Pa.stateSize;l.OtherIntersectionCC={};l.OtherIntersectionCC.kind="P";l.OtherIntersectionCC.signature=["C","C","P"];l.OtherIntersectionCC.updatePosition=function(a){var b=v.csnames[a.args[0]].matrix,c=v.csnames[a.args[1]].matrix,d=v.csnames[a.args[2]].homog,e=h.scalmult(c.value[0].value[0],b.value[2]),c=h.scalmult(b.value[0].value[0],c.value[2]),e=h.sub(e,c),
+e=h.turnIntoCSList([e.value[0],e.value[1],m.realmult(.5,e.value[2])]),e=h.normalizeMax(e),e=l._helper.IntersectLC(e,b),b=e[0],e=e[1],c=h.projectiveDistMinScal(b,d),d=h.projectiveDistMinScal(e,d);a.homog=c<d?e:b;a.homog=h.normalizeMax(a.homog);a.homog=w.withUsage(a.homog,"Point")};l._helper.IntersectConicConic=function(a,b){var c=a.value[0],d=a.value[1],e=a.value[2],f=b.value[0],k=b.value[1],n=b.value[2],p=h.det3(c,d,e),r=m.add(m.add(h.det3(c,d,n),h.det3(c,k,e)),h.det3(f,d,e)),c=m.add(m.add(h.det3(c,
+k,n),h.det3(f,d,n)),h.det3(f,k,e)),f=h.det3(f,k,n),n=m.abs2(p).value.real,k=m.abs2(f).value.real;n<k&&(n=a,a=b,b=n,n=f,f=p,p=n,n=c,c=r,r=n,n=k);1E-24>n?(p=a,c=b):(r=m.solveCubic(p,r,c,f),c=m.abs2(m.sub(r[0],r[1])).value.real,f=m.abs2(m.sub(r[0],r[2])).value.real,k=m.abs2(m.sub(r[1],r[2])).value.real,c>f?(p=r[1],r=c>k?r[0]:r[2]):(p=r[2],r=f>k?r[0]:r[1]),p=h.add(h.scalmult(p,a),b),c=h.add(h.scalmult(r,a),b));r=l._helper.splitDegenConic(p);p=r[0];r=r[1];c=l._helper.splitDegenConic(c);k=c[0];f=c[1];c=
+h.cross(p,k);k=h.cross(r,k);p=h.cross(p,f);r=h.cross(r,f);c=h.normalizeMax(c);k=h.normalizeMax(k);p=h.normalizeMax(p);r=h.normalizeMax(r);c=w.withUsage(c,"Point");k=w.withUsage(k,"Point");p=w.withUsage(p,"Point");r=w.withUsage(r,"Point");return[c,k,p,r]};l.IntersectConicConic={};l.IntersectConicConic.kind="Ps";l.IntersectConicConic.signature=["C","C"];l.IntersectConicConic.updatePosition=function(a){var b=l._helper.IntersectConicConic(v.csnames[a.args[0]].matrix,v.csnames[a.args[1]].matrix),b=Fc(b[0],
+b[1],b[2],b[3]);a.results=b};l.IntersectConicConic.stateSize=Fc.stateSize;l.SelectP={};l.SelectP.kind="P";l.SelectP.signature=["Ps"];l.SelectP.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=v.csnames[a.args[0]].results.value;a=l._helper.initializePoint(a);for(var c=h.projectiveDistMinScal(a,b[0]),d=0,e=1;e<b.length;++e){var f=h.projectiveDistMinScal(a,b[e]);f<c&&(c=f,d=e)}return d};l.SelectP.updatePosition=function(a){a.homog=v.csnames[a.args[0]].results.value[a.param]};l.SelectL=
+{};l.SelectL.kind="L";l.SelectL.signature=["Ls"];l.SelectL.initialize=function(a){if(void 0!==a.index)return a.index-1;var b=v.csnames[a.args[0]].results.value;a=l._helper.initializeLine(a);for(var c=h.projectiveDistMinScal(a,b[0]),d=0,e=1;e<b.length;++e){var f=h.projectiveDistMinScal(a,b[e]);f<c&&(c=f,d=e)}return d};l.SelectL.updatePosition=function(a){a.homog=v.csnames[a.args[0]].results.value[a.param];a.homog=w.withUsage(a.homog,"Line")};l._helper.moebiusStep=function(a,b,c){var d=m.add,e=m.sub,
+f=m.mult,h=a.value[0],k=a.value[1];a=a.value[2];var l=b.value[0],n=b.value[1];b=b.value[2];var p=c.value[0],r=c.value[1],t=c.value[2];c=e(f(b,p),f(l,t));var u=e(f(b,r),f(n,t)),p=e(f(h,t),f(a,p)),r=e(f(k,t),f(a,r));return[e(f(h,c),f(k,u)),d(f(k,c),f(h,u)),f(a,c),f(a,u),e(f(l,p),f(n,r)),d(f(n,p),f(l,r)),f(b,p),f(b,r)]};l.TrMoebius={};l.TrMoebius.kind="Mt";l.TrMoebius.signature="PPPPPP".split("");l.TrMoebius.updatePosition=function(a){var b=m.neg,c=l._helper.moebiusStep(v.csnames[a.args[0]].homog,v.csnames[a.args[2]].homog,
+v.csnames[a.args[4]].homog),d=l._helper.moebiusStep(v.csnames[a.args[1]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[5]].homog),d=h.normalizeMax(h.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=h.normalizeMax(h.matrix([[c[6],b(c[4])],[c[7],b(c[5])],[b(c[2]),c[0]],[b(c[3]),c[1]]])),b=h.normalizeMax(h.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]};l._helper.moebiusPair(a)};l._helper.moebiusPair=function(a){var b=a.moebius,c=m.neg,d=b.anti?c:w.identity,b=h.normalizeMax(h.turnIntoCSList([h.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]]),h.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]};l._helper.inverseMoebius=function(a){var b=m.neg,c=a.anti?b:w.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)}};l.TrInverseMoebius={};l.TrInverseMoebius.kind="Mt";l.TrInverseMoebius.signature=["Mt"];l.TrInverseMoebius.updatePosition=function(a){a.moebius=l._helper.inverseMoebius(v.csnames[a.args[0]].moebius);l._helper.moebiusPair(a)};l.TrMoebiusP={};l.TrMoebiusP.kind="P";l.TrMoebiusP.signature=["Mt","P"];l.TrMoebiusP.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]].homog,d=h.productMV(b.mat1,
+c),b=h.productMV(b.mat2,c);a.homog=h.normalizeMax(h.cross(d,b));a.homog=w.withUsage(a.homog,"Point")};l._helper.TrMoebiusP=function(a,b){var c=h.productMV(b.mat1,a),d=h.productMV(b.mat2,a);return h.normalizeMax(h.cross(c,d))};l.TrMoebiusL={};l.TrMoebiusL.kind="C";l.TrMoebiusL.signature=["Mt","L"];l.TrMoebiusL.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]].homog,d=function(){var a=h.realVector([Math.random()-.5,Math.random()-.5,Math.random()-.5]);return h.normalizeMax(a)},
+e=h.cross(d(),c),f=h.cross(d(),c),c=h.cross(d(),c),e=l._helper.TrMoebiusP(e,b),f=l._helper.TrMoebiusP(f,b),b=l._helper.TrMoebiusP(c,b);a.matrix=h.normalizeMax(l._helper.ConicBy5(null,e,f,b,h.ii,h.jj));a.matrix=w.withUsage(a.matrix,"Circle")};l.TrMoebiusS={};l.TrMoebiusS.kind="C";l.TrMoebiusS.signature=["Mt","S"];l.TrMoebiusS.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]],d=c.startpos,c=c.endpos,e=h.add(d,c),d=l._helper.TrMoebiusP(d,b),e=l._helper.TrMoebiusP(e,b),b=l._helper.TrMoebiusP(c,
+b);a.startPoint=d;a.viaPoint=e;a.endPoint=b;a.isArc=!0;a.matrix=h.normalizeMax(l._helper.ConicBy5(null,d,e,b,h.ii,h.jj));a.matrix=w.withUsage(a.matrix,"Circle")};l.TrMoebiusC={};l.TrMoebiusC.kind="C";l.TrMoebiusC.signature=["Mt","C"];l.TrMoebiusC.signatureConstraints=function(a){return"Circle"===v.csnames[a.args[1]].matrix.usage};l.TrMoebiusC.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]].matrix,d=function(){var a=h.realVector([Math.random()-.5,Math.random()-.5,Math.random()-
+.5]);return h.normalizeMax(a)},e=l._helper.IntersectLC(d(),c),d=l._helper.IntersectLC(d(),c),c=e[1],d=d[1],e=l._helper.TrMoebiusP(e[0],b),c=l._helper.TrMoebiusP(c,b),b=l._helper.TrMoebiusP(d,b);a.matrix=h.normalizeMax(l._helper.ConicBy5(null,e,c,b,h.ii,h.jj));a.matrix=w.withUsage(a.matrix,"Circle")};l.TrMoebiusArc={};l.TrMoebiusArc.kind="C";l.TrMoebiusArc.signature=["Mt","C"];l.TrMoebiusArc.signatureConstraints=function(a){return v.csnames[a.args[1]].isArc};l.TrMoebiusArc.updatePosition=function(a){var b=
+v.csnames[a.args[0]],c=v.csnames[a.args[1]],d=c.viaPoint,e=c.endPoint,c=l._helper.TrMoebiusP(c.startPoint,b),d=l._helper.TrMoebiusP(d,b),b=l._helper.TrMoebiusP(e,b);a.startPoint=c;a.viaPoint=d;a.endPoint=b;a.isArc=!0;a.matrix=h.normalizeMax(l._helper.ConicBy5(null,c,d,b,h.ii,h.jj));a.matrix=w.withUsage(a.matrix,"Circle")};l._helper.trBuildMatrix=function(a,b){var c=b(0),d=b(1),e=h.productMM(d,h.adjoint3(c));a.matrix=h.normalizeMax(e);e=h.transpose(h.productMM(c,h.adjoint3(d)));a.dualMatrix=h.normalizeMax(e)};
+l.TrProjection={};l.TrProjection.kind="Tr";l.TrProjection.signature="PPPPPPPP".split("");l.TrProjection.initialize=function(a){a.isEuclidean=0};l.TrProjection.updatePosition=function(a){l._helper.trBuildMatrix(a,function(b){return D.basismap(v.csnames[a.args[0+b]].homog,v.csnames[a.args[2+b]].homog,v.csnames[a.args[4+b]].homog,v.csnames[a.args[6+b]].homog)})};l.TrAffine={};l.TrAffine.kind="Tr";l.TrAffine.signature="PPPPPP".split("");l.TrAffine.initialize=function(a){a.isEuclidean=0};l.TrAffine.updatePosition=
+function(a){var b=m.mult,c=h.scalmult,d=h.turnIntoCSList,e=h.transpose,f=h.normalizeMax,k=h.productMM,l=h.adjoint3,n=d([v.csnames[a.args[0]].homog,v.csnames[a.args[2]].homog,v.csnames[a.args[4]].homog]),p=d([v.csnames[a.args[1]].homog,v.csnames[a.args[3]].homog,v.csnames[a.args[5]].homog]),r=e(n),e=e(p),t=r.value[2].value,u=e.value[2].value,w=[b(t[0],u[2]),b(t[1],u[0]),b(t[2],u[1])],r=l(r).value;a.matrix=f(k(e,d([c(b(w[0],u[1]),r[0]),c(b(w[1],u[2]),r[1]),c(b(w[2],u[0]),r[2])])));r=n.value;a.dualMatrix=
+f(k(l(p),d([c(b(t[2],w[1]),r[0]),c(b(t[0],w[2]),r[1]),c(b(t[1],w[0]),r[2])])))};l.TrSimilarity={};l.TrSimilarity.kind="Tr";l.TrSimilarity.signature=["P","P","P","P"];l.TrSimilarity.initialize=function(a){a.isEuclidean=1};l.TrSimilarity.updatePosition=function(a){l._helper.trBuildMatrix(a,function(b){return D.basismap(v.csnames[a.args[0+b]].homog,v.csnames[a.args[2+b]].homog,h.ii,h.jj)})};l.TrTranslation={};l.TrTranslation.kind="Tr";l.TrTranslation.signature=["P","P"];l.TrTranslation.initialize=function(a){a.isEuclidean=
+1};l.TrTranslation.updatePosition=function(a){var b=v.csnames[a.args[0]].homog,c=v.csnames[a.args[1]].homog,d=h.cross(b,c).value,b=m.mult(b.value[2],c.value[2]),c=h.turnIntoCSList,e=m.neg,f=m.zero,d=c([c([b,f,d[1]]),c([f,b,e(d[0])]),c([f,f,b])]),d=h.normalizeMax(d);a.matrix=d;b=e(d.value[0].value[0]);d=c([c([b,f,f]),c([f,b,f]),c([d.value[0].value[2],d.value[1].value[2],b])]);a.dualMatrix=d};l.TrReflectionP={};l.TrReflectionP.kind="Tr";l.TrReflectionP.signature=["P"];l.TrReflectionP.initialize=function(a){a.isEuclidean=
+1};l.TrReflectionP.updatePosition=function(a){var b=v.csnames[a.args[0]].homog.value,c=m.realmult(-.5,b[2]),d=m.zero,b=h.turnIntoCSList([h.turnIntoCSList([c,d,b[0]]),h.turnIntoCSList([d,c,b[1]]),h.turnIntoCSList([d,d,m.neg(c)])]),b=h.normalizeMax(b);a.matrix=b;a.dualMatrix=h.transpose(b)};l.TrReflectionL={};l.TrReflectionL.kind="Tr";l.TrReflectionL.signature=["L"];l.TrReflectionL.initialize=function(a){a.isEuclidean=-1};l.TrReflectionL.updatePosition=function(a){var b=m.mult,c=m.realmult,d=m.zero,
+e=v.csnames[a.args[0]].homog.value,f=e[0],k=e[1],e=e[2],l=b(f,f),n=b(k,k),p=c(-.5,m.sub(l,n)),r=b(f,k),b=h.turnIntoCSList([h.turnIntoCSList([m.neg(p),r,b(f,e)]),h.turnIntoCSList([r,p,b(k,e)]),h.turnIntoCSList([d,d,c(-.5,m.add(l,n))])]),b=h.normalizeMax(b);a.matrix=b;a.dualMatrix=h.transpose(b)};l.TrReflectionS={};l.TrReflectionS.kind="Tr";l.TrReflectionS.signature=["S"];l.TrReflectionS.updatePosition=l.TrReflectionL.updatePosition;l.TrReflectionC={};l.TrReflectionC.kind="Mt";l.TrReflectionC.signature=
+["C"];l.TrReflectionC.signatureConstraints=function(a){return"Circle"===v.csnames[a.args[0]].matrix.usage};l.TrReflectionC.updatePosition=function(a){var b=v.csnames[a.args[0]].matrix,c=b.value[0].value[2],d=b.value[1].value[2],e=m.neg;a.moebius={anti:!0,ar:c,ai:d,br:b.value[2].value[2],bi:m.zero,cr:e(b.value[0].value[0]),ci:m.zero,dr:e(c),di:d};l._helper.moebiusPair(a)};l.TrInverse={};l.TrInverse.kind="Tr";l.TrInverse.signature=["Tr"];l.TrInverse.initialize=function(a){a.isEuclidean=v.csnames[a.args[0]].isEuclidean};
+l.TrInverse.updatePosition=function(a){var b=v.csnames[a.args[0]];a.dualMatrix=h.transpose(b.matrix);a.matrix=h.transpose(b.dualMatrix)};l.TransformC={};l.TransformC.kind="C";l.TransformC.signature=["Tr","C"];l.TransformC.updatePosition=function(a){var b=v.csnames[a.args[0]].dualMatrix,b=h.productMM(h.productMM(b,v.csnames[a.args[1]].matrix),h.transpose(b)),b=h.normalizeMax(b);a.matrix=w.withUsage(b,"Conic")};l.TransformArc={};l.TransformArc.kind="C";l.TransformArc.signature=["Tr","C"];l.TransformArc.signatureConstraints=
+function(a){return v.csnames[a.args[0]].isArc};l.TransformArc.updatePosition=function(a){var b=v.csnames[a.args[0]].matrix,c=v.csnames[a.args[1]],d=c.viaPoint,e=c.endPoint,c=h.normalizeMax(h.productMV(b,c.startPoint)),d=h.normalizeMax(h.productMV(b,d)),b=h.normalizeMax(h.productMV(b,e));a.startPoint=c;a.viaPoint=d;a.endPoint=b;a.isArc=!0;a.matrix=h.normalizeMax(l._helper.ConicBy5(null,c,d,b,h.ii,h.jj));a.matrix=w.withUsage(a.matrix,"Circle")};l.TransformP={};l.TransformP.kind="P";l.TransformP.signature=
+["Tr","P"];l.TransformP.updatePosition=function(a){a.homog=h.normalizeMax(h.productMV(v.csnames[a.args[0]].matrix,v.csnames[a.args[1]].homog));a.homog=w.withUsage(a.homog,"Point")};l.TransformL={};l.TransformL.kind="L";l.TransformL.signature=["Tr","L"];l.TransformL.updatePosition=function(a){a.homog=h.normalizeMax(h.productMV(v.csnames[a.args[0]].dualMatrix,v.csnames[a.args[1]].homog));a.homog=w.withUsage(a.homog,"Line")};l.TransformS={};l.TransformS.kind="S";l.TransformS.signature=["Tr","S"];l.TransformS.updatePosition=
+function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]];l.Segment.setSegmentPos(a,h.productMV(b.dualMatrix,c.homog),h.productMV(b.matrix,c.startpos),h.productMV(b.matrix,c.endpos))};l.TransformPolygon={};l.TransformPolygon.kind="Poly";l.TransformPolygon.signature=["Tr","Poly"];l.TransformPolygon.updatePosition=function(a){var b=v.csnames[a.args[0]].matrix;a.vertices=h.turnIntoCSList(v.csnames[a.args[1]].vertices.value.map(function(a){a=h.normalizeMax(h.productMV(b,a));return a=w.withUsage(a,
+"Point")}))};l.TrComposeTrTr={};l.TrComposeTrTr.kind="Tr";l.TrComposeTrTr.signature=["Tr","Tr"];l.TrComposeTrTr.initialize=function(a){a.isEuclidean=v.csnames[a.args[0]].isEuclidean*v.csnames[a.args[1]].isEuclidean};l.TrComposeTrTr.updatePosition=function(a){var b=v.csnames[a.args[0]],c=v.csnames[a.args[1]];a.matrix=h.normalizeMax(h.productMM(c.matrix,b.matrix));a.dualMatrix=h.normalizeMax(h.productMM(c.dualMatrix,b.dualMatrix))};l._helper.composeMtMt=function(a,b,c){function d(a,b,c,e){return k(p(a,
+b),p(c,e))}function e(a,b,c,g,f,h,l,m){return k(d(a,b,c,g),d(f,h,l,m))}function f(a,b,c,e,g,h,k,l){return n(d(a,b,c,e),d(g,h,k,l))}var k=m.add,n=m.sub,p=m.mult,r=c.anti?f:e,t=c.anti?e:f,r=h.normalizeMax(h.turnIntoCSList([t(b.ar,c.ar,b.cr,c.br,b.ai,c.ai,b.ci,c.bi),r(b.ar,c.ai,b.cr,c.bi,b.ai,c.ar,b.ci,c.br),t(b.br,c.ar,b.dr,c.br,b.bi,c.ai,b.di,c.bi),r(b.br,c.ai,b.dr,c.bi,b.bi,c.ar,b.di,c.br),t(b.ar,c.cr,b.cr,c.dr,b.ai,c.ci,b.ci,c.di),r(b.ar,c.ci,b.cr,c.di,b.ai,c.cr,b.ci,c.dr),t(b.br,c.cr,b.dr,c.dr,
+b.bi,c.ci,b.di,c.di),r(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:r[0],ai:r[1],br:r[2],bi:r[3],cr:r[4],ci:r[5],dr:r[6],di:r[7]};l._helper.moebiusPair(a)};l._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:m.zero,ci:m.zero,dr:b[2].value[2],di:m.zero}};l.TrComposeMtMt={};l.TrComposeMtMt.kind="Mt";l.TrComposeMtMt.signature=["Mt","Mt"];l.TrComposeMtMt.updatePosition=
+function(a){l._helper.composeMtMt(a,v.csnames[a.args[0]].moebius,v.csnames[a.args[1]].moebius)};l.TrComposeTrMt={};l.TrComposeTrMt.kind="Mt";l.TrComposeTrMt.signature=["Tr","Mt"];l.TrComposeTrMt.signatureConstraints=function(a){return!!v.csnames[a.args[0]].isEuclidean};l.TrComposeTrMt.updatePosition=function(a){l._helper.composeMtMt(a,l._helper.euc2moeb(v.csnames[a.args[0]]),v.csnames[a.args[1]].moebius)};l.TrComposeMtTr={};l.TrComposeMtTr.kind="Mt";l.TrComposeMtTr.signature=["Mt","Tr"];l.TrComposeMtTr.signatureConstraints=
+function(a){return!!v.csnames[a.args[1]].isEuclidean};l.TrComposeMtTr.updatePosition=function(a){l._helper.composeMtMt(a,v.csnames[a.args[0]].moebius,l._helper.euc2moeb(v.csnames[a.args[1]]))};l._helper.pointReflection=function(a,b){return h.normalizeMax(h.sub(h.scalmult(m.realmult(2,b.value[2]),a),h.scalmult(a.value[2],b)))};l._helper.conicOtherIntersection=function(a,b,c){var d=h.productMV(a,c);a=h.scalproduct(c,d);d=h.scalproduct(b,d);d=m.realmult(-2,d);b=h.scalmult(a,b);c=h.scalmult(d,c);c=h.add(b,
+c);return c=h.normalizeMax(c)};l.Dist={};l.Dist.kind="V";l.Dist.signature=["P","P"];l.Dist.updatePosition=function(a){var b=v.csnames[a.args[1]].homog;a.value=h.abs(h.sub(h.normalizeZ(v.csnames[a.args[0]].homog),h.normalizeZ(b)))};l.Angle={};l.Angle.kind="V";l.Angle.signature=["L","L","P"];l.Angle.initialize=function(a){void 0===a.angle&&(a.angle=.5*Math.PI);Za(m._helper.input(a.angle))};l.Angle.updatePosition=function(a){var b=v.csnames[a.args[1]].homog,c=v.csnames[a.args[2]].homog,d=h.cross(v.csnames[a.args[0]].homog,
+h.linfty),b=h.cross(b,h.linfty),c=h.crossratio3(d,b,h.ii,h.jj,c),c=m.mult(m.complex(0,.5),m.log(c)),d=(Bb().value.real-c.value.real)/Math.PI,b=Math.round(d);!lb&&.01<Math.abs(b-d)&&ec();c=m.complex(b*Math.PI+c.value.real,c.value.imag);Za(c);a.value=w.withUsage(c,"Angle")};l.Angle.stateSize=2;l.Text={};l.Text.kind="Text";l.Text.signature="**";l.Text.isMovable=!0;l.Text.updatePosition=Sa;l.Text.initialize=function(a){a.text=String(a.text);a.pos&&(a.homog=l._helper.initializePoint(a));a.dock&&(a.dock.offset=
+a.dock.offset&&2===a.dock.offset.length?h.realVector([+a.dock.offset[0],+a.dock.offset[1]]):h.realVector([0,0]))};l.Text.getParamForInput=function(a,b,c){return l.Free.getParamForInput(a,b,c)};l.Text.getParamFromState=function(a){return a.homog};l.Text.putParamToState=function(a,b){a.homog=b};l.Calculation={};l.Calculation.kind="Text";l.Calculation.signature="**";l.Calculation.isMovable=!0;l.Calculation.updatePosition=Sa;l.Calculation.initialize=function(a){l.Text.initialize(a);a.calculation=Ua(a.text)};
+l.Calculation.getText=function(a){return Z(z(a.calculation))};l.Calculation.getParamForInput=l.Text.getParamForInput;l.Calculation.getParamFromState=l.Text.getParamFromState;l.Calculation.putParamToState=l.Text.putParamToState;l.Equation={};l.Equation.kind="Text";l.Equation.isMovable=!0;l.Equation.signature="**";l.Equation.updatePosition=Sa;l.Equation.initialize=function(a){l.Text.initialize(a);a.calculation=Ua(a.text)};l.Equation.getText=function(a){return a.text+" = "+Z(z(a.calculation))};l.Equation.getParamForInput=
+l.Text.getParamForInput;l.Equation.getParamFromState=l.Text.getParamFromState;l.Equation.putParamToState=l.Text.putParamToState;l.Evaluate={};l.Evaluate.kind="Text";l.Evaluate.isMovable=!0;l.Evaluate.signature="**";l.Evaluate.updatePosition=Sa;l.Evaluate.initialize=function(a){l.Text.initialize(a);a.calculation=Ua(a.text)};l.Evaluate.getText=function(a){z(a.calculation);return a.text};l.Evaluate.getParamForInput=l.Text.getParamForInput;l.Evaluate.getParamFromState=l.Text.getParamFromState;l.Evaluate.putParamToState=
+l.Text.putParamToState;l.Plot={};l.Plot.kind="Text";l.Plot.isMovable=!0;l.Plot.signature="**";l.Plot.updatePosition=Sa;l.Plot.initialize=function(a){l.Text.initialize(a);a.calculation=Ua("plot(("+a.text+"))")};l.Plot.getText=function(a){z(a.calculation);return a.text};l.Plot.getParamForInput=l.Text.getParamForInput;l.Plot.getParamFromState=l.Text.getParamFromState;l.Plot.putParamToState=l.Text.putParamToState;l.Button={};l.Button.kind="Text";l.Button.signature="**";l.Button.isMovable=!0;l.Button.updatePosition=
+Sa;l.Button.initialize=function(a){var b=document.createElement("button");Gc(a,"click",b)};l.Button.getParamForInput=l.Text.getParamForInput;l.Button.getParamFromState=l.Text.getParamFromState;l.Button.putParamToState=l.Text.putParamToState;l.Button.set_fillcolor=function(a,b){h._helper.isNumberVecN(b,3)&&(a.fillcolor=b.value.map(function(a){return a.value.real}),a.html.style.backgroundColor=x.makeColor(a.fillcolor,a.fillalpha))};l.ToggleButton={};l.ToggleButton.kind="Text";l.ToggleButton.signature=
+"**";l.ToggleButton.isMovable=!0;l.ToggleButton.updatePosition=Sa;l.ToggleButton.initialize=function(a){var b;b=void 0;void 0===b&&(b="CindyJSid");b+=++Qa;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;Gc(a,"change",c,d)};l.ToggleButton.getParamForInput=l.Text.getParamForInput;l.ToggleButton.getParamFromState=l.Text.getParamFromState;l.ToggleButton.putParamToState=
+l.Text.putParamToState;l.ToggleButton.set_fillcolor=l.Button.set_fillcolor;l.EditableText={};l.EditableText.kind="Text";l.EditableText.isMovable=!0;l.EditableText.signature=[];l.EditableText.updatePosition=Sa;l.EditableText.initialize=function(a){var b=document.createElement("input");b.setAttribute("type","text");b.className="CindyJS-editabletext";Ia(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});Gc(a,"change",b)};l.EditableText.getText=function(a){return!1};l.EditableText.getParamForInput=l.Text.getParamForInput;l.EditableText.getParamFromState=l.Text.getParamFromState;l.EditableText.putParamToState=l.Text.putParamToState;l.EditableText.set_fillcolor=l.Button.set_fillcolor;l.EditableText.get_currenttext=function(a){return w.string(String(a.html.value))};l.EditableText.get_text=function(a){return w.string(String(a.text))};
+l.EditableText.set_currenttext=function(a,b){a.html.value=a.text=Z(b)};l.EditableText.get_text=l.EditableText.get_text;l.EditableText.set_text=l.EditableText.set_currenttext;l.EditableText.get_val=l.EditableText.get_text;l.EditableText.set_val=l.EditableText.set_currenttext;l.EditableText.get_currenttext=l.EditableText.get_currenttext;l.EditableText.set_currenttext=l.EditableText.set_currenttext;l._helper.initializePoint=function(a){var b=0,c=0,d=0;if(a.pos){if("list"===a.pos.ctype&&h.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=h.turnIntoCSList([m._helper.input(b),m._helper.input(c),m._helper.input(d)]);return a=h.normalizeMax(a)};l._helper.initializeLine=function(a){var b=0,c=0,d=0;if(a.pos){if("list"===a.pos.ctype&&h.isNumberVector(a.pos))return a.pos;3===a.pos.length&&(b=a.pos[0],c=a.pos[1],d=a.pos[2])}a=h.turnIntoCSList([m._helper.input(b),m._helper.input(c),m._helper.input(d)]);return a=h.normalizeMax(a)};l.Poly={};
+l.Poly.kind="Poly";l.Poly.signature="P*";l.Poly.updatePosition=function(a){a.vertices=h.turnIntoCSList(a.args.map(function(a){return v.csnames[a].homog}))};var U=null;l.IFS={};l.IFS.kind="IFS";l.IFS.signature="**";l.IFS.signatureConstraints=function(a){for(var b=0;b<a.args.length;++b){var c=v.csnames[a.args[b]].kind;if("Tr"!==c&&"Mt"!==c)return!1}return 0<a.args.length};l.IFS.initialize=function(a){if(U)U.dirty=!0;else if(a=va.getBaseDir(),!1!==a){U={dirty:!1,params:{generation:0}};var b=U.worker=
+new Worker(a+"ifs.js");b.onmessage=function(a){U.img&&"function"===typeof U.img.close&&U.img.close();if(!Yb){a=a.data;if(a.generation===U.params.generation){if(a.buffer){U.canvas||(U.canvas=document.createElement("canvas"),U.ctx=U.canvas.getContext("2d"));U.canvas.width=a.width;U.canvas.height=a.height;var d=new Uint8ClampedArray(a.buffer,a.imgPtr,a.width*a.height*4),d=new ImageData(d,a.width,a.height);U.ctx.putImageData(d,0,0);U.img=U.canvas}else U.img=a.img;e()}else U.img=null;a.buffer?b.postMessage({cmd:"next",
+buffer:a.buffer},[a.buffer]):b.postMessage({cmd:"next"})}};jb.push(b.terminate.bind(b))}};l.IFS.updatePosition=function(a){U.dirty=!0};l.IFS.updateParameters=function(){if(U.worker){var a={cmd:"init",generation:U.params.generation,width:4*ca,height:4*da};a.systems=v.ifs.map(function(a){var b=0,d,e=a.ifs||[],f=a.args.map(function(a,b){var c=e[b]||{};return{prob:c.prob||1,color:c.color||[0,0,0]}});for(d=0;d<f.length;++d)b+=f[d].prob;d=h.realMatrix([[1,0,0],[0,1,0],[0,0,4]]);var k=h.productMM(y.toMat(),
+d);for(d=0;d<a.args.length;++d){var n=v.csnames[a.args[d]],p=n.kind,r=f[d];r.kind=p;r.prob/=b;if("Tr"===p)n=h.normalizeMax(h.productMM(h.adjoint3(k),h.productMM(n.matrix,k))),h._helper.isAlmostReal(n)?r.mat=n.value.map(function(a){return a.value.map(function(a){return a.value.real})}):r.kind="cplx";else if("Mt"===p){var p=y.drawingstate.matrix,p={anti:0<p.det,ar:m.real(p.a),ai:m.real(p.c),br:m.real(p.tx),bi:m.real(-p.ty),cr:m.zero,ci:m.zero,dr:m.real(.25),di:m.zero},t={};l._helper.composeMtMt(t,n.moebius,
+p);p=l._helper.inverseMoebius(p);l._helper.composeMtMt(t,p,t.moebius);p=t.moebius;p=h.turnIntoCSList([p.ar,p.ai,p.br,p.bi,p.cr,p.ci,p.dr,p.di]);h._helper.isAlmostReal(p)?(p=p.value,r.moebius={ar:p[0].value.real,ai:p[1].value.real,br:p[2].value.real,bi:p[3].value.real,cr:p[4].value.real,ci:p[5].value.real,dr:p[6].value.real,di:p[7].value.real,sign:n.moebius.anti?-1:1}):r.kind="cplx"}}return{trafos:f}});w.deeplyEqual(a,U.params)||(++a.generation,U.img=null,U.params=a,U.mat=y.drawingstate.matrix,U.worker.postMessage(a))}};
+l.IFS.probSetter=function(a,b,c){"number"===c.ctype&&(b.ifs[a].prob=c.value.real,U.dirty=!0)};(function(){for(var a=0;10>a;++a)l.IFS["set_prob"+a]=l.IFS.probSetter.bind(null,a)})();l._helper.snapPointToLine=function(a,b){if(m._helper.isAlmostZero(a.value[2]))return a;var c=l._helper.projectPointToLine(a,b),c=h.normalizeZ(c),d=c.value[0].value.real,c=c.value[1].value.real,e=Math.round(d/za)*za,f=Math.round(c/za)*za,k=h.realVector([e,f,1]);.2>Math.abs(e-d)&&.2>Math.abs(f-c)&&m._helper.isAlmostZero(h.scalproduct(b,
+k))&&(a=l._helper.projectPointToLine(k,b));return a};var Ac={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"},zd={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=v.csnames[a.args[1]],
+b={Tr:"Transform",Mt:"TrMoebius"}[v.csnames[a.args[0]].kind]+(b.isArc?"Arc":b.kind);if(l.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");return[]},TrReflection:function(a){var b="TrReflection"+v.csnames[a.args[0]].kind;if(l.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 v.csnames[a].kind}).join("");if(l.hasOwnProperty(b))return a.type=b,[a];console.log(b+" not implemented yet");
+return[]}},te="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(" ");sa.saveState=function(){return{geometry:ue()}};var ya={},Qd,Rb,Rd,Sd;Qd=[[],[.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]];Rb=[0,.2,.3,.8,8/9,1,1];Rd=[35/384,0,500/1113,125/192,-2187/6784,11/84,0];Sd=[5179/57600,0,7571/16695,.6140625,-92097/339200,187/2100,.025];var Fa,ma=[],Hc=[],qc=!1;ya.tick=function(a){a/=Vb;for(var b=0;b<Vb;b++)ya.tick1(a),Ib+=a,z(R.simulationstep)};ya.tick1=function(a){for(var b=a,c=0;0<a&&c<.999*a||0>a&&c>.999*a;)b=ya.oneRKStep(b),c+=b,b=Math.min(2*b,a-c),b=Math.max(b,1E-16),ya.restorePosition(),ya.doCollisions(),ya.calculateForces(),
+ya.moveToFinalPos();return!0};ya.restorePosition=function(){Fa.forEach(function(a){O[a.type].restorePos(a,9)})};ya.doCollisions=function(){Fa.forEach(function(a){O[a.type].doCollisions(a)})};ya.calculateForces=function(){Fa.forEach(function(a){O[a.type].calculateForces(a)})};ya.moveToFinalPos=function(){Fa.forEach(function(a){O[a.type].move(a)})};ya.oneRKStep=function(a){for(var b=function(a){Fa.forEach(function(b){O[b.type].initRK(b,a);O[b.type].storePosition(b)})},c=function(a){Fa.forEach(function(b){O[b.type].setToTimestep(b,
+Rb[a])})},d=function(a){Fa.forEach(function(b){O[b.type].proceedMotion(b,Rb[a],a,Qd[a])})},e=function(){Fa.forEach(function(a){O[a.type].resetForces(a)})},f=function(a){Fa.forEach(function(b){O[b.type].calculateDelta(b,a)})},h=function(b){var c=0;Fa.forEach(function(a){O[a.type].proceedMotion(a,Rb[6],7,Rd);O[a.type].savePos(a,8);O[a.type].proceedMotion(a,Rb[6],7,Sd);O[a.type].savePos(a,9);c+=O[a.type].sqDist(a,8,9)});return c=Math.sqrt(c)/a},k=function(a){Fa.forEach(function(a){O[a.type].recallPosition(a)})},
+l=!1;!l;){b(a);for(var m=0;7>m;m++)c(m),d(m),e(),ya.calculateForces(),f(m);h(a)>O.env.errorbound&&a>O.env.lowestdeltat?(a/=O.env.slowdownfactor,k()):l=!0}return a};var O={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=O.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=D.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;ja&&aa.down&&a.el===ja.mover||La(a.el,h.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=d+(a.dy[b]-a.dy[c])*(a.dy[b]-a.dy[c]),d=d+(a.dz[b]-a.dz[c])*(a.dz[b]-a.dz[c]),d=d+(a.dvx[b]-a.dvx[c])*(a.dvx[b]-a.dvx[c]),d=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){var c=D.extractPoint(a.el.homog);a.x=c.x;a.y=c.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,e=0;e<ma.length;e++){var f=ma[e],h=f.behavior.x,k=f.behavior.y,l=f.behavior.z,m=Math.sqrt((b-h)*(b-h)+(c-k)*(c-k)+(d-l)*(d-l)),k=(c-k)*a.mass*f.behavior.mass/(m*m*m),l=(d-l)*a.mass*f.behavior.mass/(m*m*m);f.behavior.fx+=(b-h)*a.mass*f.behavior.mass/(m*m*
+m)*f.behavior.mass;f.behavior.fy+=k*f.behavior.mass;f.behavior.fz+=l*f.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=v.csnames[a.geo[1]];console.log(b);var c=D.extractPoint(b.homog);a=D.extractPoint(v.csnames[a.geo[2]].homog);b=b.behavior;O[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=v.csnames[a.geo[2]];if(!ja||!aa.down||b!==ja.mover){var c=v.csnames[a.geo[1]];a=D.extractPoint(c.homog);c=c.behavior;a=h.realVector([a.x+c.vx,a.y+c.vy,1]);La(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=v.csnames[a.namea];a.mb=v.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=
+D.extractPoint(a.ma.homog),c=D.extractPoint(a.mb.homog),d=(c.x-b.x)*a.strength;a=(c.y-b.y)*a.strength;for(b=0;b<ma.length;b++)c=ma[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=v.csnames[a.namea];a.mb=v.csnames[a.nameb];var c=D.extractPoint(a.ma.homog),d=D.extractPoint(a.mb.homog);a.l0=Math.sqrt((c.x-d.x)*(c.x-d.x)+(c.y-d.y)*(c.y-d.y));a.env=O.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){var b,c,d,e;!a.ma.behavior||ja&&aa.down&&a.ma===ja.mover?(c=D.extractPoint(a.ma.homog),b=c.x,d=c.y):(b=a.ma.behavior.x,d=a.ma.behavior.y);!a.mb.behavior||ja&&aa.down&&a.mb===ja.mover?(e=D.extractPoint(a.mb.homog),c=e.x,e=e.y):(c=a.mb.behavior.x,e=a.mb.behavior.y);var f=Math.sqrt((b-c)*(b-c)+(d-e)*(d-e)),h=a.l0;a.ldiff=f-
+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);var m,n;if(0===f||0!==k&&1!==k)if(a.ma.behavior&&a.mb.behavior&&0!==f){if(f*=f*f,2===k||3===k)m=(b-c)*l/f,n=(d-e)*l/f}else m=n=0;else m=-(b-c)*a.strength*(f-h)/f*a.env.springstrength,n=-(d-e)*a.strength*(f-h)/f*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,e,f){return c*f-e*d+e*b-a*f+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=v.csnames[a.namea];a.mb=v.csnames[a.nameb];var c=
+D.extractPoint(a.ma.homog),d=D.extractPoint(a.mb.homog);a.x1o=1.01*c.x-.01*d.x;a.y1o=1.01*c.y-.01*d.y;a.x2o=1.01*d.x-.01*c.x;a.y2o=1.01*d.y-.01*c.y;a.env=O.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){for(var b=D.extractPoint(a.ma.homog),c=D.extractPoint(a.mb.homog),d=b.x,b=b.y,e=c.x,c=c.y,f=a.x1o,h=a.y1o,k=a.x2o,l=a.y2o,n=Math.sqrt((d-e)*(d-e)+(b-c)*(b-c)),p=(d-e)/n,n=(b-c)/n,r=0;r<ma.length;r++){var t=ma[r],u=t.behavior.xo,v=t.behavior.yo,w=t.behavior.x,x=t.behavior.y,y=m.mult(m.complex(f,h),m.complex(e,c)),z=m.mult(m.complex(k,l),m.complex(d,b)),y=m.sub(y,z),z=m.mult(m.complex(u,v),m.complex(d,b)),y=m.add(y,z),
+z=m.mult(m.complex(u,v),m.complex(e,c)),y=m.sub(y,z),z=m.sub(m.complex(f,h),m.complex(k,l)),y=m.div(y,z);0>O.det(d,b,e,c,w,x)*O.det(d,b,e,c,y.value.real,y.value.imag)&&0>O.det(d,b,w,x,y.value.real,y.value.imag)*O.det(e,c,w,x,y.value.real,y.value.imag)&&(v=t.behavior.mvx+a.deltat*(-y.value.real+t.behavior.xo),w=t.behavior.mvy+a.deltat*(-y.value.imag+t.behavior.yo),u=p*v+n*w,v=n*v-p*w,t.behavior.x=y.value.real,t.behavior.y=y.value.imag,t.behavior.vx=p*u*(1-a.xdamp),t.behavior.vy=n*u*(1-a.xdamp),t.behavior.vx+=
+-n*v*(1-a.ydamp),t.behavior.vy+=p*v*(1-a.ydamp))}a.x1o=d;a.y1o=b;a.x2o=e;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&&(Vb=a.accuracy);"undefined"!==typeof a.deltat&&ha(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);O.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,d,e,f,h,k,l,m,n;if(a.newton)for(b=0;b<ma.length-1;b++)for(c=ma[b],d=c.behavior.x,e=c.behavior.y,f=b+1;f<ma.length;f++)h=ma[f],k=h.behavior.x,
+l=h.behavior.y,n=Math.sqrt((d-k)*(d-k)+(e-l)*(e-l)),k=(d-k)*c.behavior.mass*h.behavior.mass/(n*n*n),l=(e-l)*c.behavior.mass*h.behavior.mass/(n*n*n),c.behavior.fx-=k,c.behavior.fy-=l,h.behavior.fx+=k,h.behavior.fy+=l;if(a.charges)for(b=0;b<ma.length-1;b++)for(c=ma[b],d=c.behavior.x,e=c.behavior.y,f=b+1;f<ma.length;f++)h=ma[f],k=h.behavior.x,l=h.behavior.y,n=Math.sqrt((d-k)*(d-k)+(e-l)*(e-l)),k=(d-k)*c.behavior.charge*h.behavior.charge/(n*n*n),l=(e-l)*c.behavior.charge*h.behavior.charge/(n*n*n),c.behavior.fx+=
+k,c.behavior.fy+=l,h.behavior.fx-=k,h.behavior.fy-=l;if(a.balls)for(b=0;b<ma.length-1;b++)if(c=ma[b],0!==c.behavior.radius)for(d=c.behavior.x,e=c.behavior.y,f=b+1;f<ma.length;f++)h=ma[f],0!==h.behavior.radius&&(k=h.behavior.x,l=h.behavior.y,m=c.behavior.radius+h.behavior.radius,n=Math.sqrt((d-k)*(d-k)+(e-l)*(e-l)),0===a.ballInteractionBoosting?(k=(d-k)/(n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*n)*(n>m?0:(n-m)*(n-m))):1===a.ballInteractionBoosting?(k=(d-k)/(n*n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*
+n*n)*(n>m?0:(n-m)*(n-m))):(k=(d-k)/(n*n*n*n*n)*(n>m?0:(n-m)*(n-m)),l=(e-l)/(n*n*n*n*n)*(n>m?0:(n-m)*(n-m))),c.behavior.fx+=k,c.behavior.fy+=l,h.behavior.fx-=k,h.behavior.fy-=l);for(b=0;b<ma.length;b++)c=ma[b],c.behavior.fx+=0,c.behavior.fy+=-a.gravity*c.behavior.mass,c.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 sa};return F}(),createCindy=CindyJS;"undefined"!==typeof process&&"undefined"!==typeof module&&"undefined"!==typeof module.exports&&"undefined"===typeof window&&(module.exports=CindyJS);
//# sourceMappingURL=Cindy.js.map
+