This commit is contained in:
Rafael Tavares Juliani committed 2025-09-04 16:07:07 -03:00
commit f269aace6b
4722 files changed
+512564

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
/*
Copyright 2008-2020
Matthias Ehmann,
Michael Gerhaeuser,
Carsten Miller,
Bianca Valentin,
Alfred Wassermann,
Peter Wilfahrt
This file is part of JSXGraph.
JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
You can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version
OR
* MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
JSXGraph is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License and
the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
and <http://opensource.org/licenses/MIT/>.
*/
.jxgbox {
/* for IE 7 */
position: relative;
overflow: hidden;
background-color: #ffffff;
border-style: solid;
border-width: 1px;
border-color: #356AA0;
border-radius: 10px;
-webkit-border-radius: 10px;
-ms-touch-action: none;
/* touch-action: none; */ /* Set with JavaScript */
}
.jxgbox svg text {
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.JXGtext {
font-family: Courier, monospace;
/**
* The default font family is now set in
* JXG.Options.text.cssdefaultstyle = 'font-family: Arial, Helvetica, Geneva, sans-serif;'
*/
/*
font-family: Arial, Helvetica, Geneva, sans-serif;
*/
/* "background-color: transparent;" may produce artefacts in IE. Solution: setting a color explicitly. */
background-color: transparent;
padding: 0;
margin: 0;
}
.JXGinfobox {
border-style: none;
border-width: 1px;
border-color: black;
}
/*
CSS attributes will (permantely) overwrite attributes set in JSXGraph
*/
.JXGimage {
/* opacity: 1.0; */
}
.JXGimageHighlight {
/* opacity: 0.6; */
}
/*
CSS rules for the navigation bar
*/
.JXG_navigation {
position: absolute;
right: 5px;
bottom: 5px;
z-index: 100;
background-color: transparent;
padding: 2px;
font-size: 14px;
cursor: pointer;
}
.JXG_navigation:hover {
}
.JXG_navigation_button {
color: #666666;
}
.JXG_navigation_button:hover {
border-radius: 2px;
background-color: #c0c0c0;
background-color: rgba(184, 184, 184, 0.5);
}
/*
CSS rules for the wrapping div in fullscreen mode
*/
.JXG_wrap_private:-moz-full-screen {
background-color: #cccccc;
padding: 0px;
width: 100%;
height: 100%;
}
.JXG_wrap_private:-webkit-full-screen {
background-color: #cccccc;
padding: 0px;
width: 100%;
height: 100%;
}
.JXG_wrap_private:fullscreen {
background-color: #cccccc;
padding: 0px;
width: 100%;
height: 100%;
}
.JXG_wrap_private:-ms-fullscreen {
background-color: #cccccc;
padding: 0px;
width: 100%;
height: 100%;
}
+79
View File
@@ -0,0 +1,79 @@
/*
JSXGraph 1.1.0
Copyright 2008-2020
Matthias Ehmann,
Michael Gerhaeuser,
Carsten Miller,
Bianca Valentin,
Alfred Wassermann,
Peter Wilfahrt
This file is part of JSXGraph.
JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
You can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version
OR
* MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
JSXGraph is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License and
the MIT License along with JSXGraph. If not, see <https://www.gnu.org/licenses/>
and <https://opensource.org/licenses/MIT/>.
*/
/**
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: https://github.com/jrburke/almond for details
*/
/**
* UTF-8 Decoder by Bjoern Hoehrmann
*
* Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
!function(t,e){"function"==typeof define&&define.amd?define("jsxgraphcore",[],e):"object"==typeof module&&module.exports?module.exports=e():t.returnExports=e()}(this,function(){var requirejs,require,define;return function(t){function e(t,e){return v.call(t,e)}function i(t,e){var i,r,s,o,n,a,h,l,c,d,u,p,f=e&&e.split("/"),m=g.map,b=m&&m["*"]||{};if(t){for(t=t.split("/"),n=t.length-1,g.nodeIdCompat&&C.test(t[n])&&(t[n]=t[n].replace(C,"")),"."===t[0].charAt(0)&&f&&(p=f.slice(0,f.length-1),t=p.concat(t)),c=0;c<t.length;c++)if("."===(u=t[c]))t.splice(c,1),c-=1;else if(".."===u){if(0===c||1===c&&".."===t[2]||".."===t[c-1])continue;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||b)&&m){for(i=t.split("/"),c=i.length;c>0;c-=1){if(r=i.slice(0,c).join("/"),f)for(d=f.length;d>0;d-=1)if((s=m[f.slice(0,d).join("/")])&&(s=s[r])){o=s,a=c;break}if(o)break;!h&&b&&b[r]&&(h=b[r],l=c)}!o&&h&&(o=h,a=l),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function r(e,i){return function(){var r=y.call(arguments,0);return"string"!=typeof r[0]&&1===r.length&&r.push(null),d.apply(t,r.concat([e,i]))}}function s(t){return function(e){return i(e,t)}}function o(t){return function(e){f[t]=e}}function n(i){if(e(m,i)){var r=m[i];delete m[i],b[i]=!0,c.apply(t,r)}if(!e(f,i)&&!e(b,i))throw new Error("No "+i);return f[i]}function a(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function h(t){return t?a(t):[]}function l(t){return function(){return g&&g.config&&g.config[t]||{}}}var c,d,u,p,f={},m={},g={},b={},v=Object.prototype.hasOwnProperty,y=[].slice,C=/\.js$/;u=function(t,e){var r,o=a(t),h=o[0],l=e[1];return t=o[1],h&&(h=i(h,l),r=n(h)),h?t=r&&r.normalize?r.normalize(t,s(l)):i(t,l):(t=i(t,l),o=a(t),h=o[0],t=o[1],h&&(r=n(h))),{f:h?h+"!"+t:t,n:t,pr:h,p:r}},p={require:function(t){return r(t)},exports:function(t){var e=f[t];return void 0!==e?e:f[t]={}},module:function(t){return{id:t,uri:"",exports:f[t],config:l(t)}}},c=function(i,s,a,l){var c,d,g,v,y,C,_,P=[],E=typeof a;if(l=l||i,C=h(l),"undefined"===E||"function"===E){for(s=!s.length&&a.length?["require","exports","module"]:s,y=0;y<s.length;y+=1)if(v=u(s[y],C),"require"===(d=v.f))P[y]=p.require(i);else if("exports"===d)P[y]=p.exports(i),_=!0;else if("module"===d)c=P[y]=p.module(i);else if(e(f,d)||e(m,d)||e(b,d))P[y]=n(d);else{if(!v.p)throw new Error(i+" missing "+d);v.p.load(v.n,r(l,!0),o(d),{}),P[y]=f[d]}g=a?a.apply(f[i],P):void 0,i&&(c&&c.exports!==t&&c.exports!==f[i]?f[i]=c.exports:g===t&&_||(f[i]=g))}else i&&(f[i]=a)},requirejs=require=d=function(e,i,r,s,o){if("string"==typeof e)return p[e]?p[e](i):n(u(e,h(i)).f);if(!e.splice){if(g=e,g.deps&&d(g.deps,g.callback),!i)return;i.splice?(e=i,i=r,r=null):e=t}return i=i||function(){},"function"==typeof r&&(r=s,s=o),s?c(t,e,i,r):setTimeout(function(){c(t,e,i,r)},4),d},d.config=function(t){return d(t)},requirejs._defined=f,define=function(t,i,r){if("string"!=typeof t)throw new Error("See almond README: incorrect module build, no module name");i.splice||(r=i,i=[]),e(f,t)||e(m,t)||(m[t]=[t,i,r])},define.amd={jQuery:!0}}(),define("../node_modules/almond/almond",function(){}),define("jxg",[],function(){"use strict";var t={};return"object"!=typeof JXG||JXG.extend||(t=JXG),t.extend=function(t,e,i,r){var s,o;i=i||!1,r=r||!1;for(s in e)(!i||i&&e.hasOwnProperty(s))&&(o=r?s.toLowerCase():s,t[o]=e[s])},t.extend(t,{boards:{},readers:{},elements:{},registerElement:function(t,e){t=t.toLowerCase(),this.elements[t]=e},registerReader:function(t,e){var i,r;for(i=0;i<e.length;i++)r=e[i].toLowerCase(),"function"!=typeof this.readers[r]&&(this.readers[r]=t)},shortcut:function(t,e){return function(){return t[e].apply(this,arguments)}},getRef:function(e,i){return t.deprecated("JXG.getRef()","Board.select()"),e.select(i)},getReference:function(e,i){return t.deprecated("JXG.getReference()","Board.select()"),e.select(i)},getBoardByContainerId:function(t){var e;for(e in JXG.boards)if(JXG.boards.hasOwnProperty(e)&&JXG.boards[e].container===t)return JXG.boards[e];return null},deprecated:function(e,i){var r=e+" is deprecated.";i&&(r+=" Please use "+i+" instead."),t.warn(r)},warn:function(t){"object"==typeof window&&window.console&&console.warn?console.warn("WARNING:",t):"object"==typeof document&&document.getElementById("warning")&&(document.getElementById("debug").innerHTML+="WARNING: "+t+"<br />")},debugInt:function(t){var e,i;for(e=0;e<arguments.length;e++)i=arguments[e],"object"==typeof window&&window.console&&console.log?console.log(i):"object"==typeof document&&document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=i+"<br/>")},debugWST:function(e){var i=new Error;t.debugInt.apply(this,arguments),i&&i.stack&&(t.debugInt("stacktrace"),t.debugInt(i.stack.split("\n").slice(1).join("\n")))},debugLine:function(e){var i=new Error;t.debugInt.apply(this,arguments),i&&i.stack&&t.debugInt("Called from",i.stack.split("\n").slice(2,3).join("\n"))},debug:function(e){t.debugInt.apply(this,arguments)}}),t}),define("base/conLine truncated
this.scrCoords[1]=r[0]*s[1]+r[1]*i.unitX,this.scrCoords[2]=r[0]*s[2]-r[2]*i.unitY)},screen2usr:function(){var t=this.board.origin.scrCoords,e=this.scrCoords,i=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(e[1]-t[1])/i.unitX,this.usrCoords[2]=(t[2]-e[2])/i.unitY},distance:function(t,i){var r,o,n=0,a=this.usrCoords,h=this.scrCoords;if(t===e.COORDS_BY_USER){if(r=i.usrCoords,o=a[0]-r[0],(n=o*o)>s.eps*s.eps)return Number.POSITIVE_INFINITY;o=a[1]-r[1],n+=o*o,o=a[2]-r[2],n+=o*o}else r=i.scrCoords,o=h[1]-r[1],n+=o*o,o=h[2]-r[2],n+=o*o;return Math.sqrt(n)},setCoordinates:function(t,i,r,s){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===e.COORDS_BY_USER?(2===i.length?(o[0]=1,o[1]=i[0],o[2]=i[1]):(o[0]=i[0],o[1]=i[1],o[2]=i[2],this.normalizeUsrCoords()),this.usr2screen(r)):(2===i.length?(n[1]=i[0],n[2]=i[1]):(n[1]=i[1],n[2]=i[2]),this.screen2usr()),!this.emitter||s||h[1]===n[1]&&h[2]===n[2]||this.triggerEventHandlers(["update"],[a,h]),this},copy:function(t,e){return void 0===e&&(e=0),this[t].slice(e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>s.eps},__evt__update:function(t,e){},__evt:function(){}}),t.Coords}),define("utils/expect",["jxg","utils/type","base/constants","base/coords"],function(t,e,i,r){"use strict";var s={each:function(t,i,r){var s,o,n=[];if(e.exists(t.length))for(o=t.length,s=0;s<o;s++)n.push(i.call(this,t[s],r));return n},coords:function(t,e){var s=t;return t&&t.elementClass===i.OBJECT_CLASS_POINT?s=t.coords:t.usrCoords&&t.scrCoords&&t.usr2screen&&(s=t),e&&(s=new r(i.COORDS_BY_USER,s.usrCoords,s.board)),s},coordsArray:function(t,i){var r;return r=e.isArray(t)?t:this.coords(t).usrCoords,r.length<3&&r.unshift(1),i&&(r=[r[0],r[1],r[2]]),r}};return t.Expect=s,s}),define("math/qdt",["math/math","utils/type"],function(t,e){"use strict";var i=function(t){this.capacity=10,this.points=[],this.xlb=t[0],this.xub=t[2],this.ylb=t[3],this.yub=t[1],this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null};return e.extend(i.prototype,{contains:function(t,e){return this.xlb<t&&t<=this.xub&&this.ylb<e&&e<=this.yub},insert:function(t){return!!this.contains(t.usrCoords[1],t.usrCoords[2])&&(this.points.length<this.capacity?(this.points.push(t),!0):(null===this.northWest&&this.subdivide(),!!this.northWest.insert(t)||(!!this.northEast.insert(t)||(!!this.southEast.insert(t)||!!this.southWest.insert(t)))))},subdivide:function(){var t,e=this.points.length,r=this.xlb+(this.xub-this.xlb)/2,s=this.ylb+(this.yub-this.ylb)/2;for(this.northWest=new i([this.xlb,this.yub,r,s]),this.northEast=new i([r,this.yub,this.xub,s]),this.southEast=new i([this.xlb,s,r,this.ylb]),this.southWest=new i([r,s,this.xub,this.ylb]),t=0;t<e;t+=1)this.northWest.insert(this.points[t]),this.northEast.insert(this.points[t]),this.southEast.insert(this.points[t]),this.southWest.insert(this.points[t])},_query:function(t,e){var i;if(this.contains(t,e)){if(null===this.northWest)return this;if(i=this.northWest._query(t,e))return i;if(i=this.northEast._query(t,e))return i;if(i=this.southEast._query(t,e))return i;if(i=this.southWest._query(t,e))return i}return!1},query:function(t,i){var r,s;return e.exists(i)?(r=t,s=i):(r=t.usrCoords[1],s=t.usrCoords[2]),this._query(r,s)}}),t.Quadtree=i,i}),define("math/numerics",["jxg","utils/type","math/math"],function(t,e,i){"use strict";var r={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};return i.Numerics={Gauss:function(t,r){var s,o,n,a,h,l=i.eps,c=t.length>0?t[0].length:0;if(c!==r.length||c!==t.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(a=[],h=r.slice(0,c),s=0;s<c;s++)a[s]=t[s].slice(0,c);for(o=0;o<c;o++){for(s=c-1;s>o;s--)if(Math.abs(a[s][o])>l)if(Math.abs(a[o][o])<l)e.swap(a,s,o),e.swap(h,s,o);else for(a[s][o]/=a[o][o],h[s]-=a[s][o]*h[o],n=o+1;n<c;n++)a[s][n]-=a[s][o]*a[o][n];if(Math.abs(a[o][o])<l)throw new Error("JXG.Math.Numerics.Gauss(): The given matrix seems to be singular.")}return this.backwardSolve(a,h,!0),h},backwardSolve:function(t,e,i){var r,s,o,n,a;for(r=i?e:e.slice(0,e.length),s=t.length,o=t.length>0?t[0].length:0,n=s-1;n>=0;n--){for(a=o-1;a>n;a--)r[n]-=t[n][a]*r[a];r[n]/=t[n][n]}return r},gaussBareiss:function(t){var e,r,s,o,n,a,h,l,c,d=i.eps;if((h=t.length)<=0)return 0;for(t[0].length<h&&(h=t[0].length),l=[],o=0;o<h;o++)l[o]=t[o].slice(0,h);for(r=1,s=1,e=0;e<h-1;e++){if(a=l[e][e],Math.abs(a)<d){for(o=e+1;o<h&&!(Math.abs(l[o][e])>=d);o++);if(o===h)return 0;for(n=e;n<h;n++)c=l[o][n],l[o][n]=l[e][n],l[e][n]=c;s=-s,a=l[e][e]}for(o=e+1;o<h;o++)for(n=e+1;n<h;n++)c=a*l[o][n]-l[o][e]*l[e][n],l[o][n]=c/r;r=a}return s*l[h-1][h-1]},det:function(t){return 2===t.length&&2===t[0].length?t[0][0]*t[1][1]-t[1][0]*t[0][1]:this.gaussBareiss(t)},Jacobi:function(t){var e,r,s,o,n,a,h,l,c,d=i.Line truncated
var s,o,n,a,h=[],l=[],c=[];return t.deprecated("Geometry.angle()","Geometry.rad()"),e.coords?(h[0]=e.coords.usrCoords[1],h[1]=e.coords.usrCoords[2]):(h[0]=e[0],h[1]=e[1]),i.coords?(l[0]=i.coords.usrCoords[1],l[1]=i.coords.usrCoords[2]):(l[0]=i[0],l[1]=i[1]),r.coords?(c[0]=r.coords.usrCoords[1],c[1]=r.coords.usrCoords[2]):(c[0]=r[0],c[1]=r[1]),s=h[0]-l[0],o=h[1]-l[1],n=c[0]-l[0],a=c[1]-l[1],Math.atan2(s*a-o*n,s*n+o*a)},trueAngle:function(t,e,i){return 57.29577951308232*this.rad(t,e,i)},rad:function(t,e,i){var r,s,o,n,a,h,l;return t.coords?(r=t.coords.usrCoords[1],s=t.coords.usrCoords[2]):(r=t[0],s=t[1]),e.coords?(o=e.coords.usrCoords[1],n=e.coords.usrCoords[2]):(o=e[0],n=e[1]),i.coords?(a=i.coords.usrCoords[1],h=i.coords.usrCoords[2]):(a=i[0],h=i[1]),l=Math.atan2(h-n,a-o)-Math.atan2(s-n,r-o),l<0&&(l+=6.283185307179586),l},angleBisector:function(t,r,s,n){var a,h,l,c,d,u=t.coords.usrCoords,p=r.coords.usrCoords,f=s.coords.usrCoords;return o.exists(n)||(n=t.board),0===p[0]?new i(e.COORDS_BY_USER,[1,.5*(u[1]+f[1]),.5*(u[2]+f[2])],n):(c=u[1]-p[1],d=u[2]-p[2],a=Math.atan2(d,c),c=f[1]-p[1],d=f[2]-p[2],h=Math.atan2(d,c),l=.5*(a+h),a>h&&(l+=Math.PI),c=Math.cos(l)+p[1],d=Math.sin(l)+p[2],new i(e.COORDS_BY_USER,[1,c,d],n))},reflection:function(t,r,s){var n,a,h,l,c,d,u,p=r.coords.usrCoords,f=t.point1.coords.usrCoords,m=t.point2.coords.usrCoords;return o.exists(s)||(s=r.board),c=m[1]-f[1],d=m[2]-f[2],n=p[1]-f[1],a=p[2]-f[2],u=(c*a-d*n)/(c*c+d*d),h=p[1]+2*u*d,l=p[2]-2*u*c,new i(e.COORDS_BY_USER,[h,l],s)},rotation:function(t,r,s,n){var a,h,l,c,d,u,p=r.coords.usrCoords,f=t.coords.usrCoords;return o.exists(n)||(n=r.board),a=p[1]-f[1],h=p[2]-f[2],l=Math.cos(s),c=Math.sin(s),d=a*l-h*c+f[1],u=a*c+h*l+f[2],new i(e.COORDS_BY_USER,[d,u],n)},perpendicular:function(t,s,n){var a,h,l,c,d,u=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=s.coords.usrCoords;return o.exists(n)||(n=s.board),s===t.point1?(a=u[1]+p[2]-u[2],h=u[2]-p[1]+u[1],d=u[0]*p[0],Math.abs(d)<r.eps&&(a=p[2],h=-p[1]),c=[d,a,h],l=!0):s===t.point2?(a=p[1]+u[2]-p[2],h=p[2]-u[1]+p[1],d=u[0]*p[0],Math.abs(d)<r.eps&&(a=u[2],h=-u[1]),c=[d,a,h],l=!1):Math.abs(r.innerProduct(f,t.stdform,3))<r.eps?(a=f[1]+p[2]-f[2],h=f[2]-p[1]+f[1],d=p[0],Math.abs(d)<r.eps&&(a=p[2],h=-p[1]),l=!0,Math.abs(d)>r.eps&&Math.abs(a-f[1])<r.eps&&Math.abs(h-f[2])<r.eps&&(a=f[1]+u[2]-f[2],h=f[2]-u[1]+f[1],l=!1),c=[d,a,h]):(c=[0,t.stdform[1],t.stdform[2]],c=r.crossProduct(c,f),c=r.crossProduct(c,t.stdform),l=!0),[new i(e.COORDS_BY_USER,c,n),l]},circumcenterMidpoint:function(){t.deprecated("Geometry.circumcenterMidpoint()","Geometry.circumcenter()"),this.circumcenter.apply(this,arguments)},circumcenter:function(t,s,n,a){var h,l,c,d,u=t.coords.usrCoords,p=s.coords.usrCoords,f=n.coords.usrCoords;return o.exists(a)||(a=t.board),h=[p[0]-u[0],-p[2]+u[2],p[1]-u[1]],l=[.5*(u[0]+p[0]),.5*(u[1]+p[1]),.5*(u[2]+p[2])],c=r.crossProduct(h,l),h=[f[0]-p[0],-f[2]+p[2],f[1]-p[1]],l=[.5*(p[0]+f[0]),.5*(p[1]+f[1]),.5*(p[2]+f[2])],d=r.crossProduct(h,l),new i(e.COORDS_BY_USER,r.crossProduct(c,d),a)},distance:function(t,e,i){var r,s=0;for(i||(i=Math.min(t.length,e.length)),r=0;r<i;r++)s+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(s)},affineDistance:function(t,e,i){var s;return s=this.distance(t,e,i),s>r.eps&&(Math.abs(t[0])<r.eps||Math.abs(e[0])<r.eps)?1/0:s},sortVertices:function(t){for(var e,i=n.each(t,n.coordsArray),r=i.length,s=null;i[0][0]==i[r-1][0]&&i[0][1]==i[r-1][1]&&i[0][2]==i[r-1][2];)s=i.pop(),r--;return e=i[0],i.sort(function(t,i){return Math.atan2(t[2]-e[2],t[1]-e[1])-Math.atan2(i[2]-e[2],i[1]-e[1])}),null!==s&&i.push(s),i},signedTriangle:function(t,e,i){var r=n.coordsArray(t),s=n.coordsArray(e),o=n.coordsArray(i);return.5*((s[1]-r[1])*(o[2]-r[2])-(s[2]-r[2])*(o[1]-r[1]))},signedPolygon:function(t,e){var i,r,s=0,o=n.each(t,n.coordsArray);for(void 0===e&&(e=!0),e?o.unshift(o[o.length-1]):o=this.sortVertices(o),r=o.length,i=1;i<r;i++)s+=o[i-1][1]*o[i][2]-o[i][1]*o[i-1][2];return.5*s},GrahamScan:function(t){var e,i=1,r=n.each(t,n.coordsArray),s=r.length;for(r=this.sortVertices(r),s=r.length,e=2;e<s;e++){for(;this.signedTriangle(r[i-1],r[i],r[e])<=0;)if(i>1)i-=1;else{if(e===s-1)break;e+=1}i+=1,r=o.swap(r,i,e)}return r.slice(0,i)},calcStraight:function(t,i,s,n){var a,h,l,c,d,u,p,f,m,g;if(o.exists(n)||(n=10),u=o.evaluate(t.visProp.straightfirst),p=o.evaluate(t.visProp.straightlast),Math.abs(i.scrCoords[0])<r.eps&&(u=!0),Math.abs(s.scrCoords[0])<r.eps&&(p=!0),(u||p)&&(f=[],f[0]=t.stdform[0]-t.stdform[1]*t.board.origin.scrCoords[1]/t.board.unitX+t.stdform[2]*t.board.origin.scrCoords[2]/t.board.unitY,f[1]=t.stdform[1]/t.board.unitX,f[2]=-t.stdform[2]/t.board.unitY,!isNaN(f[0]+f[1]+f[2]))){if(a=!1,h=!1,a=!u&&Math.abs(i.usrCoords[0])>=r.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,h=!p&&Math.abs(s.usrCoords[0])>=r.eps&&s.scrCoords[1]>=0&&s.scrCoords[1]<=t.board.canvasWidth&&s.scrCoords[2]>=0&&s.scrCoords[2]<=t.board.canvasHeight,l=this.meetLineBoard(fLine truncated
;for(f in n)n.hasOwnProperty(f)&&(d+="&"+escape(f)+"="+escape(n[f]));p=r.toJSON(n);do{u=s+Math.floor(4096*Math.random())}while(r.exists(this.runningCalls[u]));return this.runningCalls[u]={action:s},r.exists(n.module)&&(this.runningCalls[u].module=n.module),h=t.serverBase+"JXGServer.py",l="action="+escape(s)+"&id="+u+"&dataJSON="+escape(i.encode(p)),this.cbp=function(t){var s,n,a,h,l,c,d,u;if(s=new e.Unzip(i.decodeAsArray(t)).unzip(),r.isArray(s)&&s.length>0&&(s=s[0][0]),r.exists(s))if(n=window.JSON&&window.JSON.parse?window.JSON.parse(s):new Function("return "+s)(),"error"===n.type)this.handleError(n);else if("response"===n.type){for(c=n.id,d=0;d<n.fields.length;d++)a=n.fields[d],h=a.namespace+("object"==typeof new Function("return "+a.namespace)()?".":".prototype.")+a.name+" = "+a.value,new Function(h)();for(d=0;d<n.handler.length;d++){for(a=n.handler[d],l=[],u=0;u<a.parameters.length;u++)l[u]='"'+a.parameters[u]+'": '+a.parameters[u];h="if(typeof JXG.Server.modules."+this.runningCalls[c].module+' == "undefined")JXG.Server.modules.'+this.runningCalls[c].module+" = {};",h+="JXG.Server.modules."+this.runningCalls[c].module+"."+a.name+"_cb = "+a.callback+";",h+="JXG.Server.modules."+this.runningCalls[c].module+"."+a.name+" = function ("+a.parameters.join(",")+', __JXGSERVER_CB__, __JXGSERVER_SYNC) {if(typeof __JXGSERVER_CB__ == "undefined") __JXGSERVER_CB__ = JXG.Server.modules.'+this.runningCalls[c].module+"."+a.name+"_cb;var __JXGSERVER_PAR__ = {"+l.join(",")+', "module": "'+this.runningCalls[c].module+'", "handler": "'+a.name+'" };JXG.Server.callServer("exec", __JXGSERVER_CB__, __JXGSERVER_PAR__, __JXGSERVER_SYNC);};',new Function(h)()}delete this.runningCalls[c],o(n.data)}},this.cb=t.bind(this.cbp,this),window.XMLHttpRequest?(c=new XMLHttpRequest,c.overrideMimeType("text/plain; charset=iso-8859-1")):c=new ActiveXObject("Microsoft.XMLHTTP"),!(!c||(c.open("POST",h,!a),c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a||(c.onreadystatechange=function(t){return function(){return 4===c.readyState&&200===c.status&&(t(c.responseText),!0)}}(this.cb)),c.send(l),!a))&&(this.cb(c.responseText),!0)},loadModule_cb:function(e){var i;for(i=0;i<e.length;i++)t.debug(e[i].name+": "+e[i].value)},loadModule:function(e){return t.Server.callServer("load",t.Server.loadModule_cb,{module:e},!0)}},t.Server.load=t.Server.loadModule,t.Server}),define("math/symbolic",["base/constants","base/coords","math/math","math/geometry","server/server","utils/type"],function(t,e,i,r,s,o){"use strict";return i.Symbolic={generateSymbolicCoordinatesPartial:function(t,e,i,r){var s,n,a,h=e.ancestors,l=0,c=function(t){return"underscore"===r?i+"_{"+t+"}":"brace"===r?i+"["+t+"]":i+t};t.listOfFreePoints=[],t.listOfDependantPoints=[];for(n in h)if(h.hasOwnProperty(n)&&(s=0,o.isPoint(h[n]))){for(a in h[n].ancestors)h[n].ancestors.hasOwnProperty(a)&&s++;0===s?(h[n].symbolic.x=h[n].coords.usrCoords[1],h[n].symbolic.y=h[n].coords.usrCoords[2],t.listOfFreePoints.push(h[n])):(l+=1,h[n].symbolic.x=c(l),l+=1,h[n].symbolic.y=c(l),t.listOfDependantPoints.push(h[n]))}return o.isPoint(e)&&(e.symbolic.x="x",e.symbolic.y="y"),l},clearSymbolicCoordinates:function(t){var e=function(t){var e,i=t&&t.length||0;for(e=0;e<i;e++)o.isPoint(t[e])&&(t[e].symbolic.x="",t[e].symbolic.y="")};e(t.listOfFreePoints),e(t.listOfDependantPoints),delete t.listOfFreePoints,delete t.listOfDependantPoints},generatePolynomials:function(t,e,i){var r,s,n,a,h=e.ancestors,l=[],c=[];i&&this.generateSymbolicCoordinatesPartial(t,e,"u","brace"),h[e.id]=e;for(r in h)if(h.hasOwnProperty(r)&&(a=0,l=[],o.isPoint(h[r]))){for(s in h[r].ancestors)h[r].ancestors.hasOwnProperty(s)&&a++;if(a>0)for(l=h[r].generatePolynomial(),n=0;n<l.length;n++)c.push(l[n])}return i&&this.clearSymbolicCoordinates(t),c},geometricLocusByGroebnerBase:function(n,a){var h,l,c,d,u,p,f,m,g,b,v,y,C,_=n.options.locus,P={},E=this.generateSymbolicCoordinatesPartial(n,a,"u","brace"),S=new e(t.COORDS_BY_USR,[0,0],n),x=new e(t.COORDS_BY_USR,[n.canvasWidth,n.canvasHeight],n),O=1,w=0,T=0,N=0;if(void 0===s.modules.geoloci&&s.loadModule("geoloci"),void 0===s.modules.geoloci)throw new Error("JSXGraph: Unable to load JXG.Server module 'geoloci.py'.");if(f=S.usrCoords[1],m=x.usrCoords[1],g=x.usrCoords[2],b=S.usrCoords[2],_.translateToOrigin&&n.listOfFreePoints.length>0){for(d=void 0!==_.toOrigin&&null!==_.toOrigin&&o.isInArray(n.listOfFreePoints,_.toOrigin.id)?_.toOrigin:n.listOfFreePoints[0],w=d.symbolic.x,T=d.symbolic.y,p=0;p<n.listOfFreePoints.length;p++)n.listOfFreePoints[p].symbolic.x-=w,n.listOfFreePoints[p].symbolic.y-=T;if(f-=w,m-=w,g-=T,b-=T,_.translateTo10&&n.listOfFreePoints.length>1){for(u=void 0!==_.to10&&null!==_.to10&&_.to10.id!==_.toOrigin.id&&o.isInArray(n.listOfFreePoints,_.to10.id)?_.to10:n.listOfFreePoints[0].id===d.id?n.listOfFreePoints[1]:n.listOfFreePoints[0],N=r.rad([1,0],[0,0],[u.symbolic.x,u.symbolic.y]),v=Math.cos(-N),y=Math.sin(-N),p=0;p<n.listOfFreePoints.length;p++)C=n.listOfFreePoints[p].symboliLine truncated
fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:"red",fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",strokeColor:"black",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"black",fixed:!0,position:"urt",offset:[10,10],autoPosition:!1},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],rowHeight:20,strokeWidth:5},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#888888",withTicks:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,defaultDistance:1,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1,lineCap:"butt"},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",fillColor:"#ff0000",highlightFillColor:"#EEEEEE",strokeWidth:2,strokeColor:"#ff0000",highlightStrokeColor:"#C3D9FF",zoom:!1,showInfobox:!0,infoboxDigits:"auto",draft:!1,attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},vertices:{layer:9,withLabel:!1,name:"",strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},regularpolygon:{hasInnerPoints:!1,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:"#ffff00"},sector:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,selection:"auto",arc:{visible:!1,fillColor:"none"},radiuspoint:{visible:!1,withLabel:!1},center:{visible:!1,withLabel:!1},anglePoint:{visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,name:""}},slider:{snapWidth:-1,precision:2,firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},baseline:{needsRegularUpdate:!1,fixed:!0,scalable:!1,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,drawLabels:!1,precision:2,includeBoundaries:1,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,minorHeight:4,majorHeight:5,minorTicks:0,defaultDistance:1,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,fixed:!0,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{strokeColor:"#000000"},moveOnUp:!0},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},curve:{strokeWidth:1,strokeColor:"#000000",fillColor:"none"}},slopetriangle:{fillColor:"red",fillOpacity:.4,highlightFillColor:"red",highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:Line truncated
i=l.length-2;i>=0&&e>0;)r=l.charAt(i),")"===r?e++:"("===r&&(e-=1),i-=1;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.substr(h,1).match(/([\w\.]+)/);)o=RegExp.$1+o,h-=1;o+=l.substring(i+1,l.length),o=o.replace(/([\(\)\+\*\%\^\-\/\]\[])/g,"\\$1")}else o="[\\w\\.]+";if(d.match(/^([\w\.]*\()/)){for(e=1,i=RegExp.$1.length;i<d.length&&e>0;)r=d.charAt(i),")"===r?e-=1:"("===r&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=d.substring(0,i),n=n.replace(/([\(\)\+\*\%\^\-\/\[\]])/g,"\\$1")}else n="[\\w\\.]+";u=new RegExp("("+o+")\\^("+n+")"),t=t.replace(u,"pow($1,$2)"),c=t.indexOf("^")}return t},replaceIf:function(t){var e,i,r,s,o,n,a,h,l,c="",d=null,u=null,p=null;if((r=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");r>=0;){for(e=t.slice(0,r),i=t.slice(r+3),o=1,s=0,n=-1,a=-1;s<i.length&&o>0;)h=i.charAt(s),")"===h?o-=1:"("===h?o+=1:","===h&&1===o&&(n<0?n=s:a=s),s+=1;if(l=i.slice(0,s-1),i=i.slice(s),n<0)return"";if(a<0)return"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),d=this.replaceIf(d),u=this.replaceIf(u),p=this.replaceIf(p),c+=e+"(("+d+")?("+u+"):("+p+"))",t=i,d=null,u=null,r=t.indexOf("If(")}return c+=i},replaceNameById:function(t,e,i){var r,s,o,n,a=0,h=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t};for(n=0;n<h.length;n++)for(a=t.indexOf(h[n]+"(");a>=0;)a>=0&&(r=t.indexOf(")",a+2))>=0&&(s=t.slice(a+2,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+2)+(i?"$('":"")+l(o.id)+t.slice(r))),r=t.indexOf(")",a+2),a=t.indexOf(h[n]+"(",r);for(a=t.indexOf("Dist(");a>=0;)a>=0&&(r=t.indexOf(",",a+5))>=0&&(s=t.slice(a+5,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+5)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+5),a=t.indexOf(",",r),r=t.indexOf(")",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(")",a+1),a=t.indexOf("Dist(",r);for(h=["Deg","Rad"],n=0;n<h.length;n++)for(a=t.indexOf(h[n]+"(");a>=0;)a>=0&&(r=t.indexOf(",",a+4))>=0&&(s=t.slice(a+4,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+4)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+4),a=t.indexOf(",",r),r=t.indexOf(",",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(",",a+1),a=t.indexOf(",",r),r=t.indexOf(")",a+1),r>=0&&(s=t.slice(a+1,r),s=s.replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[s])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(r))),r=t.indexOf(")",a+1),a=t.indexOf(h[n]+"(",r);return t},replaceIdByObj:function(t){var e=/(X|Y|L)\(([\w_]+)\)/g;return t=t.replace(e,"$('$2').$1()"),e=/(V)\(([\w_]+)\)/g,t=t.replace(e,"$('$2').Value()"),e=/(Dist)\(([\w_]+),([\w_]+)\)/g,t=t.replace(e,"dist($('$2'), $('$3'))"),e=/(Deg)\(([\w_]+),([ \w\[\w_]+),([\w_]+)\)/g,t=t.replace(e,"deg($('$2'),$('$3'),$('$4'))"),e=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,t=t.replace(e,"rad($('$1'),$('$2'),$('$3'))"),e=/N\((.+)\)/g,t=t.replace(e,"($1)")},geonext2JS:function(t,e){var i,r,s,o=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],n=["abs","acos","asin","atan","ceil","cos","exp","factorial","floor","log","max","min","random","round","sin","sqrt","tan","ceil"];for(t=t.replace(/&lt;/g,"<"),t=t.replace(/&gt;/g,">"),t=t.replace(/&amp;/g,"&"),r=t,r=this.replaceNameById(r,e),r=this.replaceIf(r),r=this.replacePow(r),r=this.replaceIdByObj(r),s=0;s<o.length;s++)i=new RegExp(["(\\W|^)(",o[s],")"].join(""),"ig"),r=r.replace(i,["$1",n[s]].join(""));return r=r.replace(/True/g,"true"),r=r.replace(/False/g,"false"),r=r.replace(/fasle/g,"false"),r=r.replace(/Pi/g,"PI"),r=r.replace(/"/g,"'")},findDependencies:function(t,r,s){var o,n,a,h;i.exists(s)||(s=t.board),o=s.elementsByName;for(n in o)o.hasOwnProperty(n)&&n!==t.name&&(o[n].elementClass===e.OBJECT_CLASS_TEXT?i.evaluate(o[n].visProp.islabel)||(h=n.replace(/\[/g,"\\["),h=h.replace(/\]/g,"\\]"),a=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+h+")(,[\\w\\[\\]'_ ]+)*\\)","g"),r.search(a)>=0&&o[n].addChild(t)):(h=n.replace(/\[/g,"\\["),h=h.replace(/\]/g,"\\]"),a=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+h+")(,[\\w\\[\\]'_ ]+)*\\)","g"),r.search(a)>=0&&o[n].addChild(t)))},gxt2jc:function(t,e){var i;return t=t.replace(/&lt;/g,"<"),t=t.replace(/&gt;/g,">"),t=t.replace(/&amp;/g,"&"),i=t,i=this.replaceNameById(i,e,!0),i=i.replace(/True/g,"true"),i=i.replace(/False/g,"false"),i=i.replace(/fasle/g,"false")}},t.GeonextParser}),define("base/element",["jxg","base/constants","base/coords","math/math","math/statistics","options","parser/geonext","utils/event","utils/color","utils/type"],function(t,e,i,r,s,o,n,a,h,l){"use strict";return t.GeometryElement=function(t,i,r,s){var o,n,h;if(this.needsUpdate=!0,this.isDraggable=!1,this.isReal=!0,this.childElements={},this.hasLabel=!1,this.highlighted=!1,this.notExistingParents={},this.traces={},this.numTraces=0,this.transformatLine truncated
Math.abs(O)>i.eps&&(_/=O);else if(this.updateConstraint(),T.transformations.length>0){for(x=!1,E=T.getTransformationSource(),E[0]&&(x=E[0],N.push(T),N.push(E[1]));E[0]&&c.exists(E[1]._transformationSource);)E=E[1].getTransformationSource(),N.push(E[1]);if(S=this.coords.usrCoords,x){for(t=0;t<N.length;t++)N[t].updateTransformMatrix(),y=i.inverse(N[t].transformMat),S=i.matVecMult(y,S);for(b=new n(a.COORDS_BY_USER,S,this.board).usrCoords,v=r.projectCoordsToCurve(b[1],b[2],this.position||0,N[N.length-1],this.board),S=v[0].usrCoords,t=N.length-2;t>=0;t--)S=i.matVecMult(N[t].transformMat,S);v[0]=new n(a.COORDS_BY_USER,S,this.board)}else T.updateTransformMatrix(),y=i.inverse(T.transformMat),S=i.matVecMult(y,S),b=new n(a.COORDS_BY_USER,S,this.board).usrCoords,v=r.projectCoordsToCurve(b[1],b[2],this.position||0,T,this.board);C=v[0],_=v[1]}else C=r.projectPointToCurve(this,T,this.board),_=this.position;else c.isPoint(T)&&(C=r.projectPointToPoint(this,T,this.board),_=this.position);this.coords.setCoordinates(a.COORDS_BY_USER,C.usrCoords,w),this.position=_},updateGliderFromParent:function(){var t,e,s,o,h,l,d,u,p,f,m,g,b=this.slideObject,v=[],y=2*Math.PI;if(!this.needsUpdateFromParent)return void(this.needsUpdateFromParent=!0);if(b.elementClass===a.OBJECT_CLASS_CIRCLE)s=b.Radius(),c.evaluate(this.visProp.isgeonext)&&(y=1),h=[b.center.X()+s*Math.cos(this.position*y),b.center.Y()+s*Math.sin(this.position*y)];else if(b.elementClass===a.OBJECT_CLASS_LINE)t=b.point1.coords.usrCoords,e=b.point2.coords.usrCoords,0===t[0]&&0===t[1]&&0===t[2]||0===e[0]&&0===e[1]&&0===e[2]?h=[0,0,0]:Math.abs(e[0])<i.eps?(o=Math.min(Math.abs(this.position),1-i.eps),o/=1-o,this.position<0&&(o=-o),h=[t[0]+o*e[0],t[1]+o*e[1],t[2]+o*e[2]]):Math.abs(t[0])<i.eps?(o=Math.max(this.position,i.eps),o=Math.min(o,2-i.eps),o=o>1?(o-1)/(o-2):(1-o)/o,h=[e[0]+o*t[0],e[1]+o*t[1],e[2]+o*t[2]]):(o=this.position,h=[t[0]+o*(e[0]-t[0]),t[1]+o*(e[1]-t[1]),t[2]+o*(e[2]-t[2])]);else if(b.type===a.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(a.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),this.updateConstraint(),h=r.projectPointToTurtle(this,b,this.board).usrCoords;else if(b.elementClass===a.OBJECT_CLASS_CURVE){for(u=!1,l=b.getTransformationSource(),l[0]&&(u=l[0],v.push(b),v.push(l[1]));l[0]&&c.exists(l[1]._transformationSource);)l=l[1].getTransformationSource(),v.push(l[1]);if(u?this.coords.setCoordinates(a.COORDS_BY_USER,[v[v.length-1].Z(this.position),v[v.length-1].X(this.position),v[v.length-1].Y(this.position)]):this.coords.setCoordinates(a.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),b.type===a.OBJECT_TYPE_ARC||b.type===a.OBJECT_TYPE_SECTOR)p=r.rad([b.center.X()+1,b.center.Y()],b.center,b.radiuspoint),f=0,g=r.rad(b.radiuspoint,b.center,b.anglepoint),("minor"===b.visProp.selection&&g>Math.PI||"major"===b.visProp.selection&&g<Math.PI)&&(f=g,g=2*Math.PI),y=g-f,c.evaluate(this.visProp.isgeonext)&&(y=1),m=this.position*y,(m<f||m>g)&&(m=g,(m<f&&m>.5*f||m>g&&m>.5*g+Math.PI)&&(m=f),this.position=m,Math.abs(y)>i.eps&&(this.position/=y)),s=b.Radius(),h=[b.center.X()+s*Math.cos(this.position*y+p),b.center.Y()+s*Math.sin(this.position*y+p)];else if(this.updateConstraint(),u)for(h=r.projectPointToCurve(this,v[v.length-1],this.board).usrCoords,d=v.length-2;d>=0;d--)h=new n(a.COORDS_BY_USER,i.matVecMult(v[d].transformMat,h),this.board).usrCoords;else h=r.projectPointToCurve(this,b,this.board).usrCoords}else c.isPoint(b)&&(h=r.projectPointToPoint(this,b,this.board).usrCoords);this.coords.setCoordinates(a.COORDS_BY_USER,h,!1)},updateRendererGeneric:function(t){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>i.eps&&this.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer[t](this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},XEval:function(){return this.coords.usrCoords[1]},YEval:function(){return this.coords.usrCoords[2]},ZEval:function(){return this.coords.usrCoords[0]},Dist:function(t){return this.isReal&&t.isReal?this.coords.distance(a.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,s,o,n,h,l,d,u=0,p=1/0,f=null,m=c.evaluate(this.visProp.ignoredsnaptopoints),g=!1;if(o=this.board.objectsList.length,m&&(l=m.length),c.evaluate(this.visProp.snaptopoints)||t){for(n=c.evaluate(this.visProp.attractorunit),h=c.evaluate(this.visProp.attractordistance),e=0;e<o;e++){if(i=this.board.objectsList[e],m){for(g=!1,d=0;d<l;d++)if(i==this.board.select(m[d])){g=!0;break}if(g)continue}c.isPoint(i)&&i!Line truncated
for(var e=this.scope;null!==e;){if(Type.indexOf(e.args,t)>-1)return e;e=e.previous}return null},isCreator:function(t){return!!JXG.elements[t]},isMathMethod:function(t){return"E"!==t&&!!Math[t]},isBuiltIn:function(t){return!!this.builtIn[t]},getvar:function(t,e){var i;return e=Type.def(e,!1),i=this.isLocalVariable(t),null!==i?i.locals[t]:this.isCreator(t)?this.creator(t):this.isBuiltIn(t)?this.builtIn[t]:this.isMathMethod(t)?Math[t]:e||(i=this.board.select(t))===t?void 0:i},resolve:function(t){for(var e=this.scope;null!==e;){if(Type.exists(e.locals[t]))return e.locals[t];e=e.previous}},getvarJS:function(t,e,i){var r="";return e=Type.def(e,!1),i=Type.def(i,!1),null!==this.isParameter(t)?t:null===this.isLocalVariable(t)||i?this.isCreator(t)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })":(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t)?this.builtIn[t].src||this.builtIn[t]:this.isMathMethod(t)?"Math."+t:e?"":(Type.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):Type.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):Type.isGroup(this.board,t)&&(r="$jc$.board.groups['"+t+"']"),r)):"$jc$.resolve('"+t+"')"},makeMap:function(t){return t.isMap=!0,t},functionCodeJS:function(t){var e=t.children[0].join(", "),i="",r="";return"op_map"===t.value&&(i="{ return ",r=" }"),"function ("+e+") {\nvar $oldscope$ = $jc$.scope;\n$jc$.scope = $jc$.scopes["+this.scope.id+"];\nvar r = (function () "+i+this.compile(t.children[1],!0)+r+")();\n$jc$.scope = $oldscope$;\nreturn r;\n}"},defineFunction:function(node){var fun,i,list=node.children[0],scope=this.pushScope(list);if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i<list.length;i++)scope.locals[list[i]]=list[i];this.replaceNames(node.children[1]),fun=function($jc$){var fun,str="var f = "+$jc$.functionCodeJS(node)+"; f;";try{return fun=eval(str)}catch(t){return $jc$._warn("error compiling function\n\n"+str+"\n\n"+t.toString()),function(){}}}(this),this.popScope()}else fun=function(t,e,i){return function(){var r,s;for(s=e.scope,e.scope=e.scopes[i],r=0;r<t.length;r++)e.scope.locals[t[r]]=arguments[r];return r=e.execute(node.children[1]),e.scope=s,r}}(list,this,scope.id);return fun.node=node,fun.scope=scope,fun.toJS=fun.toString,fun.toString=function(t){return function(){return t.compile(t.replaceIDs(Type.deepCopy(node)))}}(this),fun.deps={},this.collectDependencies(node.children[1],fun.deps),fun},mergeAttributes:function(t){var e,i={};for(e=0;e<arguments.length;e++)i=Type.deepCopy(i,arguments[e],!0);return i},setProp:function(t,e,i){var r,s,o={};t.elementClass!==Const.OBJECT_CLASS_POINT||"X"!==e&&"Y"!==e?t.elementClass!==Const.OBJECT_CLASS_TEXT||"X"!==e&&"Y"!==e?t.type&&t.elementClass&&t.visProp?Type.exists(t[t.methodMap[e]])&&"function"!=typeof t[t.methodMap[e]]?t[t.methodMap[e]]=i:(o[e]=i,t.setAttribute(o)):t[e]=i:("number"==typeof i?t[e]=function(){return i}:"function"==typeof i?(t.isDraggable=!1,t[e]=i):"string"==typeof i&&(t.isDraggable=!1,t[e]=Type.createFunction(i,this.board,null,!0),t[e+"jc"]=i),t[e].origin=i,this.board.update()):(e=e.toLowerCase(),t.isDraggable&&"number"==typeof i?(r="x"===e?i:t.X(),s="y"===e?i:t.Y(),t.setPosition(Const.COORDS_BY_USER,[r,s])):!t.isDraggable||"function"!=typeof i&&"string"!=typeof i?t.isDraggable||(r="x"===e?i:t.XEval.origin,s="y"===e?i:t.YEval.origin,t.addConstraint([r,s])):(r="x"===e?i:t.coords.usrCoords[1],s="y"===e?i:t.coords.usrCoords[2],t.addConstraint([r,s])),this.board.update())},_genericParse:function(t,e,i,r){var s,o,n,a,h=t.replace(/\r\n/g,"\n").split("\n"),l=[];r||(this.code+=t+"\n"),Text&&(o=Text.Text.prototype.setText,Text.Text.prototype.setText=Text.Text.prototype.setTextJessieCode);try{for(Type.exists(i)||(i=!1),s=0;s<h.length;s++)i&&(h[s]=JXG.GeonextParser.geonext2JS(h[s],this.board)),l.push(h[s]);switch(t=l.join("\n"),n=parser.parse(t),this.CA&&(n=this.CA.expandDerivatives(n,null,n),n=this.CA.removeTrivialNodes(n)),e){case"parse":a=this.execute(n);break;case"manipulate":a=this.compile(n);break;case"getAst":a=n;break;default:a=!1}}catch(t){throw t}finally{Text&&(Text.Text.prototype.setText=o)}return a},parse:function(t,e,i){return this._genericParse(t,"parse",e,i)},manipulate:function(t,e,i){return this._genericParse(t,"manipulate",e,i)},getAST:function(t,e,i){return this._genericParse(t,"getAst",e,i)},snippet:function(t,e,i,r){var s;return e=Type.def(e,!0),i=Type.def(i,""),r=Type.def(r,!1),s=(e?" function ("+i+") { return ":"")+t+(e?"; }":"")+";",this.parse(s,r,!0)},replaceIDs:function(t){var e,i;if(t.replaced&&(i=this.board.objects[t.children[1][0].value],Type.exists(i)&&""!==i.name&&(t.type="node_var",t.value=i.name,t.children.length=0,delete t.replaced)),t.children)for(e=t.children.length;e>0;e--Line truncated
this.$.isMath=!0;break;case 88:this.$=lt.createNode(ct(n[a-2]),"node_op","op_execfun",o[a-2],o[a-1],o[a],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 103:this.$=[o[a]];break;case 95:case 99:case 104:this.$=o[a-2].concat(o[a]);break;case 96:this.$=lt.createNode(ct(n[a]),"node_var",o[a]),this.$.isMath=!0;break;case 100:this.$=lt.createNode(ct(n[a-3]),"node_op","op_function",[],o[a]),this.$.isMath=!1;break;case 101:this.$=lt.createNode(ct(n[a-4]),"node_op","op_function",o[a-2],o[a]),this.$.isMath=!1;break;case 102:this.$=lt.createNode(ct(n[a-5]),"node_op","op_map",o[a-3],o[a])}},table:[e([5,7,8,14,15,16,17,19,20,21,23,26,50,51,58,65,74,75,76,77,78,79,80,82,91,93],i,{3:1,4:2}),{1:[3]},{5:[1,3],6:6,7:r,8:s,9:20,11:4,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{1:[2,1]},e(T,[2,13]),e(N,[2,15]),e(N,[2,16]),e(N,[2,17]),e(N,[2,18]),e(N,[2,19]),e(N,[2,20]),e(N,[2,21]),e([7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],i,{4:61}),{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:r,8:s,9:20,11:65,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{20:[1,66]},{20:[1,67]},{8:s,9:69,16:[1,68],20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{16:[1,70]},e(N,[2,11]),e(M,[2,23]),e(M,[2,24]),e([8,10,16,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],A,{32:[1,71],57:R}),e([8,10,16,32,35,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],[2,26],{34:[1,73],37:[1,74]}),e(k,[2,54],{88:77,8:L,64:[1,75],65:[1,76]}),e(k,[2,55],{88:79,8:L,64:[1,81],65:[1,80]}),e(B,[2,28],{39:Y}),e(M,[2,56]),e(M,[2,57]),e(M,[2,58]),e(D,[2,30],{41:j,42:I,43:X}),e(M,[2,61]),e(M,[2,62]),e(M,[2,63]),e(M,[2,64]),{8:s,9:86,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:[1,87]},{8:[1,88]},e(G,[2,32],{45:J,46:U,47:F,48:z}),e(M,[2,66]),e(M,[2,67]),e(M,[2,68]),e(M,[2,69]),{20:H,72:98,73:99,77:_,78:P,79:E,80:S,83:[1,93],84:94,85:95,87:96},{8:s,20:c,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,81:101,82:x,91:O,93:w},e(V,[2,36],{50:$,51:q}),e(M,[2,70]),e(M,[2,71]),e(M,[2,72]),e(M,[2,73]),e(M,[2,74]),e(M,[2,75]),e(M,[2,76]),e(W,[2,41],{53:Z,54:Q,55:K}),e(M,[2,44]),e(M,[2,50]),{8:s,20:c,31:109,50:f,51:m,52:108,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:110,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:111,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{6:6,7:r,8:s,9:20,11:4,13:7,14:o,15:n,16:a,17:h,18:8,19:l,20:c,21:d,22:9,23:u,24:11,25:5,26:p,27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:113,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:114,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,9:115,20:c,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{14:[1,116]},e(N,[2,7]),e(N,[2,8]),e(N,[2,9]),{16:[1,117]},e(N,[2,22]),{8:s,20:c,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:f,51:m,52:56,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:v,75:y,76:C,77:_,78:P,79:E,80:S,82:x,91:O,93:w},{8:s,20:c,31:109,50:f,51:m,52:119,56:57,58:g,59:26,60:27,61:29,62:30,63:31,65:b,67:34,68:35,69:36,70:Line truncated
Math.abs(d)<e.eps&&(p=2,d=c[p]-l[p]),u=(a[p]-l[p])/d),!(!h.evaluate(this.visProp.straightfirst)&&u<0)&&!(!h.evaluate(this.visProp.straightlast)&&u>1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(h.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(h.isFunction(this.funp1)&&(t=this.funp1(),h.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(o.COORDS_BY_USER,t)),h.isFunction(this.funp2)&&(t=this.funp2(),h.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(o.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),h.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,i,r,s,n,a,l,c;return this.hasFixedLength?(t=this.point1.Dist(this.point2),i=this.fixedLength(),r=this.fixedLengthOldCoords[0].distance(o.COORDS_BY_USER,this.point1.coords),s=this.fixedLengthOldCoords[1].distance(o.COORDS_BY_USER,this.point2.coords),(r>e.eps||s>e.eps||t!==i)&&(n=this.point1.isDraggable&&this.point1.type!==o.OBJECT_TYPE_GLIDER&&!h.evaluate(this.point1.visProp.fixed),a=this.point2.isDraggable&&this.point2.type!==o.OBJECT_TYPE_GLIDER&&!h.evaluate(this.point2.visProp.fixed),t>e.eps?r>s&&a||r<=s&&a&&!n?(this.point2.setPositionDirectly(o.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*i/t,this.point1.Y()+(this.point2.Y()-this.point1.Y())*i/t]),this.point2.fullUpdate()):(r<=s&&n||r>s&&n&&!a)&&(this.point1.setPositionDirectly(o.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*i/t,this.point2.Y()+(this.point1.Y()-this.point2.Y())*i/t]),this.point1.fullUpdate()):(l=Math.random()-.5,c=Math.random()-.5,t=Math.sqrt(l*l+c*c),a?(this.point2.setPositionDirectly(o.COORDS_BY_USER,[this.point1.X()+l*i/t,this.point1.Y()+c*i/t]),this.point2.fullUpdate()):n&&(this.point1.setPositionDirectly(o.COORDS_BY_USER,[this.point2.X()+l*i/t,this.point2.Y()+c*i/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(o.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(o.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=e.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=t[0],this.stdform[1]=t[1],this.stdform[2]=t[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&e.innerProduct(this.stdform,this.stdform,3)>=e.eps*e.eps,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateLine(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(t){var e=this.point1.symbolic.x,i=this.point1.symbolic.y,r=this.point2.symbolic.x,s=this.point2.symbolic.y,o=t.symbolic.x,n=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",r,")+(",n,")*(",r,")-(",e,")*(",n,")+(",e,")*(",s,")-(",o,")*(",s,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=e.eps?-this.stdform[0]/this.stdform[2]:1/0},getSlope:function(){return Math.abs(this.stdform[2])>=e.eps?-this.stdform[1]/this.stdform[2]:1/0},getAngle:function(){return Math.atan2(-this.stdform[1],this.stdform[2])},setStraight:function(t,e){return this.visProp.straightfirst=t,this.visProp.straightlast=e,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new n(o.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){h.exists(this.label)&&(this.label.relativeCoords=new n(o.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,r,s=0,a=new n(o.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),l=new n(o.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),c=h.evaluate(this.visProp.straightfirst),d=h.evaluate(this.visProp.straightlast);if((c||d)&&i.calcStraight(this,a,l,0),a=a.scrCoords,l=l.scrCoords,!h.exists(this.label))return new n(o.COORDS_BY_SCREEN,[NaN,NaN],this.board);switch(h.evaluate(this.label.visProp.position)){case"lft":case"llft":case"ulft":a[1]<=l[1]?(t=a[1],r=a[2]):(t=l[1],r=l[2]);break;case"rt":case"lrt":case"urt":a[1]>l[1]?(t=a[1],r=a[2]):(t=l[1],r=l[2]);break;default:t=.5*(a[1]+l[1]),r=.5*(a[2]+l[2])}return(c||d)&&(h.exists(this.label)&&(s=h.evaluate(this.label.visProp.fontsize)),Math.abs(t)<e.eps?t=s+0:this.board.canvasWidth+e.eps>t&&t>this.board.canvasWidth-s-e.eps&&(t=this.board.canvasWidth-s),e.eps+s>r&&r>-e.eps?r=s:this.board.canvasHeight+e.eps>r&&r>this.board.canvasHeight-s-e.eps&&(r=this.board.canvasHeight-s)),new n(o.COORDS_BY_SCREEN,[t,r],this.board)},cLine truncated
t>=h)return l.isFunction(a[a.length-1])?a[a.length-1]():a[a.length-1];for(r=3*Math.floor(t),o=t%1,n=1-o,s=0;s<4;s++)l.isFunction(a[r+s])?c[s]=a[r+s]():c[s]=a[r+s];return n*n*(n*c[0]+3*o*c[1])+(3*n*c[2]+o*c[3])*o*o}if((r=t>h-2?h-2:parseInt(Math.floor(t),10))===t)return l.isFunction(a[r])?a[r]():a[r];for(s=0;s<2;s++)l.isFunction(a[r+s])?c[s]=a[r+s]():c[s]=a[r+s];return c[0]+(c[1]-c[0])*(t-r)}},generateTerm:function(t,e,i,r,s){var o,n;l.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray("X"),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=l.createFunction(e,this.board,t),l.isString(e)?this.visProp.curvetype="functiongraph":(l.isFunction(e)||l.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),l.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray("Y")):this.Y=l.createFunction(i,this.board,t),l.isFunction(e)&&l.isArray(i)&&(o=l.createFunction(i[0],this.board,""),n=l.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+o()},this.Y=function(t){return e(t)*Math.sin(t)+n()},this.visProp.curvetype="polar"),l.exists(r)&&(this.minX=l.createFunction(r,this.board,"")),l.exists(s)&&(this.maxX=l.createFunction(s,this.board,""))},notifyParents:function(t){var e,i,r,s=!1;r={xterm:1,yterm:1};for(e in r)if(r.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin){s=!0;for(i in this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this)}s||h.findDependencies(this,t,this.board)},getLabelAnchor:function(){var t,r,s,o=.05*this.board.canvasWidth,n=.05*this.board.canvasHeight,h=.95*this.board.canvasWidth,c=.95*this.board.canvasHeight;switch(l.evaluate(this.visProp.label.position)){case"ulft":r=o,s=n;break;case"llft":r=o,s=c;break;case"rt":r=h,s=.5*c;break;case"lrt":r=h,s=c;break;case"urt":r=h,s=n;break;case"top":r=.5*h,s=n;break;case"bot":r=.5*h,s=c;break;default:r=o,s=.5*c}return t=new i(e.COORDS_BY_SCREEN,[r,s],this.board,!1),a.projectCoordsToCurve(t.usrCoords[1],t.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,i={id:this.id+"T"+this.numTraces,elementClass:e.OBJECT_CLASS_CURVE,points:this.points.slice(0),bezierDegree:this.bezierDegree,numberPoints:this.numberPoints,board:this.board,visProp:l.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return i.visProp.layer=this.board.options.layer.trace,i.visProp.curvetype=this.visProp.curvetype,this.numTraces++,l.clearVisPropOld(i),i.visPropCalc={visible:l.evaluate(i.visProp.visible)},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(i),this.board.renderer.enhancedRendering=t,this.traces[i.id]=i.rendNode,this},bounds:function(){var t,e,i,r=1/0,s=-1/0,o=1/0,a=-1/0,h=this.points.length;if(3===this.bezierDegree){for(t=0;t<h;t++)this.points[t].X=l.bind(function(){return this.usrCoords[1]},this.points[t]),this.points[t].Y=l.bind(function(){return this.usrCoords[2]},this.points[t]);return e=n.bezier(this.points),i=e[3](),r=n.fminbr(function(t){return e[0](t)},[0,i]),s=n.fminbr(function(t){return-e[0](t)},[0,i]),o=n.fminbr(function(t){return e[1](t)},[0,i]),a=n.fminbr(function(t){return-e[1](t)},[0,i]),r=e[0](r),s=e[0](s),o=e[1](o),a=e[1](a),[r,a,s,o]}for(t=0;t<h;t++)r>this.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),s<this.points[t].usrCoords[1]&&(s=this.points[t].usrCoords[1]),o>this.points[t].usrCoords[2]&&(o=this.points[t].usrCoords[2]),a<this.points[t].usrCoords[2]&&(a=this.points[t].usrCoords[2]);return[r,a,s,o]},getParents:function(){var t=[this.xterm,this.yterm,this.minX(),this.maxX()];return 0!==this.parents.length&&(t=this.parents),t},moveTo:function(t){var i,r=[];return this.points.length>0&&!l.evaluate(this.visProp.fixed)&&(i=this.points[0],r=3===t.length?[t[0]-i.usrCoords[0],t[1]-i.usrCoords[1],t[2]-i.usrCoords[2]]:[t[0]-i.usrCoords[1],t[1]-i.usrCoords[2]],this.setPosition(e.COORDS_BY_USER,r)),this},getTransformationSource:function(){var t,i;return l.exists(this._transformationSource)&&(i=this._transformationSource,i.elementClass===e.OBJECT_CLASS_CURVE&&(t=!0)),[t,i]}}),t.createCurve=function(i,r,s){var o,n,a=l.copyAttributes(s,i.options,"curve");return o=i.select(r[0],!0),l.isObject(o)&&(o.type===e.OBJECT_TYPE_CURVE||o.type===e.OBJECT_TYPE_ANGLE||o.type===e.OBJECT_TYPE_ARC||o.type===e.OBJECT_TYPE_CONIC||o.type===e.OBJECT_TYPE_SECTOR)&&l.isTransformationOrArray(r[1])?(o.type===e.OBJECT_TYPE_SECTOR?a=l.copyAttributes(s,i.options,"sector"):o.type===e.OBJECT_TYPE_ARC?a=l.copyAttributes(s,i.options,"arc"):o.type===e.OBJECT_TYPE_ANGLE?(l.exists(s.withLabel)||(s.withLabel=!1),a=l.copyAttributes(s,i.options,"angle")):a=l.copyAttributes(s,i.options,"curve"),a=l.copyAttributes(a,i.options,"curve"),n=new t.Curve(i,["x",[],[]],a),n.updateDataArray=function(){var t,e=o.numberPoints;for(this.bezierDegree=o.bezierDegree,this.dataX=[],this.dataY=[],t=0;t<e;t++)this.dataX.push(o.points[t].usrCoords[1]),this.dataY.push(o.points[t].usrCLine truncated
this.subs={}},t.extend(t.Composition.prototype,{add:function(t,i){return!(e.exists(this[t])||!e.exists(i))&&(e.exists(i.id)?this.elements[i.id]=i:this.elements[t]=i,e.exists(i.name)&&(this.elementsByName[i.name]=i),i.on("attribute:name",this.nameListener,this),this.objectsList.push(i),this[t]=i,this.methodMap[t]=i,!0)},remove:function(t){var e,i=!1;for(e in this.elements)if(this.elements.hasOwnProperty(e)&&this.elements[e].id===this[t].id){i=!0;break}return i&&(delete this.elements[this[t].id],delete this[t]),i},nameListener:function(t,e,i){delete this.elementsByName[t],this.elementsByName[e]=i},select:function(i){return e.exists(t.Board)?t.Board.prototype.select.call(this,i):new t.Composition},getParents:function(){return this.parents},getType:function(){return this.elType},getAttributes:function(){var t,e={};for(t in this.subs)this.subs.hasOwnProperty(t)&&(e[t]=this.subs[t].visProp);return this.attr}}),t.Composition}),define("base/polygon",["jxg","base/constants","base/coords","math/statistics","math/geometry","utils/type","base/element","base/line","base/transformation"],function(t,e,i,r,s,o,n,a,h){"use strict";return t.Polygon=function(i,r,s){this.constructor(i,s,e.OBJECT_TYPE_POLYGON,e.OBJECT_CLASS_AREA);var n,a,h,l,c=o.copyAttributes(s,i.options,"polygon","borders");for(this.withLines=s.withlines,this.attr_line=c,this.vertices=[],n=0;n<r.length;n++)this.vertices[n]=this.board.select(r[n]);if(this.vertices.length>0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(h=this.vertices.length-1,l=0;l<h;l++)n=(l+1)%h,c.id=c.ids&&c.ids[n],c.name=c.names&&c.names[n],c.strokecolor=o.isArray(c.colors)&&c.colors[n%c.colors.length]||c.strokecolor,c.visible=o.exists(s.borders.visible)?s.borders.visible:s.visible,!1===c.strokecolor&&(c.strokecolor="none"),a=i.create("segment",[this.vertices[n],this.vertices[n+1]],c),a.dump=!1,this.borders[n]=a,a.parentPolygon=this;for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),n=0;n<this.vertices.length-1;n++)this.board.select(this.vertices[n]).addChild(this);this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="polygon",this.createLabel(),this.methodMap=t.deepCopy(this.methodMap,{borders:"borders",vertices:"vertices",A:"Area",Area:"Area",Perimeter:"Perimeter",L:"Perimeter",Length:"Perimeter",boundingBox:"boundingBox",bounds:"bounds",addPoints:"addPoints",insertPoints:"insertPoints",removePoints:"removePoints"})},t.Polygon.prototype=new n,t.extend(t.Polygon.prototype,{hasPoint:function(t,e){var i,r,s,n=!1;if(o.evaluate(this.visProp.hasinnerpoints)){for(s=this.vertices.length,i=0,r=s-2;i<s-1;r=i++)this.vertices[i].coords.scrCoords[2]>e!=this.vertices[r].coords.scrCoords[2]>e&&t<(this.vertices[r].coords.scrCoords[1]-this.vertices[i].coords.scrCoords[1])*(e-this.vertices[i].coords.scrCoords[2])/(this.vertices[r].coords.scrCoords[2]-this.vertices[i].coords.scrCoords[2])+this.vertices[i].coords.scrCoords[1]&&(n=!n);if(n)return!0}for(s=this.borders.length,i=0;i<s;i++)if(this.borders[i].hasPoint(t,e)){n=!0;break}return n},updateRenderer:function(){var t,e;if(!this.needsUpdate)return this;if(this.visPropCalc.visible){for(e=this.vertices.length,this.isReal=!0,t=0;t<e;++t)if(!this.vertices[t].isReal){this.isReal=!1;break}this.isReal||this.updateVisibility(!1)}return this.visPropCalc.visible&&this.board.renderer.updatePolygon(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this},getTextAnchor:function(){var t,r,s,o,n;if(0===this.vertices.length)return new i(e.COORDS_BY_USER,[1,0,0],this.board);for(t=this.vertices[0].X(),r=this.vertices[0].Y(),s=t,o=r,n=0;n<this.vertices.length;n++)this.vertices[n].X()<t&&(t=this.vertices[n].X()),this.vertices[n].X()>s&&(s=this.vertices[n].X()),this.vertices[n].Y()>r&&(r=this.vertices[n].Y()),this.vertices[n].Y()<o&&(o=this.vertices[n].Y());return new i(e.COORDS_BY_USER,[.5*(t+s),.5*(r+o)],this.board)},getLabelAnchor:t.shortcut(t.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var t,e={};return e.id=this.id+"T"+this.numTraces,this.numTraces++,e.vertices=this.vertices,e.visProp=o.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,e.board=this.board,o.clearVisPropOld(e),e.visPropCalc={visible:o.evaluate(e.visProp.visible)},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawPolygon(e),this.board.renderer.enhancedRendering=t,this.traces[e.id]=e.rendNode,this},hideElement:function(e){var i;if(t.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),!e)for(i=0;i<this.borders.length;i++)this.borders[i].hideElement();this.hasLabel&&o.exLine truncated
return i.projectPointToLine(o,s,t)}],l),o.addChild(h),s.addChild(h),h.elType="orthogonalprojection",h.setParents([o.id,h.id]),h.update(),h.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,r=s.point2.symbolic.y,n=o.symbolic.x,a=o.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+r+")-("+l+")*("+r+")","("+a+")*("+e+")-("+a+")*("+r+")-("+c+")*("+e+")+("+c+")*("+r+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},h},t.createPerpendicular=function(t,e,i){var r,s,o,h;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)s=e[1],r=n.providePoints(t,[e[0]],i,"point")[0];else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");s=e[0],r=n.providePoints(t,[e[1]],i,"point")[0]}return h=n.copyAttributes(i,t.options,"perpendicular"),o=l.createLine(t,[function(){return s.stdform[2]*r.X()-s.stdform[1]*r.Y()},function(){return-s.stdform[2]*r.Z()},function(){return s.stdform[1]*r.Z()}],h),o.elType="perpendicular",o.setParents([s.id,r.id]),o},t.createPerpendicularPoint=function(t,e,r){var s,o,h;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)o=n.providePoints(t,[e[0]],r,"point")[0],s=e[1];else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");o=n.providePoints(t,[e[1]],r,"point")[0],s=e[0]}return h=t.create("point",[function(){return i.perpendicular(s,o,t)[0]}],r),o.addChild(h),s.addChild(h),h.elType="perpendicularpoint",h.setParents([o.id,s.id]),h.update(),h.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,r=s.point2.symbolic.y,n=o.symbolic.x,a=o.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+r+")-("+l+")*("+r+")","("+a+")*("+e+")-("+a+")*("+r+")-("+c+")*("+e+")+("+c+")*("+r+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},h},t.createPerpendicularSegment=function(e,r,s){var o,h,c,d,u;if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),n.isPointType(e,r[0])&&r[1].elementClass===a.OBJECT_CLASS_LINE)h=r[1],o=n.providePoints(e,[r[0]],s,"point")[0];else{if(!n.isPointType(e,r[1])||r[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");h=r[0],o=n.providePoints(e,[r[1]],s,"point")[0]}return u=n.copyAttributes(s,e.options,"perpendicularsegment","point"),d=t.createPerpendicularPoint(e,[h,o],u),d.dump=!1,n.exists(s.layer)||(s.layer=e.options.layer.line),u=n.copyAttributes(s,e.options,"perpendicularsegment"),c=l.createLine(e,[function(){return i.perpendicular(h,o,e)[1]?[d,o]:[o,d]}],u),c.point=d,c.elType="perpendicularsegment",c.setParents([o.id,h.id]),c.subs={point:d},c.inherits.push(d),c},t.createMidpoint=function(t,i,r){var s,o,h,l,c;for(l=0;l<i.length;++l)i[l]=t.select(i[l]);if(2===i.length&&n.isPointType(t,i[0])&&n.isPointType(t,i[1]))i=n.providePoints(t,i,r,"point"),s=i[0],o=i[1];else{if(1!==i.length||i[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create midpoint.\nPossible parent types: [point,point], [line]");s=i[0].point1,o=i[0].point2}return c=n.copyAttributes(r,t.options,"midpoint"),h=t.create("point",[function(){var t=s.coords.usrCoords[1]+o.coords.usrCoords[1];return isNaN(t)||Math.abs(s.coords.usrCoords[0])<e.eps||Math.abs(o.coords.usrCoords[0])<e.eps?NaN:.5*t},function(){var t=s.coords.usrCoords[2]+o.coords.usrCoords[2];return isNaN(t)||Math.abs(s.coords.usrCoords[0])<e.eps||Math.abs(o.coords.usrCoords[0])<e.eps?NaN:.5*t}],c),s.addChild(h),o.addChild(h),h.elType="midpoint",h.setParents([s.id,o.id]),h.prepareUpdate().update(),h.generatePolynomial=function(){var t=s.symbolic.x,e=s.symbolic.y,i=o.symbolic.x,r=o.symbolic.y,n=h.symbolic.x,a=h.symbolic.y;return["("+e+")*("+n+")-("+e+")*("+i+")+("+a+")*("+i+")-("+t+")*("+a+")+("+t+")*("+r+")-("+n+")*("+r+")","("+t+")^2 - 2*("+t+")*("+n+")+("+e+")^2-2*("+e+")*("+a+")-("+i+")^2+2*("+i+")*("+n+")-("+r+")^2+2*("+r+")*("+a+")"]},h},t.createParallelPoint=function(t,e,i){var r,s,o,h,l;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(3===e.length&&n.isPointType(t,e[0])&&n.isPointType(t,e[1])&&n.isPointType(t,e[2]))e=n.providePoints(t,e,i,"point"),r=e[0],s=e[1],o=e[2];else if(n.isPointType(t,e[0])&&e[1].elementClass===a.OBJECT_CLASS_LINE)o=n.providePoints(t,[e[0]],i,"point")[0],r=e[1].point1,s=e[1].point2;else{if(!n.isPointType(t,e[1])||e[0].elementClass!==a.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can'tLine truncated
r=1;r<s;r++)a[r-1]===i.length&&(a[r-1]=1,a[r]+=1)}return""},generateId:function(){for(var e=1;u.exists(t.boards["jxgBoard"+e]);)e=Math.round(65535*Math.random());return"jxgBoard"+e},setId:function(t,e){var i,r=this.numObjects,s=t.id;if(this.numObjects+=1,""===s||!u.exists(s))for(s=this.id+e+r;u.exists(this.objects[s]);)i=Math.round(65535*Math.random()),s=this.id+e+r+"-"+i;return t.id=s,this.objects[s]=t,t._pos=this.objectsList.length,this.objectsList[this.objectsList.length]=t,s},finalizeAdding:function(t){!1===u.evaluate(t.visProp.visible)&&this.renderer.display(t,!1)},finalizeLabel:function(t){t.hasLabel&&!u.evaluate(t.label.visProp.islabel)&&!1===u.evaluate(t.label.visProp.visible)&&this.renderer.display(t.label,!1)},getCoordsTopLeftCorner:function(){var t,e,i,r,s,o=this.document.documentElement||this.document.body.parentNode,n=this.document.body,a=this.containerObj;if(this.cPos.length>0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||(new Date).getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=(new Date).getTime(),a.getBoundingClientRect){for(i=a.getBoundingClientRect(),r=1,s=a;s&&u.exists(s.parentNode);)u.exists(s.style)&&u.exists(s.style.zoom)&&""!==s.style.zoom&&(r*=parseFloat(s.style.zoom)),s=s.parentNode;return t=[i.left*r,i.top*r],t[0]+=f.getProp(a,"border-left-width"),t[1]+=f.getProp(a,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=f.getProp(a,"padding-left"),t[1]+=f.getProp(a,"padding-top")),this.cPos=t.slice(),this.cPos}return t=f.getOffset(a),e=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&e.defaultView&&(t[0]+=f.getProp(o,"margin-left"),t[1]+=f.getProp(o,"margin-top"),t[0]+=f.getProp(o,"border-left-width"),t[1]+=f.getProp(o,"border-top-width"),t[0]+=f.getProp(o,"padding-left"),t[1]+=f.getProp(o,"padding-top")),n&&(t[0]+=f.getProp(n,"left"),t[1]+=f.getProp(n,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=f.getProp(a,"border-left-width"),t[1]+=f.getProp(a,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=f.getProp(a,"padding-left"),t[1]+=f.getProp(a,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getMousePosition:function(t,e){var i,r,s=this.getCoordsTopLeftCorner();return i=f.getPosition(t,e,this.document),u.exists(this.cssTransMat)||this.updateCSSTransforms(),r=[1,i[0]-s[0],i[1]-s[1]],r=o.matVecMult(this.cssTransMat,r),r[1]/=r[0],r[2]/=r[0],[r[1],r[2]]},initMoveOrigin:function(t,e){this.drag_dx=t-this.origin.scrCoords[1],this.drag_dy=e-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN,this.updateQuality=this.BOARD_QUALITY_LOW},initMoveObject:function(t,i,r,s){var o,n,a,l=[],c=[],d=this.objectsList.length,p={visProp:{layer:-1e4}};for(n=0;n<d;n++)o=this.objectsList[n],a=o.hasPoint&&o.hasPoint(t,i),o.visPropCalc.visible&&a&&(o.triggerEventHandlers([s+"down","down"],[r]),this.downObjects.push(o)),a&&o.isDraggable&&o.visPropCalc.visible&&(this.geonextCompatibilityMode&&(u.isPoint(o)||o.elementClass===e.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!u.evaluate(o.visProp.fixed)&&(o.visProp.layer>p.visProp.layer||o.visProp.layer===p.visProp.layer&&o.lastDragTime.getTime()>=p.lastDragTime.getTime())&&(this.attr.ignorelabels&&u.exists(p.label)&&o===p.label||(p=o,l.push(p),u.exists(p.coords)?c.push(h.subtract(p.coords.scrCoords.slice(1),[t,i])):c.push([0,0])));return l.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(l.length=1,this._drag_offset=c[0]):(l=l.slice(-1),this._drag_offset=c[c.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&u.exists(l[0])&&u.evaluate(l[0].visProp.dragtotopoflayer)&&1===l.length&&u.exists(l[0].rendNode)&&l[0].rendNode.parentNode.appendChild(l[0].rendNode),this.previousRotation=0,this.previousScale=1,l.length>=1&&(l[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[r,l[0]])),l},moveObject:function(t,r,s,o,n){var a,l,c,d=new i(e.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,r),this);s&&s.obj&&(a=s.obj,a.coords&&(l=a.coords.scrCoords.slice()),this.drag_position=[d.scrCoords[1],d.scrCoords[2]],this.drag_position=h.add(this.drag_position,this._drag_offset),u.exists(a.coords)?a.setPositionDirectly(e.COORDS_BY_SCREEN,this.drag_position):(this.showInfobox(!1),isNaN(s.targets[0].Xprev+s.targets[0].Yprev)||a.setPositionDirectly(e.COORDS_BY_SCREEN,[d.scrCoords[1],d.scrCoords[2]],[s.targets[0].Xprev,s.targets[0].Yprev]),s.targets[0].Xprev=d.scrCoords[1],s.targets[0].Yprev=d.scrCoords[2]),u.exists(a.coords)&&(a.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(a),a.prepareUpdate().update(!0).updateRenderer()),a.coords&&(c=a.coords.scrCoords),a.coords&&l[1]===c[1]&&l[2]===c[2]||(a.triggerEventHandlers([n+"drag","drag"],[o]),this.update()),a.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[o,a]),a.lastDragTime=new Date)},twoFingerMove:function(t,r,s,o){var n,a,h;u.exists(s)&&u.exists(s.obj)&&(h=s.obj,n=new Line truncated
this.mode===this.BOARD_MODE_NONE&&(r=this.mouseOriginMoveStart(t)),this.triggerEventHandlers(["mousedown","down"],[t]),r)},mouseMoveListener:function(t){var e;e=this.getMousePosition(t),this.updateQuality=this.BOARD_QUALITY_LOW,this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.showInfobox(!1)),this.selectingMode?(this._moveSelecting(e),this.triggerEventHandlers(["mousemoveselecting","moveselecting"],[t,this.mode])):this.mouseOriginMove(t)||(this.mode===this.BOARD_MODE_DRAG?this.moveObject(e[0],e[1],this.mouse,t,"mouse"):this.highlightElements(e[0],e[1],t,-1),this.triggerEventHandlers(["mousemove","move"],[t,this.mode])),this.updateQuality=this.BOARD_QUALITY_HIGH},mouseUpListener:function(t){var e;if(!1===this.selectingMode&&this.triggerEventHandlers(["mouseup","up"],[t]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mouse&&this.mouse.obj&&(this.mouse.obj.snapToGrid(this.mouse.targets[0]),this.mouse.obj.snapToPoints()),this.originMoveEnd(),this.dehighlightAll(),this.update(),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["mousestopselecting","stopselecting"],[t]);else for(e=0;e<this.downObjects.length;e++)this.downObjects[e].triggerEventHandlers(["mouseup","up"],[t]);this.downObjects.length=0,this.hasMouseUp&&(f.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.mouse=null},mouseWheelListener:function(t){if(!this.attr.zoom.wheel||!this._isRequiredKeyPressed(t,"zoom"))return!0;t=t||window.event;var r=t.detail?-t.detail:t.wheelDelta/40,s=new i(e.COORDS_BY_SCREEN,this.getMousePosition(t),this);return r>0?this.zoomIn(s.usrCoords[1],s.usrCoords[2]):this.zoomOut(s.usrCoords[1],s.usrCoords[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1},initInfobox:function(){var t=u.copyAttributes({},this.options,"infobox");return t.id=this.id+"_infobox",this.infobox=this.create("text",[0,0,"0,0"],t),this.infobox.distanceX=-20,this.infobox.distanceY=25,this.infobox.dump=!1,this.showInfobox(!1),this},updateInfobox:function(t){var e,i,r,s,o;return u.evaluate(t.visProp.showinfobox)?(u.isPoint(t)&&(r=t.coords.usrCoords[1],s=t.coords.usrCoords[2],o=u.evaluate(t.visProp.infoboxdigits),this.infobox.setCoords(r+this.infobox.distanceX/this.unitX,s+this.infobox.distanceY/this.unitY),"string"!=typeof t.infoboxText?("auto"===o?(e=u.autoDigits(r),i=u.autoDigits(s)):u.isNumber(o)?(e=u.toFixed(r,o),i=u.toFixed(s,o)):(e=r,i=s),this.highlightInfobox(e,i,t)):this.highlightCustomInfobox(t.infoboxText,t),this.showInfobox(!0)),this):this},showInfobox:function(t){return this.infobox.hiddenByParent==t&&(this.infobox.hiddenByParent=!t,this.infobox.prepareUpdate().updateVisibility(t).updateRenderer()),this},highlightInfobox:function(t,e,i){return this.highlightCustomInfobox("("+t+", "+e+")",i),this},highlightCustomInfobox:function(t,e){return this.infobox.setText(t),this},dehighlightAll:function(){var t,e,i=!1;for(t in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(t)&&(e=this.highlightedObjects[t],(this.hasMouseHandlers||this.hasPointerHandlers)&&e.noHighlight(),i=!0);return this.highlightedObjects={},"canvas"===this.renderer.type&&i&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(t,e){return[t,e]},getUsrCoordsOfMouse:function(t){var r=this.getCoordsTopLeftCorner(),s=f.getPosition(t,null,this.document),o=s[0]-r[0],n=s[1]-r[1];return new i(e.COORDS_BY_SCREEN,[o,n],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var e,i,r=this.getCoordsTopLeftCorner(),s=f.getPosition(t,null,this.document),o=s[0]-r[0],n=s[1]-r[1],a=[],h=this.objectsList.length;for(e=0;e<h;e++)i=this.objectsList[e],i.visPropCalc.visible&&i.hasPoint&&i.hasPoint(o,n)&&(a[a.length]=i);return a},updateCoords:function(){var t,e,i=this.objectsList.length;for(e=0;e<i;e++)t=this.objectsList[e],u.exists(t.coords)&&(u.evaluate(t.visProp.frozen)?t.coords.screen2usr():t.coords.usr2screen());return this},moveOrigin:function(t,r,s){var o,n,a,h;return u.exists(t)&&u.exists(r)&&(o=this.origin.scrCoords[1],n=this.origin.scrCoords[2],this.origin.scrCoords[1]=t,this.origin.scrCoords[2]=r,s&&(this.origin.scrCoords[1]-=this.drag_dx,this.origin.scrCoords[2]-=this.drag_dy),a=new i(e.COORDS_BY_SCREEN,[0,0],this).usrCoords,h=new i(e.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords,(a[1]<this.maxboundingbox[0]||a[2]>this.maxboundingbox[1]||h[1]>this.maxboundingbox[2]||h[2]<this.maxboundingbox[3])&&(this.origin.scrCoords[1]=o,this.origin.scrCoords[2]=n)),this.updateCoords().clearTraces().fullUpdate(),this.triggerEventHandlers(["boundingbox"]),this},addConditions:function(i){var r,s,o,n,a,h,l,c=[],p="var el, x, y, c, rgbo;\n",f=i.indexOf("<data>"),m=i.indexOf("</data>"),g=function(t,i,r,s){return function(){var o,n;o=t.select(i.id),n=o.coords.usrCoords[s],2===s?o.Line truncated
s.exists(o)||(o=this.createPrim("path",t.id),this.appendChildPrim(o,s.evaluate(t.visProp.layer)),t.rendNode=o),o.setAttributeNS(null,"stroke",s.evaluate(t.visProp.strokecolor)),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"stroke-opacity",s.evaluate(t.visProp.strokeopacity)),o.setAttributeNS(null,"stroke-width",s.evaluate(t.visProp.strokewidth)),this.updatePathPrim(o,c,t.board)},displayCopyright:function(t,e){var i,r=this.createPrim("text","licenseText");r.setAttributeNS(null,"x","20px"),r.setAttributeNS(null,"y",2+e+"px"),r.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+e+"px; fill:#356AA0; opacity:0.3;"),i=this.container.ownerDocument.createTextNode(t),r.appendChild(i),this.appendChildPrim(r,0)},drawInternalText:function(t){var e=this.createPrim("text",t.id);return e.style.whiteSpace="nowrap",t.rendNodeText=this.container.ownerDocument.createTextNode(""),e.appendChild(t.rendNodeText),this.appendChildPrim(e,s.evaluate(t.visProp.layer)),e},updateInternalText:function(t){var e,i=t.plaintext,r=t.getAnchorX(),o=t.getAnchorY();t.rendNode.getAttributeNS(null,"class")!==t.visProp.cssclass&&(t.rendNode.setAttributeNS(null,"class",s.evaluate(t.visProp.cssclass)),t.needsSizeUpdate=!0),isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(e=t.coords.scrCoords[1],t.visPropOld.left!==r+e&&(t.rendNode.setAttributeNS(null,"x",e+"px"),"left"===r?t.rendNode.setAttributeNS(null,"text-anchor","start"):"right"===r?t.rendNode.setAttributeNS(null,"text-anchor","end"):"middle"===r&&t.rendNode.setAttributeNS(null,"text-anchor","middle"),t.visPropOld.left=r+e),e=t.coords.scrCoords[2],t.visPropOld.top!==o+e&&(t.rendNode.setAttributeNS(null,"y",e+.5*this.vOffsetText+"px"),"bottom"===o?t.rendNode.setAttributeNS(null,"dominant-baseline","text-after-edge"):"top"===o?t.rendNode.setAttributeNS(null,"dy","1.6ex"):"middle"===o&&t.rendNode.setAttributeNS(null,"dy","0.6ex"),t.visPropOld.top=o+e)),t.htmlStr!==i&&(t.rendNodeText.data=i,t.htmlStr=i),this.transformImage(t,t.transformations)},updateInternalTextStyle:function(t,e,i,r){this.setObjectFillColor(t,e,i)},drawImage:function(t){var e=this.createPrim("image",t.id);e.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(e,s.evaluate(t.visProp.layer)),t.rendNode=e,this.updateImage(t)},transformImage:function(t,e){var i,r,s=t.rendNode,o="";e.length>0&&(r=this.joinTransforms(t,e),i=[r[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0]].join(","),o+=" matrix("+i+") ",s.setAttributeNS(null,"transform",o))},updateImageURL:function(t){var e=s.evaluate(t.url);t.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",e)},updateImageStyle:function(t,e){var i=s.evaluate(e?t.visProp.highlightcssclass:t.visProp.cssclass);t.rendNode.setAttributeNS(null,"class",i)},appendChildPrim:function(t,i){return s.exists(i)?i>=e.layer.numlayers&&(i=e.layer.numlayers-1):i=0,this.layer[i].appendChild(t),t},createPrim:function(t,e){var i=this.container.ownerDocument.createElementNS(this.svgNamespace,t);return i.setAttributeNS(null,"id",this.container.id+"_"+e),i.style.position="absolute","path"===t&&(i.setAttributeNS(null,"stroke-linecap","round"),i.setAttributeNS(null,"stroke-linejoin","round")),i},remove:function(t){s.exists(t)&&s.exists(t.parentNode)&&t.parentNode.removeChild(t)},makeArrows:function(t){var e,i=s.evaluate(t.visProp.firstarrow),r=s.evaluate(t.visProp.lastarrow);if(t.visPropOld.firstarrow===i&&t.visPropOld.lastarrow===r)return void(this.isIE&&t.visPropCalc.visible&&(i||r)&&t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode));i?(e=t.rendNodeTriangleStart,s.exists(e)?this.defs.appendChild(e):(e=this._createArrowHead(t,"End"),this.defs.appendChild(e),t.rendNodeTriangleStart=e,t.rendNode.setAttributeNS(null,"marker-start","url(#"+this.container.id+"_"+t.id+"TriangleEnd)"))):(e=t.rendNodeTriangleStart,s.exists(e)&&this.remove(e)),r?(e=t.rendNodeTriangleEnd,s.exists(e)?this.defs.appendChild(e):(e=this._createArrowHead(t,"Start"),this.defs.appendChild(e),t.rendNodeTriangleEnd=e,t.rendNode.setAttributeNS(null,"marker-end","url(#"+this.container.id+"_"+t.id+"TriangleStart)"))):(e=t.rendNodeTriangleEnd,s.exists(e)&&this.remove(e)),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r},updateEllipsePrim:function(t,e,i,r,s){var o=1e6;o=2e5,e=Math.abs(e)<o?e:o*e/Math.abs(e),i=Math.abs(i)<o?i:o*i/Math.abs(i),r=Math.abs(r)<o?r:o*r/Math.abs(r),s=Math.abs(s)<o?s:o*s/Math.abs(s),t.setAttributeNS(null,"cx",e),t.setAttributeNS(null,"cy",i),t.setAttributeNS(null,"rx",Math.abs(r)),t.setAttributeNS(null,"ry",Math.abs(s))},updateLinePrim:function(t,e,i,r,s){var o=1e6;o=2e5,isNaN(e+i+r+s)||(e=Math.abs(e)<o?e:o*e/Math.abs(e),i=Math.abs(i)<o?i:o*i/Math.abs(i),r=Math.abs(r)<o?r:o*r/Math.abs(r),s=Math.abs(s)<o?s:o*s/Math.abs(s),t.setAttributeNS(null,"x1",e),t.setAttributeNS(null,"y1",i),t.setAttributeNS(null,"x2",r),t.setAttributeNS(null,"y2",s))},updatePathPrim:function(t,e){""===e&&(e="M 0 0"),t.setAttributeNS(null,"d",e)},updatePathStringPoint:function(t,e,i){varLine truncated
e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.deprecated("Board.renderer.hide()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(t,e){var i;e.dash>=0&&(i=t.rendNodeStroke,this._setAttr(i,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=r.evaluate(t.visProp.gradient);"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",r.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",r.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"angle",r.evaluate(t.visProp.gradientangle))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",r.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",r.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"focusposition",100*r.evaluate(t.visProp.gradientpositionx)+"%,"+100*r.evaluate(t.visProp.gradientpositiony)+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,o){var n,a,h,l=r.evaluate(e),c=r.evaluate(o),d=t.rendNode;c=c>0?c:0,t.visPropOld.fillcolor===l&&t.visPropOld.fillopacity===c||(r.exists(l)&&!1!==l&&(9!==l.length?(n=l,h=c):(a=s.rgba2rgbo(l),n=a[0],h=c*a[1]),"none"===n||!1===n?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",n),r.exists(h)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*h+"%")),t.type===i.OBJECT_TYPE_IMAGE&&d.filters.length>1&&(d.filters.item(1).opacity=Math.round(100*h),d.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=l,t.visPropOld.fillopacity=c)},setObjectStrokeColor:function(t,e,s){var o,n,a,h,l=r.evaluate(e),c=r.evaluate(s),d=t.rendNode;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(r.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(n=e.rgba2rgbo(l),o=n[0],a=c*n[1]),t.elementClass===i.OBJECT_CLASS_TEXT?(d.filters.length>1&&(d.filters.item(1).opacity=Math.round(100*a),d.filters.item(1).enabled=!0),d.style.color=o):(!1!==o&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",o)),h=t.rendNodeStroke,r.exists(a)&&t.type!==i.OBJECT_TYPE_IMAGE&&this._setAttr(h,"opacity",100*a+"%"))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,s=r.evaluate(e);isNaN(s)||t.visPropOld.strokewidth===s||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),r.exists(s)&&(this.setPropertyPrim(i,"stroke-width",s),0===s&&r.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=s)},setShadow:function(t){var e=t.rendNodeShadow,i=r.evaluate(t.visProp.shadow);e&&t.visPropOld.shadow!==i&&(i?(this._setAttr(e,"On","True"),this._setAttr(e,"Offset","3pt,3pt"),this._setAttr(e,"Opacity","60%"),this._setAttr(e,"Color","#aaaaaa")):this._setAttr(e,"On","False"),t.visPropOld.shadow=i)},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}}),t.VMLRenderer}),define("renderer/canvas",["jxg","renderer/abstract","base/constants","utils/env","utils/type","utils/uuid","utils/color","base/coords","math/math","math/geometry","math/numerics"],function(t,e,i,r,s,o,n,a,h,l,c){"use strict";return t.CanvasRenderer=function(t,e){this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=o.genUUID(),this.canvasNamespace=null,r.isBrowser?(this.container=t,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.innerHTML=['<canvas id="',this.canvasId,'" width="',e.width,'px" height="',e.height,'px"><',"/canvas>"].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.context=this.canvasRoot.getContext("2d")):r.isNode()&&(this.canvasId="object"==typeof module?module.require("canvas"):require("canvas"),this.canvasRoot=new this.canvasId(500,500),this.context=this.canvasRoot.getContext("2d")),this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5]]},t.CanvasRenderer.prototype=new e,t.extend(t.CanvasRenderer.prototype,{_drawFilledPolygon:function(t){var e,i=t.length,r=this.context;if(i>0){for(r.beginPath(),r.moveTo(t[0][0],t[0][1]),e=0;e<i;e++)e>0&&r.lineTo(t[e][0],t[e][1]);r.lineTo(t[0][0],t[0][1]),r.fill()}},_fill:function(t){var e=this.context;e.save(),this._setColor(t,"fill")&&e.fill(),e.restore()},_rotatePoint:function(t,e,i){return[e*Math.cos(t)-i*Math.sin(t),e*Math.sin(t)+i*Math.cos(t)]},_rotateShape:function(t,e){var i,r=[],s=t.length;if(s<=0)return t;for(i=0;i<s;i++)r.push(this._rotatePoint(e,t[i][0],t[i][1]));return r},updateGradientAngle:function(t,e){var r,s,o,n,h,l,c,d,u,p,f,m,g=1,b=Math.cos(-e),v=Math.sin(-e),y=t.getBoundingBox();return Math.abs(b)>Math.abs(v)?g/=Math.abs(b):g/=Math.abs(v),b>=0?(o=0,n=b*g):(o=-b*g,n=0),v>=0?(h=0,l=v*g):(h=-v*g,l=0),r=Line truncated
},addRotationPoint:function(t){return this._addActionPoint("rotation",t)},removeRotationPoint:function(t){return this._removeActionPoint("rotation",t)},setTranslationPoints:function(t){return this._setActionPoints("translation",t)},addTranslationPoint:function(t){return this._addActionPoint("translation",t)},removeTranslationPoint:function(t){return this._removeActionPoint("translation",t)},setScaleCenter:function(t){return this.scaleCenter=t,this},setScalePoints:function(t,e){var i,r,o;for(i=s.isArray(t)?t:arguments,o=i.length,r=0;r<o;++r)this.scaleDirections[this.board.select(i[r]).id]=e||"xy";return this._setActionPoints("scale",t)},addScalePoint:function(t,e){return this._addActionPoint("scale",t),this.scaleDirections[this.board.select(t).id]=e||"xy",this},removeScalePoint:function(t){return this._removeActionPoint("scale",t)},_setActionPoints:function(t,e){var i,r,o;for(i=s.isArray(e)?e:arguments,o=i.length,this[t+"Points"]=[],r=0;r<o;++r)this._addActionPoint(t,i[r]);return this},_addActionPoint:function(t,e){return this[t+"Points"].push(this.board.select(e)),this},_removeActionPoint:function(t,e){var i=this[t+"Points"].indexOf(this.board.select(e));return i>-1&&this[t+"Points"].splice(i,1),this},setProperty:function(){t.deprecated("Group.setProperty","Group.setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(){var t;for(t in this.objects)this.objects.hasOwnProperty(t)&&this.objects[t].point.setAttribute.apply(this.objects[t].point,arguments);return this}}),t.createGroup=function(e,i,r){var o=s.copyAttributes(r,e.options,"group"),n=new t.Group(e,o.id,o.name,i,o);return n.elType="group",n.setParents(i),n},t.registerElement("group",t.createGroup),{Group:t.Group,createGroup:t.createGroup}}),define("element/locus",["jxg","math/symbolic","utils/type","base/constants","base/curve"],function(t,e,i,r,s){"use strict";return t.createLocus=function(t,r,s){var o,n;if(!i.isArray(r)||1!==r.length||!i.isPoint(r[0]))throw new Error("JSXGraph: Can't create locus with parent of type other than point.\nPossible parent types: [point]");return n=r[0],o=t.create("curve",[[null],[null]],s),o.dontCallServer=!1,o.elType="locus",o.setParents([n.id]),o.updateDataArray=function(){var i,r,s;o.board.mode>0||(i=e.generatePolynomials(t,n,!0).join("|"))!==o.spe&&(o.spe=i,r=function(t,e,i,r){o.dataX=t,o.dataY=e,o.eq=i,o.ctime=r,o.generatePolynomial=function(t){return function(e){var i,r="("+e.symbolic.x+")",s="("+e.symbolic.y+")",o=[];for(i=0;i<t.length;i++)o[i]=t[i].replace(/\*\*/g,"^").replace(/x/g,r).replace(/y/g,s);return o}}(i)},s=e.geometricLocusByGroebnerBase(t,n,r),r(s.datax,s.datay,s.polynomial,s.exectime))},o},t.registerElement("locus",t.createLocus),{createLocus:t.createLocus}}),define("base/image",["jxg","base/constants","base/coords","base/element","math/math","math/statistics","utils/type","base/coordselement"],function(t,e,i,r,s,o,n,a){"use strict";return t.Image=function(i,r,s,o,a){this.constructor(i,s,e.OBJECT_TYPE_IMAGE,e.OBJECT_CLASS_OTHER),this.element=this.board.select(s.anchor),this.coordsConstructor(r),this.W=n.createFunction(a[0],this.board,""),this.H=n.createFunction(a[1],this.board,""),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*i.unitX),Math.abs(this.usrSize[1]*i.unitY)],this.url=o,this.elType="image",this.span=[this.coords.usrCoords.slice(0),[this.coords.usrCoords[0],this.W(),0],[this.coords.usrCoords[0],0,this.H()]],this.id=this.board.setId(this,"Im"),this.board.renderer.drawImage(this),this.board.finalizeAdding(this),this.methodMap=t.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform"})},t.Image.prototype=new r,n.copyPrototypeMethods(t.Image,a,"coordsConstructor"),t.extend(t.Image.prototype,{hasPoint:function(t,r){var o,n,a,h,l,c,d;return 0===this.transformations.length?(o=t-this.coords.scrCoords[1],n=this.coords.scrCoords[2]-r,a=this.board.options.precision.hasPoint,o>=-a&&o-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(h=new i(e.COORDS_BY_SCREEN,[t,r],this.board),h=h.usrCoords,l=[h[0]-this.span[0][0],h[1]-this.span[0][1],h[2]-this.span[0][2]],d=s.innerProduct,0<=(c=d(l,this.span[1]))&&c<=d(this.span[1],this.span[1])&&0<=(c=d(l,this.span[2]))&&c<=d(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var t,e,i=this.transformations.length,r=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(r[0]=[this.Z(),this.X(),this.Y()],r[1]=[this.Z(),this.X()+this.W(),this.Y()],r[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t<i;t++)for(e=0;e<3;e++)r[e]=s.matVecMult(this.transformations[t].matrix,r[e]);for(e=0;e<3;e++)r[e][1]/=r[e][0],r[e][2Line truncated
var t,e,i,o,n=h.evaluate(this.visProp.label.offset).slice(0);return t=this.point1.X(),e=this.point2.X(),i=this.point1.Y(),o=this.point2.Y(),e<t&&(n[0]=-n[0]),o<i&&(n[1]=-n[1]),this.setLabelRelativeCoords(n),new s(r.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},Q=function(t,i){var r,s,o;return r=e.create("transform",[-(_[i]-y[i]),0],{type:"translate"}),s=e.create("transform",[x/(P[i]+C[i]-(_[i]-y[i])),1],{type:"scale"}),r.melt(s),o=e.create("transform",[t],{type:"rotate"}),r.melt(o),r};if(W<=0)throw new Error("JSXGraph radar chart: no data");if(l=o.paramarray,!h.exists(l))throw new Error("JSXGraph radar chart: need paramArray attribute");if((c=l.length)<=1)throw new Error("JSXGraph radar chart: need more than one param in paramArray");for(n=0;n<W;n++)if(c!==i[n].length)throw new Error("JSXGraph radar chart: use data length equal to number of params ("+i[n].length+" != "+c+")");for(d=[],u=[],a=0;a<c;a++)d[a]=i[0][a],u[a]=d[a];for(n=1;n<W;n++)for(a=0;a<c;a++)i[n][a]>d[a]&&(d[a]=i[n][a]),i[n][a]<u[a]&&(u[a]=i[n][a]);for(p=[],f=[],n=0;n<W;n++)p[n]="",f[n]=[];for(m=[],g=[],b=o.startshiftratio||0,v=o.endshiftratio||0,n=0;n<c;n++)m[n]=(d[n]-u[n])*b,g[n]=(d[n]-u[n])*v;if(y=o.startshiftarray||m,C=o.endshiftarray||g,_=o.startarray||u,h.exists(o.start))for(n=0;n<c;n++)_[n]=o.start;if(P=o.endarray||d,h.exists(o.end))for(n=0;n<c;n++)P[n]=o.end;if(y.length!==c)throw new Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(C.length!==c)throw new Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(_.length!==c)throw new Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(P.length!==c)throw new Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(E=o.labelarray||p,S=o.colors,o.highlightcolors,x=o.radius||10,$=o.strokewidth||1,h.exists(o.highlightonsector)||(o.highlightonsector=!1),O={name:o.name,id:o.id,strokewidth:$,polystrokewidth:o.polystrokewidth||$,strokecolor:o.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:o.fillColor||"#FFFF88",fillopacity:o.fillOpacity||.4,highlightfillcolor:o.highlightFillColor||"#FF7400",highlightstrokecolor:o.highlightStrokeColor||"black",gradient:o.gradient||"none"},w=o.center||[0,0],T=w[0],N=w[1],M=e.create("point",[T,N],{name:"",fixed:!0,withlabel:!1,visible:!1}),A=Math.PI/2-Math.PI/c,A=o.startangle||0,R=A,k=[],L=[],n=0;n<c;n++)for(R+=2*Math.PI/c,Y=x*Math.cos(R)+T,D=x*Math.sin(R)+N,k[n]=e.create("point",[Y,D],{name:"",fixed:!0,withlabel:!1,visible:!1}),L[n]=e.create("line",[M,k[n]],{name:l[n],strokeColor:O.strokecolor,strokeWidth:O.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:O.highlightstrokecolor}),L[n].getLabelAnchor=Z,B=Q(R,n),a=0;a<i.length;a++)q=i[a][n],f[a][n]=e.create("point",[q,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),f[a][n].addTransform(f[a][n],B);for(j=[],n=0;n<W;n++)for(O.labelcolor=S&&S[n%S.length],O.strokecolor=S&&S[n%S.length],O.fillcolor=S&&S[n%S.length],j[n]=e.create("polygon",f[n],{withLines:!0,withLabel:!1,fillColor:O.fillcolor,fillOpacity:O.fillopacity,highlightFillColor:O.highlightfillcolor}),a=0;a<c;a++)j[n].borders[a].setAttribute("strokecolor:"+S[n%S.length]),j[n].borders[a].setAttribute("strokewidth:"+O.polystrokewidth);switch(o.legendposition||"none"){case"right":X=o.legendleftoffset||2,G=o.legendtopoffset||1,this.legend=e.create("legend",[T+x+X,N+x-G],{labels:E,colors:S});break;case"none":break;default:t.debug("Unknown legend position")}if(I=[],o.showcircles){for(J=[],n=0;n<6;n++)J[n]=20*n;if(J[0]="0",U=o.circlelabelarray||J,(F=U.length)<2)throw new Error("JSXGraph radar chart: too less circles in circleLabelArray");for(z=[],H=A+Math.PI/c,B=Q(H,0),O.fillcolor="none",O.highlightfillcolor="none",O.strokecolor=o.strokecolor||"black",O.strokewidth=o.circlestrokewidth||.5,O.layer=0,V=(P[0]-_[0])/(F-1),n=0;n<F;n++)z[n]=e.create("point",[_[0]+n*V,0],{name:U[n],size:0,fixed:!0,withLabel:!0,visible:!0}),z[n].addTransform(z[n],B),I[n]=e.create("circle",[M,z[n]],O)}return this.rendNode=j[0].rendNode,{circles:I,lines:L,points:f,midpoint:M,polygons:j}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){return this}}),t.createChart=function(e,i,r){var s,o,c,d,u,p,f,m,g,b,v,y,C,_,P,E,S=[],x=l.isBrowser?e.document.getElementById(i[0]):null;if(1===i.length&&h.isString(i[0])){if(h.exists(x)){if(g=h.copyAttributes(r,e.options,"chart"),x=(new n).loadFromTable(i[0],g.withheaders,g.withheaders),s=x.data,u=x.columnHeaders,o=x.rowHeaders,b=g.width,v=g.name,y=g.strokecolor,C=g.fillcolor,_=g.highlightstrokecolor,P=g.highlightfillcolor,e.suspendUpdate(),E=s.length,m=[],g.rows&&h.isArray(g.rows)){for(c=0;c<E;c++)for(d=0;d<g.rows.length;d++)if(g.rows[d]===c||g.withheaders&&g.rows[d]===o[c]){m.push(s[c]);break}}else m=s;for(E=m.length,c=0;c<E;c++){if(f=[],g.chartstyle&&-1!==g.chartstylLine truncated
;if("node_var"==r.type&&"node_var"==s.type&&r.value==s.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[0]=s,t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_neg"==s.value)return t.value="op_sub",t.children[1]=s.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==s.type&&"op_mul"==s.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.children[1].hash=this.parser.compile(s.children[1]),r.children[1].hash===s.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],s.children[0]),r.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.hash=this.parser.compile(s),r.children[1].hash===s.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),s],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_mul"==s.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.hash=this.parser.compile(r),s.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),s.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(r=t.children[0],s=t.children[1],"node_op"==s.type&&"op_neg"==s.value)return t.value="op_add",t.children[1]=s.children[0],this.mayNotBeSimplified=!0,t;break;case"op_execfun":return this.simplifyElementary(t)}return t},simplifyElementary:function(t){var e=t.children[0].value,i=t.children[1];if(0==i.length)return t;switch(e){case"sin":case"tan":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=0,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_const",t.value=0,t;if("node_op"==i[0].type&&"op_mul"==i[0].value&&"node_const"==i[0].children[0].type&&i[0].children[0].value%1==0&&"node_var"==i[0].children[1].type&&"PI"==i[0].children[1].value)return t.type="node_const",t.value=0,t;break;case"cos":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)],t;break;case"exp":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;break;case"pow":if("node_const"==i[1].type&&0===i[1].value)return t.type="node_const",t.value=1,t}return t}}),t.CA}),define("utils/dump",["jxg","utils/type"],function(t,e){"use strict";return t.Dump={addMarkers:function(t,i,r){var s,o,n;e.isArray(i)||(i=[i]),e.isArray(r)||(r=[r]),o=Math.min(i.length,r.length),i.length=o,r.length=o;for(s in t.objects)if(t.objects.hasOwnProperty(s))for(n=0;n<o;n++)t.objects[s][i[n]]=r[n]},deleteMarkers:function(t,i){var r,s,o;e.isArray(i)||(i=[i]),s=i.length,i.length=s;for(r in t.objects)if(t.objects.hasOwnProperty(r))for(o=0;o<s;o++)delete t.objects[r][i[o]]},str:function(t){return"string"==typeof t&&"function"!==t.substr(0,7)&&(t='"'+t+'"'),t},minimizeObject:function(i,r){var s,o,n,a={},h=e.deepCopy(i),l=[];for(n=1;n<arguments.length;n++)l.push(arguments[n]);for(a=e.deepCopy(a,t.Options.elements,!0),n=l.length;n>0;n--)a=e.deepCopy(a,l[n-1],!0);for(s in a)a.hasOwnProperty(s)&&(o=s.toLowerCase(),"object"!=typeof a[s]&&a[s]===h[o]&&delete h[o]);return h},prepareAttributes:function(e,i){var r,s;r=this.minimizeObject(i.getAttributes(),t.Options[i.elType]);for(s in i.subs)i.subs.hasOwnProperty(s)&&(r[s]=this.minimizeObject(i.subs[s].getAttributes(),t.Options[i.elType][s],t.Options[i.subs[s].elType]),r[s].id=i.subs[s].id,r[s].name=i.subs[s].name);return r.id=i.id,r.name=i.name,r},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),!0]}),t},dump:function(t){var i,r,s,o,n=[],a=[],h=[],l=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),i=0;i<l;i++)if(r=t.objectsList[i],s={},!r.dumped&&r.dump){for(s.type=r.getType(),s.parents=r.getParents().slice(),"point"===s.type&&1===s.parents[0]&&(s.parents=s.parents.slice(1)),o=0;o<s.parents.length;o++)e.isString(s.parents[o])&&"'"!==s.parents[o][0]&&'"'!==s.parents[o][0]?s.parents[o]='"'+s.parents[o]+'"':e.isArray(s.parents[o])&&(s.parents[o]="["+s.parents[o].toString()+"]");s.attributes=this.prepareAttributes(t,r),"glider"===s.type&&r.onPolygon&&n.push({obj:r.id,prop:"onPolygon",val:!0}),h.push(s)}return this.deleteMarkers(t,"dumped"),{elements:h,props:n,methods:a}},arrayToParamStr:function(t,e){var i,r=[];for(i=0;i<t.length;i++)r.push(e.call(this,t[i]));return r.join(", ")},toJCAN:function(t){var i,r,s;switch(typeof t){case"object":if(t){if(r=[],e.isArray(t)){for(i=0;i<t.length;i++)r.push(this.toJCAN(t[i]));return"["+r.join(",")+"]"}for(s in t)t.hasOwnProperty(s)&&r.push(s+": "+this.toJCAN(t[s]));return"<<"+r.join(", ")+">> "}return"null";case"string":return"'"+t.replace(/(["'])/g,"\\$1Line truncated